X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_Preferences.h;h=d2f6cb9bdfe44bf92bba55413a692f52ac0ff518;hb=7f92207f4b32a1c02462c40f002e8d7d870529f1;hp=b307a5e2451124cef8cd8a3e305fc6c95374e632;hpb=43038cf5895f661133b3a21176d80a97d67c357e;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_Preferences.h b/src/ModuleBase/ModuleBase_Preferences.h index b307a5e24..d2f6cb9bd 100644 --- a/src/ModuleBase/ModuleBase_Preferences.h +++ b/src/ModuleBase/ModuleBase_Preferences.h @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: ModuleBase_Preferences.h // Created: 07 Aug 2014 // Author: Vitaly SMETANNIKOV @@ -14,18 +16,26 @@ class SUIT_ResourceMgr; class QWidget; -// Pair of values: section name, value name +/// Pair of values: section name, value name typedef QPair ModuleBase_Pref; + +/// 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 @@ -33,13 +43,13 @@ class MODULEBASE_EXPORT ModuleBase_Preferences /// Sets a resource manager /// It is used in case of necessity to define external resource manager (not NewGeom) + /// \param theMgr resource manager static void setResourceMgr(SUIT_ResourceMgr* theMgr) { myResourceMgr = theMgr; } /// 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 @@ -48,7 +58,9 @@ class MODULEBASE_EXPORT ModuleBase_Preferences /// Loads properties defined by module to Config_PropManager static void loadCustomProps(); - /// + /// Create editable content + /// \param thePref interface to preference manager + /// \param thePage an id of a page static void createEditContent(ModuleBase_IPrefMgr* thePref, int thePage); private: @@ -59,11 +71,15 @@ private: }; //*********************************************************************** +/// \ingroup GUI /// Manager of preferences class MODULEBASE_EXPORT ModuleBase_PreferencesMgr : public SUIT_PreferenceMgr { Q_OBJECT public: + /// Constructor + /// \param theResource resource manager + /// \param theParent a paren widget ModuleBase_PreferencesMgr(QtxResourceMgr* theResource, QWidget* theParent) : SUIT_PreferenceMgr(theResource, theParent) { @@ -73,12 +89,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: @@ -86,25 +104,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: