GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4UserCommandsDialog.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
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 QString com= go4sett->getAnalysisMacroCommand(id);
30 QString tip=go4sett->getAnalysisMacroTip(id).split(":").first();
31 bool monitor=go4sett->getAnalysisMacroAutomode(id);
32 QTableWidgetItem* comitem= CommandsTable->item(id,0);
33 if(comitem) comitem->setText(com);
34 QTableWidgetItem* tipitem= CommandsTable->item(id,1);
35 if(tipitem) tipitem->setText(tip);
36
37 QTableWidgetItem* autoitem= CommandsTable->item(id,2);
38 if(autoitem) {
39 autoitem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
40 autoitem->setCheckState( monitor ? Qt::Checked : Qt::Unchecked);
41 }
42 }
43
44 QObject::connect (DialogButtonBox, &QDialogButtonBox::clicked, this, &TGo4UserCommandsDialog::ButtonPressed);
45}
46
48{
49 QString rev;
50 QTableWidgetItem *item = CommandsTable->item(id, 0);
51 if (item)
52 rev = item->text();
53 return rev;
54}
55
57{
58 QString rev;
59 QTableWidgetItem *item = CommandsTable->item(id, 1);
60 if (item)
61 rev = item->text();
62 return rev;
63}
64
66{
67 bool rev = false;
68 QTableWidgetItem *item = CommandsTable->item(id, 2);
69 if (item)
70 rev = item->checkState() == Qt::Checked;
71 return rev;
72}
73
74void TGo4UserCommandsDialog::ButtonPressed(QAbstractButton* but)
75{
76 QPushButton* pbut = dynamic_cast<QPushButton*>(but);
77 if (pbut == DialogButtonBox->button(QDialogButtonBox::Reset)) {
78 for (int id = 0; id < GO4GUI_MAXMACRONUM; ++id) {
79 QTableWidgetItem *comitem = CommandsTable->item(id, 0);
80 if (comitem)
81 comitem->setText(QString(""));
82 QTableWidgetItem *tipitem = CommandsTable->item(id, 1);
83 if (tipitem)
84 tipitem->setText(QString(""));
85 QTableWidgetItem *autoitem = CommandsTable->item(id, 2);
86 if (autoitem)
87 autoitem->setCheckState(Qt::Unchecked);
88 }
89 } // if Reset
90}
TGo4QSettings * go4sett
#define GO4GUI_MAXMACRONUM
bool GetAutoExecute(int id)
timer auto execute flag
QString GetTooltip(int id)
tooltip for index id
virtual void ButtonPressed(QAbstractButton *)
TGo4UserCommandsDialog(QWidget *parent=nullptr)
QString GetCommand(int id)
read command for index id