1 // File: XGUI_Preferences.h
2 // Created: 07 Aug 2014
3 // Author: Vitaly SMETANNIKOV
5 #ifndef XGUI_Preferences_H
6 #define XGUI_Preferences_H
10 #include <Config_PropManager.h>
11 #include <SUIT_PreferenceMgr.h>
14 class SUIT_ResourceMgr;
17 // Pair of values: section name, value name
18 typedef QPair<QString, QString> XGUI_Pref;
19 typedef QList<XGUI_Pref> XGUI_Prefs;
21 //***********************************************************************
22 /// Class for manipulation with preferences in the application
23 class XGUI_EXPORT XGUI_Preferences
26 static const QString VIEWER_SECTION;
27 static const QString MENU_SECTION;
29 static bool editPreferences(XGUI_Prefs& theModified);
31 static SUIT_ResourceMgr* resourceMgr();
33 static void updateCustomProps();
35 static void loadCustomProps();
38 static SUIT_ResourceMgr* myResourceMgr;
41 //***********************************************************************
42 /// Manager of preferences
43 class XGUI_EXPORT XGUI_PreferencesMgr : public SUIT_PreferenceMgr
47 XGUI_PreferencesMgr(QtxResourceMgr* theResource, QWidget* theParent)
48 : SUIT_PreferenceMgr(theResource, theParent)
52 virtual ~XGUI_PreferencesMgr()
56 XGUI_Prefs modified() const
62 virtual void changedResources(const ResourceMap& theMap);
65 XGUI_Prefs myModified;
68 //***********************************************************************
69 /// Dialog box for preferences editing
70 class XGUI_EXPORT XGUI_PreferencesDlg : public QDialog
74 XGUI_PreferencesDlg(SUIT_ResourceMgr* theResurces, QWidget* theParent = 0);
75 virtual ~XGUI_PreferencesDlg();
77 bool isChanged() const
82 void modified(XGUI_Prefs& theModified) const;
85 virtual void accept();
89 void createViewerPage(int thePageId);
90 void createMenuPage(int thePageId);
91 void createCustomPage(int thePageId);
93 void updateCustomProps();
95 XGUI_PreferencesMgr* myPreferences;