From 136e5e90c744d6e59bf2c172a8530cb87df91c7d Mon Sep 17 00:00:00 2001 From: Damien Dupuis Date: Mon, 20 Sep 2010 10:48:13 +0000 Subject: [PATCH] Adding new ConfigurationDialog widget (QDialog) and buildDialog method on configuration. This is very useful when using configuration as a standalone widget --- vlsisapd/src/configuration/src/CMakeLists.txt | 2 + .../src/configuration/src/Configuration.cpp | 4 ++ .../configuration/src/ConfigurationDialog.cpp | 51 +++++++++++++++++++ .../vlsisapd/configuration/Configuration.h | 2 + .../configuration/ConfigurationDialog.h | 45 ++++++++++++++++ 5 files changed, 104 insertions(+) create mode 100644 vlsisapd/src/configuration/src/ConfigurationDialog.cpp create mode 100644 vlsisapd/src/configuration/src/vlsisapd/configuration/ConfigurationDialog.h diff --git a/vlsisapd/src/configuration/src/CMakeLists.txt b/vlsisapd/src/configuration/src/CMakeLists.txt index 7fca3224..8d206c6c 100644 --- a/vlsisapd/src/configuration/src/CMakeLists.txt +++ b/vlsisapd/src/configuration/src/CMakeLists.txt @@ -8,6 +8,7 @@ set ( mocIncludes vlsisapd/configuration/FilePathEdit.h vlsisapd/configuration/ConfigurationWidget.h + vlsisapd/configuration/ConfigurationDialog.h vlsisapd/configuration/ParameterWidget.h vlsisapd/configuration/ConfTabWidget.h vlsisapd/configuration/ConfEditorWidget.h @@ -23,6 +24,7 @@ ParameterWidget.cpp ConfTabWidget.cpp ConfigurationWidget.cpp + ConfigurationDialog.cpp ConfEditorWidget.cpp ) set ( editorcpp ConfEditorMain.cpp ) diff --git a/vlsisapd/src/configuration/src/Configuration.cpp b/vlsisapd/src/configuration/src/Configuration.cpp index 889dd27e..d53d06c5 100644 --- a/vlsisapd/src/configuration/src/Configuration.cpp +++ b/vlsisapd/src/configuration/src/Configuration.cpp @@ -30,6 +30,7 @@ #include #include "vlsisapd/configuration/Configuration.h" #include "vlsisapd/configuration/ConfigurationWidget.h" +#include "vlsisapd/configuration/ConfigurationDialog.h" #include "vlsisapd/configuration/ParameterWidget.h" @@ -364,6 +365,9 @@ namespace Cfg { ConfigurationWidget* Configuration::buildWidget ( unsigned int flags ) { return _layout.buildWidget(flags); } + ConfigurationDialog* Configuration::buildDialog() + { return new ConfigurationDialog(); } + Parameter* Configuration::getParameter ( const string& name, Parameter::Type type ) const { diff --git a/vlsisapd/src/configuration/src/ConfigurationDialog.cpp b/vlsisapd/src/configuration/src/ConfigurationDialog.cpp new file mode 100644 index 00000000..d5507690 --- /dev/null +++ b/vlsisapd/src/configuration/src/ConfigurationDialog.cpp @@ -0,0 +1,51 @@ + +// -*- C++ -*- +// +// This file is part of the VSLSI Stand-Alone Software. +// Copyright (c) UPMC/LIP6 2010-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 : Damien Dupuis | +// | E-mail : damien.dupuis@lip6.fr | +// | =============================================================== | +// | C++ Module : "./ConfigurationDialog.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#include +#include + +#include "vlsisapd/configuration/Configuration.h" +#include "vlsisapd/configuration/ConfigurationWidget.h" +#include "vlsisapd/configuration/ConfigurationDialog.h" + + +namespace Cfg { + +ConfigurationDialog::ConfigurationDialog(QWidget* parent): QDialog(parent) { + setModal(true); + setWindowTitle("Configure window"); + + ConfigurationWidget* confWidget = Configuration::get()->buildWidget(ConfigurationWidget::StandAlone); + connect(confWidget->getApplyButton() , SIGNAL(clicked()), this, SLOT(close())); + connect(confWidget->getCancelButton(), SIGNAL(clicked()), this, SLOT(close())); + connect(confWidget->getSaveButton() , SIGNAL(clicked()), this, SIGNAL(saveToFile())); + + QVBoxLayout* vLayout = new QVBoxLayout (); + vLayout->addWidget(confWidget); + + setLayout ( vLayout ); + } + +} // End of Cfg namespace. diff --git a/vlsisapd/src/configuration/src/vlsisapd/configuration/Configuration.h b/vlsisapd/src/configuration/src/vlsisapd/configuration/Configuration.h index 70d0470b..eb2ceed5 100644 --- a/vlsisapd/src/configuration/src/vlsisapd/configuration/Configuration.h +++ b/vlsisapd/src/configuration/src/vlsisapd/configuration/Configuration.h @@ -36,6 +36,7 @@ namespace Cfg { class ConfigurationWidget; + class ConfigurationDialog; class Configuration { @@ -46,6 +47,7 @@ namespace Cfg { public: // Methods. ConfigurationWidget* buildWidget ( unsigned int flags ); + ConfigurationDialog* buildDialog (); inline const std::map& getParameters () const; inline const LayoutDescription& getLayout () const; diff --git a/vlsisapd/src/configuration/src/vlsisapd/configuration/ConfigurationDialog.h b/vlsisapd/src/configuration/src/vlsisapd/configuration/ConfigurationDialog.h new file mode 100644 index 00000000..0ecae3e5 --- /dev/null +++ b/vlsisapd/src/configuration/src/vlsisapd/configuration/ConfigurationDialog.h @@ -0,0 +1,45 @@ + +// -*- C++ -*- +// +// This file is part of the VSLSI Stand-Alone Software. +// Copyright (c) UPMC/LIP6 2010-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 : Damien Dupuis | +// | E-mail : damien.dupuis@lip6.fr | +// | =============================================================== | +// | C++ Header : "./ConfigurationDialog.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + + +#ifndef __CFG_CONFIGURATION_DIALOG__ +#define __CFG_CONFIGURATION_DIALOG__ + +#include + +namespace Cfg { +class ConfigurationDialog : public QDialog { + Q_OBJECT; + public: + ConfigurationDialog(QWidget* parent=NULL); + + signals: + void saveToFile(); + +}; + +} // End of Cfg namespace. + +#endif // __CFG_CONFIGURATION_DIALOG_