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 showRstClkInter(AbstractBoxItem *item);
47 GroupWidget *addNewEmptyGroup(GroupScene *scene, bool show = true);
48 void addNewFullGroup();
50 inline GroupWidget* getCurrentGroup() { return currentGroup; }
52 inline void setSceneCounter(int value) { sceneCounter = value;}
54 bool isCurrentProject;
57 QMap<int, QString> getAllGroupNames();
58 GroupScene* searchSceneById(int id);
59 GroupScene* searchSceneByName(QString name);
60 BoxItem* searchBlockItemById(int id);
61 GroupItem* searchGroupItemById(int id);
62 InterfaceItem* searchInterfaceItemById(int id);
65 void addBlock(int idCategory, int idBlock, int idScene);
66 void removeBlock(BoxItem* item);
67 void duplicateBlock(BoxItem* item);
68 void renameBlockOrGroup(AbstractBoxItem* item);
72 * \brief connectInterToGroup
73 * \param item item is always owned by a BoxItem
75 * This method is called only when the user right clicks on an InterfaceItem (that belongs
76 * to a BoxItem and if it is NOT connected to an InterfaceItem of the GroupItem) and chooses
77 * connect to group in the contextual menu.
78 * Thus, parameter item is always owned by a BoxItem
80 void connectInterToGroup(InterfaceItem* item);
82 * \brief disconnectInterFromGroup
83 * \param item item is always owned by a BoxItem
85 * This method is called only when the user right clicks on an InterfaceItem (that belongs
86 * to a BoxItem and if it IS connected to an InterfaceItem of the GroupItem) and chooses
87 * disconnect from group in the contextual menu.
88 * Thus, parameter item is always owned by a BoxItem
90 void disconnectInterFromGroup(InterfaceItem* item);
92 * \brief removeBlockInterface
93 * \param item item is always owned by a BoxItem
95 * This method is called only when the user right clicks on an InterfaceItem (that belongs
96 * to a BoxItem and has a multiplicity > 1) and chooses remove in the contextual menu.
97 * Thus, parameter item is always owned by a BoxItem
99 void removeBlockInterface(InterfaceItem* item);
101 * \brief removeGroupInterface
102 * \param item item is always owned by a GroupItem
104 * This method is called only when the user right clicks on an InterfaceItem (that belongs
105 * to a GroupItem and if it is connected only to an inner interface) and chooses remove in the contextual menu.
106 * Thus, parameter item is always owned by a GroupItem
108 void removeGroupInterface(InterfaceItem* item);
109 void duplicateInterface(InterfaceItem* item);
110 void showProperties(InterfaceItem *inter);
111 void renameInterface(InterfaceItem* item);
114 ConnectionItem *addConnection(InterfaceItem *input, InterfaceItem *output);
115 void removeAllBlockConnections(BoxItem *item);
116 void removeConnection(ConnectionItem *conn);
120 void showBlocksLibrary();
123 void closeCurrentProject();
130 // attributes that corresponds to the views
131 MainWindow* mainWindow;
132 QList<GroupWidget*> groupList;
133 GroupWidget* currentGroup;
134 GroupWidget *topGroup;
136 static int sceneCounter;
139 #endif // __DISPATCHER_H__