From 775b0e561c202f309d74ebe5d82793aa67294ae1 Mon Sep 17 00:00:00 2001 From: abd Date: Fri, 3 Feb 2006 11:23:03 +0000 Subject: [PATCH] Added new button for retrieve default resources --- src/LightApp/LightApp_PreferencesDlg.cxx | 25 +++++++++++++++++++++++- src/LightApp/LightApp_PreferencesDlg.h | 1 + 2 files changed, 25 insertions(+), 1 deletion(-) 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; -- 2.39.2