GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4QSettings.h
Go to the documentation of this file.
1 // $Id$
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #ifndef TGO4QSETTINGS_H
15 #define TGO4QSETTINGS_H
16 
22 #include <QtCore/QString>
23 #include <QtCore/QStringList>
24 #include <QFont>
25 
26 class QMainWindow;
27 class QWidget;
28 class QSettings;
29 
35  private:
36 
38  QSettings *sett{nullptr};
39 
41  QString fSettFileName;
42 
43  bool fUseWeb{false};
44 
47  void Open();
48  public:
49 
50  TGo4QSettings(const QString& filename);
51  virtual ~TGo4QSettings();
52 
53  QString GetSettLoaction();
54 
55  void Store();
56 
57  // set generic function
58 
59  void setBool(const QString& name, bool value = true);
60  bool getBool(const QString& name, bool def = true);
61  void setInt(const QString& name, int value = 0);
62  int getInt(const QString& name, int def = 0);
63  void setStr(const QString& name, const QString& value = "");
64  QString getStr(const QString& name, const QString& value = "");
65  void setDouble(const QString& name, double value = 0.);
66  double getDouble(const QString& name, double value = 0.);
67 
68  // set of Go4Specific functions
69 
70  void setBasicSettings();
71  void getBasicSettings();
72 
73  void setAppFont(const QFont&);
74  void getAppFont();
75 
76  void setTermFont(const QFont&);
77  QFont getTermFont();
78 
79  void setAppStyle(const QString&);
80  QString getAppStyle();
81 
82  void setClientName(const QString&);
83  QString getClientName();
84  void setClientNode(const QString&);
85  QString getClientNode();
86  void setClientDir(const QString&);
87  QString getClientDir();
88  void setClientExeMode(int mode);
89  int getClientExeMode();
90  void setClientExec(const QString&);
91  QString getClientExec(int mode = -1);
92  void setClientArgs(const QString&);
93  QString getClientArgs();
94  void setClientShellMode(int);
95  QString getClientShell();
96  int getClientShellMode();
97  void setClientTermMode(int);
98  int getClientTermMode();
99  QString getClientTerm();
100  void setClientIsServer(int kind);
101  int getClientIsServer();
102 
103  void setClientPort(int);
104  int getClientPort();
105  void setClientControllerMode(int);
107  void setClientDefaultPass(bool);
108  bool getClientDefaultPass();
109  void setClientConnectMode(int);
110  int getClientConnectMode();
111  QString getClientAccountName();
112  void setClientAccountName(const QString&);
113 
114  void setTermHistorySize(int sz);
115  int getTermHistorySize();
116 
117  bool getTermShowTimestamp();
118  void setTermShowTimestamp(bool on);
119 
120  QString getTermTimeFormat();
121  void setTermTimeFormat(const QString& form);
122 
123 
124  void setHServName(const QString&);
125  QString getHServName();
126  void setHServBase(const QString&);
127  QString getHServBase();
128  void setHServFilter(const QString&);
129  QString getHServFilter();
130  void setHServPort(int port);
131  int getHServPort();
132 
133  void setPadCrosshair(bool on);
134  bool getPadCrosshair();
135 
136  void setPadSuperimpose(bool on);
137  bool getPadSuperimpose();
138 
139  void setPadEventStatus(bool on);
140  bool getPadEventStatus();
141 
142  void setCanvasColor(int red, int green, int blue);
143  void getCanvasColor(int& red, int& green, int& blue);
144 
145  void setPaletteOpt(int min, int def, int max);
146  void getPaletteOpt(int& min, int& def, int& max);
147 
148  void setOptStat(int value);
149  int getOptStat();
150 
151  void setOptStatW(int value);
152  int getOptStatW();
153 
154  void setOptStatH(int value);
155  int getOptStatH();
156 
157  void setStatBoxVisible(bool on = true);
158  bool getStatBoxVisible();
159 
160  void setStatBoxErrors(bool on = true);
161  bool getStatBoxErrors();
162 
163  void setCloneFlag(bool on = true);
164  bool getCloneFlag();
165 
166  void setDrawOnceFlag(bool on = true);
167  bool getDrawOnceFlag();
168 
169  void setDrawTimeFlag(bool on = true);
170  bool getDrawTimeFlag();
171 
172  void setDrawDateFlag(bool on = true);
173  bool getDrawDateFlag();
174 
175  void setDrawItemFlag(bool on = true);
176  bool getDrawItemFlag();
177 
178  void setDrawLineWidth(int w = 1);
179  int getDrawLineWidth();
180 
181  void setDrawFillColor(int col);
182  int getDrawFillColor();
183 
184  void setDrawFillStyle(int style);
185  int getDrawFillStyle();
186 
187 
188  void setTH1DrawOpt(const QString& value);
189  QString getTH1DrawOpt();
190 
191  void setTH2DrawOpt(const QString& value);
192  QString getTH2DrawOpt();
193 
194  void setTH3DrawOpt(const QString& value);
195  QString getTH3DrawOpt();
196 
197  void setTGraphDrawOpt(const QString& value);
198  QString getTGraphDrawOpt();
199 
200  void setGStyleStatFormat(const QString&);
201  QString getGStyleStatFormat();
202 
203  void storePanelSize(QWidget *w, const QString& kind = "ViewPanel");
204  QSize lastPanelSize(const QString& kind = "ViewPanel", int dfltwidth = 450, int dfltheight = 250);
205 
206  void setBrowserColumn(const char *name, int width);
207  int getBrowserColumn(const char *name, int defwidth);
208 
209  void setHistName(const QString& value);
210  QString getHistName();
211 
212  void setHistTitle(const QString& value);
213  QString getHistTitle();
214 
215  void setHistType(int value);
216  int getHistType();
217 
218  void setHistAxisPars(int naxis, int npoints, double min, double max);
219  void getHistAxisPars(int naxis, int& npoints, double& min, double& max);
220 
221  void setFetchDataWhenDraw(bool on = true);
222  bool getFetchDataWhenDraw();
223 
224  void setFetchDataWhenCopy(bool on = true);
225  bool getFetchDataWhenCopy();
226 
227  void setFetchDataWhenSave(bool on = true);
228  bool getFetchDataWhenSave();
229 
230  void setHideTGo4EventElement(bool on = true);
232 
233  void setMoveSubwindowRubberBand(bool on = true);
235 
236  void setWebBasedCanvas(bool on = true) { fUseWeb = on; }
237  bool getWebBasedCanvas() { return fUseWeb; }
238 
239  void setRemoteFileSett(const QString& hostname, const QString& filename, const QString& protocol);
240  void getRemoteFileSett(QString& hostname, QString& filename, QString& protocol);
241 
242  void setPrinterSett(const QString& name, const QString& cmd);
243  void getPrinterSett(QString& name, QString& cmd);
244 
246  void setMbsMonitorNode(const QString& name);
247  QString getMbsMonitorNode();
248  void setMbsMonitorFreq(int secs);
249  int getMbsMonitorFreq();
250  void setMbsMonitorBins(int num);
251  int getMbsMonitorBins();
252  void setMbsMonitorTrend(bool on = true);
253  bool getMbsMonitorTrend();
254  void setMbsMonitorMore(bool on = true);
255  bool getMbsMonitorMore();
256  void setMbsMonitorMonitorActive(bool on = true);
258  void setMbsMonitorBackwardsTrending(bool on = true);
260 
262  void setDabcMonitorNode(const QString& name);
263  QString getDabcMonitorNode();
264  void setDabcMonitorFreq(int secs);
265  int getDabcMonitorFreq();
266  void setDabcMonitorBins(int num);
267  int getDabcMonitorBins();
268  void setDabcMonitorBackwardsTrending(bool on = true);
270 
272  QStringList getCommandsHistoryGUI();
273  void setCommandsHistoryGUI(const QStringList & commands);
274 
276  QStringList getCommandsHistoryAnalysis();
277  void setCommandsHistoryAnalysis(const QStringList & commands);
278 
280  void restoreMainWindowState(QMainWindow* tgt);
281  void storeMainWindowState(QMainWindow* src);
282 
284  QString getAnalysisMacroCommand(int id);
285  QString getAnalysisMacroTip(int id);
286  bool getAnalysisMacroAutomode(int id);
287  void setAnalysisMacroCommand(int id, const QString &com);
288  void setAnalysisMacroTip(int id, const QString &com);
289  void setAnalysisMacroAutomode(int id, bool on);
290 
292  double getScreenScaleFactor();
293  void setScreenScaleFactor(double factor);
294 
297  void setSavePadWhiteBackground(bool on);
298 };
299 
300 extern TGo4QSettings *go4sett;
301 
302 #endif
void setClientControllerMode(int)
void setDrawDateFlag(bool on=true)
QString getClientDir()
QString GetSettLoaction()
void setScreenScaleFactor(double factor)
bool getSavePadWhiteBackground()
void setDabcMonitorNode(const QString &name)
QSettings * sett
Definition: TGo4QSettings.h:38
QString getAppStyle()
void setDouble(const QString &name, double value=0.)
QString getTGraphDrawOpt()
void getRemoteFileSett(QString &hostname, QString &filename, QString &protocol)
int getClientShellMode()
void setPrinterSett(const QString &name, const QString &cmd)
QString getClientAccountName()
void setClientExeMode(int mode)
QStringList getCommandsHistoryAnalysis()
void storeMainWindowState(QMainWindow *src)
void setCommandsHistoryAnalysis(const QStringList &commands)
QString getClientShell()
void setStatBoxErrors(bool on=true)
void setClientArgs(const QString &)
bool getStatBoxVisible()
void setTH1DrawOpt(const QString &value)
void setHideTGo4EventElement(bool on=true)
bool getDrawOnceFlag()
double getScreenScaleFactor()
void setMbsMonitorMonitorActive(bool on=true)
void setMbsMonitorTrend(bool on=true)
void setClientAccountName(const QString &)
void setAnalysisMacroTip(int id, const QString &com)
void setClientDir(const QString &)
void setFetchDataWhenCopy(bool on=true)
TGo4QSettings(const QString &filename)
void getCanvasColor(int &red, int &green, int &blue)
void setHistType(int value)
QString getClientName()
void setPadEventStatus(bool on)
QString fSettFileName
Definition: TGo4QSettings.h:41
bool getFetchDataWhenCopy()
QString getTermTimeFormat()
void setDrawFillColor(int col)
void setPaletteOpt(int min, int def, int max)
bool getDrawItemFlag()
void storePanelSize(QWidget *w, const QString &kind="ViewPanel")
void setHServFilter(const QString &)
void setOptStat(int value)
QString getClientExec(int mode=-1)
void setStr(const QString &name, const QString &value="")
bool getWebBasedCanvas()
void setDabcMonitorFreq(int secs)
void setBasicSettings()
void setClientName(const QString &)
bool getPadCrosshair()
void setTH3DrawOpt(const QString &value)
void setClientTermMode(int)
void setDabcMonitorBins(int num)
QString getStr(const QString &name, const QString &value="")
void setDabcMonitorBackwardsTrending(bool on=true)
QString getTH2DrawOpt()
void setSavePadWhiteBackground(bool on)
int getClientControllerMode()
void setClientShellMode(int)
void setTermHistorySize(int sz)
QString getHistName()
bool getBool(const QString &name, bool def=true)
QString getHServName()
void setWebBasedCanvas(bool on=true)
bool getPadSuperimpose()
bool getDrawTimeFlag()
void getHistAxisPars(int naxis, int &npoints, double &min, double &max)
void setBool(const QString &name, bool value=true)
QString getHServFilter()
void setFetchDataWhenDraw(bool on=true)
void setCloneFlag(bool on=true)
void setClientPort(int)
void setClientIsServer(int kind)
void setPadCrosshair(bool on)
bool getAnalysisMacroAutomode(int id)
void setBrowserColumn(const char *name, int width)
void getBasicSettings()
TGo4QSettings * go4sett
bool getMbsMonitorMonitorActive()
void setHServPort(int port)
bool getTermShowTimestamp()
QString getClientArgs()
void setHistAxisPars(int naxis, int npoints, double min, double max)
double getDouble(const QString &name, double value=0.)
void setTermFont(const QFont &)
int getInt(const QString &name, int def=0)
void setAppStyle(const QString &)
void setDrawLineWidth(int w=1)
void setHistName(const QString &value)
bool getMbsMonitorTrend()
bool getMbsMonitorMore()
int getDabcMonitorBins()
int getClientConnectMode()
QString getAnalysisMacroCommand(int id)
virtual ~TGo4QSettings()
void setMbsMonitorNode(const QString &name)
void setDrawOnceFlag(bool on=true)
void setAnalysisMacroCommand(int id, const QString &com)
QString getDabcMonitorNode()
bool getFetchDataWhenSave()
void setAnalysisMacroAutomode(int id, bool on)
void setHistTitle(const QString &value)
void setFetchDataWhenSave(bool on=true)
bool getPadEventStatus()
bool getStatBoxErrors()
void setRemoteFileSett(const QString &hostname, const QString &filename, const QString &protocol)
void restoreMainWindowState(QMainWindow *tgt)
QString getTH1DrawOpt()
bool getFetchDataWhenDraw()
void setMoveSubwindowRubberBand(bool on=true)
bool getMbsMonitorBackwardsTrending()
void setClientExec(const QString &)
QString getMbsMonitorNode()
QString getClientTerm()
void setDrawTimeFlag(bool on=true)
bool getDrawDateFlag()
QSize lastPanelSize(const QString &kind="ViewPanel", int dfltwidth=450, int dfltheight=250)
void getPrinterSett(QString &name, QString &cmd)
void setTH2DrawOpt(const QString &value)
void setHServName(const QString &)
QStringList getCommandsHistoryGUI()
bool getClientDefaultPass()
void setClientNode(const QString &)
QString getTH3DrawOpt()
void getPaletteOpt(int &min, int &def, int &max)
void setTermShowTimestamp(bool on)
void setDrawFillStyle(int style)
void setDrawItemFlag(bool on=true)
void setCanvasColor(int red, int green, int blue)
bool getMoveSubwindowRubberBand()
int getBrowserColumn(const char *name, int defwidth)
void setMbsMonitorBins(int num)
QString getGStyleStatFormat()
void setMbsMonitorBackwardsTrending(bool on=true)
void setInt(const QString &name, int value=0)
void setClientConnectMode(int)
int getDabcMonitorFreq()
void setOptStatW(int value)
QString getAnalysisMacroTip(int id)
bool getHideTGo4EventElement()
void setHServBase(const QString &)
void setOptStatH(int value)
void setGStyleStatFormat(const QString &)
QString getHServBase()
void setClientDefaultPass(bool)
void setMbsMonitorFreq(int secs)
void setTermTimeFormat(const QString &form)
void setMbsMonitorMore(bool on=true)
QString getClientNode()
void setAppFont(const QFont &)
void setCommandsHistoryGUI(const QStringList &commands)
void setPadSuperimpose(bool on)
void setStatBoxVisible(bool on=true)
void setTGraphDrawOpt(const QString &value)
int getTermHistorySize()
QString getHistTitle()
bool getDabcMonitorBackwardsTrending()