Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

SynapseParametersDialog.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   SpikeStream Application                                               *
00003  *   Copyright (C) 2007 by David Gamez                                     *
00004  *   david@davidgamez.eu                                                   *
00005  *   Version 0.1                                                           *
00006  *                                                                         *
00007  *   This program is free software; you can redistribute it and/or modify  *
00008  *   it under the terms of the GNU General Public License as published by  *
00009  *   the Free Software Foundation; either version 2 of the License, or     *
00010  *   (at your option) any later version.                                   *
00011  *                                                                         *
00012  *   This program is distributed in the hope that it will be useful,       *
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00015  *   GNU General Public License for more details.                          *
00016  *                                                                         *
00017  *   You should have received a copy of the GNU General Public License     *
00018  *   along with this program; if not, write to the                         *
00019  *   Free Software Foundation, Inc.,                                       *
00020  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00021  ***************************************************************************/
00022 
00023 #ifndef SYNAPSEPARAMETERSDIALOG_H
00024 #define SYNAPSEPARAMETERSDIALOG_H
00025 
00026 //SpikeStream includes
00027 #include "DBInterface.h"
00028 #include "EditSynapseParametersDialog.h"
00029 #include "ParameterTable.h"
00030 #include "SimulationManager.h"
00031 
00032 //Qt includes
00033 #include <qdialog.h>
00034 #include <qstringlist.h>
00035 #include <qpixmap.h>
00036 #include <qpushbutton.h>
00037 
00038 
00039 //------------------------ Synapse Parameters Dialog ----------------------
00040 /*! Displays the synapse parameters in a table with an edit button that 
00041         launches an edit synapse parameters dialog to change the values. The 
00042         parameters are not changed until the ok or apply buttons are pressed.*/
00043 //-------------------------------------------------------------------------
00044 
00045 class SynapseParametersDialog : public QDialog {
00046         Q_OBJECT
00047         
00048         public:
00049                 SynapseParametersDialog(QWidget *parent, DBInterface* networkDBInterface, SimulationManager* simMan);
00050                 ~SynapseParametersDialog();
00051                 bool loadSynapseParameters();
00052 
00053 
00054         private slots:
00055                 void applyButtonPressed();
00056                 void cancelButtonPressed();
00057                 void defaultsButtonPressed();
00058                 void okButtonPressed();
00059                 void parameterTableClicked(int row, int col, unsigned short typeID);
00060                 void parameterTableValueChanged(int row, int col, unsigned short typeID);
00061 
00062 
00063         private:
00064                 //========================== VARIABLES ===============================
00065                 /*! Store reference to database interfaces.*/
00066                 DBInterface *networkDBInterface;
00067 
00068                 /*! Store reference to simulation manager to inform it about changes.*/
00069                 SimulationManager *simulationManager;
00070                 
00071                 //Table and its header for displaying parameters
00072                 map<unsigned short, ParameterTable*> paramTableMap;
00073                 map<unsigned short, QHeader*> paramTableHeaderMap;
00074                 map<unsigned short, QLabel*> tableLabelMap;
00075 
00076                 /*! Applies the parameters without closing the dialog.*/
00077                 QPushButton *applyButton;
00078 
00079                 //Variables holding the columns containing different information
00080                 int editColumn;
00081                 int connGrpIDColumn;
00082                 int fromGrpColumn;
00083                 int toGrpColumn;
00084                 int paramStartColumn;
00085 
00086                 /*! Image displayed in the edit column.*/
00087                 QPixmap *editPixmap;
00088 
00089                 /*! List of all the field names of the parameters, used for loading them 
00090                         from the database.*/
00091                 map<unsigned short, QStringList*> fieldNamesMap;
00092 
00093                 /*! List of all the value names.*/
00094                 map<unsigned short, QStringList*> valueNamesMap;
00095 
00096                 /*! Links descriptions of the parameter with the default value.*/
00097                 map<unsigned short, map<const char*, double, charKeyCompare> > defaultValueMap;
00098 
00099                 /*! Links descriptions of the parameter with a column for loading up parameters.*/
00100                 map<unsigned short, map<const char*, int, charKeyCompare> > descriptionColumnMap;
00101 
00102                 /*! Records whether a value is a check box type. Only check box values are 
00103                         included in this map.*/
00104                 map<unsigned short, map<const char*, bool, charKeyCompare> > checkBoxMap;
00105 
00106                 /*! Stores the link between a description and a parameter name.*/
00107                 map<unsigned short, map<const char*, const char*, charKeyCompare> > descParamMap;
00108 
00109                 /*! Stores the link between a parameter name and a description.*/
00110                 map<unsigned short, map<const char*, const char*, charKeyCompare> > paramDescMap;
00111 
00112                 /*! Variable recording whether the parameter table has been changed
00113                         Used to enable or disable the apply button and prevent updating parameters
00114                         unnecessarily.*/
00115                 bool parameterValuesChanged;
00116 
00117 
00118                 //========================== METHODS ================================
00119                 /*! Declare copy constructor private so it cannot be used inadvertently. */
00120                 SynapseParametersDialog (const SynapseParametersDialog&);
00121 
00122                 /*! Declare assignment private so it cannot be used inadvertently.*/
00123                 SynapseParametersDialog operator = (const SynapseParametersDialog&);
00124 
00125                 QString getNeuronGroupName(QString neurGrpID);
00126                 void storeSynapseParameters();
00127 
00128 };
00129 
00130 
00131 #endif //SYNAPSEPARAMETERSDIALOG_H
00132 

Generated on Mon Sep 3 22:29:04 2007 for SpikeStream Application by  doxygen 1.4.4