1 #ifndef __DISPATCHER_H__
2 #define __DISPATCHER_H__
15 class AbstractBoxItem;
29 Dispatcher(Parameters* _params,
32 GroupWidget* loadProject(const QString& filename);
34 inline int getNumberOfScenes() { return groupList.length(); }
35 bool connect(InterfaceItem *iface1, InterfaceItem *iface2);
36 void checkSelection();
37 void unselectAllItems(int direction=0);
38 void setCurrentGroupWidget(GroupWidget *win);
39 void changeConnectionMode(int mode = -1);
42 GroupWidget* createTopScene();
43 GroupWidget* createChildScene(GroupWidget* parentWidget, BoxItem* upperItemOfGroupItem = NULL);
44 void destroyScene(GroupScene* scene);
45 void showRaiseWindow(BoxItem *item);
46 void showRstClkIface(AbstractBoxItem *item);
47 void showWishboneIface(AbstractBoxItem *item);
48 GroupWidget *addNewEmptyGroup(GroupScene *scene, bool show = true);
49 void addNewFullGroup();
51 inline GroupWidget* getCurrentGroup() { return currentGroup; }
53 inline void setSceneCounter(int value) { sceneCounter = value;}
55 bool isCurrentProject;
58 QMap<int, QString> getAllGroupNames();
59 GroupScene* searchSceneById(int id);
60 GroupScene* searchSceneByName(QString name);
61 BoxItem* searchBlockItemById(int id);
62 GroupItem* searchGroupItemById(int id);
63 InterfaceItem* searchInterfaceItemById(int id);
66 void addBlock(int idCategory, int idBlock, int idScene);
67 void removeBlock(BoxItem* item);
68 void duplicateBlock(BoxItem* item);
69 void renameBlockOrGroup(AbstractBoxItem* item);
73 * \brief connectInterToGroup
74 * \param item item is always owned by a BoxItem
76 * This method is called only when the user right clicks on an InterfaceItem (that belongs
77 * to a BoxItem and if it is NOT connected to an InterfaceItem of the GroupItem) and chooses
78 * connect to group in the contextual menu.
79 * Thus, parameter item is always owned by a BoxItem
81 void connectInterToGroup(InterfaceItem* item);
83 * \brief disconnectInterFromGroup
84 * \param item item is always owned by a BoxItem
86 * This method is called only when the user right clicks on an InterfaceItem (that belongs
87 * to a BoxItem and if it IS connected to an InterfaceItem of the GroupItem) and chooses
88 * disconnect from group in the contextual menu.
89 * Thus, parameter item is always owned by a BoxItem
91 void disconnectInterFromGroup(InterfaceItem* item);
93 * \brief removeFunctionalInterface
94 * \param item item is always owned by a BoxItem
96 * This method is called only when the user right clicks on an InterfaceItem (that belongs
97 * to a BoxItem that represents a functional block and has a multiplicity > 1) and chooses remove in the contextual menu.
98 * Thus, parameter item is always owned by a BoxItem
100 void removeFunctionalInterface(InterfaceItem* item);
102 * \brief removeGroupInterface
103 * \param item item is always owned by a GroupItem
105 * This method is called only when the user right clicks on an InterfaceItem (that belongs
106 * to a GroupItem and if it is connected only to an inner interface) and chooses remove in the contextual menu.
107 * Thus, parameter item is always owned by a GroupItem
109 void removeGroupInterface(InterfaceItem* item);
110 void duplicateInterface(InterfaceItem* item);
111 void showProperties(InterfaceItem *inter);
112 void renameInterface(InterfaceItem* item);
115 ConnectionItem *addConnection(InterfaceItem *input, InterfaceItem *output);
116 void removeAllBlockConnections(BoxItem *item);
117 void removeConnection(ConnectionItem *conn);
121 void showBlocksLibrary();
124 void closeCurrentProject();
131 // attributes that corresponds to the views
132 MainWindow* mainWindow;
133 QList<GroupWidget*> groupList;
134 GroupWidget* currentGroup;
135 GroupWidget *topGroup;
137 static int sceneCounter;
140 #endif // __DISPATCHER_H__