From 70f35501da4d1bbb36703dcc7b121c454f8d57a9 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 19 Dec 2017 16:37:24 +0100 Subject: Add a feature for qml-animation It should be possible to switch it off without globally switching animations off in Qt. Change-Id: I3cae6b72b2c6b5c420f21625208de5e273839438 Reviewed-by: Oswald Buddenhagen Reviewed-by: Lars Knoll --- src/imports/imports.pro | 4 ++-- src/qml/animations/qabstractanimationjob_p.h | 2 ++ src/qml/animations/qanimationgroupjob_p.h | 2 ++ src/qml/animations/qanimationjobutil_p.h | 2 ++ src/qml/animations/qcontinuinganimationgroupjob_p.h | 2 ++ src/qml/animations/qparallelanimationgroupjob_p.h | 2 ++ src/qml/animations/qpauseanimationjob_p.h | 2 ++ src/qml/animations/qsequentialanimationgroupjob_p.h | 2 ++ src/qml/configure.json | 7 +++++++ src/qml/qml.pro | 2 +- src/qml/qml/qqmlengine.cpp | 4 ++-- src/qml/types/qqmltimer_p.h | 2 ++ src/qml/types/types.pri | 2 +- src/src.pro | 2 +- tools/qml/main.cpp | 6 ++++-- tools/qml/qml.pro | 2 +- 16 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/imports/imports.pro b/src/imports/imports.pro index 5d7e434884..3263774fd5 100644 --- a/src/imports/imports.pro +++ b/src/imports/imports.pro @@ -1,7 +1,5 @@ TEMPLATE = subdirs -QT_FOR_CONFIG += quick-private - SUBDIRS += \ builtins \ qtqml \ @@ -13,6 +11,8 @@ qtConfig(settings): SUBDIRS += settings qtConfig(statemachine): SUBDIRS += statemachine qtHaveModule(quick) { + QT_FOR_CONFIG += quick-private + SUBDIRS += \ handlers \ layouts \ diff --git a/src/qml/animations/qabstractanimationjob_p.h b/src/qml/animations/qabstractanimationjob_p.h index 63fd4b0dac..0be6ca96ea 100644 --- a/src/qml/animations/qabstractanimationjob_p.h +++ b/src/qml/animations/qabstractanimationjob_p.h @@ -56,6 +56,8 @@ #include #include +QT_REQUIRE_CONFIG(qml_animation); + QT_BEGIN_NAMESPACE class QAnimationGroupJob; diff --git a/src/qml/animations/qanimationgroupjob_p.h b/src/qml/animations/qanimationgroupjob_p.h index 26965c0264..148cb0c098 100644 --- a/src/qml/animations/qanimationgroupjob_p.h +++ b/src/qml/animations/qanimationgroupjob_p.h @@ -54,6 +54,8 @@ #include "private/qabstractanimationjob_p.h" #include +QT_REQUIRE_CONFIG(qml_animation); + QT_BEGIN_NAMESPACE class Q_QML_PRIVATE_EXPORT QAnimationGroupJob : public QAbstractAnimationJob diff --git a/src/qml/animations/qanimationjobutil_p.h b/src/qml/animations/qanimationjobutil_p.h index 0bb9e83b2d..e3d6fe9178 100644 --- a/src/qml/animations/qanimationjobutil_p.h +++ b/src/qml/animations/qanimationjobutil_p.h @@ -51,6 +51,8 @@ // We mean it. // +QT_REQUIRE_CONFIG(qml_animation); + #define RETURN_IF_DELETED(func) \ { \ bool *prevWasDeleted = m_wasDeleted; \ diff --git a/src/qml/animations/qcontinuinganimationgroupjob_p.h b/src/qml/animations/qcontinuinganimationgroupjob_p.h index baf4ff1ae5..c67b8d39ad 100644 --- a/src/qml/animations/qcontinuinganimationgroupjob_p.h +++ b/src/qml/animations/qcontinuinganimationgroupjob_p.h @@ -53,6 +53,8 @@ #include "private/qanimationgroupjob_p.h" +QT_REQUIRE_CONFIG(qml_animation); + QT_BEGIN_NAMESPACE class Q_QML_PRIVATE_EXPORT QContinuingAnimationGroupJob : public QAnimationGroupJob diff --git a/src/qml/animations/qparallelanimationgroupjob_p.h b/src/qml/animations/qparallelanimationgroupjob_p.h index 358b95ce53..2d48686335 100644 --- a/src/qml/animations/qparallelanimationgroupjob_p.h +++ b/src/qml/animations/qparallelanimationgroupjob_p.h @@ -53,6 +53,8 @@ #include "private/qanimationgroupjob_p.h" +QT_REQUIRE_CONFIG(qml_animation); + QT_BEGIN_NAMESPACE class Q_QML_PRIVATE_EXPORT QParallelAnimationGroupJob : public QAnimationGroupJob diff --git a/src/qml/animations/qpauseanimationjob_p.h b/src/qml/animations/qpauseanimationjob_p.h index e228f46daa..53bf8a88b5 100644 --- a/src/qml/animations/qpauseanimationjob_p.h +++ b/src/qml/animations/qpauseanimationjob_p.h @@ -53,6 +53,8 @@ #include +QT_REQUIRE_CONFIG(qml_animation); + QT_BEGIN_NAMESPACE class Q_QML_PRIVATE_EXPORT QPauseAnimationJob : public QAbstractAnimationJob diff --git a/src/qml/animations/qsequentialanimationgroupjob_p.h b/src/qml/animations/qsequentialanimationgroupjob_p.h index 5fbafcb9ac..760445c8c6 100644 --- a/src/qml/animations/qsequentialanimationgroupjob_p.h +++ b/src/qml/animations/qsequentialanimationgroupjob_p.h @@ -53,6 +53,8 @@ #include +QT_REQUIRE_CONFIG(qml_animation); + QT_BEGIN_NAMESPACE class QPauseAnimationJob; diff --git a/src/qml/configure.json b/src/qml/configure.json index 95a4dd5240..47b897ce27 100644 --- a/src/qml/configure.json +++ b/src/qml/configure.json @@ -73,6 +73,13 @@ "purpose": "Provides support for locales in QML.", "section": "QML", "output": [ "privateFeature" ] + }, + "qml-animation": { + "label": "QML Animations", + "purpose": "Provides support for animations and timers in QML.", + "section": "QML", + "condition": "features.animation", + "output": [ "privateFeature" ] } }, diff --git a/src/qml/qml.pro b/src/qml/qml.pro index acaff08a29..adfaf38e9f 100644 --- a/src/qml/qml.pro +++ b/src/qml/qml.pro @@ -61,7 +61,7 @@ include(jsruntime/jsruntime.pri) include(jit/jit.pri) include(qml/qml.pri) include(debugger/debugger.pri) -qtConfig(animation) { +qtConfig(qml-animation) { include(animations/animations.pri) } include(types/types.pri) diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 6d289b3c9e..99e55a4300 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -83,7 +83,7 @@ #endif #include #include -#if QT_CONFIG(animation) +#if QT_CONFIG(qml_animation) #include #endif #if QT_CONFIG(qml_list_model) @@ -226,7 +226,7 @@ void QQmlEnginePrivate::registerBaseTypes(const char *uri, int versionMajor, int qmlRegisterType(uri, versionMajor, (versionMinor < 8 ? 8 : versionMinor), "Binding"); //Only available in >=2.8 qmlRegisterType(uri, versionMajor, (versionMinor < 3 ? 3 : versionMinor), "Connections"); //Only available in >=2.3 qmlRegisterType(uri, versionMajor, versionMinor,"Connections"); -#if QT_CONFIG(animation) +#if QT_CONFIG(qml_animation) qmlRegisterType(uri, versionMajor, versionMinor,"Timer"); #endif qmlRegisterType(uri, versionMajor, (versionMinor < 1 ? 1 : versionMinor), "Instantiator"); //Only available in >=2.1 diff --git a/src/qml/types/qqmltimer_p.h b/src/qml/types/qqmltimer_p.h index 7739dad2a6..c97230501e 100644 --- a/src/qml/types/qqmltimer_p.h +++ b/src/qml/types/qqmltimer_p.h @@ -57,6 +57,8 @@ #include +QT_REQUIRE_CONFIG(qml_animation); + QT_BEGIN_NAMESPACE class QQmlTimerPrivate; diff --git a/src/qml/types/types.pri b/src/qml/types/types.pri index 574e7c214d..25b231f954 100644 --- a/src/qml/types/types.pri +++ b/src/qml/types/types.pri @@ -33,7 +33,7 @@ qtConfig(qml-list-model) { $$PWD/qqmllistmodelworkeragent_p.h } -qtConfig(animation) { +qtConfig(qml-animation) { SOURCES += \ $$PWD/qqmltimer.cpp diff --git a/src/src.pro b/src/src.pro index ce4d69761a..8ff4d4af10 100644 --- a/src/src.pro +++ b/src/src.pro @@ -6,7 +6,7 @@ QT_FOR_CONFIG += qml qml-private quick-private SUBDIRS += \ qml -qtHaveModule(gui):qtConfig(animation) { +qtConfig(qml-animation) { SUBDIRS += \ quick \ qmltest diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 83680a5ba1..c8858a44ae 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -55,7 +55,9 @@ #include #include #include -#if QT_CONFIG(animation) + +#include +#if QT_CONFIG(qml_animation) #include #endif @@ -483,7 +485,7 @@ int main(int argc, char *argv[]) break; else if (arg == QLatin1String("-verbose")) verboseMode = true; -#if QT_CONFIG(animation) +#if QT_CONFIG(qml_animation) else if (arg == QLatin1String("-slow-animations")) QUnifiedTimer::instance()->setSlowModeEnabled(true); else if (arg == QLatin1String("-fixed-animations")) diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro index 04704f9314..3f41707275 100644 --- a/tools/qml/qml.pro +++ b/tools/qml/qml.pro @@ -1,4 +1,4 @@ -QT = qml core-private +QT = qml-private core-private qtHaveModule(gui): QT += gui qtHaveModule(widgets): QT += widgets -- cgit v1.2.3