SpikeStream Application Library
0.2
|
00001 //SpikeStream includes 00002 #include "SpikeRasterDialog.h" 00003 #include "SpikeStreamException.h" 00004 using namespace spikestream; 00005 00006 //Qt includes 00007 #include <QComboBox> 00008 #include <QDebug> 00009 #include <QLayout> 00010 00011 00013 SpikeRasterDialog::SpikeRasterDialog(QList<NeuronGroup*> neuronGroupList, QWidget* parent) : QDialog(parent){ 00014 QVBoxLayout* mainVBox = new QVBoxLayout(this); 00015 00016 try{ 00017 spikeRasterWidget = new SpikeRasterWidget(neuronGroupList, this); 00018 00019 QComboBox* colorCombo = new QComboBox(); 00020 colorCombo->addItem("Color"); 00021 colorCombo->addItem("Black and white"); 00022 connect(colorCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(colorComboChanged(int))); 00023 00024 mainVBox->addWidget(colorCombo); 00025 mainVBox->addWidget(spikeRasterWidget); 00026 } 00027 catch(SpikeStreamException& ex){ 00028 qCritical()<<"Raster error: "<<ex.getMessage(); 00029 } 00030 catch(...){ 00031 qCritical()<<"An unknown exception occurred"; 00032 } 00033 } 00034 00035 00037 SpikeRasterDialog::~SpikeRasterDialog(){ 00038 } 00039 00040 00041 /*----------------------------------------------------------*/ 00042 /*------ PRIVATE SLOTS ------*/ 00043 /*----------------------------------------------------------*/ 00044 00046 void SpikeRasterDialog::colorComboChanged(int index){ 00047 if(index == 0){ 00048 spikeRasterWidget->setBlackAndWhite(false); 00049 } 00050 else if (index == 1){ 00051 spikeRasterWidget->setBlackAndWhite(true); 00052 } 00053 else{ 00054 throw SpikeStreamException("Index not recognized: " + QString::number(index)); 00055 } 00056 } 00057 00059 void SpikeRasterDialog::addData(const QList<unsigned>& firingNeuronIDs, unsigned timeStep){ 00060 spikeRasterWidget->addSpikes(firingNeuronIDs,timeStep); 00061 }