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 ARCHIVEWIDGET_H 00024 #define ARCHIVEWIDGET_H 00025 00026 //SpikeStream includes 00027 #include "ArchiveManager.h" 00028 #include "DBInterface.h" 00029 #include "MonitorArea.h" 00030 #include "NeuronGroup.h" 00031 #include "ArchiveStatistic.h" 00032 #include "ViewModelDialog.h" 00033 00034 //Qt includes 00035 #include <qwidget.h> 00036 #include <qlineedit.h> 00037 #include <qlabel.h> 00038 #include <qpushbutton.h> 00039 #include <qcombobox.h> 00040 #include <qgroupbox.h> 00041 #include <qtable.h> 00042 00043 00044 //-------------------------- Archive Widget -------------------------------- 00045 /*! Displays controls to play back archives that have been recorded. */ 00046 //-------------------------------------------------------------------------- 00047 00048 class ArchiveWidget : public QWidget { 00049 Q_OBJECT 00050 00051 public: 00052 ArchiveWidget(QWidget *parent, DBInterface*); 00053 ~ArchiveWidget(); 00054 ArchiveManager* getArchiveManager(); 00055 void hideOpenWindows(); 00056 void setMonitorArea(MonitorArea*); 00057 void showOpenWindows(); 00058 00059 00060 public slots: 00061 void unloadArchive(); 00062 00063 00064 private slots: 00065 void addStatsButtonClicked(); 00066 void archiveNameChanged(QString timeStamp, QString newName); 00067 void archiveStopped(); 00068 void deleteStatsButtonClicked(); 00069 void dockAllButtonClicked(); 00070 void fastForwardButtonToggled(bool on); 00071 void frameRateComboChanged(int); 00072 void freezeArchive(); 00073 void loadButtonPressed(); 00074 void playButtonToggled(bool); 00075 void rewindButtonPressed(); 00076 void setSpikeCount(unsigned int); 00077 void setSpikeTotal(unsigned int); 00078 void showArchiveError(const QString& message); 00079 void statsTableClicked(int row, int col, int, const QPoint &); 00080 void stepButtonPressed(); 00081 void stopButtonPressed(); 00082 void unfreezeArchive(); 00083 void undockAllButtonClicked(); 00084 void updateStatisticsTable(); 00085 void viewModelButtonClicked(); 00086 00087 00088 private: 00089 //======================== VARIABLES ============================== 00090 /*! Reference to database handling class. */ 00091 DBInterface *archiveDBInterface; 00092 00093 /*! Widget that holds the windows used to display archived spikes. */ 00094 MonitorArea *monitorArea; 00095 00096 /*! Manager that plays back the archive. */ 00097 ArchiveManager *archiveManager; 00098 00099 /*! Reference to main application used to prevent double access to 00100 variables etc. */ 00101 SpikeStreamApplication *spikeStrApp; 00102 00103 /*! Used to ignore button events when changing button states programatically. */ 00104 bool ignoreButton; 00105 00106 /*! Vector of neuron groups in the loaded archive.*/ 00107 vector<NeuronGroup*> neuronGrpVector; 00108 00109 /*! Vector of the statistics being monitored for this archive.*/ 00110 vector<ArchiveStatisticsHolder*> archiveStatisticsVector; 00111 00112 /*! Used to give each ArchiveStatisticsHolder a unique id.*/ 00113 unsigned int archiveStatisticsIDCount; 00114 00115 /*! Holds a nicely formatted version of the network model.*/ 00116 QString networkModelString; 00117 00118 /*! Displays the XML text of the model.*/ 00119 ViewModelDialog* viewModelDialog; 00120 00121 //Qt Widgets for controls 00122 QPushButton *loadButton; 00123 QPushButton *unloadButton; 00124 QLineEdit *archInfoText; 00125 QPushButton *rewindButton; 00126 QPushButton *playButton; 00127 QPushButton *stepButton; 00128 QPushButton *fastForwardButton; 00129 QPushButton *stopButton; 00130 QLabel *frameRateLabel; 00131 QComboBox *frameRateCombo; 00132 QPushButton *dockAllButton; 00133 QPushButton *undockAllButton; 00134 QPixmap* editPixmap; 00135 00136 //Qt widgets for statistics 00137 QGroupBox *statsGrpBox; 00138 QLabel *spikeNeurCountLabel_1; 00139 QLabel *spikeNeurCountLabel_2; 00140 QLabel *spikeNeurTotalLabel_1; 00141 QLabel *spikeNeurTotalLabel_2; 00142 QTable* statsTable; 00143 QPushButton *deleteStatsButton; 00144 00145 //Location of columns in statistics table 00146 int checkBxCol; 00147 int editCol; 00148 int descCol; 00149 int neursPerTimeStepCol; 00150 int totalNeursCol; 00151 int idCol; 00152 00153 //======================== METHODS ================================= 00154 /*! Declare copy constructor private so it cannot be used inadvertently.*/ 00155 ArchiveWidget(const ArchiveWidget&); 00156 00157 /*! Declare assignment private so it cannot be used inadvertently.*/ 00158 ArchiveWidget operator = (const ArchiveWidget&); 00159 00160 void addArchiveStatistics(ArchiveStatisticsHolder* archStatHold); 00161 void addArchiveStatistics(ArchiveStatisticsHolder* archStatHold, unsigned int archStatID); 00162 void deleteArchiveStatistics(unsigned int archStatID); 00163 void enableArchiveControls(bool); 00164 QString getDate(QString); 00165 void loadArchive(QString); 00166 void loadStatisticsTable(); 00167 00168 00169 }; 00170 00171 00172 #endif //ARCHIVEWIDGET_H 00173 00174
1.4.4