itom  4.1.0
dialogProperties.h
1 /* ********************************************************************
2  itom software
3  URL: http://www.uni-stuttgart.de/ito
4  Copyright (C) 2020, Institut fuer Technische Optik (ITO),
5  Universitaet Stuttgart, Germany
6 
7  This file is part of itom.
8 
9  itom is free software; you can redistribute it and/or modify it
10  under the terms of the GNU Library General Public Licence as published by
11  the Free Software Foundation; either version 2 of the Licence, or (at
12  your option) any later version.
13 
14  itom is distributed in the hope that it will be useful, but
15  WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
17  General Public Licence for more details.
18 
19  You should have received a copy of the GNU Library General Public License
20  along with itom. If not, see <http://www.gnu.org/licenses/>.
21 *********************************************************************** */
22 
23 #ifndef DIALOGPROPERTIES_H
24 #define DIALOGPROPERTIES_H
25 
26 #include "abstractPropertyPageWidget.h"
27 
28 #include <QtGui>
29 #include <qdialog.h>
30 #include <qmap.h>
31 #include <qtreewidget.h>
32 #include <qstringlist.h>
33 #include <qstackedwidget.h>
34 #include <qsplitter.h>
35 #include <qdialogbuttonbox.h>
36 #include <qlayout.h>
37 #include <qlabel.h>
38 
39 namespace ito
40 {
41 
42 class DialogProperties : public QDialog
43 {
44  Q_OBJECT
45 
46 public:
47 
48  struct PropertyPage
49  {
50  PropertyPage() : m_widget(NULL), m_icon(), m_visited(false) {}
51  PropertyPage(QString name, QString title, QString fullname,
52  AbstractPropertyPageWidget* widget, QIcon icon) : m_title(title),
53  m_name(name), m_fullname(fullname), m_widget(widget),
54  m_icon(icon), m_visited(false) {}
55  QString m_title;
56  QString m_name;
57  QString m_fullname;
59  QIcon m_icon;
60  bool m_visited;
61  };
62 
63  DialogProperties(QWidget * parent = 0, Qt::WindowFlags f = 0);
65 
66  bool selectTabByKey(QString &key, QTreeWidgetItem *parent = NULL);
67 
68 protected:
69  void initPages();
70 
71  void addPage(PropertyPage page, QTreeWidgetItem *parent, QStringList remainingPathes);
72 
73 private:
74  QStackedWidget *m_pStackedWidget;
75  QSplitter *m_pSplitter;
76  QTreeWidget *m_pCategories;
77  QDialogButtonBox *m_pButtonBox;
78 
79  QHBoxLayout *m_pHorizontalLayout;
80  QVBoxLayout *m_pVerticalLayout;
81 
82  QLabel *m_pPageTitle;
83  QFrame *m_pLine;
84  QWidget *m_pEmptyPage;
85 
86  QString m_CurrentPropertyKey;
87 
88  QMap<QString, PropertyPage> m_pages;
89 
90 signals:
91  void propertiesChanged();
92 
93 public slots:
94 
95 private slots:
96  void categoryChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
97  void accepted();
98  void rejected();
99  void apply();
100 };
101 
102 } //end namespace ito
103 
104 #endif
Definition: abstractPropertyPageWidget.h:31
Definition: apiFunctionsGraph.cpp:39
Definition: dialogProperties.h:48
Definition: dialogProperties.h:42