summaryrefslogtreecommitdiffstats
path: root/src/imports/scxmlstatemachine/statemachine.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports/scxmlstatemachine/statemachine.h')
-rw-r--r--src/imports/scxmlstatemachine/statemachine.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/imports/scxmlstatemachine/statemachine.h b/src/imports/scxmlstatemachine/statemachine.h
new file mode 100644
index 0000000..554e25d
--- /dev/null
+++ b/src/imports/scxmlstatemachine/statemachine.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+ **
+ ** Copyright (c) 2015 Digia Plc
+ ** For any questions to Digia, please use contact form at http://qt.digia.com/
+ **
+ ** All Rights Reserved.
+ **
+ ** NOTICE: All information contained herein is, and remains
+ ** the property of Digia Plc and its suppliers,
+ ** if any. The intellectual and technical concepts contained
+ ** herein are proprietary to Digia Plc
+ ** and its suppliers and may be covered by Finnish and Foreign Patents,
+ ** patents in process, and are protected by trade secret or copyright law.
+ ** Dissemination of this information or reproduction of this material
+ ** is strictly forbidden unless prior written permission is obtained
+ ** from Digia Plc.
+ ****************************************************************************/
+
+#ifndef STATEMACHINE_H
+#define STATEMACHINE_H
+
+#include <QUrl>
+#include <QVector>
+#include <QQmlParserStatus>
+#include <QQmlListProperty>
+#include <QScxml/scxmlstatetable.h>
+
+QT_BEGIN_NAMESPACE
+
+class State;
+class QQmlOpenMetaObject;
+class StateMachine: public QObject, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(QQmlListProperty<QObject> states READ states NOTIFY statesChanged DESIGNABLE false)
+ Q_PROPERTY(QUrl filename READ filename WRITE setFilename NOTIFY filenameChanged)
+ Q_PROPERTY(Scxml::StateTable* stateMachine READ stateMachine WRITE setStateMachine)
+
+ Q_CLASSINFO("DefaultProperty", "states")
+
+public:
+ typedef QVector<QObject *> Kids;
+ explicit StateMachine(QObject *parent = 0);
+
+ void classBegin() {}
+ void componentComplete();
+ QQmlListProperty<QObject> states();
+
+ Scxml::StateTable *stateMachine() const;
+ void setStateMachine(Scxml::StateTable *stateMachine);
+
+ QUrl filename();
+ void setFilename(const QUrl &filename);
+
+Q_SIGNALS:
+ void statesChanged();
+ void filenameChanged();
+
+private:
+ bool parse(const QUrl &filename);
+
+private:
+ QUrl m_filename;
+ Kids m_children;
+ Scxml::StateTable *m_table = nullptr;
+};
+
+QT_END_NAMESPACE
+
+#endif