SpikeStream Application Library
0.2
|
00001 //SpikeStream includes 00002 #include "AbstractExperimentWidget.h" 00003 #include "Globals.h" 00004 #include "ParametersDialog.h" 00005 using namespace spikestream; 00006 00007 00009 AbstractExperimentWidget::AbstractExperimentWidget(QWidget* parent) : QWidget(parent){ 00010 parametersBuilt = false; 00011 } 00012 00013 00015 AbstractExperimentWidget::~AbstractExperimentWidget(){ 00016 } 00017 00018 00019 /*----------------------------------------------------------*/ 00020 /*------ PROTECTED METHODS ------*/ 00021 /*----------------------------------------------------------*/ 00022 00024 QToolBar* AbstractExperimentWidget::getToolBar(){ 00025 QToolBar* tmpToolBar = new QToolBar(this); 00026 00027 playAction = new QAction(QIcon(Globals::getSpikeStreamRoot() + "/images/play.png"), "Start experiment", this); 00028 connect(playAction, SIGNAL(triggered()), this, SLOT(startExperiment())); 00029 tmpToolBar->addAction (playAction); 00030 00031 stopAction = new QAction(QIcon(Globals::getSpikeStreamRoot() + "/images/stop.png"), "Stop experiment", this); 00032 connect(stopAction, SIGNAL(triggered()), this, SLOT(stopExperiment())); 00033 stopAction->setEnabled(false); 00034 tmpToolBar->addAction (stopAction); 00035 00036 parametersButton = new QPushButton("Parameters"); 00037 connect(parametersButton, SIGNAL(clicked()), this, SLOT(parametersButtonClicked())); 00038 parametersButton->setMaximumSize(100, 20); 00039 parametersButton->setMinimumSize(100, 20); 00040 tmpToolBar->addWidget(parametersButton); 00041 00042 return tmpToolBar; 00043 } 00044 00045 00046 /*----------------------------------------------------------*/ 00047 /*------ PRIVATE SLOTS ------*/ 00048 /*----------------------------------------------------------*/ 00049 00051 void AbstractExperimentWidget::parametersButtonClicked(){ 00052 //Build parameter maps if this has not been done 00053 if(!parametersBuilt){ 00054 buildParameters(); 00055 parametersBuilt = true; 00056 } 00057 00058 //Launch dialog to edit parameters 00059 try{ 00060 ParametersDialog dialog(parameterInfoList, defaultParameterMap, parameterMap, this); 00061 if(dialog.exec() == QDialog::Accepted){ 00062 parameterMap = dialog.getParameters(); 00063 } 00064 } 00065 catch(SpikeStreamException& ex){ 00066 qCritical()<<ex.getMessage(); 00067 } 00068 } 00069 00070