00001 /*========================================================================= 00002 00003 Program: BlueBerry Platform 00004 Language: C++ 00005 Date: $Date: 2009-02-22 15:57:29 +0100 (So, 22 Feb 2009) $ 00006 Version: $Revision: 16375 $ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 00019 #ifndef BERRYQMITKPREFERENCESDIALOG_H_ 00020 #define BERRYQMITKPREFERENCESDIALOG_H_ 00021 00022 #include <berryIBerryPreferencesService.h> 00023 #include <berryIQtPreferencePage.h> 00024 #include <berryIConfigurationElement.h> 00025 #include "mitkQtCommonDll.h" 00026 00027 #include <QDialog> 00028 00029 class QVBoxLayout; 00030 class QGridLayout; 00031 class QHBoxLayout; 00032 class QLineEdit; 00033 class QTreeWidget; 00034 class QLabel; 00035 class QPushButton; 00036 class QSplitter; 00037 class QTreeWidgetItem; 00038 class QStackedWidget; 00039 00040 #include <map> 00041 #include <vector> 00042 00043 class MITK_QT_COMMON QmitkPreferencesDialog : public QDialog 00044 { 00045 Q_OBJECT 00046 00047 public: 00048 QmitkPreferencesDialog(QWidget * parent = 0, Qt::WindowFlags f = 0); 00049 ~QmitkPreferencesDialog(); 00050 void SetSelectedPage(const std::string& id); 00051 00052 protected slots: 00053 void OnImportButtonClicked(bool triggered=false); 00054 void OnExportButtonClicked(bool triggered=false); 00055 void OnApplyButtonClicked(bool triggered=false); 00056 void OnCloseButtonClicked(bool triggered=false); 00057 void OnKeywordTextChanged(const QString & s); 00058 void OnKeywordEditingFinished(); 00059 void OnPreferencesTreeItemSelectionChanged(); 00060 00061 protected: 00065 struct PrefPage 00066 { 00067 PrefPage(std::string _id, std::string _name, std::string _category 00068 , std::string _className, std::string _keywords, berry::IConfigurationElement::Pointer _confElem); 00069 bool operator==(const PrefPage& other); 00070 bool operator<(const PrefPage& other); 00071 00072 std::string id; 00073 std::string name; 00074 std::string category; 00075 std::string className; 00076 std::string keywords; 00077 berry::IQtPreferencePage* prefPage; 00078 berry::IConfigurationElement::Pointer confElem; 00079 QTreeWidgetItem* treeWidgetItem; 00080 }; 00081 00082 bool eventFilter(QObject *obj, QEvent *event); 00083 void UpdateTree(); 00084 00088 berry::IPreferencesService::WeakPtr m_PreferencesService; 00089 00093 std::vector<PrefPage> m_PrefPages; 00094 std::size_t m_CurrentPage; 00095 00096 //# QWidgets 00097 QGridLayout* m_Layout; 00098 QSplitter* m_Splitter; 00099 00100 QWidget* m_LeftPanel; 00101 QGridLayout* m_LeftLayout; 00102 QLineEdit* m_Keyword; 00103 QTreeWidget* m_PreferencesTree; 00104 00105 QWidget* m_RightPanel; 00106 QGridLayout* m_RightLayout; 00107 QLabel* m_Headline; 00108 QStackedWidget* m_PreferencesPanel; 00109 00110 QPushButton* m_ImportButton; 00111 QPushButton* m_ExportButton; 00112 QPushButton* m_ApplyButton; 00113 QPushButton* m_CloseButton; 00114 00115 }; 00116 00117 #endif /* BERRYQMITKPREFERENCESDIALOG_H_ */