1 #ifndef __DISPATCHER_H__
2 #define __DISPATCHER_H__
15 class AbstractBoxItem;
22 class FunctionalBlock;
30 * \brief The Dispatcher class
31 * The Dispatcher class represents the control part (in MVC) of the application. It relays
32 * user's interactions with the GUI into model's modifications and feeds back them onto the view.
37 Dispatcher(Parameters* _params,
40 GroupWidget* loadProject(const QString& filename);
42 inline int getNumberOfScenes() { return groupList.length(); }
44 void unselectAllItems(int direction=0);
45 void setCurrentGroupWidget(GroupWidget *win);
46 void changeConnectionMode(int mode = -1);
49 GroupWidget* createTopScene();
50 GroupWidget* createChildScene(GroupWidget* parentWidget, BoxItem* upperItemOfGroupItem = NULL);
51 void destroyScene(GroupScene* scene);
52 void showRaiseWindow(BoxItem *item);
53 void showRstClkIface(AbstractBoxItem *item);
54 void showWishboneIface(AbstractBoxItem *item);
55 GroupWidget *addNewEmptyGroup(GroupScene *scene, bool show = true);
56 void addNewFullGroup();
58 inline GroupWidget* getCurrentGroup() { return currentGroup; }
60 inline void setSceneCounter(int value) { sceneCounter = value;}
62 bool isCurrentProject;
65 QMap<int, QString> getAllGroupNames();
66 GroupScene* getSceneById(int id);
67 GroupScene* getSceneByName(QString name);
68 BoxItem* getBoxItemById(int id);
69 GroupItem* getGroupItemById(int id);
70 InterfaceItem* getInterfaceItemById(int id);
74 void addBlock(int idCategory, int idBlock, int idScene);
75 void removeBoxItem(BoxItem* item);
76 void duplicateBoxItem(BoxItem* item);
77 void renameFunctionalBlock(BoxItem* item);
78 void renameGroupBlock(GroupItem* item);
79 void renameSourceBlock(SourceItem* item);
80 void removeSourceItem(SourceItem* item);
81 void duplicateSourceItem(SourceItem* item);
85 * \brief connectInterToGroup
86 * \param item item is always owned by a BoxItem
88 * This method is called only when the user right clicks on an InterfaceItem (that belongs
89 * to a BoxItem and if it is NOT connected to an InterfaceItem of the GroupItem) and chooses
90 * connect to group in the contextual menu.
91 * Thus, parameter item is always owned by a BoxItem
93 void connectInterToGroup(InterfaceItem* item);
95 * \brief removeFunctionalInterface
96 * \param item item is always owned by a BoxItem
98 * This method is called only when the user right clicks on an InterfaceItem (that belongs
99 * to a BoxItem that represents a functional block and has a multiplicity > 1) and chooses remove in the contextual menu.
100 * Thus, parameter item is always owned by a BoxItem
102 void removeFunctionalInterface(InterfaceItem* item);
104 * \brief removeGroupInterface
105 * \param item item is always owned by a GroupItem
107 * This method is called only when the user right clicks on an InterfaceItem (that belongs
108 * to a GroupItem and if it is connected only to an inner interface) and chooses remove in the contextual menu.
109 * Thus, parameter item is always owned by a GroupItem
111 void removeGroupInterface(InterfaceItem* item);
112 void duplicateInterfaceItem(InterfaceItem* item);
113 void showProperties(InterfaceItem *inter);
114 void renameInterface(InterfaceItem* item);
117 bool createConnection(InterfaceItem *iface1, InterfaceItem *iface2);
118 void removeAllBlockConnections(AbstractBoxItem *item);
119 void removeConnection(ConnectionItem *conn);
123 void showBlocksLibrary();
126 void closeCurrentProject();
133 // attributes that corresponds to the views
134 MainWindow* mainWindow;
135 QList<GroupWidget*> groupList;
136 GroupWidget* currentGroup;
137 GroupWidget *topGroup;
139 static int sceneCounter;
142 #endif // __DISPATCHER_H__