1 // File: XGUI_Preferences.h
2 // Created: 07 Aug 2014
3 // Author: Vitaly SMETANNIKOV
5 #ifndef XGUI_Preferences_H
6 #define XGUI_Preferences_H
9 #include "XGUI_IPrefMgr.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 /// Returns currently installed resource manager
32 static SUIT_ResourceMgr* resourceMgr();
34 /// Sets a resource manager
35 /// It is used in case of necessity to define external resource manager (not NewGeom)
36 static void setResourceMgr(SUIT_ResourceMgr* theMgr) { myResourceMgr = theMgr; }
38 /// Updates properties defined by module from SUIT_ResourceMgr to Config_PropManager
39 static void updateCustomProps();
41 /// Loads properties defined by module to Config_PropManager
42 static void loadCustomProps();
45 static void createEditContent(XGUI_IPrefMgr* thePref, int thePage);
48 /// Creates content of preferences editing widget
49 static void createCustomPage(XGUI_IPrefMgr* thePref, int thePageId);
51 static SUIT_ResourceMgr* myResourceMgr;
54 //***********************************************************************
55 /// Manager of preferences
56 class XGUI_EXPORT XGUI_PreferencesMgr : public SUIT_PreferenceMgr
60 XGUI_PreferencesMgr(QtxResourceMgr* theResource, QWidget* theParent)
61 : SUIT_PreferenceMgr(theResource, theParent)
65 virtual ~XGUI_PreferencesMgr()
69 XGUI_Prefs modified() const
75 virtual void changedResources(const ResourceMap& theMap);
78 XGUI_Prefs myModified;
81 //***********************************************************************
82 /// Dialog box for preferences editing
83 class XGUI_EXPORT XGUI_PreferencesDlg : public QDialog
87 XGUI_PreferencesDlg(SUIT_ResourceMgr* theResurces, QWidget* theParent = 0);
88 virtual ~XGUI_PreferencesDlg();
90 bool isChanged() const
95 void modified(XGUI_Prefs& theModified) const;
98 virtual void accept();
101 void createEditors();
102 void createViewerPage(int thePageId);
103 void createMenuPage(int thePageId);
104 //void createCustomPage(int thePageId);
106 void updateCustomProps();
108 XGUI_PreferencesMgr* myPreferences;