diff options
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/imports.pro | 3 | ||||
-rw-r--r-- | src/imports/scxmlstatemachine/eventconnection.cpp | 143 | ||||
-rw-r--r-- | src/imports/scxmlstatemachine/eventconnection_p.h | 96 | ||||
-rw-r--r-- | src/imports/scxmlstatemachine/invokedservices.cpp | 133 | ||||
-rw-r--r-- | src/imports/scxmlstatemachine/invokedservices_p.h | 92 | ||||
-rw-r--r-- | src/imports/scxmlstatemachine/plugin.cpp | 88 | ||||
-rw-r--r-- | src/imports/scxmlstatemachine/plugins.qmltypes | 140 | ||||
-rw-r--r-- | src/imports/scxmlstatemachine/qmldir | 5 | ||||
-rw-r--r-- | src/imports/scxmlstatemachine/scxmlstatemachine.pro | 23 | ||||
-rw-r--r-- | src/imports/scxmlstatemachine/statemachineextended.cpp | 57 | ||||
-rw-r--r-- | src/imports/scxmlstatemachine/statemachineextended_p.h | 76 | ||||
-rw-r--r-- | src/imports/scxmlstatemachine/statemachineloader.cpp | 203 | ||||
-rw-r--r-- | src/imports/scxmlstatemachine/statemachineloader_p.h | 102 |
13 files changed, 0 insertions, 1161 deletions
diff --git a/src/imports/imports.pro b/src/imports/imports.pro deleted file mode 100644 index 60a0bd2..0000000 --- a/src/imports/imports.pro +++ /dev/null @@ -1,3 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS = scxmlstatemachine - diff --git a/src/imports/scxmlstatemachine/eventconnection.cpp b/src/imports/scxmlstatemachine/eventconnection.cpp deleted file mode 100644 index 2a073bd..0000000 --- a/src/imports/scxmlstatemachine/eventconnection.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtScxml 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 "eventconnection_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \qmltype EventConnection - \instantiates QScxmlEventConnection - \inqmlmodule QtScxml - \since QtScxml 5.8 - - \brief Connects to events sent out by state machines. - - To receive a notification when a state machine sends out an event, a - connection can be created to the corresponding signal. -*/ - -/*! - \qmlproperty stringlist EventConnection::events - - The list of SCXML event specifiers that describe the events to listen for. - - Even though spaces are allowed in event specifications in SCXML documents, - they are not allowed in this list. However, the list can contain multiple - specifiers, to the same effect. -*/ - -/*! - \qmlproperty ScxmlStateMachine EventConnection::stateMachine - - The state machine that sends out the event. -*/ - -/*! - \qmlsignal EventConnection::occurred(event) - - This signal is emitted when the event \a event occurrs. - - The corresponding signal handler is \c onOccurred. - - \sa QScxmlEvent -*/ - - -QScxmlEventConnection::QScxmlEventConnection(QObject *parent) : - QObject(parent), m_stateMachine(nullptr) -{ -} - -QStringList QScxmlEventConnection::events() const -{ - return m_events; -} - -void QScxmlEventConnection::setEvents(const QStringList &events) -{ - if (events != m_events) { - m_events = events; - doConnect(); - emit eventsChanged(); - } -} - -QScxmlStateMachine *QScxmlEventConnection::stateMachine() const -{ - return m_stateMachine; -} - -void QScxmlEventConnection::setStateMachine(QScxmlStateMachine *stateMachine) -{ - if (stateMachine != m_stateMachine) { - m_stateMachine = stateMachine; - doConnect(); - emit stateMachineChanged(); - } -} - -void QScxmlEventConnection::doConnect() -{ - for (const QMetaObject::Connection &connection : qAsConst(m_connections)) - disconnect(connection); - m_connections.clear(); - if (m_stateMachine) { - for (const QString &event : qAsConst(m_events)) { - m_connections.append(m_stateMachine->connectToEvent(event, this, - &QScxmlEventConnection::occurred)); - } - - } - -} - -void QScxmlEventConnection::classBegin() -{ -} - -void QScxmlEventConnection::componentComplete() -{ - if (!m_stateMachine) { - if ((m_stateMachine = qobject_cast<QScxmlStateMachine *>(parent()))) - doConnect(); - } -} - -QT_END_NAMESPACE diff --git a/src/imports/scxmlstatemachine/eventconnection_p.h b/src/imports/scxmlstatemachine/eventconnection_p.h deleted file mode 100644 index 5fea645..0000000 --- a/src/imports/scxmlstatemachine/eventconnection_p.h +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtScxml 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 EVENTCONNECTION_P_H -#define EVENTCONNECTION_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtScxml/qscxmlstatemachine.h> -#include <QtCore/qobject.h> -#include <QtQml/qqmlparserstatus.h> - -QT_BEGIN_NAMESPACE - -class QScxmlEventConnection : public QObject, public QQmlParserStatus -{ - Q_OBJECT - Q_PROPERTY(QStringList events READ events WRITE setEvents NOTIFY eventsChanged) - Q_PROPERTY(QScxmlStateMachine *stateMachine READ stateMachine WRITE setStateMachine - NOTIFY stateMachineChanged) - Q_INTERFACES(QQmlParserStatus) - -public: - QScxmlEventConnection(QObject *parent = nullptr); - - QStringList events() const; - void setEvents(const QStringList &events); - - QScxmlStateMachine *stateMachine() const; - void setStateMachine(QScxmlStateMachine *stateMachine); - -Q_SIGNALS: - void eventsChanged(); - void stateMachineChanged(); - - void occurred(const QScxmlEvent &event); - -private: - QScxmlStateMachine *m_stateMachine; - QStringList m_events; - - QList<QMetaObject::Connection> m_connections; - - void doConnect(); - void classBegin() override; - void componentComplete() override; -}; - -QT_END_NAMESPACE - -#endif // EVENTCONNECTION_P_H diff --git a/src/imports/scxmlstatemachine/invokedservices.cpp b/src/imports/scxmlstatemachine/invokedservices.cpp deleted file mode 100644 index 6011557..0000000 --- a/src/imports/scxmlstatemachine/invokedservices.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtScxml 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 "invokedservices_p.h" -#include <QtScxml/qscxmlinvokableservice.h> - -QT_BEGIN_NAMESPACE - -/*! - \qmltype InvokedServices - \instantiates QScxmlInvokedServices - \inqmlmodule QtScxml - \since QtScxml 5.8 - - \brief Provices access to the services invoked by state machines. - - Makes the invoked services easily accessible by their names, without - constantly iterating through QScxmlStateMachine::invokedServices. - - The services are called from state machines via the mechanism described in - \l{SCXML Specification - 6.4 <invoke>}. -*/ - -QScxmlInvokedServices::QScxmlInvokedServices(QObject *parent) : QObject(parent) -{ -} - -/*! - \qmlproperty var InvokedServices::children - - The services invoked by the state machine. -*/ - -QVariantMap QScxmlInvokedServices::children() -{ - QVariantMap ret; - if (m_stateMachine) { - const QVector<QScxmlInvokableService *> children = m_stateMachine->invokedServices(); - for (QScxmlInvokableService *service : children) - ret.insertMulti(service->name(), QVariant::fromValue(service)); - } - return ret; -} - -void QScxmlInvokedServices::classBegin() -{ -} - -/*! - \qmlproperty ScxmlStateMachine InvokedServices::stateMachine - - The state machine that invoked the services. -*/ - -QScxmlStateMachine *QScxmlInvokedServices::stateMachine() const -{ - return m_stateMachine; -} - -void QScxmlInvokedServices::setStateMachine(QScxmlStateMachine *stateMachine) -{ - if (stateMachine != m_stateMachine) { - if (m_stateMachine) { - disconnect(m_stateMachine, &QScxmlStateMachine::invokedServicesChanged, - this, &QScxmlInvokedServices::childrenChanged); - } - m_stateMachine = stateMachine; - connect(m_stateMachine, &QScxmlStateMachine::invokedServicesChanged, - this, &QScxmlInvokedServices::childrenChanged); - emit stateMachineChanged(); - emit childrenChanged(); - } -} - -/*! - \qmlproperty list<QtObject> InvokedServices::qmlChildren - - A list of additional QtObject types nested in this type. -*/ - -QQmlListProperty<QObject> QScxmlInvokedServices::qmlChildren() -{ - return QQmlListProperty<QObject>(this, m_qmlChildren); -} - - -void QScxmlInvokedServices::componentComplete() -{ - if (!m_stateMachine) { - if ((m_stateMachine = qobject_cast<QScxmlStateMachine *>(parent()))) { - connect(m_stateMachine, &QScxmlStateMachine::invokedServicesChanged, - this, &QScxmlInvokedServices::childrenChanged); - } - } -} - -QT_END_NAMESPACE diff --git a/src/imports/scxmlstatemachine/invokedservices_p.h b/src/imports/scxmlstatemachine/invokedservices_p.h deleted file mode 100644 index 5a6dac7..0000000 --- a/src/imports/scxmlstatemachine/invokedservices_p.h +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtScxml 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 INVOKEDSERVICES_P_H -#define INVOKEDSERVICES_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtQml/qqmlparserstatus.h> -#include <QtQml/qqmllist.h> -#include <QtScxml/qscxmlstatemachine.h> - -QT_BEGIN_NAMESPACE - -class QScxmlInvokedServices : public QObject, public QQmlParserStatus -{ - Q_OBJECT - Q_PROPERTY(QScxmlStateMachine *stateMachine READ stateMachine WRITE setStateMachine - NOTIFY stateMachineChanged) - Q_PROPERTY(QVariantMap children READ children NOTIFY childrenChanged) - Q_PROPERTY(QQmlListProperty<QObject> qmlChildren READ qmlChildren) - Q_INTERFACES(QQmlParserStatus) - Q_CLASSINFO("DefaultProperty", "qmlChildren") -public: - QScxmlInvokedServices(QObject *parent = nullptr); - QVariantMap children(); - - QScxmlStateMachine *stateMachine() const; - void setStateMachine(QScxmlStateMachine *stateMachine); - - QQmlListProperty<QObject> qmlChildren(); - -Q_SIGNALS: - void childrenChanged(); - void stateMachineChanged(); - -private: - void classBegin() override; - void componentComplete() override; - - QScxmlStateMachine *m_stateMachine = nullptr; - QList<QObject *> m_qmlChildren; -}; - -QT_END_NAMESPACE - -#endif // INVOKEDSERVICES_P_H diff --git a/src/imports/scxmlstatemachine/plugin.cpp b/src/imports/scxmlstatemachine/plugin.cpp deleted file mode 100644 index 1d6c8a1..0000000 --- a/src/imports/scxmlstatemachine/plugin.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtScxml 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 "statemachineloader_p.h" -#include "eventconnection_p.h" -#include "qscxmlevent.h" -#include "statemachineextended_p.h" -#include "invokedservices_p.h" - -#include <qqmlextensionplugin.h> -#include <qqml.h> - -QT_BEGIN_NAMESPACE - -class QScxmlStateMachinePlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) - -public: - QScxmlStateMachinePlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { } - void registerTypes(const char *uri) - { - // @uri QtScxml - Q_ASSERT(uri == QStringLiteral("QtScxml")); - - int major = 5; - int minor = 8; - // Do not rely on RegisterMethodArgumentMetaType meta-call to register the QScxmlEvent type. - // This registration is required for the receiving end of the signal emission that carries - // parameters of this type to be able to treat them correctly as a gadget. This is because the - // receiving end of the signal is a generic method in the QML engine, at which point it's too late - // to do a meta-type registration. - static const int qScxmlEventMetaTypeId = qMetaTypeId<QScxmlEvent>(); - Q_UNUSED(qScxmlEventMetaTypeId) - qmlRegisterType<QScxmlStateMachineLoader>(uri, major, minor, "StateMachineLoader"); - qmlRegisterType<QScxmlEventConnection>(uri, major, minor, "EventConnection"); - qmlRegisterType<QScxmlInvokedServices>(uri, major, minor, "InvokedServices"); - qmlRegisterExtendedUncreatableType<QScxmlStateMachine, QScxmlStateMachineExtended>( - uri, major, minor, "StateMachine", "Only created through derived types"); - - // The minor version used to be the current Qt 5 minor. For compatibility it is the last - // Qt 5 release. - qmlRegisterModule(uri, major, 15); - - qmlProtectModule(uri, 1); - } -}; - -QT_END_NAMESPACE - -#include "plugin.moc" diff --git a/src/imports/scxmlstatemachine/plugins.qmltypes b/src/imports/scxmlstatemachine/plugins.qmltypes deleted file mode 100644 index 1b6c469..0000000 --- a/src/imports/scxmlstatemachine/plugins.qmltypes +++ /dev/null @@ -1,140 +0,0 @@ -import QtQuick.tooling 1.2 - -// This file describes the plugin-supplied types contained in the library. -// It is used for QML tooling purposes only. -// -// This file was auto-generated by: -// 'qmlplugindump -nonrelocatable QtScxml 5.14' - -Module { - dependencies: ["QtQuick 2.0"] - Component { - name: "QScxmlEventConnection" - prototype: "QObject" - exports: ["QtScxml/EventConnection 5.8"] - exportMetaObjectRevisions: [0] - Property { name: "events"; type: "QStringList" } - Property { name: "stateMachine"; type: "QScxmlStateMachine"; isPointer: true } - Signal { - name: "occurred" - Parameter { name: "event"; type: "QScxmlEvent" } - } - } - Component { - name: "QScxmlInvokedServices" - defaultProperty: "qmlChildren" - prototype: "QObject" - exports: ["QtScxml/InvokedServices 5.8"] - exportMetaObjectRevisions: [0] - Property { name: "stateMachine"; type: "QScxmlStateMachine"; isPointer: true } - Property { name: "children"; type: "QVariantMap"; isReadonly: true } - Property { name: "qmlChildren"; type: "QObject"; isList: true; isReadonly: true } - } - Component { - name: "QScxmlStateMachine" - defaultProperty: "children" - prototype: "QObject" - exports: ["QtScxml/StateMachine 5.8"] - isCreatable: false - exportMetaObjectRevisions: [508] - Property { name: "running"; type: "bool" } - Property { name: "initialized"; type: "bool"; isReadonly: true } - Property { name: "dataModel"; type: "QScxmlDataModel"; isPointer: true } - Property { name: "initialValues"; type: "QVariantMap" } - Property { name: "invokedServices"; type: "QVector<QScxmlInvokableService*>"; isReadonly: true } - Property { name: "sessionId"; type: "string"; isReadonly: true } - Property { name: "name"; type: "string"; isReadonly: true } - Property { name: "invoked"; type: "bool"; isReadonly: true } - Property { name: "parseErrors"; type: "QVector<QScxmlError>"; isReadonly: true } - Property { name: "loader"; type: "QScxmlCompiler::Loader"; isPointer: true } - Property { name: "tableData"; type: "QScxmlTableData"; isPointer: true } - Signal { - name: "runningChanged" - Parameter { name: "running"; type: "bool" } - } - Signal { - name: "invokedServicesChanged" - Parameter { name: "invokedServices"; type: "QVector<QScxmlInvokableService*>" } - } - Signal { - name: "log" - Parameter { name: "label"; type: "string" } - Parameter { name: "msg"; type: "string" } - } - Signal { name: "reachedStableState" } - Signal { name: "finished" } - Signal { - name: "dataModelChanged" - Parameter { name: "model"; type: "QScxmlDataModel"; isPointer: true } - } - Signal { - name: "initialValuesChanged" - Parameter { name: "initialValues"; type: "QVariantMap" } - } - Signal { - name: "initializedChanged" - Parameter { name: "initialized"; type: "bool" } - } - Signal { - name: "loaderChanged" - Parameter { name: "loader"; type: "QScxmlCompiler::Loader"; isPointer: true } - } - Signal { - name: "tableDataChanged" - Parameter { name: "tableData"; type: "QScxmlTableData"; isPointer: true } - } - Method { name: "start" } - Method { name: "stop" } - Method { name: "init"; type: "bool" } - Method { - name: "stateNames" - type: "QStringList" - Parameter { name: "compress"; type: "bool" } - } - Method { name: "stateNames"; type: "QStringList" } - Method { - name: "activeStateNames" - type: "QStringList" - Parameter { name: "compress"; type: "bool" } - } - Method { name: "activeStateNames"; type: "QStringList" } - Method { - name: "isActive" - type: "bool" - Parameter { name: "scxmlStateName"; type: "string" } - } - Method { - name: "submitEvent" - Parameter { name: "event"; type: "QScxmlEvent"; isPointer: true } - } - Method { - name: "submitEvent" - Parameter { name: "eventName"; type: "string" } - } - Method { - name: "submitEvent" - Parameter { name: "eventName"; type: "string" } - Parameter { name: "data"; type: "QVariant" } - } - Method { - name: "cancelDelayedEvent" - Parameter { name: "sendId"; type: "string" } - } - Method { - name: "isDispatchableTarget" - type: "bool" - Parameter { name: "target"; type: "string" } - } - Property { name: "children"; revision: 508; type: "QObject"; isList: true; isReadonly: true } - } - Component { - name: "QScxmlStateMachineLoader" - prototype: "QObject" - exports: ["QtScxml/StateMachineLoader 5.8"] - exportMetaObjectRevisions: [0] - Property { name: "source"; type: "QUrl" } - Property { name: "stateMachine"; type: "QScxmlStateMachine"; isReadonly: true; isPointer: true } - Property { name: "initialValues"; type: "QVariantMap" } - Property { name: "dataModel"; type: "QScxmlDataModel"; isPointer: true } - } -} diff --git a/src/imports/scxmlstatemachine/qmldir b/src/imports/scxmlstatemachine/qmldir deleted file mode 100644 index e836ddd..0000000 --- a/src/imports/scxmlstatemachine/qmldir +++ /dev/null @@ -1,5 +0,0 @@ -module QtScxml -plugin declarative_scxml -classname QScxmlStateMachinePlugin -typeinfo plugins.qmltypes - diff --git a/src/imports/scxmlstatemachine/scxmlstatemachine.pro b/src/imports/scxmlstatemachine/scxmlstatemachine.pro deleted file mode 100644 index 9bc7c72..0000000 --- a/src/imports/scxmlstatemachine/scxmlstatemachine.pro +++ /dev/null @@ -1,23 +0,0 @@ -TARGET = scxml -TARGETPATH = QtScxml -IMPORT_VERSION = 5.$$QT_MINOR_VERSION - -QT = scxml qml-private core-private - -SOURCES = \ - $$PWD/plugin.cpp \ - $$PWD/statemachineloader.cpp \ - $$PWD/eventconnection.cpp \ - $$PWD/statemachineextended.cpp \ - $$PWD/invokedservices.cpp - -HEADERS = \ - $$PWD/eventconnection_p.h \ - $$PWD/invokedservices_p.h \ - $$PWD/statemachineextended_p.h \ - $$PWD/statemachineloader_p.h - - -load(qml_plugin) - -OTHER_FILES += plugins.qmltypes qmldir diff --git a/src/imports/scxmlstatemachine/statemachineextended.cpp b/src/imports/scxmlstatemachine/statemachineextended.cpp deleted file mode 100644 index 6b1b13b..0000000 --- a/src/imports/scxmlstatemachine/statemachineextended.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtScxml 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 "statemachineextended_p.h" - -#include <QtScxml/qscxmlglobals.h> -#include <QtScxml/qscxmlstatemachine.h> - -QT_BEGIN_NAMESPACE - -QScxmlStateMachineExtended::QScxmlStateMachineExtended(QObject *extendee) : - QObject(extendee) -{ -} - -QQmlListProperty<QObject> QScxmlStateMachineExtended::children() -{ - return QQmlListProperty<QObject>(this, m_children); -} - -QT_END_NAMESPACE diff --git a/src/imports/scxmlstatemachine/statemachineextended_p.h b/src/imports/scxmlstatemachine/statemachineextended_p.h deleted file mode 100644 index ab069b1..0000000 --- a/src/imports/scxmlstatemachine/statemachineextended_p.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtScxml 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 STATEMACHINEEXTENDED_P_H -#define STATEMACHINEEXTENDED_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtScxml/qscxmlglobals.h> -#include <QtCore/qobject.h> -#include <QtQml/qqmllist.h> - -QT_BEGIN_NAMESPACE - -/* Allow State Machines created from QML to have children. */ -class QScxmlStateMachineExtended : public QObject -{ - Q_OBJECT - Q_PROPERTY(QQmlListProperty<QObject> children READ children) - Q_CLASSINFO("DefaultProperty", "children") -public: - QScxmlStateMachineExtended(QObject *extendee); - QQmlListProperty<QObject> children(); - -private: - QObjectList m_children; -}; - -QT_END_NAMESPACE - -#endif // STATEMACHINEEXTENDED_P_H diff --git a/src/imports/scxmlstatemachine/statemachineloader.cpp b/src/imports/scxmlstatemachine/statemachineloader.cpp deleted file mode 100644 index 1d312a5..0000000 --- a/src/imports/scxmlstatemachine/statemachineloader.cpp +++ /dev/null @@ -1,203 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtScxml 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 "statemachineloader_p.h" - -#include <QtScxml/qscxmlstatemachine.h> -#include <qqmlcontext.h> -#include <qqmlengine.h> -#include <qqmlinfo.h> -#include <qqmlfile.h> -#include <qbuffer.h> - -/*! - \qmltype StateMachineLoader - \instantiates QScxmlStateMachineLoader - \inqmlmodule QtScxml - - \brief Dynamically loads an SCXML document and instantiates the state machine. - - \since QtScxml 5.7 - */ - -QScxmlStateMachineLoader::QScxmlStateMachineLoader(QObject *parent) - : QObject(parent) - , m_dataModel(nullptr) - , m_implicitDataModel(nullptr) - , m_stateMachine(nullptr) -{ -} - -/*! - \qmlproperty ScxmlStateMachine StateMachineLoader::stateMachine - - The state machine instance. - */ -QT_PREPEND_NAMESPACE(QScxmlStateMachine) *QScxmlStateMachineLoader::stateMachine() const -{ - return m_stateMachine; -} - -/*! - \qmlproperty url StateMachineLoader::source - - The URL of the SCXML document to load. Only synchronously accessible URLs - are supported. - */ -QUrl QScxmlStateMachineLoader::source() -{ - return m_source; -} - -void QScxmlStateMachineLoader::setSource(const QUrl &source) -{ - if (!source.isValid()) - return; - - QUrl oldSource = m_source; - if (m_stateMachine) { - delete m_stateMachine; - m_stateMachine = nullptr; - m_implicitDataModel = nullptr; - } - - if (parse(source)) { - m_source = source; - emit sourceChanged(); - } else { - m_source.clear(); - if (!oldSource.isEmpty()) { - emit sourceChanged(); - } - } -} - -QVariantMap QScxmlStateMachineLoader::initialValues() const -{ - return m_initialValues; -} - -void QScxmlStateMachineLoader::setInitialValues(const QVariantMap &initialValues) -{ - if (initialValues != m_initialValues) { - m_initialValues = initialValues; - if (m_stateMachine) - m_stateMachine->setInitialValues(initialValues); - emit initialValuesChanged(); - } -} - -QScxmlDataModel *QScxmlStateMachineLoader::dataModel() const -{ - return m_dataModel; -} - -void QScxmlStateMachineLoader::setDataModel(QScxmlDataModel *dataModel) -{ - if (dataModel != m_dataModel) { - m_dataModel = dataModel; - if (m_stateMachine) { - if (dataModel) - m_stateMachine->setDataModel(dataModel); - else - m_stateMachine->setDataModel(m_implicitDataModel); - } - emit dataModelChanged(); - } -} - -bool QScxmlStateMachineLoader::parse(const QUrl &source) -{ - if (!QQmlFile::isSynchronous(source)) { - qmlWarning(this) << QStringLiteral("Cannot open '%1' for reading: only synchronous access is supported.") - .arg(source.url()); - return false; - } - QQmlFile scxmlFile(QQmlEngine::contextForObject(this)->engine(), source); - if (scxmlFile.isError()) { - // the synchronous case can only fail when the file is not found (or not readable). - qmlWarning(this) << QStringLiteral("Cannot open '%1' for reading.").arg(source.url()); - return false; - } - - QByteArray data(scxmlFile.dataByteArray()); - QBuffer buf(&data); - if (!buf.open(QIODevice::ReadOnly)) { - qmlWarning(this) << QStringLiteral("Cannot open input buffer for reading"); - return false; - } - - QString fileName; - if (source.isLocalFile()) { - fileName = source.toLocalFile(); - } else if (source.scheme() == QStringLiteral("qrc")) { - fileName = ":" + source.path(); - } else { - qmlWarning(this) << QStringLiteral("%1 is neither a local nor a resource URL.") - .arg(source.url()) - << QStringLiteral("Invoking services by relative path will not work."); - } - - m_stateMachine = QScxmlStateMachine::fromData(&buf, fileName); - m_stateMachine->setParent(this); - m_implicitDataModel = m_stateMachine->dataModel(); - - if (m_stateMachine->parseErrors().isEmpty()) { - if (m_dataModel) - m_stateMachine->setDataModel(m_dataModel); - m_stateMachine->setInitialValues(m_initialValues); - emit stateMachineChanged(); - - // as this is deferred any pending property updates to m_dataModel and m_initialValues - // should still occur before start(). - QMetaObject::invokeMethod(m_stateMachine, "start", Qt::QueuedConnection); - return true; - } else { - qmlWarning(this) << QStringLiteral("Something went wrong while parsing '%1':") - .arg(source.url()) - << Qt::endl; - const auto errors = m_stateMachine->parseErrors(); - for (const QScxmlError &error : errors) { - qmlWarning(this) << error.toString(); - } - - emit stateMachineChanged(); - return false; - } -} diff --git a/src/imports/scxmlstatemachine/statemachineloader_p.h b/src/imports/scxmlstatemachine/statemachineloader_p.h deleted file mode 100644 index 88ed445..0000000 --- a/src/imports/scxmlstatemachine/statemachineloader_p.h +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtScxml 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 STATEMACHINELOADER_P_H -#define STATEMACHINELOADER_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtCore/qurl.h> -#include <QtScxml/qscxmlstatemachine.h> -#include <private/qqmlengine_p.h> - -QT_BEGIN_NAMESPACE - -class QScxmlStateMachineLoader: public QObject -{ - Q_OBJECT - Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) - Q_PROPERTY(QScxmlStateMachine *stateMachine READ stateMachine DESIGNABLE false NOTIFY stateMachineChanged) - Q_PROPERTY(QVariantMap initialValues READ initialValues WRITE setInitialValues NOTIFY initialValuesChanged) - Q_PROPERTY(QScxmlDataModel *dataModel READ dataModel WRITE setDataModel NOTIFY dataModelChanged) - - -public: - explicit QScxmlStateMachineLoader(QObject *parent = nullptr); - - QScxmlStateMachine *stateMachine() const; - - QUrl source(); - void setSource(const QUrl &source); - - QVariantMap initialValues() const; - void setInitialValues(const QVariantMap &initialValues); - - QScxmlDataModel *dataModel() const; - void setDataModel(QScxmlDataModel *dataModel); - -Q_SIGNALS: - void sourceChanged(); - void initialValuesChanged(); - void stateMachineChanged(); - void dataModelChanged(); - -private: - bool parse(const QUrl &source); - -private: - QUrl m_source; - QVariantMap m_initialValues; - QScxmlDataModel *m_dataModel; - QScxmlDataModel *m_implicitDataModel; - QScxmlStateMachine *m_stateMachine; -}; - -QT_END_NAMESPACE - -#endif // STATEMACHINELOADER_P_H |