Adding new ConfigurationDialog widget (QDialog) and buildDialog method on configuration.

This is very useful when using configuration as a standalone widget
This commit is contained in:
Damien Dupuis 2010-09-20 10:48:13 +00:00
parent c904ed18f7
commit 136e5e90c7
5 changed files with 104 additions and 0 deletions

View File

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

View File

@ -30,6 +30,7 @@
#include <libxml/xmlreader.h>
#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
{

View File

@ -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 <QVBoxLayout>
#include <QPushButton>
#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.

View File

@ -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<const std::string,Parameter*>&
getParameters () const;
inline const LayoutDescription& getLayout () const;

View File

@ -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 <QDialog>
namespace Cfg {
class ConfigurationDialog : public QDialog {
Q_OBJECT;
public:
ConfigurationDialog(QWidget* parent=NULL);
signals:
void saveToFile();
};
} // End of Cfg namespace.
#endif // __CFG_CONFIGURATION_DIALOG_