X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_Preferences.h;h=c3f31b76e732213e964ec3c049fcf64ef101b60a;hb=0d9a107853208317a6352bb7f8c77eb54d5efbe1;hp=b7783c09dff2df92e865497ed561e3b83461f506;hpb=331af9b7eb4feddf17c37fe2ce1f0f046f522145;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_Preferences.h b/src/ModuleBase/ModuleBase_Preferences.h index b7783c09d..c3f31b76e 100644 --- a/src/ModuleBase/ModuleBase_Preferences.h +++ b/src/ModuleBase/ModuleBase_Preferences.h @@ -16,20 +16,26 @@ class SUIT_ResourceMgr; class QWidget; -/// \typedef ModuleBase_Pref Pair of values: section name, value name +/// Pair of values: section name, value name typedef QPair ModuleBase_Pref; -/// \typedef ModuleBase_Prefs list of preferences +/// List of preferences typedef QList ModuleBase_Prefs; //*********************************************************************** +/// \ingroup GUI /// Class for manipulation with preferences in the application class MODULEBASE_EXPORT ModuleBase_Preferences { public: + /// Name of preferences of viewer section static const QString VIEWER_SECTION; + + /// Name of preferences of menu section static const QString MENU_SECTION; + /// Shows a dialog box to edit preferences + /// \param theModified a list of modified preferences static bool editPreferences(ModuleBase_Prefs& theModified); /// Returns currently installed resource manager @@ -43,13 +49,6 @@ class MODULEBASE_EXPORT ModuleBase_Preferences /// Updates Config_PropManager properties by module from SUIT_ResourceMgr static void updateConfigByResources(); - /// Updates SUIT_ResourceMgr values by Config_PropManager properties - /// \param theUpdateOnlyInvalid flag to update only invalid values, if it is false, all are updated - static void updateResourcesByConfig(); - - /// Set default values to the Config_PropManager properties - static void resetConfig(); - /// Loads properties defined by module to Config_PropManager static void loadCustomProps(); @@ -58,7 +57,19 @@ class MODULEBASE_EXPORT ModuleBase_Preferences /// \param thePage an id of a page static void createEditContent(ModuleBase_IPrefMgr* thePref, int thePage); + /// Retrieve preferences of resource manage to default state + static void resetResourcePreferences(SUIT_PreferenceMgr* thePref); + + /// Retrieve preferences of config prop to default state + static void resetConfigPropPreferences(SUIT_PreferenceMgr* thePref); + private: + /// Updates SUIT_ResourceMgr values by Config_PropManager properties + static void updateResourcesByConfig(); + + /// Set default values to the Config_PropManager properties + static void resetConfig(); + /// Creates content of preferences editing widget static void createCustomPage(ModuleBase_IPrefMgr* thePref, int thePageId); @@ -66,6 +77,7 @@ private: }; //*********************************************************************** +/// \ingroup GUI /// Manager of preferences class MODULEBASE_EXPORT ModuleBase_PreferencesMgr : public SUIT_PreferenceMgr { @@ -83,12 +95,14 @@ Q_OBJECT { } + /// Returns True if preferences were modified ModuleBase_Prefs modified() const { return myModified; } protected: + /// Store changed resource virtual void changedResources(const ResourceMap& theMap); private: @@ -96,25 +110,34 @@ Q_OBJECT }; //*********************************************************************** +/// \ingroup GUI /// Dialog box for preferences editing class MODULEBASE_EXPORT ModuleBase_PreferencesDlg : public QDialog { Q_OBJECT public: + /// Constructor + /// \param theResurces resources manager + /// \param theParent a parent widget ModuleBase_PreferencesDlg(SUIT_ResourceMgr* theResurces, QWidget* theParent = 0); virtual ~ModuleBase_PreferencesDlg(); + /// Returns True if preferences were changed bool isChanged() const { return myIsChanged; } + /// Returns list of modified preferences + /// \param theModified output list of modified preferences void modified(ModuleBase_Prefs& theModified) const; public slots: + /// A slot called on Ok button press virtual void accept(); protected slots: + /// A slot called on Default button press void onDefault(); private: