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 disconnectInterFromGroup
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 and if it IS connected to an InterfaceItem of the GroupItem) and chooses
100 * disconnect from group in the contextual menu.
101 * Thus, parameter item is always owned by a BoxItem
103 void disconnectInterFromGroup(InterfaceItem* item);
105 * \brief removeFunctionalInterface
106 * \param item item is always owned by a BoxItem
108 * This method is called only when the user right clicks on an InterfaceItem (that belongs
109 * to a BoxItem that represents a functional block and has a multiplicity > 1) and chooses remove in the contextual menu.
110 * Thus, parameter item is always owned by a BoxItem
112 void removeFunctionalInterface(InterfaceItem* item);
114 * \brief removeGroupInterface
115 * \param item item is always owned by a GroupItem
117 * This method is called only when the user right clicks on an InterfaceItem (that belongs
118 * to a GroupItem and if it is connected only to an inner interface) and chooses remove in the contextual menu.
119 * Thus, parameter item is always owned by a GroupItem
121 void removeGroupInterface(InterfaceItem* item);
122 void duplicateInterfaceItem(InterfaceItem* item);
123 void showProperties(InterfaceItem *inter);
124 void renameInterface(InterfaceItem* item);
127 bool createConnectionItem(InterfaceItem *iface1, InterfaceItem *iface2);
128 void removeAllBlockConnections(AbstractBoxItem *item);
129 void removeConnection(ConnectionItem *conn);
133 void showBlocksLibrary();
136 void closeCurrentProject();
143 // attributes that corresponds to the views
144 MainWindow* mainWindow;
145 QList<GroupWidget*> groupList;
146 GroupWidget* currentGroup;
147 GroupWidget *topGroup;
149 static int sceneCounter;
152 #endif // __DISPATCHER_H__