Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

TGo4QSettings.cpp

Go to the documentation of this file.
00001 //-------------------------------------------------------------
00002 //        Go4 Release Package v3.04-01 (build 30401)
00003 //                      28-November-2008
00004 //---------------------------------------------------------------
00005 //   The GSI Online Offline Object Oriented (Go4) Project
00006 //   Experiment Data Processing at EE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
00015 //----------------------------------------------------------------
00016 #include "TGo4QSettings.h"
00017 
00018 #include "Riostream.h"
00019 #include <stdlib.h>
00020 
00021 #include "qdir.h"
00022 #include "qfile.h"
00023 #include "qfont.h"
00024 #include "qapplication.h"
00025 #include "qmainwindow.h"
00026 
00027 #include "TGo4Marker.h"
00028 #include "TGo4Condition.h"
00029 
00030 const char* fxToolsfile = "/go4toolsrc";
00031 const char* fxSettingsfolder = "/.qt";
00032 
00033 bool TGo4QSettings::fgbUSEMYLOCATION = false;
00034 QString TGo4QSettings::fgxSETTINGSLOCATION = "";
00035 QString TGo4QSettings::fgxSETTINGSNAME = "/go4";
00036 QString TGo4QSettings::fgxHOMESETTINGSNAME = "/go4";
00037 
00038 TGo4QSettings* go4sett = 0;
00039 
00040 
00041 TGo4QSettings::TGo4QSettings() : QSettings()
00042 {
00043    SetSettingsPath();
00044 }
00045 
00046 TGo4QSettings::TGo4QSettings(Format format) : QSettings(format)
00047 {
00048    SetSettingsPath();
00049 }
00050 
00051 
00052 TGo4QSettings::~TGo4QSettings()
00053 {
00054 }
00055 
00056 void TGo4QSettings::SetToCurrentDir(bool on)
00057 {
00058    fgbUSEMYLOCATION=on;
00059    if(on) {
00060       fgxSETTINGSLOCATION = QDir::currentDirPath()+ "/.go4";
00061       fgxSETTINGSNAME = fgxHOMESETTINGSNAME+"local";
00062    } else
00063       fgxSETTINGSNAME = fgxHOMESETTINGSNAME;
00064 }
00065 
00066 
00067 void TGo4QSettings::DumpSettingsLocation()
00068 {
00069    if(fgbUSEMYLOCATION)
00070       cout <<"Using Qt Settings at "<<fgxSETTINGSLOCATION+fgxSETTINGSNAME+"rc" << endl;
00071    else
00072       cout <<"Using Qt Settings at "<<QDir::homeDirPath()+ "/.qt"+fgxSETTINGSNAME+"rc"<<endl;
00073 }
00074 
00075 void TGo4QSettings::SetSettingsPath()
00076 {
00077    if(fgbUSEMYLOCATION)
00078       insertSearchPath( QSettings::Unix, fgxSETTINGSLOCATION);
00079 }
00080 
00081 
00082 
00083 // set of Go4 specific functions
00084 
00085 void TGo4QSettings::setBasicSettings()
00086 {
00087    writeEntry(GetSettingsName()+"/Font", QApplication::font().toString() );
00088 
00089    writeEntry(GetSettingsName()+"/markers/Markerlabel", (int) TGo4Marker::fgbHASLABEL);
00090    writeEntry(GetSettingsName()+"/markers/Connectorline", (int) TGo4Marker::fgbHASCONNECTOR);
00091    writeEntry(GetSettingsName()+"/markers/ShowX", (int) TGo4Marker::fgbXDRAW);
00092    writeEntry(GetSettingsName()+"/markers/ShowY", (int) TGo4Marker::fgbYDRAW);
00093    writeEntry(GetSettingsName()+"/markers/ShowXbin", (int) TGo4Marker::fgbXBINDRAW);
00094    writeEntry(GetSettingsName()+"/markers/ShowYbin", (int)TGo4Marker::fgbYBINDRAW);
00095    writeEntry(GetSettingsName()+"/markers/ShowBinContent", (int) TGo4Marker::fgbCONTDRAW);
00096 
00097    writeEntry(GetSettingsName()+"/conditions/Conditionlabel", (int) TGo4Condition::fgbLABELDRAW);
00098    writeEntry(GetSettingsName()+"/conditions/ShowLimits", (int) TGo4Condition::fgbLIMITSDRAW);
00099    writeEntry(GetSettingsName()+"/conditions/ShowIntegral", (int) TGo4Condition::fgbINTDRAW);
00100    writeEntry(GetSettingsName()+"/conditions/ShowXmean", (int) TGo4Condition::fgbXMEANDRAW);
00101    writeEntry(GetSettingsName()+"/conditions/ShowYmean", (int) TGo4Condition::fgbYMEANDRAW);
00102    writeEntry(GetSettingsName()+"/conditions/ShowXrms", (int) TGo4Condition::fgbXRMSDRAW);
00103    writeEntry(GetSettingsName()+"/conditions/ShowYrms", (int) TGo4Condition::fgbYRMSDRAW);
00104    writeEntry(GetSettingsName()+"/conditions/ShowXmax", (int) TGo4Condition::fgbXMAXDRAW);
00105    writeEntry(GetSettingsName()+"/conditions/ShowYmax", (int) TGo4Condition::fgbYMAXDRAW);
00106    writeEntry(GetSettingsName()+"/conditions/ShowCmax", (int) TGo4Condition::fgbCMAXDRAW);
00107 }
00108 
00109 void TGo4QSettings::getBasicSettings()
00110 {
00111 //   QString AppStyle = readEntry(GetSettingsName()+"/Style/AppStyle", "windows");
00112 //   MakeStyleSlot(AppStyle);
00113 
00114    QFont font;
00115    font.fromString(readEntry(GetSettingsName()+"/Font", "Arial,11,-1,5,50,0,0,0,0,0"));
00116    QApplication::setFont(font, true );
00117 
00118    TGo4Marker::fgbHASLABEL     = readNumEntry(GetSettingsName()+"/markers/Markerlabel", 1);
00119    TGo4Marker::fgbHASCONNECTOR = readNumEntry(GetSettingsName()+"/markers/Connectorline", 1);;
00120    TGo4Marker::fgbXDRAW        = readNumEntry(GetSettingsName()+"/markers/ShowX", 1);
00121    TGo4Marker::fgbYDRAW        = readNumEntry(GetSettingsName()+"/markers/ShowY", 0);
00122    TGo4Marker::fgbXBINDRAW     = readNumEntry(GetSettingsName()+"/markers/ShowXbin", 0);
00123    TGo4Marker::fgbYBINDRAW     = readNumEntry(GetSettingsName()+"/markers/ShowYbin", 0);
00124    TGo4Marker::fgbCONTDRAW     = readNumEntry(GetSettingsName()+"/markers/ShowBinContent", 1);
00125 
00126    TGo4Condition::fgbLABELDRAW = readNumEntry(GetSettingsName()+"/conditions/Conditionlabel", 1);
00127    TGo4Condition::fgbLIMITSDRAW= readNumEntry(GetSettingsName()+"/conditions/ShowLimits", 1);
00128    TGo4Condition::fgbINTDRAW   = readNumEntry(GetSettingsName()+"/conditions/ShowIntegral", 1);
00129    TGo4Condition::fgbXMEANDRAW = readNumEntry(GetSettingsName()+"/conditions/ShowXmean", 1);
00130    TGo4Condition::fgbYMEANDRAW = readNumEntry(GetSettingsName()+"/conditions/ShowYmean", 0);
00131    TGo4Condition::fgbXRMSDRAW  = readNumEntry(GetSettingsName()+"/conditions/ShowXrms", 1);
00132    TGo4Condition::fgbYRMSDRAW  = readNumEntry(GetSettingsName()+"/conditions/ShowYrms", 0);
00133    TGo4Condition::fgbXMAXDRAW  = readNumEntry(GetSettingsName()+"/conditions/ShowXmax", 1);
00134    TGo4Condition::fgbYMAXDRAW  = readNumEntry(GetSettingsName()+"/conditions/ShowYmax", 0);
00135    TGo4Condition::fgbCMAXDRAW  = readNumEntry(GetSettingsName()+"/conditions/ShowCmax", 1);
00136 }
00137 
00138 void TGo4QSettings::setAppStyle(const QString& v)
00139 {
00140    writeEntry(GetSettingsName()+"/Style/AppStyle", v);
00141 }
00142 
00143 QString TGo4QSettings::getAppStyle()
00144 {
00145    return readEntry(GetSettingsName()+"/Style/AppStyle", "windows");
00146 }
00147 
00148 void TGo4QSettings::setClientName(const QString& v)
00149 {
00150    writeEntry(GetSettingsName()+"/ClientSetting/Name", v);
00151 }
00152 
00153 QString TGo4QSettings::getClientName()
00154 {
00155    return readEntry(GetSettingsName()+"/ClientSetting/Name", "MyAnalysis");
00156 }
00157 
00158 void TGo4QSettings::setClientNode(const QString& v)
00159 {
00160    writeEntry( GetSettingsName()+"/ClientSetting/Node", v);
00161 }
00162 
00163 QString TGo4QSettings::getClientNode()
00164 {
00165    return readEntry(GetSettingsName()+"/ClientSetting/Node", "localhost");
00166 }
00167 
00168 void TGo4QSettings::setClientDir(const QString& v)
00169 {
00170    writeEntry( GetSettingsName()+"/ClientSetting/Dir", v);
00171 }
00172 
00173 QString TGo4QSettings::getClientDir()
00174 {
00175    return readEntry(GetSettingsName()+"/ClientSetting/Dir", QDir::currentDirPath());
00176 }
00177 
00178 void TGo4QSettings::setClientExec(const QString& v)
00179 {
00180    writeEntry( GetSettingsName()+"/ClientSetting/Exec", v);
00181 }
00182 
00183 QString TGo4QSettings::getClientExec()
00184 {
00185    return readEntry( GetSettingsName()+"/ClientSetting/Exec", "MainUserAnalysis");
00186 }
00187 
00188 void TGo4QSettings::setClientShellMode(int v)
00189 {
00190    QString res = "ssh";
00191    switch(v) {
00192       case 1: res = "rsh"; break;
00193       case 2: res = "ssh"; break;
00194    }
00195    writeEntry( GetSettingsName()+"/ClientSetting/Shell", res);
00196 }
00197 
00198 QString TGo4QSettings::getClientShell()
00199 {
00200    return readEntry( GetSettingsName()+"/ClientSetting/Shell", "ssh");
00201 }
00202 
00203 int TGo4QSettings::getClientShellMode()
00204 {
00205    QString v = getClientShell();
00206    int shellmode = 2;
00207    if(v.contains("rsh")) shellmode=1; else
00208    if(v.contains("ssh")) shellmode=2;
00209    return shellmode;
00210 }
00211 
00212 
00213 void TGo4QSettings::setClientTermMode(int v)
00214 {
00215    QString res = "qt";
00216    switch(v) {
00217       case 1: res = "qt"; break;
00218       case 2: res = "xterm"; break;
00219       case 3: res = "konsole"; break;
00220    }
00221    writeEntry( GetSettingsName()+"/ClientSetting/Term", res);
00222 }
00223 
00224 QString TGo4QSettings::getClientTerm()
00225 {
00226    return readEntry( GetSettingsName()+"/ClientSetting/Term", "qt");
00227 }
00228 
00229 int TGo4QSettings::getClientTermMode()
00230 {
00231    QString v = getClientTerm();
00232    int termmode = 1;
00233    if(v.contains("qt")) termmode = 1; else
00234    if(v.contains("xterm")) termmode = 2; else
00235    if(v.contains("konsole")) termmode = 3;
00236    return termmode;
00237 }
00238 
00239 void  TGo4QSettings::setClientIsServer(bool on)
00240 {
00241    writeEntry(GetSettingsName()+"/ClientSetting/IsServer", on ? "on" : "off");
00242 }
00243 
00244 bool TGo4QSettings::getClientIsServer()
00245 {
00246    QString value = readEntry(GetSettingsName()+"/ClientSetting/IsServer", "off");
00247    return  value == QString("on");
00248 }
00249 
00250 void TGo4QSettings::setClientPort(int nport)
00251 {
00252    writeEntry(GetSettingsName()+"/ClientSetting/ClientPort", nport);
00253 }
00254 
00255 int TGo4QSettings::getClientPort()
00256 {
00257    return readNumEntry(GetSettingsName()+"/ClientSetting/ClientPort", 5000);
00258 }
00259 
00260 void TGo4QSettings::setClientControllerMode(int mode)
00261 {
00262    writeEntry(GetSettingsName()+"/ClientSetting/Controller", mode);
00263 }
00264 
00265 int TGo4QSettings::getClientControllerMode()
00266 {
00267    return readNumEntry(GetSettingsName()+"/ClientSetting/Controller", 0);
00268 }
00269 
00270 void TGo4QSettings::setClientDefaultPass(bool on)
00271 {
00272    writeEntry(GetSettingsName()+"/ClientSetting/DefaultPass", on ? "on" : "off");
00273 }
00274 
00275 bool TGo4QSettings::getClientDefaultPass()
00276 {
00277    QString value = readEntry(GetSettingsName()+"/ClientSetting/DefaultPass", "on");
00278    return value == QString("on");
00279 }
00280 
00281 void TGo4QSettings::setTermHistorySize(int sz)
00282 {
00283    writeEntry(GetSettingsName()+"/AnalisysTerminal/HistorySize", sz);
00284 }
00285 
00286 int TGo4QSettings::getTermHistorySize()
00287 {
00288    return readNumEntry(GetSettingsName()+"/AnalisysTerminal/HistorySize", 100000);
00289 }
00290 
00291 void TGo4QSettings::setHServName(const QString& v)
00292 {
00293    writeEntry(GetSettingsName()+"/HistogramClient/server", v);
00294 }
00295 
00296 QString TGo4QSettings::getHServName()
00297 {
00298    return readEntry(GetSettingsName()+"/HistogramClient/server", "");
00299 }
00300 
00301 void TGo4QSettings::setHServBase(const QString& v)
00302 {
00303    writeEntry(GetSettingsName()+"/HistogramClient/base", v);
00304 }
00305 
00306 QString TGo4QSettings::getHServBase()
00307 {
00308    return readEntry(GetSettingsName()+"/HistogramClient/base", "");
00309 }
00310 
00311 void TGo4QSettings::setHServFilter(const QString& v)
00312 {
00313    writeEntry(GetSettingsName()+"/HistogramClient/filter", v);
00314 }
00315 
00316 QString TGo4QSettings::getHServFilter()
00317 {
00318    return readEntry(GetSettingsName()+"/HistogramClient/filter", "*");
00319 }
00320 
00321 void TGo4QSettings::setHServPort(int port)
00322 {
00323    writeEntry(GetSettingsName()+"/HistogramClient/port", port);
00324 }
00325 
00326 int TGo4QSettings::getHServPort()
00327 {
00328    return readNumEntry(GetSettingsName()+"/HistogramClient/port", 6009);
00329 }
00330 
00331 
00332 void TGo4QSettings::setPadCrosshair(bool on)
00333 {
00334    writeEntry( GetSettingsName()+"/geometry/Crosshairmode", on ? 1: 0);
00335 }
00336 
00337 bool TGo4QSettings::getPadCrosshair()
00338 {
00339    return readNumEntry( GetSettingsName()+"/geometry/Crosshairmode", 0) != 0;
00340 }
00341 
00342 void TGo4QSettings::setPadEventStatus(bool on)
00343 {
00344    writeEntry( GetSettingsName()+"/geometry/Eventstatusmode", on ? 1: 0);
00345 }
00346 
00347 bool TGo4QSettings::getPadEventStatus()
00348 {
00349    return readNumEntry( GetSettingsName()+"/geometry/Eventstatusmode", 0) != 0;
00350 }
00351 
00352 void TGo4QSettings::setCanvasColor(int red, int green, int blue)
00353 {
00354    writeEntry(GetSettingsName()+"/geometry/ViewPanelBackRed", red );
00355    writeEntry(GetSettingsName()+"/geometry/ViewPanelBackGrn", green);
00356    writeEntry(GetSettingsName()+"/geometry/ViewPanelBackBlu", blue );
00357 }
00358 
00359 void TGo4QSettings::getCanvasColor(int& red, int& green, int& blue)
00360 {
00361    red   = readNumEntry(GetSettingsName()+"/geometry/ViewPanelBackRed", 220);
00362    green = readNumEntry(GetSettingsName()+"/geometry/ViewPanelBackGrn", 220);
00363    blue  = readNumEntry(GetSettingsName()+"/geometry/ViewPanelBackBlu", 220);
00364 }
00365 
00366 void TGo4QSettings::setCloneFlag(bool on)
00367 {
00368    writeEntry( GetSettingsName()+"/geometry/CloneFlag", on ? 1: 0);
00369 }
00370 
00371 bool TGo4QSettings::getCloneFlag()
00372 {
00373    return readNumEntry( GetSettingsName()+"/geometry/CloneFlag", 1);
00374 }
00375 
00376 void TGo4QSettings::setDrawTimeFlag(bool on)
00377 {
00378    writeEntry( GetSettingsName()+"/geometry/DrawTime", on ? 1: 0);
00379 }
00380 
00381 bool TGo4QSettings::getDrawTimeFlag()
00382 {
00383    return readNumEntry( GetSettingsName()+"/geometry/DrawTime", 1);
00384 }
00385 
00386 void TGo4QSettings::setDrawDateFlag(bool on)
00387 {
00388    writeEntry( GetSettingsName()+"/geometry/DrawDate", on ? 1: 0);
00389 }
00390 
00391 bool TGo4QSettings::getDrawDateFlag()
00392 {
00393    return readNumEntry( GetSettingsName()+"/geometry/DrawDate", 0);
00394 }
00395 
00396 void TGo4QSettings::setDrawItemFlag(bool on)
00397 {
00398    writeEntry( GetSettingsName()+"/geometry/DrawItem", on ? 1: 0);
00399 }
00400 
00401 bool TGo4QSettings::getDrawItemFlag()
00402 {
00403    return readNumEntry( GetSettingsName()+"/geometry/DrawItem", 0);
00404 }
00405 
00406 QString TGo4QSettings::getSettingsFileName()
00407 {
00408    if(UsesUserPath())
00409       return GetUserPath() + fxToolsfile;
00410    else
00411       return QDir::homeDirPath() + fxSettingsfolder+ fxToolsfile;
00412 }
00413 
00414 void TGo4QSettings::RestoreSettings(QMainWindow* tgt)
00415 {
00416    QString fn = getSettingsFileName();
00417    QFile f( fn );
00418    if (f.open(IO_ReadOnly)) {
00419      QTextStream ts( &f );
00420      ts >> *tgt;
00421      f.close();
00422      cout <<"Loaded Go4 toolbar settings from "<<fn << endl;
00423    } else {
00424      QString fndefault = QString(getenv("GO4SYS")) + "/etc/go4defaulttoolsrc.txt";
00425      QFile fdefault( fndefault );
00426      if (fdefault.open( IO_ReadOnly )) {
00427        QTextStream ts( &fdefault );
00428        ts >> *tgt;
00429        fdefault.close();
00430        cout <<"Loaded Go4 toolbar settings from "<<fndefault << endl;
00431      } else
00432        cout <<"Could not load default toolbar settings from "<<fndefault << endl;
00433    }
00434 }
00435 
00436 void TGo4QSettings::StoreSettings(QMainWindow* src)
00437 {
00438    QString fn = getSettingsFileName();
00439    QFile f( fn );
00440    f.open( IO_WriteOnly );
00441    QTextStream ts( &f );
00442    ts << *src;
00443    f.close();
00444    cout <<"Saved Go4 toolbar settings to " << fn << endl;
00445 }
00446 
00447 void TGo4QSettings::storeGeometry(QMainWindow* w)
00448 {
00449    writeEntry(GetSettingsName()+"/geometry/MainWinWidth", w->width() );
00450    writeEntry(GetSettingsName()+"/geometry/MainWinHeight", w->height() );
00451    writeEntry(GetSettingsName()+"/geometry/MainWinX", w->x() );
00452    writeEntry(GetSettingsName()+"/geometry/MainWinY", w->y() );
00453 }
00454 
00455 void TGo4QSettings::restoreGeometry(QMainWindow* w)
00456 {
00457    int Width, Height, PosX, PosY;
00458    Width  = readNumEntry(GetSettingsName()+"/geometry/MainWinWidth", 997 );
00459    Height = readNumEntry(GetSettingsName()+"/geometry/MainWinHeight", 690 );
00460    PosX   = readNumEntry(GetSettingsName()+"/geometry/MainWinX", 129 );
00461    PosY   = readNumEntry(GetSettingsName()+"/geometry/MainWinY", 132 );
00462    w->resize( Width, Height );
00463    w->move( PosX, PosY );
00464 }
00465 
00466 void TGo4QSettings::storePanelSize(QWidget* w)
00467 {
00468    writeEntry(GetSettingsName()+"/geometry/ViewPanelWidth", w->width() );
00469    writeEntry(GetSettingsName()+"/geometry/ViewPanelHeight", w->height() );
00470 }
00471 
00472 void TGo4QSettings::restorePanelSize(QWidget* w)
00473 {
00474    QSize rect;
00475    rect.setWidth(readNumEntry(GetSettingsName()+"/geometry/ViewPanelWidth", 300));
00476    rect.setHeight(readNumEntry(GetSettingsName()+"/geometry/ViewPanelHeight", 300));
00477    w->resize(rect);
00478 }
00479 
00480 void TGo4QSettings::setBrowserColumn(const char* name, int width)
00481 {
00482    writeEntry(GetSettingsName()+"/Browser/" + name, width);
00483 }
00484 
00485 int TGo4QSettings::getBrowserColumn(const char* name, int defwidth)
00486 {
00487    return readNumEntry(GetSettingsName()+"/Browser/" + name, defwidth);
00488 }
00489 
00490 
00491 void TGo4QSettings::setOptStat(int value)
00492 {
00493    writeEntry(GetSettingsName()+"/HistStatsBox/OptStats", value);
00494 }
00495 
00496 int TGo4QSettings::getOptStat()
00497 {
00498    return readNumEntry(GetSettingsName()+"/HistStatsBox/OptStats", 11111111);
00499 }
00500 
00501 void TGo4QSettings::setStatBoxVisible(bool on)
00502 {
00503    writeEntry(GetSettingsName()+"/HistStatsBox/Visible", on ? 1: 0);
00504 }
00505 
00506 bool TGo4QSettings::getStatBoxVisible()
00507 {
00508    return readNumEntry(GetSettingsName()+"/HistStatsBox/Visible", 1);
00509 }
00510 
00511 void TGo4QSettings::setStatBoxErrors(bool on)
00512 {
00513    writeEntry(GetSettingsName()+"/HistStatsBox/Errors", on ? 1: 0);
00514 }
00515 
00516 bool TGo4QSettings::getStatBoxErrors()
00517 {
00518    return readNumEntry(GetSettingsName()+"/HistStatsBox/Errors", 0);
00519 }
00520 
00521 
00522 void  TGo4QSettings::setHistName(const QString& value)
00523 {
00524    writeEntry(GetSettingsName()+"/NewHist/Name", value);
00525 }
00526 
00527 QString TGo4QSettings::getHistName()
00528 {
00529    return readEntry(GetSettingsName()+"/NewHist/Name", "histo1");
00530 }
00531 
00532 void TGo4QSettings::setHistType(int value)
00533 {
00534    writeEntry(GetSettingsName()+"/NewHist/HType", value);
00535 }
00536 
00537 int TGo4QSettings::getHistType()
00538 {
00539    return readNumEntry(GetSettingsName()+"/NewHist/HType", 11);
00540 }
00541 
00542 
00543 
00544 
00545 void TGo4QSettings::setHistAxisPars(int naxis, int npoints, double min, double max)
00546 {
00547    QString sname = GetSettingsName()+"/NewHist/Axis";
00548    switch (naxis) {
00549       case 0: sname+="X_"; break;
00550       case 1: sname+="Y_"; break;
00551       case 2: sname+="Z_"; break;
00552       default: sname+="X_"; break;
00553    }
00554    writeEntry(sname+"NPoints", npoints);
00555    writeEntry(sname+"Min", min);
00556    writeEntry(sname+"Max", max);
00557 }
00558 
00559 void TGo4QSettings::getHistAxisPars(int naxis, int& npoints, double& min, double& max)
00560 {
00561    QString sname = GetSettingsName()+"/NewHist/Axis";
00562    switch (naxis) {
00563       case 0: sname+="X_"; break;
00564       case 1: sname+="Y_"; break;
00565       case 2: sname+="Z_"; break;
00566       default: sname+="X_"; break;
00567    }
00568    npoints = readDoubleEntry(sname+"NPoints", 100);
00569    min = readDoubleEntry(sname+"Min", 0.);
00570    max = readDoubleEntry(sname+"Max", 100.);
00571 }
00572 
00573 void TGo4QSettings::setFetchDataWhenDraw(bool on)
00574 {
00575    writeEntry( GetSettingsName()+"/preferences/FetchWhenDraw", on ? 1: 0);
00576 }
00577 
00578 bool TGo4QSettings::getFetchDataWhenDraw()
00579 {
00580    return readNumEntry( GetSettingsName()+"/preferences/FetchWhenDraw", 1) != 0;
00581 }
00582 
00583 void TGo4QSettings::setFetchDataWhenCopy(bool on)
00584 {
00585    writeEntry( GetSettingsName()+"/preferences/FetchWhenCopy", on ? 1: 0);
00586 }
00587 
00588 bool TGo4QSettings::getFetchDataWhenCopy()
00589 {
00590    return readNumEntry( GetSettingsName()+"/preferences/FetchWhenCopy", 0) != 0;
00591 }
00592 
00593 void TGo4QSettings::setFetchDataWhenSave(bool on)
00594 {
00595    writeEntry( GetSettingsName()+"/preferences/FetchWhenSave", on ? 1 : 0);
00596 }
00597 
00598 bool TGo4QSettings::getFetchDataWhenSave()
00599 {
00600    return readNumEntry( GetSettingsName()+"/preferences/FetchWhenSave", 0) != 0;
00601 }
00602 
00603 void TGo4QSettings::setRemoteFileSett(const QString& hostname, const QString& filename, const QString& protocol)
00604 {
00605    writeEntry(GetSettingsName()+"/OpenRemoteFile/Host", hostname);
00606    writeEntry(GetSettingsName()+"/OpenRemoteFile/File", filename);
00607    writeEntry(GetSettingsName()+"/OpenRemoteFile/Type", protocol);
00608 }
00609 
00610 void TGo4QSettings::getRemoteFileSett(QString& hostname, QString& filename, QString& protocol)
00611 {
00612    hostname = readEntry(GetSettingsName()+"/OpenRemoteFile/Host", "machine.gsi.de");
00613    filename = readEntry(GetSettingsName()+"/OpenRemoteFile/File", "tmp/hsimple.root");
00614    protocol = readEntry(GetSettingsName()+"/OpenRemoteFile/Type", "root:");
00615 }
00616 
00617 void TGo4QSettings::setPrinterSett(const QString& name, const QString& cmd)
00618 {
00619    writeEntry(GetSettingsName()+"/Printer", name);
00620    writeEntry(GetSettingsName()+"/PrintProg", cmd);
00621 }
00622 
00623 void TGo4QSettings::getPrinterSett(QString& name, QString& cmd)
00624 {
00625    name = readEntry(GetSettingsName()+"/Printer", getenv("PRINTER"));
00626    cmd  = readEntry(GetSettingsName()+"/PrintProg","lpr");
00627 }
00628 
00629 void    TGo4QSettings::setMbsMonitorNode(const QString& name)
00630 {
00631    writeEntry(GetSettingsName()+"/MbsMonitor/Node", name);
00632 }
00633 
00634 QString TGo4QSettings::getMbsMonitorNode()
00635 {
00636     return readEntry(GetSettingsName()+"/MbsMonitor/Node", "r2-d2");
00637 }
00638 
00639 void    TGo4QSettings::setMbsMonitorFreq(int secs)
00640 {
00641    writeEntry(GetSettingsName()+"/MbsMonitor/Frequency", secs);
00642 }
00643 
00644 int     TGo4QSettings::getMbsMonitorFreq()
00645 {
00646    return readNumEntry(GetSettingsName()+"/MbsMonitor/Frequency", 5);
00647 }
00648 
00649 void    TGo4QSettings::setMbsMonitorBins(int num)
00650 {
00651    writeEntry(GetSettingsName()+"/MbsMonitor/Bins", num);
00652 }
00653 
00654 int     TGo4QSettings::getMbsMonitorBins()
00655 {
00656    return readNumEntry(GetSettingsName()+"/MbsMonitor/Bins", 200);
00657 }
00658 
00659 void    TGo4QSettings::setMbsMonitorTrend(bool on)
00660 {
00661    writeEntry( GetSettingsName()+"/MbsMonitor/TrendOn", on ? 1: 0);
00662 }
00663 
00664 bool    TGo4QSettings::getMbsMonitorTrend()
00665 {
00666     return readNumEntry( GetSettingsName()+"/MbsMonitor/TrendOn", 0) != 0;
00667 }
00668 
00669 void    TGo4QSettings::setMbsMonitorMore(bool on)
00670 {
00671    writeEntry( GetSettingsName()+"/MbsMonitor/ShowMore", on ? 1: 0);
00672 }
00673 
00674 bool    TGo4QSettings::getMbsMonitorMore()
00675 {
00676    return readNumEntry( GetSettingsName()+"/MbsMonitor/ShowMore", 1) != 0;
00677 }
00678 
00679 void    TGo4QSettings::setMbsMonitorMonitorActive(bool on)
00680 {
00681    writeEntry( GetSettingsName()+"/MbsMonitor/MonitorActive", on ? 1: 0);
00682 }
00683 
00684 bool    TGo4QSettings::getMbsMonitorMonitorActive()
00685 {
00686    return readNumEntry( GetSettingsName()+"/MbsMonitor/MonitorActive", 0) != 0;
00687 }
00688 
00689 void    TGo4QSettings::setMbsMonitorBackwardsTrending(bool on)
00690 {
00691    writeEntry( GetSettingsName()+"/MbsMonitor/BackwardsTrending", on ? 1: 0);
00692 }
00693 
00694 bool    TGo4QSettings::getMbsMonitorBackwardsTrending()
00695 {
00696    return readNumEntry( GetSettingsName()+"/MbsMonitor/BackwardsTrending", 1) != 0;
00697 }
00698 
00699 
00700 void    TGo4QSettings::setDabcMonitorNode(const QString& name)
00701 {
00702    writeEntry(GetSettingsName()+"/DabcMonitor/Node", name);
00703 }
00704 
00705 QString TGo4QSettings::getDabcMonitorNode()
00706 {
00707     return readEntry(GetSettingsName()+"/DabcMonitor/Node", "dimDns.gsi.de");
00708 }
00709 
00710 void    TGo4QSettings::setDabcMonitorFreq(int secs)
00711 {
00712    writeEntry(GetSettingsName()+"/DabcMonitor/Frequency", secs);
00713 }
00714 
00715 int     TGo4QSettings::getDabcMonitorFreq()
00716 {
00717    return readNumEntry(GetSettingsName()+"/DabcMonitor/Frequency", 5);
00718 }
00719 
00720 void    TGo4QSettings::setDabcMonitorBins(int num)
00721 {
00722    writeEntry(GetSettingsName()+"/DabcMonitor/Bins", num);
00723 }
00724 
00725 int     TGo4QSettings::getDabcMonitorBins()
00726 {
00727    return readNumEntry(GetSettingsName()+"/DabcMonitor/Bins", 200);
00728 }
00729 
00730 void    TGo4QSettings::setDabcMonitorBackwardsTrending(bool on)
00731 {
00732    writeEntry( GetSettingsName()+"/DabcMonitor/BackwardsTrending", on ? 1: 0);
00733 }
00734 
00735 bool    TGo4QSettings::getDabcMonitorBackwardsTrending()
00736 {
00737    return readNumEntry( GetSettingsName()+"/DabcMonitor/BackwardsTrending", 1) != 0;
00738 }
00739 
00740 
00741 
00742 
00743 void    TGo4QSettings::setBool(const QString& name, bool value)
00744 {
00745    writeEntry( GetSettingsName()+name, value ? 1: 0);
00746 }
00747 
00748 bool    TGo4QSettings::getBool(const QString& name, bool def)
00749 {
00750    return readNumEntry( GetSettingsName()+name, def ? 1 : 0) != 0;
00751 }
00752 
00753 void    TGo4QSettings::setInt(const QString& name, int value)
00754 {
00755    writeEntry( GetSettingsName()+name, value);
00756 }
00757 
00758 int     TGo4QSettings::getInt(const QString& name, int def)
00759 {
00760    return readNumEntry( GetSettingsName()+name, def);
00761 }
00762 
00763 void    TGo4QSettings::setStr(const QString& name, const QString& value)
00764 {
00765    writeEntry( GetSettingsName()+name, value);
00766 }
00767 
00768 QString TGo4QSettings::getStr(const QString& name, const QString& def)
00769 {
00770    return readEntry( GetSettingsName()+name, def);
00771 }
00772 
00773 
00774 QStringList TGo4QSettings::getCommandsHistoryGUI()
00775 {
00776   return readListEntry( GetSettingsName()+"/CommandsHistoryGUI");
00777 }
00778 
00779 void TGo4QSettings::setCommandsHistoryGUI(QStringList & commands)
00780 {
00781    writeEntry( GetSettingsName()+"/CommandsHistoryGUI", commands);
00782 
00783 }
00784 
00785 
00786 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Fri Nov 28 12:59:22 2008 for Go4-v3.04-1 by  doxygen 1.4.2