gui
Loading...
Searching...
No Matches
gui.h
Go to the documentation of this file.
1#pragma once
2
3// qt
4#include <QStackedWidget> // rightContent
5#include <QLineEdit> // nEvents
6#include <QLabel> // eventNumberLabel
7#include <QTimer> // gtimer
8#include <QHBoxLayout> // createTopButtons
9
10// gemc
11#include "gQtButtonsWidget.h"
12#include "gAnalysisAccumulator.h"
13#include "eventDispenser.h"
15
16// gboard
17#include "gui_session.h"
18
19class GTree;
20class GAnalysisView;
21class PhysicsView;
22
40class GemcGUI : public QWidget
41{
42 // metaobject required for non-qt slots
43 Q_OBJECT
44
45public:
63 GemcGUI(std::shared_ptr<GOptions> gopts,
64 std::shared_ptr<EventDispenser> ed,
66 std::shared_ptr<GAnalysisAccumulator> analysisAccumulator,
67 bool viewerAlreadyInitialized = false,
68 QWidget* parent = nullptr);
69
76 ~GemcGUI() override;
77
78private:
85 GQTButtonsWidget* leftButtons; // left bar buttons
86
93 QStackedWidget* rightContent; // pages controlled by left bar buttons
94
104 QLineEdit* nEvents;
105
114 QLabel* eventNumberLabel;
115 qulonglong displayedEventCount = 0;
116
123 QTimer* gtimer; // for cycling events
124
133 std::shared_ptr<EventDispenser> eventDispenser;
134
136 std::shared_ptr<GAnalysisAccumulator> analysisAccumulator;
137
144 std::unique_ptr<GUI_Session> guiSession;
145
146 std::shared_ptr<GOptions> guiOptions;
147 GDetectorConstruction* detectorConstruction = nullptr;
148 GTree* geometryTree = nullptr;
149 GAnalysisView* analysisView = nullptr;
150 PhysicsView* physicsView = nullptr;
151 bool geometryReloadedSinceRun = false;
152 bool viewerInitialized = false;
153 bool visualizationNeedsRunRestore = false;
154
155private:
161 void createLeftButtons();
162
172 void createRightContent(std::shared_ptr<GOptions> gopts,
174 GBoard* gb);
175
181 void createTopButtons(QHBoxLayout* topLayout);
182
189 void refreshGeometryTree();
190
197 void resetVisualizationBeforeGeometryReload();
198
205 void refreshVisualizationFromOptions();
206
215 void prepareGeometryForBeamOn();
216
223 void updateGui();
224
225private slots:
232 void neventsChanged();
233
240 void beamOn();
241
248 void cycleBeamOn();
249
253 void stopCycleBeamOn();
254
260 void gquit();
261
271 void change_page(QListWidgetItem* current, QListWidgetItem* previous);
272};
GemcGUI(std::shared_ptr< GOptions > gopts, std::shared_ptr< EventDispenser > ed, GDetectorConstruction *dc, std::shared_ptr< GAnalysisAccumulator > analysisAccumulator, bool viewerAlreadyInitialized=false, QWidget *parent=nullptr)
Construct the main GUI widget.
Definition gui.cc:78
~GemcGUI() override
Destroy the GUI widget and release explicitly owned resources.
Definition gui.cc:236