GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4LogSettings.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 "TGo4LogSettings.h"
15 #include <QFileDialog>
16 #include "TGo4Log.h"
17 
19  : QDialog( parent )
20 {
21  setObjectName("Go4LogSettings");
22  setupUi(this);
23 
24  QObject::connect(FileNameLog, &QPushButton::clicked, this, &TGo4LogSettings::LogfileDialog);
25 
26  bool iswrite = TGo4Log::IsLogfileEnabled();
27 
28  IgnoreCombo->setCurrentIndex(TGo4Log::GetIgnoreLevel());
29  ModeCombo->setCurrentIndex(TGo4Log::IsAutoEnabled());
30  LogfilePrint->setChecked(TGo4Log::IsOutputEnabled());
31 
32  LogfileWrite->setChecked(iswrite);
33  LogfileName->setText(TGo4Log::GetLogname());
34  LogfileName->setEnabled(iswrite);
35  FileNameLog->setEnabled(iswrite);
36 }
37 
39 {
40  QFileDialog fd( this, "Set GUI logfile", "", "Log textfile (*.log)");
41  fd.setFileMode( QFileDialog::AnyFile );
42  if (fd.exec() != QDialog::Accepted) return;
43 
44  QStringList flst = fd.selectedFiles();
45  if (flst.isEmpty()) return;
46 
47  QString fileName = flst[0];
48  if(!fileName.endsWith(".log")) fileName.append(".log");
49  LogfileName->setText(fileName);
50 }
static const char * GetLogname()
Definition: TGo4Log.cxx:343
virtual void LogfileDialog()
static Bool_t IsOutputEnabled()
Definition: TGo4Log.cxx:358
static Bool_t IsLogfileEnabled()
Definition: TGo4Log.cxx:368
TGo4LogSettings(QWidget *parent=nullptr)
static Int_t GetIgnoreLevel()
Definition: TGo4Log.cxx:338
static Bool_t IsAutoEnabled()
Definition: TGo4Log.cxx:378