SpikeStream Application Library  0.2
ParametersDialog.cpp
Go to the documentation of this file.
00001 //SpikeStream includes
00002 #include "Globals.h"
00003 #include "ParametersDialog.h"
00004 #include "SpikeStreamException.h"
00005 using namespace spikestream;
00006 
00007 //Qt includes
00008 #include <QScrollArea>
00009 
00010 
00012 ParametersDialog::ParametersDialog(const QList<ParameterInfo>& paramInfoList, const QHash<QString, double>& defaultParameterMap, const QHash<QString, double>& currentParameterMap, QWidget* parent)
00013                 : AbstractParametersEditDialog(paramInfoList, parent) {
00014 
00015         //Store map with default values
00016         this->defaultParameterMap = defaultParameterMap;
00017 
00018         //Scroll area for parameters
00019         QScrollArea* scrollArea = new QScrollArea(this);
00020         QWidget* parameterHoldingWidget = new QWidget();
00021 
00022         //Create layout to organize widget within scroll area
00023         QVBoxLayout* mainVBox = new QVBoxLayout(parameterHoldingWidget);
00024 
00025         //Add the parameter edit fields
00026         addParameters(mainVBox);
00027 
00028         //Sets the values of the parameters
00029         setParameterValues(currentParameterMap);
00030 
00031         //Add the buttons
00032         addButtons(mainVBox);
00033 
00034         scrollArea->setWidget(parameterHoldingWidget);
00035         scrollArea->setMinimumSize(800, 500);
00036         this->setMinimumSize(800,500);
00037         this->setMaximumSize(800,500);
00038 }
00039 
00040 
00042 ParametersDialog::~ParametersDialog(){
00043 }
00044 
00045 
00046 /*--------------------------------------------------------*/
00047 /*-------              PROTECTED SLOTS             -------*/
00048 /*--------------------------------------------------------*/
00049 
00051 void ParametersDialog::defaultButtonClicked(){
00052         try{
00053                 setParameterValues(defaultParameterMap);
00054         }
00055         catch(SpikeStreamException& ex){
00056                 qCritical()<<ex.getMessage();
00057                 this->accept();
00058         }
00059 }
00060 
00061 
00063 void ParametersDialog::okButtonClicked(){
00064         try{
00065                 currentParameterMap = getParameterValues();
00066 
00067                 //Close dialog
00068                 this->accept();
00069         }
00070         catch(SpikeStreamException& ex){
00071                 qCritical()<<ex.getMessage();
00072         }
00073 }
 All Classes Files Functions Variables Typedefs Friends Defines