]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Emit signal when user resets appication settings to defaults by pressing "Defaults... BR_NewGEOM_V7_4_1
authornds <natalia.donis@opencascade.com>
Fri, 24 Oct 2014 09:35:48 +0000 (13:35 +0400)
committernds <natalia.donis@opencascade.com>
Fri, 24 Oct 2014 09:35:48 +0000 (13:35 +0400)
Conflicts:

src/LightApp/LightApp_PreferencesDlg.cxx

src/LightApp/LightApp_Application.cxx
src/LightApp/LightApp_Application.h
src/LightApp/LightApp_Preferences.h
src/LightApp/LightApp_PreferencesDlg.cxx [changed mode: 0644->0755]
src/LightApp/LightApp_PreferencesDlg.h
src/Qtx/QtxResourceMgr.cxx
src/Qtx/QtxResourceMgr.h

index 0e2d4108cbdca48586e86ac10ed4123390c6485c..c7d20a8de4effbf1fa395f8d1eb11d4fb93e5d9f 100644 (file)
@@ -2025,7 +2025,9 @@ LightApp_Preferences* LightApp_Application::preferences( const bool crt ) const
   that->myPrefs = _prefs_;
 
   connect( myPrefs, SIGNAL( preferenceChanged( QString&, QString&, QString& ) ),
-           this, SLOT( onPreferenceChanged( QString&, QString&, QString& ) ) );
+           this, SLOT( onPreferenceChanged( QString&, QString&, QString& ) ), Qt::UniqueConnection );
+  connect( myPrefs, SIGNAL( resetToDefaults() ),
+           this, SIGNAL( preferenceResetToDefaults() ), Qt::UniqueConnection );
 
   if ( !crt )
     return myPrefs;
index 59837134589b750e26fab198d2cb2e99ed056466..ca125e908b121befbb9eec2b7671cf65502e2ed7 100644 (file)
@@ -187,6 +187,7 @@ signals:
   void                                studySaved();
   void                                studyClosed();
   void                                preferenceChanged( const QString&, const QString&, const QString& );
+  void                                preferenceResetToDefaults();
   void                                operationFinished( const QString&, const QString&, const QStringList& );
 
 public slots:
index cda80799ebf078d84de5e0370e52afd08d8f764a..f6568fac75c8d4981bfc2f50fec3bcd9cf80d014 100644 (file)
@@ -60,6 +60,7 @@ protected:
 
 signals:
   void                 preferenceChanged( QString&, QString&, QString& );
+  void                 resetToDefaults();
 
 private slots:
   void                 onHelp();
old mode 100644 (file)
new mode 100755 (executable)
index e2d29ec..87b5178
@@ -68,6 +68,7 @@ myPrefs( prefs ), mySaved ( false )
   QAbstractButton* impBtn = userButton( insertButton( tr( "IMPORT_BTN_TEXT" ) ) );
   if( impBtn )
     connect( impBtn, SIGNAL( clicked() ), this, SLOT( onImportPref() ) );
+  connect( this, SIGNAL( defaultPressed() ), prefs, SIGNAL( resetToDefaults() ) );
 
   setMinimumSize( 800, 600 );
 }
@@ -140,18 +141,19 @@ void LightApp_PreferencesDlg::onApply()
 /*! Restore default preferences*/
 void LightApp_PreferencesDlg::onDefault()
 {
-  if( SUIT_MessageBox::Ok == SUIT_MessageBox::question( this, tr( "WARNING" ), tr( "DEFAULT_QUESTION" ),
-                                                        SUIT_MessageBox::Ok | SUIT_MessageBox::Cancel,
-                                                        SUIT_MessageBox::Ok ) )
+  if ( SUIT_MessageBox::Ok == SUIT_MessageBox::question( this, tr( "WARNING" ), tr( "DEFAULT_QUESTION" ),
+                                                        SUIT_MessageBox::Ok | SUIT_MessageBox::Cancel,
+                                                        SUIT_MessageBox::Ok ) )
+  {
+    if ( myPrefs && myPrefs->resourceMgr() )
     {
-      if ( myPrefs && myPrefs->resourceMgr() )
-        {
-          QtxResourceMgr::WorkingMode prev = myPrefs->resourceMgr()->workingMode();
+      QtxResourceMgr::WorkingMode prev = myPrefs->resourceMgr()->setWorkingMode( QtxResourceMgr::IgnoreUserValues );
           myPrefs->resourceMgr()->setWorkingMode( QtxResourceMgr::IgnoreUserValues );
-          myPrefs->retrieve();
-          myPrefs->resourceMgr()->setWorkingMode( prev );
-        }
+      myPrefs->retrieve();
+      myPrefs->resourceMgr()->setWorkingMode( prev );
     }
+    emit defaultPressed();
+  }
 }
 
 /*! Import preferences from some file */
index 6ed946817e858f52df4ec0ce533162b727f1642f..3953530e5b2d23e3f9dfc220beee6e53e6b7387d 100644 (file)
@@ -51,6 +51,9 @@ public:
   bool                  isSaved() { return mySaved; }
   void                  setSaved( bool saved ) { mySaved = saved; } 
 
+signals:
+  void                  defaultPressed();
+
 private slots:
   void                  onHelp();
   void                  onApply();
index d3c2aa09886e3cc147263455fac25344a10a76f1..64931db56ca31995af0c5c36e75c818bce9867af 100644 (file)
@@ -1411,9 +1411,11 @@ QtxResourceMgr::WorkingMode QtxResourceMgr::workingMode() const
   \param mode new working mode
   \sa workingMode(), value(), hasValue(), hasSection(), setValue()
 */
-void QtxResourceMgr::setWorkingMode( WorkingMode mode )
+QtxResourceMgr::WorkingMode QtxResourceMgr::setWorkingMode( WorkingMode mode )
 {
+  WorkingMode m = myWorkingMode;
   myWorkingMode = mode;
+  return m;
 }
 
 /*!
index 6abab30100c71d21ec4b00239827dbd5cf35a9ce..991019660b739b8301b1a4a4d1a400679c8143a7 100644 (file)
@@ -86,7 +86,7 @@ public:
   void             clear();
 
   WorkingMode      workingMode() const;
-  void             setWorkingMode( WorkingMode );
+  WorkingMode      setWorkingMode( WorkingMode );
 
   bool             value( const QString&, const QString&, int& ) const;
   bool             value( const QString&, const QString&, double& ) const;