summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@theqtcompany.com>2015-12-17 11:33:08 +0100
committerJarek Kobus <jaroslaw.kobus@theqtcompany.com>2015-12-18 14:30:46 +0000
commit7e44a1fe2726b62c304d3345544645d685e8442f (patch)
treef5af3381b3d509d74acca2178aa8e55d66349d2e /examples
parent91ebbc9cbbe9614650c3480157c61cfc21543626 (diff)
Reorganize pinball example
Change-Id: I61cd8f4309c0fc8cd0ca34722ad30e6133eeb4fc Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/examples.pro3
-rw-r--r--examples/pinball-common/mainwindow.cpp115
-rw-r--r--examples/pinball-common/mainwindow.h68
-rw-r--r--examples/pinball-common/mainwindow.ui550
-rw-r--r--examples/pinball-common/pinball.scxml318
-rw-r--r--examples/pinball-ecmascript-widgets-static/pinball-ecmascript-widgets-static.cpp57
-rw-r--r--examples/pinball-ecmascript-widgets-static/pinball-ecmascript-widgets-static.pro21
-rw-r--r--examples/pinball-widgets-static/doc/src/pinball-widgets-static.qdoc28
-rw-r--r--examples/pinball-widgets-static/pinball-widgets-static.pro21
-rw-r--r--examples/pinball/doc/images/pinball.png (renamed from examples/doc/images/pinball-ecmascript-widgets-static.png)bin44973 -> 44973 bytes
-rw-r--r--examples/pinball/doc/src/pinball.qdoc (renamed from examples/pinball-ecmascript-widgets-static/doc/src/pinball-ecmascript-widgets-static.qdoc)35
-rw-r--r--examples/pinball/main.cpp (renamed from examples/pinball-widgets-static/pinball-widgets-static.cpp)2
-rw-r--r--examples/pinball/mainwindow.cpp (renamed from examples/pinball-ecmascript-common/mainwindow.cpp)0
-rw-r--r--examples/pinball/mainwindow.h (renamed from examples/pinball-ecmascript-common/mainwindow.h)0
-rw-r--r--examples/pinball/mainwindow.ui (renamed from examples/pinball-ecmascript-common/mainwindow.ui)0
-rw-r--r--examples/pinball/pinball.pro21
-rw-r--r--examples/pinball/pinball.scxml (renamed from examples/pinball-ecmascript-common/pinball.scxml)0
17 files changed, 41 insertions, 1198 deletions
diff --git a/examples/examples.pro b/examples/examples.pro
index 9aa8475..20ef6c2 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -6,8 +6,7 @@ qtHaveModule(widgets) {
SUBDIRS += trafficlight-widgets-dynamic
SUBDIRS += mediaplayer-widgets-static
SUBDIRS += mediaplayer-widgets-dynamic
- SUBDIRS += pinball-widgets-static
- SUBDIRS += pinball-ecmascript-widgets-static
+ SUBDIRS += pinball
SUBDIRS += calculator-widgets-static
}
diff --git a/examples/pinball-common/mainwindow.cpp b/examples/pinball-common/mainwindow.cpp
deleted file mode 100644
index d6fa413..0000000
--- a/examples/pinball-common/mainwindow.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mainwindow.h"
-#include "ui_mainwindow.h"
-
-#include <QStringListModel>
-#include <QScxmlStateMachine>
-
-QT_USE_NAMESPACE
-
-MainWindow::MainWindow(QScxmlStateMachine *machine, QWidget *parent) :
- QWidget(parent),
- ui(new Ui::MainWindow),
- m_machine(machine)
-{
- ui->setupUi(this);
-
- // lights
- initAndConnect(QLatin1String("cLightOn"), ui->cLabel);
- initAndConnect(QLatin1String("rLightOn"), ui->rLabel);
- initAndConnect(QLatin1String("aLightOn"), ui->aLabel);
- initAndConnect(QLatin1String("zLightOn"), ui->zLabel);
- initAndConnect(QLatin1String("yLightOn"), ui->yLabel);
- initAndConnect(QLatin1String("hurryLightOn"), ui->hurryLabel);
- initAndConnect(QLatin1String("jackpotLightOn"), ui->jackpotLabel);
-
- // help labels
- initAndConnect(QLatin1String("offState"), ui->offStateLabel);
- initAndConnect(QLatin1String("normalState"), ui->normalStateLabel);
- initAndConnect(QLatin1String("hurryState"), ui->hurryStateLabel);
- initAndConnect(QLatin1String("jackpotStateOn"), ui->jackpotStateLabel);
-
- // context enablement
- initAndConnect(QLatin1String("offState"), ui->startButton);
- initAndConnect(QLatin1String("onState"), ui->cButton);
- initAndConnect(QLatin1String("onState"), ui->rButton);
- initAndConnect(QLatin1String("onState"), ui->aButton);
- initAndConnect(QLatin1String("onState"), ui->zButton);
- initAndConnect(QLatin1String("onState"), ui->yButton);
- initAndConnect(QLatin1String("onState"), ui->ballOutButton);
-
- // gui interaction
- connect(ui->cButton, &QAbstractButton::clicked,
- [this] { m_machine->submitEvent("letterTriggered.C");
- });
- connect(ui->rButton, &QAbstractButton::clicked,
- [this] { m_machine->submitEvent("letterTriggered.R");
- });
- connect(ui->aButton, &QAbstractButton::clicked,
- [this] { m_machine->submitEvent("letterTriggered.A");
- });
- connect(ui->zButton, &QAbstractButton::clicked,
- [this] { m_machine->submitEvent("letterTriggered.Z");
- });
- connect(ui->yButton, &QAbstractButton::clicked,
- [this] { m_machine->submitEvent("letterTriggered.Y");
- });
- connect(ui->startButton, &QAbstractButton::clicked,
- [this] { m_machine->submitEvent("startTriggered");
- });
- connect(ui->ballOutButton, &QAbstractButton::clicked,
- [this] { m_machine->submitEvent("ballOutTriggered");
- });
-}
-
-MainWindow::~MainWindow()
-{
- delete ui;
-}
-
-void MainWindow::initAndConnect(const QString &state, QWidget *widget)
-{
- widget->setEnabled(m_machine->isActive(state));
- m_machine->connect(state, SIGNAL(activeChanged(bool)),
- widget, SLOT(setEnabled(bool)));
-}
-
diff --git a/examples/pinball-common/mainwindow.h b/examples/pinball-common/mainwindow.h
deleted file mode 100644
index 34b6c25..0000000
--- a/examples/pinball-common/mainwindow.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#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 = 0);
- ~MainWindow();
-
-private:
- void initAndConnect(const QString &state, QWidget *widget);
- QT_PREPEND_NAMESPACE(Ui::MainWindow) *ui;
- QScxmlStateMachine *m_machine;
-};
-
-#endif // MAINWINDOW_H
diff --git a/examples/pinball-common/mainwindow.ui b/examples/pinball-common/mainwindow.ui
deleted file mode 100644
index 3f13e26..0000000
--- a/examples/pinball-common/mainwindow.ui
+++ /dev/null
@@ -1,550 +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>421</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Pinball</string>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" 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="0" column="5" rowspan="5">
- <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="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="2" 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="2" 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="2" 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="2" 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="2" 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="3" column="0">
- <widget class="QPushButton" name="cButton">
- <property name="text">
- <string>C</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QPushButton" name="rButton">
- <property name="text">
- <string>R</string>
- </property>
- </widget>
- </item>
- <item row="3" column="2">
- <widget class="QPushButton" name="aButton">
- <property name="text">
- <string>A</string>
- </property>
- </widget>
- </item>
- <item row="3" column="3">
- <widget class="QPushButton" name="zButton">
- <property name="text">
- <string>Z</string>
- </property>
- </widget>
- </item>
- <item row="3" column="4">
- <widget class="QPushButton" name="yButton">
- <property name="text">
- <string>Y</string>
- </property>
- </widget>
- </item>
- <item row="4" column="0" colspan="5">
- <widget class="QPushButton" name="ballOutButton">
- <property name="text">
- <string>BALL OUT</string>
- </property>
- </widget>
- </item>
- <item row="5" 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="6" 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="7" 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="8" 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/pinball-common/pinball.scxml b/examples/pinball-common/pinball.scxml
deleted file mode 100644
index 4fd5661..0000000
--- a/examples/pinball-common/pinball.scxml
+++ /dev/null
@@ -1,318 +0,0 @@
-<?xml version="1.0" ?>
-<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0"
- name="Pinball">
- <parallel id="global">
- <parallel id="internalState">
- <parallel id="logicalState">
- <state id="letterState">
- <parallel id="lettersState">
- <state id="cState" initial="cLetterOff">
- <state id="cLetterOff">
- <transition event="letterTriggered.C" cond="In(onState)" target="cLetterOn"/>
- </state>
- <final id="cLetterOn">
- <onentry>
- <raise event="letterOn"/>
- </onentry>
- </final>
- </state>
- <state id="rState" initial="rLetterOff">
- <state id="rLetterOff">
- <transition event="letterTriggered.R" cond="In(onState)" target="rLetterOn"/>
- </state>
- <final id="rLetterOn">
- <onentry>
- <raise event="letterOn"/>
- </onentry>
- </final>
- </state>
- <state id="aState" initial="aLetterOff">
- <state id="aLetterOff">
- <transition event="letterTriggered.A" cond="In(onState)" target="aLetterOn"/>
- </state>
- <final id="aLetterOn">
- <onentry>
- <raise event="letterOn"/>
- </onentry>
- </final>
- </state>
- <state id="zState" initial="zLetterOff">
- <state id="zLetterOff">
- <transition event="letterTriggered.Z" cond="In(onState)" target="zLetterOn"/>
- </state>
- <final id="zLetterOn">
- <onentry>
- <raise event="letterOn"/>
- </onentry>
- </final>
- </state>
- <state id="yState" initial="yLetterOff">
- <state id="yLetterOff">
- <transition event="letterTriggered.Y" cond="In(onState)" target="yLetterOn"/>
- </state>
- <final id="yLetterOn">
- <onentry>
- <raise event="letterOn"/>
- </onentry>
- </final>
- </state>
- </parallel>
- <transition event="resetLetters" target="lettersState" type="internal"/>
- </state>
- <state id="modeState" initial="offState">
- <state id="offState">
- <onentry>
- <raise event="resetLetters"/>
- <raise event="resetJackpot"/>
- <raise event="update"/>
- </onentry>
- <transition event="startTriggered" target="normalState"/>
- </state>
- <state id="onState">
- <state id="normalState">
- <onentry>
- <raise event="resetLetters"/>
- <raise event="update"/>
- </onentry>
- <transition event="goToHurry" target="hurryState"/>
- </state>
- <state id="hurryState">
- <onentry>
- <send event="hurryTimeout" id="hurried" delay="5s"/>
- <raise event="resetLetters"/>
- <raise event="update"/>
- </onentry>
- <transition event="goToNormal" target="normalState"/>
- <transition event="hurryTimeout" target="normalState"/>
- <onexit>
- <cancel sendid="hurried"/>
- </onexit>
- </state>
- </state>
- </state>
- <state id="jackpotState" initial="jackpotStateOff">
- <state id="jackpotStateOff">
- <onentry>
- <raise event="update"/>
- </onentry>
- <transition event="goForJackpot" target="jackpotStateOn"/>
- </state>
- <state id="jackpotStateOn">
- <onentry>
- <raise event="update"/>
- </onentry>
- <transition event="resetJackpot" target="jackpotStateOff"/>
- </state>
- </state>
- </parallel>
-
- <state id="workflow">
-
- <state id="lightImpulseGenerator">
- <state id="lightImpulseOn"/>
- <state id="lightImpulseOff"/>
-
- <onentry>
- <raise event="updateLights"/>
- <raise event="scheduleNewImpulse"/>
- </onentry>
-
- <transition event="scheduleNewImpulse">
- <cancel sendid="delayed"/>
- <if cond="In(offState)">
- <send event="lightImpulse" id="delayed" delay="1s"/>
- <elseif cond="In(normalState)"/>
- <send event="lightImpulse" id="delayed" delay="500ms"/>
- <else/>
- <send event="lightImpulse" id="delayed" delay="200ms"/>
- </if>
- </transition>
-
- <onexit>
- <cancel sendid="delayed"/>
- </onexit>
-
- <transition event="lightImpulse" cond="In(lightImpulseOn)" target="lightImpulseOff"/>
- <transition event="lightImpulse" cond="In(lightImpulseOff)" target="lightImpulseOn"/>
- </state>
-
- <transition event="letterOn">
- <raise event="updateLights"/>
- </transition>
-
- <transition event="done.state.lettersState">
- <if cond="In(normalState)">
- <raise event="goToHurry"/>
- <elseif cond="In(hurryState)"/>
- <raise event="goToNormal"/>
- <raise event="goForJackpot"/>
- </if>
- </transition>
-
- <transition event="update">
- <raise event="scheduleNewImpulse"/>
- <raise event="updateLights"/>
- </transition>
-
- <transition event="updateLights">
- <if cond="In(jackpotStateOn)">
- <raise event="turnOnJackpot"/>
- <else/>
- <raise event="turnOffJackpot"/>
- </if>
-
- <if cond="In(lightImpulseOn)">
- <if cond="In(offState)">
- <raise event="turnOnC"/>
- <raise event="turnOnR"/>
- <raise event="turnOnA"/>
- <raise event="turnOnZ"/>
- <raise event="turnOnY"/>
- <raise event="turnOnHurry"/>
- <raise event="turnOnJackpot"/>
- <elseif cond="In(normalState)"/>
- <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>
- <raise event="turnOffHurry"/>
- <else/>
- <raise event="turnOnC"/>
- <raise event="turnOnR"/>
- <raise event="turnOnA"/>
- <raise event="turnOnZ"/>
- <raise event="turnOnY"/>
- <raise event="turnOnHurry"/>
- </if>
- <else/>
- <if cond="In(offState)">
- <raise event="turnOffC"/>
- <raise event="turnOffR"/>
- <raise event="turnOffA"/>
- <raise event="turnOffZ"/>
- <raise event="turnOffY"/>
- <raise event="turnOffHurry"/>
- <raise event="turnOffJackpot"/>
- <elseif cond="In(normalState)"/>
- <raise event="turnOffC"/>
- <raise event="turnOffR"/>
- <raise event="turnOffA"/>
- <raise event="turnOffZ"/>
- <raise event="turnOffY"/>
- <else/>
- <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>
- </if>
- <raise event="turnOffHurry"/>
- </if>
- </transition>
-
- </state>
-
- <transition event="ballOutTriggered" cond="In(onState)" target="offState"/>
- </parallel>
-
- <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>
- </parallel>
- </parallel>
-</scxml>
diff --git a/examples/pinball-ecmascript-widgets-static/pinball-ecmascript-widgets-static.cpp b/examples/pinball-ecmascript-widgets-static/pinball-ecmascript-widgets-static.cpp
deleted file mode 100644
index 891cac8..0000000
--- a/examples/pinball-ecmascript-widgets-static/pinball-ecmascript-widgets-static.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "pinball.h"
-#include "../pinball-ecmascript-common/mainwindow.h"
-
-#include <QApplication>
-
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
-
- Pinball machine;
- MainWindow mainWindow(&machine);
- machine.init();
-
- machine.start();
- mainWindow.show();
- return app.exec();
-}
diff --git a/examples/pinball-ecmascript-widgets-static/pinball-ecmascript-widgets-static.pro b/examples/pinball-ecmascript-widgets-static/pinball-ecmascript-widgets-static.pro
deleted file mode 100644
index d8d841d..0000000
--- a/examples/pinball-ecmascript-widgets-static/pinball-ecmascript-widgets-static.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-QT += widgets scxml
-
-CONFIG += c++11
-
-STATECHARTS = ../pinball-ecmascript-common/pinball.scxml
-
-SOURCES += \
- pinball-ecmascript-widgets-static.cpp \
- ../pinball-ecmascript-common/mainwindow.cpp
-
-FORMS += \
- ../pinball-ecmascript-common/mainwindow.ui
-
-HEADERS += \
- ../pinball-ecmascript-common/mainwindow.h
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/scxml/pinball-ecmascript-widgets
-INSTALLS += target
-
-load(qscxmlc)
diff --git a/examples/pinball-widgets-static/doc/src/pinball-widgets-static.qdoc b/examples/pinball-widgets-static/doc/src/pinball-widgets-static.qdoc
deleted file mode 100644
index 1f7c7e1..0000000
--- a/examples/pinball-widgets-static/doc/src/pinball-widgets-static.qdoc
+++ /dev/null
@@ -1,28 +0,0 @@
-/******************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtScxml module.
-**
-** $QT_BEGIN_LICENSE:COMM$
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** $QT_END_LICENSE$
-**
-******************************************************************************/
-
-/*!
- \example pinball-widgets-static
- \title Qt SCXML: Pinball Example (Static)
- \ingroup examples-qtscxml
-
- \brief Demonstrates...
-*/
diff --git a/examples/pinball-widgets-static/pinball-widgets-static.pro b/examples/pinball-widgets-static/pinball-widgets-static.pro
deleted file mode 100644
index 7017e5d..0000000
--- a/examples/pinball-widgets-static/pinball-widgets-static.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-QT += widgets scxml
-
-CONFIG += c++11
-
-STATECHARTS = ../pinball-common/pinball.scxml
-
-SOURCES += \
- pinball-widgets-static.cpp \
- ../pinball-common/mainwindow.cpp
-
-FORMS += \
- ../pinball-common/mainwindow.ui
-
-HEADERS += \
- ../pinball-common/mainwindow.h
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/scxml/pinball-widgets
-INSTALLS += target
-
-load(qscxmlc)
diff --git a/examples/doc/images/pinball-ecmascript-widgets-static.png b/examples/pinball/doc/images/pinball.png
index bbd390e..bbd390e 100644
--- a/examples/doc/images/pinball-ecmascript-widgets-static.png
+++ b/examples/pinball/doc/images/pinball.png
Binary files differ
diff --git a/examples/pinball-ecmascript-widgets-static/doc/src/pinball-ecmascript-widgets-static.qdoc b/examples/pinball/doc/src/pinball.qdoc
index e831744..b4cc827 100644
--- a/examples/pinball-ecmascript-widgets-static/doc/src/pinball-ecmascript-widgets-static.qdoc
+++ b/examples/pinball/doc/src/pinball.qdoc
@@ -20,8 +20,8 @@
******************************************************************************/
/*!
- \example pinball-ecmascript-widgets-static
- \title Qt SCXML: Pinball ECMAScript Example (Static)
+ \example pinball
+ \title Qt SCXML: Pinball Example
\ingroup examples-qtscxml
\brief Demonstrates how the internal
logic of the application can be encapsulated in a scxml file.
@@ -33,9 +33,9 @@
\section1 Pinball Features
- \image pinball-ecmascript-widgets-static.png Screenshot of the Pinball example
+ \image pinball.png Screenshot of the Pinball example
- \e {Pinball EcmaScript Widgets Static Example} mimics a pinball game.
+ \e {Pinball Example} mimics a pinball game.
The targets on the pinball table are substituted here by GUI controls,
mainly by push buttons. Display elements, including current
score, highscore and targets' lights are substituted by labels.
@@ -88,7 +88,7 @@
The pinball.scxml file describes the internal logic implemented for
pinball game.
- \quotefromfile pinball-ecmascript-common/pinball.scxml
+ \quotefromfile pinball/pinball.scxml
\skipto scxml
\printuntil guiControl
\dots 12
@@ -114,7 +114,7 @@
The \c global state in our example doesn't play any other role apart from
collecting its two children and making them both active at a time.
- \quotefromfile pinball-ecmascript-common/pinball.scxml
+ \quotefromfile pinball/pinball.scxml
\skipto guiControl
\printuntil rLight
\dots 16
@@ -173,7 +173,7 @@
will be generated by this state machine inside \c internalState
in reaction to running timers or to external triggers.
- \quotefromfile pinball-ecmascript-common/pinball.scxml
+ \quotefromfile pinball/pinball.scxml
\skipto internalState
\printuntil logicalState
\dots 16
@@ -191,7 +191,7 @@
As mentioned already, \c internalState is always active, and since
it is of a parallel type, \c logicalState and \c workflow children are always active too.
- \quotefromfile pinball-ecmascript-common/pinball.scxml
+ \quotefromfile pinball/pinball.scxml
\skipto logicalState
\printuntil letterState
\dots 20
@@ -206,7 +206,7 @@
it is of parallel type, \c letterState and \c modeState children are always active too.
Now let's look at the first part of it, the \c letterState:
- \quotefromfile pinball-ecmascript-common/pinball.scxml
+ \quotefromfile pinball/pinball.scxml
\skipto letterState
\printuntil lettersState
\printuntil rLetter
@@ -291,7 +291,7 @@
the state machine will automatically post \c {done.state.lettersState} event.
Later, we will make use of it.
- \quotefromfile pinball-ecmascript-common/pinball.scxml
+ \quotefromfile pinball/pinball.scxml
\skipto modeState
\printuntil offState
\dots 24
@@ -306,7 +306,7 @@
is not yet started or when it is over,
while \c onState represents the logic appropriate for the active game.
- \quotefromfile pinball-ecmascript-common/pinball.scxml
+ \quotefromfile pinball/pinball.scxml
\skipto offState
\printuntil /^\ {20}<\//
@@ -369,7 +369,7 @@
it by the pressing \uicontrol {BALL OUT} button. Posting the event from outside of state
machine will be shown in \l {cpp} {cpp code} later on.
- \quotefromfile pinball-ecmascript-common/pinball.scxml
+ \quotefromfile pinball/pinball.scxml
\skipto workflow
\printuntil letterOn
\dots 20
@@ -408,7 +408,7 @@
event may occur on demand, before the next delayed \c lightImpulse
event gets delivered, so for that case we cancel any possible pending event.
- \quotefromfile pinball-ecmascript-common/pinball.scxml
+ \quotefromfile pinball/pinball.scxml
\skipto workflow
\skipto letterOn
\printuntil /^\ {16}<\//
@@ -495,7 +495,7 @@
MainWindow class which glues the GUI part with the SCXML part.
The class is declared in mainwindow.h.
- \quotefromfile pinball-ecmascript-common/mainwindow.h
+ \quotefromfile pinball/mainwindow.h
\skipto Pinball
\printuntil };
@@ -505,7 +505,7 @@
and the pointer to the \c {Ui::MainWindow *m_ui} which
describes the GUI part. It also declares two helper methods.
- \quotefromfile pinball-ecmascript-common/mainwindow.cpp
+ \quotefromfile pinball/mainwindow.cpp
\skipto #include
\printuntil /}$/
@@ -533,11 +533,12 @@
all target buttons' \c clicked signals to the lambda expressions
which submit corresponding event into the state machine.
- \quotefromfile pinball-ecmascript-widgets-static/pinball-ecmascript-widgets-static.cpp
+ \quotefromfile pinball/main.cpp
\skipto #include
\printuntil /}$/
- Finally, inside the main() function we instantiate the
+ Finally, there is main.cpp file with the main() function
+ inside which 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/pinball-widgets-static/pinball-widgets-static.cpp b/examples/pinball/main.cpp
index a342b97..9af9643 100644
--- a/examples/pinball-widgets-static/pinball-widgets-static.cpp
+++ b/examples/pinball/main.cpp
@@ -39,7 +39,7 @@
****************************************************************************/
#include "pinball.h"
-#include "../pinball-common/mainwindow.h"
+#include "mainwindow.h"
#include <QApplication>
diff --git a/examples/pinball-ecmascript-common/mainwindow.cpp b/examples/pinball/mainwindow.cpp
index ea5995d..ea5995d 100644
--- a/examples/pinball-ecmascript-common/mainwindow.cpp
+++ b/examples/pinball/mainwindow.cpp
diff --git a/examples/pinball-ecmascript-common/mainwindow.h b/examples/pinball/mainwindow.h
index 26a24a5..26a24a5 100644
--- a/examples/pinball-ecmascript-common/mainwindow.h
+++ b/examples/pinball/mainwindow.h
diff --git a/examples/pinball-ecmascript-common/mainwindow.ui b/examples/pinball/mainwindow.ui
index cc25176..cc25176 100644
--- a/examples/pinball-ecmascript-common/mainwindow.ui
+++ b/examples/pinball/mainwindow.ui
diff --git a/examples/pinball/pinball.pro b/examples/pinball/pinball.pro
new file mode 100644
index 0000000..2cb002d
--- /dev/null
+++ b/examples/pinball/pinball.pro
@@ -0,0 +1,21 @@
+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
+
+load(qscxmlc)
diff --git a/examples/pinball-ecmascript-common/pinball.scxml b/examples/pinball/pinball.scxml
index 92fad64..92fad64 100644
--- a/examples/pinball-ecmascript-common/pinball.scxml
+++ b/examples/pinball/pinball.scxml