BuildmLearn Toolkit  2.0.4
BuildmLearn Toolkit is an easy-to-use program that helps users make mobile apps without any knowledge of application development.
 All Classes Functions Enumerations Groups Pages
formsimulator.h
1 #ifndef FORMSIMULATOR_H
2 #define FORMSIMULATOR_H
3 
4 #include <QDialog>
5 
6 #include "ui_formsimulator.h"
7 
8 
9 namespace Ui {
10  class FormSimulator;
11 }
12 
13 class FormMain;
14 class TemplateSimulator;
15 class QCloseEvent;
16 
17 /// \brief Separate window which contains active simulator.
18 /// \remarks This window can be sticked to main window.
19 class FormSimulator : public QDialog {
20  Q_OBJECT
21 
22  friend class FormMain;
23 
24  public:
25  // Constructors and destructors.
26  explicit FormSimulator(FormMain *parent = 0);
27  virtual ~FormSimulator();
28 
29  /// \brief Saves size & position for the window into settings.
30  void saveState();
31 
32  /// \brief Loads size & position for the window from settings.
33  void loadState();
34 
35  /// \brief Indicates whether simulator window is sticked to
36  /// main window or not.
37  /// \return Returns true if window is sticked
38  /// or false when it is not.
39  inline bool isSticked() const {
40  return m_isSticked;
41  }
42 
43  /// \brief Indicates whether simulator window should be shown
44  /// when application launches.
45  inline bool isVisibleOnStartup() const {
46  return m_isVisibleOnStartup;
47  }
48 
49  /// \brief Sets new active simulation widget.
50  /// \param simulation New active simulation widget.
51  /// \remarks This instance of FormSimulator takes ownership
52  /// of added simulation editors. When this method is called
53  /// and there is already some editor set, then this editor
54  /// is deleted.
55  void setActiveSimulation(TemplateSimulator *simulation);
56 
57  public slots:
58  /// \brief Takes active simulation one step back.
59  ///
60  /// This simply calls TemplateSimulator::goBack().
61  void goBack();
62 
63  /// \brief Starts active simulation.
64  ///
65  /// This simply calls TemplateSimulator::startSimulation().
66  void startSimulation();
67 
68  /// \brief Stops active simulation.
69  ///
70  /// This simply calls TemplateSimulator::stopSimulation().
71  void stopSimulation();
72 
73  /// \brief Conditionally sticks simulator window to its parent.
74  /// \remarks Depends on settings.
76 
77  /// \brief Forces this window to align itself next to its parent window.
78  void attachToParent();
79 
80  /// \brief Allows window to be unattached and allows vertical resize policy.
81  void unAttachFromParent();
82 
83  /// \brief Sticks or unsticks window.
84  /// \param is_sticked Do we want to stick window?
85  void setIsSticked(bool is_sticked);
86 
87  /// \brief Displays simulator window.
88  void show();
89 
90  protected:
91  /// \brief Executed when simulator window is closed.
92  /// \param e Event argument.
93  void closeEvent(QCloseEvent *e);
94 
95  signals:
96  /// \brief Emitted when simulator window is closed.
97  void closed();
98 
99  /// \brief Emitted if "stop" feature for active simulation is changed, in other
100  /// words, if simulation is started/stopped.
101  void stopEnableChanged(bool enabled);
102 
103  private:
104  void setupPhoneWidget();
105  void setupIcons();
106 
107  private:
108  Ui::FormSimulator *m_ui;
109  FormMain *m_mainWindow;
110  bool m_isVisibleOnStartup;
111  bool m_isSticked;
112  bool m_isActive;
113  TemplateSimulator *m_activeSimulation;
114 };
115 
116 #endif // FORMSIMULATOR_H
void setActiveSimulation(TemplateSimulator *simulation)
Sets new active simulation widget.
void attachToParent()
Forces this window to align itself next to its parent window.
void stopSimulation()
Stops active simulation.
Separate window which contains active simulator.
Definition: formsimulator.h:19
Main application window.
Definition: formmain.h:53
bool isVisibleOnStartup() const
Indicates whether simulator window should be shown when application launches.
Definition: formsimulator.h:45
void conditionallyAttachToParent()
Conditionally sticks simulator window to its parent.
void show()
Displays simulator window.
bool isSticked() const
Indicates whether simulator window is sticked to main window or not.
Definition: formsimulator.h:39
void stopEnableChanged(bool enabled)
Emitted if "stop" feature for active simulation is changed, in other words, if simulation is started/...
void goBack()
Takes active simulation one step back.
void closed()
Emitted when simulator window is closed.
void closeEvent(QCloseEvent *e)
Executed when simulator window is closed.
void startSimulation()
Starts active simulation.
void setIsSticked(bool is_sticked)
Sticks or unsticks window.
void loadState()
Loads size & position for the window from settings.
void unAttachFromParent()
Allows window to be unattached and allows vertical resize policy.
void saveState()
Saves size & position for the window into settings.
Base widget which represents simulator of the template.