itom 1.1.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 
00034 namespace ito
00035 {
00036 
00037 class DialogProperties : public QDialog
00038 {
00039     Q_OBJECT
00040 
00041 public:
00042 
00043     struct PropertyPage
00044     {
00045         PropertyPage() : m_widget(NULL), m_icon(), m_visited(false) {}
00046         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) {}
00047         QString m_title;
00048         QString m_name;
00049         QString m_fullname;
00050         AbstractPropertyPageWidget* m_widget;
00051         QIcon m_icon;
00052         bool m_visited;
00053     };
00054 
00055     DialogProperties(QWidget * parent = 0, Qt::WindowFlags f = 0);
00056     ~DialogProperties();
00057 
00058     bool selectTabByKey(QString &key, QTreeWidgetItem *parent = NULL);
00059 
00060 protected:
00061     void initPages();
00062 
00063     void addPage(PropertyPage page, QTreeWidgetItem *parent, QStringList remainingPathes);
00064 
00065 private:
00066     QStackedWidget *m_pStackedWidget;
00067     QSplitter *m_pSplitter;
00068     QTreeWidget *m_pCategories;
00069     QDialogButtonBox *m_pButtonBox;
00070 
00071     QHBoxLayout *m_pHorizontalLayout;
00072     QVBoxLayout *m_pVerticalLayout;
00073 
00074     QLabel *m_pPageTitle;
00075     QFrame *m_pLine;
00076     QWidget *m_pEmptyPage;
00077 
00078     QString m_CurrentPropertyKey;
00079 
00080     QMap<QString, PropertyPage> m_pages;
00081 
00082 signals:
00083     void propertiesChanged();
00084 
00085 public slots:
00086 
00087 private slots:
00088     void setPageTitle();
00089     void categoryChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
00090     void accepted();
00091     void rejected();
00092     void apply();
00093 };
00094 
00095 } //end namespace ito
00096 
00097 #endif
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends