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