1 #ifndef __DISPATCHER_H__
2 #define __DISPATCHER_H__
15 class AbstractBoxItem;
22 class FunctionalBlock;
23 #include "Exception.h"
32 * \brief The Dispatcher class
33 * The Dispatcher class represents the control part (in MVC) of the application. It relays
34 * user's interactions with the GUI into model's modifications and feeds back them onto the view.
39 Dispatcher(Parameters* _params,
42 GroupWidget* loadProject(const QString& filename);
44 inline int getNumberOfScenes() { return groupList.length(); }
46 void unselectAllItems(int direction=0);
47 void setCurrentGroupWidget(GroupWidget *win);
48 void changeConnectionMode(int mode = -1);
51 GroupWidget* createTopScene();
52 GroupWidget* createChildScene(GroupWidget* parentWidget, BoxItem* upperItemOfGroupItem = NULL);
53 void destroyScene(GroupScene* scene);
54 void showRaiseWindow(BoxItem *item);
55 void showRstClkIface(AbstractBoxItem *item);
56 void showWishboneIface(AbstractBoxItem *item);
57 GroupWidget *addNewEmptyGroup(GroupScene *scene, bool show = true);
58 void addNewFullGroup();
60 inline GroupWidget* getCurrentGroup() { return currentGroup; }
62 inline void setSceneCounter(int value) { sceneCounter = value;}
64 bool isCurrentProject;
69 QMap<int, QString> getAllGroupNames();
70 void generateVHDL() throw(Exception);
73 GroupScene* getSceneById(int id);
74 GroupScene* getSceneByName(QString name);
75 BoxItem* getBoxItemById(int id);
76 GroupItem* getGroupItemById(int id);
77 InterfaceItem* getInterfaceItemById(int id);
81 BoxItem* addBlock(int idCategory, int idBlock, int idScene);
82 void removeBoxItem(BoxItem* item);
83 void duplicateBoxItem(BoxItem* item);
84 void renameFunctionalBlock(BoxItem* item);
85 void generateBlockVHDL(BoxItem* item);
86 void renameGroupBlock(GroupItem* item);
87 void renameSourceBlock(SourceItem* item);
88 void removeSourceItem(SourceItem* item);
89 void duplicateSourceItem(SourceItem* item);
94 * \brief connectInterToGroup
95 * \param item item is always owned by a BoxItem
97 * This method is called only when the user right clicks on an InterfaceItem (that belongs
98 * to a BoxItem and if it is NOT connected to an InterfaceItem of the GroupItem) and chooses
99 * connect to group in the contextual menu.
100 * Thus, parameter item is always owned by a BoxItem
102 void connectInterToGroup(InterfaceItem* item);
104 * \brief removeFunctionalInterface
105 * \param item item is always owned by a BoxItem
107 * This method is called only when the user right clicks on an InterfaceItem (that belongs
108 * to a BoxItem that represents a functional block and has a multiplicity > 1) and chooses remove in the contextual menu.
109 * Thus, parameter item is always owned by a BoxItem
111 void removeFunctionalInterface(InterfaceItem* item);
113 * \brief removeGroupInterface
114 * \param item item is always owned by a GroupItem
116 * This method is called only when the user right clicks on an InterfaceItem (that belongs
117 * to a GroupItem and if it is connected only to an inner interface) and chooses remove in the contextual menu.
118 * Thus, parameter item is always owned by a GroupItem
120 void removeGroupInterface(InterfaceItem* item);
121 void duplicateInterfaceItem(InterfaceItem* item);
122 void showProperties(InterfaceItem *inter);
123 void renameInterface(InterfaceItem* item);
124 void showPatterns(InterfaceItem* item);
125 void showModifier(InterfaceItem* item);
126 void removeModifier(InterfaceItem* item);
129 bool createConnection(InterfaceItem *iface1, InterfaceItem *iface2, bool visible = true);
130 void removeAllBlockConnections(AbstractBoxItem *item);
131 void removeConnection(ConnectionItem *conn);
135 void findGraphModifications(FunctionalBlock* block); // find modif so that block has compatible inputs
138 void showBlocksLibrary();
141 void closeCurrentProject();
148 // attributes that corresponds to the views
149 MainWindow* mainWindow;
150 QList<GroupWidget*> groupList;
151 GroupWidget* currentGroup;
152 GroupWidget *topGroup;
154 static int sceneCounter;
157 #endif // __DISPATCHER_H__