GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4QSettings.cpp
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#include "TGo4QSettings.h"
15
16#include "TSystem.h"
17
18#include "TGo4Marker.h"
19#include "TGo4Condition.h"
20#include "TGo4MdiArea.h"
21
22#include <QtCore/QSettings>
23#include <QtCore/QDir>
24#include <QFont>
25#include <QApplication>
26#include <QMainWindow>
27
28
29const char *MainWindowDefaultState = "000000ff00000000fd000000020000000000000178000002a9fc0200000001fb0000001600420072006f00770073006500720044006f0063006b0100000071000002a90000007e0100000300000003000003d500000082fc0100000001fc00000000000003d50000000000fffffffa000000020200000003fb00000016004c006f00670049006e0066006f0044006f0063006b0000000000ffffffff0000005701000003fb0000001a004d006200730056006900650077006500720044006f0063006b0000000000ffffffff0000006b01000003fb0000001e0044004100420043004d006f006e00690074006f00720044006f0063006b0000000279000000ce000000000000000000000392000002a900000004000000040000000800000008fc0000000800000002000000050000001600460069006c00650054006f006f006c0042006100720100000000ffffffff0000000000000000000000160047006f00340054006f006f006c007300420061007201000000f6ffffffff00000000000000000000001e0041006e0061006c00790073006900730054006f006f006c0042006100720100000226ffffffff00000000000000000000001a0044006900760069006400650050006100640044006f0063006b0000000395000000e400000000000000000000002c0041006e0061006c00790073006900730043006f006d006d0061006e00640054006f006f006c0042006100720000000339000001d50000000000000000000000020000000000000002000000020000002400420072006f0077007300650072004f007000740069006f006e00730044006f0063006b01000000000000010200000000000000000000001e0044007200610077004f007000740069006f006e00730044006f0063006b01000001020000037e00000000000000000000000200000002000000240048006900730044007200610077004f007000740069006f006e00730044006f0063006b0000000000000001290000000000000000000000180047006f0034005300740079006c00650044006f0063006b0000000000000004b10000000000000000000000020000000100000020005300630061006c0065004f007000740069006f006e00730044006f0063006b0100000000ffffffff0000000000000000000000030000000000000003000000010000001e0043006f006d006d0061006e0064004c0069006e00650044006f0063006b0000000000000004b1000000000000000000000003000000010000001c00540072006500650056006900650077006500720044006f0063006b0000000000000004b10000000000000000";
30
31const char *MainWindowDefaultGeometry = "01d9d0cb0003000000000ad90000002d00000fe60000037a00000ad90000004a00000fe60000037a00000000000000000a0000000ad90000004a00000fe60000037a";
32
34
35TGo4QSettings::TGo4QSettings(const QString& filename)
36{
37 fSettFileName = filename;
38
39 fUseWeb = false;
40
41 Open();
42}
43
45{
46 // do not destroy QSettings - they will be automatically saved
47 // delete sett;
48}
49
51{
52 if (fSettFileName.length() > 0) return fSettFileName;
53#ifdef _MSC_VER
54 return QString("Registry (default)");
55#endif
56
57 return QDir::homePath() + "/.config/GSI/go4.conf (default)";
58}
59
61{
62 if (fSettFileName.length()>0)
63 sett = new QSettings(fSettFileName, QSettings::NativeFormat);
64 else
65 sett = new QSettings("GSI","go4");
66}
67
69{
70 delete sett;
71 sett = nullptr;
72 Open();
73}
74
75void TGo4QSettings::setBool(const QString& name, bool value)
76{
77 sett->setValue(name, QString(value ? "true" : "false"));
78}
79
80bool TGo4QSettings::getBool(const QString& name, bool def)
81{
82 return sett->value(name, QString(def ? "true" : "false")).toString() == QString("true");
83}
84
85void TGo4QSettings::setInt(const QString& name, int value)
86{
87 sett->setValue(name, value);
88}
89
90int TGo4QSettings::getInt(const QString& name, int def)
91{
92 return sett->value(name, def).toInt();
93}
94
95void TGo4QSettings::setStr(const QString& name, const QString& value)
96{
97 sett->setValue(name, value);
98}
99
100QString TGo4QSettings::getStr(const QString& name, const QString& def)
101{
102 return sett->value(name, def).toString();
103}
104
105void TGo4QSettings::setDouble(const QString& name, double value)
106{
107 sett->setValue(name, value);
108}
109
110double TGo4QSettings::getDouble(const QString& name, double def)
111{
112 return sett->value(name, def).toDouble();
113}
114
115// set of Go4 specific functions
116
118{
119 //writeEntry( "/Font", QApplication::font().toString() );
120 Bool_t HASLABEL, HASCONNECTOR, XDRAW, YDRAW, XBINDRAW, YBINDRAW, CONTDRAW;
121 TString NUMFORMAT;
122 TGo4Marker::GetGlobalStyle(HASLABEL, HASCONNECTOR, XDRAW, YDRAW,
123 XBINDRAW, YBINDRAW, CONTDRAW, NUMFORMAT);
124
125 setBool("/markers/Markerlabel", HASLABEL);
126 setBool("/markers/Connectorline", HASCONNECTOR);
127 setBool("/markers/ShowX", XDRAW);
128 setBool("/markers/ShowY", YDRAW);
129 setBool("/markers/ShowXbin", XBINDRAW);
130 setBool("/markers/ShowYbin", YBINDRAW);
131 setBool("/markers/ShowBinContent", CONTDRAW);
132 setStr("/markers/LabelNumberFormat", NUMFORMAT.Data());
133
134 Bool_t LABELDRAW, LIMITSDRAW, INTDRAW,
135 XMEANDRAW, YMEANDRAW, XRMSDRAW, YRMSDRAW,
136 XMAXDRAW, YMAXDRAW, CMAXDRAW;
137 TGo4Condition::GetGlobalStyle(LABELDRAW, LIMITSDRAW, INTDRAW,
138 XMEANDRAW, YMEANDRAW, XRMSDRAW, YRMSDRAW,
139 XMAXDRAW, YMAXDRAW, CMAXDRAW, NUMFORMAT);
140 setBool("/conditions/Conditionlabel", LABELDRAW);
141 setBool("/conditions/ShowLimits", LIMITSDRAW);
142 setBool("/conditions/ShowIntegral", INTDRAW);
143 setBool("/conditions/ShowXmean", XMEANDRAW);
144 setBool("/conditions/ShowYmean", YMEANDRAW);
145 setBool("/conditions/ShowXrms", XRMSDRAW);
146 setBool("/conditions/ShowYrms", YRMSDRAW);
147 setBool("/conditions/ShowXmax", XMAXDRAW);
148 setBool("/conditions/ShowYmax", YMAXDRAW);
149 setBool("/conditions/ShowCmax", CMAXDRAW);
150 setStr("/conditions/LabelNumberFormat", NUMFORMAT.Data());
151}
152
154{
155 // QString AppStyle = readEntry( "/Style/AppStyle", "windows");
156 // QApplication::setStyle(AppStyle);
157
158 // QFont font;
159 // font.fromString(readEntry( "/Font", "Arial,11,-1,5,50,0,0,0,0,0"));
160 // QApplication::setFont(font, true );
161
162 TGo4Marker::SetGlobalStyle(getBool("/markers/Markerlabel", 1),
163 getBool("/markers/Connectorline", 1),
164 getBool("/markers/ShowX", 1),
165 getBool("/markers/ShowY", 0),
166 getBool("/markers/ShowXbin", 0),
167 getBool("/markers/ShowYbin", 0),
168 getBool("/markers/ShowBinContent", 1),
169 getStr("/markers/LabelNumberFormat", "%.4E").toLatin1().constData());
170
171 TGo4Condition::SetGlobalStyle(getBool("/conditions/Conditionlabel", 1),
172 getBool("/conditions/ShowLimits", 1),
173 getBool("/conditions/ShowIntegral", 1),
174 getBool("/conditions/ShowXmean", 1),
175 getBool("/conditions/ShowYmean", 0),
176 getBool("/conditions/ShowXrms", 1),
177 getBool("/conditions/ShowYrms", 0),
178 getBool("/conditions/ShowXmax", 1),
179 getBool("/conditions/ShowYmax", 0),
180 getBool("/conditions/ShowCmax", 1),
181 getStr("/conditions/LabelNumberFormat", "%.4E").toLatin1().constData());
182}
183
184void TGo4QSettings::setAppFont(const QFont& font)
185{
186 setStr("/Font", font.toString());
187}
188
190{
191 QFont font;
192 font.fromString(getStr("/Font", "Arial,11,-1,5,50,0,0,0,0,0"));
193 QApplication::setFont(font);
194}
195
196void TGo4QSettings::setTermFont(const QFont& font)
197{
198 setStr("/TermFont", font.toString());
199
200}
202{
203 QFont font;
204// font.fromString(getStr("/TermFont", "Arial,11,-1,5,50,0,0,0,0,0"));
205 font.fromString(getStr("/TermFont", ""));
206 return font;
207}
208
209void TGo4QSettings::setAppStyle(const QString& v)
210{
211 setStr("/Style/AppStyle", v);
212}
213
215{
216 return getStr("/Style/AppStyle", "windows");
217}
218
219void TGo4QSettings::setClientName(const QString& v)
220{
221 setStr("/ClientSetting/Name", v);
222}
223
225{
226 return getStr("/ClientSetting/Name", "MyAnalysis");
227}
228
229void TGo4QSettings::setClientNode(const QString& v)
230{
231 setStr( "/ClientSetting/Node", v);
232}
233
235{
236 return getStr("/ClientSetting/Node", "localhost");
237}
238
239void TGo4QSettings::setClientDir(const QString& v)
240{
241 setStr("/ClientSetting/Dir", v);
242}
243
245{
246 return getStr("/ClientSetting/Dir", QDir::currentPath());
247}
248
250{
251 setInt("/ClientSetting/ExeMode", mode);
252}
253
255{
256 return getInt("/ClientSetting/ExeMode", 1);
257}
258
259void TGo4QSettings::setClientExec(const QString& v)
260{
261 if (getClientExeMode() == 0) setStr("/ClientSetting/Exec", v);
262 else setStr("/ClientSetting/Lib", v);
263}
264
266{
267 if (mode < 0) mode = getClientExeMode();
268 return mode == 0 ? getStr("/ClientSetting/Exec", "./MainUserAnalysis") : getStr("/ClientSetting/Lib", "libGo4UserAnalysis");
269}
270
271void TGo4QSettings::setClientArgs(const QString& v)
272{
273 setStr("/ClientSetting/Args", v);
274}
275
277{
278 return getStr("/ClientSetting/Args", "");
279}
280
282{
283 const char *name = "exec";
284 switch (v) {
285 case 0: name = "exec"; break;
286 case 1: name = "rsh"; break;
287 case 2: name = "ssh"; break;
288 }
289
290 setStr( "/ClientSetting/Shell", name);
291}
292
294{
295 return getStr("/ClientSetting/Shell", "exec");
296}
297
299{
300 QString v = getClientShell();
301 int shellmode = 2;
302 if(v.contains("exec")) shellmode = 0; else
303 if(v.contains("rsh")) shellmode = 1; else
304 if(v.contains("ssh")) shellmode = 2;
305 return shellmode;
306}
307
308
310{
311 QString res = "qt";
312 switch(v) {
313 case 1: res = "qt"; break;
314 case 2: res = "xterm"; break;
315 case 3: res = "konsole"; break;
316 }
317 setStr("/ClientSetting/Term", res);
318}
319
321{
322 return getStr("/ClientSetting/Term", "qt");
323}
324
326{
327 QString v = getClientTerm();
328 int termmode = 1;
329 if(v.contains("qt")) termmode = 1; else
330 if(v.contains("xterm")) termmode = 2; else
331 if(v.contains("konsole")) termmode = 3;
332 return termmode;
333}
334
336{
337 QString v = "false";
338 if (kind==1) v = "true";
339 if (kind==2) v = "http";
340 setStr("/ClientSetting/IsServer", v);
341}
342
344{
345 QString v = getStr("/ClientSetting/IsServer", "false");
346 if (v == "true") return 1;
347 if (v == "http") return 2;
348 return 0;
349}
350
352{
353 setInt( "/ClientSetting/ClientPort", nport);
354}
355
357{
358 return getInt( "/ClientSetting/ClientPort", 5000);
359}
360
362{
363 setInt("/ClientSetting/Controller", mode);
364}
365
367{
368 return getInt("/ClientSetting/Controller", 0);
369}
370
372{
373 setBool("/ClientSetting/DefaultPass", on);
374}
375
377{
378 return getBool("/ClientSetting/DefaultPass", true);
379}
380
382{
383 setInt("/ClientSetting/Connection", mode);
384}
385
387{
388 return getInt("/ClientSetting/Connection", 0);
389}
390
392{
393 return getStr("/ClientSetting/Account", "observer");
394}
395
397{
398 setStr("/ClientSetting/Account", v);
399}
400
402{
403 setInt("/AnalisysTerminal/HistorySize", sz);
404}
405
407{
408 return getInt("/AnalisysTerminal/HistorySize", 100000);
409}
410
411void TGo4QSettings::setHServName(const QString &v)
412{
413 setStr("/HistogramClient/server", v);
414}
415
417{
418 return getStr("/HistogramClient/server", "");
419}
420
421void TGo4QSettings::setHServBase(const QString &v)
422{
423 setStr("/HistogramClient/base", v);
424}
425
427{
428 return getStr("/HistogramClient/base", "");
429}
430
431void TGo4QSettings::setHServFilter(const QString &v)
432{
433 setStr("/HistogramClient/filter", v);
434}
435
437{
438 return getStr("/HistogramClient/filter", "*");
439}
440
442{
443 setInt("/HistogramClient/port", port);
444}
445
447{
448 return getInt("/HistogramClient/port", 6009);
449}
450
452{
453 setBool("/geometry/Crosshairmode", on);
454}
455
457{
458 return getBool( "/geometry/Crosshairmode", false);
459}
460
462{
463 setBool("/geometry/Superimpose", on);
464}
465
467{
468 return getBool("/geometry/Superimpose", false);
469}
470
472{
473 setBool("/geometry/Eventstatusmode", on);
474}
475
477{
478 return getBool("/geometry/Eventstatusmode", false);
479}
480
481void TGo4QSettings::setCanvasColor(int red, int green, int blue)
482{
483 setInt( "/ViewPanel/BackRed", red );
484 setInt( "/ViewPanel/BackGrn", green);
485 setInt( "/ViewPanel/BackBlu", blue );
486}
487
488void TGo4QSettings::getCanvasColor(int& red, int& green, int& blue)
489{
490 red = getInt( "/ViewPanel/BackRed", 220);
491 green = getInt( "/ViewPanel/BackGrn", 220);
492 blue = getInt( "/ViewPanel/BackBlu", 220);
493}
494
495
496void TGo4QSettings::setPaletteOpt(int min, int def, int max)
497{
498 setInt( "/ViewPanel/PaletteMin", min);
499 setInt( "/ViewPanel/PaletteDef", def);
500 setInt( "/ViewPanel/PaletteMax", max);
501}
502
503void TGo4QSettings::getPaletteOpt(int& min, int& def, int& max)
504{
505 min = getInt( "/ViewPanel/PaletteMin", 0);
506 def = getInt( "/ViewPanel/PaletteDef", 1);
507 max = getInt( "/ViewPanel/PaletteMax", 56);
508 if (max == 56) max = 112; // default values for old ROOT can be overwritten
509}
510
512{
513 setBool("/ViewPanel/CloneFlag", on);
514}
515
517{
518 return getBool( "/ViewPanel/CloneFlag", true);
519}
520
522{
523 setBool("/ViewPanel/DrawOnce", on);
524}
525
527{
528 return getBool("/ViewPanel/DrawOnce", false);
529}
530
532{
533 setBool("/ViewPanel/DrawTime", on);
534}
535
537{
538 return getBool("/ViewPanel/DrawTime", true);
539}
540
542{
543 setBool("/ViewPanel/DrawDate", on);
544}
545
547{
548 return getBool("/ViewPanel/DrawDate");
549}
550
552{
553 setBool("/ViewPanel/DrawItem", on);
554}
555
557{
558 return getBool("/ViewPanel/DrawItem");
559}
560
562{
563 setInt("/ViewPanel/DrawLineWidth", w);
564}
565
567{
568 return getInt("/ViewPanel/DrawLineWidth", 1);
569}
570
572{
573 setInt("/ViewPanel/DrawFillColor", col);
574}
575
577{
578 return getInt("/ViewPanel/DrawFillColor", 0);
579}
580
582{
583 setInt("/ViewPanel/DrawFillStyle", style);
584}
585
587{
588 return getInt("/ViewPanel/DrawFillStyle", 1001);
589}
590
591void TGo4QSettings::setTH1DrawOpt(const QString& v)
592{
593 setStr("/ViewPanel/TH1DrawOpt", v);
594}
595
597{
598 return getStr("/ViewPanel/TH1DrawOpt", "hist");
599}
600
601void TGo4QSettings::setTH2DrawOpt(const QString& v)
602{
603 setStr("/ViewPanel/TH2DrawOpt", v);
604}
605
607{
608 return getStr("/ViewPanel/TH2DrawOpt", "col");
609}
610
611void TGo4QSettings::setTH3DrawOpt(const QString& v)
612{
613 setStr("/ViewPanel/TH3DrawOpt", v);
614}
615
617{
618 return getStr("/ViewPanel/TH3DrawOpt", "hist");
619}
620
622{
623 setStr("/ViewPanel/TGraphDrawOpt", v);
624}
625
627{
628 return getStr("/ViewPanel/TGraphDrawOpt", "al");
629}
630
632{
633 setStr("/ViewPanel/GStyleStatFormat", v);
634}
635
637{
638 return getStr("/ViewPanel/GStyleStatFormat", "");
639}
640
642{
643 tgt->restoreState(sett->value("/MainWindow/State", QByteArray::fromHex(MainWindowDefaultState)).toByteArray());
644 tgt->restoreGeometry(sett->value("/MainWindow/Geometry", QByteArray::fromHex(MainWindowDefaultGeometry)).toByteArray());
645}
646
648{
649 // printf("state: %s\n", src->saveState().toHex().data());
650 // printf("geom: %s\n", src->saveGeometry().toHex().data());
651
652 sett->setValue("/MainWindow/State", src->saveState());
653 sett->setValue("/MainWindow/Geometry", src->saveGeometry());
654}
655
656void TGo4QSettings::storePanelSize(QWidget *w, const QString& kind)
657{
658 setInt(QString("/") + kind + QString("/Width"), w->width());
659 setInt(QString("/") + kind + QString("/Height"), w->height());
660}
661
662QSize TGo4QSettings::lastPanelSize(const QString& kind, int dfltwidth, int dfltheight)
663{
664 QSize rect(getInt(QString("/") + kind + QString("/Width"), dfltwidth),
665 getInt(QString("/") + kind + QString("/Height"), dfltheight));
666
667 if (rect.height() > 1.5*TGo4MdiArea::Instance()->height())
668 rect.setHeight(1.5*TGo4MdiArea::Instance()->height());
669
670 if (rect.width() > 1.5*TGo4MdiArea::Instance()->width())
671 rect.setWidth(1.5*TGo4MdiArea::Instance()->width());
672
673 return rect;
674}
675
676void TGo4QSettings::setBrowserColumn(const char *name, int width)
677{
678 setInt( QString("/Browser/") + name, width);
679}
680
681int TGo4QSettings::getBrowserColumn(const char *name, int defwidth)
682{
683 return getInt( QString("/Browser/") + name, defwidth);
684}
685
686
688{
689 setInt( "/HistStatsBox/OptStats", value);
690}
691
693{
694 return getInt( "/HistStatsBox/OptStats", 11111111);
695}
696
698{
699 setInt( "/HistStatsBox/OptStatsW", value);
700}
701
703{
704 return getInt( "/HistStatsBox/OptStatsW", 0);
705}
706
708{
709 setInt( "/HistStatsBox/OptStatsH", value);
710}
711
713{
714 return getInt( "/HistStatsBox/OptStatsH", 0);
715}
716
718{
719 setBool( "/HistStatsBox/Visible", on);
720}
721
723{
724 return getBool( "/HistStatsBox/Visible", true);
725}
726
728{
729 setBool( "/HistStatsBox/Errors", on);
730}
731
733{
734 return getBool( "/HistStatsBox/Errors", false);
735}
736
737void TGo4QSettings::setHistName(const QString& value)
738{
739 setStr("/NewHist/Name", value);
740}
741
743{
744 return getStr("/NewHist/Name", "histo1");
745}
746
747void TGo4QSettings::setHistTitle(const QString& value)
748{
749 setStr("/NewHist/Title", value);
750}
751
753{
754 return getStr("/NewHist/Title", "histogram title");
755}
756
758{
759 setInt( "/NewHist/HType", value);
760}
761
763{
764 return getInt( "/NewHist/HType", 14);
765}
766
767void TGo4QSettings::setHistAxisPars(int naxis, int npoints, double min, double max)
768{
769 QString sname = "/NewHist/Axis";
770 switch (naxis) {
771 case 0: sname+="X_"; break;
772 case 1: sname+="Y_"; break;
773 case 2: sname+="Z_"; break;
774 default: sname+="X_"; break;
775 }
776 setInt(sname+"NPoints", npoints);
777 setDouble(sname+"Min", min);
778 setDouble(sname+"Max", max);
779}
780
781void TGo4QSettings::getHistAxisPars(int naxis, int& npoints, double& min, double& max)
782{
783 QString sname = "/NewHist/Axis";
784 switch (naxis) {
785 case 0: sname+="X_"; break;
786 case 1: sname+="Y_"; break;
787 case 2: sname+="Z_"; break;
788 default: sname+="X_"; break;
789 }
790 npoints = getInt(sname+"NPoints", 100);
791 min = getDouble(sname+"Min", 0.);
792 max = getDouble(sname+"Max", 100.);
793}
794
796{
797 setBool("/preferences/FetchWhenDraw", on);
798}
799
801{
802 return getBool("/preferences/FetchWhenDraw", true);
803}
804
806{
807 setBool("/preferences/FetchWhenCopy", on);
808}
809
811{
812 return getBool("/preferences/FetchWhenCopy", false);
813}
814
816{
817 setBool("/preferences/FetchWhenSave", on);
818}
819
821{
822 return getBool("/preferences/FetchWhenSave", false);
823}
824
826{
827 setBool("/preferences/HideEventElement", on);
828}
829
831{
832 return getBool("/preferences/HideEventElement", false);
833}
834
836{
837 setBool("/preferences/MoveSubwindowRubberBand", on);
838}
839
841{
842 return getBool("/preferences/MoveSubwindowRubberBand", true);
843}
844
846{
847 setBool("/preferences/NativeMenuBar", on);
848}
849
851{
852#ifdef Darwin
853 bool dflt = true;
854#else
855 bool dflt = false;
856#endif
857 return getBool("/preferences/NativeMenuBar", dflt);
858}
859
860
861void TGo4QSettings::setRemoteFileSett(const QString& hostname, const QString& filename, const QString& protocol)
862{
863 setStr( "/OpenRemoteFile/Host", hostname);
864 setStr( "/OpenRemoteFile/File", filename);
865 setStr( "/OpenRemoteFile/Type", protocol);
866}
867
868void TGo4QSettings::getRemoteFileSett(QString& hostname, QString& filename, QString& protocol)
869{
870 hostname = getStr( "/OpenRemoteFile/Host", "jsroot.gsi.de");
871 filename = getStr( "/OpenRemoteFile/File", "files/hsimple.root");
872 protocol = getStr( "/OpenRemoteFile/Type", "http:");
873}
874
875void TGo4QSettings::setPrinterSett(const QString& name, const QString& cmd)
876{
877 setStr( "/Printer/Name", name);
878 setStr( "/Printer/Prog", cmd);
879}
880
881void TGo4QSettings::getPrinterSett(QString &name, QString &cmd)
882{
883 name = getStr("/Printer/Name", gSystem->Getenv("PRINTER"));
884 cmd = getStr("/Printer/Prog", "lpr");
885}
886
887void TGo4QSettings::setMbsMonitorNode(const QString &name)
888{
889 setStr("/MbsMonitor/Node", name);
890}
891
893{
894 return getStr("/MbsMonitor/Node", "r2-d2");
895}
896
898{
899 setInt("/MbsMonitor/Frequency", secs);
900}
901
903{
904 return getInt("/MbsMonitor/Frequency", 5);
905}
906
908{
909 setInt("/MbsMonitor/Bins", num);
910}
911
913{
914 return getInt("/MbsMonitor/Bins", 200);
915}
916
918{
919 setBool("/MbsMonitor/TrendOn", on);
920}
921
923{
924 return getBool("/MbsMonitor/TrendOn", false);
925}
926
928{
929 setBool("/MbsMonitor/ShowMore", on);
930}
931
933{
934 return getBool("/MbsMonitor/ShowMore", true);
935}
936
938{
939 setBool("/MbsMonitor/MonitorActive", on);
940}
941
943{
944 return getBool("/MbsMonitor/MonitorActive", false);
945}
946
948{
949 setBool("/MbsMonitor/BackwardsTrending", on);
950}
951
953{
954 return getBool("/MbsMonitor/BackwardsTrending", true);
955}
956
957void TGo4QSettings::setDabcMonitorNode(const QString &name)
958{
959 setStr("/DabcMonitor/Node", name);
960}
961
963{
964 return getStr("/DabcMonitor/Node", "dimDns.gsi.de");
965}
966
968{
969 setInt("/DabcMonitor/Frequency", secs);
970}
971
973{
974 return getInt("/DabcMonitor/Frequency", 5);
975}
976
978{
979 setInt("/DabcMonitor/Bins", num);
980}
981
983{
984 return getInt("/DabcMonitor/Bins", 200);
985}
986
988{
989 setBool("/DabcMonitor/BackwardsTrending", on);
990}
991
993{
994 return getBool("/DabcMonitor/BackwardsTrending", true);
995}
996
998{
999 return sett->value("/CommandsHistoryGUI").toStringList();
1000}
1001
1002void TGo4QSettings::setCommandsHistoryGUI(const QStringList &commands)
1003{
1004 sett->setValue("/CommandsHistoryGUI", commands);
1005}
1006
1008{
1009 return sett->value("/CommandsHistoryAnalysis").toStringList();
1010}
1011
1012void TGo4QSettings::setCommandsHistoryAnalysis(const QStringList &commands)
1013{
1014 sett->setValue("/CommandsHistoryAnalysis", commands);
1015}
1016
1018{
1019 QString descriptor = QString("/AnalysisMacro%1/Command").arg(id);
1020
1021 return getStr(descriptor, "");
1022}
1023
1025{
1026 QString descriptor = QString("/AnalysisMacro%1/Tip").arg(id);
1027 QString deftip = QString("Ctrl - %1").arg(id + 1);
1028 return getStr(descriptor, deftip);
1029}
1030
1032{
1033 QString descriptor=QString("/AnalysisMacro%1/Automode").arg(id);
1034 return getBool(descriptor, false);
1035}
1036
1038{
1039 QString descriptor=QString("/AnalysisMacro%1/Automode").arg(id);
1040 setBool(descriptor, on);
1041}
1042
1043
1044void TGo4QSettings::setAnalysisMacroCommand(int id, const QString& com)
1045{
1046 QString descriptor=QString("/AnalysisMacro%1/Command").arg(id);
1047 setStr(descriptor, com);
1048}
1049
1050void TGo4QSettings::setAnalysisMacroTip(int id, const QString& com)
1051{
1052 QString descriptor=QString("/AnalysisMacro%1/Tip").arg(id);
1053 setStr(descriptor, com);
1054}
1055
1057{
1058 return getDouble("/Screen/ScaleFactor", 1.0);
1059}
1061{
1062 setDouble( "/Screen/ScaleFactor", factor);
1063}
1064
1066{
1067 return getBool("/ViewPanel/SavePadWhiteBackground", false);
1068}
1069
1071{
1072
1073 setBool("/ViewPanel/SavePadWhiteBackground", on);
1074}
1075
1077{
1078 return getBool("/AnalisysTerminal/ShowTimestamp", false);
1079}
1080
1082{
1083 setBool("/AnalisysTerminal/ShowTimestamp", on);
1084}
1085
1087{
1088 return getStr( "/AnalisysTerminal/TimeFormat", "yyyy-MM-dd hh mm:ss.zzz");
1089}
1090
1091void TGo4QSettings::setTermTimeFormat(const QString& form)
1092{
1093 setStr( "/AnalisysTerminal/TimeFormat", form);
1094}
1095
TGo4QSettings * go4sett
const char * MainWindowDefaultGeometry
const char * MainWindowDefaultState
static void SetGlobalStyle(Bool_t LABELDRAW, Bool_t LIMITSDRAW, Bool_t INTDRAW, Bool_t XMEANDRAW, Bool_t YMEANDRAW, Bool_t XRMSDRAW, Bool_t YRMSDRAW, Bool_t XMAXDRAW, Bool_t YMAXDRAW, Bool_t CMAXDRAW, const char *NUMFORMAT)
static void GetGlobalStyle(Bool_t &LABELDRAW, Bool_t &LIMITSDRAW, Bool_t &INTDRAW, Bool_t &XMEANDRAW, Bool_t &YMEANDRAW, Bool_t &XRMSDRAW, Bool_t &YRMSDRAW, Bool_t &XMAXDRAW, Bool_t &YMAXDRAW, Bool_t &CMAXDRAW, TString &NUMFORMAT)
static void SetGlobalStyle(Bool_t HASLABEL, Bool_t HASCONNECTOR, Bool_t XDRAW, Bool_t YDRAW, Bool_t XBINDRAW, Bool_t YBINDRAW, Bool_t CONTDRAW, const char *NUMFORMAT)
static void GetGlobalStyle(Bool_t &HASLABEL, Bool_t &HASCONNECTOR, Bool_t &XDRAW, Bool_t &YDRAW, Bool_t &XBINDRAW, Bool_t &YBINDRAW, Bool_t &CONTDRAW, TString &NUMFORMAT)
static TGo4MdiArea * Instance()
Extends the usual QSettings by a global setup for the location of the settings file.
void setTH3DrawOpt(const QString &value)
QString getGStyleStatFormat()
QString getClientNode()
void Open()
Read settings from the file/registry.
QString getHServFilter()
void setHistTitle(const QString &value)
void setAnalysisMacroCommand(int id, const QString &com)
void setAppFont(const QFont &)
void getHistAxisPars(int naxis, int &npoints, double &min, double &max)
bool getFetchDataWhenDraw()
virtual ~TGo4QSettings()
void setBool(const QString &name, bool value=true)
int getInt(const QString &name, int def=0)
void setTermHistorySize(int sz)
QString getStr(const QString &name, const QString &value="")
QStringList getCommandsHistoryGUI()
implement history for gui command line
double getDouble(const QString &name, double value=0.)
QString getTH3DrawOpt()
void setAnalysisMacroTip(int id, const QString &com)
void setFetchDataWhenDraw(bool on=true)
void setInt(const QString &name, int value=0)
bool getSavePadWhiteBackground()
switch to make pad and frame backgrounds white before saving/printing them
void setTermFont(const QFont &)
bool getClientDefaultPass()
bool getMoveSubwindowRubberBand()
void setClientControllerMode(int)
QString getClientAccountName()
QString fSettFileName
This is the name of the file with settings, if empty - default qt location will be used.
void setTH1DrawOpt(const QString &value)
void setClientExeMode(int mode)
QString getClientArgs()
void setMbsMonitorNode(const QString &name)
some things for the mbs monitor dockwindow:
void setHServPort(int port)
QString getHistTitle()
QString getClientName()
void setCommandsHistoryGUI(const QStringList &commands)
void setDrawFillStyle(int style)
void setHistAxisPars(int naxis, int npoints, double min, double max)
void restoreMainWindowState(QMainWindow *tgt)
main window state/geometry
void setHistName(const QString &value)
void setNativeMenuBar(bool on=true)
bool getTermShowTimestamp()
void setAppStyle(const QString &)
QString getDabcMonitorNode()
void setDabcMonitorFreq(int secs)
void setGStyleStatFormat(const QString &)
QString getTH2DrawOpt()
void setDrawOnceFlag(bool on=true)
TGo4QSettings(const QString &filename)
void setClientPort(int)
QString getClientExec(int mode=-1)
void setPaletteOpt(int min, int def, int max)
void setOptStat(int value)
void setTGraphDrawOpt(const QString &value)
QString getAnalysisMacroCommand(int id)
for predefined macro buttons in main gui:
bool getFetchDataWhenSave()
void setPrinterSett(const QString &name, const QString &cmd)
void setHServName(const QString &)
void getRemoteFileSett(QString &hostname, QString &filename, QString &protocol)
double getScreenScaleFactor()
for Qt>5.6: factor to scale up whole gui on high dpi screens
void setOptStatH(int value)
void setMbsMonitorTrend(bool on=true)
QString getHServBase()
void setStr(const QString &name, const QString &value="")
void setSavePadWhiteBackground(bool on)
void setStatBoxErrors(bool on=true)
void setTermTimeFormat(const QString &form)
void setPadEventStatus(bool on)
void setClientTermMode(int)
void setClientArgs(const QString &)
void setClientShellMode(int)
void getPaletteOpt(int &min, int &def, int &max)
void setRemoteFileSett(const QString &hostname, const QString &filename, const QString &protocol)
void storeMainWindowState(QMainWindow *src)
bool getMbsMonitorBackwardsTrending()
void setDrawFillColor(int col)
void setClientIsServer(int kind)
void setClientDir(const QString &)
void setDrawLineWidth(int w=1)
bool getBool(const QString &name, bool def=true)
bool getMbsMonitorMonitorActive()
QString getTGraphDrawOpt()
QSize lastPanelSize(const QString &kind="ViewPanel", int dfltwidth=450, int dfltheight=250)
QString getHServName()
int getBrowserColumn(const char *name, int defwidth)
int getClientControllerMode()
void setPadCrosshair(bool on)
void storePanelSize(QWidget *w, const QString &kind="ViewPanel")
void setDrawTimeFlag(bool on=true)
QStringList getCommandsHistoryAnalysis()
implement history for analysis command line
void setPadSuperimpose(bool on)
void setTermShowTimestamp(bool on)
void setClientExec(const QString &)
void setMbsMonitorMonitorActive(bool on=true)
void setDabcMonitorBins(int num)
void setMbsMonitorFreq(int secs)
void setClientDefaultPass(bool)
void setAnalysisMacroAutomode(int id, bool on)
void setDabcMonitorNode(const QString &name)
some things for the DABC monitor dockwindow:
bool getFetchDataWhenCopy()
void setMoveSubwindowRubberBand(bool on=true)
QString getHistName()
void setMbsMonitorBackwardsTrending(bool on=true)
void setOptStatW(int value)
void setCanvasColor(int red, int green, int blue)
void setHServBase(const QString &)
bool getHideTGo4EventElement()
void setMbsMonitorMore(bool on=true)
void setDrawDateFlag(bool on=true)
void setDabcMonitorBackwardsTrending(bool on=true)
QString getClientTerm()
void setClientConnectMode(int)
void setClientNode(const QString &)
void setScreenScaleFactor(double factor)
void setBrowserColumn(const char *name, int width)
void setFetchDataWhenSave(bool on=true)
QString getClientShell()
void setClientAccountName(const QString &)
void setHistType(int value)
QSettings * sett
Currently opened settings.
void setDrawItemFlag(bool on=true)
void getCanvasColor(int &red, int &green, int &blue)
void setClientName(const QString &)
QString GetSettLoaction()
QString getMbsMonitorNode()
void setHServFilter(const QString &)
QString getAnalysisMacroTip(int id)
void setCommandsHistoryAnalysis(const QStringList &commands)
void setStatBoxVisible(bool on=true)
bool getMbsMonitorTrend()
void getPrinterSett(QString &name, QString &cmd)
void setCloneFlag(bool on=true)
QString getTermTimeFormat()
void setHideTGo4EventElement(bool on=true)
void setMbsMonitorBins(int num)
void setTH2DrawOpt(const QString &value)
QString getAppStyle()
void setDouble(const QString &name, double value=0.)
QString getClientDir()
bool getAnalysisMacroAutomode(int id)
QString getTH1DrawOpt()
bool getDabcMonitorBackwardsTrending()
void setFetchDataWhenCopy(bool on=true)