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

ConnectionPropertiesDialog.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 CONNECTIONPROPERTIESDIALOG_H
00024 #define CONNECTIONPROPERTIESDIALOG_H
00025 
00026 //SpikeStream includes
00027 #include "DBInterface.h"
00028 #include "ConnectionType.h"
00029 #include "ConnectionManager.h"
00030 #include "ConnectionParameterTable.h"
00031 
00032 //Qt includes
00033 #include <qdialog.h>
00034 #include <qcombobox.h>
00035 #include <qlabel.h>
00036 #include <qtable.h>
00037 #include <qstring.h>
00038 #include <qlineedit.h>
00039 #include <qvalidator.h>
00040 #include <qradiobutton.h>
00041 
00042 //Other includes
00043 #include <map>
00044 
00045 //Default delay values, stored as strings to save conversion
00046 #define DEFAULT_MIN_DELAY 0
00047 #define DEFAULT_MAX_DELAY 250
00048 
00049 
00050 //---------------------- Connection Properties Dialog ---------------------
00051 /*! Dialog used to specify the properties for new connections.
00052         This contains quite a lot of complicated checking for the inter layer 
00053         connections. At present edit mode is used when obtaining the parameters
00054         for a SIMNOS connection and has not been generalised from this. */
00055 //-------------------------------------------------------------------------
00056 
00057 class ConnectionPropertiesDialog : public QDialog{
00058         Q_OBJECT
00059         
00060         public:
00061                 ConnectionPropertiesDialog(QWidget *, const char*, DBInterface*);
00062                 ConnectionPropertiesDialog(QWidget *, const char*, DBInterface* netDBInter, unsigned int fromNeurGrpID, unsigned int toNeurGrpID, unsigned short connType);
00063                 ~ConnectionPropertiesDialog();
00064                 ConnectionHolder getConnectionHolder();
00065                 map<string, double> getConnectionParameters();
00066 
00067         
00068         private slots:
00069                 void layerRadioStateChanged();
00070                 void okButtonPressed();
00071                 void paramSelectionChanged();
00072                 void paramValueChanged(int, int);
00073         
00074 
00075         private:
00076                 //=========================== VARIABLES =======================================
00077                 /*! References to database handling class.*/
00078                 DBInterface *dbInterface;
00079 
00080                 /*! Validator to check integer input.*/
00081                 QIntValidator *delayValidator;
00082 
00083                 /*! Validator to check double input.*/
00084                 QDoubleValidator * paramValidator;
00085 
00086                 /*! Stores link between a combo position and a synapse type ID.*/
00087                 map<int, unsigned short> synapseTypePositionMap;
00088 
00089                 /*! Records whether the from and to neuron groups and connection
00090                         type has already been determined at the launch of the dialog.*/
00091                 bool editMode;
00092 
00093                 /*! Used in edit mode to hold the type of the connection, defined in 
00094                         ConnectionType.h*/
00095                 int connectionType;
00096 
00097                 /*! Used in edit mode to hold the from neuron group.*/
00098                 int fromNeurGrpID;
00099 
00100                 /*! Used in edit mode to hold the to neuron group.*/
00101                 int toNeurGrpID;
00102 
00103                 //GUI Widgets
00104                 QLabel *intraLayerLabel;
00105                 QLabel *fromLayerLabel;
00106                 QLabel *toLayerLabel;
00107                 QComboBox *intraLayerCombo;
00108                 QComboBox *fromLayerCombo;
00109                 QComboBox *toLayerCombo;
00110                 QComboBox *synapseTypeCombo;
00111                 QComboBox *connectionTypeCombo;
00112                 QRadioButton *interRadioButt;
00113                 QRadioButton *intraRadioButt;
00114                 ConnectionParameterTable *connParamTable;
00115                 QLineEdit *minDelayText;
00116                 QLineEdit *maxDelayText;
00117 
00118                 /*! Tracks whether an error in the parameters has taken place after the
00119                         ok button has been pressed.*/
00120                 bool parameterError;
00121 
00122                 /*! Records whether there was an error loading the dialog. */
00123                 bool loadError;
00124 
00125 
00126                 //============================ METHODS ========================================
00127                 /*! Declare copy constructor private so it cannot be used inadvertently.*/
00128                 ConnectionPropertiesDialog(const ConnectionPropertiesDialog&);
00129 
00130                 /*! Declare assignment private so it cannot be used inadvertently.*/
00131                 ConnectionPropertiesDialog operator = (const ConnectionPropertiesDialog&);
00132 
00133                 bool checkConnection_INTER(unsigned int, unsigned int, unsigned short);
00134                 bool checkConnection_INTRA(unsigned short);
00135                 void constructDialog();
00136                 void fillConnectionTypeCombo_INTER();
00137                 void fillConnectionTypeCombo_INTRA();
00138                 double getParameterValue(QString);
00139                 void loadLayerNames();
00140                 void loadParameterTable(unsigned short);
00141                 void setParameterValue(QString, double);
00142 
00143 };
00144 
00145 
00146 #endif//CONNECTIONPROPERTIESDIALOG_H
00147 
00148 

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