00001 /*************************************************************************** 00002 ** 00003 ** This file is part of GeopsyCore. 00004 ** 00005 ** This library is free software; you can redistribute it and/or 00006 ** modify it under the terms of the GNU Lesser General Public 00007 ** License as published by the Free Software Foundation; either 00008 ** version 2.1 of the License, or (at your option) any later version. 00009 ** 00010 ** This file is distributed in the hope that it will be useful, but WITHOUT 00011 ** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 ** FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 00013 ** License for more details. 00014 ** 00015 ** You should have received a copy of the GNU Lesser General Public 00016 ** License along with this library; if not, write to the Free Software 00017 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 ** 00019 ** See http://www.geopsy.org for more information. 00020 ** 00021 ** Created : 2003-11-10 00022 ** Authors : 00023 ** Marc Wathelet 00024 ** Marc Wathelet (ULg, Liège, Belgium) 00025 ** Marc Wathelet (LGIT, Grenoble, France) 00026 ** 00027 ***************************************************************************/ 00028 00029 #ifndef GeopsyPreferences_H 00030 #define GeopsyPreferences_H 00031 00032 #include "MetaDataFieldList.h" 00033 #include "SignalFileFormat.h" 00034 #include "GeopsyCoreDLLExport.h" 00035 00036 namespace GeopsyCore { 00037 00038 class GEOPSYCORE_EXPORT GeopsyPreferences 00039 { 00040 TRANSLATIONS("GeopsyPreferences"); 00041 public: 00042 GeopsyPreferences(); 00043 ~GeopsyPreferences(); 00044 00045 // Loading preferences 00046 bool askForFormat() const {return _askForFormat;} 00047 SignalFileFormat fileFormat() const {return _fileFormat;} 00048 bool askForTimeReference() const {return _timeReference==AskTimeReference;} 00049 bool isFixedTimeReference() const {return _timeReference & FixedTimeReference;} 00050 bool isFixedDate() const {return _timeReference & FixedDate;} 00051 bool isFixedTime() const {return _timeReference & FixedTime;} 00052 QDate fixedDate() const {return _fixedDate;} 00053 QTime fixedTime() const {return _fixedTime;} 00054 bool isNoCommonTimeReference() const {return _timeReference==NoCommonTimeReference;} 00055 bool viewIfFewFiles() const {return _viewIfFewFiles;} 00056 int maxNofFiles() const {return _maxNofFiles;} 00057 bool showTable() const {return _showTable;} 00058 bool showGraphic() const {return _showGraphic;} 00059 bool oneWindowPerFile() const {return _oneWindowPerFile;} 00060 // Signal name 00061 bool stationNameFile() const {return _stationName==StationNameFile;} 00062 bool stationNameRxxx() const {return _stationName==StationNameRxxx;} 00063 // Viewers tab 00064 MetaDataFieldList& tableFields() {return _tableFields;} 00065 bool restoreGraphicMakeUp() const {return _graphicMakeUp;} 00066 QString graphicMakeUpFile() const {return _graphicMakeUpFile;} 00067 bool restoreMapMakeUp() const {return _mapMakeUp;} 00068 QString mapMakeUpFile() const {return _mapMakeUpFile;} 00069 bool restoreChronogramMakeUp() const {return _chronogramMakeUp;} 00070 QString chronogramMakeUpFile() const {return _chronogramMakeUpFile;} 00071 // Cache preferences 00072 uint cacheSize() {return _cacheSize;} 00073 QString cacheSwapDir() {return _cacheSwapDir;} 00074 00075 void load(); 00076 void save(); 00077 void saveNoAuto(); 00078 void restoreFileDefaults(); 00079 void restorePoolDefaults(); 00080 protected: 00081 // Flags 00082 uint _askForFormat:1; 00083 uint _timeReference:3; 00084 uint _showTable:1; 00085 uint _showGraphic:1; 00086 uint _oneWindowPerFile:1; 00087 uint _viewIfFewFiles:1; 00088 uint _stationName:2; 00089 uint _graphicMakeUp:1; 00090 uint _mapMakeUp:1; 00091 uint _chronogramMakeUp:1; 00092 uint _unused:19; 00093 00094 enum TimeReference {AskTimeReference=0x0, FixedTimeReference=0x3, FixedDate=0x1, FixedTime=0x2, NoCommonTimeReference=0x4}; 00095 enum StationName {StationNameFile=0x0, StationNameRxxx=0x1}; 00096 00097 // Loading prefs values 00098 SignalFileFormat _fileFormat; 00099 QDate _fixedDate; 00100 QTime _fixedTime; 00101 int _maxNofFiles; 00102 // Viewers prefs 00103 MetaDataFieldList _tableFields; 00104 QString _graphicMakeUpFile; 00105 QString _mapMakeUpFile; 00106 QString _chronogramMakeUpFile; 00107 // Cache preferences 00108 QString _cacheSwapDir; 00109 uint _cacheSize; 00110 }; 00111 00112 } // namespace GeopsyCore 00113 00114 #endif // GEOPSYPREFERENCES_H