00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef SLATEWINDOW_H
00022 #define SLATEWINDOW_H
00023
00024 #include <QMainWindow>
00025 #include <QCloseEvent>
00026 #include <QPair>
00027 #include <QAction>
00028
00029
00030 class QGraphicsItem;
00031 class QGraphicsScene;
00032 class QGraphicsView;
00033 class Link;
00034 class Node;
00035 class ItemNode;
00036 class ItemProperties;
00037 class SlateView;
00038 class DesignerGUI;
00039
00040 #ifndef DOXYGEN_IGNORE_THIS
00041
00042
00043 class SlateWindow : public QMainWindow
00044 {
00045 Q_OBJECT
00046
00047 public:
00048 SlateWindow(DesignerGUI *desig, QWidget * parent = 0);
00049 bool createLink(Node *fromNode, int fromPoint, Node *toNode, int toPoint);
00050 void addLinkLine(QString fromNode, QString fromProp, QString toNode, QString toProp, bool sinc);
00051 void delLinkLine(QString fromNode, QString fromProp, QString toNode, QString toProp);
00052 void addItemNode(QString type, QString name, ItemProperties *item);
00053 void delItemNode(QString name);
00054 void addProperty(QString srcName, QString propName, int type, bool in, bool out);
00055 void delProperty(QString srcName, QString propName);
00056 void closeEvent(QCloseEvent *event);
00057
00058 public slots:
00059 void showProperties();
00060 void showProperties(Node *node);
00061
00062 private slots:
00063 void del();
00064 void join();
00065 void bringToFront();
00066 void sendToBack();
00067 void updateActions();
00068 void insertItem(QString type);
00069 void run();
00070 void stop();
00071
00072 signals:
00074 void closed();
00075
00076 private:
00077 typedef QPair<Node *, Node *> NodePair;
00078
00079 QPoint startPos;
00080
00081 void createMenus();
00082 void createToolBars();
00083 void setZValue(int z);
00084 void setupNode(Node *node);
00085 Node *selectedNode() const;
00086 Link *selectedLink() const;
00087 NodePair selectedNodePair() const;
00088 QList<QGraphicsItem *> selectedNodeGroup() const;
00089 QList<QGraphicsItem *> onlyParents(QList<QGraphicsItem *> items) const;
00090
00091 QMenu *fileMenu;
00092 QMenu *editMenu;
00093 QMenu *insertMenu;
00094 QToolBar *editToolBar;
00095 QAction *exitAction;
00096 QAction *addSLinkAction;
00097 QAction *addALinkAction;
00098 QActionGroup *linkGroup;
00099 QAction *joinAction;
00100 QAction *deleteAction;
00101 QAction *bringToFrontAction;
00102 QAction *sendToBackAction;
00103 QAction *propertiesAction;
00104 QAction *runAction;
00105 QAction *stopAction;
00106
00107 QGraphicsScene *scene;
00108 SlateView *view;
00109 DesignerGUI *designer;
00110
00111 int minZ;
00112 int maxZ;
00113 int seqNumber;
00114
00115 QMap<QString, ItemNode *> insertNodes;
00116 QMap<QString, QPointF> insertNodesPos;
00117 QMap<QString, Link *> insertLinks;
00118 };
00119
00120 #endif
00121 #endif