SpikeStream Application Library
0.2
|
00001 //SpikeStream includes 00002 #include "Globals.h" 00003 #include "SynapseParametersEditDialog.h" 00004 #include "SpikeStreamException.h" 00005 using namespace spikestream; 00006 00007 00009 SynapseParametersEditDialog::SynapseParametersEditDialog(const ConnectionGroupInfo& conGrpInfo, const QList<ParameterInfo>& paramInfoList, const QHash<QString, double>& currParamValueMap, QWidget* parent) 00010 : AbstractParametersEditDialog(paramInfoList, parent) { 00011 00012 //Store the connection group info for when we update the parameters 00013 this->conGrpInfo = conGrpInfo; 00014 00015 //Create layout to organize dialog 00016 QVBoxLayout* mainVBox = new QVBoxLayout(this); 00017 00018 //Add the parameter edit fields 00019 addParameters(mainVBox); 00020 00021 //Sets the values of the parameters 00022 setParameterValues(currParamValueMap); 00023 00024 //Add the buttons 00025 addButtons(mainVBox); 00026 } 00027 00028 00030 SynapseParametersEditDialog::~SynapseParametersEditDialog(){ 00031 } 00032 00033 00034 /*--------------------------------------------------------*/ 00035 /*------- PROTECTED SLOTS -------*/ 00036 /*--------------------------------------------------------*/ 00037 00039 void SynapseParametersEditDialog::defaultButtonClicked(){ 00040 try{ 00041 setParameterValues(Globals::getNetworkDao()->getDefaultSynapseParameters(conGrpInfo.getSynapseTypeID())); 00042 } 00043 catch(SpikeStreamException& ex){ 00044 qCritical()<<ex.getMessage(); 00045 this->accept(); 00046 } 00047 } 00048 00049 00051 void SynapseParametersEditDialog::okButtonClicked(){ 00052 try{ 00053 QHash<QString, double> paramMap = getParameterValues(); 00054 00055 //Set parameters in the database 00056 Globals::getNetworkDao()->setSynapseParameters(conGrpInfo, paramMap); 00057 00058 //Set parameters in the network object stored in memory 00059 Globals::getNetwork()->getConnectionGroup(conGrpInfo.getID())->setParameters(paramMap); 00060 00061 //Close dialog 00062 this->accept(); 00063 } 00064 catch(SpikeStreamException& ex){ 00065 qCritical()<<ex.getMessage(); 00066 } 00067 }