2
* configFile.h - Configuration file management header
3
* Copyright (C) 2011 D Haley
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
29
//!Startup panel identifiers.
31
CONFIG_STARTUPPANEL_RAWDATA,
32
CONFIG_STARTUPPANEL_CONTROL,
33
CONFIG_STARTUPPANEL_PLOTLIST,
34
CONFIG_STARTUPPANEL_END_ENUM
39
CONFIG_PANELMODE_NONE,
40
CONFIG_PANELMODE_REMEMBER,
41
CONFIG_PANELMODE_SPECIFY,
42
CONFIG_PANELMODE_END_ENUM
56
std::deque<std::string> recentFiles;
57
vector<Filter *> filterDefaults;
59
//!Did the configuration load from file OK?
63
vector<bool> startupPanelView;
65
//!Any errors that occur during file IO. Set by class members during read()/write()
66
std::string errMessage;
68
//!Method for showing/hiding panel at startup
69
unsigned int panelMode;
71
//!Initial application window size in pixels
72
unsigned int initialSizeX,initialSizeY;
73
//!Do we have a valid initial app size?
74
bool haveIntialAppSize;
76
//!Percentile speeds for mouse zoom and move
77
unsigned int mouseZoomRatePercent,mouseMoveRatePercent;
79
//!Master allow the program to do stuff online check. This is AND-ed, so cannot override disabled items
82
//!Should the program perform online version number checking?
83
bool allowOnlineVerCheck;
85
//!fractional initial positions of sashes in main UI
86
float leftRightSashPos,topBottomSashPos,
87
filterSashPos,plotListSashPos;
93
void addRecentFile(const std::string &str);
94
void getRecentFiles(std::vector<std::string> &filenames) const;
95
void removeRecentFile(const std::string &str);
100
bool configLoadedOK() const { return configLoadOK;}
102
//Create the configuration folder, if needed.
103
bool createConfigDir() const;
104
//Get the configartion dir path
105
std::string getConfigDir() const;
107
std::string getErrMessage() const { return errMessage;};
109
unsigned int getMaxHistory() const;
111
//Get a vector of the default filter pointers
112
void getFilterDefaults(vector<Filter* > &defs);
113
//Set the default filter pointers (note this will take ownership of the poitner)
114
void setFilterDefaults(const vector<Filter* > &defs);
116
//Get a clone of the default filter for a given type,
117
//even if it is not in the array (use hardcoded)
118
Filter *getDefaultFilter(unsigned int type) const;
120
//!Return startup status of UI panels
121
bool getPanelEnabled(unsigned int panelID) const;
123
//!Return startup status of UI panels
124
void setPanelEnabled(unsigned int panelID,bool enabled, bool permanent=false);
126
//!Get the mouse movement rate (for all but zoom)
127
unsigned int getMouseMoveRate() const { return mouseMoveRatePercent; }
128
//!Get the mouse movement rate for zoom
129
unsigned int getMouseZoomRate() const { return mouseZoomRatePercent; }
131
//Set the mouse zoom rate(percent)
132
void setMouseZoomRate(unsigned int rate) { mouseZoomRatePercent=rate;};
133
//Set the mouse move rate (percent)
134
void setMouseMoveRate(unsigned int rate) { mouseMoveRatePercent=rate;};
136
//!Return the current panelmode
137
unsigned int getStartupPanelMode() const;
138
//!Set the mode to use for recalling the startup panel layout
139
void setStartupPanelMode(unsigned int panelM);
141
//!Returns true if we have a suggested initial window size; with x & y being the suggestion
142
bool getInitialAppSize(unsigned int &x, unsigned int &y) const;
143
//!Set the inital window suggested size
144
void setInitialAppSize(unsigned int x, unsigned int y);
146
bool getAllowOnlineVersionCheck() const;
148
//!Set if the program is allowed to access network resources
149
void setAllowOnline(bool v);
150
//!Set if the program is allowed to phone home to get latest version #s
151
void setAllowOnlineVersionCheck(bool v);
153
//!Set the position for the main window left/right sash
154
void setLeftRightSashPos(float fraction);
155
//!Set the position for the top/bottom sash
156
void setTopBottomSashPos(float fraction);
157
//!Set the position for the filter property/tree sash
158
void setFilterSashPos(float fraction);
159
//!Set the position for the plot list panel
160
void setPlotListSashPos(float fraction);
162
//!Set the position for the main window left/right sash
163
float getLeftRightSashPos() const { return leftRightSashPos;};
164
//!Set the position for the top/bottom sash
165
float getTopBottomSashPos() const{ return topBottomSashPos;}
166
//!Set the position for the filter property/tree sash
167
float getFilterSashPos() const { return filterSashPos;};
168
//!Set the position for the plot list panel
169
float getPlotListSashPos()const { return plotListSashPos;};