GSI Object Oriented Online Offline (Go4)  GO4-6.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4UserCommandsDialog.cpp
Go to the documentation of this file.
1 // $Id: TGo4UserCommandsDialog.cpp 3362 2021-10-25 15:17:20Z linev $
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 "TGo4UserCommandsDialog.h"
15 
16 #include "TGo4QSettings.h"
17 #include "TGo4UserCommands.h"
18 
19 #include <QPushButton>
20 
22  : QDialog( parent )
23 {
24  setObjectName("Go4UserCommandsDialog");
25  setupUi(this);
26 
27  // here we fill table directly from go4 settings:
28  for(int id=0; id<GO4GUI_MAXMACRONUM; ++id)
29  {
30  QString com= go4sett->getAnalysisMacroCommand(id);
31  QString tip=go4sett->getAnalysisMacroTip(id).split(":").first();
32  bool monitor=go4sett->getAnalysisMacroAutomode(id);
33  QTableWidgetItem* comitem= CommandsTable->item(id,0);
34  if(comitem) comitem->setText(com);
35  QTableWidgetItem* tipitem= CommandsTable->item(id,1);
36  if(tipitem) tipitem->setText(tip);
37 
38  QTableWidgetItem* autoitem= CommandsTable->item(id,2);
39  if(autoitem) {
40  autoitem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
41  autoitem->setCheckState( monitor ? Qt::Checked : Qt::Unchecked);
42  }
43 
44  }
45 
46  QObject::connect (DialogButtonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(ButtonPressed(QAbstractButton*)));
47 }
48 
50  {
51  QString rev("");
52  QTableWidgetItem* item=CommandsTable->item(id,0);
53  if(item)
54  rev=item->text();
55  return rev;
56  }
57 
59  {
60  QString rev("");
61  QTableWidgetItem* item=CommandsTable->item(id,1);
62  if(item)
63  rev=item->text();
64  return rev;
65  }
66 
68 {
69  bool rev(false);
70  QTableWidgetItem* item=CommandsTable->item(id,2);
71  if(item)
72  rev=(item->checkState()==Qt::Checked);
73  return rev;
74 
75 }
76 
77 void TGo4UserCommandsDialog::ButtonPressed(QAbstractButton* but)
78 {
79  //std::cout<<"TGo4UserCommandsDialog ButtonPressed " << std::endl;
80  QPushButton* pbut=dynamic_cast<QPushButton*>(but);
81  if (pbut == DialogButtonBox->button (QDialogButtonBox::Reset))
82  {
83  //std::cout<<"Found Reset button " << std::endl;
84  for(int id=0; id<GO4GUI_MAXMACRONUM; ++id)
85  {
86  QTableWidgetItem* comitem= CommandsTable->item(id,0);
87  if(comitem) comitem->setText(QString(""));
88  QTableWidgetItem* tipitem= CommandsTable->item(id,1);
89  if(tipitem) tipitem->setText(QString(""));
90  QTableWidgetItem* autoitem= CommandsTable->item(id,2);
91  if(autoitem)
92  autoitem->setCheckState(Qt::Unchecked);
93  }
94  } // if Reset
95 
96 }
virtual void ButtonPressed(QAbstractButton *)
#define GO4GUI_MAXMACRONUM
bool getAnalysisMacroAutomode(int id)
TGo4UserCommandsDialog(QWidget *parent=0)
QString getAnalysisMacroCommand(int id)
TGo4QSettings * go4sett
QString getAnalysisMacroTip(int id)