* ./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().
This commit is contained in:
Jean-Paul Chaput 2010-10-14 09:02:24 +00:00
parent 45f9dcc394
commit 0cd5cc498d
4 changed files with 25 additions and 23 deletions

View File

@ -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();
}

View File

@ -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();

View File

@ -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 )

View File

@ -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;