18 #include "Riostream.h"
26 #include <QtCore/QSettings>
27 #include <QtCore/QFile>
28 #include <QtCore/QDir>
30 #include <QApplication>
31 #include <QMainWindow>
34 const char*
MainWindowDefaultState =
"000000ff00000000fd00000002000000000000012500000198fc0200000001fb0000001600420072006f00770073006500720044006f0063006b0100000057000001980000007a00ffffff00000003000003d500000082fc0100000001fc00000000000003d50000007f00fffffffa000000000200000003fb00000016004c006f00670049006e0066006f0044006f0063006b0100000000ffffffff0000005300fffffffb0000001a004d006200730056006900650077006500720044006f0063006b0000000000ffffffff0000006500fffffffb0000001e0044004100420043004d006f006e00690074006f00720044006f0063006b0000000279000000ce0000000000000000000002aa0000019800000004000000040000000800000008fc0000000800000002000000040000001600460069006c00650054006f006f006c0042006100720100000000ffffffff0000000000000000000000160047006f00340054006f006f006c007300420061007201000000c8ffffffff00000000000000000000001e0041006e0061006c00790073006900730054006f006f006c004200610072010000020c0000025800000000000000000000001a0044006900760069006400650050006100640044006f0063006b0000000395000000e40000000000000000000000020000000000000002000000020000002400420072006f0077007300650072004f007000740069006f006e00730044006f0063006b01000000000000010200000000000000000000001e0044007200610077004f007000740069006f006e00730044006f0063006b01000001020000037e00000000000000000000000200000002000000240048006900730044007200610077004f007000740069006f006e00730044006f0063006b0000000000000001290000000000000000000000180047006f0034005300740079006c00650044006f0063006b0000000000000004b10000000000000000000000020000000100000020005300630061006c0065004f007000740069006f006e00730044006f0063006b0000000000000004b10000000000000000000000030000000000000003000000010000001e0043006f006d006d0061006e0064004c0069006e00650044006f0063006b0000000000000004b1000000000000000000000003000000010000001c00540072006500650056006900650077006500720044006f0063006b0000000000000004b10000000000000000";
36 const char*
MainWindowDefaultGeometry =
"01d9d0cb00010000000000140000000c000003f0000002ba0000001800000029000003ec000002b6000000000000";
57 return QString(
"Registry (default)");
60 return QDir::homePath() +
"/.config/GSI/go4.conf (default)";
69 sett =
new QSettings(
"GSI",
"go4");
80 sett->setValue(name, QString(value ?
"true" :
"false"));
85 return sett->value(name, QString(def ?
"true" :
"false")).toString() == QString(
"true");
90 sett->setValue(name, value);
95 return sett->value(name, def).toInt();
100 sett->setValue(name, value);
105 return sett->value(name, def).toString();
110 sett->setValue(name, value);
115 return sett->value(name, def).toDouble();
181 setStr(
"/Font", font.toString());
187 font.fromString(
getStr(
"/Font",
"Arial,11,-1,5,50,0,0,0,0,0"));
188 QApplication::setFont(font);
193 setStr(
"/TermFont", font.toString());
200 font.fromString(
getStr(
"/TermFont",
""));
206 setStr(
"/Style/AppStyle", v);
211 return getStr(
"/Style/AppStyle",
"windows");
216 setStr(
"/ClientSetting/Name", v);
221 return getStr(
"/ClientSetting/Name",
"MyAnalysis");
226 setStr(
"/ClientSetting/Node", v);
231 return getStr(
"/ClientSetting/Node",
"localhost");
236 setStr(
"/ClientSetting/Dir", v);
241 return getStr(
"/ClientSetting/Dir", QDir::currentPath());
246 setInt(
"/ClientSetting/ExeMode", mode);
251 return getInt(
"/ClientSetting/ExeMode", 1);
257 else setStr(
"/ClientSetting/Lib", v);
263 return mode==0 ?
getStr(
"/ClientSetting/Exec",
"./MainUserAnalysis") :
getStr(
"/ClientSetting/Lib",
"libGo4UserAnalysis");
268 setStr(
"/ClientSetting/Args", v);
273 return getStr(
"/ClientSetting/Args",
"");
278 const char* name =
"exec";
280 case 0: name =
"exec";
break;
281 case 1: name =
"rsh";
break;
282 case 2: name =
"ssh";
break;
285 setStr(
"/ClientSetting/Shell", name);
290 return getStr(
"/ClientSetting/Shell",
"exec");
297 if(v.contains(
"exec")) shellmode = 0;
else
298 if(v.contains(
"rsh")) shellmode = 1;
else
299 if(v.contains(
"ssh")) shellmode = 2;
308 case 1: res =
"qt";
break;
309 case 2: res =
"xterm";
break;
310 case 3: res =
"konsole";
break;
312 setStr(
"/ClientSetting/Term", res);
317 return getStr(
"/ClientSetting/Term",
"qt");
324 if(v.contains(
"qt")) termmode = 1;
else
325 if(v.contains(
"xterm")) termmode = 2;
else
326 if(v.contains(
"konsole")) termmode = 3;
333 if (kind==1) v =
"true";
334 if (kind==2) v =
"http";
335 setStr(
"/ClientSetting/IsServer", v);
340 QString v =
getStr(
"/ClientSetting/IsServer",
"false");
341 if (v ==
"true")
return 1;
342 if (v ==
"http")
return 2;
348 setInt(
"/ClientSetting/ClientPort", nport);
353 return getInt(
"/ClientSetting/ClientPort", 5000);
358 setInt(
"/ClientSetting/Controller", mode);
363 return getInt(
"/ClientSetting/Controller", 0);
368 setBool(
"/ClientSetting/DefaultPass", on);
373 return getBool(
"/ClientSetting/DefaultPass",
true);
378 setInt(
"/ClientSetting/Connection", mode);
383 return getInt(
"/ClientSetting/Connection", 0);
388 return getStr(
"/ClientSetting/Account",
"observer");
393 setStr(
"/ClientSetting/Account", v);
400 setInt(
"/AnalisysTerminal/HistorySize", sz);
405 return getInt(
"/AnalisysTerminal/HistorySize", 100000);
410 setStr(
"/HistogramClient/server", v);
415 return getStr(
"/HistogramClient/server",
"");
420 setStr(
"/HistogramClient/base", v);
425 return getStr(
"/HistogramClient/base",
"");
430 setStr(
"/HistogramClient/filter", v);
435 return getStr(
"/HistogramClient/filter",
"*");
440 setInt(
"/HistogramClient/port", port);
445 return getInt(
"/HistogramClient/port", 6009);
451 setBool(
"/geometry/Crosshairmode", on);
456 return getBool(
"/geometry/Crosshairmode",
false);
461 setBool(
"/geometry/Superimpose", on);
466 return getBool(
"/geometry/Superimpose",
false);
471 setBool(
"/geometry/Eventstatusmode", on);
476 return getBool(
"/geometry/Eventstatusmode",
false);
481 setInt(
"/ViewPanel/BackRed", red );
482 setInt(
"/ViewPanel/BackGrn", green);
483 setInt(
"/ViewPanel/BackBlu", blue );
488 red =
getInt(
"/ViewPanel/BackRed", 220);
489 green =
getInt(
"/ViewPanel/BackGrn", 220);
490 blue =
getInt(
"/ViewPanel/BackBlu", 220);
496 setInt(
"/ViewPanel/PaletteMin", min);
497 setInt(
"/ViewPanel/PaletteDef", def);
498 setInt(
"/ViewPanel/PaletteMax", max);
503 min =
getInt(
"/ViewPanel/PaletteMin", 0);
504 def =
getInt(
"/ViewPanel/PaletteDef", 1);
505 max =
getInt(
"/ViewPanel/PaletteMax", 56);
506 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,5,0)
507 if (max==56) max = 112;
514 setBool(
"/ViewPanel/CloneFlag", on);
519 return getBool(
"/ViewPanel/CloneFlag",
true);
524 setBool(
"/ViewPanel/DrawOnce", on);
529 return getBool(
"/ViewPanel/DrawOnce",
false);
534 setBool(
"/ViewPanel/DrawTime", on);
539 return getBool(
"/ViewPanel/DrawTime",
true);
544 setBool(
"/ViewPanel/DrawDate", on);
549 return getBool(
"/ViewPanel/DrawDate");
554 setBool(
"/ViewPanel/DrawItem", on);
559 return getBool(
"/ViewPanel/DrawItem");
564 setInt(
"/ViewPanel/DrawLineWidth", w);
569 return getInt(
"/ViewPanel/DrawLineWidth", 1);
574 setInt(
"/ViewPanel/DrawFillColor", col);
579 return getInt(
"/ViewPanel/DrawFillColor", 0);
584 setInt(
"/ViewPanel/DrawFillStyle", style);
588 return getInt(
"/ViewPanel/DrawFillStyle", 1001);
595 setStr(
"/ViewPanel/TH1DrawOpt", v);
600 return getStr(
"/ViewPanel/TH1DrawOpt",
"hist");
605 setStr(
"/ViewPanel/TH2DrawOpt", v);
610 return getStr(
"/ViewPanel/TH2DrawOpt",
"col");
615 setStr(
"/ViewPanel/TH3DrawOpt", v);
620 return getStr(
"/ViewPanel/TH3DrawOpt",
"hist");
625 setStr(
"/ViewPanel/TGraphDrawOpt", v);
630 return getStr(
"/ViewPanel/TGraphDrawOpt",
"al");
635 setStr(
"/ViewPanel/GStyleStatFormat", v);
641 return getStr(
"/ViewPanel/GStyleStatFormat",
"");
653 sett->setValue(
"/MainWindow/State", src->saveState());
655 sett->setValue(
"/MainWindow/Geometry", src->saveGeometry());
660 setInt(QString(
"/") + kind + QString(
"/Width"), w->width() );
661 setInt(QString(
"/") + kind + QString(
"/Height"), w->height() );
666 QSize rect(
getInt(QString(
"/") + kind + QString(
"/Width"), dfltwidth),
667 getInt(QString(
"/") + kind + QString(
"/Height"), dfltheight));
680 setInt( QString(
"/Browser/") + name, width);
685 return getInt( QString(
"/Browser/") + name, defwidth);
691 setInt(
"/HistStatsBox/OptStats", value);
696 return getInt(
"/HistStatsBox/OptStats", 11111111);
701 setInt(
"/HistStatsBox/OptStatsW", value);
706 return getInt(
"/HistStatsBox/OptStatsW", 0);
711 setInt(
"/HistStatsBox/OptStatsH", value);
716 return getInt(
"/HistStatsBox/OptStatsH", 0);
721 setBool(
"/HistStatsBox/Visible", on);
726 return getBool(
"/HistStatsBox/Visible",
true);
731 setBool(
"/HistStatsBox/Errors", on);
736 return getBool(
"/HistStatsBox/Errors",
false);
741 setStr(
"/NewHist/Name", value);
746 return getStr(
"/NewHist/Name",
"histo1");
751 setStr(
"/NewHist/Title", value);
756 return getStr(
"/NewHist/Title",
"histogram title");
761 setInt(
"/NewHist/HType", value);
766 return getInt(
"/NewHist/HType", 14);
771 QString sname =
"/NewHist/Axis";
773 case 0: sname+=
"X_";
break;
774 case 1: sname+=
"Y_";
break;
775 case 2: sname+=
"Z_";
break;
776 default: sname+=
"X_";
break;
778 setInt(sname+
"NPoints", npoints);
785 QString sname =
"/NewHist/Axis";
787 case 0: sname+=
"X_";
break;
788 case 1: sname+=
"Y_";
break;
789 case 2: sname+=
"Z_";
break;
790 default: sname+=
"X_";
break;
792 npoints =
getInt(sname+
"NPoints", 100);
799 setBool(
"/preferences/FetchWhenDraw", on);
804 return getBool(
"/preferences/FetchWhenDraw",
true);
809 setBool(
"/preferences/FetchWhenCopy", on);
814 return getBool(
"/preferences/FetchWhenCopy",
false);
819 setBool(
"/preferences/FetchWhenSave", on);
824 return getBool(
"/preferences/FetchWhenSave",
false);
829 setBool(
"/preferences/HideEventElement", on);
834 return getBool(
"/preferences/HideEventElement",
false);
840 setBool(
"/preferences/MoveSubwindowRubberBand", on);
845 return getBool(
"/preferences/MoveSubwindowRubberBand",
true);
851 setStr(
"/OpenRemoteFile/Host", hostname);
852 setStr(
"/OpenRemoteFile/File", filename);
853 setStr(
"/OpenRemoteFile/Type", protocol);
858 hostname =
getStr(
"/OpenRemoteFile/Host",
"machine.gsi.de");
859 filename =
getStr(
"/OpenRemoteFile/File",
"tmp/hsimple.root");
860 protocol =
getStr(
"/OpenRemoteFile/Type",
"root:");
865 setStr(
"/Printer/Name", name);
866 setStr(
"/Printer/Prog", cmd);
871 name =
getStr(
"/Printer/Name", gSystem->Getenv(
"PRINTER"));
872 cmd =
getStr(
"/Printer/Prog",
"lpr");
877 setStr(
"/MbsMonitor/Node", name);
882 return getStr(
"/MbsMonitor/Node",
"r2-d2");
887 setInt(
"/MbsMonitor/Frequency", secs);
892 return getInt(
"/MbsMonitor/Frequency", 5);
897 setInt(
"/MbsMonitor/Bins", num);
902 return getInt(
"/MbsMonitor/Bins", 200);
907 setBool(
"/MbsMonitor/TrendOn", on);
912 return getBool(
"/MbsMonitor/TrendOn",
false);
917 setBool(
"/MbsMonitor/ShowMore", on);
922 return getBool(
"/MbsMonitor/ShowMore",
true);
927 setBool(
"/MbsMonitor/MonitorActive", on);
932 return getBool(
"/MbsMonitor/MonitorActive",
false);
937 setBool(
"/MbsMonitor/BackwardsTrending", on);
942 return getBool(
"/MbsMonitor/BackwardsTrending",
true);
947 setStr(
"/DabcMonitor/Node", name);
952 return getStr(
"/DabcMonitor/Node",
"dimDns.gsi.de");
957 setInt(
"/DabcMonitor/Frequency", secs);
962 return getInt(
"/DabcMonitor/Frequency", 5);
967 setInt(
"/DabcMonitor/Bins", num);
972 return getInt(
"/DabcMonitor/Bins", 200);
977 setBool(
"/DabcMonitor/BackwardsTrending", on);
982 return getBool(
"/DabcMonitor/BackwardsTrending",
true);
987 return sett->value(
"/CommandsHistoryGUI").toStringList();
992 sett->setValue(
"/CommandsHistoryGUI", commands);
997 return sett->value(
"/CommandsHistoryAnalysis").toStringList();
1002 sett->setValue(
"/CommandsHistoryAnalysis", commands);
1009 QString descriptor=QString(
"/AnalysisMacro%1/Command").arg(
id);
1011 return getStr(descriptor,
"");
1016 QString descriptor=QString(
"/AnalysisMacro%1/Tip").arg(
id);
1017 QString deftip=QString(
"Ctrl - %1").arg(
id+1);
1018 return getStr(descriptor, deftip);
1023 QString descriptor=QString(
"/AnalysisMacro%1/Automode").arg(
id);
1024 return getBool(descriptor,
false);
1029 QString descriptor=QString(
"/AnalysisMacro%1/Automode").arg(
id);
1036 QString descriptor=QString(
"/AnalysisMacro%1/Command").arg(
id);
1042 QString descriptor=QString(
"/AnalysisMacro%1/Tip").arg(
id);
1048 return getDouble(
"/Screen/ScaleFactor", 1.0);
1052 setDouble(
"/Screen/ScaleFactor", factor);
1057 return getBool(
"/ViewPanel/SavePadWhiteBackground" ,
false);
1064 setBool(
"/ViewPanel/SavePadWhiteBackground", on);
1069 return getBool(
"/AnalisysTerminal/ShowTimestamp",
false);
1074 setBool(
"/AnalisysTerminal/ShowTimestamp", on);
1079 return getStr(
"/AnalisysTerminal/TimeFormat",
"yyyy-MM-dd�hh mm:ss.zzz");
1084 setStr(
"/AnalisysTerminal/TimeFormat", form);
void setClientControllerMode(int)
void setDrawDateFlag(bool on=true)
QString GetSettLoaction()
static Bool_t fgbXRMSDRAW
void setScreenScaleFactor(double factor)
static Bool_t fgbHASCONNECTOR
bool getSavePadWhiteBackground()
void setDabcMonitorNode(const QString &name)
static Bool_t fgbYMAXDRAW
void setDouble(const QString &name, double value=0.)
QString getTGraphDrawOpt()
static Bool_t fgbLIMITSDRAW
void getRemoteFileSett(QString &hostname, QString &filename, QString &protocol)
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)
static Bool_t fgbCONTDRAW
void setStatBoxErrors(bool on=true)
void setClientArgs(const QString &)
void setTH1DrawOpt(const QString &value)
void setHideTGo4EventElement(bool on=true)
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)
void setPadEventStatus(bool on)
bool getFetchDataWhenCopy()
QString getTermTimeFormat()
static TGo4MdiArea * Instance()
void setDrawFillColor(int col)
void setPaletteOpt(int min, int def, int max)
static Bool_t fgbCMAXDRAW
void storePanelSize(QWidget *w, const QString &kind="ViewPanel")
void setHServFilter(const QString &)
static Bool_t fgbLABELDRAW
static TString fgxNUMFORMAT
void setOptStat(int value)
QString getClientExec(int mode=-1)
void setStr(const QString &name, const QString &value="")
void setDabcMonitorFreq(int secs)
void setClientName(const QString &)
static Bool_t fgbXMEANDRAW
static Bool_t fgbYBINDRAW
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)
void setSavePadWhiteBackground(bool on)
int getClientControllerMode()
void setClientShellMode(int)
void setTermHistorySize(int sz)
bool getBool(const QString &name, bool def=true)
void getHistAxisPars(int naxis, int &npoints, double &min, double &max)
void setBool(const QString &name, bool value=true)
void setFetchDataWhenDraw(bool on=true)
void setCloneFlag(bool on=true)
void setClientIsServer(int kind)
void setPadCrosshair(bool on)
bool getAnalysisMacroAutomode(int id)
void setBrowserColumn(const char *name, int width)
bool getMbsMonitorMonitorActive()
void setHServPort(int port)
bool getTermShowTimestamp()
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)
static Bool_t fgbYMEANDRAW
bool getMbsMonitorTrend()
int getClientConnectMode()
QString getAnalysisMacroCommand(int id)
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)
void setRemoteFileSett(const QString &hostname, const QString &filename, const QString &protocol)
void restoreMainWindowState(QMainWindow *tgt)
bool getFetchDataWhenDraw()
void setMoveSubwindowRubberBand(bool on=true)
bool getMbsMonitorBackwardsTrending()
static Bool_t fgbXMAXDRAW
void setClientExec(const QString &)
QString getMbsMonitorNode()
static Bool_t fgbXBINDRAW
static TString fgxNUMFORMAT
void setDrawTimeFlag(bool on=true)
const char * MainWindowDefaultGeometry
QSize lastPanelSize(const QString &kind="ViewPanel", int dfltwidth=450, int dfltheight=250)
static Bool_t fgbHASLABEL
void getPrinterSett(QString &name, QString &cmd)
void setTH2DrawOpt(const QString &value)
void setHServName(const QString &)
QStringList getCommandsHistoryGUI()
bool getClientDefaultPass()
void setClientNode(const QString &)
static Bool_t fgbYRMSDRAW
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()
const char * MainWindowDefaultState
void setMbsMonitorBackwardsTrending(bool on=true)
void setInt(const QString &name, int value=0)
void setClientConnectMode(int)
void setOptStatW(int value)
QString getAnalysisMacroTip(int id)
bool getHideTGo4EventElement()
void setHServBase(const QString &)
void setOptStatH(int value)
void setGStyleStatFormat(const QString &)
void setClientDefaultPass(bool)
void setMbsMonitorFreq(int secs)
void setTermTimeFormat(const QString &form)
void setMbsMonitorMore(bool on=true)
void setAppFont(const QFont &)
void setCommandsHistoryGUI(const QStringList &commands)
void setPadSuperimpose(bool on)
void setStatBoxVisible(bool on=true)
void setTGraphDrawOpt(const QString &value)
bool getDabcMonitorBackwardsTrending()