Salome HOME
Visualization preferences for sketcher are created
[modules/shaper.git] / src / XGUI / XGUI_Preferences.h
1 // File:        XGUI_Preferences.h
2 // Created:     07 Aug 2014
3 // Author:      Vitaly SMETANNIKOV
4
5 #ifndef XGUI_Preferences_H
6 #define XGUI_Preferences_H
7
8 #include "XGUI.h"
9
10 #include <Config_PropManager.h>
11 #include <SUIT_PreferenceMgr.h>
12 #include <QDialog>
13
14 class SUIT_ResourceMgr;
15 class QWidget;
16
17 // Pair of values: section name, value name
18 typedef QPair<QString, QString> XGUI_Pref;
19 typedef QList<XGUI_Pref> XGUI_Prefs;
20
21
22 //***********************************************************************
23 /// Class for manipulation  with preferences in the application
24 class XGUI_EXPORT XGUI_Preferences
25 {
26 public:
27   static const QString VIEWER_SECTION;
28   static const QString MENU_SECTION;
29
30   static bool editPreferences(XGUI_Prefs& theModified);
31
32   static SUIT_ResourceMgr* resourceMgr();
33
34 private:
35   static SUIT_ResourceMgr* myResourceMgr;
36 };
37
38 //***********************************************************************
39 /// Manager of preferences
40 class XGUI_EXPORT XGUI_PreferencesMgr : public SUIT_PreferenceMgr
41 {
42   Q_OBJECT
43 public:
44   XGUI_PreferencesMgr(QtxResourceMgr* theResource, QWidget* theParent)
45     :SUIT_PreferenceMgr(theResource, theParent) {}
46
47   virtual ~XGUI_PreferencesMgr() {}
48
49   XGUI_Prefs modified() const { return myModified; }
50
51 protected:
52   virtual void changedResources( const ResourceMap& theMap);
53
54 private:
55   XGUI_Prefs myModified;
56 };
57
58
59 //***********************************************************************
60 /// Dialog box for preferences editing
61 class XGUI_EXPORT XGUI_PreferencesDlg: public QDialog
62 {
63   Q_OBJECT
64 public:
65   XGUI_PreferencesDlg(SUIT_ResourceMgr* theResurces, QWidget* theParent = 0);
66   virtual ~XGUI_PreferencesDlg();
67
68   bool isChanged() const { return myIsChanged; }
69
70   void modified(XGUI_Prefs& theModified) const;
71
72 public slots:
73   virtual void accept();
74
75 private:
76   void createEditors();
77   void createViewerPage(int thePageId);
78   void createMenuPage(int thePageId);
79   void createCustomPage(int thePageId, Config_Properties& theProps);
80   
81   XGUI_PreferencesMgr* myPreferences;
82   bool myIsChanged;
83 };
84
85
86 #endif