From 9f0fb0b467a461bff8c662c3a9216733b22ec229 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Wed, 6 Oct 2010 22:03:35 +0000 Subject: [PATCH] * ./vslsisapd/src/configuration: - New: Attributes "needRestart", "mustExist", "isFile" and "isPath". - New: Display a warning message when a parameter with mustExist or needRestart is modificated. - New: In ConfigurationWidget, method selectTab() to select the current displayed tab. - Change: In Configuration::writeToFile() and writeToStream(), adds a third parameter telling which parameter to save. It's a semicolon separated list of parameter head id. Example: "kite;mauka". --- vlsisapd/src/configuration/src/CMakeLists.txt | 4 +- .../src/configuration/src/ConfEditorMain.cpp | 1 + .../configuration/src/ConfEditorWidget.cpp | 1 + .../src/configuration/src/Configuration.cpp | 87 +++++++-- .../src/configuration/src/Configuration.qrc | 1 + .../configuration/src/ConfigurationWidget.cpp | 39 +++- .../configuration/src/LayoutDescription.cpp | 32 +++- vlsisapd/src/configuration/src/LogWidget.cpp | 151 +++++++++++++++ vlsisapd/src/configuration/src/Parameter.cpp | 99 ++++++++-- .../src/configuration/src/ParameterWidget.cpp | 173 +++++++++++------- .../src/configuration/src/images/warning.png | Bin 0 -> 2514 bytes .../vlsisapd/configuration/ConfEditorWidget.h | 14 +- .../vlsisapd/configuration/Configuration.h | 62 +++++-- .../configuration/ConfigurationWidget.h | 8 + .../configuration/LayoutDescription.h | 27 ++- .../src/vlsisapd/configuration/LogWidget.h | 53 ++++++ .../src/vlsisapd/configuration/Parameter.h | 136 ++++++++------ .../vlsisapd/configuration/ParameterWidget.h | 2 +- 18 files changed, 708 insertions(+), 182 deletions(-) create mode 100644 vlsisapd/src/configuration/src/LogWidget.cpp create mode 100644 vlsisapd/src/configuration/src/images/warning.png create mode 100644 vlsisapd/src/configuration/src/vlsisapd/configuration/LogWidget.h diff --git a/vlsisapd/src/configuration/src/CMakeLists.txt b/vlsisapd/src/configuration/src/CMakeLists.txt index 8d206c6c..932a5e5e 100644 --- a/vlsisapd/src/configuration/src/CMakeLists.txt +++ b/vlsisapd/src/configuration/src/CMakeLists.txt @@ -7,10 +7,11 @@ ) set ( mocIncludes vlsisapd/configuration/FilePathEdit.h - vlsisapd/configuration/ConfigurationWidget.h vlsisapd/configuration/ConfigurationDialog.h vlsisapd/configuration/ParameterWidget.h vlsisapd/configuration/ConfTabWidget.h + vlsisapd/configuration/LogWidget.h + vlsisapd/configuration/ConfigurationWidget.h vlsisapd/configuration/ConfEditorWidget.h ) set ( includes vlsisapd/configuration/Parameter.h @@ -23,6 +24,7 @@ FilePathEdit.cpp ParameterWidget.cpp ConfTabWidget.cpp + LogWidget.cpp ConfigurationWidget.cpp ConfigurationDialog.cpp ConfEditorWidget.cpp diff --git a/vlsisapd/src/configuration/src/ConfEditorMain.cpp b/vlsisapd/src/configuration/src/ConfEditorMain.cpp index a02dba7f..9f9b81c7 100644 --- a/vlsisapd/src/configuration/src/ConfEditorMain.cpp +++ b/vlsisapd/src/configuration/src/ConfEditorMain.cpp @@ -93,6 +93,7 @@ int main ( int argc, char* argv[] ) } ConfEditorWidget* editor = new ConfEditorWidget (); + //editor->getConfigurationWidget()->selectTab ( "Kite" ); editor->show (); //QFileDialog::getOpenFileName(NULL, "Choose file", "", ""); diff --git a/vlsisapd/src/configuration/src/ConfEditorWidget.cpp b/vlsisapd/src/configuration/src/ConfEditorWidget.cpp index a5c19815..c6f67881 100644 --- a/vlsisapd/src/configuration/src/ConfEditorWidget.cpp +++ b/vlsisapd/src/configuration/src/ConfEditorWidget.cpp @@ -90,6 +90,7 @@ namespace Cfg { cout << "Saving configuration file: <" << dotConfigFile << ">."<< endl; + //Configuration::get()->writeToStream ( file, 0, ";misc;kite;;mauka;;" ); Configuration::get()->writeToStream ( file, 0 ); //Configuration::get()->writeToStream ( file, Configuration::DriveValues|Configuration::DriveLayout ); file.close (); diff --git a/vlsisapd/src/configuration/src/Configuration.cpp b/vlsisapd/src/configuration/src/Configuration.cpp index 9b593092..8b951d50 100644 --- a/vlsisapd/src/configuration/src/Configuration.cpp +++ b/vlsisapd/src/configuration/src/Configuration.cpp @@ -23,6 +23,7 @@ // x-----------------------------------------------------------------x +#include #include #include #include @@ -38,6 +39,24 @@ namespace { using namespace std; using namespace Cfg; + + + void tokenize ( set& tokens, const string& line ) + { + static std::string separators = " ;"; + size_t iBegin = 0; + size_t iEnd = 0; + + for ( ; iEnd < line.size() ; ++iEnd ) { + if ( separators.find(line[iEnd]) != std::string::npos ) { + if ( iBegin < iEnd ) + tokens.insert ( line.substr(iBegin,iEnd-iBegin) ); + iBegin = iEnd+1; + } + } + if ( iBegin < iEnd ) + tokens.insert ( line.substr(iBegin,iEnd-iBegin) ); + } class XmlParser { @@ -123,8 +142,12 @@ namespace { { if ( xmlTextReaderNodeType(_reader) == XML_READER_TYPE_END_ELEMENT ) return; - string attrId = _getAttributeValue("id"); - string attrType = _getAttributeValue("type"); + string attrId = _getAttributeValue("id"); + string attrType = _getAttributeValue("type"); + string attrRestart = _getAttributeValue("needRestart"); + string attrMustExist = _getAttributeValue("mustExist"); + string attrIsFile = _getAttributeValue("isFile"); + string attrIsPath = _getAttributeValue("isPath"); Parameter::Type type = Parameter::String; if ( attrType == "string" ) type = Parameter::String; @@ -144,6 +167,11 @@ namespace { _parameter->setString ( _getAttributeValue("value"), false ); } + if ( not attrRestart.empty() ) _parameter->setFlags ( Parameter::NeedRestart ); + if ( not attrMustExist.empty() ) _parameter->setFlags ( Parameter::MustExist ); + if ( not attrIsFile.empty() ) _parameter->setFlags ( Parameter::IsFile ); + if ( not attrIsPath.empty() ) _parameter->setFlags ( Parameter::IsPath ); + if ( type == Parameter::Percentage ) { istringstream s ( _getAttributeValue("value") ); double ratio; @@ -257,7 +285,7 @@ namespace { { string attrName = _getAttributeValue("name"); - _configuration->getLayout().addTab ( new TabDescription(attrName) ); + _configuration->getLayout().addTab ( attrName ); _status = xmlTextReaderRead ( _reader ); while ( _status == 1 ) { @@ -359,7 +387,13 @@ namespace Cfg { Configuration::Configuration () : _parameters() , _layout (this) - { } + , _flags (0) + , _logSets () + { + _logSets.reserve ( LogTypeSize ); + for ( size_t ilog=0 ; ilog() ); + } ConfigurationWidget* Configuration::buildWidget ( unsigned int flags ) @@ -409,6 +443,18 @@ namespace Cfg { } + void Configuration::addLog ( unsigned int type, const string& id ) + { + _logSets[ (type::const_iterator iparameter = _parameters.begin(); @@ -442,20 +488,23 @@ namespace Cfg { } - bool Configuration::writeToFile ( const std::string& fileName, unsigned int flags ) const + bool Configuration::writeToFile ( const std::string& fileName, unsigned int flags, const string& tabs ) const { ofstream out ( fileName.c_str() ); if ( out.fail() ) return false; - writeToStream ( out, flags ); + writeToStream ( out, flags, tabs ); out.close (); return true; } - void Configuration::writeToStream ( ostream& out, unsigned int flags ) const + void Configuration::writeToStream ( ostream& out, unsigned int flags, const string& tabs ) const { + set tabset; + tokenize ( tabset, tabs ); + out << "" << endl; map::const_iterator iparameter = _parameters.begin(); @@ -465,23 +514,37 @@ namespace Cfg { string id = "\"" + p->getId() + "\""; string type = "\"" + Parameter::typeToString(p->getType()) + "\""; + if ( not tabset.empty() ) { + set::iterator itab = tabset.begin(); + for ( ; itab != tabset.end() ; ++itab ) { + if ( id.compare(1,(*itab).size(),*itab) == 0 ) { + break; + } + } + if ( itab == tabset.end() ) continue; + } + out << " getType() == Parameter::Percentage ) out << p->asPercentage(); + if ( p->getType() == Parameter::Percentage ) out << p->asPercentageString(); else out << p->asString(); out << "\""; if ( flags & DriveValues ) { if ( p->getType() == Parameter::Int ) { - if ( p->hasFlags(Parameter::HasMin) ) out << " min=\"" << p->getMinInt() << "\""; - if ( p->hasFlags(Parameter::HasMax) ) out << " max=\"" << p->getMaxInt() << "\""; + if ( p->hasMin() ) out << " min=\"" << p->getMinInt() << "\""; + if ( p->hasMax() ) out << " max=\"" << p->getMaxInt() << "\""; } else if ( p->getType() == Parameter::Double ) { - if ( p->hasFlags(Parameter::HasMin) ) out << " min=\"" << p->getMinDouble() << "\""; - if ( p->hasFlags(Parameter::HasMax) ) out << " max=\"" << p->getMaxDouble() << "\""; + if ( p->hasMin() ) out << " min=\"" << p->getMinDouble() << "\""; + if ( p->hasMax() ) out << " max=\"" << p->getMaxDouble() << "\""; } + if ( p->hasMustExist() ) out << " mustExist=\"true\""; + if ( p->hasNeedRestart() ) out << " needRestart=\"true\""; + if ( p->isFile() ) out << " isFile=\"true\""; + if ( p->isPath() ) out << " isPath=\"true\""; } if ( (flags&DriveValues) and (p->getType() == Parameter::Enumerate) ) { diff --git a/vlsisapd/src/configuration/src/Configuration.qrc b/vlsisapd/src/configuration/src/Configuration.qrc index b487bc43..fbe12a08 100644 --- a/vlsisapd/src/configuration/src/Configuration.qrc +++ b/vlsisapd/src/configuration/src/Configuration.qrc @@ -1,5 +1,6 @@ images/choose.png + images/warning.png diff --git a/vlsisapd/src/configuration/src/ConfigurationWidget.cpp b/vlsisapd/src/configuration/src/ConfigurationWidget.cpp index 3c9f16e6..f78c1b54 100644 --- a/vlsisapd/src/configuration/src/ConfigurationWidget.cpp +++ b/vlsisapd/src/configuration/src/ConfigurationWidget.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -35,6 +36,7 @@ #include "vlsisapd/configuration/Configuration.h" #include "vlsisapd/configuration/ParameterWidget.h" #include "vlsisapd/configuration/ConfTabWidget.h" +#include "vlsisapd/configuration/LogWidget.h" #include "vlsisapd/configuration/ConfigurationWidget.h" @@ -44,6 +46,7 @@ namespace Cfg { using std::cerr; using std::endl; using std::string; + using std::set; using std::map; using std::pair; using std::make_pair; @@ -62,6 +65,7 @@ namespace Cfg { , _apply (new QPushButton()) , _save (NULL) , _cancel (NULL) + , _log (NULL) { _boldFont.setBold ( true ); @@ -93,6 +97,8 @@ namespace Cfg { vLayout->addStretch (); setLayout ( vLayout ); + + connect ( _apply, SIGNAL(clicked()), this, SLOT(applyClicked()) ); } @@ -158,7 +164,7 @@ namespace Cfg { tab = new ConfTabWidget ( tabName ); _tabWidget->addTab ( tab, tabName.c_str() ); - connect ( _apply, SIGNAL(clicked()), tab, SIGNAL(updateParameters()) ); + connect ( this, SIGNAL(updateParameters()), tab, SIGNAL(updateParameters()) ); return tab; } @@ -178,6 +184,37 @@ namespace Cfg { pw->enableSlaves ( pw->getParameter()->asBool() ); } } + + + void ConfigurationWidget::applyClicked () + { + emit updateParameters(); + checkConfiguration (); + } + + + void ConfigurationWidget::checkConfiguration () + { + Configuration* configuration = Configuration::get(); + + if ( configuration->hasLogs() ) { + if ( _log == NULL ) _log = new LogWidget(this); + _log->updateLogs (); + _log->exec (); + } + } + + + void ConfigurationWidget::selectTab ( const std::string& tabName ) + { + QString qtabName ( tabName.c_str() ); + for ( int itab=0 ; itab<_tabWidget->count() ; ++itab ) { + if ( _tabWidget->tabText(itab) == qtabName ) { + _tabWidget->setCurrentIndex ( itab ); + return; + } + } + } string toXml ( const string& source ) diff --git a/vlsisapd/src/configuration/src/LayoutDescription.cpp b/vlsisapd/src/configuration/src/LayoutDescription.cpp index 4898cf56..bf1e8ff4 100644 --- a/vlsisapd/src/configuration/src/LayoutDescription.cpp +++ b/vlsisapd/src/configuration/src/LayoutDescription.cpp @@ -35,16 +35,40 @@ namespace Cfg { using std::endl; using std::string; using std::vector; + using std::map; + using std::make_pair; using std::ostream; + void TabDescription::addWidget ( WidgetDescription* widget ) + { + _widgets.push_back(widget); + _layout->addWidgetLookup(widget); + } + + + WidgetDescription* LayoutDescription::getWidget ( const string& id ) + { + map::iterator iwid = _widgets.find(id); + if ( iwid != _widgets.end() ) return (*iwid).second; + + return NULL; + } + + + void LayoutDescription::addWidgetLookup ( WidgetDescription* widget ) + { + _widgets.insert ( make_pair(widget->getId(),widget) ); + } + + TabDescription* LayoutDescription::getTab ( const string& tabName ) { for ( size_t itab=0 ; itab<_tabs.size() ; ++itab ) { if ( _tabs[itab]->getName() == tabName ) return _tabs[itab]; } - addTab ( new TabDescription(tabName) ); + addTab ( new TabDescription(this,tabName) ); return getBackTab(); } @@ -77,8 +101,10 @@ namespace Cfg { , int span , unsigned int flags ) { - TabDescription* tab = getTab ( tabName ); - tab->addWidget ( WidgetDescription::parameter(id,label,column,span,flags) ); + TabDescription* tab = getTab ( tabName ); + WidgetDescription* widget = WidgetDescription::parameter(id,label,column,span,flags); + + tab->addWidget ( widget ); } diff --git a/vlsisapd/src/configuration/src/LogWidget.cpp b/vlsisapd/src/configuration/src/LogWidget.cpp new file mode 100644 index 00000000..7fd3d1d6 --- /dev/null +++ b/vlsisapd/src/configuration/src/LogWidget.cpp @@ -0,0 +1,151 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | C o n f i g u r a t i o n D a t a - B a s e | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Module : "./LogWidget.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "vlsisapd/configuration/Configuration.h" +#include "vlsisapd/configuration/LogWidget.h" + + +namespace Cfg { + + using std::set; + using std::string; + using std::cerr; + using std::endl; + + + LogWidget::LogWidget ( QWidget* parent ) + : QDialog (parent) + , _restartMessage (new QLabel()) + , _needExistMessage(new QLabel()) + { + setModal ( true ); + setWindowTitle( tr("") ); + setToolTip ( tr("You should better follow these instructions...") ); + + _restartMessage->setTextFormat ( Qt::RichText ); + _restartMessage->setText ( "Oups! I did it again!" ); + + QLabel* ok = new QLabel (); + ok->setSizePolicy ( QSizePolicy::Preferred, QSizePolicy::MinimumExpanding ); + ok->setPixmap ( QPixmap(":/images/warning.png") ); + ok->setStyleSheet ( "QLabel { background-color: #FF9999;" + " padding: 5px }" ); + + QPushButton* okButton = new QPushButton (); + okButton->setSizePolicy ( QSizePolicy::Fixed, QSizePolicy::Fixed ); + okButton->setText ( tr("Continue") ); + + QHBoxLayout* hLayout2 = new QHBoxLayout (); + hLayout2->addStretch ( 1 ); + hLayout2->addWidget ( okButton, Qt::AlignCenter ); + hLayout2->addStretch ( 1 ); + + QVBoxLayout* vLayout1 = new QVBoxLayout (); + vLayout1->setContentsMargins ( 10, 10, 10, 10 ); + vLayout1->setSpacing ( 0 ); + vLayout1->addWidget ( _restartMessage , Qt::AlignCenter ); + vLayout1->addWidget ( _needExistMessage, Qt::AlignCenter ); + vLayout1->addSpacing ( 10 ); + vLayout1->addLayout ( hLayout2, Qt::AlignCenter ); + + QHBoxLayout* hLayout1 = new QHBoxLayout (); + hLayout1->setSizeConstraint ( QLayout::SetFixedSize ); + hLayout1->setContentsMargins ( 0, 0, 0, 0 ); + hLayout1->addWidget ( ok ); + hLayout1->addLayout ( vLayout1 ); + + setLayout ( hLayout1 ); + + connect ( okButton, SIGNAL(clicked()), this, SLOT(accept()) ); + } + + + void LogWidget::closeEvent ( QCloseEvent* event ) + { + event->ignore (); + } + + + void LogWidget::updateLogs () + { + Configuration* configuration = Configuration::get(); + + for ( size_t ilog=0 ; ilog& logs = configuration->getLogs(ilog); + QLabel* messageLabel = NULL; + QString contents; + const char* header = NULL; + + switch ( ilog ) { + case Configuration::LogRestart: + messageLabel = _restartMessage; + header = "Program needs restart for these parameters to take effect:
"; + break; + case Configuration::LogNeedExist: + messageLabel = _needExistMessage; + header = "Those parameters needs file/path to exists:
"; + break; + } + if ( messageLabel == NULL ) continue; + + if ( not logs.empty() ) { + contents += header; + + set::const_iterator iid = logs.begin(); + for ( ; iid != logs.end() ; ++iid ) { + Parameter* p = configuration->getParameter((*iid)); + if ( p != NULL ) { + WidgetDescription* desc = configuration->getLayout().getWidget ( p->getId() ); + + contents += "   "; + if ( desc != NULL ) { + contents += desc->getLabel().c_str(); + contents += "  "; + } + contents += "<"; + contents += p->getId().c_str(); + contents += ">: "; + if ( p->asString().size() > 30 ) contents += "
     "; + contents += p->asString().c_str(); + contents += "
