| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the Qt Quick Extras module of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU Lesser General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
| 19 | ** General Public License version 3 as published by the Free Software |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
| 21 | ** packaging of this file. Please review the following information to |
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements |
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
| 24 | ** |
| 25 | ** GNU General Public License Usage |
| 26 | ** Alternatively, this file may be used under the terms of the GNU |
| 27 | ** General Public License version 2.0 or (at your option) the GNU General |
| 28 | ** Public license version 3 or any later version approved by the KDE Free |
| 29 | ** Qt Foundation. The licenses are as published by the Free Software |
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
| 31 | ** included in the packaging of this file. Please review the following |
| 32 | ** information to ensure the GNU General Public License requirements will |
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
| 35 | ** |
| 36 | ** $QT_END_LICENSE$ |
| 37 | ** |
| 38 | ****************************************************************************/ |
| 39 | |
| 40 | #include "plugin.h" |
| 41 | |
| 42 | #include <QtCore/qfile.h> |
| 43 | |
| 44 | #include "qquickpicture_p.h" |
| 45 | #include "qquicktriggermode_p.h" |
| 46 | #include "Private/qquickcircularprogressbar_p.h" |
| 47 | #include "Private/qquickflatprogressbar_p.h" |
| 48 | #include "Private/qquickmousethief_p.h" |
| 49 | #include "Private/qquickmathutils_p.h" |
| 50 | |
| 51 | static void initResources() |
| 52 | { |
| 53 | #ifdef QT_STATIC |
| 54 | Q_INIT_RESOURCE(qmake_QtQuick_Extras); |
| 55 | #endif |
| 56 | } |
| 57 | |
| 58 | QT_BEGIN_NAMESPACE |
| 59 | |
| 60 | static QObject *registerMathUtilsSingleton(QQmlEngine *engine, QJSEngine *jsEngine) |
| 61 | { |
| 62 | Q_UNUSED(engine); |
| 63 | Q_UNUSED(jsEngine); |
| 64 | return new QQuickMathUtils(); |
| 65 | } |
| 66 | |
| 67 | QtQuickExtrasPlugin::(QObject *parent) : |
| 68 | QQmlExtensionPlugin(parent) |
| 69 | { |
| 70 | initResources(); |
| 71 | } |
| 72 | |
| 73 | void QtQuickExtrasPlugin::(const char *uri) |
| 74 | { |
| 75 | #ifndef QT_STATIC |
| 76 | # ifdef Q_OS_ANDROID |
| 77 | const QString prefix = QLatin1String("qrc:/android_rcc_bundle/qml/QtQuick/Extras" ); |
| 78 | # else |
| 79 | const QString prefix = baseUrl().toString(); |
| 80 | # endif // Q_OS_ANDROID |
| 81 | #else |
| 82 | const QString prefix = "qrc:/qt-project.org/imports/QtQuick/Extras" ; |
| 83 | #endif |
| 84 | // Register public API. |
| 85 | qmlRegisterUncreatableType<QQuickActivationMode>(uri, versionMajor: 1, versionMinor: 0, qmlName: "ActivationMode" , reason: QLatin1String("Do not create objects of type ActivationMode" )); |
| 86 | // register 1.0 |
| 87 | qmlRegisterType(url: QUrl(prefix + "/CircularGauge.qml" ), uri, versionMajor: 1, versionMinor: 0, qmlName: "CircularGauge" ); |
| 88 | qmlRegisterType(url: QUrl(prefix + "/DelayButton.qml" ), uri, versionMajor: 1, versionMinor: 0, qmlName: "DelayButton" ); |
| 89 | qmlRegisterType(url: QUrl(prefix + "/Dial.qml" ), uri, versionMajor: 1, versionMinor: 0, qmlName: "Dial" ); |
| 90 | qmlRegisterType(url: QUrl(prefix + "/Gauge.qml" ), uri, versionMajor: 1, versionMinor: 0, qmlName: "Gauge" ); |
| 91 | qmlRegisterType(url: QUrl(prefix + "/PieMenu.qml" ), uri, versionMajor: 1, versionMinor: 0, qmlName: "PieMenu" ); |
| 92 | qmlRegisterType(url: QUrl(prefix + "/StatusIndicator.qml" ), uri, versionMajor: 1, versionMinor: 0, qmlName: "StatusIndicator" ); |
| 93 | qmlRegisterType(url: QUrl(prefix + "/ToggleButton.qml" ), uri, versionMajor: 1, versionMinor: 0, qmlName: "ToggleButton" ); |
| 94 | // register 1.1 |
| 95 | qmlRegisterType(url: QUrl(prefix + "/Dial.qml" ), uri, versionMajor: 1, versionMinor: 1, qmlName: "Dial" ); |
| 96 | qmlRegisterType(url: QUrl(prefix + "/StatusIndicator.qml" ), uri, versionMajor: 1, versionMinor: 1, qmlName: "StatusIndicator" ); |
| 97 | // register 1.2 |
| 98 | qmlRegisterType(url: QUrl(prefix + "/Tumbler.qml" ), uri, versionMajor: 1, versionMinor: 2, qmlName: "Tumbler" ); |
| 99 | qmlRegisterType(url: QUrl(prefix + "/TumblerColumn.qml" ), uri, versionMajor: 1, versionMinor: 2, qmlName: "TumblerColumn" ); |
| 100 | // register 1.3 |
| 101 | qmlRegisterUncreatableType<QQuickTriggerMode>(uri, versionMajor: 1, versionMinor: 3, qmlName: "TriggerMode" , reason: QLatin1String("Do not create objects of type TriggerMode" )); |
| 102 | // register 1.4 |
| 103 | #if QT_CONFIG(picture) |
| 104 | qmlRegisterType<QQuickPicture>(uri, versionMajor: 1, versionMinor: 4, qmlName: "Picture" ); |
| 105 | #endif |
| 106 | |
| 107 | qmlRegisterType<QQuickMouseThief>(uri: "QtQuick.Extras.Private.CppUtils" , versionMajor: 1, versionMinor: 0, qmlName: "MouseThief" ); |
| 108 | qmlRegisterType<QQuickCircularProgressBar>(uri: "QtQuick.Extras.Private.CppUtils" , versionMajor: 1, versionMinor: 1, qmlName: "CircularProgressBar" ); |
| 109 | qmlRegisterType<QQuickFlatProgressBar>(uri: "QtQuick.Extras.Private.CppUtils" , versionMajor: 1, versionMinor: 1, qmlName: "FlatProgressBar" ); |
| 110 | qmlRegisterSingletonType<QQuickMathUtils>(uri: "QtQuick.Extras.Private.CppUtils" , versionMajor: 1, versionMinor: 0, typeName: "MathUtils" , callback: registerMathUtilsSingleton); |
| 111 | |
| 112 | const char *private_uri = "QtQuick.Extras.Private" ; |
| 113 | qmlRegisterType(url: QUrl(prefix + "/Private/CircularButton.qml" ), uri: private_uri, versionMajor: 1, versionMinor: 0, qmlName: "CircularButton" ); |
| 114 | qmlRegisterType(url: QUrl(prefix + "/Private/CircularButtonStyleHelper.qml" ), uri: private_uri, versionMajor: 1, versionMinor: 0, qmlName: "CircularButtonStyleHelper" ); |
| 115 | qmlRegisterType(url: QUrl(prefix + "/Private/CircularTickmarkLabel.qml" ), uri: private_uri, versionMajor: 1, versionMinor: 0, qmlName: "CircularTickmarkLabel" ); |
| 116 | qmlRegisterType(url: QUrl(prefix + "/Private/Handle.qml" ), uri: private_uri, versionMajor: 1, versionMinor: 0, qmlName: "Handle" ); |
| 117 | qmlRegisterType(url: QUrl(prefix + "/Private/PieMenuIcon.qml" ), uri: private_uri, versionMajor: 1, versionMinor: 0, qmlName: "PieMenuIcon" ); |
| 118 | qmlRegisterSingletonType(url: QUrl(prefix + "/Private/TextSingleton.qml" ), uri: private_uri, versionMajor: 1, versionMinor: 0, qmlName: "TextSingleton" ); |
| 119 | } |
| 120 | |
| 121 | QT_END_NAMESPACE |
| 122 | |