dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
connectiondiagram.h
Go to the documentation of this file.
1 
13 /*
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 3 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful, but
20  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  * for more details.
23  *
24  * You should have received a copy of the GNU General Public License along
25  * with this program; if not, see <http://www.gnu.org/licenses/>
26  *
27  * Additional note on redistribution: The copyright and license notices above
28  * must be maintained in each individual source file that is a derivative work
29  * of this source file; otherwise redistribution is prohibited.
30  */
31 
32 #ifndef CONNECTIONDIAGRAM_H
33 #define CONNECTIONDIAGRAM_H
34 
36 
37 #include <QDialog>
38 #include <QHash>
39 #include <QSvgRenderer>
40 #include <QGraphicsSvgItem>
41 
42 class UAVObject;
43 class UAVObjectManager;
45 namespace Ui {
46  class ConnectionDiagram;
47 }
48 
49 class UAVOBJECTWIDGETUTILS_EXPORT ConnectionDiagram : public QDialog
50 {
51  Q_OBJECT
52 
53 public:
54  explicit ConnectionDiagram(QWidget *parent = nullptr);
56 
57 protected:
58  void resizeEvent(QResizeEvent *event);
59  void showEvent(QShowEvent *event);
60 
61 private:
62  Ui::ConnectionDiagram *ui;
63 
64  QSvgRenderer *m_renderer;
65  QGraphicsSvgItem *m_background;
66  QGraphicsScene *m_scene;
67 
68  UAVObjectManager *uavoMngr;
69  UAVObjectUtilManager *utilMngr;
70 
71  const QString ENUM_SPECIAL_CHARS = "[\\.\\-\\s\\+/\\(\\)]";
72 
73  void setupGraphicsScene();
74  void setupGraphicsSceneItems(QStringList elementsToShow);
75  void addUavoFieldElements(QStringList &elements, UAVObject *obj, const QString &prefix = "");
76 
77 private slots:
78  void saveToFile();
79 };
80 
81 #endif // CONNECTIONDIAGRAM_H
82