"; + } + } + } + + messageLabel->setText ( contents ); + } + } + + +} // End of Hurricane Namespace. diff --git a/vlsisapd/src/configuration/src/Parameter.cpp b/vlsisapd/src/configuration/src/Parameter.cpp index eed82c7a..8d68da84 100644 --- a/vlsisapd/src/configuration/src/Parameter.cpp +++ b/vlsisapd/src/configuration/src/Parameter.cpp @@ -24,7 +24,11 @@ #include +#include +namespace bfs = boost::filesystem; + #include "vlsisapd/configuration/Parameter.h" +#include "vlsisapd/configuration/Configuration.h" namespace Cfg { @@ -67,6 +71,20 @@ namespace Cfg { //cerr << "New " << typeToString(_type) << " parameter " << _id << " value:" << _value << endl; } + + + string Parameter::asPercentageString () const + { + if ( (_type != Double) and (_type != Percentage) ) + cerr << "[ERROR] Accessing " << Parameter::typeToString(_type) + << " parameter <" << _id + << "> as " << Parameter::typeToString(Percentage)<< " (type mismatch)." << endl; + + std::istringstream is ( _value ); double r; is >> r; + std::ostringstream os; os << (r*100.0); + + return os.str(); + } bool Parameter::asBool () const @@ -113,64 +131,121 @@ namespace Cfg { } - void Parameter::setString ( const std::string& s, bool check ) + bool Parameter::setString ( const std::string& s, bool check ) { if ( check and (_type != String) ) cerr << "[ERROR] Parameter::setString(): Setting " << Parameter::typeToString(_type) << " parameter <" << _id << "> as " << Parameter::typeToString(String)<< " (type mismatch)." << endl; + if ( _value == s ) return true; + _value = s; _onValueChanged(); + _checkRequirements(); + + return true; } - void Parameter::setBool ( bool b ) + bool Parameter::setBool ( bool b ) { if ( _type != Bool ) cerr << "[ERROR] Parameter::setBool(): Setting " << Parameter::typeToString(_type) << " parameter <" << _id << "> as " << Parameter::typeToString(Bool)<< " (type mismatch)." << endl; - std::ostringstream s; s << std::boolalpha << b; _value = s.str(); + std::ostringstream s; s << std::boolalpha << b; + if ( _value == s.str() ) return true; + _value = s.str(); _onValueChanged(); + _checkRequirements(); + + return true; } - void Parameter::setInt ( int i ) + bool Parameter::setInt ( int i ) { if ( (_type != Int) and (_type != Enumerate) ) cerr << "[ERROR] Parameter::setInt(): Setting " << Parameter::typeToString(_type) << " parameter <" << _id << "> as " << Parameter::typeToString(Int)<< " (type mismatch)." << endl; - std::ostringstream s; s << i; _value = s.str(); - _onValueChanged(); + bool success = checkValue(i); + if ( success ) { + std::ostringstream s; s << i; + if ( _value == s.str() ) return true; + + _value = s.str(); + _onValueChanged(); + _checkRequirements(); + } + + return success; } - void Parameter::setDouble ( double d ) + bool Parameter::setDouble ( double d ) { if ( (_type != Double) and (_type != Percentage) ) cerr << "[ERROR] Parameter::setDouble(): Setting " << Parameter::typeToString(_type) << " parameter <" << _id << "> as " << Parameter::typeToString(Double)<< " (type mismatch)." << endl; - std::ostringstream s; s << d; _value = s.str(); - _onValueChanged(); + bool success = checkValue(d); + if ( success ) { + std::ostringstream s; s << d; + if ( _value == s.str() ) return true; + + _value = s.str(); + _onValueChanged(); + _checkRequirements(); + } + + return success; } - void Parameter::setPercentage ( double d ) + bool Parameter::setPercentage ( double d ) { if ( (_type != Double) and (_type != Percentage) ) cerr << "[ERROR] Parameter::setPercentage(): Setting " << Parameter::typeToString(_type) << " parameter <" << _id << "> as " << Parameter::typeToString(Double)<< " (type mismatch)." << endl; - std::ostringstream s; s << (d/100.0); _value = s.str(); - _onValueChanged(); + bool success = checkValue(d/100.0); + if ( success ) { + std::ostringstream s; s << (d/100.0); + if ( _value == s.str() ) return true; + + _value = s.str(); + _onValueChanged(); + _checkRequirements(); + } + + return success; + } + + + void Parameter::_checkRequirements () const + { + Configuration* configuration = Configuration::get(); + + if ( hasFlags(NeedRestart) ) { + configuration->addLog ( Configuration::LogRestart, _id ); + } + + if ( hasFlags(MustExist) ) { + if ( _type == String ) { + bfs::path filePath = ( asString() ); + if ( not bfs::exists(filePath) ) + configuration->addLog ( Configuration::LogNeedExist, _id ); + else + configuration->removeLog ( Configuration::LogNeedExist, _id ); + } + } } diff --git a/vlsisapd/src/configuration/src/ParameterWidget.cpp b/vlsisapd/src/configuration/src/ParameterWidget.cpp index ea003a97..c0fbfc76 100644 --- a/vlsisapd/src/configuration/src/ParameterWidget.cpp +++ b/vlsisapd/src/configuration/src/ParameterWidget.cpp @@ -173,9 +173,7 @@ namespace Cfg { string valueId = _parameter->getId() + ".edit"; _valueWidget->setObjectName ( valueId.c_str() ); - //Parameter::ParameterChangedCb_t cb = boost::bind(&ParameterWidget::updateValueCb,this); - - _parameter->registerCb ( boost::bind(&ParameterWidget::updateValueCb,this,_1) ); + _parameter->registerCb ( boost::bind(&ParameterWidget::onUpdateValueCb,this,_1) ); } @@ -197,6 +195,113 @@ namespace Cfg { QSpinBox* spinBox = qobject_cast(_valueWidget); int value = spinBox->value(); + if ( not _parameter->setInt(value) ) + spinBox->setValue ( _parameter->asInt() ); + } else { + bool success; + QLineEdit* lineEdit = qobject_cast(_valueWidget); + int value = lineEdit->displayText().toInt ( &success ); + + if ( not success or not _parameter->setInt(value) ) + lineEdit->setText ( _parameter->asString().c_str() ); + } + } + else if ( _parameter->getType() == Parameter::Double ) + { + bool success; + QLineEdit* lineEdit = qobject_cast(_valueWidget); + double value = lineEdit->displayText().toFloat ( &success ); + + if ( not success or not _parameter->setDouble(value) ) + lineEdit->setText ( _parameter->asString().c_str() ); + } + else if ( _parameter->getType() == Parameter::Percentage ) + { + bool success; + QLineEdit* lineEdit = qobject_cast(_valueWidget); + double value = lineEdit->displayText().toFloat ( &success ); + + if ( not success or not _parameter->setPercentage(value) ) { + lineEdit->setText ( _parameter->asPercentageString().c_str() ); + } + } + else if ( _parameter->getType() == Parameter::Enumerate ) + { + QComboBox* comboBox = qobject_cast(_valueWidget); + + const vector& values = _parameter->getValues(); + _parameter->setInt ( values[comboBox->currentIndex()]._value ); + } + } + + + void ParameterWidget::onUpdateValueCb ( Parameter* ) + { + if ( _parameter->getType() == Parameter::String ) + { + QLineEdit* lineEdit = qobject_cast(_valueWidget); + lineEdit->setText ( _parameter->asString().c_str() ); + } + else if ( _parameter->getType() == Parameter::Bool ) + { + QCheckBox* checkBox = qobject_cast(_valueWidget); + checkBox->setChecked ( _parameter->asBool() ); + } + else if ( _parameter->getType() == Parameter::Int ) + { + if ( hasFlags(UseSpinBox) ) { + QSpinBox* spinBox = qobject_cast(_valueWidget); + spinBox->setValue ( _parameter->asInt() ); + } else { + QLineEdit* lineEdit = qobject_cast(_valueWidget); + lineEdit->setText ( _parameter->asString().c_str() ); + } + } + else if ( _parameter->getType() == Parameter::Double ) + { + QLineEdit* lineEdit = qobject_cast(_valueWidget); + lineEdit->setText ( _parameter->asString().c_str() ); + } + else if ( _parameter->getType() == Parameter::Percentage ) + { + QLineEdit* lineEdit = qobject_cast(_valueWidget); + lineEdit->setText ( _parameter->asPercentageString().c_str() ); + } + else if ( _parameter->getType() == Parameter::Enumerate ) + { + QComboBox* comboBox = qobject_cast(_valueWidget); + + int value = _parameter->asInt(); + const vector& values = _parameter->getValues(); + for ( size_t ival=0 ; ival < values.size() ; ++ival ) { + if ( values[ival]._value == value ) { + comboBox->setCurrentIndex ( ival ); + break; + } + } + } + } + + +#if BACKUP + void ParameterWidget::onUpdateValueCb ( Parameter* ) + { + if ( _parameter->getType() == Parameter::String ) + { + QLineEdit* lineEdit = qobject_cast(_valueWidget); + _parameter->setString ( lineEdit->displayText().toStdString() ); + } + else if ( _parameter->getType() == Parameter::Bool ) + { + QCheckBox* checkBox = qobject_cast(_valueWidget); + _parameter->setBool ( checkBox->isChecked() ); + } + else if ( _parameter->getType() == Parameter::Int ) + { + if ( hasFlags(UseSpinBox) ) { + QSpinBox* spinBox = qobject_cast(_valueWidget); + int value = spinBox->value(); + if ( _parameter->checkValue(value) ) _parameter->setInt ( value ); else spinBox->setValue ( _parameter->asInt() ); } else { @@ -237,67 +342,7 @@ namespace Cfg { _parameter->setInt ( values[comboBox->currentIndex()]._value ); } } - - - void ParameterWidget::updateValueCb ( Parameter* p ) - { - if ( _parameter->getType() == Parameter::String ) - { - QLineEdit* lineEdit = qobject_cast(_valueWidget); - if ( _parameter->asString() != lineEdit->displayText().toStdString() ) return; - - lineEdit->setText ( _parameter->asString().c_str() ); - } - else if ( _parameter->getType() == Parameter::Bool ) - { - QCheckBox* checkBox = qobject_cast(_valueWidget); - if ( _parameter->asBool() == checkBox->isChecked() ) return; - - checkBox->setCheckState ( Qt::Checked ); - } - else if ( _parameter->getType() == Parameter::Int ) - { - if ( hasFlags(UseSpinBox) ) { - QSpinBox* spinBox = qobject_cast(_valueWidget); - if ( spinBox->value() == _parameter->asInt() ) return; - - spinBox->setValue ( _parameter->asInt() ); - } else { - QLineEdit* lineEdit = qobject_cast(_valueWidget); - if ( _parameter->asString() == lineEdit->displayText().toStdString() ) return; - - lineEdit->setText ( _parameter->asString().c_str() ); - } - } - else if ( _parameter->getType() == Parameter::Double ) - { - bool success; - QLineEdit* lineEdit = qobject_cast(_valueWidget); - if ( _parameter->asDouble() == lineEdit->displayText().toFloat(&success) ) return; - - lineEdit->setText ( _parameter->asString().c_str() ); - } - else if ( _parameter->getType() == Parameter::Percentage ) - { - bool success; - QLineEdit* lineEdit = qobject_cast(_valueWidget); - double value = lineEdit->displayText().toFloat ( &success ); - - if ( value == _parameter->asPercentage() ) return; - lineEdit->setText ( QString("%1").arg(_parameter->asPercentage()) ); - } - else if ( _parameter->getType() == Parameter::Enumerate ) - { - QComboBox* comboBox = qobject_cast(_valueWidget); - const vector& values = _parameter->getValues(); - - if ( values[comboBox->currentIndex()]._value == _parameter->asInt() ) return; - for ( size_t ivalue=0 ; ivalueasInt() ) - comboBox->setCurrentIndex ( ivalue ); - } - } - } +#endif void ParameterWidget::enableSlaves ( int state ) diff --git a/vlsisapd/src/configuration/src/images/warning.png b/vlsisapd/src/configuration/src/images/warning.png new file mode 100644 index 0000000000000000000000000000000000000000..43aa17c63b8832fc70f68e4e4723c16b08aa5a04 GIT binary patch literal 2514 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 literal 0 HcmV?d00001 diff --git a/vlsisapd/src/configuration/src/vlsisapd/configuration/ConfEditorWidget.h b/vlsisapd/src/configuration/src/vlsisapd/configuration/ConfEditorWidget.h index a7a034ec..37e028c4 100644 --- a/vlsisapd/src/configuration/src/vlsisapd/configuration/ConfEditorWidget.h +++ b/vlsisapd/src/configuration/src/vlsisapd/configuration/ConfEditorWidget.h @@ -39,11 +39,12 @@ namespace Cfg { class ConfEditorWidget : public QMainWindow { Q_OBJECT; public: - ConfEditorWidget ( QWidget* parent=NULL ); - void createActions (); - void createMenus (); + ConfEditorWidget ( QWidget* parent=NULL ); + void createActions (); + void createMenus (); + inline ConfigurationWidget* getConfigurationWidget (); public slots: - void save (); + void save (); private: ConfigurationWidget* _configurationWidget; QMenu* _fileMenu; @@ -52,6 +53,11 @@ namespace Cfg { }; +// Inline Functions. + inline ConfigurationWidget* ConfEditorWidget::getConfigurationWidget () + { return _configurationWidget; } + + } // End of Cfg namespace. #endif // __VLSISAPD_CONF_EDITOR_WIDGET__ diff --git a/vlsisapd/src/configuration/src/vlsisapd/configuration/Configuration.h b/vlsisapd/src/configuration/src/vlsisapd/configuration/Configuration.h index eb2ceed5..8cd0200a 100644 --- a/vlsisapd/src/configuration/src/vlsisapd/configuration/Configuration.h +++ b/vlsisapd/src/configuration/src/vlsisapd/configuration/Configuration.h @@ -28,6 +28,7 @@ #include #include +#include #include #include "vlsisapd/configuration/Parameter.h" #include "vlsisapd/configuration/LayoutDescription.h" @@ -41,31 +42,42 @@ namespace Cfg { class Configuration { public: - enum Flags { DriveValues=0x1, DriveLayout=0x2 }; + enum Flags { DriveValues=0x1, DriveLayout=0x2 }; + enum LogType { LogRestart=0, LogNeedExist, LogTypeSize }; public: - static Configuration* get (); + static Configuration* get (); public: // Methods. - ConfigurationWidget* buildWidget ( unsigned int flags ); + ConfigurationWidget* buildWidget ( unsigned int flags ); ConfigurationDialog* buildDialog (); inline const std::map& - getParameters () const; - inline const LayoutDescription& getLayout () const; - inline LayoutDescription& getLayout (); - Parameter* getParameter ( const std::string& id - , Parameter::Type type=Parameter::Unknown ) const; - Parameter* addParameter ( const std::string& id - , Parameter::Type type - , const std::string& value ); - void print ( std::ostream& ) const; - bool readFromFile ( const std::string& ); - bool writeToFile ( const std::string&, unsigned int flags ) const; - void writeToStream ( std::ostream&, unsigned int flags ) const; + getParameters () const; + inline const std::set& + getLogs ( unsigned int type ) const; + inline unsigned int getFlags () const; + inline const LayoutDescription& getLayout () const; + inline LayoutDescription& getLayout (); + Parameter* getParameter ( const std::string& id + , Parameter::Type type=Parameter::Unknown ) const; + Parameter* addParameter ( const std::string& id + , Parameter::Type type + , const std::string& value ); + inline void setFlags ( unsigned int mask ); + inline bool hasLogs () const; + void addLog ( unsigned int type, const std::string& id ); + void removeLog ( unsigned int type, const std::string& id ); + inline void clearLogs (); + void print ( std::ostream& ) const; + bool readFromFile ( const std::string& ); + bool writeToFile ( const std::string&, unsigned int flags, const std::string& tabs="" ) const; + void writeToStream ( std::ostream&, unsigned int flags, const std::string& tabs="" ) const; private: // Attributes. static Configuration* _singleton; std::map _parameters; LayoutDescription _layout; + unsigned int _flags; + std::vector< std::set > _logSets; private: Configuration (); }; @@ -75,8 +87,26 @@ namespace Cfg { inline const std::map& Configuration::getParameters () const { return _parameters; } + inline const std::set& Configuration::getLogs ( unsigned int type ) const + { return _logSets[(type #include +#include #include @@ -36,6 +37,7 @@ namespace Cfg { class Configuration; class ConfigurationWidget; + class LayoutDescription; // ------------------------------------------------------------------- @@ -120,24 +122,22 @@ namespace Cfg { class TabDescription { public: - inline TabDescription ( const std::string& name ); - inline void addWidget ( WidgetDescription* ); + inline TabDescription ( LayoutDescription*, const std::string& name ); + void addWidget ( WidgetDescription* ); inline const std::string& getName () const; inline const std::vector& getWidgets () const; private: + LayoutDescription* _layout; std::string _name; std::vector _widgets; }; // Inline Methods. - inline TabDescription::TabDescription ( const std::string& name ) - : _name(name), _widgets() + inline TabDescription::TabDescription ( LayoutDescription* layout, const std::string& name ) + : _layout(layout), _name(name), _widgets() { } - inline void TabDescription::addWidget ( WidgetDescription* widget ) - { _widgets.push_back(widget); } - inline const std::string& TabDescription::getName () const { return _name; } @@ -152,7 +152,10 @@ namespace Cfg { class LayoutDescription { public: inline LayoutDescription ( Configuration* ); + WidgetDescription* getWidget ( const std::string& id ); + void addWidgetLookup ( WidgetDescription* ); inline void addTab ( TabDescription* ); + inline void addTab ( const std::string& tabName ); inline TabDescription* getBackTab (); TabDescription* getTab ( const std::string& tabName ); inline const std::vector& getTabs () const; @@ -171,19 +174,23 @@ namespace Cfg { ConfigurationWidget* buildWidget ( unsigned int flags ); void writeToStream ( std::ostream& ) const; private: - Configuration* _configuration; - std::vector _tabs; + Configuration* _configuration; + std::vector _tabs; + std::map _widgets; }; // Inline Methods. inline LayoutDescription::LayoutDescription ( Configuration* cfg ) - : _configuration(cfg), _tabs() + : _configuration(cfg), _tabs(), _widgets() { } inline void LayoutDescription::addTab ( TabDescription* tab ) { _tabs.push_back(tab); } + inline void LayoutDescription::addTab ( const std::string& tabName ) + { addTab ( new TabDescription(this,tabName) ); } + inline TabDescription* LayoutDescription::getBackTab () { return _tabs.back(); } diff --git a/vlsisapd/src/configuration/src/vlsisapd/configuration/LogWidget.h b/vlsisapd/src/configuration/src/vlsisapd/configuration/LogWidget.h new file mode 100644 index 00000000..355a5a74 --- /dev/null +++ b/vlsisapd/src/configuration/src/vlsisapd/configuration/LogWidget.h @@ -0,0 +1,53 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | C o n f i g u r a t i o n D a t a - B a s e | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Header : "./vlsispad/configuration/LogWidget.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#ifndef __CONFIGURATION_LOG_WIDGET__ +#define __CONFIGURATION_LOG_WIDGET__ + + +#include +class QLabel; + + +namespace Cfg { + + + class LogWidget : public QDialog { + Q_OBJECT; + public: + LogWidget ( QWidget* parent=NULL); + void updateLogs (); + private: + QLabel* _restartMessage; + QLabel* _needExistMessage; + protected: + virtual void closeEvent ( QCloseEvent* ); + }; + + +} // End of Configuration namespace. + + +#endif // __CONFIGURATION_LOG_WIDGET__ diff --git a/vlsisapd/src/configuration/src/vlsisapd/configuration/Parameter.h b/vlsisapd/src/configuration/src/vlsisapd/configuration/Parameter.h index 2d3a0363..5e47fa8e 100644 --- a/vlsisapd/src/configuration/src/vlsisapd/configuration/Parameter.h +++ b/vlsisapd/src/configuration/src/vlsisapd/configuration/Parameter.h @@ -38,16 +38,20 @@ namespace Cfg { class Parameter { public: - enum Type { Unknown = 0 - , String = 1 - , Bool = 2 - , Int = 3 - , Enumerate = 4 - , Double = 5 - , Percentage = 6 - }; - enum Flags { HasMin = 0x1 - , HasMax = 0x2 + enum Type { Unknown = 0 + , String = 1 + , Bool = 2 + , Int = 3 + , Enumerate = 4 + , Double = 5 + , Percentage = 6 + }; + enum Flags { HasMin = 0x01 + , HasMax = 0x02 + , IsFile = 0x04 + , IsPath = 0x08 + , NeedRestart = 0x10 + , MustExist = 0x20 }; typedef boost::function< void(Parameter*) > ParameterChangedCb_t; public: @@ -59,46 +63,54 @@ namespace Cfg { int _value; }; public: - static std::string typeToString ( Type ); - public: - Parameter ( const std::string& id - , Type type - , const std::string& value ); - inline const std::string& getId () const; - inline const Type getType () const; - inline const std::vector& - getValues () const; - inline const std::vector& - getSlaves () const; - inline int getFlags () const; - inline bool hasFlags ( int mask ) const; - inline int getMinInt () const; - inline int getMaxInt () const; - inline double getMinDouble () const; - inline double getMaxDouble () const; - inline bool checkValue ( int ) const; - inline bool checkValue ( double ) const; - inline const std::string& asString () const; - bool asBool () const; - int asInt () const; - double asDouble () const; - double asPercentage () const; - inline void addValue ( const std::string&, int ); - inline void addSlave ( const std::string& ); - void setString ( const std::string&, bool check=true ); - inline void setFlags ( int mask ); - inline void unsetFlags ( int mask ); - void setBool ( bool ); - void setInt ( int ); - void setDouble ( double ); - void setPercentage ( double ); - inline void setMin ( int ); - inline void setMax ( int ); - inline void setMin ( double ); - inline void setMax ( double ); - inline void registerCb ( ParameterChangedCb_t ); - private: - inline void _onValueChanged (); + static std::string typeToString ( Type ); + public: + Parameter ( const std::string& id + , Type type + , const std::string& value ); + inline bool isFile () const; + inline bool isPath () const; + inline bool hasMin () const; + inline bool hasMax () const; + inline bool hasNeedRestart () const; + inline bool hasMustExist () const; + inline bool hasFlags ( int mask ) const; + inline const std::string& getId () const; + inline const Type getType () const; + inline const std::vector& + getValues () const; + inline const std::vector& + getSlaves () const; + inline int getFlags () const; + inline int getMinInt () const; + inline int getMaxInt () const; + inline double getMinDouble () const; + inline double getMaxDouble () const; + inline bool checkValue ( int ) const; + inline bool checkValue ( double ) const; + inline const std::string& asString () const; + std::string asPercentageString () const; + bool asBool () const; + int asInt () const; + double asDouble () const; + double asPercentage () const; + inline void addValue ( const std::string&, int ); + inline void addSlave ( const std::string& ); + inline void setFlags ( int mask ); + inline void unsetFlags ( int mask ); + bool setString ( const std::string&, bool check=true ); + bool setBool ( bool ); + bool setInt ( int ); + bool setDouble ( double ); + bool setPercentage ( double ); + inline void setMin ( int ); + inline void setMax ( int ); + inline void setMin ( double ); + inline void setMax ( double ); + inline void registerCb ( ParameterChangedCb_t ); + private: + inline void _onValueChanged (); + void _checkRequirements () const; private: // Attributes. std::string _id; @@ -116,15 +128,21 @@ namespace Cfg { // Inline Methods. - inline const std::string& Parameter::getId () const { return _id; } - inline const Parameter::Type Parameter::getType () const { return _type; } - inline int Parameter::getFlags () const { return _flags; } - inline bool Parameter::hasFlags ( int mask ) const { return (_flags & mask); } - inline int Parameter::getMinInt () const { return _minInt; } - inline int Parameter::getMaxInt () const { return _maxInt; } - inline double Parameter::getMinDouble () const { return _minDouble; } - inline double Parameter::getMaxDouble () const { return _maxDouble; } - inline const std::string& Parameter::asString () const { return _value; } + inline bool Parameter::isFile () const { return hasFlags(IsFile); }; + inline bool Parameter::isPath () const { return hasFlags(IsPath); }; + inline bool Parameter::hasMin () const { return hasFlags(HasMin); }; + inline bool Parameter::hasMax () const { return hasFlags(HasMax); }; + inline bool Parameter::hasNeedRestart () const { return hasFlags(NeedRestart); }; + inline bool Parameter::hasMustExist () const { return hasFlags(MustExist); }; + inline const std::string& Parameter::getId () const { return _id; } + inline const Parameter::Type Parameter::getType () const { return _type; } + inline int Parameter::getFlags () const { return _flags; } + inline bool Parameter::hasFlags ( int mask ) const { return (_flags & mask); } + inline int Parameter::getMinInt () const { return _minInt; } + inline int Parameter::getMaxInt () const { return _maxInt; } + inline double Parameter::getMinDouble () const { return _minDouble; } + inline double Parameter::getMaxDouble () const { return _maxDouble; } + inline const std::string& Parameter::asString () const { return _value; } inline bool Parameter::checkValue ( int value ) const { bool ok = not ( ( (_flags&HasMin) and (value < _minInt) ) diff --git a/vlsisapd/src/configuration/src/vlsisapd/configuration/ParameterWidget.h b/vlsisapd/src/configuration/src/vlsisapd/configuration/ParameterWidget.h index 8e90344a..aefdc30a 100644 --- a/vlsisapd/src/configuration/src/vlsisapd/configuration/ParameterWidget.h +++ b/vlsisapd/src/configuration/src/vlsisapd/configuration/ParameterWidget.h @@ -54,7 +54,7 @@ namespace Cfg { inline bool hasFlags ( int mask ) const; inline void setFlags ( int mask ); inline void unsetFlags ( int mask ); - void updateValueCb ( Parameter* ); + void onUpdateValueCb ( Parameter* ); public slots: void updateValue (); void enableSlaves ( int );