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 Class Reference

Separate window which contains active simulator. More...

#include <formsimulator.h>

Collaboration diagram for FormSimulator:
Collaboration graph

Public Slots

void goBack ()
 Takes active simulation one step back. More...
 
void startSimulation ()
 Starts active simulation. More...
 
void stopSimulation ()
 Stops active simulation. More...
 
void conditionallyAttachToParent ()
 Conditionally sticks simulator window to its parent. More...
 
void attachToParent ()
 Forces this window to align itself next to its parent window.
 
void unAttachFromParent ()
 Allows window to be unattached and allows vertical resize policy.
 
void setIsSticked (bool is_sticked)
 Sticks or unsticks window. More...
 
void show ()
 Displays simulator window.
 

Signals

void closed ()
 Emitted when simulator window is closed.
 
void stopEnableChanged (bool enabled)
 Emitted if "stop" feature for active simulation is changed, in other words, if simulation is started/stopped.
 

Public Member Functions

 FormSimulator (FormMain *parent=0)
 
void saveState ()
 Saves size & position for the window into settings.
 
void loadState ()
 Loads size & position for the window from settings.
 
bool isSticked () const
 Indicates whether simulator window is sticked to main window or not. More...
 
bool isVisibleOnStartup () const
 Indicates whether simulator window should be shown when application launches.
 
void setActiveSimulation (TemplateSimulator *simulation)
 Sets new active simulation widget. More...
 

Protected Member Functions

void closeEvent (QCloseEvent *e)
 Executed when simulator window is closed. More...
 

Friends

class FormMain
 

Detailed Description

Separate window which contains active simulator.

Remarks
This window can be sticked to main window.

Definition at line 19 of file formsimulator.h.

Member Function Documentation

void FormSimulator::closeEvent ( QCloseEvent *  e)
protected

Executed when simulator window is closed.

Parameters
eEvent argument.

Definition at line 160 of file formsimulator.cpp.

160  {
161  m_isActive = false;
162 
163  emit closed();
164  e->accept();
165 }
void closed()
Emitted when simulator window is closed.
void FormSimulator::conditionallyAttachToParent ( )
slot

Conditionally sticks simulator window to its parent.

Remarks
Depends on settings.

Definition at line 105 of file formsimulator.cpp.

105  {
106  if (m_isSticked) {
107  attachToParent();
108  }
109 }
void attachToParent()
Forces this window to align itself next to its parent window.

Here is the call graph for this function:

Here is the caller graph for this function:

void FormSimulator::goBack ( )
slot

Takes active simulation one step back.

This simply calls TemplateSimulator::goBack().

Definition at line 83 of file formsimulator.cpp.

83  {
84  if (m_activeSimulation != NULL) {
85  m_activeSimulation->goBack();
86  }
87 }
virtual bool goBack()=0
Gets simulation one step back.

Here is the call graph for this function:

bool FormSimulator::isSticked ( ) const
inline

Indicates whether simulator window is sticked to main window or not.

Returns
Returns true if window is sticked or false when it is not.

Definition at line 39 of file formsimulator.h.

39  {
40  return m_isSticked;
41  }

Here is the caller graph for this function:

void FormSimulator::setActiveSimulation ( TemplateSimulator simulation)

Sets new active simulation widget.

Parameters
simulationNew active simulation widget.
Remarks
This instance of FormSimulator takes ownership of added simulation editors. When this method is called and there is already some editor set, then this editor is deleted.

Definition at line 60 of file formsimulator.cpp.

60  {
61  if (m_activeSimulation != NULL) {
62  // There is existing simulator widget, remove it.
63  m_activeSimulation->close();
64  m_activeSimulation->deleteLater();
65  m_activeSimulation = NULL;
66  }
67 
68  // Assign new simulation and display its initial state.
69  m_activeSimulation = simulation;
70  m_activeSimulation->setParent(m_ui->m_phoneWidget);
71  m_activeSimulation->setGeometry(SIMULATOR_CONTENTS_OFFSET_X, SIMULATOR_CONTENTS_OFFSET_Y,
72  SIMULATOR_CONTENTS_WIDTH, SIMULATOR_CONTENTS_HEIGHT);
73  m_activeSimulation->show();
74 
75  // Make necessary connections which are meant for simulator window.
76  connect(m_activeSimulation, SIGNAL(canGoBackChanged(bool)), m_ui->m_btnGoBack, SLOT(setEnabled(bool)));
77  connect(m_activeSimulation, SIGNAL(simulationStopRequested()), m_ui->m_btnStopSimulation, SLOT(click()));
78  connect(m_activeSimulation->core()->editor(), SIGNAL(canGenerateChanged(bool)), m_ui->m_btnRunSimulation, SLOT(setEnabled(bool)));
79 
80  emit stopEnableChanged(false);
81 }
virtual TemplateEditor * editor() const
Access to editor widget of the template.
Definition: templatecore.h:84
void stopEnableChanged(bool enabled)
Emitted if "stop" feature for active simulation is changed, in other words, if simulation is started/...
TemplateCore * core() const
Access to associated template core.

Here is the call graph for this function:

void FormSimulator::setIsSticked ( bool  is_sticked)
slot

Sticks or unsticks window.

Parameters
is_stickedDo we want to stick window?

Definition at line 111 of file formsimulator.cpp.

111  {
112  if (is_sticked && !m_isSticked) {
113  attachToParent();
114  }
115  else if (!is_sticked && m_isSticked) {
117  }
118 
119  m_isSticked = is_sticked;
120 
121  qApp->settings()->setValue(APP_CFG_SIMULATOR, "is_sticked", is_sticked);
122 }
void attachToParent()
Forces this window to align itself next to its parent window.
void unAttachFromParent()
Allows window to be unattached and allows vertical resize policy.

Here is the call graph for this function:

void FormSimulator::startSimulation ( )
slot

Starts active simulation.

This simply calls TemplateSimulator::startSimulation().

Definition at line 89 of file formsimulator.cpp.

89  {
90  if (m_activeSimulation != NULL) {
91  if (m_activeSimulation->startSimulation()) {
92  emit stopEnableChanged(true);
93  }
94  }
95 }
void stopEnableChanged(bool enabled)
Emitted if "stop" feature for active simulation is changed, in other words, if simulation is started/...
virtual bool startSimulation()=0
(Re)starts the simulation.

Here is the call graph for this function:

void FormSimulator::stopSimulation ( )
slot

Stops active simulation.

This simply calls TemplateSimulator::stopSimulation().

Definition at line 97 of file formsimulator.cpp.

97  {
98  if (m_activeSimulation != NULL) {
99  if (m_activeSimulation->stopSimulation()) {
100  emit stopEnableChanged(false);
101  }
102  }
103 }
virtual bool stopSimulation()=0
Stops simulation and resets its to initial state, all user data from simulation are cleared...
void stopEnableChanged(bool enabled)
Emitted if "stop" feature for active simulation is changed, in other words, if simulation is started/...

Here is the call graph for this function:


The documentation for this class was generated from the following files: