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;
void studySaved();
void studyClosed();
void preferenceChanged( const QString&, const QString&, const QString& );
+ void preferenceResetToDefaults();
void operationFinished( const QString&, const QString&, const QStringList& );
public slots:
signals:
void preferenceChanged( QString&, QString&, QString& );
+ void resetToDefaults();
private slots:
void onHelp();
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 );
}
/*! 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 */
bool isSaved() { return mySaved; }
void setSaved( bool saved ) { mySaved = saved; }
+signals:
+ void defaultPressed();
+
private slots:
void onHelp();
void onApply();
\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;
}
/*!
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;