* ./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:
parent
45f9dcc394
commit
0cd5cc498d
|
@ -194,29 +194,28 @@ namespace Cfg {
|
||||||
void ConfigurationWidget::applyClicked ()
|
void ConfigurationWidget::applyClicked ()
|
||||||
{
|
{
|
||||||
emit updateParameters();
|
emit updateParameters();
|
||||||
if ( checkConfiguration(Configuration::LogNeedExist) == QDialog::Accepted ) {
|
|
||||||
if ( checkConfiguration(Configuration::LogRestart) == QDialog::Accepted ) {
|
|
||||||
emit confOk();
|
|
||||||
} else {
|
|
||||||
Configuration* configuration = Configuration::get();
|
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->restoreFromLogs(Configuration::LogRestart);
|
configuration->restoreFromLogs(Configuration::LogRestart);
|
||||||
configuration->clearLogs (Configuration::LogRestart);
|
configuration->clearLogs (Configuration::LogRestart);
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit confOk();
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,7 @@ namespace Cfg {
|
||||||
|
|
||||||
bool Parameter::_doChange ( unsigned int flags, const string& s, bool b, int i, double d )
|
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();
|
Configuration* configuration = Configuration::get();
|
||||||
ostringstream svalue;
|
ostringstream svalue;
|
||||||
|
@ -223,11 +223,11 @@ namespace Cfg {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( not success ) {
|
if ( not success ) {
|
||||||
//cerr << " (" << _flags << "," << _minInt << ") check failed." << endl;
|
cerr << " (" << _flags << "," << _minInt << ") check failed." << endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ( svalue.str() == _value ) {
|
if ( svalue.str() == _value ) {
|
||||||
//cerr << " no change." << endl;
|
cerr << " no change." << endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ namespace Cfg {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//cerr << " updated" << endl;
|
cerr << " updated" << endl;
|
||||||
|
|
||||||
_value = svalue.str();
|
_value = svalue.str();
|
||||||
_onValueChanged();
|
_onValueChanged();
|
||||||
|
|
|
@ -219,7 +219,10 @@ namespace Cfg {
|
||||||
inline void Configuration::LogEntry::restore () const
|
inline void Configuration::LogEntry::restore () const
|
||||||
{
|
{
|
||||||
Parameter* parameter = Configuration::get()->getParameter(_id);
|
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 )
|
inline bool operator< ( const Configuration::LogEntry& lhs, const Configuration::LogEntry& rhs )
|
||||||
|
|
|
@ -73,13 +73,13 @@ namespace Cfg {
|
||||||
, int span =1
|
, int span =1
|
||||||
, int flags =0 );
|
, int flags =0 );
|
||||||
void syncSlaves ();
|
void syncSlaves ();
|
||||||
int checkConfiguration ( unsigned int mask );
|
|
||||||
void selectTab ( const std::string& );
|
void selectTab ( const std::string& );
|
||||||
public slots:
|
public slots:
|
||||||
void applyClicked ();
|
void applyClicked ();
|
||||||
signals:
|
signals:
|
||||||
void updateParameters ();
|
void updateParameters ();
|
||||||
void confOk ();
|
void confOk ();
|
||||||
|
void needRestart ();
|
||||||
private:
|
private:
|
||||||
unsigned int _flags;
|
unsigned int _flags;
|
||||||
QFont _boldFont;
|
QFont _boldFont;
|
||||||
|
|
Loading…
Reference in New Issue