From f1d884b6dad5a93d7a3077b6b05d3ec7fcd9a6ea Mon Sep 17 00:00:00 2001 From: Teemu Holappa Date: Thu, 11 Feb 2016 11:50:55 +0200 Subject: Refactored Qml plugins into modules. Separated C++ and Qml interfaces. All the UI's from plugins are moved to the settingsui folder. Change-Id: Id6a6623346b18321357bc42d24121c4d9cdfd098 Reviewed-by: Kimmo Ollila --- .../bluetoothsettings/bluetoothsettings.pro | 17 +++ src/imports/bluetoothsettings/plugin.cpp | 67 +++++++++ src/imports/bluetoothsettings/qmldir | 2 + src/imports/displaysettings/displaysettings.pro | 18 +++ src/imports/displaysettings/plugin.cpp | 63 ++++++++ src/imports/displaysettings/qmldir | 2 + src/imports/imports.pro | 7 +- src/imports/localdevice/localdevice.pro | 17 +++ src/imports/localdevice/plugin.cpp | 117 +++++++++++++++ src/imports/localdevice/plugins.qmltypes | 54 +++++++ src/imports/localdevice/qmldir | 3 + src/imports/localesettings/locale.xml | 12 ++ src/imports/localesettings/localesettings.pro | 18 +++ src/imports/localesettings/plugin.cpp | 75 ++++++++++ src/imports/localesettings/qmldir | 2 + src/imports/networksettings/networksettings.pro | 34 +++++ src/imports/networksettings/plugin.cpp | 67 +++++++++ src/imports/networksettings/plugin.h | 52 +++++++ src/imports/networksettings/qmldir | 3 + src/imports/timedatesettings/plugin.cpp | 77 ++++++++++ src/imports/timedatesettings/qmldir | 2 + src/imports/timedatesettings/timedatesettings.pro | 19 +++ src/imports/utils/plugin.cpp | 160 --------------------- src/imports/utils/plugins.qmltypes | 54 ------- src/imports/utils/qmldir | 3 - src/imports/utils/utils.pro | 10 -- 26 files changed, 727 insertions(+), 228 deletions(-) create mode 100644 src/imports/bluetoothsettings/bluetoothsettings.pro create mode 100644 src/imports/bluetoothsettings/plugin.cpp create mode 100644 src/imports/bluetoothsettings/qmldir create mode 100644 src/imports/displaysettings/displaysettings.pro create mode 100644 src/imports/displaysettings/plugin.cpp create mode 100644 src/imports/displaysettings/qmldir create mode 100644 src/imports/localdevice/localdevice.pro create mode 100644 src/imports/localdevice/plugin.cpp create mode 100644 src/imports/localdevice/plugins.qmltypes create mode 100644 src/imports/localdevice/qmldir create mode 100644 src/imports/localesettings/locale.xml create mode 100644 src/imports/localesettings/localesettings.pro create mode 100644 src/imports/localesettings/plugin.cpp create mode 100644 src/imports/localesettings/qmldir create mode 100644 src/imports/networksettings/networksettings.pro create mode 100644 src/imports/networksettings/plugin.cpp create mode 100644 src/imports/networksettings/plugin.h create mode 100644 src/imports/networksettings/qmldir create mode 100644 src/imports/timedatesettings/plugin.cpp create mode 100644 src/imports/timedatesettings/qmldir create mode 100644 src/imports/timedatesettings/timedatesettings.pro delete mode 100644 src/imports/utils/plugin.cpp delete mode 100644 src/imports/utils/plugins.qmltypes delete mode 100644 src/imports/utils/qmldir delete mode 100644 src/imports/utils/utils.pro (limited to 'src/imports') diff --git a/src/imports/bluetoothsettings/bluetoothsettings.pro b/src/imports/bluetoothsettings/bluetoothsettings.pro new file mode 100644 index 0000000..3475ffa --- /dev/null +++ b/src/imports/bluetoothsettings/bluetoothsettings.pro @@ -0,0 +1,17 @@ +TEMPLATE = lib +CONFIG += plugin +QT += qml bluetooth bluetoothsettings +uri = com.theqtcompany.settings.bluetooth + +TARGET = btsettingsplugin + +pluginfiles.files += \ + qmldir \ + +SOURCES += plugin.cpp + +installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /) + +target.path = $$installPath +pluginfiles.path += $$installPath +INSTALLS += target pluginfiles diff --git a/src/imports/bluetoothsettings/plugin.cpp b/src/imports/bluetoothsettings/plugin.cpp new file mode 100644 index 0000000..d0a25c3 --- /dev/null +++ b/src/imports/bluetoothsettings/plugin.cpp @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include + +#include "bluetoothdevice.h" +#include "discoverymodel.h" + +class BluetoothSettingsQmlPlugin : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + +public: + void registerTypes(const char *uri) + { + Q_ASSERT(QLatin1String(uri) == QLatin1String("com.theqtcompany.settings.bluetooth")); + qmlRegisterUncreatableType(uri, 1, 0, "BtDeviceItem", "Cannot be instantiated directly."); + + } + + void initializeEngine(QQmlEngine * engine, const char * uri) + { + Q_ASSERT(QLatin1String(uri) == QLatin1String("com.theqtcompany.settings.bluetooth")); + BluetoothDevice *device = new BluetoothDevice(engine); + engine->rootContext()->setContextProperty("BtDevice", device); + } +}; + +#include "plugin.moc" diff --git a/src/imports/bluetoothsettings/qmldir b/src/imports/bluetoothsettings/qmldir new file mode 100644 index 0000000..f63b52f --- /dev/null +++ b/src/imports/bluetoothsettings/qmldir @@ -0,0 +1,2 @@ +module com.theqtcompany.settings.bluetooth +plugin btsettingsplugin diff --git a/src/imports/displaysettings/displaysettings.pro b/src/imports/displaysettings/displaysettings.pro new file mode 100644 index 0000000..4c581f4 --- /dev/null +++ b/src/imports/displaysettings/displaysettings.pro @@ -0,0 +1,18 @@ +TEMPLATE = lib +CONFIG += plugin +QT += qml displaysettings + +uri = com.theqtcompany.settings.display + +TARGET = qmldisplaysettingsplugin + +SOURCES += plugin.cpp \ + +pluginfiles.files += \ + qmldir \ + +installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /) + +target.path = $$installPath +pluginfiles.path += $$installPath +INSTALLS += target pluginfiles diff --git a/src/imports/displaysettings/plugin.cpp b/src/imports/displaysettings/plugin.cpp new file mode 100644 index 0000000..92c0171 --- /dev/null +++ b/src/imports/displaysettings/plugin.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include "displaysettings.h" + +template +QObject *instance(QQmlEngine *engine, QJSEngine *) { + T *t = new T(engine); + t->setObjectName(T::staticMetaObject.className()); + return t; +} + +class GeneralSettingsQmlPlugin : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + +public: + void registerTypes(const char *uri) + { + qmlRegisterType(QUrl("qrc:/Display.qml"), uri, 1, 0, "Display"); + qmlRegisterSingletonType(uri, 1, 0, "DisplaySettings", &instance); + } +}; + +#include "plugin.moc" diff --git a/src/imports/displaysettings/qmldir b/src/imports/displaysettings/qmldir new file mode 100644 index 0000000..4f8a3db --- /dev/null +++ b/src/imports/displaysettings/qmldir @@ -0,0 +1,2 @@ +module com.theqtcompany.settings.display +plugin qmldisplaysettingsplugin diff --git a/src/imports/imports.pro b/src/imports/imports.pro index 38f61c3..f34be18 100644 --- a/src/imports/imports.pro +++ b/src/imports/imports.pro @@ -1,2 +1,7 @@ TEMPLATE = subdirs -SUBDIRS += utils +SUBDIRS += networksettings \ + bluetoothsettings \ + localesettings \ + timedatesettings \ + localdevice \ + displaysettings diff --git a/src/imports/localdevice/localdevice.pro b/src/imports/localdevice/localdevice.pro new file mode 100644 index 0000000..dfcbcf9 --- /dev/null +++ b/src/imports/localdevice/localdevice.pro @@ -0,0 +1,17 @@ +TEMPLATE = lib +CONFIG += plugin +TARGET = localdeviceplugin +uri = com.theqtcompany.localdevice + +QT += qml localdevice + +pluginfiles.files += \ + qmldir \ + +SOURCES += plugin.cpp + +installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /) + +target.path = $$installPath +pluginfiles.path += $$installPath +INSTALLS += target pluginfiles diff --git a/src/imports/localdevice/plugin.cpp b/src/imports/localdevice/plugin.cpp new file mode 100644 index 0000000..b69d9b4 --- /dev/null +++ b/src/imports/localdevice/plugin.cpp @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** All rights reserved. +** For any questions to Digia, please use the contact form at +** http://www.qt.io +** +** This file is part of Qt Enterprise Embedded. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** the contact form at http://www.qt.io +** +****************************************************************************/ +#include +#include + +/*! + \qmlmodule com.theqtcompany.localdevice 1.0 + \title Qt Local Device QML Module + \ingroup qtee-qmlmodules + \brief A collection of the local device related utility functions, accessible from QML. +*/ + +/*! + \page b2qt-addon-utils.html + \title Qt Local Device Module + \ingroup qtee-modules + \brief A collection of the local device realted utility functions, accessible from QML. + + Provides utility functions for controlling an embedded + device, such as device shutdown/reboot. + + Import the module as follows: + + \badcode + import com.theqtcompany.localdevice 1.0 + \endcode + + This will give you access to the singleton QML type LocalDevice. + + \note Some functions are currently only implemented for one of + the platforms. + + \section1 QML Types + + \annotatedlist utils-qmltypes +*/ + +/*! + \qmltype LocalDevice + \inqmlmodule com.theqtcompany.localdevice + \ingroup utils-qmltypes + \brief Singleton QML type providing access to utility functions. + + LocalDevice QML type is the interface to various utility + functions. + + There is no need to create an instance of this object. To use it, + simply import the \c {LocalDevice} module: + + \qml + com.theqtcompany.localdevice + + \endqml + + \note Some functions are currently only implemented for one of + the platforms. +*/ + +/*! + \qmlmethod LocalDevice::reboot() + + Reboots the system. Does not return. + + \sa powerOff() +*/ + +/*! + \qmlmethod LocalDevice::powerOff() + + Shuts down the system. Does not return. + + \sa reboot() +*/ + +static QObject *module_api_factory(QQmlEngine *engine, QJSEngine *scriptEngine) +{ + Q_UNUSED(engine) + Q_UNUSED(scriptEngine) + QLocalDevice *api = new QLocalDevice(); + + return api; +} + +class B2QtUtilsPlugin : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + +public: + B2QtUtilsPlugin() + { + } + + void registerTypes(const char *uri) + { + Q_ASSERT(QLatin1String(uri) == "com.theqtcompany.localdevice"); + qmlRegisterSingletonType(uri, 1, 0, "LocalDevice", module_api_factory); + } +}; + +#include "plugin.moc" diff --git a/src/imports/localdevice/plugins.qmltypes b/src/imports/localdevice/plugins.qmltypes new file mode 100644 index 0000000..88acb66 --- /dev/null +++ b/src/imports/localdevice/plugins.qmltypes @@ -0,0 +1,54 @@ +import QtQuick.tooling 1.1 + +// This file describes the plugin-supplied types contained in the library. +// It is used for QML tooling purposes only. +// +// This file was auto-generated by: +// 'qmlplugindump -nonrelocatable B2Qt.Utils 1.0 /system/qml/B2Qt/Utils/' + +Module { + Component { + name: "B2QtDevice" + prototype: "QObject" + exports: ["B2Qt.Utils/B2QtDevice 1.0"] + isCreatable: false + isSingleton: true + exportMetaObjectRevisions: [0] + Property { name: "displayBrightness"; type: "uchar" } + Property { name: "hostname"; type: "string" } + Property { name: "ipAddress"; type: "string"; isReadonly: true } + Property { name: "masterVolume"; type: "int" } + Signal { + name: "displayBrightnessChanged" + Parameter { name: "newValue"; type: "uchar" } + } + Signal { + name: "hostnameChanged" + Parameter { name: "newName"; type: "string" } + } + Signal { + name: "ipAddressChanged" + Parameter { name: "newAddress"; type: "string" } + } + Signal { + name: "masterVolumeChanged" + Parameter { name: "newVolume"; type: "int" } + } + Method { name: "reboot" } + Method { name: "powerOff" } + Method { + name: "setDisplayBrightness" + type: "bool" + Parameter { name: "value"; type: "uchar" } + } + Method { + name: "setHostname" + type: "bool" + Parameter { name: "name"; type: "string" } + } + Method { + name: "setMasterVolume" + Parameter { name: "volume"; type: "int" } + } + } +} diff --git a/src/imports/localdevice/qmldir b/src/imports/localdevice/qmldir new file mode 100644 index 0000000..ae1b1c5 --- /dev/null +++ b/src/imports/localdevice/qmldir @@ -0,0 +1,3 @@ +module com.theqtcompany.localdevice +plugin localdeviceplugin +typeinfo plugins.qmltypes diff --git a/src/imports/localesettings/locale.xml b/src/imports/localesettings/locale.xml new file mode 100644 index 0000000..b722456 --- /dev/null +++ b/src/imports/localesettings/locale.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/imports/localesettings/localesettings.pro b/src/imports/localesettings/localesettings.pro new file mode 100644 index 0000000..891e4f8 --- /dev/null +++ b/src/imports/localesettings/localesettings.pro @@ -0,0 +1,18 @@ +TEMPLATE = lib +CONFIG += plugin +QT += qml localesettings + +uri = com.theqtcompany.settings.locale + +TARGET = localesettingsplugin + +SOURCES += plugin.cpp + +pluginfiles.files += \ + qmldir \ + +installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /) + +target.path = $$installPath +pluginfiles.path += $$installPath +INSTALLS += target pluginfiles diff --git a/src/imports/localesettings/plugin.cpp b/src/imports/localesettings/plugin.cpp new file mode 100644 index 0000000..7edd2c5 --- /dev/null +++ b/src/imports/localesettings/plugin.cpp @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include + +#include +#include +#include + +template +QObject *instance(QQmlEngine *engine, QJSEngine *) { + T *t = new T(engine); + t->setObjectName(T::staticMetaObject.className()); + return t; +} + +class LanguageSettingsQmlPlugin : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + +public: + void registerTypes(const char *uri) + { + qmlRegisterSingletonType(uri, 1, 0, "LocaleManager", &instance); + } + + void initializeEngine(QQmlEngine * engine, const char * uri) + { + Q_ASSERT(QLatin1String(uri) == QLatin1String("com.theqtcompany.settings.locale")); + LocaleModel*localeModel = new LocaleModel(engine); + LocaleFilterModel* filter = new LocaleFilterModel(engine); + filter->setSourceModel(localeModel); + engine->rootContext()->setContextProperty("LocaleFilter", filter); + } +}; + +#include "plugin.moc" diff --git a/src/imports/localesettings/qmldir b/src/imports/localesettings/qmldir new file mode 100644 index 0000000..3c59bb0 --- /dev/null +++ b/src/imports/localesettings/qmldir @@ -0,0 +1,2 @@ +module com.theqtcompany.settings.locale +plugin localesettingsplugin diff --git a/src/imports/networksettings/networksettings.pro b/src/imports/networksettings/networksettings.pro new file mode 100644 index 0000000..45228c5 --- /dev/null +++ b/src/imports/networksettings/networksettings.pro @@ -0,0 +1,34 @@ +TEMPLATE = lib +TARGET = networksettingsplugin +QT += qml quick networksettings +CONFIG += qt plugin + +uri = com.theqtcompany.settings.network + +SOURCES += \ + plugin.cpp \ + +HEADERS += \ + plugin.h \ + +DISTFILES = qmldir + +!equals(_PRO_FILE_PWD_, $$OUT_PWD) { + copy_qmldir.target = $$OUT_PWD/qmldir + copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir + copy_qmldir.commands = $(COPY_FILE) \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)\" + QMAKE_EXTRA_TARGETS += copy_qmldir + PRE_TARGETDEPS += $$copy_qmldir.target +} + +qmldir.files = qmldir + +pluginfiles.files += \ + +installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /) + +pluginfiles.path = $$installPath +qmldir.path = $$installPath +target.path = $$installPath +INSTALLS += target qmldir pluginfiles + diff --git a/src/imports/networksettings/plugin.cpp b/src/imports/networksettings/plugin.cpp new file mode 100644 index 0000000..eeee147 --- /dev/null +++ b/src/imports/networksettings/plugin.cpp @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "plugin.h" +#include +#include +#include +#include + +#include +#include +#include + +void NetworksettingspluginPlugin::registerTypes(const char *uri) +{ + Q_ASSERT(QLatin1String(uri) == QLatin1String("com.theqtcompany.settings.network")); + qmlRegisterUncreatableType(uri, 1, 0, "NetworkService", "Cannot be instantiated directly."); + qmlRegisterUncreatableType(uri, 1, 0, "NetworkSettingsIPv4", "Cannot be instantiated directly."); + qmlRegisterUncreatableType(uri, 1, 0, "NetworkSettingsIPv6", "Cannot be instantiated directly."); + qmlRegisterUncreatableType(uri, 1, 0, "NetworkSettingsProxy", "Cannot be instantiated directly."); + qmlRegisterUncreatableType(uri, 1, 0, "NetworkSettingsType", "Cannot be instantiated directly."); + qmlRegisterUncreatableType(uri, 1, 0, "NetworkSettingsState", "Cannot be instantiated directly."); +} + + +void NetworksettingspluginPlugin::initializeEngine(QQmlEngine * engine, const char * uri) +{ + Q_ASSERT(QLatin1String(uri) == QLatin1String("com.theqtcompany.settings.network")); + QNetworkSettingsManager* networkManager = new QNetworkSettingsManager(engine); + QNetworkSettingsUserAgent* userAgent = new QNetworkSettingsUserAgent(engine); + networkManager->setUserAgent(userAgent); + + engine->rootContext()->setContextProperty("NetworkSettingsManager", networkManager); + engine->rootContext()->setContextProperty("NetworkSettingsUserAgent", userAgent); +} diff --git a/src/imports/networksettings/plugin.h b/src/imports/networksettings/plugin.h new file mode 100644 index 0000000..f47b964 --- /dev/null +++ b/src/imports/networksettings/plugin.h @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef NETWORKSETTINGSPLUGIN_PLUGIN_H +#define NETWORKSETTINGSPLUGIN_PLUGIN_H + +#include + +class NetworksettingspluginPlugin : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + +public: + void registerTypes(const char *uri); + void initializeEngine(QQmlEngine * engine, const char * uri); +}; + +#endif // NETWORKSETTINGSPLUGIN_PLUGIN_H + diff --git a/src/imports/networksettings/qmldir b/src/imports/networksettings/qmldir new file mode 100644 index 0000000..7774745 --- /dev/null +++ b/src/imports/networksettings/qmldir @@ -0,0 +1,3 @@ +module com.theqtcompany.settings.network +plugin networksettingsplugin + diff --git a/src/imports/timedatesettings/plugin.cpp b/src/imports/timedatesettings/plugin.cpp new file mode 100644 index 0000000..e55cddc --- /dev/null +++ b/src/imports/timedatesettings/plugin.cpp @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include + +#include +#include +#include + +template +QObject *instance(QQmlEngine *engine, QJSEngine *) { + T *t = new T(engine); + t->setObjectName(T::staticMetaObject.className()); + return t; +} + +class TimeDateSettingsQmlPlugin : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + +public: + void registerTypes(const char *uri) + { + qmlRegisterSingletonType(uri, 1, 0, "TimeManager", &instance); + } + + void initializeEngine(QQmlEngine * engine, const char * uri) + { + Q_ASSERT(QLatin1String(uri) == QLatin1String("com.theqtcompany.settings.timedate")); + TimezoneModel* timezoneModel = new TimezoneModel(engine); + TimezoneFilterModel* filter = new TimezoneFilterModel(engine); + filter->setSourceModel(timezoneModel); + + engine->rootContext()->setContextProperty("Timezones", timezoneModel); + engine->rootContext()->setContextProperty("TimezonesFilter", filter); + } +}; + +#include "plugin.moc" diff --git a/src/imports/timedatesettings/qmldir b/src/imports/timedatesettings/qmldir new file mode 100644 index 0000000..3fc8fec --- /dev/null +++ b/src/imports/timedatesettings/qmldir @@ -0,0 +1,2 @@ +module com.theqtcompany.settings.timedate +plugin qmltimedatesettingsplugin diff --git a/src/imports/timedatesettings/timedatesettings.pro b/src/imports/timedatesettings/timedatesettings.pro new file mode 100644 index 0000000..ec86d4e --- /dev/null +++ b/src/imports/timedatesettings/timedatesettings.pro @@ -0,0 +1,19 @@ +TEMPLATE = lib +CONFIG += plugin +QT += qml timedatesettings + +uri = com.theqtcompany.settings.timedate + +DESTDIR = imports/TimeDate +TARGET = qmltimedatesettingsplugin + +SOURCES += plugin.cpp + +pluginfiles.files += qmldir + +installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /) + +target.path = $$installPath +pluginfiles.path += $$installPath +INSTALLS += target pluginfiles + diff --git a/src/imports/utils/plugin.cpp b/src/imports/utils/plugin.cpp deleted file mode 100644 index a4f8810..0000000 --- a/src/imports/utils/plugin.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use the contact form at -** http://www.qt.io -** -** This file is part of Qt Enterprise Embedded. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** the contact form at http://www.qt.io -** -****************************************************************************/ -#include -#include - -/*! - \qmlmodule B2Qt.Utils 1.0 - \title B2Qt Utils QML Module - \ingroup qtee-qmlmodules - \brief A collection of utility functions, accessible from QML. -*/ - -/*! - \page b2qt-addon-utils.html - \title B2Qt Utils Module - \ingroup qtee-modules - \brief A collection of utility functions, accessible from QML. - - Provides various utility functions for controlling an embedded - device, such as display brightness, IP address and hostname, and - device shutdown/reboot. - - Import the module as follows: - - \badcode - import B2Qt.Utils 1.0 - \endcode - - This will give you access to the singleton QML type B2QtDevice. - - \note Some functions are currently only implemented for one of - the platforms. - - \section1 QML Types - - \annotatedlist utils-qmltypes -*/ - -/*! - \qmltype B2QtDevice - \inqmlmodule B2Qt.Utils - \ingroup utils-qmltypes - \brief Singleton QML type providing access to utility functions. - - B2QtDevice QML type is the interface to various utility - functions. - - There is no need to create an instance of this object. To use it, - simply import the \c {B2Qt.Utils} module: - - \qml - import B2Qt.Utils 1.0 - - Text { - text: qsTr("IP Address:") + B2QtDevice.ipAddress - } - \endqml - - \note Some functions are currently only implemented for one of - the platforms. -*/ - -/*! - \qmlmethod B2Qt.Utils::B2QtDevice::reboot() - - Reboots the system. Does not return. - - \sa powerOff() -*/ - -/*! - \qmlmethod B2Qt.Utils::B2QtDevice::powerOff() - - Shuts down the system. Does not return. - - \sa reboot() -*/ - -/*! - \qmlproperty int B2Qt.Utils::B2QtDevice::masterVolume - - This property holds the master volume of the device. - The volume can range from \c 0 to \c 100 and is linear. - Changing the master volume will affect all audio streams. - - \note Currently implemented only for \B2QA. -*/ - -/*! - \qmlproperty int B2Qt.Utils::B2QtDevice::displayBrightness - This property holds the display brightness (the intensity of the backlight). - The value is in the range from \c 0 to \c 255, where 255 is the maximum - brightness, and 0 is the minimum (typically, the backlight is turned off). - - \note Currently implemented only for \B2QA. -*/ - -/*! - \qmlproperty string B2Qt.Utils::B2QtDevice::ipAddress - \readonly - - This property holds the current IP address(es) of the device - for all active network interfaces. If multiple IP addresses are defined, - this property holds a comma-separated list. The localhost (loopback) - IP addresses are omitted. - - \sa hostname -*/ - -/*! - \qmlproperty string B2Qt.Utils::B2QtDevice::hostname - - This property holds the current hostname of the device. - - \sa ipAddress -*/ - -static QObject *module_api_factory(QQmlEngine *engine, QJSEngine *scriptEngine) -{ - Q_UNUSED(engine) - Q_UNUSED(scriptEngine) - B2QtDevice *api = new B2QtDevice(); - - return api; -} - -class B2QtUtilsPlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") - -public: - B2QtUtilsPlugin() - { - } - - void registerTypes(const char *uri) - { - Q_ASSERT(QLatin1String(uri) == "B2Qt.Utils"); - qmlRegisterSingletonType(uri, 1, 0, "B2QtDevice", module_api_factory); - } -}; - -#include "plugin.moc" diff --git a/src/imports/utils/plugins.qmltypes b/src/imports/utils/plugins.qmltypes deleted file mode 100644 index 88acb66..0000000 --- a/src/imports/utils/plugins.qmltypes +++ /dev/null @@ -1,54 +0,0 @@ -import QtQuick.tooling 1.1 - -// This file describes the plugin-supplied types contained in the library. -// It is used for QML tooling purposes only. -// -// This file was auto-generated by: -// 'qmlplugindump -nonrelocatable B2Qt.Utils 1.0 /system/qml/B2Qt/Utils/' - -Module { - Component { - name: "B2QtDevice" - prototype: "QObject" - exports: ["B2Qt.Utils/B2QtDevice 1.0"] - isCreatable: false - isSingleton: true - exportMetaObjectRevisions: [0] - Property { name: "displayBrightness"; type: "uchar" } - Property { name: "hostname"; type: "string" } - Property { name: "ipAddress"; type: "string"; isReadonly: true } - Property { name: "masterVolume"; type: "int" } - Signal { - name: "displayBrightnessChanged" - Parameter { name: "newValue"; type: "uchar" } - } - Signal { - name: "hostnameChanged" - Parameter { name: "newName"; type: "string" } - } - Signal { - name: "ipAddressChanged" - Parameter { name: "newAddress"; type: "string" } - } - Signal { - name: "masterVolumeChanged" - Parameter { name: "newVolume"; type: "int" } - } - Method { name: "reboot" } - Method { name: "powerOff" } - Method { - name: "setDisplayBrightness" - type: "bool" - Parameter { name: "value"; type: "uchar" } - } - Method { - name: "setHostname" - type: "bool" - Parameter { name: "name"; type: "string" } - } - Method { - name: "setMasterVolume" - Parameter { name: "volume"; type: "int" } - } - } -} diff --git a/src/imports/utils/qmldir b/src/imports/utils/qmldir deleted file mode 100644 index e5e0b31..0000000 --- a/src/imports/utils/qmldir +++ /dev/null @@ -1,3 +0,0 @@ -module B2Qt.Utils -plugin b2qtutilsplugin -typeinfo plugins.qmltypes diff --git a/src/imports/utils/utils.pro b/src/imports/utils/utils.pro deleted file mode 100644 index a580643..0000000 --- a/src/imports/utils/utils.pro +++ /dev/null @@ -1,10 +0,0 @@ -CXX_MODULE = qml -TARGET = b2qtutilsplugin -TARGETPATH = B2Qt/Utils -IMPORT_VERSION = 1.0 - -QT += qml b2qtutils - -SOURCES += plugin.cpp - -load(qml_plugin) -- cgit v1.2.3