aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
authorKarsten Heimrich <karsten.heimrich@qt.io>2020-08-14 13:04:22 +0200
committerKarsten Heimrich <karsten.heimrich@qt.io>2020-08-23 20:56:31 +0200
commitae36d94c2f385e272ae25fcd0fe780edb70cf7d9 (patch)
tree5812b2a57c9f355313755b95a09358f9c19cd7d4 /src/imports
parent48b4c1f450109b148f03f62574d78b460859c4a1 (diff)
Remove qml statemachine plugin from qtdeclarative
Task-number: QTBUG-80316 Change-Id: I584b699a1eec88117f343870bd2cd01075da64f7 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/CMakeLists.txt3
-rw-r--r--src/imports/imports.pro1
-rw-r--r--src/imports/statemachine/CMakeLists.txt30
-rw-r--r--src/imports/statemachine/childrenprivate.h188
-rw-r--r--src/imports/statemachine/finalstate.cpp85
-rw-r--r--src/imports/statemachine/finalstate.h74
-rw-r--r--src/imports/statemachine/plugin.cpp70
-rw-r--r--src/imports/statemachine/qmldir4
-rw-r--r--src/imports/statemachine/signaltransition.cpp349
-rw-r--r--src/imports/statemachine/signaltransition.h115
-rw-r--r--src/imports/statemachine/state.cpp240
-rw-r--r--src/imports/statemachine/state.h78
-rw-r--r--src/imports/statemachine/statemachine.cpp234
-rw-r--r--src/imports/statemachine/statemachine.h93
-rw-r--r--src/imports/statemachine/statemachine.pro27
-rw-r--r--src/imports/statemachine/statemachineforeign.h84
-rw-r--r--src/imports/statemachine/timeouttransition.cpp114
-rw-r--r--src/imports/statemachine/timeouttransition.h77
18 files changed, 0 insertions, 1866 deletions
diff --git a/src/imports/CMakeLists.txt b/src/imports/CMakeLists.txt
index 9970e5a39d..d2c8e5694f 100644
--- a/src/imports/CMakeLists.txt
+++ b/src/imports/CMakeLists.txt
@@ -16,9 +16,6 @@ endif()
if(QT_FEATURE_settings)
add_subdirectory(settings)
endif()
-if(QT_FEATURE_statemachine)
- add_subdirectory(statemachine)
-endif()
if(TARGET Qt::Quick)
add_subdirectory(labsanimation)
add_subdirectory(layouts)
diff --git a/src/imports/imports.pro b/src/imports/imports.pro
index 0ea9395179..c97da5809f 100644
--- a/src/imports/imports.pro
+++ b/src/imports/imports.pro
@@ -11,7 +11,6 @@ qtConfig(qml-itemmodel): SUBDIRS += folderlistmodel
qtConfig(qml-worker-script): SUBDIRS += workerscript
qtHaveModule(sql): SUBDIRS += localstorage
qtConfig(settings): SUBDIRS += settings
-qtConfig(statemachine): SUBDIRS += statemachine
qtHaveModule(quick) {
QT_FOR_CONFIG += quick-private
diff --git a/src/imports/statemachine/CMakeLists.txt b/src/imports/statemachine/CMakeLists.txt
deleted file mode 100644
index 232f3f28d5..0000000000
--- a/src/imports/statemachine/CMakeLists.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# Generated from statemachine.pro.
-
-#####################################################################
-## qtqmlstatemachine Plugin:
-#####################################################################
-
-qt_add_qml_module(qtqmlstatemachine
- URI "QtQml.StateMachine"
- VERSION "${CMAKE_PROJECT_VERSION}"
- CLASSNAME QtQmlStateMachinePlugin
- SKIP_TYPE_REGISTRATION
- GENERATE_QMLTYPES
- SOURCES
- childrenprivate.h
- finalstate.cpp finalstate.h
- plugin.cpp
- signaltransition.cpp signaltransition.h
- state.cpp state.h
- statemachine.cpp statemachine.h
- statemachineforeign.h
- timeouttransition.cpp timeouttransition.h
- PUBLIC_LIBRARIES
- Qt::CorePrivate
- Qt::QmlPrivate
-)
-
-#### Keys ignored in scope 1:.:.:statemachine.pro:<TRUE>:
-# CXX_MODULE = "qml"
-# QML_IMPORT_VERSION = "$$QT_VERSION"
-# TARGETPATH = "QtQml/StateMachine"
diff --git a/src/imports/statemachine/childrenprivate.h b/src/imports/statemachine/childrenprivate.h
deleted file mode 100644
index 2dcecd6531..0000000000
--- a/src/imports/statemachine/childrenprivate.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Ford Motor Company
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQMLCHILDRENPRIVATE_H
-#define QQMLCHILDRENPRIVATE_H
-
-#include <QAbstractState>
-#include <QAbstractTransition>
-#include <QStateMachine>
-#include <QQmlInfo>
-#include <QQmlListProperty>
-
-enum class ChildrenMode {
- None = 0x0,
- State = 0x1,
- Transition = 0x2,
- StateOrTransition = State | Transition
-};
-
-template<typename T>
-static T *parentObject(QQmlListProperty<QObject> *prop) { return static_cast<T *>(prop->object); }
-
-template<class T, ChildrenMode Mode>
-struct ParentHandler
-{
- static bool unparentItem(QQmlListProperty<QObject> *prop, QObject *oldItem);
- static bool parentItem(QQmlListProperty<QObject> *prop, QObject *item);
-};
-
-template<class T>
-struct ParentHandler<T, ChildrenMode::None>
-{
- static bool unparentItem(QQmlListProperty<QObject> *, QObject *) { return true; }
- static bool parentItem(QQmlListProperty<QObject> *, QObject *) { return true; }
-};
-
-template<class T>
-struct ParentHandler<T, ChildrenMode::State>
-{
- static bool parentItem(QQmlListProperty<QObject> *prop, QObject *item)
- {
- if (QAbstractState *state = qobject_cast<QAbstractState *>(item)) {
- state->setParent(parentObject<T>(prop));
- return true;
- }
- return false;
- }
-
- static bool unparentItem(QQmlListProperty<QObject> *, QObject *oldItem)
- {
- if (QAbstractState *state = qobject_cast<QAbstractState *>(oldItem)) {
- state->setParent(nullptr);
- return true;
- }
- return false;
- }
-};
-
-template<class T>
-struct ParentHandler<T, ChildrenMode::Transition>
-{
- static bool parentItem(QQmlListProperty<QObject> *prop, QObject *item)
- {
- if (QAbstractTransition *trans = qobject_cast<QAbstractTransition *>(item)) {
- parentObject<T>(prop)->addTransition(trans);
- return true;
- }
- return false;
- }
-
- static bool unparentItem(QQmlListProperty<QObject> *prop, QObject *oldItem)
- {
- if (QAbstractTransition *trans = qobject_cast<QAbstractTransition *>(oldItem)) {
- parentObject<T>(prop)->removeTransition(trans);
- return true;
- }
- return false;
- }
-};
-
-template<class T>
-struct ParentHandler<T, ChildrenMode::StateOrTransition>
-{
- static bool parentItem(QQmlListProperty<QObject> *prop, QObject *oldItem)
- {
- return ParentHandler<T, ChildrenMode::State>::parentItem(prop, oldItem)
- || ParentHandler<T, ChildrenMode::Transition>::parentItem(prop, oldItem);
- }
-
- static bool unparentItem(QQmlListProperty<QObject> *prop, QObject *oldItem)
- {
- return ParentHandler<T, ChildrenMode::State>::unparentItem(prop, oldItem)
- || ParentHandler<T, ChildrenMode::Transition>::unparentItem(prop, oldItem);
- }
-};
-
-template <class T, ChildrenMode Mode>
-class ChildrenPrivate
-{
-public:
- static void append(QQmlListProperty<QObject> *prop, QObject *item)
- {
- Handler::parentItem(prop, item);
- static_cast<Self *>(prop->data)->children.append(item);
- emit parentObject<T>(prop)->childrenChanged();
- }
-
- static int count(QQmlListProperty<QObject> *prop)
- {
- return static_cast<Self *>(prop->data)->children.count();
- }
-
- static QObject *at(QQmlListProperty<QObject> *prop, int index)
- {
- return static_cast<Self *>(prop->data)->children.at(index);
- }
-
- static void clear(QQmlListProperty<QObject> *prop)
- {
- auto &children = static_cast<Self *>(prop->data)->children;
- for (QObject *oldItem : qAsConst(children))
- Handler::unparentItem(prop, oldItem);
-
- children.clear();
- emit parentObject<T>(prop)->childrenChanged();
- }
-
- static void replace(QQmlListProperty<QObject> *prop, int index, QObject *item)
- {
- auto &children = static_cast<Self *>(prop->data)->children;
-
- Handler::unparentItem(prop, children.at(index));
- Handler::parentItem(prop, item);
-
- children.replace(index, item);
- emit parentObject<T>(prop)->childrenChanged();
- }
-
- static void removeLast(QQmlListProperty<QObject> *prop)
- {
- Handler::unparentItem(prop, static_cast<Self *>(prop->data)->children.takeLast());
- emit parentObject<T>(prop)->childrenChanged();
- }
-
-private:
- using Self = ChildrenPrivate<T, Mode>;
- using Handler = ParentHandler<T, Mode>;
-
- QList<QObject *> children;
-};
-
-#endif
diff --git a/src/imports/statemachine/finalstate.cpp b/src/imports/statemachine/finalstate.cpp
deleted file mode 100644
index 4d4c6b2cc7..0000000000
--- a/src/imports/statemachine/finalstate.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Ford Motor Company
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "finalstate.h"
-
-#include <QQmlContext>
-#include <QQmlEngine>
-#include <QQmlInfo>
-
-FinalState::FinalState(QState *parent)
- : QFinalState(parent)
-{
-}
-
-QQmlListProperty<QObject> FinalState::children()
-{
- return QQmlListProperty<QObject>(this, &m_children,
- m_children.append, m_children.count, m_children.at,
- m_children.clear, m_children.replace, m_children.removeLast);
-}
-
-/*!
- \qmltype FinalState
- \inqmlmodule QtQml.StateMachine
- \inherits QAbstractState
- \ingroup statemachine-qmltypes
- \since 5.4
-
- \brief Provides a final state.
-
-
- A final state is used to communicate that (part of) a StateMachine has
- finished its work. When a final top-level state is entered, the state
- machine's \l{State::finished}{finished}() signal is emitted. In
- general, when a final substate (a child of a State) is entered, the parent
- state's \l{State::finished}{finished}() signal is emitted. FinalState
- is part of \l{The Declarative State Machine Framework}.
-
- To use a final state, you create a FinalState object and add a transition
- to it from another state.
-
- \section1 Example Usage
-
- \snippet qml/statemachine/finalstate.qml document
-
- \clearfloat
-
- \sa StateMachine, State
-*/
diff --git a/src/imports/statemachine/finalstate.h b/src/imports/statemachine/finalstate.h
deleted file mode 100644
index fef0e9c092..0000000000
--- a/src/imports/statemachine/finalstate.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Ford Motor Company
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQMLFINALSTATE_H
-#define QQMLFINALSTATE_H
-
-#include "childrenprivate.h"
-#include "statemachine.h"
-
-#include <QtCore/QFinalState>
-#include <QtQml/QQmlListProperty>
-#include <QtQml/qqml.h>
-
-
-QT_BEGIN_NAMESPACE
-
-class FinalState : public QFinalState
-{
- Q_OBJECT
- Q_PROPERTY(QQmlListProperty<QObject> children READ children NOTIFY childrenChanged)
- Q_CLASSINFO("DefaultProperty", "children")
- QML_ELEMENT
- QML_ADDED_IN_VERSION(1, 0)
-
-public:
- explicit FinalState(QState *parent = 0);
-
- QQmlListProperty<QObject> children();
-
-Q_SIGNALS:
- void childrenChanged();
-
-private:
- ChildrenPrivate<FinalState, ChildrenMode::State> m_children;
-};
-
-QT_END_NAMESPACE
-#endif
diff --git a/src/imports/statemachine/plugin.cpp b/src/imports/statemachine/plugin.cpp
deleted file mode 100644
index c370504029..0000000000
--- a/src/imports/statemachine/plugin.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Ford Motor Company
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "finalstate.h"
-#include "signaltransition.h"
-#include "state.h"
-#include "statemachine.h"
-#include "timeouttransition.h"
-#include "statemachineforeign.h"
-
-#include <QHistoryState>
-#include <QQmlExtensionPlugin>
-#include <qqml.h>
-
-extern void qml_register_types_QtQml_StateMachine();
-
-QT_BEGIN_NAMESPACE
-
-class QtQmlStateMachinePlugin : public QQmlEngineExtensionPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid)
-
-public:
- QtQmlStateMachinePlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent)
- {
- volatile auto registration = &qml_register_types_QtQml_StateMachine;
- Q_UNUSED(registration);
- }
-};
-
-QT_END_NAMESPACE
-
-#include "plugin.moc"
diff --git a/src/imports/statemachine/qmldir b/src/imports/statemachine/qmldir
deleted file mode 100644
index 8bc3831208..0000000000
--- a/src/imports/statemachine/qmldir
+++ /dev/null
@@ -1,4 +0,0 @@
-module QtQml.StateMachine
-plugin qtqmlstatemachine
-classname QtQmlStateMachinePlugin
-typeinfo plugins.qmltypes
diff --git a/src/imports/statemachine/signaltransition.cpp b/src/imports/statemachine/signaltransition.cpp
deleted file mode 100644
index c600081820..0000000000
--- a/src/imports/statemachine/signaltransition.cpp
+++ /dev/null
@@ -1,349 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Ford Motor Company
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "signaltransition.h"
-
-#include <QStateMachine>
-#include <QMetaProperty>
-#include <QQmlInfo>
-#include <QQmlEngine>
-#include <QQmlContext>
-#include <QQmlExpression>
-
-#include <private/qv4qobjectwrapper_p.h>
-#include <private/qjsvalue_p.h>
-#include <private/qv4scopedvalue_p.h>
-#include <private/qqmlcontext_p.h>
-
-SignalTransition::SignalTransition(QState *parent)
- : QSignalTransition(this, SIGNAL(invokeYourself()), parent), m_complete(false), m_signalExpression(nullptr)
-{
- connect(this, SIGNAL(signalChanged()), SIGNAL(qmlSignalChanged()));
-}
-
-bool SignalTransition::eventTest(QEvent *event)
-{
- Q_ASSERT(event);
- if (!QSignalTransition::eventTest(event))
- return false;
-
- if (m_guard.isEmpty())
- return true;
-
- QQmlContext *outerContext = QQmlEngine::contextForObject(this);
- QQmlContext context(outerContext);
- QQmlContextData::get(&context)->setImports(QQmlContextData::get(outerContext)->imports());
-
- QStateMachine::SignalEvent *e = static_cast<QStateMachine::SignalEvent*>(event);
-
- // Set arguments as context properties
- int count = e->arguments().count();
- QMetaMethod metaMethod = e->sender()->metaObject()->method(e->signalIndex());
- const auto parameterNames = metaMethod.parameterNames();
- for (int i = 0; i < count; i++)
- context.setContextProperty(parameterNames[i], QVariant::fromValue(e->arguments().at(i)));
-
- QQmlExpression expr(m_guard, &context, this);
- QVariant result = expr.evaluate();
-
- return result.toBool();
-}
-
-void SignalTransition::onTransition(QEvent *event)
-{
- if (m_signalExpression) {
- QStateMachine::SignalEvent *e = static_cast<QStateMachine::SignalEvent*>(event);
- m_signalExpression->evaluate(e->arguments());
- }
- QSignalTransition::onTransition(event);
-}
-
-const QJSValue& SignalTransition::signal()
-{
- return m_signal;
-}
-
-void SignalTransition::setSignal(const QJSValue &signal)
-{
- if (m_signal.strictlyEquals(signal))
- return;
-
- QV4::ExecutionEngine *jsEngine = QQmlEngine::contextForObject(this)->engine()->handle();
- QV4::Scope scope(jsEngine);
-
- QObject *sender;
- QMetaMethod signalMethod;
-
- m_signal = signal;
- QJSValuePrivate::manageStringOnV4Heap(jsEngine, &m_signal);
-
- QV4::ScopedValue value(scope, QJSValuePrivate::asReturnedValue(&m_signal));
-
- // Did we get the "slot" that can be used to invoke the signal?
- if (QV4::QObjectMethod *signalSlot = value->as<QV4::QObjectMethod>()) {
- sender = signalSlot->object();
- Q_ASSERT(sender);
- signalMethod = sender->metaObject()->method(signalSlot->methodIndex());
- } else if (QV4::QmlSignalHandler *signalObject = value->as<QV4::QmlSignalHandler>()) { // or did we get the signal object (the one with the connect()/disconnect() functions) ?
- sender = signalObject->object();
- Q_ASSERT(sender);
- signalMethod = sender->metaObject()->method(signalObject->signalIndex());
- } else {
- qmlWarning(this) << tr("Specified signal does not exist.");
- return;
- }
-
- QSignalTransition::setSenderObject(sender);
- QSignalTransition::setSignal(signalMethod.methodSignature());
-
- connectTriggered();
-}
-
-QQmlScriptString SignalTransition::guard() const
-{
- return m_guard;
-}
-
-void SignalTransition::setGuard(const QQmlScriptString &guard)
-{
- if (m_guard == guard)
- return;
-
- m_guard = guard;
- emit guardChanged();
-}
-
-void SignalTransition::invoke()
-{
- emit invokeYourself();
-}
-
-void SignalTransition::connectTriggered()
-{
- if (!m_complete || !m_compilationUnit)
- return;
-
- QObject *target = senderObject();
- QQmlData *ddata = QQmlData::get(this);
- QQmlRefPointer<QQmlContextData> ctxtdata = ddata ? ddata->outerContext : nullptr;
-
- Q_ASSERT(m_bindings.count() == 1);
- const QV4::CompiledData::Binding *binding = m_bindings.at(0);
- Q_ASSERT(binding->type == QV4::CompiledData::Binding::Type_Script);
-
- QV4::ExecutionEngine *jsEngine = QQmlEngine::contextForObject(this)->engine()->handle();
- QV4::Scope scope(jsEngine);
- QV4::Scoped<QV4::QObjectMethod> qobjectSignal(scope, QJSValuePrivate::asReturnedValue(&m_signal));
- Q_ASSERT(qobjectSignal);
- QMetaMethod metaMethod = target->metaObject()->method(qobjectSignal->methodIndex());
- int signalIndex = QMetaObjectPrivate::signalIndex(metaMethod);
-
- auto f = m_compilationUnit->runtimeFunctions[binding->value.compiledScriptIndex];
- if (ctxtdata) {
- QQmlRefPointer<QQmlBoundSignalExpression> expression(
- new QQmlBoundSignalExpression(target, signalIndex, ctxtdata, this, f),
- QQmlRefPointer<QQmlBoundSignalExpression>::Adopt);
- expression->setNotifyOnValueChanged(false);
- m_signalExpression = expression;
- } else {
- m_signalExpression.adopt(nullptr);
- }
-}
-
-void SignalTransitionParser::verifyBindings(const QQmlRefPointer<QV4::ExecutableCompilationUnit> &compilationUnit, const QList<const QV4::CompiledData::Binding *> &props)
-{
- for (int ii = 0; ii < props.count(); ++ii) {
- const QV4::CompiledData::Binding *binding = props.at(ii);
-
- QString propName = compilationUnit->stringAt(binding->propertyNameIndex);
-
- if (propName != QLatin1String("onTriggered")) {
- error(props.at(ii), SignalTransition::tr("Cannot assign to non-existent property \"%1\"").arg(propName));
- return;
- }
-
- if (binding->type != QV4::CompiledData::Binding::Type_Script) {
- error(binding, SignalTransition::tr("SignalTransition: script expected"));
- return;
- }
- }
-}
-
-void SignalTransitionParser::applyBindings(
- QObject *object, const QQmlRefPointer<QV4::ExecutableCompilationUnit> &compilationUnit,
- const QList<const QV4::CompiledData::Binding *> &bindings)
-{
- SignalTransition *st = qobject_cast<SignalTransition*>(object);
- st->m_compilationUnit = compilationUnit;
- st->m_bindings = bindings;
-}
-
-/*!
- \qmltype QAbstractTransition
- \inqmlmodule QtQml.StateMachine
- \omit
- \ingroup statemachine-qmltypes
- \endomit
- \since 5.4
-
- \brief The QAbstractTransition type is the base type of transitions between QAbstractState objects.
-
- The QAbstractTransition type is the abstract base type of transitions
- between states (QAbstractState objects) of a StateMachine.
- QAbstractTransition is part of \l{The Declarative State Machine Framework}.
-
- The sourceState() property has the source of the transition. The
- targetState and targetStates properties return the target(s) of the
- transition.
-
- The triggered() signal is emitted when the transition has been triggered.
-
- Do not use QAbstractTransition directly; use SignalTransition or
- TimeoutTransition instead.
-
- \sa SignalTransition, TimeoutTransition
-*/
-
-/*!
- \qmlproperty bool QAbstractTransition::sourceState
- \readonly sourceState
-
- \brief The source state (parent) of this transition.
-*/
-
-/*!
- \qmlproperty QAbstractState QAbstractTransition::targetState
-
- \brief The target state of this transition.
-
- If a transition has no target state, the transition may still be
- triggered, but this will not cause the state machine's configuration to
- change (i.e. the current state will not be exited and re-entered).
-*/
-
-/*!
- \qmlproperty list<QAbstractState> QAbstractTransition::targetStates
-
- \brief The target states of this transition.
-
- If multiple states are specified, they all must be descendants of the
- same parallel group state.
-*/
-
-/*!
- \qmlsignal QAbstractTransition::triggered()
-
- This signal is emitted when the transition has been triggered.
-*/
-
-/*!
- \qmltype QSignalTransition
- \inqmlmodule QtQml.StateMachine
- \inherits QAbstractTransition
- \omit
- \ingroup statemachine-qmltypes
- \endomit
- \since 5.4
-
- \brief The QSignalTransition type provides a transition based on a Qt signal.
-
- Do not use QSignalTransition directly; use SignalTransition or
- TimeoutTransition instead.
-
- \sa SignalTransition, TimeoutTransition
-*/
-
-/*!
- \qmlproperty string QSignalTransition::signal
-
- \brief The signal which is associated with this signal transition.
-*/
-
-/*!
- \qmlproperty QObject QSignalTransition::senderObject
-
- \brief The sender object which is associated with this signal transition.
-*/
-
-
-/*!
- \qmltype SignalTransition
- \inqmlmodule QtQml.StateMachine
- \inherits QSignalTransition
- \ingroup statemachine-qmltypes
- \since 5.4
-
- \brief The SignalTransition type provides a transition based on a Qt signal.
-
- SignalTransition is part of \l{The Declarative State Machine Framework}.
-
- \section1 Example Usage
-
- \snippet qml/statemachine/signaltransition.qml document
-
- \clearfloat
-
- \sa StateMachine, FinalState, TimeoutTransition
-*/
-
-/*!
- \qmlproperty signal SignalTransition::signal
-
- \brief The signal which is associated with this signal transition.
-
- \snippet qml/statemachine/signaltransitionsignal.qml document
-*/
-
-/*!
- \qmlproperty bool SignalTransition::guard
-
- Guard conditions affect the behavior of a state machine by enabling
- transitions only when they evaluate to true and disabling them when
- they evaluate to false.
-
- When the signal associated with this signal transition is emitted the
- guard condition is evaluated. In the guard condition the arguments
- of the signal can be used as demonstrated in the example below.
-
- \snippet qml/statemachine/guardcondition.qml document
-
- \sa signal
-*/
-
-#include "moc_signaltransition.cpp"
diff --git a/src/imports/statemachine/signaltransition.h b/src/imports/statemachine/signaltransition.h
deleted file mode 100644
index 7cef80bb4c..0000000000
--- a/src/imports/statemachine/signaltransition.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Ford Motor Company
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SIGNALTRANSITION_H
-#define SIGNALTRANSITION_H
-
-#include <QtCore/QSignalTransition>
-#include <QtCore/QVariant>
-#include <QtQml/QJSValue>
-
-#include <QtQml/qqmlscriptstring.h>
-#include <QtQml/qqmlparserstatus.h>
-#include <private/qqmlcustomparser_p.h>
-#include <private/qqmlrefcount_p.h>
-#include <private/qqmlboundsignal_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class SignalTransition : public QSignalTransition, public QQmlParserStatus
-{
- Q_OBJECT
- Q_INTERFACES(QQmlParserStatus)
- Q_PROPERTY(QJSValue signal READ signal WRITE setSignal NOTIFY qmlSignalChanged)
- Q_PROPERTY(QQmlScriptString guard READ guard WRITE setGuard NOTIFY guardChanged)
- QML_ELEMENT
- QML_ADDED_IN_VERSION(1, 0)
-
-public:
- explicit SignalTransition(QState *parent = nullptr);
-
- QQmlScriptString guard() const;
- void setGuard(const QQmlScriptString &guard);
-
- bool eventTest(QEvent *event) override;
- void onTransition(QEvent *event) override;
-
- const QJSValue &signal();
- void setSignal(const QJSValue &signal);
-
- Q_INVOKABLE void invoke();
-
-Q_SIGNALS:
- void guardChanged();
- void invokeYourself();
- /*!
- * \internal
- */
- void qmlSignalChanged();
-
-private:
- void classBegin() override { m_complete = false; }
- void componentComplete() override { m_complete = true; connectTriggered(); }
- void connectTriggered();
-
- friend class SignalTransitionParser;
- QJSValue m_signal;
- QQmlScriptString m_guard;
- bool m_complete;
- QQmlRefPointer<QV4::ExecutableCompilationUnit> m_compilationUnit;
- QList<const QV4::CompiledData::Binding *> m_bindings;
- QQmlRefPointer<QQmlBoundSignalExpression> m_signalExpression;
-};
-
-class SignalTransitionParser : public QQmlCustomParser
-{
-public:
- void verifyBindings(const QQmlRefPointer<QV4::ExecutableCompilationUnit> &compilationUnit, const QList<const QV4::CompiledData::Binding *> &props) override;
- void applyBindings(QObject *object, const QQmlRefPointer<QV4::ExecutableCompilationUnit> &compilationUnit, const QList<const QV4::CompiledData::Binding *> &bindings) override;
-};
-
-template<>
-inline QQmlCustomParser *qmlCreateCustomParser<SignalTransition>()
-{
- return new SignalTransitionParser;
-}
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/imports/statemachine/state.cpp b/src/imports/statemachine/state.cpp
deleted file mode 100644
index ff0f55f197..0000000000
--- a/src/imports/statemachine/state.cpp
+++ /dev/null
@@ -1,240 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Ford Motor Company
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "state.h"
-
-#include <QQmlContext>
-#include <QQmlEngine>
-#include <QQmlInfo>
-
-State::State(QState *parent)
- : QState(parent)
-{
-}
-
-void State::componentComplete()
-{
- if (this->machine() == nullptr) {
- static bool once = false;
- if (!once) {
- once = true;
- qmlWarning(this) << "No top level StateMachine found. Nothing will run without a StateMachine.";
- }
- }
-}
-
-QQmlListProperty<QObject> State::children()
-{
- return QQmlListProperty<QObject>(this, &m_children,
- m_children.append, m_children.count, m_children.at,
- m_children.clear, m_children.replace, m_children.removeLast);
-}
-
-/*!
- \qmltype QAbstractState
- \inqmlmodule QtQml.StateMachine
- \omit
- \ingroup statemachine-qmltypes
- \endomit
- \since 5.4
-
- \brief The QAbstractState type is the base type of States of a StateMachine.
-
- Do not use QAbstractState directly; use State, FinalState or
- StateMachine instead.
-
- \sa StateMachine, State
-*/
-
-/*!
- \qmlproperty bool QAbstractState::active
- \readonly active
-
- The active property of this state. A state is active between
- entered() and exited() signals. This property is readonly.
-
- \sa entered, exited
-*/
-
-/*!
- \qmlsignal QAbstractState::entered()
-
- This signal is emitted when the State becomes active.
-
- \sa active, exited
-*/
-
-/*!
- \qmlsignal QAbstractState::exited()
-
- This signal is emitted when the State becomes inactive.
-
- \sa active, entered
-*/
-
-/*!
- \qmltype State
- \inqmlmodule QtQml.StateMachine
- \inherits QAbstractState
- \ingroup statemachine-qmltypes
- \since 5.4
-
- \brief Provides a general-purpose state for StateMachine.
-
- State objects can have child states as well as transitions to other
- states. State is part of \l{The Declarative State Machine Framework}.
-
- \section1 States with Child States
-
- The childMode property determines how child states are treated. For
- non-parallel state groups, the initialState property must be used to
- set the initial state. The child states are mutually exclusive states,
- and the state machine needs to know which child state to enter when the
- parent state is the target of a transition.
-
- The state emits the State::finished() signal when a final child state
- (FinalState) is entered.
-
- The errorState sets the state's error state. The error state is the state
- that the state machine will transition to if an error is detected when
- attempting to enter the state (e.g. because no initial state has been set).
-
- \section1 Example Usage
-
- \snippet qml/statemachine/basicstate.qml document
-
- \clearfloat
-
- \sa StateMachine, FinalState
-*/
-
-/*!
- \qmlproperty enumeration State::childMode
-
- \brief The child mode of this state
-
- The default value of this property is QState.ExclusiveStates.
-
- This enum specifies how a state's child states are treated:
- \list
- \li QState.ExclusiveStates The child states are mutually exclusive and an initial state must be set by setting initialState property.
- \li QState.ParallelStates The child states are parallel. When the parent state is entered, all its child states are entered in parallel.
- \endlist
-*/
-
-/*!
- \qmlproperty QAbstractState State::errorState
-
- \brief The error state of this state.
-*/
-
-/*!
- \qmlproperty QAbstractState State::initialState
-
- \brief The initial state of this state (one of its child states).
-*/
-
-/*!
- \qmlsignal State::finished()
-
- This signal is emitted when a final child state of this state is entered.
-
- \sa QAbstractState::active, QAbstractState::entered, QAbstractState::exited
-*/
-
-/*!
- \qmltype HistoryState
- \inqmlmodule QtQml.StateMachine
- \inherits QAbstractState
- \ingroup statemachine-qmltypes
- \since 5.4
-
- \brief The HistoryState type provides a means of returning to a previously active substate.
-
- A history state is a pseudo-state that represents the child state that the
- parent state was in the last time the parent state was exited. A transition
- with a history state as its target is in fact a transition to one of the
- other child states of the parent state.
- HistoryState is part of \l{The Declarative State Machine Framework}.
-
- Use the defaultState property to set the state that should be entered
- if the parent state has never been entered.
-
- \section1 Example Usage
-
- \snippet qml/statemachine/historystate.qml document
-
- \clearfloat
-
- By default, a history state is shallow, meaning that it will not remember
- nested states. This can be configured through the historyType property.
-
- \sa StateMachine, State
-*/
-
-/*!
- \qmlproperty QAbstractState HistoryState::defaultState
-
- \brief The default state of this history state.
-
- The default state indicates the state to transition to if the parent
- state has never been entered before.
-*/
-
-/*!
- \qmlproperty enumeration HistoryState::historyType
-
- \brief The type of history that this history state records.
-
- The default value of this property is HistoryState.ShallowHistory.
-
- This enum specifies the type of history that a HistoryState records.
- \list
- \li HistoryState.ShallowHistory Only the immediate child states of the
- parent state are recorded. In this case, a transition with the history
- state as its target will end up in the immediate child state that the
- parent was in the last time it was exited. This is the default.
- \li HistoryState.DeepHistory Nested states are recorded. In this case
- a transition with the history state as its target will end up in the
- most deeply nested descendant state the parent was in the last time
- it was exited.
- \endlist
-*/
-
-#include "moc_state.cpp"
diff --git a/src/imports/statemachine/state.h b/src/imports/statemachine/state.h
deleted file mode 100644
index 8cb454f3cf..0000000000
--- a/src/imports/statemachine/state.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Ford Motor Company
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef STATE_H
-#define STATE_H
-
-#include "childrenprivate.h"
-
-#include <QtCore/QState>
-#include <QtQml/QQmlParserStatus>
-#include <QtQml/QQmlListProperty>
-#include <QtQml/qqml.h>
-
-QT_BEGIN_NAMESPACE
-
-class State : public QState, public QQmlParserStatus
-{
- Q_OBJECT
- Q_INTERFACES(QQmlParserStatus)
- Q_PROPERTY(QQmlListProperty<QObject> children READ children NOTIFY childrenChanged)
- Q_CLASSINFO("DefaultProperty", "children")
- QML_ELEMENT
- QML_ADDED_IN_VERSION(1, 0)
-
-public:
- explicit State(QState *parent = 0);
-
- void classBegin() override {}
- void componentComplete() override;
-
- QQmlListProperty<QObject> children();
-
-Q_SIGNALS:
- void childrenChanged();
-
-private:
- ChildrenPrivate<State, ChildrenMode::StateOrTransition> m_children;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/imports/statemachine/statemachine.cpp b/src/imports/statemachine/statemachine.cpp
deleted file mode 100644
index de6c84227d..0000000000
--- a/src/imports/statemachine/statemachine.cpp
+++ /dev/null
@@ -1,234 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Ford Motor Company
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "statemachine.h"
-
-#include <QAbstractTransition>
-#include <QQmlContext>
-#include <QQmlEngine>
-#include <QQmlInfo>
-
-#include <private/qqmlopenmetaobject_p.h>
-#include <private/qqmlengine_p.h>
-
-StateMachine::StateMachine(QObject *parent)
- : QStateMachine(parent), m_completed(false), m_running(false)
-{
- connect(this, SIGNAL(runningChanged(bool)), SIGNAL(qmlRunningChanged()));
- connect(this, SIGNAL(childModeChanged()), SLOT(checkChildMode()));
-}
-
-bool StateMachine::isRunning() const
-{
- return QStateMachine::isRunning();
-}
-
-void StateMachine::setRunning(bool running)
-{
- if (m_completed)
- QStateMachine::setRunning(running);
- else
- m_running = running;
-}
-
-void StateMachine::checkChildMode()
-{
- if (childMode() != QState::ExclusiveStates) {
- qmlWarning(this) << "Setting the childMode of a StateMachine to anything else than\n"
- "QState.ExclusiveStates will result in an invalid state machine,\n"
- "and can lead to incorrect behavior!";
- }
-}
-
-void StateMachine::componentComplete()
-{
- if (QStateMachine::initialState() == nullptr && childMode() == QState::ExclusiveStates)
- qmlWarning(this) << "No initial state set for StateMachine";
-
- // Everything is proper setup, now start the state-machine if we got
- // asked to do so.
- m_completed = true;
- if (m_running)
- setRunning(true);
-}
-
-QQmlListProperty<QObject> StateMachine::children()
-{
- return QQmlListProperty<QObject>(this, &m_children,
- m_children.append, m_children.count, m_children.at,
- m_children.clear, m_children.replace, m_children.removeLast);
-}
-
-/*!
- \qmltype StateMachine
- \inqmlmodule QtQml.StateMachine
- \inherits State
- \ingroup statemachine-qmltypes
- \since 5.4
-
- \brief Provides a hierarchical finite state machine.
-
- StateMachine is based on the concepts and notation of
- \l{http://www.wisdom.weizmann.ac.il/~dharel/SCANNED.PAPERS/Statecharts.pdf}{Statecharts}.
- StateMachine is part of \l{The Declarative State Machine Framework}.
-
- A state machine manages a set of states and transitions between those
- states; these states and transitions define a state graph. Once a state
- graph has been built, the state machine can execute it. StateMachine's
- execution algorithm is based on the \l{http://www.w3.org/TR/scxml/}{State Chart XML (SCXML)}
- algorithm. The framework's \l{The Declarative State Machine Framework}{overview}
- gives several state graphs and the code to build them.
-
- Before the machine can be started, the \l{State::initialState}{initialState}
- must be set. The initial state is the state that the
- machine enters when started. You can then set running property to true
- or start() the state machine. The started signal is emitted when the
- initial state is entered.
-
- The state machine processes events and takes transitions until a
- top-level final state is entered; the state machine then emits the
- finished() signal. You can also stop() the state machine
- explicitly (you can also set running property to false).
- The stopped signal is emitted in this case.
-
- \section1 Example Usage
- The following snippet shows a state machine that will finish when a button
- is clicked:
-
- \snippet qml/statemachine/simplestatemachine.qml document
-
- If an error is encountered, the machine will look for an
- \l{State::errorState}{errorState}, and if one is available, it will
- enter this state. After the error state is entered, the type of the error
- can be retrieved with error(). The execution of the state graph will not
- stop when the error state is entered. If no error state applies to the
- erroneous state, the machine will stop executing and an error message will
- be printed to the console.
-
- \warning Setting the childMode of a StateMachine to anything else than QState::ExclusiveStates
- will result in an invalid state machine, and can lead to incorrect behavior.
-
- \clearfloat
-
- \sa QAbstractState, State, SignalTransition, TimeoutTransition, HistoryState {The Declarative State Machine Framework}
-*/
-
-/*!
- \qmlproperty enumeration StateMachine::globalRestorePolicy
-
- \brief The restore policy for states of this state machine.
-
- The default value of this property is QState.DontRestoreProperties.
-
- This enum specifies the restore policy type. The restore policy
- takes effect when the machine enters a state which sets one or more
- properties. If the restore policy is set to QState.RestoreProperties,
- the state machine will save the original value of the property before the
- new value is set.
-
- Later, when the machine either enters a state which does not set a
- value for the given property, the property will automatically be restored
- to its initial value.
-
- Only one initial value will be saved for any given property. If a value
- for a property has already been saved by the state machine, it will not be
- overwritten until the property has been successfully restored.
-
- \list
- \li QState.DontRestoreProperties The state machine should not save the initial values of properties and restore them later.
- \li QState.RestoreProperties The state machine should save the initial values of properties and restore them later.
- \endlist
-*/
-
-/*!
- \qmlproperty bool StateMachine::running
-
- \brief The running state of this state machine.
- \sa start(), stop()
-*/
-
-/*!
- \qmlproperty string StateMachine::errorString
- \readonly errorString
-
- \brief The error string of this state machine.
-*/
-
-
-/*!
- \qmlmethod StateMachine::start()
-
- Starts this state machine. The machine will reset its configuration and
- transition to the initial state. When a final top-level state (FinalState)
- is entered, the machine will emit the finished() signal.
-
- \note A state machine will not run without a running event loop, such as
- the main application event loop started with QCoreApplication::exec() or
- QApplication::exec().
-
- \sa started, State::finished, stop(), State::initialState, running
-*/
-
-/*!
- \qmlsignal StateMachine::started()
-
- This signal is emitted when the state machine has entered its initial state
- (State::initialState).
-
- \sa running, start(), State::finished
-*/
-
-/*!
- \qmlmethod StateMachine::stop()
-
- Stops this state machine. The state machine will stop processing events
- and then emit the stopped signal.
-
- \sa stopped, start(), running
-*/
-
-/*!
- \qmlsignal StateMachine::stopped()
-
- This signal is emitted when the state machine has stopped.
-
- \sa running, stop(), State::finished
-*/
-
-#include "moc_statemachine.cpp"
diff --git a/src/imports/statemachine/statemachine.h b/src/imports/statemachine/statemachine.h
deleted file mode 100644
index 85ac4cf26b..0000000000
--- a/src/imports/statemachine/statemachine.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Ford Motor Company
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef STATEMACHINE_H
-#define STATEMACHINE_H
-
-#include "childrenprivate.h"
-
-#include <QtCore/QStateMachine>
-#include <QtQml/QQmlParserStatus>
-#include <QtQml/QQmlListProperty>
-#include <QtQml/qqml.h>
-
-QT_BEGIN_NAMESPACE
-
-class StateMachine : public QStateMachine, public QQmlParserStatus
-{
- Q_OBJECT
- Q_INTERFACES(QQmlParserStatus)
- Q_PROPERTY(QQmlListProperty<QObject> children READ children NOTIFY childrenChanged)
-
- // Override to delay execution after componentComplete()
- Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY qmlRunningChanged)
-
- Q_CLASSINFO("DefaultProperty", "children")
- QML_ELEMENT
- QML_ADDED_IN_VERSION(1, 0)
-
-public:
- explicit StateMachine(QObject *parent = 0);
-
- void classBegin() override {}
- void componentComplete() override;
- QQmlListProperty<QObject> children();
-
- bool isRunning() const;
- void setRunning(bool running);
-
-private Q_SLOTS:
- void checkChildMode();
-
-Q_SIGNALS:
- void childrenChanged();
- /*!
- * \internal
- */
- void qmlRunningChanged();
-
-private:
- ChildrenPrivate<StateMachine, ChildrenMode::StateOrTransition> m_children;
- bool m_completed;
- bool m_running;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/imports/statemachine/statemachine.pro b/src/imports/statemachine/statemachine.pro
deleted file mode 100644
index cff81c2416..0000000000
--- a/src/imports/statemachine/statemachine.pro
+++ /dev/null
@@ -1,27 +0,0 @@
-CXX_MODULE = qml
-TARGET = qtqmlstatemachine
-TARGETPATH = QtQml/StateMachine
-QML_IMPORT_VERSION = $$QT_VERSION
-
-QT = core-private qml-private
-
-SOURCES = \
- $$PWD/finalstate.cpp \
- $$PWD/signaltransition.cpp \
- $$PWD/state.cpp \
- $$PWD/statemachine.cpp \
- $$PWD/timeouttransition.cpp \
- $$PWD/plugin.cpp
-
-HEADERS = \
- $$PWD/childrenprivate.h \
- $$PWD/finalstate.h \
- $$PWD/signaltransition.h \
- $$PWD/state.h \
- $$PWD/statemachine.h \
- $$PWD/timeouttransition.h \
- $$PWD/statemachineforeign.h
-
-CONFIG += qmltypes install_qmltypes
-
-load(qml_plugin)
diff --git a/src/imports/statemachine/statemachineforeign.h b/src/imports/statemachine/statemachineforeign.h
deleted file mode 100644
index 7543d55fdf..0000000000
--- a/src/imports/statemachine/statemachineforeign.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef STATEMACHINEFOREIGN_H
-#define STATEMACHINEFOREIGN_H
-
-#include <QtQml/qqml.h>
-#include <QtCore/qhistorystate.h>
-#include <QtCore/qstate.h>
-#include <QtCore/qabstractstate.h>
-#include <QtCore/qsignaltransition.h>
-
-struct QHistoryStateForeign
-{
- Q_GADGET
- QML_FOREIGN(QHistoryState)
- QML_NAMED_ELEMENT(HistoryState)
- QML_ADDED_IN_VERSION(1, 0)
-};
-
-struct QStateForeign
-{
- Q_GADGET
- QML_FOREIGN(QState)
- QML_NAMED_ELEMENT(QState)
- QML_ADDED_IN_VERSION(1, 0)
- QML_UNCREATABLE("Don't use this, use State instead.")
-};
-
-struct QAbstractStateForeign
-{
- Q_GADGET
- QML_FOREIGN(QAbstractState)
- QML_NAMED_ELEMENT(QAbstractState)
- QML_ADDED_IN_VERSION(1, 0)
- QML_UNCREATABLE("Don't use this, use State instead.")
-};
-
-struct QSignalTransitionForeign
-{
- Q_GADGET
- QML_FOREIGN(QSignalTransition)
- QML_NAMED_ELEMENT(QSignalTransition)
- QML_ADDED_IN_VERSION(1, 0)
- QML_UNCREATABLE("Don't use this, use SignalTransition instead.")
-};
-
-#endif // STATEMACHINEFOREIGN_H
diff --git a/src/imports/statemachine/timeouttransition.cpp b/src/imports/statemachine/timeouttransition.cpp
deleted file mode 100644
index b0400b7d00..0000000000
--- a/src/imports/statemachine/timeouttransition.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Ford Motor Company
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "timeouttransition.h"
-
-#include <QQmlInfo>
-#include <QTimer>
-#include <QState>
-
-TimeoutTransition::TimeoutTransition(QState* parent)
- : QSignalTransition((m_timer = new QTimer), SIGNAL(timeout()), parent)
-{
- m_timer->setSingleShot(true);
- m_timer->setInterval(1000);
-}
-
-TimeoutTransition::~TimeoutTransition()
-{
- delete m_timer;
-}
-
-int TimeoutTransition::timeout() const
-{
- return m_timer->interval();
-}
-
-void TimeoutTransition::setTimeout(int timeout)
-{
- if (timeout != m_timer->interval()) {
- m_timer->setInterval(timeout);
- emit timeoutChanged();
- }
-}
-
-void TimeoutTransition::componentComplete()
-{
- QState *state = qobject_cast<QState*>(parent());
- if (!state) {
- qmlWarning(this) << "Parent needs to be a State";
- return;
- }
-
- connect(state, SIGNAL(entered()), m_timer, SLOT(start()));
- connect(state, SIGNAL(exited()), m_timer, SLOT(stop()));
- if (state->active())
- m_timer->start();
-}
-
-/*!
- \qmltype TimeoutTransition
- \inqmlmodule QtQml.StateMachine
- \inherits QSignalTransition
- \ingroup statemachine-qmltypes
- \since 5.4
-
- \brief The TimeoutTransition type provides a transition based on a timer.
-
- \l{Timer} type can be combined with SignalTransition to enact more complex
- timeout based transitions.
-
- TimeoutTransition is part of \l{The Declarative State Machine Framework}.
-
- \section1 Example Usage
-
- \snippet qml/statemachine/timeouttransition.qml document
-
- \clearfloat
-
- \sa StateMachine, SignalTransition, FinalState, HistoryState
-*/
-
-/*!
- \qmlproperty int TimeoutTransition::timeout
-
- \brief The timeout interval in milliseconds.
-*/
-
-#include "moc_timeouttransition.cpp"
diff --git a/src/imports/statemachine/timeouttransition.h b/src/imports/statemachine/timeouttransition.h
deleted file mode 100644
index 3d056b5e41..0000000000
--- a/src/imports/statemachine/timeouttransition.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Ford Motor Company
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef TIMEOUTTRANSITION_H
-#define TIMEOUTTRANSITION_H
-
-#include <QtCore/QSignalTransition>
-#include <QtQml/QQmlParserStatus>
-#include <QtQml/qqml.h>
-
-QT_BEGIN_NAMESPACE
-class QTimer;
-
-class TimeoutTransition : public QSignalTransition, public QQmlParserStatus
-{
- Q_OBJECT
- Q_PROPERTY(int timeout READ timeout WRITE setTimeout NOTIFY timeoutChanged)
- Q_INTERFACES(QQmlParserStatus)
- QML_ELEMENT
- QML_ADDED_IN_VERSION(1, 0)
-
-public:
- TimeoutTransition(QState *parent = nullptr);
- ~TimeoutTransition();
-
- int timeout() const;
- void setTimeout(int timeout);
-
- void classBegin() override {}
- void componentComplete() override;
-
-Q_SIGNALS:
- void timeoutChanged();
-
-private:
- QTimer *m_timer;
-};
-
-QT_END_NAMESPACE
-
-#endif