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 GLOBALPARAMETERSDIALOG_H 00024 #define GLOBALPARAMETERSDIALOG_H 00025 00026 //SpikeStream includes 00027 #include "GlobalVariables.h" 00028 #include "DBInterface.h" 00029 #include "SimulationManager.h" 00030 00031 //Qt includes 00032 #include <qdialog.h> 00033 #include <qlineedit.h> 00034 #include <qstring.h> 00035 #include <qstringlist.h> 00036 #include <qvalidator.h> 00037 #include <qlayout.h> 00038 #include <qcheckbox.h> 00039 00040 00041 //------------------------- Global Parameters Dialog ---------------------- 00042 /*! Dialog that enables the editing of parameters that apply across the 00043 simulation as a whole. */ 00044 //-------------------------------------------------------------------------- 00045 00046 class GlobalParametersDialog : public QDialog { 00047 Q_OBJECT 00048 00049 public: 00050 GlobalParametersDialog(QWidget *parent, DBInterface *netDBInterface, SimulationManager *); 00051 ~GlobalParametersDialog(); 00052 bool loadParameters(); 00053 00054 00055 private slots: 00056 void applyButtonPressed(); 00057 void cancelButtonPressed(); 00058 void loadDefaultsButtonPressed(); 00059 void makeDefaultsButtonPressed(); 00060 void okButtonPressed(); 00061 00062 00063 private: 00064 //==================== VARIABLES ================================= 00065 /*! Reference to database handling class.*/ 00066 DBInterface *networkDBInterface; 00067 00068 /*! Reference to simulation manager.*/ 00069 SimulationManager *simulationManager; 00070 00071 /*! Validator for line edit input.*/ 00072 QDoubleValidator *paramValidator; 00073 00074 /*! Map holding all the references to the line edits.*/ 00075 map<const char *, QLineEdit*, charKeyCompare> lineEditMap; 00076 00077 /*! Map holding all the descriptions for the labels.*/ 00078 map<const char *, QString*, charKeyCompare> labelMap; 00079 00080 /*! Map holding the default values for each of the parameters.*/ 00081 map<const char *, double, charKeyCompare> defaultValueMap; 00082 00083 /*! Records whether a value is a check box type. Only check box values 00084 are included in this map.*/ 00085 map<const char*, bool, charKeyCompare> boolParameterMap; 00086 00087 /*! Holds references to all the check boxes.*/ 00088 map<const char*, QCheckBox*, charKeyCompare> checkBoxMap; 00089 00090 /*! Holds all the map keys so they do not vanish.*/ 00091 QStringList mapKeyStrList; 00092 00093 00094 //======================= METHODS ================================ 00095 /*! Declare copy constructor private so it cannot be used inadvertently.*/ 00096 GlobalParametersDialog (const GlobalParametersDialog&); 00097 00098 /*! Declare assignment private so it cannot be used inadvertently.*/ 00099 GlobalParametersDialog operator = (const GlobalParametersDialog&); 00100 00101 void addParameter(QString *labelText, QLineEdit *lineEdit, QVBoxLayout *vBox); 00102 void storeParameters(); 00103 00104 }; 00105 00106 00107 #endif //GLOBALPARAMETERSDIALOG_H 00108
1.4.4