class AbstractBoxItem;
class GroupItem;
class BoxItem;
+class SourceItem;
class ConnectionItem;
class InterfaceItem;
+class GroupBlock;
+class FunctionalBlock;
using namespace std;
using namespace Qt;
+/*!
+ * \brief The Dispatcher class
+ * The Dispatcher class represents the control part (in MVC) of the application. It relays
+ * user's interactions with the GUI into model's modifications and feeds back them onto the view.
+ */
class Dispatcher {
public:
GroupWidget* loadProject(const QString& filename);
inline int getNumberOfScenes() { return groupList.length(); }
- bool connect(InterfaceItem *iface1, InterfaceItem *iface2);
- void checkSelection();
+
void unselectAllItems(int direction=0);
void setCurrentGroupWidget(GroupWidget *win);
void changeConnectionMode(int mode = -1);
- void rename(AbstractBoxItem* item);
- void rename(InterfaceItem* item);
+
+
GroupWidget* createTopScene();
GroupWidget* createChildScene(GroupWidget* parentWidget, BoxItem* upperItemOfGroupItem = NULL);
- void showRaiseWindow(AbstractBoxItem *item);
- void showRstClkInter(AbstractBoxItem *item);
- void addNewEmptyGroup();
+ void destroyScene(GroupScene* scene);
+ void showRaiseWindow(BoxItem *item);
+ void showRstClkIface(AbstractBoxItem *item);
+ void showWishboneIface(AbstractBoxItem *item);
+ GroupWidget *addNewEmptyGroup(GroupScene *scene, bool show = true);
void addNewFullGroup();
inline GroupWidget* getCurrentGroup() { return currentGroup; }
+ inline void setSceneCounter(int value) { sceneCounter = value;}
+
bool isCurrentProject;
public slots:
QMap<int, QString> getAllGroupNames();
- GroupScene* searchSceneById(int id);
- GroupScene* searchSceneByName(QString name);
- BoxItem* searchBlockItemById(int id);
- GroupItem* searchGroupItemById(int id);
- InterfaceItem* searchInterfaceItemById(int id);
-
- void removeBlock(AbstractBoxItem* item);
- void duplicateBlock(BoxItem* item);
- void duplicateInterface(InterfaceItem* item);
+ GroupScene* getSceneById(int id);
+ GroupScene* getSceneByName(QString name);
+ BoxItem* getBoxItemById(int id);
+ GroupItem* getGroupItemById(int id);
+ InterfaceItem* getInterfaceItemById(int id);
+
+
+ // block ops
void addBlock(int idCategory, int idBlock, int idScene);
- ConnectionItem *addConnection(InterfaceItem *input, InterfaceItem *output);
- void removeAllBlockConnections(AbstractBoxItem *block);
- void removeConnection(ConnectionItem *conn);
- void removeUselessGroupInterfaces();
- void showBlocksLibrary();
- void showProperties(InterfaceItem *inter);
+ void removeBoxItem(BoxItem* item);
+ void duplicateBoxItem(BoxItem* item);
+ void renameFunctionalBlock(BoxItem* item);
+ void renameGroupBlock(GroupItem* item);
+ void renameSourceBlock(SourceItem* item);
+ void removeSourceItem(SourceItem* item);
+ void duplicateSourceItem(SourceItem* item);
+
+ // interface ops
+ /*!
+ * \brief connectInterToGroup
+ * \param item item is always owned by a BoxItem
+ *
+ * This method is called only when the user right clicks on an InterfaceItem (that belongs
+ * to a BoxItem and if it is NOT connected to an InterfaceItem of the GroupItem) and chooses
+ * connect to group in the contextual menu.
+ * Thus, parameter item is always owned by a BoxItem
+ */
void connectInterToGroup(InterfaceItem* item);
+ /*!
+ * \brief disconnectInterFromGroup
+ * \param item item is always owned by a BoxItem
+ *
+ * This method is called only when the user right clicks on an InterfaceItem (that belongs
+ * to a BoxItem and if it IS connected to an InterfaceItem of the GroupItem) and chooses
+ * disconnect from group in the contextual menu.
+ * Thus, parameter item is always owned by a BoxItem
+ */
void disconnectInterFromGroup(InterfaceItem* item);
+ /*!
+ * \brief removeFunctionalInterface
+ * \param item item is always owned by a BoxItem
+ *
+ * This method is called only when the user right clicks on an InterfaceItem (that belongs
+ * to a BoxItem that represents a functional block and has a multiplicity > 1) and chooses remove in the contextual menu.
+ * Thus, parameter item is always owned by a BoxItem
+ */
+ void removeFunctionalInterface(InterfaceItem* item);
+ /*!
+ * \brief removeGroupInterface
+ * \param item item is always owned by a GroupItem
+ *
+ * This method is called only when the user right clicks on an InterfaceItem (that belongs
+ * to a GroupItem and if it is connected only to an inner interface) and chooses remove in the contextual menu.
+ * Thus, parameter item is always owned by a GroupItem
+ */
void removeGroupInterface(InterfaceItem* item);
+ void duplicateInterfaceItem(InterfaceItem* item);
+ void showProperties(InterfaceItem *inter);
+ void renameInterface(InterfaceItem* item);
+
+ // connection ops
+ bool createConnectionItem(InterfaceItem *iface1, InterfaceItem *iface2);
+ void removeAllBlockConnections(AbstractBoxItem *item);
+ void removeConnection(ConnectionItem *conn);
+
+
+ // others
+ void showBlocksLibrary();
- void addConnection();
void closeCurrentProject();