From 0cd5cc498d719465c3a992fd4c72810b74522693 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Thu, 14 Oct 2010 09:02:24 +0000 Subject: [PATCH] * ./vslsisapd/src/configuration: - Change: In ConfigurationWidget, two separate signals for "confOk" and "needRestart", rewrite of the "apply clicked" method. - Bug: In LogEntry::restore(), uses correct flags on Paramater::setString(). --- .../configuration/src/ConfigurationWidget.cpp | 33 +++++++++---------- vlsisapd/src/configuration/src/Parameter.cpp | 8 ++--- .../vlsisapd/configuration/Configuration.h | 5 ++- .../configuration/ConfigurationWidget.h | 2 +- 4 files changed, 25 insertions(+), 23 deletions(-) diff --git a/vlsisapd/src/configuration/src/ConfigurationWidget.cpp b/vlsisapd/src/configuration/src/ConfigurationWidget.cpp index 8b9bea55..60dd8bfb 100644 --- a/vlsisapd/src/configuration/src/ConfigurationWidget.cpp +++ b/vlsisapd/src/configuration/src/ConfigurationWidget.cpp @@ -194,29 +194,28 @@ namespace Cfg { void ConfigurationWidget::applyClicked () { emit updateParameters(); - if ( checkConfiguration(Configuration::LogNeedExist) == QDialog::Accepted ) { - if ( checkConfiguration(Configuration::LogRestart) == QDialog::Accepted ) { - emit confOk(); + + Configuration* configuration = Configuration::get(); + if ( _log == NULL ) _log = new LogWidget(this); + + if ( configuration->hasLogs(Configuration::LogNeedExist) ) { + _log->updateLogs(Configuration::LogNeedExist); + _log->exec(); + return; + } + + if ( configuration->hasLogs(Configuration::LogRestart) ) { + _log->updateLogs(Configuration::LogRestart); + if ( _log->exec() == QDialog::Accepted ) { + emit needRestart(); } else { - Configuration* configuration = Configuration::get(); configuration->restoreFromLogs(Configuration::LogRestart); configuration->clearLogs (Configuration::LogRestart); + return; } } - } - - int ConfigurationWidget::checkConfiguration ( unsigned int mask ) - { - Configuration* configuration = Configuration::get(); - - if ( configuration->hasLogs(mask) ) { - if ( _log == NULL ) _log = new LogWidget(this); - _log->updateLogs (mask); - return _log->exec (); - } - - return QDialog::Accepted; + emit confOk(); } diff --git a/vlsisapd/src/configuration/src/Parameter.cpp b/vlsisapd/src/configuration/src/Parameter.cpp index 08bdae3d..eae463b2 100644 --- a/vlsisapd/src/configuration/src/Parameter.cpp +++ b/vlsisapd/src/configuration/src/Parameter.cpp @@ -191,7 +191,7 @@ namespace Cfg { bool Parameter::_doChange ( unsigned int flags, const string& s, bool b, int i, double d ) { - //cerr << "_doChange: " << _id << ":" << _value << " -> \"" << s << "\"|" << b << "|" << i << "|" << d; + cerr << "_doChange: " << _id << ":" << _value << " -> \"" << s << "\"|" << b << "|" << i << "|" << d; Configuration* configuration = Configuration::get(); ostringstream svalue; @@ -223,11 +223,11 @@ namespace Cfg { } if ( not success ) { - //cerr << " (" << _flags << "," << _minInt << ") check failed." << endl; + cerr << " (" << _flags << "," << _minInt << ") check failed." << endl; return false; } if ( svalue.str() == _value ) { - //cerr << " no change." << endl; + cerr << " no change." << endl; return true; } @@ -245,7 +245,7 @@ namespace Cfg { } } - //cerr << " updated" << endl; + cerr << " updated" << endl; _value = svalue.str(); _onValueChanged(); diff --git a/vlsisapd/src/configuration/src/vlsisapd/configuration/Configuration.h b/vlsisapd/src/configuration/src/vlsisapd/configuration/Configuration.h index d5f87e02..0829fa3b 100644 --- a/vlsisapd/src/configuration/src/vlsisapd/configuration/Configuration.h +++ b/vlsisapd/src/configuration/src/vlsisapd/configuration/Configuration.h @@ -219,7 +219,10 @@ namespace Cfg { inline void Configuration::LogEntry::restore () const { Parameter* parameter = Configuration::get()->getParameter(_id); - if ( parameter != NULL ) parameter->setString(_valid,false); + if ( parameter != NULL ) parameter->setString ( _valid + , (Parameter::AllRequirements | Parameter::FromString) + & ~Parameter::TypeCheck + ); } inline bool operator< ( const Configuration::LogEntry& lhs, const Configuration::LogEntry& rhs ) diff --git a/vlsisapd/src/configuration/src/vlsisapd/configuration/ConfigurationWidget.h b/vlsisapd/src/configuration/src/vlsisapd/configuration/ConfigurationWidget.h index 5ad36f68..224355e8 100644 --- a/vlsisapd/src/configuration/src/vlsisapd/configuration/ConfigurationWidget.h +++ b/vlsisapd/src/configuration/src/vlsisapd/configuration/ConfigurationWidget.h @@ -73,13 +73,13 @@ namespace Cfg { , int span =1 , int flags =0 ); void syncSlaves (); - int checkConfiguration ( unsigned int mask ); void selectTab ( const std::string& ); public slots: void applyClicked (); signals: void updateParameters (); void confOk (); + void needRestart (); private: unsigned int _flags; QFont _boldFont;