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();
34 static void updateCustomProps();
36 static void loadCustomProps();
39 static SUIT_ResourceMgr* myResourceMgr;
42 //***********************************************************************
43 /// Manager of preferences
44 class XGUI_EXPORT XGUI_PreferencesMgr : public SUIT_PreferenceMgr
48 XGUI_PreferencesMgr(QtxResourceMgr* theResource, QWidget* theParent)
49 :SUIT_PreferenceMgr(theResource, theParent) {}
51 virtual ~XGUI_PreferencesMgr() {}
53 XGUI_Prefs modified() const { return myModified; }
56 virtual void changedResources( const ResourceMap& theMap);
59 XGUI_Prefs myModified;
63 //***********************************************************************
64 /// Dialog box for preferences editing
65 class XGUI_EXPORT XGUI_PreferencesDlg: public QDialog
69 XGUI_PreferencesDlg(SUIT_ResourceMgr* theResurces, QWidget* theParent = 0);
70 virtual ~XGUI_PreferencesDlg();
72 bool isChanged() const { return myIsChanged; }
74 void modified(XGUI_Prefs& theModified) const;
77 virtual void accept();
81 void createViewerPage(int thePageId);
82 void createMenuPage(int thePageId);
83 void createCustomPage(int thePageId);
85 void updateCustomProps();
87 XGUI_PreferencesMgr* myPreferences;