summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2018-06-28 11:07:18 +0200
committerUlf Hermann <ulf.hermann@qt.io>2018-06-28 13:13:54 +0000
commit67d9d69b97c8c2db54974850783d0d10292f63b5 (patch)
treeeda5530ab35dfb19293e70506dcfd048c5d83e8b /src
parent81205d62c91c05ab0639052baeeb637236159473 (diff)
Make the ECMAScript model a configurable feature
Introducing this feature allows our users to slim down the module. Task-number: QTBUG-61960 Change-Id: I94215fd3c6dee9766a5f7479bec0440cdfe85ac1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/scxml/configure.json21
-rw-r--r--src/scxml/qscxmlcompiler.cpp1
-rw-r--r--src/scxml/qscxmldatamodel.cpp4
-rw-r--r--src/scxml/qscxmlecmascriptdatamodel.h7
-rw-r--r--src/scxml/qscxmlecmascriptplatformproperties_p.h2
-rw-r--r--src/scxml/qscxmlglobals.h1
-rw-r--r--src/scxml/scxml.pro18
7 files changed, 48 insertions, 6 deletions
diff --git a/src/scxml/configure.json b/src/scxml/configure.json
new file mode 100644
index 0000000..288373d
--- /dev/null
+++ b/src/scxml/configure.json
@@ -0,0 +1,21 @@
+{
+ "module": "scxml",
+
+ "features": {
+ "scxml-ecmascriptdatamodel": {
+ "label": "ECMAScript data model for QtScxml",
+ "purpose": "Enables the usage of ecmascript data models in SCXML state machines.",
+ "section": "SCXML",
+ "output": [ "publicFeature" ]
+ }
+ },
+
+ "summary": [
+ {
+ "section": "Qt Scxml",
+ "entries": [
+ "scxml-ecmascriptdatamodel"
+ ]
+ }
+ ]
+}
diff --git a/src/scxml/qscxmlcompiler.cpp b/src/scxml/qscxmlcompiler.cpp
index 61ad030..e2e9b4c 100644
--- a/src/scxml/qscxmlcompiler.cpp
+++ b/src/scxml/qscxmlcompiler.cpp
@@ -47,7 +47,6 @@
#include <qstring.h>
#ifndef BUILD_QSCXMLC
-#include "qscxmlecmascriptdatamodel.h"
#include "qscxmlinvokableservice_p.h"
#include "qscxmldatamodel_p.h"
#include "qscxmlstatemachine_p.h"
diff --git a/src/scxml/qscxmldatamodel.cpp b/src/scxml/qscxmldatamodel.cpp
index 5f2ef2d..ab0ae7c 100644
--- a/src/scxml/qscxmldatamodel.cpp
+++ b/src/scxml/qscxmldatamodel.cpp
@@ -39,7 +39,9 @@
#include "qscxmldatamodel_p.h"
#include "qscxmlnulldatamodel.h"
+#if QT_CONFIG(scxml_ecmascriptdatamodel)
#include "qscxmlecmascriptdatamodel.h"
+#endif
#include "qscxmlstatemachine_p.h"
QT_BEGIN_NAMESPACE
@@ -150,7 +152,9 @@ QScxmlDataModel *QScxmlDataModelPrivate::instantiateDataModel(DocumentModel::Scx
dataModel = new QScxmlNullDataModel;
break;
case DocumentModel::Scxml::JSDataModel:
+#if QT_CONFIG(scxml_ecmascriptdatamodel)
dataModel = new QScxmlEcmaScriptDataModel;
+#endif
break;
case DocumentModel::Scxml::CppDataModel:
break;
diff --git a/src/scxml/qscxmlecmascriptdatamodel.h b/src/scxml/qscxmlecmascriptdatamodel.h
index 658df6d..16f29d4 100644
--- a/src/scxml/qscxmlecmascriptdatamodel.h
+++ b/src/scxml/qscxmlecmascriptdatamodel.h
@@ -40,9 +40,14 @@
#ifndef QSCXMLECMASCRIPTDATAMODEL_H
#define QSCXMLECMASCRIPTDATAMODEL_H
+#include <QtScxml/qscxmlglobals.h>
#include <QtScxml/qscxmldatamodel.h>
QT_BEGIN_NAMESPACE
+
+// We cannot use QT_REQUIRE_CONFIG here, because the feature name contains a dash.
+#if QT_CONFIG(scxml_ecmascriptdatamodel)
+
class QScxmlEcmaScriptDataModelPrivate;
class Q_SCXML_EXPORT QScxmlEcmaScriptDataModel: public QScxmlDataModel
{
@@ -68,6 +73,8 @@ public:
bool setScxmlProperty(const QString &name, const QVariant &value, const QString &context) override;
};
+#endif // QT_CONFIG(scxml_ecmascriptdatamodel)
+
QT_END_NAMESPACE
#endif // QSCXMLECMASCRIPTDATAMODEL_H
diff --git a/src/scxml/qscxmlecmascriptplatformproperties_p.h b/src/scxml/qscxmlecmascriptplatformproperties_p.h
index b751bda..e7b8a09 100644
--- a/src/scxml/qscxmlecmascriptplatformproperties_p.h
+++ b/src/scxml/qscxmlecmascriptplatformproperties_p.h
@@ -58,6 +58,8 @@
QT_FORWARD_DECLARE_CLASS(QJSEngine)
QT_FORWARD_DECLARE_CLASS(QJSValue)
+QT_REQUIRE_CONFIG(scxml_ecmascriptdatamodel);
+
QT_BEGIN_NAMESPACE
class QScxmlStateMachine;
diff --git a/src/scxml/qscxmlglobals.h b/src/scxml/qscxmlglobals.h
index 8672aa1..da45a2b 100644
--- a/src/scxml/qscxmlglobals.h
+++ b/src/scxml/qscxmlglobals.h
@@ -40,6 +40,7 @@
#ifndef QSCXMLGLOBALS_H
#define QSCXMLGLOBALS_H
#include <QtCore/qglobal.h>
+#include <QtScxml/qtscxml-config.h>
QT_BEGIN_NAMESPACE
diff --git a/src/scxml/scxml.pro b/src/scxml/scxml.pro
index 1f5bc25..c3a6aff 100644
--- a/src/scxml/scxml.pro
+++ b/src/scxml/scxml.pro
@@ -1,5 +1,5 @@
TARGET = QtScxml
-QT = core-private qml-private
+QT = core-private
MODULE_CONFIG += c++11 qscxmlc
load(qt_module)
@@ -17,8 +17,6 @@ HEADERS += \
qscxmlglobals.h \
qscxmlglobals_p.h \
qscxmlnulldatamodel.h \
- qscxmlecmascriptdatamodel.h \
- qscxmlecmascriptplatformproperties_p.h \
qscxmlexecutablecontent.h \
qscxmlexecutablecontent_p.h \
qscxmlevent.h \
@@ -38,8 +36,6 @@ SOURCES += \
qscxmlcompiler.cpp \
qscxmlstatemachine.cpp \
qscxmlnulldatamodel.cpp \
- qscxmlecmascriptdatamodel.cpp \
- qscxmlecmascriptplatformproperties.cpp \
qscxmlexecutablecontent.cpp \
qscxmlevent.cpp \
qscxmldatamodel.cpp \
@@ -49,6 +45,18 @@ SOURCES += \
qscxmltabledata.cpp \
qscxmlstatemachineinfo.cpp
+qtConfig(scxml-ecmascriptdatamodel) {
+ QT += qml-private
+
+ HEADERS += \
+ qscxmlecmascriptdatamodel.h \
+ qscxmlecmascriptplatformproperties_p.h
+
+ SOURCES += \
+ qscxmlecmascriptdatamodel.cpp \
+ qscxmlecmascriptplatformproperties.cpp
+}
+
FEATURES += ../../mkspecs/features/qscxmlc.prf
features.files = $$FEATURES
features.path = $$[QT_HOST_DATA]/mkspecs/features/