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 BoxItem* addBlock(int idCategory, int idBlock, int idScene);
75 void removeBoxItem(BoxItem* item);
76 void duplicateBoxItem(BoxItem* item);
77 void renameFunctionalBlock(BoxItem* item);
78 void generateBlockVHDL(BoxItem* item);
79 void renameGroupBlock(GroupItem* item);
80 void renameSourceBlock(SourceItem* item);
81 void removeSourceItem(SourceItem* item);
82 void duplicateSourceItem(SourceItem* item);
87 * \brief connectInterToGroup
88 * \param item item is always owned by a BoxItem
90 * This method is called only when the user right clicks on an InterfaceItem (that belongs
91 * to a BoxItem and if it is NOT connected to an InterfaceItem of the GroupItem) and chooses
92 * connect to group in the contextual menu.
93 * Thus, parameter item is always owned by a BoxItem
95 void connectInterToGroup(InterfaceItem* item);
97 * \brief removeFunctionalInterface
98 * \param item item is always owned by a BoxItem
100 * This method is called only when the user right clicks on an InterfaceItem (that belongs
101 * to a BoxItem that represents a functional block and has a multiplicity > 1) and chooses remove in the contextual menu.
102 * Thus, parameter item is always owned by a BoxItem
104 void removeFunctionalInterface(InterfaceItem* item);
106 * \brief removeGroupInterface
107 * \param item item is always owned by a GroupItem
109 * This method is called only when the user right clicks on an InterfaceItem (that belongs
110 * to a GroupItem and if it is connected only to an inner interface) and chooses remove in the contextual menu.
111 * Thus, parameter item is always owned by a GroupItem
113 void removeGroupInterface(InterfaceItem* item);
114 void duplicateInterfaceItem(InterfaceItem* item);
115 void showProperties(InterfaceItem *inter);
116 void renameInterface(InterfaceItem* item);
117 void showPatterns(InterfaceItem* item);
118 void showModifier(InterfaceItem* item);
119 void removeModifier(InterfaceItem* item);
122 bool createConnection(InterfaceItem *iface1, InterfaceItem *iface2);
123 void removeAllBlockConnections(AbstractBoxItem *item);
124 void removeConnection(ConnectionItem *conn);
128 void findGraphModifications(FunctionalBlock* block); // find modif so that block has compatible inputs
131 void showBlocksLibrary();
134 void closeCurrentProject();
141 // attributes that corresponds to the views
142 MainWindow* mainWindow;
143 QList<GroupWidget*> groupList;
144 GroupWidget* currentGroup;
145 GroupWidget *topGroup;
147 static int sceneCounter;
150 #endif // __DISPATCHER_H__