| 1 |
/* |
| 2 |
* Copyright 2016 Canonical Ltd. |
| 3 |
* |
| 4 |
* This program is free software; you can redistribute it and/or modify |
| 5 |
* it under the terms of the GNU Lesser General Public License as published by |
| 6 |
* the Free Software Foundation; version 3. |
| 7 |
* |
| 8 |
* This program is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 |
* GNU Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public License |
| 14 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
#include "plugin.h" |
| 18 |
|
| 19 |
#include <QtQml/QQmlEngine> |
| 20 |
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) |
| 21 |
#include <LomiriToolkit-Qt6/lomiritoolkitmodule.h> |
| 22 |
#else |
| 23 |
#include <LomiriToolkit/lomiritoolkitmodule.h> |
| 24 |
#endif |
| 25 |
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) |
| 26 |
#include <LomiriGestures-Qt6/lomirigesturesmodule.h> |
| 27 |
#else |
| 28 |
#include <LomiriGestures/lomirigesturesmodule.h> |
| 29 |
#endif |
| 30 |
|
| 31 |
UbuntuComponentsPlugin::~UbuntuComponentsPlugin() |
| 32 |
{ |
| 33 |
UT_PREPEND_NAMESPACE(LomiriToolkitModule)::undefineModule(); |
| 34 |
UG_PREPEND_NAMESPACE(LomiriGesturesModule)::undefineModule(); |
| 35 |
} |
| 36 |
|
| 37 |
void UbuntuComponentsPlugin::registerTypes(const char *uri) |
| 38 |
{ |
| 39 |
Q_ASSERT(uri == QLatin1String("Ubuntu.Components")); |
| 40 |
Q_UNUSED(uri); |
| 41 |
|
| 42 |
UG_PREPEND_NAMESPACE(LomiriGesturesModule)::defineModule(uri); |
| 43 |
UT_PREPEND_NAMESPACE(LomiriToolkitModule)::defineModule(uri); |
| 44 |
} |
| 45 |
|
| 46 |
void UbuntuComponentsPlugin::initializeEngine(QQmlEngine *engine, const char *uri) |
| 47 |
{ |
| 48 |
// Give the base URL for Lomiri.Components. Normally it should be adjacent. |
| 49 |
// Only one ".." because the rightmost component is considered a file. |
| 50 |
// FIXME: may be incorrect for QRC case. |
| 51 |
QUrl lomiriBaseUrl = baseUrl().resolved(QUrl("../Lomiri/Components")); |
| 52 |
|
| 53 |
UT_PREPEND_NAMESPACE(LomiriToolkitModule)::initializeModule(engine, lomiriBaseUrl); |
| 54 |
QQmlExtensionPlugin::initializeEngine(engine, uri); |
| 55 |
} |