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 CONNECTIONWIDGET_H 00024 #define CONNECTIONWIDGET_H 00025 00026 //SpikeStream includes 00027 #include "DBInterface.h" 00028 #include "ConnectionManager.h" 00029 #include "BusyDialog.h" 00030 00031 //Qt includes 00032 #include <qwidget.h> 00033 #include <qtable.h> 00034 #include <string> 00035 #include <qstring.h> 00036 #include <qpixmap.h> 00037 #include <qpoint.h> 00038 00039 00040 //-------------------------- Connection Widget ---------------------------- 00041 /*! Displays table with details of all connection groups with controls for 00042 creating new connections, deleting connections and viewing connection 00043 groups. Interfaces with the connection manager, which does the actual 00044 adding and deleting from the database. */ 00045 //------------------------------------------------------------------------- 00046 00047 class ConnectionWidget : public QWidget { 00048 Q_OBJECT 00049 00050 public: 00051 ConnectionWidget(QWidget *parent, DBInterface* netDBInter, DBInterface* devDBInter); 00052 ~ConnectionWidget(); 00053 void createConnections(unsigned int fromNeurGrpID, unsigned int toNeurGrpID, unsigned int componentID, bool deviceIsFrom); 00054 void deleteLayerConnections(unsigned int); 00055 vector<unsigned int>getConnectionViewVector(); 00056 void reloadConnections(); 00057 void simulationDestroyed(); 00058 void simulationInitialised(); 00059 00060 00061 private slots: 00062 void deleteConnections(); 00063 void newConnectionsButtonPressed(); 00064 void tableClicked(int, int, int, const QPoint &); 00065 void tableHeaderClicked(int); 00066 00067 00068 private: 00069 //=========================== VARIABLES ======================================= 00070 /*! Reference to class handling network database.*/ 00071 DBInterface* networkDBInterface; 00072 00073 /*! Reference to class handling device database.*/ 00074 DBInterface* deviceDBInterface; 00075 00076 /*! References to class responsible for creating and deleting connections.*/ 00077 ConnectionManager *connectionManager; 00078 00079 //Widgets 00080 QTable *connTable; 00081 00082 //Pixmaps for showing and hiding layers 00083 QPixmap *showPixmap; 00084 QPixmap *hidePixmap; 00085 QPixmap *paramPixmap; 00086 00087 //Store location of columns that are used to access information in the table 00088 int connGrpIDColumn; 00089 int paramCol; 00090 00091 //Buttons 00092 QPushButton *newConnButt; 00093 QPushButton *deleteConnButt; 00094 00095 /*! Vector contains connection group IDS of the visible layers.*/ 00096 vector<unsigned int> viewVector; 00097 00098 /*! Dialog to inform user that a long operation is taking place.*/ 00099 BusyDialog* busyDialog; 00100 00101 00102 //=========================== METHODS ========================================= 00103 /*! Declare copy constructor private so it cannot be used inadvertently.*/ 00104 ConnectionWidget(const ConnectionWidget&); 00105 00106 /*! Declare assignment private so it cannot be used inadvertently.*/ 00107 ConnectionWidget operator = (const ConnectionWidget&); 00108 00109 string getSynapseTypeDescription(unsigned short synapseTypeID); 00110 void loadAllConnections(); 00111 void loadConnection(unsigned int); 00112 void removeConnectionFromTable(unsigned int); 00113 00114 }; 00115 00116 00117 #endif//CONNECTIONWIDGET_H 00118
1.4.4