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 <SUIT_PreferenceMgr.h>
13 class SUIT_ResourceMgr;
16 // Pair of values: section name, value name
17 typedef QPair<QString, QString> XGUI_Pref;
18 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();
34 static SUIT_ResourceMgr* myResourceMgr;
37 //***********************************************************************
38 /// Manager of preferences
39 class XGUI_EXPORT XGUI_PreferencesMgr : public SUIT_PreferenceMgr
43 XGUI_PreferencesMgr(QtxResourceMgr* theResource, QWidget* theParent)
44 :SUIT_PreferenceMgr(theResource, theParent) {}
46 virtual ~XGUI_PreferencesMgr() {}
48 XGUI_Prefs modified() const { return myModified; }
51 virtual void changedResources( const ResourceMap& theMap);
54 XGUI_Prefs myModified;
58 //***********************************************************************
59 /// Dialog box for preferences editing
60 class XGUI_EXPORT XGUI_PreferencesDlg: public QDialog
64 XGUI_PreferencesDlg(SUIT_ResourceMgr* theResurces, QWidget* theParent = 0);
65 virtual ~XGUI_PreferencesDlg();
67 bool isChanged() const { return myIsChanged; }
69 void modified(XGUI_Prefs& theModified) const;
72 virtual void accept();
76 void createViewerPage(int thePageId);
77 void createMenuPage(int thePageId);
79 XGUI_PreferencesMgr* myPreferences;