Salome HOME
Merge branch 'master' of newgeom:newgeom.git
[modules/shaper.git] / src / XGUI / XGUI_Preferences.h
index bd30a31a581b0558d2fcf22b7eb22c362203e0f4..a6fbc8a2b2faa2675bb944ff7506e5b531b43745 100644 (file)
@@ -6,8 +6,8 @@
 #define XGUI_Preferences_H
 
 #include "XGUI.h"
+#include "XGUI_IPrefMgr.h"
 
-#include <Config_PropManager.h>
 #include <SUIT_PreferenceMgr.h>
 #include <QDialog>
 
@@ -18,20 +18,36 @@ class QWidget;
 typedef QPair<QString, QString> XGUI_Pref;
 typedef QList<XGUI_Pref> XGUI_Prefs;
 
-
 //***********************************************************************
 /// Class for manipulation  with preferences in the application
 class XGUI_EXPORT XGUI_Preferences
 {
-public:
+ public:
   static const QString VIEWER_SECTION;
   static const QString MENU_SECTION;
 
   static bool editPreferences(XGUI_Prefs& theModified);
 
+  /// Returns currently installed resource manager
   static SUIT_ResourceMgr* resourceMgr();
 
+  /// Sets a resource manager
+  /// It is used in case of necessity to define external resource manager (not NewGeom)
+  static void setResourceMgr(SUIT_ResourceMgr* theMgr) { myResourceMgr = theMgr; }
+
+  /// Updates properties defined by module from SUIT_ResourceMgr to Config_PropManager
+  static void updateCustomProps();
+
+  /// Loads properties defined by module to Config_PropManager
+  static void loadCustomProps();
+
+  /// 
+  static void createEditContent(XGUI_IPrefMgr* thePref, int thePage);
+
 private:
+  /// Creates content of preferences editing widget
+  static void createCustomPage(XGUI_IPrefMgr* thePref, int thePageId);
+
   static SUIT_ResourceMgr* myResourceMgr;
 };
 
@@ -39,48 +55,60 @@ private:
 /// Manager of preferences
 class XGUI_EXPORT XGUI_PreferencesMgr : public SUIT_PreferenceMgr
 {
-  Q_OBJECT
-public:
+Q_OBJECT
+ public:
   XGUI_PreferencesMgr(QtxResourceMgr* theResource, QWidget* theParent)
-    :SUIT_PreferenceMgr(theResource, theParent) {}
+      : SUIT_PreferenceMgr(theResource, theParent)
+  {
+  }
 
-  virtual ~XGUI_PreferencesMgr() {}
+  virtual ~XGUI_PreferencesMgr()
+  {
+  }
 
-  XGUI_Prefs modified() const { return myModified; }
+  XGUI_Prefs modified() const
+  {
+    return myModified;
+  }
 
-protected:
-  virtual void changedResources( const ResourceMap& theMap);
+ protected:
+  virtual void changedResources(const ResourceMap& theMap);
 
-private:
+ private:
   XGUI_Prefs myModified;
 };
 
-
 //***********************************************************************
 /// Dialog box for preferences editing
-class XGUI_EXPORT XGUI_PreferencesDlg: public QDialog
+class XGUI_EXPORT XGUI_PreferencesDlg : public QDialog
 {
-  Q_OBJECT
-public:
+Q_OBJECT
+ public:
   XGUI_PreferencesDlg(SUIT_ResourceMgr* theResurces, QWidget* theParent = 0);
   virtual ~XGUI_PreferencesDlg();
 
-  bool isChanged() const { return myIsChanged; }
+  bool isChanged() const
+  {
+    return myIsChanged;
+  }
 
   void modified(XGUI_Prefs& theModified) const;
 
-public slots:
+ public slots:
   virtual void accept();
 
-private:
-  void createEditors();
-  void createViewerPage(int thePageId);
-  void createMenuPage(int thePageId);
-  void createCustomPage(int thePageId, Config_Properties& theProps);
-  
+ private:
+   /// Create editors for aplication properties
+   void createEditors();
+
+   /// Create a viewer page in dialog box
+   void createViewerPage(int thePageId);
+   
+   /// Create menu properties page in the dialog box
+   void createMenuPage(int thePageId);
+
   XGUI_PreferencesMgr* myPreferences;
   bool myIsChanged;
 };
 
-
-#endif
\ No newline at end of file
+#endif