VPTissue Reference Manual
SessionController.h
Go to the documentation of this file.
1 #ifndef GUI_RUNNINGCONTROLLER_H_INCLUDED
2 #define GUI_RUNNINGCONTROLLER_H_INCLUDED
3 /*
4  * Copyright 2011-2016 Universiteit Antwerpen
5  *
6  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
7  * the European Commission - subsequent versions of the EUPL (the "Licence");
8  * You may not use this work except in compliance with the Licence.
9  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the Licence is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the Licence for the specific language governing
15  * permissions and limitations under the Licence.
16  */
22 #include "session/ISession.h"
23 #include "gui/EnabledActions.h"
24 #include "workspace/IProject.h"
25 
26 #include <QWidget>
27 #include <memory>
28 
29 class QAction;
30 class QTimer;
31 
32 namespace SimShell {
33 namespace Gui {
34 namespace Controller {
35 
44 class SessionController : public QWidget
45 {
46  Q_OBJECT
47 public:
48  SessionController(QWidget* parent);
49 
50  void Disable();
51 
52  void Enable(const std::shared_ptr<Ws::IProject>& project);
53 
54  QAction* GetActionRun() const;
55 
56  QAction* GetActionSingleStep() const;
57 
58  bool IsEnabled() const;
59 
60  bool IsRunning() const;
61 
62  void SetRunning(bool);
63 
64 private slots:
65  void SLOT_ToggleRunning(bool);
66 
67  void SLOT_TimeStep();
68 
69 private:
70  // Because of Qt wanting to match parameter types of signals and slots by string comparison
72 
73 private slots:
75  void SimulationError(const std::string& error);
76 
78  void SimulationInfo(const std::string& message, const InfoMessageReason& reason);
79 
80 private:
81  QAction* m_action_run;
82  QAction* m_action_single_step;
83  EnabledActions m_enabled_actions;
84  std::shared_ptr<Ws::IProject> m_project;
85 };
86 
87 } // namespace
88 } // namespace
89 } // namespace
90 
91 #endif // end_of_inclde_guard
Helper class to enable or disable a collection of QAction and QMenu objects at once.
EnabledActions interface.
InfoMessageReason
Enumeration for the reason of an emitted InfoMessage from the project.
Definition: ISession.h:126
Interface for IProject.
Interface for ISession.
Simple state machine with 3 states: "disabled", "enabled-not-running" and "enabled-running".
see the online Qt documentation
Namespace for generic graphical shell for simulators.
Definition: SimSession.h:32