itom 2.0.0
D:/git-itom/sources/itom/Qitom/ui/dialogProperties.h
00001 /* ********************************************************************
00002     itom software
00003     URL: http://www.uni-stuttgart.de/ito
00004     Copyright (C) 2013, Institut für Technische Optik (ITO),
00005     Universität Stuttgart, Germany
00006 
00007     This file is part of itom.
00008   
00009     itom is free software; you can redistribute it and/or modify it
00010     under the terms of the GNU Library General Public Licence as published by
00011     the Free Software Foundation; either version 2 of the Licence, or (at
00012     your option) any later version.
00013 
00014     itom is distributed in the hope that it will be useful, but
00015     WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library
00017     General Public Licence for more details.
00018 
00019     You should have received a copy of the GNU Library General Public License
00020     along with itom. If not, see <http://www.gnu.org/licenses/>.
00021 *********************************************************************** */
00022 
00023 #ifndef DIALOGPROPERTIES_H
00024 #define DIALOGPROPERTIES_H
00025 
00026 #include "abstractPropertyPageWidget.h"
00027 
00028 #include <QtGui>
00029 #include <qdialog.h>
00030 #include <qmap.h>
00031 #include <qtreewidget.h>
00032 #include <qstringlist.h>
00033 #include <qstackedwidget.h>
00034 #include <qsplitter.h>
00035 #include <qdialogbuttonbox.h>
00036 #include <qlayout.h>
00037 #include <qlabel.h>
00038 
00039 namespace ito
00040 {
00041 
00042 class DialogProperties : public QDialog
00043 {
00044     Q_OBJECT
00045 
00046 public:
00047 
00048     struct PropertyPage
00049     {
00050         PropertyPage() : m_widget(NULL), m_icon(), m_visited(false) {}
00051         PropertyPage(QString name, QString title, QString fullname, AbstractPropertyPageWidget* widget, QIcon icon) : m_title(title), m_name(name), m_fullname(fullname), m_widget(widget), m_icon(icon), m_visited(false) {}
00052         QString m_title;
00053         QString m_name;
00054         QString m_fullname;
00055         AbstractPropertyPageWidget* m_widget;
00056         QIcon m_icon;
00057         bool m_visited;
00058     };
00059 
00060     DialogProperties(QWidget * parent = 0, Qt::WindowFlags f = 0);
00061     ~DialogProperties();
00062 
00063     bool selectTabByKey(QString &key, QTreeWidgetItem *parent = NULL);
00064 
00065 protected:
00066     void initPages();
00067 
00068     void addPage(PropertyPage page, QTreeWidgetItem *parent, QStringList remainingPathes);
00069 
00070 private:
00071     QStackedWidget *m_pStackedWidget;
00072     QSplitter *m_pSplitter;
00073     QTreeWidget *m_pCategories;
00074     QDialogButtonBox *m_pButtonBox;
00075 
00076     QHBoxLayout *m_pHorizontalLayout;
00077     QVBoxLayout *m_pVerticalLayout;
00078 
00079     QLabel *m_pPageTitle;
00080     QFrame *m_pLine;
00081     QWidget *m_pEmptyPage;
00082 
00083     QString m_CurrentPropertyKey;
00084 
00085     QMap<QString, PropertyPage> m_pages;
00086 
00087 signals:
00088     void propertiesChanged();
00089 
00090 public slots:
00091 
00092 private slots:
00093     void setPageTitle();
00094     void categoryChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
00095     void accepted();
00096     void rejected();
00097     void apply();
00098 };
00099 
00100 } //end namespace ito
00101 
00102 #endif
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends