00001 /*************************************************************************** 00002 configuration.h - description 00003 ------------------- 00004 begin : Fri Feb 27 2004 00005 copyright : (C) 2003 by Lynn Hazan 00006 email : 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef CONFIGURATION_H 00019 #define CONFIGURATION_H 00020 00021 // include files for QT 00022 #include <qstring.h> 00023 #include <qfont.h> 00024 #include <qcolor.h> 00025 00026 //General C++ include files 00027 #include <iostream> 00028 using namespace std; 00029 00037 class Configuration { 00038 public: 00042 void read(); 00044 void write() const; 00045 00048 inline void setScreenGain(float gain){ 00049 screenGain = gain; 00050 }; 00051 00054 inline void setVoltageRange(int value){ 00055 voltageRange = value; 00056 }; 00057 00060 inline void setAmplification(int value){ 00061 amplification = value; 00062 }; 00063 00065 inline void setBackgroundColor(QColor color) {backgroundColor = color;}; 00066 00068 inline void setPaletteHeaders(bool show){displayPaletteHeaders = show;}; 00069 00071 inline void setNbChannels(int nb){nbChannels = nb;}; 00072 00074 inline void setDatSamplingRate(double rate){datSamplingRate = rate;}; 00075 00077 inline void setEegSamplingRate(double rate){eegSamplingRate = rate;}; 00078 00080 inline void setOffset(int offset){this->offset = offset;}; 00081 00083 inline void setResolutionIndex(int index){resolutionIndex = index;}; 00084 00086 inline void setEventPosition(int position){eventPosition = position;}; 00087 00089 inline void setClusterPosition(int position){clusterPosition = position;}; 00090 00092 inline void setNbSamples(int nb){nbSamples = nb;}; 00093 00095 inline void setPeakIndex(int index){peakIndex = index;}; 00096 00098 inline void setSamplingRate(double rate){videoSamplingRate = rate;}; 00099 00101 inline void setWidth(int width){this->width = width;}; 00102 00104 inline void setHeight(int height){this->height = height;}; 00105 00107 inline void setBackgroundImage(QString image){backgroundImage = image;}; 00108 00110 inline void setRotation(int angle){rotation = angle;}; 00111 00113 inline void setFlip(int index){flip = index;}; 00114 00118 inline void setPositionsBackground(int drawPositions){drawPositionsOnBackground = drawPositions;}; 00119 00121 inline void setTraceBackgroundImage(QString image){traceBackgroundImage = image;}; 00122 00125 inline float getScreenGain() const{ 00126 return screenGainDefault; 00127 }; 00128 00131 inline int getVoltageRange() const{ 00132 return voltageRange; 00133 }; 00134 00137 inline int getAmplification() const{ 00138 return amplificationDefault; 00139 }; 00140 00141 00143 inline QColor getBackgroundColor() const{return backgroundColor;}; 00144 00146 inline bool isPaletteHeadersDisplayed() const{return displayPaletteHeaders;}; 00147 00149 inline int getNbChannels() const{return nbChannels;}; 00150 00152 inline double getDatSamplingRate() const{return datSamplingRate;}; 00153 00155 inline double getEegSamplingRate() const{return eegSamplingRate;}; 00156 00158 inline int getOffset() const{return offset;}; 00159 00161 inline int getResolution()const{ 00162 switch(resolutionIndex){ 00163 case 0: 00164 return 12; 00165 case 1: 00166 return 14; 00167 case 2: 00168 return 16; 00169 case 3: 00170 return 32; 00171 default: 00172 return 16; 00173 } 00174 }; 00175 00177 inline int getResolutionIndex() const{return resolutionIndex;}; 00178 00180 inline QString getTraceBackgroundImage()const{return traceBackgroundImage;}; 00181 00183 inline int getEventPosition()const{return eventPosition;}; 00184 00186 inline int getClusterPosition()const{return clusterPosition;}; 00187 00189 inline int getNbSamples()const{return nbSamples;}; 00190 00192 inline int getPeakIndex()const{return peakIndex;}; 00193 00195 inline double getVideoSamplingRate()const{return videoSamplingRate;}; 00196 00198 inline int getWidth()const{return width;}; 00199 00201 inline int getHeight()const{return height;}; 00202 00204 inline QString getBackgroundImage()const{return backgroundImage;}; 00205 00207 inline int getRotation()const{return rotation;}; 00208 00212 inline int getFlip()const{return flip;}; 00213 00218 inline bool getPositionsBackground()const{return drawPositionsOnBackground;}; 00219 00222 inline float getScreenGainDefault() const{ 00223 return screenGainDefault; 00224 }; 00225 00228 inline int getVoltageRangeDefault() const{ 00229 return voltageRangeDefault; 00230 }; 00231 00234 inline int getAmplificationDefault() const{ 00235 return amplificationDefault; 00236 }; 00237 00239 inline QColor getBackgroundColorDefault() const{return backgroundColorDefault;}; 00240 00243 inline bool isPaletteHeadersDisplayedDefault() const{return displayPaletteHeadersDefault;}; 00244 00246 inline int getNbChannelsDefault() const{return nbChannelsDefault;}; 00247 00249 inline double getDatSamplingRateDefault() const{return datSamplingRateDefault;}; 00250 00252 inline double getEegSamplingRateDefault() const{return eegSamplingRateDefault;}; 00253 00255 inline int getOffsetDefault() const{return offsetDefault;}; 00256 00258 inline int getResolutionIndexDefault()const{return resolutionIndexDefault;}; 00259 00261 inline int getEventPositionDefault()const{return eventPositionDefault;}; 00262 00264 inline int getClusterPositionDefault()const{return clusterPositionDefault;}; 00265 00267 inline int getNbSamplesDefault()const{return nbSamplesDefault;}; 00268 00270 inline int getPeakIndexDefault()const{return peakIndexDefault;}; 00271 00273 inline double getVideoSamplingRateDefault()const{return videoSamplingRateDefault;}; 00274 00276 inline int getWidthDefault()const{return widthDefault;}; 00277 00279 inline int getHeightDefault()const{return heightDefault;}; 00280 00282 inline QString getBackgroundImageDefault()const{return backgroundImageDefault;}; 00283 00285 inline int getRotationDefault()const{return rotationDefault;}; 00286 00290 inline int getFlipDefault()const{return flipDefault;}; 00291 00296 inline bool getPositionsBackgroundDefault()const{return drawPositionsOnBackgroundDefault;}; 00297 00298 private: 00300 float screenGain; 00302 int voltageRange; 00304 int amplification; 00306 int nbChannels; 00308 QColor backgroundColor; 00310 double datSamplingRate; 00312 double eegSamplingRate; 00314 int offset; 00316 int resolutionIndex; 00318 bool displayPaletteHeaders; 00320 int eventPosition; 00322 int clusterPosition; 00324 int nbSamples; 00326 int peakIndex; 00328 double videoSamplingRate; 00330 int width; 00332 int height; 00334 QString backgroundImage; 00336 int rotation; 00338 int flip; 00340 bool drawPositionsOnBackground; 00342 QString traceBackgroundImage; 00343 00344 static const float screenGainDefault; 00345 static const int voltageRangeDefault; 00346 static const int amplificationDefault; 00347 static const int nbChannelsDefault; 00348 static const double datSamplingRateDefault; 00349 static const double eegSamplingRateDefault; 00350 static const QColor backgroundColorDefault; 00351 static const int offsetDefault; 00352 static const int resolutionIndexDefault; 00353 static const bool displayPaletteHeadersDefault; 00354 static const int eventPositionDefault; 00355 static const int clusterPositionDefault; 00356 static const int nbSamplesDefault; 00357 static const int peakIndexDefault; 00358 static const double videoSamplingRateDefault; 00359 static const int widthDefault; 00360 static const int heightDefault; 00361 static const QString backgroundImageDefault; 00362 static const int rotationDefault; 00363 static const int flipDefault; 00364 static const bool drawPositionsOnBackgroundDefault; 00365 static const QString traceBackgroundImageDefault; 00366 00367 Configuration(); 00368 inline ~Configuration(){}; 00369 Configuration(const Configuration&); 00370 00371 friend Configuration& configuration(); 00372 00373 }; 00374 00376 Configuration& configuration(); 00377 00378 #endif // CONFIGURATION_H