SpikeStream Nemo Plugin  0.2
ExperimentLoaderWidget.cpp
Go to the documentation of this file.
00001 //SpikeStream includes
00002 #include "ExperimentLoaderWidget.h"
00003 #include "Globals.h"
00004 #include "PluginManager.h"
00005 using namespace spikestream;
00006 
00007 //Qt includes
00008 #include <QLabel>
00009 #include <QDebug>
00010 
00011 
00013 ExperimentLoaderWidget::ExperimentLoaderWidget(QString pluginPath, QWidget* parent) : QWidget(parent) {
00014         //Create vertical box to organize layout
00015         mainVerticalBox = new QVBoxLayout(this);
00016 
00017         try{
00018                 //Get list of available analysis plugins
00019                 PluginManager* pluginManager = new PluginManager(pluginPath);
00020                 pluginManager->loadPlugins();
00021                 QStringList pluginList = pluginManager->getPluginNames();
00022 
00023                 //Add list to combo box
00024                 QComboBox* pluginsCombo = new QComboBox(this);
00025                 pluginsCombo->addItems(pluginList);
00026 
00027                 //Add combo to layout
00028                 QHBoxLayout *comboBox = new QHBoxLayout();
00029                 comboBox->addWidget(new QLabel("Experiment plugins: "));
00030                 comboBox->addWidget(pluginsCombo);
00031                 comboBox->addStretch(5);
00032                 mainVerticalBox->addLayout(comboBox);
00033 
00034                 //Add the widgets to a stacked widget
00035                 stackedWidget = new QStackedWidget();
00036                 for(QList<QString>::iterator iter = pluginList.begin(); iter != pluginList.end(); ++iter){
00037                         QWidget* tmpWidget = pluginManager->getPlugin(*iter);
00038                         abstractExperimentList.append((AbstractExperimentWidget*)tmpWidget);
00039                         pluginWidgetMap[*iter] = stackedWidget->addWidget(tmpWidget);
00040                 }
00041 
00042                 //Add stacked widget to layout
00043                 mainVerticalBox->addWidget(stackedWidget);
00044 
00045                 //Connect combo changed signal to slot loading appropriate analysis widget
00046                 connect(pluginsCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(showExperimentWidget(int)) );
00047         }
00048         catch(SpikeStreamException& ex){
00049                 qCritical()<<ex.getMessage();
00050         }
00051 }
00052 
00053 
00055 ExperimentLoaderWidget::~ExperimentLoaderWidget(){
00056 }
00057 
00058 
00059 /*------------------------------------------------------------*/
00060 /*------               PRIVATE SLOTS                    ------*/
00061 /*------------------------------------------------------------*/
00062 
00065 void ExperimentLoaderWidget::showExperimentWidget(int layerID){
00066         if(layerID != stackedWidget->currentIndex()){
00067                 stackedWidget->setCurrentIndex(layerID);
00068         }
00069 }
00070 
00071 
00072 
 All Classes Files Functions Variables Typedefs Defines