From: abd Date: Fri, 3 Feb 2006 11:23:03 +0000 (+0000) Subject: Added new button for retrieve default resources X-Git-Tag: T_merge_to_HEAD_20060207~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=775b0e561c202f309d74ebe5d82793aa67294ae1;p=modules%2Fgui.git Added new button for retrieve default resources --- diff --git a/src/LightApp/LightApp_PreferencesDlg.cxx b/src/LightApp/LightApp_PreferencesDlg.cxx index 7b615d87c..af26451f7 100644 --- a/src/LightApp/LightApp_PreferencesDlg.cxx +++ b/src/LightApp/LightApp_PreferencesDlg.cxx @@ -23,8 +23,12 @@ #include "LightApp_Preferences.h" -#include +#include "QtxResourceMgr.h" + +#include #include +#include +#include /*! Constructor. @@ -50,6 +54,10 @@ myPrefs( prefs ), mySaved ( false ) connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) ); connect( this, SIGNAL( dlgApply() ), this, SLOT( onApply() ) ); + + QButton* defBtn = userButton( insertButton( tr( "DEFAULT_BTN_TEXT" ) ) ); + if ( defBtn ) + connect( defBtn, SIGNAL( clicked() ), this, SLOT( onDefault() ) ); } /*! @@ -109,3 +117,18 @@ void LightApp_PreferencesDlg::onApply() myPrefs->toBackup(); mySaved = true; } + +/*! Restore default preferences*/ +void LightApp_PreferencesDlg::onDefault() +{ + if( QMessageBox::Ok == QMessageBox::information( this, tr( "WARNING" ), tr( "DEFAULT_QUESTION" ), QMessageBox::Ok, QMessageBox::Cancel ) ) + { + if ( myPrefs && myPrefs->resourceMgr() ) + { + bool prev = myPrefs->resourceMgr()->ignoreUserValues(); + myPrefs->resourceMgr()->setIgnoreUserValues( true ); + myPrefs->retrieve(); + myPrefs->resourceMgr()->setIgnoreUserValues( prev ); + } + } +} diff --git a/src/LightApp/LightApp_PreferencesDlg.h b/src/LightApp/LightApp_PreferencesDlg.h index ea7bf55fe..771714519 100644 --- a/src/LightApp/LightApp_PreferencesDlg.h +++ b/src/LightApp/LightApp_PreferencesDlg.h @@ -46,6 +46,7 @@ public: private slots: void onHelp(); void onApply(); + void onDefault(); private: LightApp_Preferences* myPrefs;