7#include <QCoreApplication>
10void GemcGUI::createTopButtons(QHBoxLayout* topLayout) {
15 auto* nEventsLabel =
new QLabel(tr(
"N. Events:"));
17 auto* runButton =
new QPushButton(tr(
"Run"));
18 runButton->setToolTip(
"Run events");
19 runButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
23 auto grunNumberOfEvents = std::to_string(
eventDispenser->getTotalNumberOfEvents());
24 nEvents =
new QLineEdit(tr(grunNumberOfEvents.c_str()));
25 nEvents->setMaximumWidth(50);
27 auto* cycleButton =
new QPushButton(tr(
"Cycle"));
28 cycleButton->setToolTip(
"Run 1 event every 2 seconds");
29 cycleButton->setIcon(style()->standardIcon(QStyle::SP_BrowserReload));
31 auto* stopButton =
new QPushButton(tr(
"Stop"));
32 stopButton->setToolTip(
"Stops running events");
33 stopButton->setIcon(style()->standardIcon(QStyle::SP_MediaStop));
35 auto* closeButton =
new QPushButton(tr(
"Exit"));
36 closeButton->setToolTip(
"Quit GEMC");
37 closeButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton));
40 eventNumberLabel =
new QLabel(tr(
"Event Number: 0"));
42 topLayout->addWidget(nEventsLabel);
43 topLayout->addWidget(nEvents);
44 topLayout->addWidget(runButton);
45 topLayout->addWidget(cycleButton);
46 topLayout->addWidget(stopButton);
47 topLayout->addStretch(1);
48 topLayout->addWidget(eventNumberLabel);
49 topLayout->addStretch(40);
50 topLayout->addWidget(closeButton);
55 connect(nEvents, &QLineEdit::textChanged,
this, &GemcGUI::neventsChanged);
56 connect(closeButton, &QPushButton::clicked,
this, &GemcGUI::gquit);
57 connect(runButton, &QPushButton::clicked,
this, &GemcGUI::beamOn);
58 connect(cycleButton, &QPushButton::clicked,
this, &GemcGUI::cycleBeamOn);
59 connect(stopButton, &QPushButton::clicked,
this, &GemcGUI::stopCycleBeamOn);
63void GemcGUI::gquit() {
69void GemcGUI::neventsChanged() {
71 int newNevents = nEvents->text().toInt();
75void GemcGUI::beamOn() {
82void GemcGUI::cycleBeamOn() {
84 if (!gtimer->isActive()) {
91void GemcGUI::stopCycleBeamOn() { gtimer->stop(); }