00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "TGo4QSettings.h"
00015
00016 #include <stdlib.h>
00017
00018 #include "Riostream.h"
00019 #include "TSystem.h"
00020
00021 #include "TGo4Marker.h"
00022 #include "TGo4Condition.h"
00023 #include "TGo4MdiArea.h"
00024
00025 #include <QtCore/QSettings>
00026 #include <QtCore/QFile>
00027 #include <QtCore/QDir>
00028 #include <QFont>
00029 #include <QApplication>
00030 #include <QMainWindow>
00031
00032
00033 const char* MainWindowDefaultState = "000000ff00000000fd00000002000000000000012500000198fc0200000001fb0000001600420072006f00770073006500720044006f0063006b0100000057000001980000007a00ffffff00000003000003d500000082fc0100000001fc00000000000003d50000007f00fffffffa000000000200000003fb00000016004c006f00670049006e0066006f0044006f0063006b0100000000ffffffff0000005300fffffffb0000001a004d006200730056006900650077006500720044006f0063006b0000000000ffffffff0000006500fffffffb0000001e0044004100420043004d006f006e00690074006f00720044006f0063006b0000000279000000ce0000000000000000000002aa0000019800000004000000040000000800000008fc0000000800000002000000040000001600460069006c00650054006f006f006c0042006100720100000000ffffffff0000000000000000000000160047006f00340054006f006f006c007300420061007201000000c8ffffffff00000000000000000000001e0041006e0061006c00790073006900730054006f006f006c004200610072010000020c0000025800000000000000000000001a0044006900760069006400650050006100640044006f0063006b0000000395000000e40000000000000000000000020000000000000002000000020000002400420072006f0077007300650072004f007000740069006f006e00730044006f0063006b01000000000000010200000000000000000000001e0044007200610077004f007000740069006f006e00730044006f0063006b01000001020000037e00000000000000000000000200000002000000240048006900730044007200610077004f007000740069006f006e00730044006f0063006b0000000000000001290000000000000000000000180047006f0034005300740079006c00650044006f0063006b0000000000000004b10000000000000000000000020000000100000020005300630061006c0065004f007000740069006f006e00730044006f0063006b0000000000000004b10000000000000000000000030000000000000003000000010000001e0043006f006d006d0061006e0064004c0069006e00650044006f0063006b0000000000000004b1000000000000000000000003000000010000001c00540072006500650056006900650077006500720044006f0063006b0000000000000004b10000000000000000";
00034
00035 const char* MainWindowDefaultGeometry = "01d9d0cb00010000000000140000000c000003f0000002ba0000001800000029000003ec000002b6000000000000";
00036
00037 TGo4QSettings* go4sett = 0;
00038
00039 TGo4QSettings::TGo4QSettings(const QString& filename)
00040 {
00041 fSettFileName = filename;
00042
00043 Open();
00044 }
00045
00046 TGo4QSettings::~TGo4QSettings()
00047 {
00048
00049
00050 }
00051
00052 QString TGo4QSettings::GetSettLoaction()
00053 {
00054 if (fSettFileName.length() > 0) return fSettFileName;
00055 #ifdef WIN32
00056 return QString("Registry (default)");
00057 #endif
00058
00059 return QDir::homePath() + "/.config/GSI/go4.conf (default)";
00060 }
00061
00062
00063 void TGo4QSettings::Open()
00064 {
00065 if (fSettFileName.length()>0)
00066 sett = new QSettings(fSettFileName, QSettings::NativeFormat);
00067 else
00068 sett = new QSettings("GSI","go4");
00069 }
00070
00071 void TGo4QSettings::Store()
00072 {
00073 delete sett;
00074 Open();
00075 }
00076
00077 void TGo4QSettings::setBool(const QString& name, bool value)
00078 {
00079 sett->setValue(name, QString(value ? "true" : "false"));
00080 }
00081
00082 bool TGo4QSettings::getBool(const QString& name, bool def)
00083 {
00084 return sett->value(name, QString(def ? "true" : "false")).toString() == QString("true");
00085 }
00086
00087 void TGo4QSettings::setInt(const QString& name, int value)
00088 {
00089 sett->setValue(name, value);
00090 }
00091
00092 int TGo4QSettings::getInt(const QString& name, int def)
00093 {
00094 return sett->value(name, def).toInt();
00095 }
00096
00097 void TGo4QSettings::setStr(const QString& name, const QString& value)
00098 {
00099 sett->setValue(name, value);
00100 }
00101
00102 QString TGo4QSettings::getStr(const QString& name, const QString& def)
00103 {
00104 return sett->value(name, def).toString();
00105 }
00106
00107 void TGo4QSettings::setDouble(const QString& name, double value)
00108 {
00109 sett->setValue(name, value);
00110 }
00111
00112 double TGo4QSettings::getDouble(const QString& name, double def)
00113 {
00114 return sett->value(name, def).toDouble();
00115 }
00116
00117
00118
00119 void TGo4QSettings::setBasicSettings()
00120 {
00121
00122
00123 setBool("/markers/Markerlabel", TGo4Marker::fgbHASLABEL);
00124 setBool("/markers/Connectorline", TGo4Marker::fgbHASCONNECTOR);
00125 setBool("/markers/ShowX", TGo4Marker::fgbXDRAW);
00126 setBool("/markers/ShowY", TGo4Marker::fgbYDRAW);
00127 setBool("/markers/ShowXbin", TGo4Marker::fgbXBINDRAW);
00128 setBool("/markers/ShowYbin", TGo4Marker::fgbYBINDRAW);
00129 setBool("/markers/ShowBinContent", TGo4Marker::fgbCONTDRAW);
00130 setStr("/markers/LabelNumberFormat", TGo4Marker::fgxNUMFORMAT.Data());
00131
00132 setBool("/conditions/Conditionlabel", TGo4Condition::fgbLABELDRAW);
00133 setBool("/conditions/ShowLimits", TGo4Condition::fgbLIMITSDRAW);
00134 setBool("/conditions/ShowIntegral", TGo4Condition::fgbINTDRAW);
00135 setBool("/conditions/ShowXmean", TGo4Condition::fgbXMEANDRAW);
00136 setBool("/conditions/ShowYmean", TGo4Condition::fgbYMEANDRAW);
00137 setBool("/conditions/ShowXrms", TGo4Condition::fgbXRMSDRAW);
00138 setBool("/conditions/ShowYrms", TGo4Condition::fgbYRMSDRAW);
00139 setBool("/conditions/ShowXmax", TGo4Condition::fgbXMAXDRAW);
00140 setBool("/conditions/ShowYmax", TGo4Condition::fgbYMAXDRAW);
00141 setBool("/conditions/ShowCmax", TGo4Condition::fgbCMAXDRAW);
00142 setStr("/conditions/LabelNumberFormat", TGo4Condition::fgxNUMFORMAT.Data());
00143
00144 }
00145
00146 void TGo4QSettings::getBasicSettings()
00147 {
00148
00149
00150
00151
00152
00153
00154
00155 TGo4Marker::fgbHASLABEL = getBool("/markers/Markerlabel", 1);
00156 TGo4Marker::fgbHASCONNECTOR = getBool("/markers/Connectorline", 1);;
00157 TGo4Marker::fgbXDRAW = getBool("/markers/ShowX", 1);
00158 TGo4Marker::fgbYDRAW = getBool("/markers/ShowY", 0);
00159 TGo4Marker::fgbXBINDRAW = getBool("/markers/ShowXbin", 0);
00160 TGo4Marker::fgbYBINDRAW = getBool("/markers/ShowYbin", 0);
00161 TGo4Marker::fgbCONTDRAW = getBool("/markers/ShowBinContent", 1);
00162 TGo4Marker::fgxNUMFORMAT = getStr("/markers/LabelNumberFormat", "%.4E").toLatin1().data();
00163
00164 TGo4Condition::fgbLABELDRAW = getBool("/conditions/Conditionlabel", 1);
00165 TGo4Condition::fgbLIMITSDRAW= getBool("/conditions/ShowLimits", 1);
00166 TGo4Condition::fgbINTDRAW = getBool("/conditions/ShowIntegral", 1);
00167 TGo4Condition::fgbXMEANDRAW = getBool("/conditions/ShowXmean", 1);
00168 TGo4Condition::fgbYMEANDRAW = getBool("/conditions/ShowYmean", 0);
00169 TGo4Condition::fgbXRMSDRAW = getBool("/conditions/ShowXrms", 1);
00170 TGo4Condition::fgbYRMSDRAW = getBool("/conditions/ShowYrms", 0);
00171 TGo4Condition::fgbXMAXDRAW = getBool("/conditions/ShowXmax", 1);
00172 TGo4Condition::fgbYMAXDRAW = getBool("/conditions/ShowYmax", 0);
00173 TGo4Condition::fgbCMAXDRAW = getBool("/conditions/ShowCmax", 1);
00174 TGo4Condition::fgxNUMFORMAT = getStr("/conditions/LabelNumberFormat", "%.4E").toLatin1().data();
00175 }
00176
00177
00178 void TGo4QSettings::setAppFont(const QFont& font)
00179 {
00180 setStr("/Font", font.toString());
00181 }
00182
00183 void TGo4QSettings::getAppFont()
00184 {
00185 QFont font;
00186 font.fromString(getStr("/Font", "Arial,11,-1,5,50,0,0,0,0,0"));
00187 QApplication::setFont(font);
00188 }
00189
00190 void TGo4QSettings::setTermFont(const QFont& font)
00191 {
00192 setStr("/TermFont", font.toString());
00193
00194 }
00195 QFont TGo4QSettings::getTermFont()
00196 {
00197 QFont font;
00198
00199 font.fromString(getStr("/TermFont", ""));
00200 return font;
00201 }
00202
00203 void TGo4QSettings::setAppStyle(const QString& v)
00204 {
00205 setStr("/Style/AppStyle", v);
00206 }
00207
00208 QString TGo4QSettings::getAppStyle()
00209 {
00210 return getStr("/Style/AppStyle", "windows");
00211 }
00212
00213 void TGo4QSettings::setClientName(const QString& v)
00214 {
00215 setStr("/ClientSetting/Name", v);
00216 }
00217
00218 QString TGo4QSettings::getClientName()
00219 {
00220 return getStr("/ClientSetting/Name", "MyAnalysis");
00221 }
00222
00223 void TGo4QSettings::setClientNode(const QString& v)
00224 {
00225 setStr( "/ClientSetting/Node", v);
00226 }
00227
00228 QString TGo4QSettings::getClientNode()
00229 {
00230 return getStr("/ClientSetting/Node", "localhost");
00231 }
00232
00233 void TGo4QSettings::setClientDir(const QString& v)
00234 {
00235 setStr("/ClientSetting/Dir", v);
00236 }
00237
00238 QString TGo4QSettings::getClientDir()
00239 {
00240 return getStr("/ClientSetting/Dir", QDir::currentPath());
00241 }
00242
00243 void TGo4QSettings::setClientExeMode(int mode)
00244 {
00245 setInt("/ClientSetting/ExeMode", mode);
00246 }
00247
00248 int TGo4QSettings::getClientExeMode()
00249 {
00250 return getInt("/ClientSetting/ExeMode", 1);
00251 }
00252
00253 void TGo4QSettings::setClientExec(const QString& v)
00254 {
00255 if (getClientExeMode()==0) setStr("/ClientSetting/Exec", v);
00256 else setStr("/ClientSetting/Lib", v);
00257 }
00258
00259 QString TGo4QSettings::getClientExec(int mode)
00260 {
00261 if (mode<0) mode = getClientExeMode();
00262 return mode==0 ? getStr("/ClientSetting/Exec", "./MainUserAnalysis") : getStr("/ClientSetting/Lib", "libGo4UserAnalysis");
00263 }
00264
00265 void TGo4QSettings::setClientArgs(const QString& v)
00266 {
00267 setStr("/ClientSetting/Args", v);
00268 }
00269
00270 QString TGo4QSettings::getClientArgs()
00271 {
00272 return getStr("/ClientSetting/Args", "");
00273 }
00274
00275 void TGo4QSettings::setClientShellMode(int v)
00276 {
00277 const char* name = "exec";
00278 switch (v) {
00279 case 0: name = "exec"; break;
00280 case 1: name = "rsh"; break;
00281 case 2: name = "ssh"; break;
00282 }
00283
00284 setStr( "/ClientSetting/Shell", name);
00285 }
00286
00287 QString TGo4QSettings::getClientShell()
00288 {
00289 return getStr("/ClientSetting/Shell", "exec");
00290 }
00291
00292 int TGo4QSettings::getClientShellMode()
00293 {
00294 QString v = getClientShell();
00295 int shellmode = 2;
00296 if(v.contains("exec")) shellmode = 0; else
00297 if(v.contains("rsh")) shellmode = 1; else
00298 if(v.contains("ssh")) shellmode = 2;
00299 return shellmode;
00300 }
00301
00302
00303 void TGo4QSettings::setClientTermMode(int v)
00304 {
00305 QString res = "qt";
00306 switch(v) {
00307 case 1: res = "qt"; break;
00308 case 2: res = "xterm"; break;
00309 case 3: res = "konsole"; break;
00310 }
00311 setStr( "/ClientSetting/Term", res);
00312 }
00313
00314 QString TGo4QSettings::getClientTerm()
00315 {
00316 return getStr("/ClientSetting/Term", "qt");
00317 }
00318
00319 int TGo4QSettings::getClientTermMode()
00320 {
00321 QString v = getClientTerm();
00322 int termmode = 1;
00323 if(v.contains("qt")) termmode = 1; else
00324 if(v.contains("xterm")) termmode = 2; else
00325 if(v.contains("konsole")) termmode = 3;
00326 return termmode;
00327 }
00328
00329 void TGo4QSettings::setClientIsServer(bool on)
00330 {
00331 setBool("/ClientSetting/IsServer", on);
00332 }
00333
00334 bool TGo4QSettings::getClientIsServer()
00335 {
00336 return getBool("/ClientSetting/IsServer", false);
00337 }
00338
00339 void TGo4QSettings::setClientPort(int nport)
00340 {
00341 setInt( "/ClientSetting/ClientPort", nport);
00342 }
00343
00344 int TGo4QSettings::getClientPort()
00345 {
00346 return getInt( "/ClientSetting/ClientPort", 5000);
00347 }
00348
00349 void TGo4QSettings::setClientControllerMode(int mode)
00350 {
00351 setInt( "/ClientSetting/Controller", mode);
00352 }
00353
00354 int TGo4QSettings::getClientControllerMode()
00355 {
00356 return getInt( "/ClientSetting/Controller", 0);
00357 }
00358
00359 void TGo4QSettings::setClientDefaultPass(bool on)
00360 {
00361 setBool( "/ClientSetting/DefaultPass", on);
00362 }
00363
00364 bool TGo4QSettings::getClientDefaultPass()
00365 {
00366 return getBool( "/ClientSetting/DefaultPass", true);
00367 }
00368
00369 void TGo4QSettings::setTermHistorySize(int sz)
00370 {
00371 setInt( "/AnalisysTerminal/HistorySize", sz);
00372 }
00373
00374 int TGo4QSettings::getTermHistorySize()
00375 {
00376 return getInt( "/AnalisysTerminal/HistorySize", 100000);
00377 }
00378
00379 void TGo4QSettings::setHServName(const QString& v)
00380 {
00381 setStr( "/HistogramClient/server", v);
00382 }
00383
00384 QString TGo4QSettings::getHServName()
00385 {
00386 return getStr( "/HistogramClient/server", "");
00387 }
00388
00389 void TGo4QSettings::setHServBase(const QString& v)
00390 {
00391 setStr( "/HistogramClient/base", v);
00392 }
00393
00394 QString TGo4QSettings::getHServBase()
00395 {
00396 return getStr( "/HistogramClient/base", "");
00397 }
00398
00399 void TGo4QSettings::setHServFilter(const QString& v)
00400 {
00401 setStr( "/HistogramClient/filter", v);
00402 }
00403
00404 QString TGo4QSettings::getHServFilter()
00405 {
00406 return getStr( "/HistogramClient/filter", "*");
00407 }
00408
00409 void TGo4QSettings::setHServPort(int port)
00410 {
00411 setInt( "/HistogramClient/port", port);
00412 }
00413
00414 int TGo4QSettings::getHServPort()
00415 {
00416 return getInt( "/HistogramClient/port", 6009);
00417 }
00418
00419
00420 void TGo4QSettings::setPadCrosshair(bool on)
00421 {
00422 setBool( "/geometry/Crosshairmode", on);
00423 }
00424
00425 bool TGo4QSettings::getPadCrosshair()
00426 {
00427 return getBool( "/geometry/Crosshairmode", false);
00428 }
00429
00430 void TGo4QSettings::setPadEventStatus(bool on)
00431 {
00432 setBool( "/geometry/Eventstatusmode", on);
00433 }
00434
00435 bool TGo4QSettings::getPadEventStatus()
00436 {
00437 return getBool("/geometry/Eventstatusmode", false);
00438 }
00439
00440 void TGo4QSettings::setCanvasColor(int red, int green, int blue)
00441 {
00442 setInt( "/ViewPanel/BackRed", red );
00443 setInt( "/ViewPanel/BackGrn", green);
00444 setInt( "/ViewPanel/BackBlu", blue );
00445 }
00446
00447 void TGo4QSettings::getCanvasColor(int& red, int& green, int& blue)
00448 {
00449 red = getInt( "/ViewPanel/BackRed", 220);
00450 green = getInt( "/ViewPanel/BackGrn", 220);
00451 blue = getInt( "/ViewPanel/BackBlu", 220);
00452 }
00453
00454 void TGo4QSettings::setCloneFlag(bool on)
00455 {
00456 setBool("/ViewPanel/CloneFlag", on);
00457 }
00458
00459 bool TGo4QSettings::getCloneFlag()
00460 {
00461 return getBool( "/ViewPanel/CloneFlag", true);
00462 }
00463
00464 void TGo4QSettings::setDrawOnceFlag(bool on)
00465 {
00466 setBool("/ViewPanel/DrawOnce", on);
00467 }
00468
00469 bool TGo4QSettings::getDrawOnceFlag()
00470 {
00471 return getBool("/ViewPanel/DrawOnce", false);
00472 }
00473
00474
00475 void TGo4QSettings::setDrawTimeFlag(bool on)
00476 {
00477 setBool("/ViewPanel/DrawTime", on);
00478 }
00479
00480 bool TGo4QSettings::getDrawTimeFlag()
00481 {
00482 return getBool("/ViewPanel/DrawTime", true);
00483 }
00484
00485 void TGo4QSettings::setDrawDateFlag(bool on)
00486 {
00487 setBool("/ViewPanel/DrawDate", on);
00488 }
00489
00490 bool TGo4QSettings::getDrawDateFlag()
00491 {
00492 return getBool("/ViewPanel/DrawDate");
00493 }
00494
00495 void TGo4QSettings::setDrawItemFlag(bool on)
00496 {
00497 setBool("/ViewPanel/DrawItem", on);
00498 }
00499
00500 bool TGo4QSettings::getDrawItemFlag()
00501 {
00502 return getBool("/ViewPanel/DrawItem");
00503 }
00504
00505 void TGo4QSettings::setTH1DrawOpt(const QString& v)
00506 {
00507 setStr("/ViewPanel/TH1DrawOpt", v);
00508 }
00509
00510 QString TGo4QSettings::getTH1DrawOpt()
00511 {
00512 return getStr("/ViewPanel/TH1DrawOpt", "hist");
00513 }
00514
00515 void TGo4QSettings::setTH2DrawOpt(const QString& v)
00516 {
00517 setStr("/ViewPanel/TH2DrawOpt", v);
00518 }
00519
00520 QString TGo4QSettings::getTH2DrawOpt()
00521 {
00522 return getStr("/ViewPanel/TH2DrawOpt", "col");
00523 }
00524
00525 void TGo4QSettings::setTH3DrawOpt(const QString& v)
00526 {
00527 setStr("/ViewPanel/TH3DrawOpt", v);
00528 }
00529
00530 QString TGo4QSettings::getTH3DrawOpt()
00531 {
00532 return getStr("/ViewPanel/TH3DrawOpt", "hist");
00533 }
00534
00535 void TGo4QSettings::setTGraphDrawOpt(const QString& v)
00536 {
00537 setStr("/ViewPanel/TGraphDrawOpt", v);
00538 }
00539
00540 QString TGo4QSettings::getTGraphDrawOpt()
00541 {
00542 return getStr("/ViewPanel/TGraphDrawOpt", "al");
00543 }
00544
00545 void TGo4QSettings::setGStyleStatFormat(const QString& v)
00546 {
00547 setStr("/ViewPanel/GStyleStatFormat", v);
00548
00549 }
00550
00551 QString TGo4QSettings::getGStyleStatFormat()
00552 {
00553 return getStr("/ViewPanel/GStyleStatFormat", "");
00554 }
00555
00556 void TGo4QSettings::restoreMainWindowState(QMainWindow* tgt)
00557 {
00558 tgt->restoreState(sett->value("/MainWindow/State", QByteArray::fromHex(MainWindowDefaultState)).toByteArray());
00559
00560 tgt->restoreGeometry(sett->value("/MainWindow/Geometry", QByteArray::fromHex(MainWindowDefaultGeometry)).toByteArray());
00561 }
00562
00563 void TGo4QSettings::storeMainWindowState(QMainWindow* src)
00564 {
00565
00566
00567
00568 sett->setValue("/MainWindow/State", src->saveState());
00569
00570 sett->setValue("/MainWindow/Geometry", src->saveGeometry());
00571 }
00572
00573 void TGo4QSettings::storePanelSize(QWidget* w, const QString& kind)
00574 {
00575 setInt(QString("/") + kind + QString("/Width"), w->width() );
00576 setInt(QString("/") + kind + QString("/Height"), w->height() );
00577 }
00578
00579 QSize TGo4QSettings::lastPanelSize(const QString& kind, int dfltwidth, int dfltheight)
00580 {
00581 QSize rect(getInt(QString("/") + kind + QString("/Width"), dfltwidth),
00582 getInt(QString("/") + kind + QString("/Height"), dfltheight));
00583
00584 if (rect.height() > TGo4MdiArea::Instance()->height()*4/5)
00585 rect.setHeight(TGo4MdiArea::Instance()->height()*4/5);
00586
00587 if (rect.width() > TGo4MdiArea::Instance()->width()*4/5)
00588 rect.setWidth(TGo4MdiArea::Instance()->width()*4/5);
00589
00590 return rect;
00591 }
00592
00593 void TGo4QSettings::setBrowserColumn(const char* name, int width)
00594 {
00595 setInt( QString("/Browser/") + name, width);
00596 }
00597
00598 int TGo4QSettings::getBrowserColumn(const char* name, int defwidth)
00599 {
00600 return getInt( QString("/Browser/") + name, defwidth);
00601 }
00602
00603
00604 void TGo4QSettings::setOptStat(int value)
00605 {
00606 setInt( "/HistStatsBox/OptStats", value);
00607 }
00608
00609 int TGo4QSettings::getOptStat()
00610 {
00611 return getInt( "/HistStatsBox/OptStats", 11111111);
00612 }
00613
00614 void TGo4QSettings::setOptStatW(int value)
00615 {
00616 setInt( "/HistStatsBox/OptStatsW", value);
00617 }
00618
00619 int TGo4QSettings::getOptStatW()
00620 {
00621 return getInt( "/HistStatsBox/OptStatsW", 0);
00622 }
00623
00624 void TGo4QSettings::setOptStatH(int value)
00625 {
00626 setInt( "/HistStatsBox/OptStatsH", value);
00627 }
00628
00629 int TGo4QSettings::getOptStatH()
00630 {
00631 return getInt( "/HistStatsBox/OptStatsH", 0);
00632 }
00633
00634 void TGo4QSettings::setStatBoxVisible(bool on)
00635 {
00636 setBool( "/HistStatsBox/Visible", on);
00637 }
00638
00639 bool TGo4QSettings::getStatBoxVisible()
00640 {
00641 return getBool( "/HistStatsBox/Visible", true);
00642 }
00643
00644 void TGo4QSettings::setStatBoxErrors(bool on)
00645 {
00646 setBool( "/HistStatsBox/Errors", on);
00647 }
00648
00649 bool TGo4QSettings::getStatBoxErrors()
00650 {
00651 return getBool( "/HistStatsBox/Errors", false);
00652 }
00653
00654 void TGo4QSettings::setHistName(const QString& value)
00655 {
00656 setStr("/NewHist/Name", value);
00657 }
00658
00659 QString TGo4QSettings::getHistName()
00660 {
00661 return getStr("/NewHist/Name", "histo1");
00662 }
00663
00664 void TGo4QSettings::setHistTitle(const QString& value)
00665 {
00666 setStr("/NewHist/Title", value);
00667 }
00668
00669 QString TGo4QSettings::getHistTitle()
00670 {
00671 return getStr("/NewHist/Title", "histogram title");
00672 }
00673
00674 void TGo4QSettings::setHistType(int value)
00675 {
00676 setInt( "/NewHist/HType", value);
00677 }
00678
00679 int TGo4QSettings::getHistType()
00680 {
00681 return getInt( "/NewHist/HType", 14);
00682 }
00683
00684 void TGo4QSettings::setHistAxisPars(int naxis, int npoints, double min, double max)
00685 {
00686 QString sname = "/NewHist/Axis";
00687 switch (naxis) {
00688 case 0: sname+="X_"; break;
00689 case 1: sname+="Y_"; break;
00690 case 2: sname+="Z_"; break;
00691 default: sname+="X_"; break;
00692 }
00693 setInt(sname+"NPoints", npoints);
00694 setDouble(sname+"Min", min);
00695 setDouble(sname+"Max", max);
00696 }
00697
00698 void TGo4QSettings::getHistAxisPars(int naxis, int& npoints, double& min, double& max)
00699 {
00700 QString sname = "/NewHist/Axis";
00701 switch (naxis) {
00702 case 0: sname+="X_"; break;
00703 case 1: sname+="Y_"; break;
00704 case 2: sname+="Z_"; break;
00705 default: sname+="X_"; break;
00706 }
00707 npoints = getInt(sname+"NPoints", 100);
00708 min = getDouble(sname+"Min", 0.);
00709 max = getDouble(sname+"Max", 100.);
00710 }
00711
00712 void TGo4QSettings::setFetchDataWhenDraw(bool on)
00713 {
00714 setBool("/preferences/FetchWhenDraw", on);
00715 }
00716
00717 bool TGo4QSettings::getFetchDataWhenDraw()
00718 {
00719 return getBool("/preferences/FetchWhenDraw", true);
00720 }
00721
00722 void TGo4QSettings::setFetchDataWhenCopy(bool on)
00723 {
00724 setBool("/preferences/FetchWhenCopy", on);
00725 }
00726
00727 bool TGo4QSettings::getFetchDataWhenCopy()
00728 {
00729 return getBool("/preferences/FetchWhenCopy", false);
00730 }
00731
00732 void TGo4QSettings::setFetchDataWhenSave(bool on)
00733 {
00734 setBool("/preferences/FetchWhenSave", on);
00735 }
00736
00737 bool TGo4QSettings::getFetchDataWhenSave()
00738 {
00739 return getBool("/preferences/FetchWhenSave", false);
00740 }
00741
00742 void TGo4QSettings::setHideTGo4EventElement(bool on)
00743 {
00744 setBool("/preferences/HideEventElement", on);
00745 }
00746
00747 bool TGo4QSettings::getHideTGo4EventElement()
00748 {
00749 return getBool("/preferences/HideEventElement", false);
00750 }
00751
00752 void TGo4QSettings::setRemoteFileSett(const QString& hostname, const QString& filename, const QString& protocol)
00753 {
00754 setStr( "/OpenRemoteFile/Host", hostname);
00755 setStr( "/OpenRemoteFile/File", filename);
00756 setStr( "/OpenRemoteFile/Type", protocol);
00757 }
00758
00759 void TGo4QSettings::getRemoteFileSett(QString& hostname, QString& filename, QString& protocol)
00760 {
00761 hostname = getStr( "/OpenRemoteFile/Host", "machine.gsi.de");
00762 filename = getStr( "/OpenRemoteFile/File", "tmp/hsimple.root");
00763 protocol = getStr( "/OpenRemoteFile/Type", "root:");
00764 }
00765
00766 void TGo4QSettings::setPrinterSett(const QString& name, const QString& cmd)
00767 {
00768 setStr( "/Printer/Name", name);
00769 setStr( "/Printer/Prog", cmd);
00770 }
00771
00772 void TGo4QSettings::getPrinterSett(QString& name, QString& cmd)
00773 {
00774 name = getStr( "/Printer/Name", gSystem->Getenv("PRINTER"));
00775 cmd = getStr( "/Printer/Prog","lpr");
00776 }
00777
00778 void TGo4QSettings::setMbsMonitorNode(const QString& name)
00779 {
00780 setStr( "/MbsMonitor/Node", name);
00781 }
00782
00783 QString TGo4QSettings::getMbsMonitorNode()
00784 {
00785 return getStr( "/MbsMonitor/Node", "r2-d2");
00786 }
00787
00788 void TGo4QSettings::setMbsMonitorFreq(int secs)
00789 {
00790 setInt( "/MbsMonitor/Frequency", secs);
00791 }
00792
00793 int TGo4QSettings::getMbsMonitorFreq()
00794 {
00795 return getInt( "/MbsMonitor/Frequency", 5);
00796 }
00797
00798 void TGo4QSettings::setMbsMonitorBins(int num)
00799 {
00800 setInt( "/MbsMonitor/Bins", num);
00801 }
00802
00803 int TGo4QSettings::getMbsMonitorBins()
00804 {
00805 return getInt( "/MbsMonitor/Bins", 200);
00806 }
00807
00808 void TGo4QSettings::setMbsMonitorTrend(bool on)
00809 {
00810 setBool( "/MbsMonitor/TrendOn", on);
00811 }
00812
00813 bool TGo4QSettings::getMbsMonitorTrend()
00814 {
00815 return getBool("/MbsMonitor/TrendOn", false);
00816 }
00817
00818 void TGo4QSettings::setMbsMonitorMore(bool on)
00819 {
00820 setBool("/MbsMonitor/ShowMore", on);
00821 }
00822
00823 bool TGo4QSettings::getMbsMonitorMore()
00824 {
00825 return getBool("/MbsMonitor/ShowMore", true);
00826 }
00827
00828 void TGo4QSettings::setMbsMonitorMonitorActive(bool on)
00829 {
00830 setBool("/MbsMonitor/MonitorActive", on);
00831 }
00832
00833 bool TGo4QSettings::getMbsMonitorMonitorActive()
00834 {
00835 return getBool("/MbsMonitor/MonitorActive", false);
00836 }
00837
00838 void TGo4QSettings::setMbsMonitorBackwardsTrending(bool on)
00839 {
00840 setBool("/MbsMonitor/BackwardsTrending", on);
00841 }
00842
00843 bool TGo4QSettings::getMbsMonitorBackwardsTrending()
00844 {
00845 return getBool("/MbsMonitor/BackwardsTrending", true);
00846 }
00847
00848 void TGo4QSettings::setDabcMonitorNode(const QString& name)
00849 {
00850 setStr( "/DabcMonitor/Node", name);
00851 }
00852
00853 QString TGo4QSettings::getDabcMonitorNode()
00854 {
00855 return getStr( "/DabcMonitor/Node", "dimDns.gsi.de");
00856 }
00857
00858 void TGo4QSettings::setDabcMonitorFreq(int secs)
00859 {
00860 setInt( "/DabcMonitor/Frequency", secs);
00861 }
00862
00863 int TGo4QSettings::getDabcMonitorFreq()
00864 {
00865 return getInt( "/DabcMonitor/Frequency", 5);
00866 }
00867
00868 void TGo4QSettings::setDabcMonitorBins(int num)
00869 {
00870 setInt( "/DabcMonitor/Bins", num);
00871 }
00872
00873 int TGo4QSettings::getDabcMonitorBins()
00874 {
00875 return getInt( "/DabcMonitor/Bins", 200);
00876 }
00877
00878 void TGo4QSettings::setDabcMonitorBackwardsTrending(bool on)
00879 {
00880 setBool("/DabcMonitor/BackwardsTrending", on);
00881 }
00882
00883 bool TGo4QSettings::getDabcMonitorBackwardsTrending()
00884 {
00885 return getBool("/DabcMonitor/BackwardsTrending", true);
00886 }
00887
00888 QStringList TGo4QSettings::getCommandsHistoryGUI()
00889 {
00890 return sett->value("/CommandsHistoryGUI").toStringList();
00891 }
00892
00893 void TGo4QSettings::setCommandsHistoryGUI(const QStringList & commands)
00894 {
00895 sett->setValue("/CommandsHistoryGUI", commands);
00896 }
00897
00898 QStringList TGo4QSettings::getCommandsHistoryAnalysis()
00899 {
00900 return sett->value("/CommandsHistoryAnalysis").toStringList();
00901 }
00902
00903 void TGo4QSettings::setCommandsHistoryAnalysis(const QStringList & commands)
00904 {
00905 sett->setValue("/CommandsHistoryAnalysis", commands);
00906 }