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 QVDesignerGUI;
00039
00040 #ifndef DOXYGEN_IGNORE_THIS
00041
00042
00043 class SlateWindow : public QMainWindow
00044 {
00045 Q_OBJECT
00046
00047 public:
00048 SlateWindow(QVDesignerGUI *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 void includeItemType(QString itemType);
00058 void arrangeItems();
00059
00060 public slots:
00061 void showProperties();
00062 void showProperties(Node *node);
00063 void showMessage(QString message);
00064
00065 private slots:
00066 void del();
00067 void join();
00068 void bringToFront();
00069 void sendToBack();
00070 void updateActions();
00071 void insertItem(QString type);
00072 void run();
00073 void stop();
00074 bool saveAs();
00075
00076 signals:
00078 void closed();
00079
00080 private:
00081 typedef QPair<Node *, Node *> NodePair;
00082
00083 QPoint startPos;
00084
00085 void createMenus();
00086 void createToolBars();
00087 void setZValue(int z);
00088 void setupNode(Node *node);
00089 Node *selectedNode() const;
00090 Link *selectedLink() const;
00091 NodePair selectedNodePair() const;
00092 QList<QGraphicsItem *> selectedNodeGroup() const;
00093 QList<QGraphicsItem *> onlyParents(QList<QGraphicsItem *> items) const;
00094 bool saveFile(const QString &fileName);
00095 bool writeCppFile(const QString &fileName);
00096 int precursors(ItemNode *node);
00097
00098 QMenu *fileMenu;
00099 QMenu *editMenu;
00100 QMenu *insertMenu;
00101 QToolBar *editToolBar;
00102 QAction *exitAction;
00103 QAction *addSLinkAction;
00104 QAction *addALinkAction;
00105 QActionGroup *linkGroup;
00106 QAction *joinAction;
00107 QAction *deleteAction;
00108 QAction *bringToFrontAction;
00109 QAction *sendToBackAction;
00110 QAction *propertiesAction;
00111 QAction *runAction;
00112 QAction *stopAction;
00113 QAction *saveAsAction;
00114
00115 QStatusBar *statusbar;
00116
00117 QGraphicsScene *scene;
00118 SlateView *view;
00119 QVDesignerGUI *designer;
00120
00121 int minZ;
00122 int maxZ;
00123 int seqNumber;
00124
00125 QMap<QString, ItemNode *> insertNodes;
00126 QMap<QString, QPointF> insertNodesPos;
00127 QMap<QString, Link *> insertLinks;
00128 };
00129
00130 #endif
00131 #endif