summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuha Vuolle <juha.vuolle@qt.io>2023-02-20 10:52:21 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-02-23 06:38:48 +0000
commit8b43bc98abe124529e672cd79624351bccd2c9f2 (patch)
tree6d8caa931f6161ad0f7da95d4ad8b76a61ad78c5
parenta9fcf950e7ffa1ce9385c2660cd8b811cd1ed9d3 (diff)
Remove scxml pinball example
While an admirable state machine implementation in its own right, perhaps doesn't provide adequate unique demonstrative value. Task-number: QTBUG-111090 Change-Id: I47c1392bf5ac30f7b0b8a46b5539cdd333d77610 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 74428c29dc8c81d17e1a666bd271572206ca7e97) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--examples/scxml/CMakeLists.txt1
-rw-r--r--examples/scxml/pinball/CMakeLists.txt44
-rw-r--r--examples/scxml/pinball/doc/images/pinball-statechart-global.pngbin2925 -> 0 bytes
-rw-r--r--examples/scxml/pinball/doc/images/pinball-statechart-guicontrol.pngbin3618 -> 0 bytes
-rw-r--r--examples/scxml/pinball/doc/images/pinball-statechart-internalstate.pngbin2987 -> 0 bytes
-rw-r--r--examples/scxml/pinball/doc/images/pinball-statechart-logicalstate.pngbin7613 -> 0 bytes
-rw-r--r--examples/scxml/pinball/doc/images/pinball-statechart-modestate.pngbin3546 -> 0 bytes
-rw-r--r--examples/scxml/pinball/doc/images/pinball-statechart-onstate.pngbin7139 -> 0 bytes
-rw-r--r--examples/scxml/pinball/doc/images/pinball-statechart-workflow.pngbin4433 -> 0 bytes
-rw-r--r--examples/scxml/pinball/doc/images/pinball.pngbin44973 -> 0 bytes
-rw-r--r--examples/scxml/pinball/doc/src/pinball.qdoc478
-rw-r--r--examples/scxml/pinball/main.cpp19
-rw-r--r--examples/scxml/pinball/mainwindow.cpp86
-rw-r--r--examples/scxml/pinball/mainwindow.h31
-rw-r--r--examples/scxml/pinball/mainwindow.ui663
-rw-r--r--examples/scxml/pinball/pinball.pro19
-rw-r--r--examples/scxml/pinball/pinball.scxml306
-rw-r--r--examples/scxml/scxml.pro1
18 files changed, 0 insertions, 1648 deletions
diff --git a/examples/scxml/CMakeLists.txt b/examples/scxml/CMakeLists.txt
index 6b0ce37..a0f3867 100644
--- a/examples/scxml/CMakeLists.txt
+++ b/examples/scxml/CMakeLists.txt
@@ -15,7 +15,6 @@ if(TARGET Qt::Widgets)
qt_internal_add_example(mediaplayer-widgets-dynamic)
endif()
qt_internal_add_example(calculator-widgets)
- qt_internal_add_example(pinball)
qt_internal_add_example(sudoku)
endif()
endif()
diff --git a/examples/scxml/pinball/CMakeLists.txt b/examples/scxml/pinball/CMakeLists.txt
deleted file mode 100644
index e80c9dd..0000000
--- a/examples/scxml/pinball/CMakeLists.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: BSD-3-Clause
-
-cmake_minimum_required(VERSION 3.16)
-project(pinball LANGUAGES CXX)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/scxml/pinball")
-
-find_package(Qt6 REQUIRED COMPONENTS Core Gui Scxml Widgets)
-
-qt_add_executable(pinball
- main.cpp
- mainwindow.cpp mainwindow.h mainwindow.ui
-)
-
-set_target_properties(pinball PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-
-target_link_libraries(pinball PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Scxml
- Qt::Widgets
-)
-
-# Statecharts:
-qt6_add_statecharts(pinball
- pinball.scxml
-)
-
-install(TARGETS pinball
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/scxml/pinball/doc/images/pinball-statechart-global.png b/examples/scxml/pinball/doc/images/pinball-statechart-global.png
deleted file mode 100644
index 630c678..0000000
--- a/examples/scxml/pinball/doc/images/pinball-statechart-global.png
+++ /dev/null
Binary files differ
diff --git a/examples/scxml/pinball/doc/images/pinball-statechart-guicontrol.png b/examples/scxml/pinball/doc/images/pinball-statechart-guicontrol.png
deleted file mode 100644
index b79e343..0000000
--- a/examples/scxml/pinball/doc/images/pinball-statechart-guicontrol.png
+++ /dev/null
Binary files differ
diff --git a/examples/scxml/pinball/doc/images/pinball-statechart-internalstate.png b/examples/scxml/pinball/doc/images/pinball-statechart-internalstate.png
deleted file mode 100644
index 3bd9d1b..0000000
--- a/examples/scxml/pinball/doc/images/pinball-statechart-internalstate.png
+++ /dev/null
Binary files differ
diff --git a/examples/scxml/pinball/doc/images/pinball-statechart-logicalstate.png b/examples/scxml/pinball/doc/images/pinball-statechart-logicalstate.png
deleted file mode 100644
index 7a3395a..0000000
--- a/examples/scxml/pinball/doc/images/pinball-statechart-logicalstate.png
+++ /dev/null
Binary files differ
diff --git a/examples/scxml/pinball/doc/images/pinball-statechart-modestate.png b/examples/scxml/pinball/doc/images/pinball-statechart-modestate.png
deleted file mode 100644
index e8b6df9..0000000
--- a/examples/scxml/pinball/doc/images/pinball-statechart-modestate.png
+++ /dev/null
Binary files differ
diff --git a/examples/scxml/pinball/doc/images/pinball-statechart-onstate.png b/examples/scxml/pinball/doc/images/pinball-statechart-onstate.png
deleted file mode 100644
index db9459c..0000000
--- a/examples/scxml/pinball/doc/images/pinball-statechart-onstate.png
+++ /dev/null
Binary files differ
diff --git a/examples/scxml/pinball/doc/images/pinball-statechart-workflow.png b/examples/scxml/pinball/doc/images/pinball-statechart-workflow.png
deleted file mode 100644
index dfcf3f2..0000000
--- a/examples/scxml/pinball/doc/images/pinball-statechart-workflow.png
+++ /dev/null
Binary files differ
diff --git a/examples/scxml/pinball/doc/images/pinball.png b/examples/scxml/pinball/doc/images/pinball.png
deleted file mode 100644
index bbd390e..0000000
--- a/examples/scxml/pinball/doc/images/pinball.png
+++ /dev/null
Binary files differ
diff --git a/examples/scxml/pinball/doc/src/pinball.qdoc b/examples/scxml/pinball/doc/src/pinball.qdoc
deleted file mode 100644
index aa12e42..0000000
--- a/examples/scxml/pinball/doc/src/pinball.qdoc
+++ /dev/null
@@ -1,478 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
-
-/*!
- \example pinball
- \title Qt SCXML Pinball Example
- \ingroup examples-qtscxml
- \brief Encapsulates the internal logic of an application in an SCXML file.
-
- \e {Pinball} demonstrates a clear separation between the user interface,
- which may be easily replaced, and the internal logic encapsulated in an
- SCXML file, which could also be used with another user interface.
-
- \include examples-run.qdocinc
-
- \section1 Pinball Features
-
- \image pinball.png Screenshot of the Pinball example
-
- The Pinball example mimics a pinball game. The targets on the pinball table
- are substituted by GUI controls, mainly by push buttons. Display elements,
- including current score, highscore, and targets' lights, are substituted by
- labels. Usually, the state of the targets' lights changes very often during
- a game: the lights get turned on or off permanently or they blink at varying
- speed indicating a game (or a certain target) entered a temporary state. The
- state of each target light is presented as an enabled or a disabled label.
- There is no real ball, but clicking a target's button represents hitting a
- real pinball target with a ball.
-
- Our pinball contains the following features:
- \list
- \li Initially and when the game ends, the pinball table
- enters \c offState. In that state, all lights on the table
- blink slowly (at intervals of 1 second).
- \li After clicking the \uicontrol START button, the pinball table
- enters \c onState. All lights are turned off and the
- pinball table is ready to be played.
- \li When the table is in \c onState and the players
- click the \uicontrol {BALL OUT} button, the game ends
- and enters \c offState. If the players' score is
- higher than the current highscore, the highscore is updated.
- \li The goal is to collect the \uicontrol JACKPOT. In order to do that,
- the players must hit all five \uicontrol CRAZY letters twice.
- They have unlimited time for hitting them for the first time.
- However, after they have collected all the letters for the first time,
- they enter the \c hurryState and must collect
- them again within 5 seconds. If the time has passed and
- the letters were not collected again, the players must
- start collecting the letters from scratch.
- \li Scores:
- \list
- \li 1.000 per letter hit when not in \c hurryState.
- \li 10.000 per letter hit when in \c hurryState.
- \li 100.000 bonus for all 5 letters when not in \c hurryState.
- \li 1.000.000 bonus for all 5 letters when in \c hurryState
- (\uicontrol JACKPOT).
- \endlist
- \li When not in \c hurryState, the letters already hit should blink
- at intermediate speed (500ms). Letters not hit yet should stay off.
- \li When in \c hurryState, the letters already hit should
- stay on. Letters not hit yet should blink fast (200ms).
- In addition, the \uicontrol HURRY light should blink at the same speed.
- \li When the jackpot gets collected, the \uicontrol JACKPOT light should
- stay on.
- \endlist
-
- \section1 SCXML Part: Internal Logic Description
-
- The \e pinball.scxml file describes the internal logic implemented for the
- pinball game. In this example, we have chosen the ECMAScript data model:
-
- \quotefromfile pinball/pinball.scxml
- \skipto scxml
- \printuntil ecmascript
-
- The ECMAScript data model enables declaring variables with initial values
- that can be modified later. We declare the \c "highscore" and \c "score"
- variables with the initial values of 0:
-
- \printuntil </datamodel>
-
- We define a root parallel state \c "global", with two child states,
- \c guiControl and \c internalState, which are also parallel. Because the top
- \c global state is parallel, all of its direct children are active when it
- is active. In this example, the role of \c global is to collect the child
- states and make them both active at a time.
-
- \image pinball-statechart-global.png
-
- \section2 Maintaining Light State
-
- The \c guiControl element is responsible for maintaining the current
- state of each light control that is visible on the pinball table.
- Each light has a corresponding state.
-
- \image pinball-statechart-guicontrol.png
-
- For example, the light of the letter
- \uicontrol C corresponds to the \c cLight state. Each light state has two
- child states indicating whether the light is on or off:
-
- \printuntil target="cLightOn"
- \printuntil /^\ {12}<\//
-
- As mentioned before, the \c guiControl state is always active, and since
- it is of parallel type, all its direct children are always active too.
- Therefore, the \c cLight state is always active. However,
- only one of its children, \c cLightOn or \c cLightOff, is active at a time.
- The same applies to the other children of the \c guiControl state.
- In addition, we define transitions between on and off substates. For example,
- whenever the active state is \c cLightOn and a \c turnOffC event is received,
- we change the active substate of \c cLight to \c cLightOff.
- Whenever the active state is \c cLightOff and we receive a \c turnOnC event,
- we change the active substate of \c cLight to \c cLightOn.
-
- In our application, we use instances of QLabel class in C++
- to represent real lights on the table. When the light transitions
- into the \e on or \e off state, we enable or disable the particular label
- accordingly. The connection between the state machine and the GUI
- part of the application will be shown in the \l {cpp}{C++ code} later on. For now,
- it is enough to realize that changes to active states inside
- the state machine will serve as the external interface of the state machine
- that the other parts of the application (such as the GUI part) can listen to.
-
- All of the mentioned events that switch the state of a light
- will be generated by this state machine inside the \c internalState
- in reaction to running timers or external triggers.
-
- \section2 Maintaining Game State
-
- The \c internalState state consists of two main parts: \c logicalState and \c workflow.
-
- \image pinball-statechart-internalstate.png
-
- The \c logicalState state holds the definitions for the modes that the game is able
- to go into and for the logical states of collected targets. The \c workflow state
- implements a generator for light blinking and calculates most of the new states
- the machine should go into depending on incoming events and on currently active states.
- As mentioned already, \c internalState is always active, and since
- it is of a parallel type, \c logicalState and \c workflow are always active too.
-
- \section2 Maintaining Logical State of Buttons
-
- The \c logicalState state consist of two parts: \c letterState and \c modeState.
-
- \image pinball-statechart-logicalstate.png
-
- As previously mentioned, \c logicalState is always active, and since
- it is of parallel type, the \c letterState and \c modeState children are always
- active too. Now let us look at the first part, the \c letterState, which contains
- one parallel \c lettersState:
-
- \quotefromfile pinball/pinball.scxml
- \skipto letterState
- \printuntil lettersState
- \printuntil letter.R
- \dots 28
- \skipto /^\ {24}<\//
- \printuntil letter.A
- \dots 28
- \skipto /^\ {24}<\//
- \printuntil letter.Z
- \dots 28
- \skipto /^\ {24}<\//
- \printuntil letter.Y
- \dots 28
- \skipto /^\ {24}<\//
- \printuntil /^\ {16}<\//
-
- The \c lettersState state maintains the logical state of the buttons pretending to
- be targets that were clicked by the players. The letter state for the letter
- \uicontrol C holds whether the target for the letter \uicontrol C was hit,
- while the light state for the letter \uicontrol C holds whether the light
- for the target for the letter \uicontrol C should be currently on or off.
- In a real pinball game, these states are usually orthogonal,
- which means that if you have not hit a target yet, the target is blinking,
- indicating that it is currently worth hitting. This blinking
- means that the light state switches between on and off at short intervals,
- while the target state is continuously off, because it has not been hit yet.
- The author of a pinball table can decide that
- after a target is hit (that is, after the target state switches to on)
- the target's light is continuously turned off or on or the intervals between
- lights blinking become shorter or longer.
-
- As mentioned before, \c letterState is always active, which means
- that its only child \c lettersState should always be active too. However,
- there is one exception: for a short while the \c lettersState may
- end up being \e {not active}. This happens when the transition for
- \c lettersState is being performed. This transition is triggered when
- the \c resetLetters event occurs, and it instructs the state machine
- to exit \c lettersState and all its descendant states and reenter
- \c lettersState and set up all its descendant states with their initial states.
- In short, the \c resetLetters event resets the \c lettersState and all its
- descendant states to the default configuration.
-
- The \c lettersState contains five direct substates that
- correspond to five different letters. The content for other letters' states
- than C is not shown here, but it is analogous to the content for C's state.
-
- The \c {letter.C} state contains two substates reflecting its off and on states:
- \c cLetterOff and \c cLetterOn. The \c {letter.C} state inside its parallel
- parent \c lettersState is always active (under the condition that
- \c lettersState is active, as described before). However,
- only one of its child states is active at a time: \c cLetterOff or \c cLetterOn.
- The initial substate of the \c {letter.C} state is \c cLetterOff meaning
- that whenever the \c {letter.C} state is being activated (which happens
- initially and after the \c resetLetters event) its active
- substate will be set to \c cLetterOff.
-
- The \c cLetterOff state defines a transition, which will be triggered by
- the \c {cLetterTriggered} event. This transition activates \c cLetterOn,
- the other child of \c {letter.C}, only when the machine is in \c onState
- (that is, when the pinball game is running).
- The \c {cLetterTriggered} event is expected to be an event posted into the state machine
- from outside of the state machine. This event should be generated when
- the ball hits the letter \uicontrol C target. In our example we mimic
- it by the clicking the letter \uicontrol C button.
-
- The \c cLetterOn state is defined as a final state, which means that
- whenever this state is activated the \c {done.state.letter.C} event
- will be automatically posted by the state machine. This event will be used
- later for updating the current score.
-
- Moreover, when all \c lettersState children reach their final state,
- the state machine will automatically post the \c {done.state.lettersState} event.
- This event will be used later, too, for updating the current score
- and for turning on or off the hurry state.
-
- \section2 Maintaining Game Modes
-
- The \c modeState state consists of two substates, \c offState and \c onState.
-
- \image pinball-statechart-modestate.png
-
- The \c offState state describes what should happen before the pinball game
- is started and when it is over,
- while \c onState represents the logic appropriate for the active game.
-
- \quotefromfile pinball/pinball.scxml
- \skipto offState
- \printuntil /^\ {20}<\//
-
- When the pinball application starts or a game ends, the machine goes into
- \c offState. Entering that state invokes some actions, which are
- enclosed inside an \c <onentry> element. First, we update the \c highScore
- variable in case the current \c highScore value is less than current \c score value.
- This is being checked inside the \c "cond" attribute of the \c <if> element
- (note that we need to escape the "<" character with "&lt;").
- Even in the \c off state, we want to show the last reached score,
- so we do not clear it here; we will do that when we enter the \c on state.
- Next, we raise two events: \c resetLetters to logically reset
- all letters that might have been hit during the last game and \c update
- to immediately activate the blinking and updating of all lights.
- When the machine is in \c offState, it is ready to transition into the
- \c onState if only the \c startTriggered event occurs, which is described
- by the <transition> element. This event is expected to be generated externally
- after clicking the \uicontrol START button on the pinball table.
-
- \skipto onState
- \printuntil /^\ {20}<\//
-
- \section2 Game On
-
- When the state machine enters \c onState, it first clears the current score
- variable. The \c onState state is of the parallel type and has two direct child states:
- \c hurryState and \c jackpotState. They are active as long as
- their parent, \c onState, is active. Both \c hurryState and \c jackpotState
- contain two substates that reflect their off and on states.
- Only one substate of \c hurryState and one substate of \c jackpotState
- can be active at a time. Initially, the off substates are active.
-
- \image pinball-statechart-onstate.png
-
- Whenever we enter \c hurryStateOff or \c hurryStateOn, we generate the same
- two events we generate when entering the \c onState state: \c resetLetters and
- \c update. In addition, when we enter the \c hurryStateOn state, we send a delayed
- event, \c goToHurryOff, with a delay of five seconds, marked with \c hurryId.
- This means that after five seconds we just
- switch the state back to \c hurryStateOff without granting the bonus points.
- In this way, we implement the five-second hurry feature of the pinball table.
- We also define transitions from \c hurryStateOff to \c hurryStateOn when the
- \c goToHurryOn event occurs and from \c hurryStateOn to \c hurryStateOff
- when the \c goToHurryOff event occurs. When we exit the \c hurryStateOn
- state, we cancel the possibly pending delayed event that was marked with
- \c hurryId. This is important in case the five seconds have not elapsed yet,
- but players have collected all the five letters in the hurry state. We then
- collect the jackpot and want the pending timer to finish.
-
- The substates of \c jackpotState generate the request to update the state
- of lights. The \c jackpotStateOff state defines the transition to \c jackpotStateOn
- when the \c goForJackpot event occurs. The opposite transition is not
- needed, because when the jackpot gets collected, the corresponding light
- remains lit until the end of game. When a new game starts, the \c jackpotState
- is entered again which causes its initial active substate to be
- \c jackpotStateOff.
-
- In addition, the \c onState state defines one transition in reaction to the
- \c ballOutTriggered event which instructs the machine to go into the \c offState.
- The \c ballOutTriggered event is expected to be an event posted into the state machine
- from outside of the state machine. This event should be generated when
- the ball gets out of playing area of the table. In our example we mimic
- it by the clicking \uicontrol {BALL OUT} button. Posting the event from outside of state
- machine will be shown in the \l{cpp}{C++ code} later on.
-
- \section2 Generating Blinking Lights
-
- The \c workflow state is responsible for generating the blinking lights. The
- generator is defined in its \c lightImpulseGenerator substate. In addition,
- it is responsible for reacting to events that have been posted so far from
- the other parts of the state machine.
-
- \quotefromfile pinball/pinball.scxml
- \skipto workflow
- \printuntil done.state.letter.*
- \dots 20
- \skipto /^\ {16}<\//
- \printuntil done.state.lettersState
- \dots 20
- \skipto /^\ {16}<\//
- \printuntil updateLights
- \dots 20
- \skipto /^\ {16}<\//
- \printuntil updateLightsAccordingToLettersState
- \dots 20
- \skipto /^\ {16}<\//
- \printuntil turnOnLights
- \dots 20
- \skipto /^\ {16}<\//
- \printuntil turnOffLights
- \dots 20
- \skipto /^\ {16}<\//
- \printuntil /^\ {12}<\//
-
- The \c lightImpulseGenerator contains two child states:
- \c lightImpulseOn and \c lightImpulseOff, with only one active at a time.
-
- \image pinball-statechart-workflow.png
-
- Whenever the delayed \c lightImpulse event is being delivered, it immediately
- causes the transition from \c lightImpluseOn into \c lightImpulseOff or vice versa,
- depending on the state the machine was in. In effect, the \c lightImpulseGenerator
- toggles between its on and off state. These transitions are defined inside
- \c lightImpulseGenerator, so it means that during this toggling the machine
- also exits \c lightImpulseGenerator and reenters it immediately afterwards.
- Entering \c lightImpulseGenerator causes the generation of the \c update event.
- The \c update event triggers a targetless transition and posts two other
- events: \c scheduleNewImpulse and \c updateLights. The first one,
- \c scheduleNewImpulse, returns back to the \c lightImpulseGenerator, which
- posts a delayed \c lightImpulse event. After the delay,
- the \c lightImpulse event gets delivered back to \c lightImpulseGenerator,
- which causes it to toggle its substate again. In this way, the machine
- enters into a cycle. The current delay of the \c lightImpulse
- event depends on the state in which the machine was in the time of posting
- the delayed event. If a \c scheduleNewImpulse event occurs on demand, before
- the next delayed \c lightImpulse event gets delivered, we cancel any
- possible pending events.
-
- \quotefromfile pinball/pinball.scxml
- \skipto workflow
- \skipto done.state.letter.*
- \printuntil /^\ {16}<\//
- \printuntil /^\ {16}<\//
-
- Whenever we receive the event the name of which matches the
- \c {done.state.letter.*}, we update the current score.
- When the machine enters the final substate of the \c {letter.C},
- it emits the \c {done.state.letter.C} event. The same happens for
- all other letters we have previously defined. We capture the events for all
- letters, that is why we have used an asterisk
- after a dot in the event name.
- The transition above is targetless, since we just
- listen for matching events and update the internal data accordingly
- without changing any active state. The new score is being
- increased by 1.000 or 10.000 points, depending on whether we currently are
- in \c hurryStateOff or \c hurryStateOn.
- After the score is updated, we generate the \c updateLights event
- in order to immediately update the letters' lights accordingly.
- We do not generate the \c update event here, since we do not want to toggle
- the light impulse now, but just update the lights according to
- the current impulse state.
-
- We also intercept the \c {done.state.lettersState} event,
- which is being generated when all the letters have been hit.
- Depending on which state we are currently in, we grant the players either
- a small bonus of 100.000 or a big one of 1.000.000 (jackpot).
- In addition, we toggle the \c hurryState substate by
- sending the \c goToHurryOn or \c goToHurryOff event.
- When all letters have been collected while in \c hurryStateOn,
- we also raise the \c goForJackpot event which instructs
- the machine to activate the \c jackpotStateOn.
-
- \skipto updateLights
- \printuntil /^\ {16}<\//
- \printuntil updateLightsAccordingToLettersState
- \printuntil /^\ {16}<\//
- \printuntil turnOnLights
- \printuntil /^\ {16}<\//
- \printuntil turnOffLights
- \printuntil /^\ {16}<\//
-
- When we receive the \c updateLights event, we first want to send a
- \c updateScore event outside of the state machine. We pass
- the current values of the \c highScore and \c score variables to the event.
- This event is received by the C++ part.
-
- Next, depending on whether we are in \c jackpotStateOn or \c jackpotStateOff,
- we send the \c turnOnJackpot or the \c turnOffJackpot event,
- which instructs the \c guiControl state to transition to
- \c jackpotLightOn or \c jackpotLightOff, respectively.
-
- When the machine is in \e idle state, (that is, in the off state)
- or when the game is on, but no interaction occurs,
- the \c updateLights event is delivered periodically
- during the game, each time with the \c lightImpulseOn or
- \c lightImpulseOff state toggled. Depending on the
- current state of the light impulse and on the active state (\c offState,
- \c hurryStateOff or \c hurryStateOn), we turn on or off all the lights
- according to the description of the pinball table.
-
- \section1 GUI Part: User Interface Description
-
- The GUI part of the application consists of a \e mainwindow.ui
- file which describes the static user interface of the game.
-
- \target cpp
- \section1 C++ Part: Glue GUI with SCXML
-
- The C++ part of the application consists of a
- \c MainWindow class which glues the GUI part with the SCXML part.
- The class is declared in \e mainwindow.h.
-
- \quotefromfile pinball/mainwindow.h
- \skipto MainWindow
- \printuntil };
-
- The \c MainWindow class holds the pointer to the
- \c {QScxmlStateMachine *m_machine} which is the state machine
- class automatically generated by Qt out of SCMXL file
- and the pointer to the \c {Ui::MainWindow *m_ui} which
- describes the GUI part. It also declares two helper methods.
-
- \quotefromfile pinball/mainwindow.cpp
- \skipto #include
- \printuntil /\}$/
-
- The constructor of the \c MainWindow class
- instantiates the GUI part of the application
- and stores the pointer to the passed \c QScxmlStateMachine.
- It also initializes the GUI part and glues the
- GUI part to the state machine by connecting
- their communication interfaces together.
-
- The \c initAndConnect() method connects
- the state with the corresponding GUI widget by
- binding its activity with the enabling of the widget,
- so that whenever the state is active, its corresponding
- widget is enabled and whenever the state is inactive,
- the widget is disabled. We do that for all lights, targets,
- and description labels.
-
- We also intercept the \c updateScore event sent by the state machine,
- in order to update the score displays with the values
- passed with the event.
-
- The info about hitting any GUI target needs to be passed
- to the state machine and we do that by connecting
- all target buttons' \c clicked signals to the lambda expressions
- which submit the corresponding event into the state machine.
-
- \quotefromfile pinball/main.cpp
- \skipto #include
- \printuntil /\}$/
-
- In the \c main() function in the \e main.cpp file, we instantiate the
- \c app application object, \c Pinball state machine,
- and \c MainWindow GUI class. We initialize and start the state machine,
- show the main window, and execute the application.
-*/
diff --git a/examples/scxml/pinball/main.cpp b/examples/scxml/pinball/main.cpp
deleted file mode 100644
index b2c4046..0000000
--- a/examples/scxml/pinball/main.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#include "mainwindow.h"
-#include "pinball.h"
-
-#include <QApplication>
-
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
-
- Pinball machine;
- MainWindow mainWindow(&machine);
-
- machine.start();
- mainWindow.show();
- return app.exec();
-}
diff --git a/examples/scxml/pinball/mainwindow.cpp b/examples/scxml/pinball/mainwindow.cpp
deleted file mode 100644
index c02f435..0000000
--- a/examples/scxml/pinball/mainwindow.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#include "mainwindow.h"
-#include "ui_mainwindow.h"
-
-#include <QScxmlStateMachine>
-#include <QStringListModel>
-
-QT_USE_NAMESPACE
-
-MainWindow::MainWindow(QScxmlStateMachine *machine, QWidget *parent) :
- QWidget(parent),
- m_ui(new Ui::MainWindow),
- m_machine(machine)
-{
- m_ui->setupUi(this);
-
- // lights
- initAndConnect(QLatin1String("cLightOn"), m_ui->cLabel);
- initAndConnect(QLatin1String("rLightOn"), m_ui->rLabel);
- initAndConnect(QLatin1String("aLightOn"), m_ui->aLabel);
- initAndConnect(QLatin1String("zLightOn"), m_ui->zLabel);
- initAndConnect(QLatin1String("yLightOn"), m_ui->yLabel);
- initAndConnect(QLatin1String("hurryLightOn"), m_ui->hurryLabel);
- initAndConnect(QLatin1String("jackpotLightOn"), m_ui->jackpotLabel);
- initAndConnect(QLatin1String("gameOverLightOn"), m_ui->gameOverLabel);
-
- // help labels
- initAndConnect(QLatin1String("offState"), m_ui->offStateLabel);
- initAndConnect(QLatin1String("hurryStateOff"), m_ui->normalStateLabel);
- initAndConnect(QLatin1String("hurryStateOn"), m_ui->hurryStateLabel);
- initAndConnect(QLatin1String("jackpotStateOn"), m_ui->jackpotStateLabel);
-
- // context enablement
- initAndConnect(QLatin1String("offState"), m_ui->startButton);
- initAndConnect(QLatin1String("onState"), m_ui->cButton);
- initAndConnect(QLatin1String("onState"), m_ui->rButton);
- initAndConnect(QLatin1String("onState"), m_ui->aButton);
- initAndConnect(QLatin1String("onState"), m_ui->zButton);
- initAndConnect(QLatin1String("onState"), m_ui->yButton);
- initAndConnect(QLatin1String("onState"), m_ui->ballOutButton);
-
- // datamodel update
- m_machine->connectToEvent("updateScore", [this] (const QScxmlEvent &event) {
- const QVariant data = event.data();
- const QString highScore = data.toMap().value("highScore").toString();
- m_ui->highScoreLabel->setText(highScore);
- const QString score = data.toMap().value("score").toString();
- m_ui->scoreLabel->setText(score);
- });
-
- // gui interaction
- connect(m_ui->cButton, &QAbstractButton::clicked,
- [this] { m_machine->submitEvent("cLetterTriggered");
- });
- connect(m_ui->rButton, &QAbstractButton::clicked,
- [this] { m_machine->submitEvent("rLetterTriggered");
- });
- connect(m_ui->aButton, &QAbstractButton::clicked,
- [this] { m_machine->submitEvent("aLetterTriggered");
- });
- connect(m_ui->zButton, &QAbstractButton::clicked,
- [this] { m_machine->submitEvent("zLetterTriggered");
- });
- connect(m_ui->yButton, &QAbstractButton::clicked,
- [this] { m_machine->submitEvent("yLetterTriggered");
- });
- connect(m_ui->startButton, &QAbstractButton::clicked,
- [this] { m_machine->submitEvent("startTriggered");
- });
- connect(m_ui->ballOutButton, &QAbstractButton::clicked,
- [this] { m_machine->submitEvent("ballOutTriggered");
- });
-}
-
-MainWindow::~MainWindow()
-{
- delete m_ui;
-}
-
-void MainWindow::initAndConnect(const QString &state, QWidget *widget)
-{
- widget->setEnabled(m_machine->isActive(state));
- m_machine->connectToState(state, widget, &QWidget::setEnabled);
-}
diff --git a/examples/scxml/pinball/mainwindow.h b/examples/scxml/pinball/mainwindow.h
deleted file mode 100644
index fdf51df..0000000
--- a/examples/scxml/pinball/mainwindow.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
-
-#include <QWidget>
-
-QT_BEGIN_NAMESPACE
-namespace Ui {
-class MainWindow;
-}
-class QScxmlStateMachine;
-QT_END_NAMESPACE
-
-
-class MainWindow : public QWidget
-{
- Q_OBJECT
-
-public:
- explicit MainWindow(QScxmlStateMachine *machine, QWidget *parent = nullptr);
- ~MainWindow();
-
-private:
- void initAndConnect(const QString &state, QWidget *widget);
- QT_PREPEND_NAMESPACE(Ui::MainWindow) *m_ui;
- QScxmlStateMachine *m_machine;
-};
-
-#endif // MAINWINDOW_H
diff --git a/examples/scxml/pinball/mainwindow.ui b/examples/scxml/pinball/mainwindow.ui
deleted file mode 100644
index 601c23e..0000000
--- a/examples/scxml/pinball/mainwindow.ui
+++ /dev/null
@@ -1,663 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>MainWindow</class>
- <widget class="QWidget" name="MainWindow">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>476</width>
- <height>458</height>
- </rect>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0" colspan="5">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="highScoreTextLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>HIGH SCORE:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="highScoreLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>0</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="scoreTextLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>SCORE:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="scoreLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>0</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="5" rowspan="7">
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>1</width>
- <height>98</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QToolButton" name="startButton">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>^
-^
-^
-
-S
-T
-A
-R
-T
-
-^
-^
-^</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="1" column="0" colspan="5">
- <widget class="QLabel" name="gameOverLabel">
- <property name="palette">
- <palette>
- <active>
- <colorrole role="WindowText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>255</red>
- <green>0</green>
- <blue>4</blue>
- </color>
- </brush>
- </colorrole>
- </active>
- <inactive>
- <colorrole role="WindowText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>255</red>
- <green>0</green>
- <blue>4</blue>
- </color>
- </brush>
- </colorrole>
- </inactive>
- <disabled>
- <colorrole role="WindowText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>190</red>
- <green>190</green>
- <blue>190</blue>
- </color>
- </brush>
- </colorrole>
- </disabled>
- </palette>
- </property>
- <property name="font">
- <font>
- <pointsize>20</pointsize>
- <weight>75</weight>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>GAME OVER</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="2" column="0" colspan="5">
- <widget class="QLabel" name="jackpotLabel">
- <property name="palette">
- <palette>
- <active>
- <colorrole role="WindowText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>55</red>
- <green>200</green>
- <blue>191</blue>
- </color>
- </brush>
- </colorrole>
- </active>
- <inactive>
- <colorrole role="WindowText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>55</red>
- <green>200</green>
- <blue>191</blue>
- </color>
- </brush>
- </colorrole>
- </inactive>
- <disabled>
- <colorrole role="WindowText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>190</red>
- <green>190</green>
- <blue>190</blue>
- </color>
- </brush>
- </colorrole>
- </disabled>
- </palette>
- </property>
- <property name="font">
- <font>
- <pointsize>20</pointsize>
- <weight>75</weight>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>JACKPOT!</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="3" column="0" colspan="5">
- <widget class="QLabel" name="hurryLabel">
- <property name="palette">
- <palette>
- <active>
- <colorrole role="WindowText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>67</red>
- <green>24</green>
- <blue>97</blue>
- </color>
- </brush>
- </colorrole>
- </active>
- <inactive>
- <colorrole role="WindowText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>67</red>
- <green>24</green>
- <blue>97</blue>
- </color>
- </brush>
- </colorrole>
- </inactive>
- <disabled>
- <colorrole role="WindowText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>190</red>
- <green>190</green>
- <blue>190</blue>
- </color>
- </brush>
- </colorrole>
- </disabled>
- </palette>
- </property>
- <property name="font">
- <font>
- <pointsize>20</pointsize>
- <weight>75</weight>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>HURRY!</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="cLabel">
- <property name="palette">
- <palette>
- <active>
- <colorrole role="WindowText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>7</red>
- <green>0</green>
- <blue>222</blue>
- </color>
- </brush>
- </colorrole>
- </active>
- <inactive>
- <colorrole role="WindowText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>7</red>
- <green>0</green>
- <blue>222</blue>
- </color>
- </brush>
- </colorrole>
- </inactive>
- <disabled>
- <colorrole role="WindowText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>190</red>
- <green>190</green>
- <blue>190</blue>
- </color>
- </brush>
- </colorrole>
- </disabled>
- </palette>
- </property>
- <property name="font">
- <font>
- <pointsize>20</pointsize>
- <weight>75</weight>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>C</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="QLabel" name="rLabel">
- <property name="palette">
- <palette>
- <active>
- <colorrole role="WindowText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>6</red>
- <green>208</green>
- <blue>36</blue>
- </color>
- </brush>
- </colorrole>
- </active>
- <inactive>
- <colorrole role="WindowText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>6</red>
- <green>208</green>
- <blue>36</blue>
- </color>
- </brush>
- </colorrole>
- </inactive>
- <disabled>
- <colorrole role="WindowText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>190</red>
- <green>190</green>
- <blue>190</blue>
- </color>
- </brush>
- </colorrole>
- </disabled>
- </palette>
- </property>
- <property name="font">
- <font>
- <pointsize>20</pointsize>
- <weight>75</weight>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>R</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="4" column="2">
- <widget class="QLabel" name="aLabel">
- <property name="palette">
- <palette>
- <active>
- <colorrole role="WindowText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>238</red>
- <green>17</green>
- <blue>1</blue>
- </color>
- </brush>
- </colorrole>
- </active>
- <inactive>
- <colorrole role="WindowText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>238</red>
- <green>17</green>
- <blue>1</blue>
- </color>
- </brush>
- </colorrole>
- </inactive>
- <disabled>
- <colorrole role="WindowText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>190</red>
- <green>190</green>
- <blue>190</blue>
- </color>
- </brush>
- </colorrole>
- </disabled>
- </palette>
- </property>
- <property name="font">
- <font>
- <pointsize>20</pointsize>
- <weight>75</weight>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>A</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="4" column="3">
- <widget class="QLabel" name="zLabel">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="palette">
- <palette>
- <active>
- <colorrole role="WindowText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>230</red>
- <green>10</green>
- <blue>230</blue>
- </color>
- </brush>
- </colorrole>
- </active>
- <inactive>
- <colorrole role="WindowText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>230</red>
- <green>10</green>
- <blue>230</blue>
- </color>
- </brush>
- </colorrole>
- </inactive>
- <disabled>
- <colorrole role="WindowText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>190</red>
- <green>190</green>
- <blue>190</blue>
- </color>
- </brush>
- </colorrole>
- </disabled>
- </palette>
- </property>
- <property name="font">
- <font>
- <pointsize>20</pointsize>
- <weight>75</weight>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>Z</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="4" column="4">
- <widget class="QLabel" name="yLabel">
- <property name="palette">
- <palette>
- <active>
- <colorrole role="WindowText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>239</red>
- <green>224</green>
- <blue>9</blue>
- </color>
- </brush>
- </colorrole>
- </active>
- <inactive>
- <colorrole role="WindowText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>239</red>
- <green>224</green>
- <blue>9</blue>
- </color>
- </brush>
- </colorrole>
- </inactive>
- <disabled>
- <colorrole role="WindowText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>190</red>
- <green>190</green>
- <blue>190</blue>
- </color>
- </brush>
- </colorrole>
- </disabled>
- </palette>
- </property>
- <property name="font">
- <font>
- <pointsize>20</pointsize>
- <weight>75</weight>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>Y</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="5" column="0">
- <widget class="QPushButton" name="cButton">
- <property name="text">
- <string>C</string>
- </property>
- </widget>
- </item>
- <item row="5" column="1">
- <widget class="QPushButton" name="rButton">
- <property name="text">
- <string>R</string>
- </property>
- </widget>
- </item>
- <item row="5" column="2">
- <widget class="QPushButton" name="aButton">
- <property name="text">
- <string>A</string>
- </property>
- </widget>
- </item>
- <item row="5" column="3">
- <widget class="QPushButton" name="zButton">
- <property name="text">
- <string>Z</string>
- </property>
- </widget>
- </item>
- <item row="5" column="4">
- <widget class="QPushButton" name="yButton">
- <property name="text">
- <string>Y</string>
- </property>
- </widget>
- </item>
- <item row="6" column="0" colspan="5">
- <widget class="QPushButton" name="ballOutButton">
- <property name="text">
- <string>BALL OUT</string>
- </property>
- </widget>
- </item>
- <item row="7" column="0" colspan="6">
- <widget class="QLabel" name="offStateLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Press START to release the ball.</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="8" column="0" colspan="6">
- <widget class="QLabel" name="normalStateLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Try to hit all CRAZY letters. Watch out for ball and avoid BALL OUT since the game will end.</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="9" column="0" colspan="6">
- <widget class="QLabel" name="hurryStateLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Now you need to hurry. Quickly hit all CRAZY letters again to gather the extra JACKPOT bonus. You have only 5 seconds. Otherwise you will need to start from scratch.</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="10" column="0" colspan="6">
- <widget class="QLabel" name="jackpotStateLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>You did that! You have collected JACKPOT! Congratulations. Now you can continue game until you BALL OUT.</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/examples/scxml/pinball/pinball.pro b/examples/scxml/pinball/pinball.pro
deleted file mode 100644
index 549010d..0000000
--- a/examples/scxml/pinball/pinball.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-QT += widgets scxml
-
-CONFIG += c++11
-
-STATECHARTS = pinball.scxml
-
-SOURCES += \
- main.cpp \
- mainwindow.cpp
-
-FORMS += \
- mainwindow.ui
-
-HEADERS += \
- mainwindow.h
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/scxml/pinball
-INSTALLS += target
diff --git a/examples/scxml/pinball/pinball.scxml b/examples/scxml/pinball/pinball.scxml
deleted file mode 100644
index 7589a2c..0000000
--- a/examples/scxml/pinball/pinball.scxml
+++ /dev/null
@@ -1,306 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
--->
-<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0"
- name="Pinball" datamodel="ecmascript">
- <datamodel>
- <data id="highScore" expr="0"/>
- <data id="score" expr="0"/>
- </datamodel>
- <parallel id="global">
- <parallel id="guiControl">
- <state id="cLight">
- <state id="cLightOn">
- <transition event="turnOffC" target="cLightOff"/>
- </state>
- <state id="cLightOff">
- <transition event="turnOnC" target="cLightOn"/>
- </state>
- </state>
- <state id="rLight">
- <state id="rLightOn">
- <transition event="turnOffR" target="rLightOff"/>
- </state>
- <state id="rLightOff">
- <transition event="turnOnR" target="rLightOn"/>
- </state>
- </state>
- <state id="aLight">
- <state id="aLightOn">
- <transition event="turnOffA" target="aLightOff"/>
- </state>
- <state id="aLightOff">
- <transition event="turnOnA" target="aLightOn"/>
- </state>
- </state>
- <state id="zLight">
- <state id="zLightOn">
- <transition event="turnOffZ" target="zLightOff"/>
- </state>
- <state id="zLightOff">
- <transition event="turnOnZ" target="zLightOn"/>
- </state>
- </state>
- <state id="yLight">
- <state id="yLightOn">
- <transition event="turnOffY" target="yLightOff"/>
- </state>
- <state id="yLightOff">
- <transition event="turnOnY" target="yLightOn"/>
- </state>
- </state>
- <state id="hurryLight">
- <state id="hurryLightOn">
- <transition event="turnOffHurry" target="hurryLightOff"/>
- </state>
- <state id="hurryLightOff">
- <transition event="turnOnHurry" target="hurryLightOn"/>
- </state>
- </state>
- <state id="jackpotLight">
- <state id="jackpotLightOn">
- <transition event="turnOffJackpot" target="jackpotLightOff"/>
- </state>
- <state id="jackpotLightOff">
- <transition event="turnOnJackpot" target="jackpotLightOn"/>
- </state>
- </state>
- <state id="gameOverLight">
- <state id="gameOverLightOn">
- <transition event="turnOffGameOver" target="gameOverLightOff"/>
- </state>
- <state id="gameOverLightOff">
- <transition event="turnOnGameOver" target="gameOverLightOn"/>
- </state>
- </state>
- </parallel>
-
- <parallel id="internalState">
- <parallel id="logicalState">
- <state id="letterState">
- <parallel id="lettersState">
- <state id="letter.C">
- <state id="cLetterOff">
- <transition event="cLetterTriggered" cond="In('onState')" target="cLetterOn"/>
- </state>
- <final id="cLetterOn"/>
- </state>
- <state id="letter.R">
- <state id="rLetterOff">
- <transition event="rLetterTriggered" cond="In('onState')" target="rLetterOn"/>
- </state>
- <final id="rLetterOn"/>
- </state>
- <state id="letter.A">
- <state id="aLetterOff">
- <transition event="aLetterTriggered" cond="In('onState')" target="aLetterOn"/>
- </state>
- <final id="aLetterOn"/>
- </state>
- <state id="letter.Z">
- <state id="zLetterOff">
- <transition event="zLetterTriggered" cond="In('onState')" target="zLetterOn"/>
- </state>
- <final id="zLetterOn"/>
- </state>
- <state id="letter.Y">
- <state id="yLetterOff">
- <transition event="yLetterTriggered" cond="In('onState')" target="yLetterOn"/>
- </state>
- <final id="yLetterOn"/>
- </state>
- <transition event="resetLetters" target="lettersState"/>
- </parallel>
- </state>
- <state id="modeState">
- <state id="offState">
- <onentry>
- <if cond="highScore &lt; score">
- <assign location="highScore" expr="score"/>
- </if>
- <raise event="resetLetters"/>
- <raise event="update"/>
- </onentry>
- <transition event="startTriggered" target="onState"/>
- </state>
- <parallel id="onState">
- <onentry>
- <assign location="score" expr="0"/>
- </onentry>
- <state id="hurryState">
- <state id="hurryStateOff">
- <onentry>
- <raise event="resetLetters"/>
- <raise event="update"/>
- </onentry>
- <transition event="goToHurryOn" target="hurryStateOn"/>
- </state>
- <state id="hurryStateOn">
- <onentry>
- <send event="goToHurryOff" id="hurryId" delay="5s"/>
- <raise event="resetLetters"/>
- <raise event="update"/>
- </onentry>
- <transition event="goToHurryOff" target="hurryStateOff"/>
- <onexit>
- <cancel sendid="hurryId"/>
- </onexit>
- </state>
- </state>
- <state id="jackpotState">
- <state id="jackpotStateOff">
- <onentry>
- <raise event="update"/>
- </onentry>
- <transition event="goForJackpot" target="jackpotStateOn"/>
- </state>
- <state id="jackpotStateOn">
- <onentry>
- <raise event="update"/>
- </onentry>
- </state>
- </state>
- <transition event="ballOutTriggered" target="offState"/>
- </parallel>
- </state>
- </parallel>
-
- <state id="workflow">
- <state id="lightImpulseGenerator">
- <state id="lightImpulseOn"/>
- <state id="lightImpulseOff"/>
-
- <onentry>
- <raise event="update"/>
- </onentry>
-
- <transition event="scheduleNewImpulse">
- <cancel sendid="lightId"/>
- <if cond="In('offState')">
- <send event="lightImpulse" id="lightId" delay="1s"/>
- <elseif cond="In('hurryStateOff')"/>
- <send event="lightImpulse" id="lightId" delay="500ms"/>
- <else/>
- <send event="lightImpulse" id="lightId" delay="200ms"/>
- </if>
- </transition>
-
- <transition event="update">
- <raise event="scheduleNewImpulse"/>
- <raise event="updateLights"/>
- </transition>
-
- <transition event="lightImpulse" cond="In('lightImpulseOn')" target="lightImpulseOff"/>
- <transition event="lightImpulse" cond="In('lightImpulseOff')" target="lightImpulseOn"/>
- </state>
-
- <transition event="done.state.letter.*">
- <if cond="In('hurryStateOff')">
- <assign location="score" expr="score + 1000"/>
- <elseif cond="In('hurryStateOn')"/>
- <assign location="score" expr="score + 10000"/>
- </if>
- <raise event="updateLights"/>
- </transition>
-
- <transition event="done.state.lettersState">
- <if cond="In('hurryStateOff')">
- <assign location="score" expr="score + 100000"/>
- <raise event="goToHurryOn"/>
- <elseif cond="In('hurryStateOn')"/>
- <assign location="score" expr="score + 1000000"/>
- <raise event="goToHurryOff"/>
- <raise event="goForJackpot"/>
- </if>
- </transition>
-
- <transition event="updateLights">
- <send event="updateScore">
- <param name="highScore" expr="highScore"/>
- <param name="score" expr="score"/>
- </send>
- <if cond="In('jackpotStateOn')">
- <raise event="turnOnJackpot"/>
- <else/>
- <raise event="turnOffJackpot"/>
- </if>
-
- <if cond="In('lightImpulseOn')">
- <if cond="In('offState')">
- <raise event="turnOnLights"/>
- <raise event="turnOnHurry"/>
- <raise event="turnOnJackpot"/>
- <raise event="turnOnGameOver"/>
- <elseif cond="In('hurryStateOff')"/>
- <raise event="updateLightsAccordingToLettersState"/>
- <raise event="turnOffHurry"/>
- <raise event="turnOffGameOver"/>
- <else/>
- <raise event="turnOnLights"/>
- <raise event="turnOnHurry"/>
- <raise event="turnOffGameOver"/>
- </if>
- <else/>
- <if cond="In('offState')">
- <raise event="turnOffLights"/>
- <raise event="turnOffHurry"/>
- <raise event="turnOffJackpot"/>
- <elseif cond="In('hurryStateOff')"/>
- <raise event="turnOffLights"/>
- <else/>
- <raise event="updateLightsAccordingToLettersState"/>
- </if>
- <raise event="turnOffHurry"/>
- <raise event="turnOffGameOver"/>
- </if>
- </transition>
-
- <transition event="updateLightsAccordingToLettersState">
- <if cond="In('cLetterOn')">
- <raise event="turnOnC"/>
- <else/>
- <raise event="turnOffC"/>
- </if>
- <if cond="In('rLetterOn')">
- <raise event="turnOnR"/>
- <else/>
- <raise event="turnOffR"/>
- </if>
- <if cond="In('aLetterOn')">
- <raise event="turnOnA"/>
- <else/>
- <raise event="turnOffA"/>
- </if>
- <if cond="In('zLetterOn')">
- <raise event="turnOnZ"/>
- <else/>
- <raise event="turnOffZ"/>
- </if>
- <if cond="In('yLetterOn')">
- <raise event="turnOnY"/>
- <else/>
- <raise event="turnOffY"/>
- </if>
- </transition>
-
- <transition event="turnOnLights">
- <raise event="turnOnC"/>
- <raise event="turnOnR"/>
- <raise event="turnOnA"/>
- <raise event="turnOnZ"/>
- <raise event="turnOnY"/>
- </transition>
-
- <transition event="turnOffLights">
- <raise event="turnOffC"/>
- <raise event="turnOffR"/>
- <raise event="turnOffA"/>
- <raise event="turnOffZ"/>
- <raise event="turnOffY"/>
- </transition>
- </state>
- </parallel>
- </parallel>
-</scxml>
diff --git a/examples/scxml/scxml.pro b/examples/scxml/scxml.pro
index 2f80c60..974b0bb 100644
--- a/examples/scxml/scxml.pro
+++ b/examples/scxml/scxml.pro
@@ -6,7 +6,6 @@ qtHaveModule(widgets) {
SUBDIRS += mediaplayer-widgets-static
SUBDIRS += mediaplayer-widgets-dynamic
SUBDIRS += calculator-widgets
- SUBDIRS += pinball
SUBDIRS += sudoku
}