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;
22 //***********************************************************************
23 /// Class for manipulation with preferences in the application
24 class XGUI_EXPORT XGUI_Preferences
27 static const QString VIEWER_SECTION;
28 static const QString MENU_SECTION;
30 static bool editPreferences(XGUI_Prefs& theModified);
32 static SUIT_ResourceMgr* resourceMgr();
35 static SUIT_ResourceMgr* myResourceMgr;
38 //***********************************************************************
39 /// Manager of preferences
40 class XGUI_EXPORT XGUI_PreferencesMgr : public SUIT_PreferenceMgr
44 XGUI_PreferencesMgr(QtxResourceMgr* theResource, QWidget* theParent)
45 :SUIT_PreferenceMgr(theResource, theParent) {}
47 virtual ~XGUI_PreferencesMgr() {}
49 XGUI_Prefs modified() const { return myModified; }
52 virtual void changedResources( const ResourceMap& theMap);
55 XGUI_Prefs myModified;
59 //***********************************************************************
60 /// Dialog box for preferences editing
61 class XGUI_EXPORT XGUI_PreferencesDlg: public QDialog
65 XGUI_PreferencesDlg(SUIT_ResourceMgr* theResurces, QWidget* theParent = 0);
66 virtual ~XGUI_PreferencesDlg();
68 bool isChanged() const { return myIsChanged; }
70 void modified(XGUI_Prefs& theModified) const;
73 virtual void accept();
77 void createViewerPage(int thePageId);
78 void createMenuPage(int thePageId);
79 void createCustomPage(int thePageId, Config_Properties& theProps);
81 XGUI_PreferencesMgr* myPreferences;