From 1ace321e373ad19287c41cef9ae17fcfb7ab938d Mon Sep 17 00:00:00 2001 From: Lassi Lehikoinen Date: Fri, 20 Nov 2020 10:10:39 +0200 Subject: Remove all device utilities except network settings Also remove USB ethernet functionality from Qt Network Settings. Task-number: QTBUG-88315 Change-Id: I06c41b61854b57f57c264b3c98940333902222d2 Reviewed-by: Samuli Piippo Reviewed-by: Rami Potinkara --- src/bluetoothsettings/bluetoothdevice.cpp | 185 ----------- src/bluetoothsettings/bluetoothdevice.h | 71 ----- src/bluetoothsettings/bluetoothsettings.pro | 18 -- src/bluetoothsettings/bluez/bluetoothdevice_p.cpp | 278 ---------------- src/bluetoothsettings/bluez/bluetoothdevice_p.h | 106 ------- src/bluetoothsettings/bluez/bluez.pri | 22 -- src/bluetoothsettings/bluez/datatypes.h | 50 --- src/bluetoothsettings/bluez/device1.xml | 31 -- src/bluetoothsettings/bluez/objectmanager.xml | 20 -- src/bluetoothsettings/discoverymodel.cpp | 270 ---------------- src/bluetoothsettings/discoverymodel.h | 127 -------- src/displaysettings/displaysettings.cpp | 221 ------------- src/displaysettings/displaysettings.h | 81 ----- src/displaysettings/displaysettings.pro | 16 - src/displaysettings/displaysettings_p.cpp | 278 ---------------- src/displaysettings/displaysettings_p.h | 119 ------- .../bluetoothsettings/bluetoothsettings.pro | 10 - src/imports/bluetoothsettings/plugin.cpp | 133 -------- src/imports/bluetoothsettings/plugins.qmltypes | 89 ------ src/imports/bluetoothsettings/qmldir | 4 - src/imports/displaysettings/displaysettings.pro | 10 - src/imports/displaysettings/plugin.cpp | 108 ------- src/imports/displaysettings/plugins.qmltypes | 47 --- src/imports/displaysettings/qmldir | 4 - src/imports/imports.pro | 6 - src/imports/localdevice/localdevice.pro | 10 - src/imports/localdevice/plugin.cpp | 114 ------- src/imports/localdevice/plugins.qmltypes | 21 -- src/imports/localdevice/qmldir | 4 - src/imports/localesettings/locale.xml | 12 - src/imports/localesettings/localesettings.pro | 10 - src/imports/localesettings/plugin.cpp | 176 ----------- src/imports/localesettings/plugins.qmltypes | 349 -------------------- src/imports/localesettings/qmldir | 4 - src/imports/timedatesettings/plugin.cpp | 167 ---------- src/imports/timedatesettings/plugins.qmltypes | 351 --------------------- src/imports/timedatesettings/qmldir | 4 - src/imports/timedatesettings/timedatesettings.pro | 10 - src/localdevice/localdevice.pro | 15 - src/localdevice/qlocaldevice.cpp | 108 ------- src/localdevice/qlocaldevice.h | 51 --- src/localesettings/locale.xml | 12 - src/localesettings/localefiltermodel.cpp | 179 ----------- src/localesettings/localefiltermodel.h | 58 ---- src/localesettings/localemodel.cpp | 324 ------------------- src/localesettings/localemodel.h | 95 ------ src/localesettings/localesettings.pro | 21 -- src/localesettings/systemlocale.cpp | 54 ---- src/localesettings/systemlocale.h | 59 ---- src/localesettings/systemlocale_p.h | 95 ------ .../connman/qnetworksettingsmanager_p.cpp | 84 ----- .../connman/qnetworksettingsmanager_p.h | 7 - src/networksettings/qnetworksettingsmanager.cpp | 37 --- src/networksettings/qnetworksettingsmanager.h | 8 - src/settingsui/ViewSettings.qml | 1 - src/settingsui/bluetooth/Bluetooth.qml | 110 ------- src/settingsui/bluetooth/Discovery.qml | 138 -------- src/settingsui/display/Display.qml | 193 ----------- src/settingsui/locale/Language.qml | 114 ------- src/settingsui/locale/RegionSelect.qml | 158 ---------- src/settingsui/locale/TableKey.qml | 35 -- src/settingsui/locale/TableValue.qml | 35 -- src/settingsui/network/NetworkSettings.qml | 136 +------- src/settingsui/power/Power.qml | 55 ---- src/settingsui/settingsuiapp.qrc | 11 - src/settingsui/settingsuiplugin/ShutdownPopup.qml | 108 ------- src/settingsui/settingsuiplugin/icons.qrc | 5 - .../settingsuiplugin/newIcons/bluetooth_icon.svg | 1 - .../settingsuiplugin/newIcons/date-time_icon.svg | 1 - .../settingsuiplugin/newIcons/display_icon.svg | 1 - .../settingsuiplugin/newIcons/language_icon.svg | 1 - .../settingsuiplugin/newIcons/power_icon.svg | 1 - src/settingsui/settingsuiplugin/pluginMain.qml | 17 - src/settingsui/settingsuiplugin/settingsui.qrc | 21 -- src/settingsui/settingsuiplugin/settingsview.xml | 30 -- src/settingsui/timedate/AnalogClock.qml | 172 ---------- src/settingsui/timedate/ClockHand.qml | 70 ---- src/settingsui/timedate/CustomCalendar.qml | 216 ------------- src/settingsui/timedate/CustomComboBox.qml | 98 ------ src/settingsui/timedate/ManualTime.qml | 248 --------------- src/settingsui/timedate/TimeDate.qml | 162 ---------- src/settingsui/timedate/TimezonesView.qml | 72 ----- src/src.pro | 5 - src/timedatesettings/systemtime.cpp | 128 -------- src/timedatesettings/systemtime.h | 70 ---- src/timedatesettings/systemtime_p.h | 95 ------ src/timedatesettings/timedated.xml | 30 -- src/timedatesettings/timedatesettings.pro | 22 -- src/timedatesettings/timezonefiltermodel.cpp | 118 ------- src/timedatesettings/timezonefiltermodel.h | 69 ---- src/timedatesettings/timezonemodel.cpp | 244 -------------- src/timedatesettings/timezonemodel.h | 94 ------ sync.profile | 7 +- 93 files changed, 2 insertions(+), 7833 deletions(-) delete mode 100644 src/bluetoothsettings/bluetoothdevice.cpp delete mode 100644 src/bluetoothsettings/bluetoothdevice.h delete mode 100644 src/bluetoothsettings/bluetoothsettings.pro delete mode 100644 src/bluetoothsettings/bluez/bluetoothdevice_p.cpp delete mode 100644 src/bluetoothsettings/bluez/bluetoothdevice_p.h delete mode 100644 src/bluetoothsettings/bluez/bluez.pri delete mode 100644 src/bluetoothsettings/bluez/datatypes.h delete mode 100644 src/bluetoothsettings/bluez/device1.xml delete mode 100644 src/bluetoothsettings/bluez/objectmanager.xml delete mode 100644 src/bluetoothsettings/discoverymodel.cpp delete mode 100644 src/bluetoothsettings/discoverymodel.h delete mode 100644 src/displaysettings/displaysettings.cpp delete mode 100644 src/displaysettings/displaysettings.h delete mode 100644 src/displaysettings/displaysettings.pro delete mode 100644 src/displaysettings/displaysettings_p.cpp delete mode 100644 src/displaysettings/displaysettings_p.h delete mode 100644 src/imports/bluetoothsettings/bluetoothsettings.pro delete mode 100644 src/imports/bluetoothsettings/plugin.cpp delete mode 100644 src/imports/bluetoothsettings/plugins.qmltypes delete mode 100644 src/imports/bluetoothsettings/qmldir delete mode 100644 src/imports/displaysettings/displaysettings.pro delete mode 100644 src/imports/displaysettings/plugin.cpp delete mode 100644 src/imports/displaysettings/plugins.qmltypes delete mode 100644 src/imports/displaysettings/qmldir delete mode 100644 src/imports/localdevice/localdevice.pro delete mode 100644 src/imports/localdevice/plugin.cpp delete mode 100644 src/imports/localdevice/plugins.qmltypes delete mode 100644 src/imports/localdevice/qmldir delete mode 100644 src/imports/localesettings/locale.xml delete mode 100644 src/imports/localesettings/localesettings.pro delete mode 100644 src/imports/localesettings/plugin.cpp delete mode 100644 src/imports/localesettings/plugins.qmltypes delete mode 100644 src/imports/localesettings/qmldir delete mode 100644 src/imports/timedatesettings/plugin.cpp delete mode 100644 src/imports/timedatesettings/plugins.qmltypes delete mode 100644 src/imports/timedatesettings/qmldir delete mode 100644 src/imports/timedatesettings/timedatesettings.pro delete mode 100644 src/localdevice/localdevice.pro delete mode 100644 src/localdevice/qlocaldevice.cpp delete mode 100644 src/localdevice/qlocaldevice.h delete mode 100644 src/localesettings/locale.xml delete mode 100644 src/localesettings/localefiltermodel.cpp delete mode 100644 src/localesettings/localefiltermodel.h delete mode 100644 src/localesettings/localemodel.cpp delete mode 100644 src/localesettings/localemodel.h delete mode 100644 src/localesettings/localesettings.pro delete mode 100644 src/localesettings/systemlocale.cpp delete mode 100644 src/localesettings/systemlocale.h delete mode 100644 src/localesettings/systemlocale_p.h delete mode 100644 src/settingsui/bluetooth/Bluetooth.qml delete mode 100644 src/settingsui/bluetooth/Discovery.qml delete mode 100644 src/settingsui/display/Display.qml delete mode 100644 src/settingsui/locale/Language.qml delete mode 100644 src/settingsui/locale/RegionSelect.qml delete mode 100644 src/settingsui/locale/TableKey.qml delete mode 100644 src/settingsui/locale/TableValue.qml delete mode 100644 src/settingsui/power/Power.qml delete mode 100644 src/settingsui/settingsuiplugin/ShutdownPopup.qml delete mode 100644 src/settingsui/settingsuiplugin/newIcons/bluetooth_icon.svg delete mode 100644 src/settingsui/settingsuiplugin/newIcons/date-time_icon.svg delete mode 100644 src/settingsui/settingsuiplugin/newIcons/display_icon.svg delete mode 100644 src/settingsui/settingsuiplugin/newIcons/language_icon.svg delete mode 100644 src/settingsui/settingsuiplugin/newIcons/power_icon.svg delete mode 100644 src/settingsui/timedate/AnalogClock.qml delete mode 100644 src/settingsui/timedate/ClockHand.qml delete mode 100644 src/settingsui/timedate/CustomCalendar.qml delete mode 100644 src/settingsui/timedate/CustomComboBox.qml delete mode 100644 src/settingsui/timedate/ManualTime.qml delete mode 100644 src/settingsui/timedate/TimeDate.qml delete mode 100644 src/settingsui/timedate/TimezonesView.qml delete mode 100644 src/timedatesettings/systemtime.cpp delete mode 100644 src/timedatesettings/systemtime.h delete mode 100644 src/timedatesettings/systemtime_p.h delete mode 100644 src/timedatesettings/timedated.xml delete mode 100644 src/timedatesettings/timedatesettings.pro delete mode 100644 src/timedatesettings/timezonefiltermodel.cpp delete mode 100644 src/timedatesettings/timezonefiltermodel.h delete mode 100644 src/timedatesettings/timezonemodel.cpp delete mode 100644 src/timedatesettings/timezonemodel.h diff --git a/src/bluetoothsettings/bluetoothdevice.cpp b/src/bluetoothsettings/bluetoothdevice.cpp deleted file mode 100644 index dda2386..0000000 --- a/src/bluetoothsettings/bluetoothdevice.cpp +++ /dev/null @@ -1,185 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include "bluetoothdevice.h" -#include "bluetoothdevice_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \module QtBluetoothSettings - \qtvariable bluetoothsettings - \ingroup qtdevice-utilities-cpp-modules - \ingroup modules - \title Qt Bluetooth Settings C++ Classes - \brief Provides functionality for controlling Bluetooth settings. - - To use classes from this module, add this directive into the C++ files: - - \code - #include - \endcode - - To link against the corresponding C++ libraries, add the following to your - qmake project file: - - \code - QT += bluetoothsettings - \endcode -*/ - -/*! - \class BluetoothDevice - \inmodule QtBluetoothSettings - - \brief The BluetoothDevice class controls Bluetooth settings. - - The Bluetooth settings contain information about the local Bluetooth device, - such as the device model and whether the device is powered on and available - for connections with other Bluetooth devices. - - The Bluetooth device can scan for other Bluetooth devices in range and - retrieve information about them. The Bluetooth device then uses the address - of another device to attempt pairing to it, and connects to it if the - pairing was successful. -*/ - -/*! - \property BluetoothDevice::scanning - \brief Whether the Bluetooth device is scanning for remote devices. -*/ - -/*! - \property BluetoothDevice::powered - \brief Whether the power in the Bluetooth device is on or off. -*/ - -/*! - \property BluetoothDevice::available - \brief Whether the Bluetooth device is available. -*/ - -/*! - \property BluetoothDevice::deviceModel - \brief The model of the Bluetooth device. -*/ - -/*! - Creates a new Bluetooth device with the parent \a parent. -*/ -BluetoothDevice::BluetoothDevice(QObject *parent) : QObject(parent) - ,d_ptr(new BluetoothDevicePrivate(this)) -{ -} - -/*! - Returns \c true if the power is switched on in the Bluetooth device. -*/ -bool BluetoothDevice::powered() const -{ - Q_D(const BluetoothDevice); - return d->powered(); -} - -/*! - Sets the powered state in the Bluetooth device to \a aPowered. -*/ -void BluetoothDevice::setPowered(const bool& aPowered) -{ - Q_D(BluetoothDevice); - d->setPowered(aPowered); -} - -/*! - Returns the model of the Bluetooth device. -*/ -DiscoveryModel* BluetoothDevice::deviceModel() const -{ - Q_D(const BluetoothDevice); - return d->deviceModel(); -} - -/*! - Returns whether the Bluetooth device is scanning for remote devices. -*/ -bool BluetoothDevice::scanning() const -{ - Q_D(const BluetoothDevice); - return d->scanning(); -} - -/*! - Sets scanning in the Bluetooth device to \a aScan. -*/ -void BluetoothDevice::setScanning(const bool& aScan) -{ - Q_D(BluetoothDevice); - d->setScanning(aScan); -} - -/*! - Starts the process of pairing to a remote device specified by \a address, - and connects to it if the pairing was successful. - - \sa requestConnect -*/ -void BluetoothDevice::requestPairing(const QString& address) -{ - Q_D(BluetoothDevice); - d->requestPairing(address); -} - -/*! - Connects to the remote device specified by \a address. -*/ -void BluetoothDevice::requestConnect(const QString& address) -{ - Q_D(BluetoothDevice); - d->requestConnect(address); -} - -/*! - Disconnects from the remote device specified by \a address. -*/ -void BluetoothDevice::requestDisconnect(const QString& address) -{ - Q_D(BluetoothDevice); - d->requestDisconnect(address); -} - -/*! - Returns the availability of the Bluetooth device. -*/ -bool BluetoothDevice::available() const -{ - Q_D(const BluetoothDevice); - return d->available(); -} - -QT_END_NAMESPACE diff --git a/src/bluetoothsettings/bluetoothdevice.h b/src/bluetoothsettings/bluetoothdevice.h deleted file mode 100644 index 1c51b87..0000000 --- a/src/bluetoothsettings/bluetoothdevice.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef BLUETOOTHDEVICE_H -#define BLUETOOTHDEVICE_H - -#include -#include "discoverymodel.h" - -QT_FORWARD_DECLARE_CLASS(DiscoveryModel) -QT_FORWARD_DECLARE_CLASS(BluetoothDevicePrivate) - -QT_BEGIN_NAMESPACE - -class Q_DECL_EXPORT BluetoothDevice : public QObject -{ - Q_OBJECT - Q_PROPERTY(bool scanning READ scanning WRITE setScanning NOTIFY scanningChanged) - Q_PROPERTY(bool powered READ powered WRITE setPowered NOTIFY poweredChanged) - Q_PROPERTY(bool available READ available NOTIFY availabilityChanged) - Q_PROPERTY(DiscoveryModel* deviceModel READ deviceModel CONSTANT) -public: - explicit BluetoothDevice(QObject *parent = Q_NULLPTR); - bool powered() const; - void setPowered(const bool& aPowered); - DiscoveryModel *deviceModel() const; - bool scanning() const; - void setScanning(const bool& aScan); - bool available() const; - Q_INVOKABLE void requestPairing(const QString& address); - Q_INVOKABLE void requestConnect(const QString& address); - Q_INVOKABLE void requestDisconnect(const QString& address); -Q_SIGNALS: - void poweredChanged(); - void scanningChanged(); - void availabilityChanged(); -protected: - BluetoothDevicePrivate *d_ptr; -private: -Q_DISABLE_COPY(BluetoothDevice) -Q_DECLARE_PRIVATE(BluetoothDevice) -}; - -QT_END_NAMESPACE - -#endif // BLUETOOTHDEVICE_H diff --git a/src/bluetoothsettings/bluetoothsettings.pro b/src/bluetoothsettings/bluetoothsettings.pro deleted file mode 100644 index 7f46c58..0000000 --- a/src/bluetoothsettings/bluetoothsettings.pro +++ /dev/null @@ -1,18 +0,0 @@ -load(qt_build_config) - -TARGET = QtBluetoothSettings -VERSION = 1.0 - -QT += core bluetooth - -MODULE = bluetoothsettings -load(qt_module) - -include(bluez/bluez.pri) - -HEADERS += \ - bluetoothdevice.h \ - discoverymodel.h - -SOURCES += bluetoothdevice.cpp \ - discoverymodel.cpp diff --git a/src/bluetoothsettings/bluez/bluetoothdevice_p.cpp b/src/bluetoothsettings/bluez/bluetoothdevice_p.cpp deleted file mode 100644 index 7b29ec9..0000000 --- a/src/bluetoothsettings/bluez/bluetoothdevice_p.cpp +++ /dev/null @@ -1,278 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "discoverymodel.h" -#include "bluetoothdevice_p.h" -#include "datatypes.h" -#include "objectmanager_interface.cpp" -#include "moc_objectmanager_interface.cpp" -#include "device1_interface.h" - -#ifdef USE_CONNMAN_BLUETOOTH -#include "connman_technology_interface.h" -#include "connmancommon.h" -#endif - -QT_BEGIN_NAMESPACE - -BluetoothDevicePrivate::BluetoothDevicePrivate(BluetoothDevice *parent) : QObject(parent) - ,q_ptr(parent) - ,m_localDevice(Q_NULLPTR) - ,m_powered(false) - ,m_scanning(false) - ,m_adapter(QStringLiteral("")) - ,m_deviceModel(new DiscoveryModel(this)) -{ - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - - m_manager = new OrgFreedesktopDBusObjectManagerInterface(QStringLiteral("org.bluez"), - QStringLiteral("/"), - QDBusConnection::systemBus(), this); -#ifdef USE_CONNMAN_BLUETOOTH - m_technology = new NetConnmanTechnologyInterface(QStringLiteral("net.connman"), - QStringLiteral("/net/connman/technology/bluetooth"), - QDBusConnection::systemBus(), this); -#endif - QDBusPendingReply reply = m_manager->GetManagedObjects(); - QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this); - connect(watcher, &QDBusPendingCallWatcher::finished, - this, &BluetoothDevicePrivate::getManagedObjectsFinished, Qt::QueuedConnection); -} - -void BluetoothDevicePrivate::deviceStateChanged(QBluetoothLocalDevice::HostMode state) -{ - Q_Q(BluetoothDevice); - m_powered = state != QBluetoothLocalDevice::HostPoweredOff; - emit q->poweredChanged(); -} - -bool BluetoothDevicePrivate::powered() const -{ - return m_powered; -} - -void BluetoothDevicePrivate::setPowered(const bool& aPowered) -{ - if (!m_localDevice) - return; - -#ifdef USE_CONNMAN_BLUETOOTH - m_technology->SetProperty(PropertyPowered, QDBusVariant(QVariant(aPowered))); -#endif - - if (aPowered) { - m_localDevice->powerOn(); - } - else { - m_localDevice->setHostMode(QBluetoothLocalDevice::HostPoweredOff); - } -} - -DiscoveryModel* BluetoothDevicePrivate::deviceModel() const -{ - return m_deviceModel; -} - -void BluetoothDevicePrivate::scanFinished() -{ - Q_Q(BluetoothDevice); - m_scanning = false; - emit q->scanningChanged(); - updateConnectionStatuses(); -} - -bool BluetoothDevicePrivate::scanning() const -{ - return m_scanning; -} - -void BluetoothDevicePrivate::setScanning(const bool& aScan) -{ - Q_Q(BluetoothDevice); - if (m_scanning && !aScan) { - m_deviceModel->stopScanning(); - } - else if (aScan && !m_scanning) { - m_deviceModel->scanDevices(); - } - m_scanning = aScan; - emit q->scanningChanged(); -} - -bool BluetoothDevicePrivate::available() const -{ - return (!m_adapter.isEmpty()); -} - -void BluetoothDevicePrivate::updateConnectionStatuses() -{ - QList connectedDevices = - m_localDevice->connectedDevices(); - - foreach (QBluetoothAddress addr, connectedDevices) { - m_deviceModel->setConnected(addr.toString(), true); - } -} - -void BluetoothDevicePrivate::requestPairing(const QString& address) -{ - QBluetoothAddress addr(address); - if (m_localDevice) { - m_localDevice->requestPairing(addr, QBluetoothLocalDevice::Paired); - connect(m_localDevice, &QBluetoothLocalDevice::pairingDisplayConfirmation, this, &BluetoothDevicePrivate::pairingDisplayConfirmation); - - connect(m_localDevice, &QBluetoothLocalDevice::pairingDisplayPinCode, this, &BluetoothDevicePrivate::pairingDisplayPinCode); - - connect(m_localDevice, &QBluetoothLocalDevice::pairingFinished, this, &BluetoothDevicePrivate::pairingFinished); - } -} - -void BluetoothDevicePrivate::requestConnect(const QString &address) -{ - OrgBluezDevice1Interface *dev = findPeerDevice(address); - if (dev) { - dev->Connect(); - dev->deleteLater(); - } -} - -void BluetoothDevicePrivate::requestDisconnect(const QString& address) -{ - OrgBluezDevice1Interface *dev = findPeerDevice(address); - if (dev) { - dev->Disconnect(); - dev->deleteLater(); - } -} - -void BluetoothDevicePrivate::pairingDisplayConfirmation(const QBluetoothAddress & address, QString pin) -{ - Q_UNUSED(address); - Q_UNUSED(pin); -} - -void BluetoothDevicePrivate::pairingDisplayPinCode(const QBluetoothAddress & address, QString pin) -{ - Q_UNUSED(address); - Q_UNUSED(pin); -} - -void BluetoothDevicePrivate::pairingFinished(const QBluetoothAddress & address, QBluetoothLocalDevice::Pairing pairing) -{ - if (pairing == QBluetoothLocalDevice::Paired) { - requestConnect(address.toString()); - } -} - -void BluetoothDevicePrivate::deviceConnected(const QBluetoothAddress & address) -{ - m_deviceModel->setConnected(address.toString(), true); -} - -void BluetoothDevicePrivate::deviceDisconnected(const QBluetoothAddress & address) -{ - m_deviceModel->setConnected(address.toString(), false); -} - -void BluetoothDevicePrivate::getManagedObjectsFinished(QDBusPendingCallWatcher *watcher) -{ - Q_Q(BluetoothDevice); - - QDBusPendingReply reply = *watcher; - watcher->deleteLater(); - if (reply.isError()) { - return; - } - - //Find adapter - ManagedObjectList managedObjectList = reply.value(); - for (ManagedObjectList::const_iterator it = managedObjectList.constBegin(); it != managedObjectList.constEnd(); ++it) { - const InterfaceList &ifaceList = it.value(); - for (InterfaceList::const_iterator jt = ifaceList.constBegin(); jt != ifaceList.constEnd(); ++jt) { - const QString &iface = jt.key(); - const QVariantMap &ifaceValues = jt.value(); - - if (iface == QStringLiteral("org.bluez.Adapter1")) { - m_adapter = ifaceValues[QStringLiteral("Address")].toString(); - break; - } - } - } - - if (!m_adapter.isEmpty()) { - m_localDevice = new QBluetoothLocalDevice(this); - m_powered = m_localDevice->hostMode() != QBluetoothLocalDevice::HostPoweredOff; - - connect(m_localDevice, &QBluetoothLocalDevice::hostModeStateChanged, this, &BluetoothDevicePrivate::deviceStateChanged); - connect(m_localDevice, &QBluetoothLocalDevice::deviceConnected, this, &BluetoothDevicePrivate::deviceConnected); - connect(m_localDevice, &QBluetoothLocalDevice::deviceDisconnected, this, &BluetoothDevicePrivate::deviceDisconnected); - connect(m_deviceModel, &DiscoveryModel::scanFinished, this, &BluetoothDevicePrivate::scanFinished); - - if (m_powered) { - emit q->poweredChanged(); - if (!m_scanning) { - m_deviceModel->scanDevices(); - m_scanning = true; - emit q->scanningChanged(); - } - } - - emit q->availabilityChanged(); - } -} - -OrgBluezDevice1Interface* BluetoothDevicePrivate::findPeerDevice(const QString &address) -{ - QDBusPendingReply reply = m_manager->GetManagedObjects(); - reply.waitForFinished(); - if (reply.isError()) { - qWarning() << "Failed to get objects"; - return NULL; - } - - ManagedObjectList managedObjectList = reply.value(); - for (ManagedObjectList::const_iterator it = managedObjectList.constBegin(); it != managedObjectList.constEnd(); ++it) { - const QDBusObjectPath &path = it.key(); - - const InterfaceList &ifaceList = it.value(); - for (InterfaceList::const_iterator jt = ifaceList.constBegin(); jt != ifaceList.constEnd(); ++jt) { - const QString &iface = jt.key(); - const QVariantMap &ifaceValues = jt.value(); - if (iface == QStringLiteral("org.bluez.Device1")) { - if (ifaceValues[QStringLiteral("Address")] == address) { - OrgBluezDevice1Interface *devIf = new OrgBluezDevice1Interface(QStringLiteral("org.bluez"), path.path(), QDBusConnection::systemBus()); - return devIf; - } - } - } - } - return NULL; -} - -QT_END_NAMESPACE diff --git a/src/bluetoothsettings/bluez/bluetoothdevice_p.h b/src/bluetoothsettings/bluez/bluetoothdevice_p.h deleted file mode 100644 index 0e1777e..0000000 --- a/src/bluetoothsettings/bluez/bluetoothdevice_p.h +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef BLUETOOTHDEVICE__P_H -#define BLUETOOTHDEVICE__P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include -#include "bluetoothdevice.h" - -// Automatically generated classes in global namespace -class OrgBluezDevice1Interface; -class OrgFreedesktopDBusObjectManagerInterface; - -#ifdef USE_CONNMAN_BLUETOOTH -class NetConnmanTechnologyInterface; -#endif - -QT_BEGIN_NAMESPACE - -class BluetoothDevicePrivate : public QObject -{ - Q_OBJECT - Q_DECLARE_PUBLIC(BluetoothDevice) -public: - BluetoothDevice *q_ptr; - BluetoothDevicePrivate(BluetoothDevice *parent); - bool powered() const; - void setPowered(const bool& aPowered); - bool scanning() const; - bool available() const; - void setScanning(const bool& aScan); - void requestPairing(const QString& address); - void requestConnect(const QString& address); - void requestDisconnect(const QString& address); - DiscoveryModel* deviceModel() const; - -public Q_SLOTS: - void deviceStateChanged(QBluetoothLocalDevice::HostMode state); - void scanFinished(); - //These are not yet signaled - //See bug https://bugreports.qt.io/browse/QTBUG-38401 - void pairingDisplayConfirmation(const QBluetoothAddress & address, QString pin); - void pairingDisplayPinCode(const QBluetoothAddress & address, QString pin); - void pairingFinished(const QBluetoothAddress & address, QBluetoothLocalDevice::Pairing pairing); - void deviceConnected(const QBluetoothAddress & address); - void deviceDisconnected(const QBluetoothAddress & address); - void getManagedObjectsFinished(QDBusPendingCallWatcher *watcher); - -private: - void updateConnectionStatuses(); - OrgBluezDevice1Interface* findPeerDevice(const QString& address); - -private: - QBluetoothLocalDevice* m_localDevice; - bool m_powered; - bool m_scanning; - QString m_adapter; - DiscoveryModel *m_deviceModel; - OrgFreedesktopDBusObjectManagerInterface *m_manager; - -#ifdef USE_CONNMAN_BLUETOOTH - NetConnmanTechnologyInterface *m_technology; -#endif -}; - -QT_END_NAMESPACE - -#endif // BLUETOOTHDEVICE__P_H diff --git a/src/bluetoothsettings/bluez/bluez.pri b/src/bluetoothsettings/bluez/bluez.pri deleted file mode 100644 index 60a3b17..0000000 --- a/src/bluetoothsettings/bluez/bluez.pri +++ /dev/null @@ -1,22 +0,0 @@ -QT += core dbus - -INCLUDEPATH += $${PWD} -INCLUDEPATH += $${PWD}/bluez - -DBUS_INTERFACES = \ - $${PWD}/objectmanager.xml \ - $${PWD}/device1.xml - -HEADERS += \ - $$PWD/bluetoothdevice_p.h \ - $$PWD/datatypes.h \ - -SOURCES += \ - $$PWD/bluetoothdevice_p.cpp - -qtHaveModule(networksettings) { - DEFINES += USE_CONNMAN_BLUETOOTH - INCLUDEPATH += $${PWD}/../../networksettings/connman - DBUS_INTERFACES += $${PWD}/../../networksettings/connman/connman_technology.xml - -} diff --git a/src/bluetoothsettings/bluez/datatypes.h b/src/bluetoothsettings/bluez/datatypes.h deleted file mode 100644 index 9458dbe..0000000 --- a/src/bluetoothsettings/bluez/datatypes.h +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef DATATYPES_H -#define DATATYPES_H - -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -typedef QMap InterfaceList; -typedef QMap ManagedObjectList; - -QT_END_NAMESPACE - -Q_DECLARE_METATYPE(InterfaceList) -Q_DECLARE_METATYPE(ManagedObjectList) - - -#endif // DATATYPES_H diff --git a/src/bluetoothsettings/bluez/device1.xml b/src/bluetoothsettings/bluez/device1.xml deleted file mode 100644 index 5b16992..0000000 --- a/src/bluetoothsettings/bluez/device1.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/bluetoothsettings/bluez/objectmanager.xml b/src/bluetoothsettings/bluez/objectmanager.xml deleted file mode 100644 index e52d6fe..0000000 --- a/src/bluetoothsettings/bluez/objectmanager.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/src/bluetoothsettings/discoverymodel.cpp b/src/bluetoothsettings/discoverymodel.cpp deleted file mode 100644 index 31cf972..0000000 --- a/src/bluetoothsettings/discoverymodel.cpp +++ /dev/null @@ -1,270 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include "discoverymodel.h" - -QT_BEGIN_NAMESPACE - -BtDeviceItem::BtDeviceItem(const QBluetoothDeviceInfo& bt, QObject *parent) - : QObject(parent) - ,m_name(bt.name()) - ,m_address(bt.address().toString()) - ,m_connected(false) -{ - m_type = getDeviceType(bt.majorDeviceClass(), bt.minorDeviceClass()); -} - -QString BtDeviceItem::name() const -{ - return m_name; -} - -QString BtDeviceItem::address() const -{ - return m_address; -} - -bool BtDeviceItem::connected() const -{ - return m_connected; -} - -void BtDeviceItem::setConnected(bool aConnected) -{ - m_connected = aConnected; - emit connectedChanged(); -} - -BtDeviceItem::DeviceType BtDeviceItem::type() const -{ - return m_type; -} - -BtDeviceItem::DeviceType BtDeviceItem::getDeviceType(const QBluetoothDeviceInfo::MajorDeviceClass major, const quint8 minor) const -{ - switch (major) { - case QBluetoothDeviceInfo::ComputerDevice: - return getComputerDeviceType(minor); - break; - case QBluetoothDeviceInfo::PhoneDevice: - return getPhoneDeviceType(minor); - break; - case QBluetoothDeviceInfo::AudioVideoDevice: - return getAudioDeviceType(minor); - break; - case QBluetoothDeviceInfo::PeripheralDevice: - return getPeripheralDeviceType(minor); - break; - case QBluetoothDeviceInfo::ImagingDevice: - return getImagingDeviceType(minor); - break; - default: - return GenericDevice; - } - return GenericDevice; -} - -BtDeviceItem::DeviceType BtDeviceItem::getComputerDeviceType(const quint8 minor) const -{ - Q_UNUSED(minor); - return Computer; -} - -BtDeviceItem::DeviceType BtDeviceItem::getAudioDeviceType(const quint8 minor) const -{ - switch (minor) { - case QBluetoothDeviceInfo::Microphone: - return Microphone; - break; - case QBluetoothDeviceInfo::WearableHeadsetDevice: - case QBluetoothDeviceInfo::Headphones: - return Headphones; - break; - case QBluetoothDeviceInfo::Camcorder: - case QBluetoothDeviceInfo::VideoCamera: - return Camcorder; - break; - default: - return GenericDevice; - break; - } -} - -BtDeviceItem::DeviceType BtDeviceItem::getPeripheralDeviceType(const quint8 minor) const -{ - switch (minor) { - case QBluetoothDeviceInfo::KeyboardPeripheral: - return Keyboard; - break; - case QBluetoothDeviceInfo::PointingDevicePeripheral: - return Mouse; - break; - default: - return GenericDevice; - break; - } -} - -BtDeviceItem::DeviceType BtDeviceItem::getImagingDeviceType(const quint8 minor) const -{ - switch (minor) { - case QBluetoothDeviceInfo::ImageCamera: - return Camera; - break; - default: - return GenericDevice; - break; - } -} - -BtDeviceItem::DeviceType BtDeviceItem::getPhoneDeviceType(const quint8 minor) const -{ - Q_UNUSED(minor); - return Phone; -} - - -DiscoveryModel::DiscoveryModel(QObject *parent) - : QAbstractListModel(parent) - ,m_discoveryAgent(Q_NULLPTR) -{ - m_roleNames.insert(Qt::UserRole, "modelData"); - m_roleNames.insert(Address, "address"); - m_roleNames.insert(Name, "name"); - m_roleNames.insert(Type, "type"); - m_roleNames.insert(Connected, "connected"); -} - -void DiscoveryModel::deviceDiscovered(const QBluetoothDeviceInfo &device) -{ - int index; - - // Insert the device to alphabetically sorted location - for (index = 0; index < m_items.count(); index++) - { - if (device.name() < m_items.at(index)->name()) - break; - } - - beginInsertRows(QModelIndex(), index, index); - BtDeviceItem *item = new BtDeviceItem(device); - m_items.insert(index, item); - endInsertRows(); -} - -DiscoveryModel::~DiscoveryModel() -{ - -} - -void DiscoveryModel::scanDevices() -{ - if (!m_discoveryAgent) { - m_discoveryAgent = new QBluetoothDeviceDiscoveryAgent(this); - connect(m_discoveryAgent, SIGNAL(deviceDiscovered(QBluetoothDeviceInfo)), - this, SLOT(deviceDiscovered(QBluetoothDeviceInfo))); - - connect(m_discoveryAgent, SIGNAL(finished()), - this, SIGNAL(scanFinished())); - } - - // Reset previous list, devices are already cached by bluez - clearDeviceList(); - - m_discoveryAgent->start(); -} - -void DiscoveryModel::stopScanning() -{ - if (m_discoveryAgent) { - m_discoveryAgent->stop(); - } -} - -QHash DiscoveryModel::roleNames() const -{ - return m_roleNames; -} - -int DiscoveryModel::rowCount(const QModelIndex & parent) const -{ - Q_UNUSED(parent); - return m_items.count(); -} - -QVariant DiscoveryModel::data(const QModelIndex & index, int role) const -{ - if (!index.isValid()) return QVariant(); - - BtDeviceItem *item = m_items[index.row()]; - - switch (role) { - case DiscoveryModel::Name: - return item->name(); - break; - case DiscoveryModel::Address: - return item->address(); - break; - case DiscoveryModel::Type: - return item->type(); - break; - case DiscoveryModel::Connected: - return item->connected(); - default: - return QVariant(); - } -} - -void DiscoveryModel::setConnected(const QString &aAddress, bool connected) -{ - bool found = false; - int i = 0; - QVector role; - role.append(DiscoveryModel::Connected); - foreach (BtDeviceItem *item, m_items) { - if (item->address() == aAddress) { - item->setConnected(connected); - found = true; - break; - } - i++; - } - - if (found) - emit dataChanged(index(i, 0), index(i, 0), role); -} - -void DiscoveryModel::clearDeviceList() -{ - beginResetModel(); - m_items.clear(); - endResetModel(); -} - -QT_END_NAMESPACE diff --git a/src/bluetoothsettings/discoverymodel.h b/src/bluetoothsettings/discoverymodel.h deleted file mode 100644 index 56f8299..0000000 --- a/src/bluetoothsettings/discoverymodel.h +++ /dev/null @@ -1,127 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef DISCOVERYMODEL_H -#define DISCOVERYMODEL_H - - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class Q_DECL_EXPORT BtDeviceItem : public QObject -{ - Q_OBJECT - Q_ENUMS(DeviceType) - Q_PROPERTY(QString address READ address CONSTANT) - Q_PROPERTY(QString name READ name CONSTANT) - Q_PROPERTY(bool connected READ connected NOTIFY connectedChanged) - Q_PROPERTY(DeviceType type READ type CONSTANT) -public: - explicit BtDeviceItem(const QBluetoothDeviceInfo& id, QObject *parent = Q_NULLPTR); - //The list of device type we want to show the icon - enum DeviceType { - Phone, - Computer, - Mouse, - Keyboard, - Headphones, - Microphone, - Camera, - Camcorder, - Clock, - HealthDevice, - GenericDevice=1000 - }; - QString name() const; - QString address() const; - DeviceType type() const; - bool connected() const; - void setConnected(bool aConnected); - -Q_SIGNALS: - void connectedChanged(); - -protected: - DeviceType getDeviceType(const QBluetoothDeviceInfo::MajorDeviceClass major, - const quint8 minor) const; - DeviceType getComputerDeviceType(const quint8 minor) const; - DeviceType getAudioDeviceType(const quint8 minor) const; - DeviceType getPeripheralDeviceType(const quint8 minor) const; - DeviceType getImagingDeviceType(const quint8 minor) const; - DeviceType getHealthDeviceType(const quint8 minor) const; - DeviceType getPhoneDeviceType(const quint8 minor) const; - -private: - QString m_name; - QString m_address; - bool m_connected; - DeviceType m_type; -}; - -class Q_DECL_EXPORT DiscoveryModel : public QAbstractListModel -{ - Q_OBJECT - Q_ENUMS(DeviceType) -public: - explicit DiscoveryModel(QObject *parent = Q_NULLPTR); - virtual ~DiscoveryModel(); - // from QAbstractItemModel - int rowCount(const QModelIndex & parent = QModelIndex()) const; - QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const; - QHash roleNames() const; - void setConnected(const QString& aAddress, bool connected); - void scanDevices(); - void stopScanning(); - - enum Roles { - Name = Qt::UserRole, - Address, - Type, - Connected - }; - -Q_SIGNALS: - void scanFinished(); - -private Q_SLOTS: - void deviceDiscovered(const QBluetoothDeviceInfo &device); -private: - void clearDeviceList(); - - QList m_items; - QHash m_roleNames; - QBluetoothDeviceDiscoveryAgent *m_discoveryAgent; -}; - -QT_END_NAMESPACE - -#endif // DISCOVERYMODEL_H diff --git a/src/displaysettings/displaysettings.cpp b/src/displaysettings/displaysettings.cpp deleted file mode 100644 index c7c93c8..0000000 --- a/src/displaysettings/displaysettings.cpp +++ /dev/null @@ -1,221 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "displaysettings.h" -#include "displaysettings_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \module QtDisplaySettings - \qtvariable displaysettings - \ingroup qtdevice-utilities-cpp-modules - \ingroup modules - \title Qt Display Settings C++ Classes - \brief Provides access to display settings. - - To use classes from this module, add this directive into the C++ files: - - \code - #include - \endcode - - To link against the corresponding C++ libraries, add the following to your - qmake project file: - - \code - QT += displaysettings - \endcode -*/ - -/*! - \class DisplaySettings - \inmodule QtDisplaySettings - - \brief The DisplaySettings class specifies display settings. - - The Boot to Qt demo launcher and Qt Quick Controls scale automatically to - screens of different sizes, from 7-inch touch screens to 60-inch or larger - television screens to ensure readability and touch friendliness. For this, - Qt has to know the physical dimensions of the screen. By default, it tries - to query these values from the framebuffer devices. However, many kernel - drivers do not provide this information. - - The display settings enable overriding and manually setting the physical - screen size. - - In addition, you can set the display brightness. That is, the intensity of - the backlight. -*/ - -/*! - \property DisplaySettings::displayBrightness - \brief The display brightness. - - A value of \c 255 requests the maximum brightness, while that of \c 0 - requests the minimum (typically, the backlight turned off). -*/ - - -/*! - \property DisplaySettings::physicalScreenSizeInch - \brief The physical screen size in inches. -*/ - -/*! - \property DisplaySettings::physicalScreenWidthMm - \brief The physical screen width in millimeters. -*/ - -/*! - \property DisplaySettings::physicalScreenHeightMm - \brief The physical screen height in millimeters. -*/ - -/*! - \property DisplaySettings::physicalScreenSizeOverride - \brief Whether to use the value set for the physical screen size. -*/ - -/*! - Creates a new display settings object with the parent \a parent. -*/ -DisplaySettings::DisplaySettings(QObject *parent) - : QObject(parent) - ,d_ptr(new DisplaySettingsPrivate(this)) -{ -} - -/*! - Deletes the display settings object. -*/ -DisplaySettings::~DisplaySettings() -{ -} - - -/*! - Sets the display brightness to \a v. - - Returns \c true on success. -*/ -bool DisplaySettings::setDisplayBrightness(int v) -{ - Q_D(DisplaySettings); - return d->setDisplayBrightness(v); -} - - -/*! - * Returns the current backlight intensity. - * \sa setDisplayBrightness - */ -int DisplaySettings::displayBrightness() -{ - Q_D(DisplaySettings); - return d->displayBrightness(); -} - -/*! - Returns the physical screen size in inches. -*/ -int DisplaySettings::physicalScreenSizeInch() const -{ - Q_D(const DisplaySettings); - return d->physicalScreenSizeInch(); -} - -/*! - Returns the physical screen width in millimeters. -*/ -int DisplaySettings::physicalScreenWidthMm() const -{ - Q_D(const DisplaySettings); - return d->physicalScreenWidthMm(); -} - -/*! - Returns the physical screen height in millimeters. -*/ -int DisplaySettings::physicalScreenHeightMm() const -{ - Q_D(const DisplaySettings); - return d->physicalScreenHeightMm(); -} - -/*! - Sets the physical screen size to \a inches. -*/ -void DisplaySettings::setPhysicalScreenSizeInch(int inches) -{ - Q_D(DisplaySettings); - d->setPhysicalScreenSizeInch(inches); -} - -/*! - Sets the physical screen width to \a newWidth. -*/ -void DisplaySettings::setPhysicalScreenWidthMm(int newWidth) -{ - Q_D(DisplaySettings); - d->setPhysicalScreenWidthMm(newWidth); -} - -/*! - Sets the physical screen height to \a newHeight. -*/ -void DisplaySettings::setPhysicalScreenHeightMm(int newHeight) -{ - Q_D(DisplaySettings); - d->setPhysicalScreenHeightMm(newHeight); -} - -/*! - Returns whether the value set for the physical screen size is used. - - \sa physicalScreenSizeInch() -*/ -bool DisplaySettings::physicalScreenSizeOverride() const -{ - Q_D(const DisplaySettings); - return d->physicalScreenSizeOverride(); -} - -/*! - Sets whether the value set for the physical screen size is used to - \a enable. - - \sa physicalScreenSizeInch() -*/ -void DisplaySettings::setPhysicalScreenSizeOverride(bool enable) -{ - Q_D(DisplaySettings); - d->setPhysicalScreenSizeOverride(enable); -} - -QT_END_NAMESPACE diff --git a/src/displaysettings/displaysettings.h b/src/displaysettings/displaysettings.h deleted file mode 100644 index 835da3f..0000000 --- a/src/displaysettings/displaysettings.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef DISPLAYSETTINGS_H -#define DISPLAYSETTINGS_H - -#include - -QT_BEGIN_NAMESPACE - -class DisplaySettingsPrivate; - -class Q_DECL_EXPORT DisplaySettings : public QObject -{ - Q_OBJECT - - Q_PROPERTY(int displayBrightness READ displayBrightness WRITE setDisplayBrightness NOTIFY displayBrightnessChanged) - Q_PROPERTY(int physicalScreenSizeInch READ physicalScreenSizeInch WRITE setPhysicalScreenSizeInch NOTIFY physicalScreenSizeInchChanged) - Q_PROPERTY(int physicalScreenWidthMm READ physicalScreenWidthMm WRITE setPhysicalScreenWidthMm NOTIFY physicalScreenWidthMmChanged) - Q_PROPERTY(int physicalScreenHeightMm READ physicalScreenHeightMm WRITE setPhysicalScreenHeightMm NOTIFY physicalScreenHeightMmChanged) - Q_PROPERTY(bool physicalScreenSizeOverride READ physicalScreenSizeOverride WRITE setPhysicalScreenSizeOverride NOTIFY physicalScreenSizeOverrideChanged) - -public: - DisplaySettings(QObject *parent = Q_NULLPTR); - ~DisplaySettings(); - - int displayBrightness(); - int physicalScreenSizeInch() const; - int physicalScreenWidthMm() const; - int physicalScreenHeightMm() const; - bool physicalScreenSizeOverride() const; - -public Q_SLOTS: - bool setDisplayBrightness(int value); - void setPhysicalScreenSizeInch(int inches); - void setPhysicalScreenSizeOverride(bool enable); - void setPhysicalScreenWidthMm(int newWidth); - void setPhysicalScreenHeightMm(int newHeight); - -Q_SIGNALS: - void displayBrightnessChanged(int newValue); - void physicalScreenSizeInchChanged(int newInches); - void physicalScreenSizeOverrideChanged(bool newValue); - void physicalScreenWidthMmChanged(int newValue); - void physicalScreenHeightMmChanged(int newValue); - -protected: - DisplaySettingsPrivate *d_ptr; - - Q_DISABLE_COPY(DisplaySettings) - Q_DECLARE_PRIVATE(DisplaySettings) -}; - -QT_END_NAMESPACE - -#endif // DISPLAYSETTINGS_H diff --git a/src/displaysettings/displaysettings.pro b/src/displaysettings/displaysettings.pro deleted file mode 100644 index f19d872..0000000 --- a/src/displaysettings/displaysettings.pro +++ /dev/null @@ -1,16 +0,0 @@ -load(qt_build_config) - -TARGET = QtDisplaySettings -VERSION = 1.0 - -QT = core - -MODULE = displaysettings -load(qt_module) - -SOURCES += displaysettings.cpp \ - displaysettings_p.cpp - -HEADERS += displaysettings.h \ - displaysettings_p.h - diff --git a/src/displaysettings/displaysettings_p.cpp b/src/displaysettings/displaysettings_p.cpp deleted file mode 100644 index e62fca7..0000000 --- a/src/displaysettings/displaysettings_p.cpp +++ /dev/null @@ -1,278 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include -#include "displaysettings_p.h" - -QT_BEGIN_NAMESPACE - -DisplaySettingsPrivate::DisplaySettingsPrivate(DisplaySettings *qq) - :q_ptr(qq) - ,m_brightness(255) - ,m_lightDevicesInitialized(false) - ,m_physScreenSize(new PhysicalScreenSize(qq)) -{ - -} - -void DisplaySettingsPrivate::initLightDevices() -{ - if (m_lightDevicesInitialized) - return; - QDirIterator it(QStringLiteral("/sys/class/backlight")); - while (it.hasNext()) { - LightDevice ld; - ld.deviceFile = it.next() + QStringLiteral("/brightness"); - QFile maxFile(it.filePath() + QStringLiteral("/max_brightness")); - if (!maxFile.open(QIODevice::ReadOnly)) - continue; - bool ok = false; - ld.maxValue = maxFile.read(10).simplified().toUInt(&ok); - if (!ok || !ld.maxValue) - continue; - QFile valFile(ld.deviceFile); - if (!valFile.open(QIODevice::ReadOnly)) - continue; - ok = false; - uint val = valFile.read(10).simplified().toUInt(&ok); - if (!ok) - continue; - // map max->max as that is a common case, otherwise choose a reasonable value - ld.value = (val == ld.maxValue) ? 255 : (val * 256)/(ld.maxValue+1); - ld.name = it.fileName(); - m_lightDevices.append(ld); - } - if (!m_lightDevices.isEmpty()) - m_brightness = m_lightDevices.at(0).value; - m_lightDevicesInitialized = true; -} - - -bool DisplaySettingsPrivate::setDisplayBrightness(int v) -{ - quint8 value = qBound(0, v, 255); - initLightDevices(); - for (int i = 0; i < m_lightDevices.size(); i++) { - LightDevice &ld = m_lightDevices[i]; - QFile devFile(ld.deviceFile); - if (!devFile.open(QIODevice::WriteOnly)) - continue; - // Maps only 0 to 0, since 0 often means "off"; other values are degrees of "on". - uint newVal = value ? 1 + ((value * ld.maxValue) / 256) : 0; - devFile.write(QByteArray::number(newVal)); - ld.value = value; - } - m_brightness = value; - return true; -} - -int DisplaySettingsPrivate::displayBrightness() -{ - initLightDevices(); - return m_brightness; -} - -int DisplaySettingsPrivate::physicalScreenSizeInch() const -{ - return m_physScreenSize->size(); -} - -int DisplaySettingsPrivate::physicalScreenWidthMm() const -{ - return m_physScreenSize->widthMm(); -} - -int DisplaySettingsPrivate::physicalScreenHeightMm() const -{ - return m_physScreenSize->heightMm(); -} - -void DisplaySettingsPrivate::setPhysicalScreenSizeInch(int inches) -{ - Q_Q(DisplaySettings); - if (m_physScreenSize->size() != inches) { - m_physScreenSize->setSize(inches); - emit q->physicalScreenSizeInchChanged(inches); - } -} - -void DisplaySettingsPrivate::setPhysicalScreenWidthMm(int newWidth) -{ - Q_Q(DisplaySettings); - if (m_physScreenSize->widthMm() != newWidth) { - m_physScreenSize->setSizeMm(newWidth, m_physScreenSize->heightMm()); - emit q->physicalScreenWidthMmChanged(newWidth); - } -} - -void DisplaySettingsPrivate::setPhysicalScreenHeightMm(int newHeight) -{ - Q_Q(DisplaySettings); - if (m_physScreenSize->heightMm() != newHeight) { - m_physScreenSize->setSizeMm(m_physScreenSize->widthMm(), newHeight); - emit q->physicalScreenHeightMmChanged(newHeight); - } -} - -bool DisplaySettingsPrivate::physicalScreenSizeOverride() const -{ - return m_physScreenSize->enabled(); -} - -void DisplaySettingsPrivate::setPhysicalScreenSizeOverride(bool enable) -{ - Q_Q(DisplaySettings); - if (m_physScreenSize->enabled() != enable) { - m_physScreenSize->setEnabled(enable); - emit q->physicalScreenSizeOverrideChanged(enable); - } -} - -PhysicalScreenSize::PhysicalScreenSize(QObject *parent) - : QObject(parent) - ,physScreenSizeEnabled(false), physScreenSizeInch(7) -{ - physWriteTimer.setSingleShot(true); - physWriteTimer.setInterval(1000); - QObject::connect(&physWriteTimer, SIGNAL(timeout()), this, SLOT(onTimeout())); - - read(QStringLiteral("/etc/appcontroller.conf")); - read(QStringLiteral("/var/lib/b2qt/appcontroller.conf.d/physical_screen_size.conf")); -} - -PhysicalScreenSize::~PhysicalScreenSize() -{ - -} - -void PhysicalScreenSize::read(const QString &filename) -{ - QFile f(filename); - if (!f.open(QIODevice::ReadOnly | QIODevice::Text)) - return; - - physScreenWidthMm = 154; - physScreenHeightMm = 90; - int found = 0; - while (!f.atEnd()) { - QByteArray line = f.readLine().trimmed(); - if (line.startsWith(QByteArrayLiteral("env="))) { - QByteArrayList values = line.split('='); - if (values.count() == 3) { - bool ok; - if (values[1] == QByteArrayLiteral("QT_QPA_EGLFS_PHYSICAL_WIDTH")) { - int val = values[2].toInt(&ok); - if (ok) { - ++found; - physScreenWidthMm = val; - } - } else if (values[1] == QByteArrayLiteral("QT_QPA_EGLFS_PHYSICAL_HEIGHT")) { - int val = values[2].toInt(&ok); - if (ok) { - ++found; - physScreenHeightMm = val; - } - } - } - } - } - if (found == 2) - physScreenSizeEnabled = true; - - const qreal diagMM = qSqrt(physScreenWidthMm * physScreenWidthMm + physScreenHeightMm * physScreenHeightMm); - physScreenSizeInch = qRound(diagMM / 25.4); -} - -void PhysicalScreenSize::onTimeout() -{ - write(); -} - -void PhysicalScreenSize::write(bool includePhysSize) -{ - QDir(QStringLiteral("/var/lib")).mkpath(QStringLiteral("b2qt/appcontroller.conf.d")); - write(QStringLiteral("/var/lib/b2qt/appcontroller.conf.d/physical_screen_size.conf"), includePhysSize); -} - -void PhysicalScreenSize::write(const QString &filename, bool includePhysSize) -{ - QFile f(filename); - - QByteArrayList lines; - if (f.open(QIODevice::ReadOnly | QIODevice::Text)) { - while (!f.atEnd()) { - QByteArray line = f.readLine().trimmed(); - if (!line.startsWith(QByteArrayLiteral("env=QT_QPA_EGLFS_PHYSICAL_WIDTH=")) - && !line.startsWith(QByteArrayLiteral("env=QT_QPA_EGLFS_PHYSICAL_HEIGHT="))) - lines.append(line); - } - f.close(); - } - - if (!f.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) - return; - - const int physScreenHeight = physScreenHeightMm; - const int physScreenWidth = physScreenWidthMm; - - foreach (const QByteArray &line, lines) - f.write(line + QByteArrayLiteral("\n")); - - if (includePhysSize) - f.write(QByteArrayLiteral("env=QT_QPA_EGLFS_PHYSICAL_WIDTH=") + QByteArray::number(physScreenWidth) - + QByteArrayLiteral("\nenv=QT_QPA_EGLFS_PHYSICAL_HEIGHT=") + QByteArray::number(physScreenHeight) - + QByteArrayLiteral("\n")); -} - -void PhysicalScreenSize::setSize(int inches) -{ - physScreenSizeInch = inches; - physWriteTimer.start(); -} - -void PhysicalScreenSize::setSizeMm(int width, int height) -{ - physScreenWidthMm = width; - physScreenHeightMm = height; - physWriteTimer.start(); -} - -bool PhysicalScreenSize::enabled() const -{ - return physScreenSizeEnabled; -} - -void PhysicalScreenSize::setEnabled(bool enable) -{ - physScreenSizeEnabled = enable; - // Rewrite appcontroller.conf with or without the physical width/height lines. - write(enable); -} - -QT_END_NAMESPACE diff --git a/src/displaysettings/displaysettings_p.h b/src/displaysettings/displaysettings_p.h deleted file mode 100644 index 91825e8..0000000 --- a/src/displaysettings/displaysettings_p.h +++ /dev/null @@ -1,119 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef DISPLAYSETTINGSPRIVATE_H -#define DISPLAYSETTINGSPRIVATE_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include "displaysettings.h" - -QT_BEGIN_NAMESPACE - -class PhysicalScreenSize : public QObject -{ - Q_OBJECT - -public: - explicit PhysicalScreenSize(QObject *parent = Q_NULLPTR); - virtual ~PhysicalScreenSize(); - - void setSize(int inches); - void setSizeMm(int widthMm, int heightMm); - int size() const { return physScreenSizeInch; } - int widthMm() const { return physScreenWidthMm; } - int heightMm() const { return physScreenHeightMm; } - bool enabled() const; - void setEnabled(bool enable); - -private slots: - void onTimeout(); - -private: - void read(const QString &filename); - void write(bool includePhysSize = true); - void write(const QString &filename, bool includePhysSize = true); - - bool physScreenSizeEnabled; - int physScreenSizeInch; - int physScreenWidthMm; - int physScreenHeightMm; - QTimer physWriteTimer; -}; - -class LightDevice -{ -public: - QString name; - QString deviceFile; - quint8 value; - uint maxValue; -}; - -class DisplaySettingsPrivate -{ - Q_DECLARE_PUBLIC(DisplaySettings) -public: - DisplaySettingsPrivate(DisplaySettings* qq); - int displayBrightness(); - int physicalScreenSizeInch() const; - int physicalScreenWidthMm() const; - int physicalScreenHeightMm() const; - bool physicalScreenSizeOverride() const; - - bool setDisplayBrightness(int value); - void setPhysicalScreenSizeInch(int inches); - void setPhysicalScreenWidthMm(int newWidth); - void setPhysicalScreenHeightMm(int newHeight); - void setPhysicalScreenSizeOverride(bool enable); -private: - void initLightDevices(); - DisplaySettings *q_ptr; - int m_brightness; - int m_screenSizeInch; - int m_screenWidthMm; - int m_screenHeightMm; - bool m_sizeOverride; - QList m_lightDevices; - bool m_lightDevicesInitialized; - PhysicalScreenSize *m_physScreenSize; -}; - -QT_END_NAMESPACE - -#endif // DISPLAYSETTINGSPRIVATE_H diff --git a/src/imports/bluetoothsettings/bluetoothsettings.pro b/src/imports/bluetoothsettings/bluetoothsettings.pro deleted file mode 100644 index 8facaf3..0000000 --- a/src/imports/bluetoothsettings/bluetoothsettings.pro +++ /dev/null @@ -1,10 +0,0 @@ -QT += qml bluetooth bluetoothsettings - -CONFIG += no_cxx_module - -TARGET = btsettingsplugin -TARGETPATH = QtDeviceUtilities/BluetoothSettings - -SOURCES += plugin.cpp - -load(qml_plugin) diff --git a/src/imports/bluetoothsettings/plugin.cpp b/src/imports/bluetoothsettings/plugin.cpp deleted file mode 100644 index db180f7..0000000 --- a/src/imports/bluetoothsettings/plugin.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include -#include -#include -#include - -#include "bluetoothdevice.h" -#include "discoverymodel.h" - -/*! - \qmlmodule QtDeviceUtilities.BluetoothSettings 1.0 - \ingroup qtdevice-utilities-qml-modules - \ingroup qmlmodules - \title Qt Bluetooth Settings QML Types - - \brief Provides a singleton QML type for controlling bluetooth settings. - - To import and use the module's QML types, use the following statement: - - \badcode - import QtDeviceUtilities.BluetoothSettings 1.0 - \endcode - - \note Some functions may not be available on all of the platforms. - - \section1 QML Types -*/ - -/*! - \qmltype BtDevice - \inqmlmodule QtDeviceUtilities.BluetoothSettings - \brief A singleton QML type for controlling bluetooth settings. - - There is no need to create an instance of this object. To use it, - simply import the \c {QtDeviceUtilities.BluetoothSettings} module. -*/ - -/*! - \qmlproperty bool BtDevice::scanning - - Controls whether the Bluetooth device is scanning for remote devices. -*/ - -/*! - \qmlproperty bool BtDevice::powered - - Powers the Bluetooth device on or off. -*/ - -/*! - \qmlproperty object BtDevice::deviceModel - \readonly - - Holds the device model. -*/ - -/*! - \qmlmethod void BtDevice::requestPairing(string address) - - Starts the process of pairing to a remove device specified by \a address, - and connects to it if the pairing was successful. -*/ - -/*! - \qmlmethod void BtDevice::requestConnect(string address) - - Connects to a remove device specified by \a address. - - \sa requestDisconnect() -*/ - -/*! - \qmlmethod void BtDevice::requestDisconnect(string address) - - Disconnects from the remove device specified by \a address. - - \sa requestConnect() -*/ - -QT_BEGIN_NAMESPACE - -template -QObject *instance(QQmlEngine *engine, QJSEngine *) { - T *t = new T(engine); - t->setObjectName(T::staticMetaObject.className()); - return t; -} - -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("QtDeviceUtilities.BluetoothSettings")); - qmlRegisterUncreatableType(uri, 1, 0, "BtDeviceItem", "Cannot be instantiated directly."); - qmlRegisterSingletonType(uri, 1, 0, "BtDevice", &instance); - } -}; - -QT_END_NAMESPACE - -#include "plugin.moc" diff --git a/src/imports/bluetoothsettings/plugins.qmltypes b/src/imports/bluetoothsettings/plugins.qmltypes deleted file mode 100644 index 0270419..0000000 --- a/src/imports/bluetoothsettings/plugins.qmltypes +++ /dev/null @@ -1,89 +0,0 @@ -import QtQuick.tooling 1.2 - -// 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 QtDeviceUtilities.BluetoothSettings 1.0' - -Module { - dependencies: [] - Component { - name: "BluetoothDevice" - prototype: "QObject" - exports: ["QtDeviceUtilities.BluetoothSettings/BtDevice 1.0"] - isCreatable: false - isSingleton: true - exportMetaObjectRevisions: [0] - Property { name: "scanning"; type: "bool" } - Property { name: "powered"; type: "bool" } - Property { name: "deviceModel"; type: "QObject"; isReadonly: true; isPointer: true } - Method { - name: "deviceStateChanged" - Parameter { name: "state"; type: "QBluetoothLocalDevice::HostMode" } - } - Method { name: "scanFinished" } - Method { - name: "pairingDisplayConfirmation" - Parameter { name: "address"; type: "QBluetoothAddress" } - Parameter { name: "pin"; type: "string" } - } - Method { - name: "pairingDisplayPinCode" - Parameter { name: "address"; type: "QBluetoothAddress" } - Parameter { name: "pin"; type: "string" } - } - Method { - name: "pairingFinished" - Parameter { name: "address"; type: "QBluetoothAddress" } - Parameter { name: "pairing"; type: "QBluetoothLocalDevice::Pairing" } - } - Method { - name: "deviceConnected" - Parameter { name: "address"; type: "QBluetoothAddress" } - } - Method { - name: "deviceDisconnected" - Parameter { name: "address"; type: "QBluetoothAddress" } - } - Method { - name: "requestPairing" - Parameter { name: "address"; type: "string" } - } - Method { - name: "requestConnect" - Parameter { name: "address"; type: "string" } - } - Method { - name: "requestDisconnect" - Parameter { name: "address"; type: "string" } - } - } - Component { - name: "BtDeviceItem" - prototype: "QObject" - exports: ["QtDeviceUtilities.BluetoothSettings/BtDeviceItem 1.0"] - isCreatable: false - exportMetaObjectRevisions: [0] - Enum { - name: "DeviceType" - values: { - "Phone": 0, - "Computer": 1, - "Mouse": 2, - "Keyboard": 3, - "Headphones": 4, - "Microphone": 5, - "Camera": 6, - "Camcorder": 7, - "Clock": 8, - "HealthDevice": 9, - "GenericDevice": 1000 - } - } - Property { name: "address"; type: "string"; isReadonly: true } - Property { name: "name"; type: "string"; isReadonly: true } - Property { name: "connected"; type: "bool"; isReadonly: true } - Property { name: "type"; type: "DeviceType"; isReadonly: true } - } -} diff --git a/src/imports/bluetoothsettings/qmldir b/src/imports/bluetoothsettings/qmldir deleted file mode 100644 index f0c15f5..0000000 --- a/src/imports/bluetoothsettings/qmldir +++ /dev/null @@ -1,4 +0,0 @@ -module QtDeviceUtilities.BluetoothSettings -plugin btsettingsplugin -classname BluetoothSettingsQmlPlugin -typeinfo plugins.qmltypes diff --git a/src/imports/displaysettings/displaysettings.pro b/src/imports/displaysettings/displaysettings.pro deleted file mode 100644 index efa1903..0000000 --- a/src/imports/displaysettings/displaysettings.pro +++ /dev/null @@ -1,10 +0,0 @@ -QT += qml displaysettings - -CONFIG += no_cxx_module - -TARGET = qmldisplaysettingsplugin -TARGETPATH = QtDeviceUtilities/DisplaySettings - -SOURCES += plugin.cpp \ - -load(qml_plugin) diff --git a/src/imports/displaysettings/plugin.cpp b/src/imports/displaysettings/plugin.cpp deleted file mode 100644 index 1fd56b0..0000000 --- a/src/imports/displaysettings/plugin.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include -#include -#include -#include "displaysettings.h" - -/*! - \qmlmodule QtDeviceUtilities.DisplaySettings 1.0 - \ingroup qtdevice-utilities-qml-modules - \ingroup qmlmodules - \title Qt Display Settings QML Types - - \brief Provides a singleton QML type for controlling display settings. - - To import and use the module's QML types, use the following statement: - - \badcode - import QtDeviceUtilities.DisplaySettings 1.0 - \endcode - - \note Some functions may not be available on all of the platforms. - - \section1 QML Types -*/ - -/*! - \qmltype DisplaySettings - \inqmlmodule QtDeviceUtilities.DisplaySettings - \brief A singleton QML type for controlling display settings. - - There is no need to create an instance of this object. To use it, - simply import the \c {QtDeviceUtilities.DisplaySettings} module. -*/ - -/*! - \qmlproperty int DisplaySettings::displayBrightness - - Holds the display brightness (intensity of the backlight). A valid - range for the property is from 0 to 255, where 255 is the maximum - brightness and 0 is the minimum (typically, the backlight turned off). -*/ - -/*! - \qmlproperty int DisplaySettings::physicalScreenSizeInch - - Holds the physical (diagonal) screen size in inches. -*/ - -/*! - \qmlproperty bool DisplaySettings::physicalScreenSizeOverride - - Holds whether the value in physicalScreenSizeInch should be - used or not. -*/ - -QT_BEGIN_NAMESPACE - -template -QObject *instance(QQmlEngine *engine, QJSEngine *) { - T *t = new T(engine); - t->setObjectName(T::staticMetaObject.className()); - return t; -} - -class DisplaySettingsQmlPlugin : 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); - } -}; - -QT_END_NAMESPACE - -#include "plugin.moc" diff --git a/src/imports/displaysettings/plugins.qmltypes b/src/imports/displaysettings/plugins.qmltypes deleted file mode 100644 index bebb50e..0000000 --- a/src/imports/displaysettings/plugins.qmltypes +++ /dev/null @@ -1,47 +0,0 @@ -import QtQuick.tooling 1.2 - -// 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 QtDeviceUtilities.DisplaySettings 1.0' - -Module { - dependencies: [] - Component { - name: "DisplaySettings" - prototype: "QObject" - exports: ["QtDeviceUtilities.DisplaySettings/DisplaySettings 1.0"] - isCreatable: false - isSingleton: true - exportMetaObjectRevisions: [0] - Property { name: "displayBrightness"; type: "int" } - Property { name: "physicalScreenSizeInch"; type: "int" } - Property { name: "physicalScreenSizeOverride"; type: "bool" } - Signal { - name: "displayBrightnessChanged" - Parameter { name: "newValue"; type: "int" } - } - Signal { - name: "physicalScreenSizeInchChanged" - Parameter { name: "newInches"; type: "int" } - } - Signal { - name: "physicalScreenSizeOverrideChanged" - Parameter { name: "newValue"; type: "bool" } - } - Method { - name: "setDisplayBrightness" - type: "bool" - Parameter { name: "value"; type: "int" } - } - Method { - name: "setPhysicalScreenSizeInch" - Parameter { name: "inches"; type: "int" } - } - Method { - name: "setPhysicalScreenSizeOverride" - Parameter { name: "enable"; type: "bool" } - } - } -} diff --git a/src/imports/displaysettings/qmldir b/src/imports/displaysettings/qmldir deleted file mode 100644 index 1bfbe93..0000000 --- a/src/imports/displaysettings/qmldir +++ /dev/null @@ -1,4 +0,0 @@ -module QtDeviceUtilities.DisplaySettings -plugin qmldisplaysettingsplugin -classname DisplaySettingsQmlPlugin -typeinfo plugins.qmltypes diff --git a/src/imports/imports.pro b/src/imports/imports.pro index c39e30f..0d4185e 100644 --- a/src/imports/imports.pro +++ b/src/imports/imports.pro @@ -1,9 +1,3 @@ TEMPLATE = subdirs -SUBDIRS += localdevice \ - displaysettings - -qtHaveModule(bluetoothsettings): SUBDIRS += bluetoothsettings qtHaveModule(networksettings): SUBDIRS += networksettings -qtHaveModule(localesettings): SUBDIRS += localesettings -qtHaveModule(timedatesettings): SUBDIRS += timedatesettings diff --git a/src/imports/localdevice/localdevice.pro b/src/imports/localdevice/localdevice.pro deleted file mode 100644 index e34a3d5..0000000 --- a/src/imports/localdevice/localdevice.pro +++ /dev/null @@ -1,10 +0,0 @@ -QT += qml localdevice - -CONFIG += no_cxx_module - -TARGET = localdeviceplugin -TARGETPATH = QtDeviceUtilities/LocalDeviceSettings - -SOURCES += plugin.cpp - -load(qml_plugin) diff --git a/src/imports/localdevice/plugin.cpp b/src/imports/localdevice/plugin.cpp deleted file mode 100644 index 8a59a27..0000000 --- a/src/imports/localdevice/plugin.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include - -/*! - \qmlmodule QtDeviceUtilities.LocalDeviceSettings 1.0 - \ingroup qtdevice-utilities-qml-modules - \ingroup qmlmodules - \title Qt Local Device Settings QML Types - - \brief Provides a collection of local device related utility functions. - - Qt Local Device Settings QML modules provides utility functions for controlling - an embedded device, such as device shutdown and reboot. - - To import and use the module's QML types, use the following statement: - - \badcode - import QtDeviceUtilities.LocalDeviceSettings 1.0 - \endcode - - \note Some functions may not be available on all of the platforms. - - \section1 QML Types -*/ - -/*! - \qmltype LocalDevice - \inqmlmodule QtDeviceUtilities.LocalDeviceSettings - \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 QtDeviceUtilities.LocalDeviceSettings module: - - \badcode - import QtDeviceUtilities.LocalDeviceSettings 1.0 - \endcode - - \note Some functions may not be available on all 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() -*/ - -QT_BEGIN_NAMESPACE - -static QObject *module_api_factory(QQmlEngine *engine, QJSEngine *scriptEngine) -{ - Q_UNUSED(engine) - Q_UNUSED(scriptEngine) - QLocalDevice *api = new QLocalDevice(); - - return api; -} - -class LocalDeviceSettingsQmlPlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") - -public: - void registerTypes(const char *uri) - { - Q_ASSERT(QLatin1String(uri) == "QtDeviceUtilities.LocalDeviceSettings"); - qmlRegisterSingletonType(uri, 1, 0, "LocalDevice", module_api_factory); - } -}; - -QT_END_NAMESPACE - -#include "plugin.moc" diff --git a/src/imports/localdevice/plugins.qmltypes b/src/imports/localdevice/plugins.qmltypes deleted file mode 100644 index 1becd85..0000000 --- a/src/imports/localdevice/plugins.qmltypes +++ /dev/null @@ -1,21 +0,0 @@ -import QtQuick.tooling 1.2 - -// 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 QtDeviceUtilities.LocalDeviceSettings 1.0' - -Module { - dependencies: [] - Component { - name: "QLocalDevice" - prototype: "QObject" - exports: ["QtDeviceUtilities.LocalDeviceSettings/LocalDevice 1.0"] - isCreatable: false - isSingleton: true - exportMetaObjectRevisions: [0] - Method { name: "reboot" } - Method { name: "powerOff" } - } -} diff --git a/src/imports/localdevice/qmldir b/src/imports/localdevice/qmldir deleted file mode 100644 index 81b12d4..0000000 --- a/src/imports/localdevice/qmldir +++ /dev/null @@ -1,4 +0,0 @@ -module QtDeviceUtilities.LocalDeviceSettings -plugin localdeviceplugin -classname LocalDeviceSettingsQmlPlugin -typeinfo plugins.qmltypes diff --git a/src/imports/localesettings/locale.xml b/src/imports/localesettings/locale.xml deleted file mode 100644 index b722456..0000000 --- a/src/imports/localesettings/locale.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/src/imports/localesettings/localesettings.pro b/src/imports/localesettings/localesettings.pro deleted file mode 100644 index 5dcb5f7..0000000 --- a/src/imports/localesettings/localesettings.pro +++ /dev/null @@ -1,10 +0,0 @@ -QT += qml localesettings - -CONFIG += no_cxx_module - -TARGET = localesettingsplugin -TARGETPATH = QtDeviceUtilities/LocaleSettings - -SOURCES += plugin.cpp - -load(qml_plugin) diff --git a/src/imports/localesettings/plugin.cpp b/src/imports/localesettings/plugin.cpp deleted file mode 100644 index 573e5bc..0000000 --- a/src/imports/localesettings/plugin.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include "localefiltermodel.h" - -/*! - \qmlmodule QtDeviceUtilities.LocaleSettings 1.0 - \ingroup qtdevice-utilities-qml-modules - \ingroup qmlmodules - \title Qt Locale Settings QML Types - - \brief Provides singleton QML types for controlling locale settings. - - Qt Local Device Settings QML module provides singleton QML types for - controlling locale settings in an embedded device. - - To import and use the module's QML types, use the following statement: - - \badcode - import QtDeviceUtilities.LocaleSettings 1.0 - \endcode - - \note Some functions may not be available on all of the platforms. - - \section1 QML Types -*/ - -/*! - \qmltype LocaleManager - \inqmlmodule QtDeviceUtilities.LocaleSettings - \brief A singleton QML type for managing the system locale. - - There is no need to create an instance of this object. To use it, - simply import the \c {QtDeviceUtilities.LocaleSettings} module. - - The \l locale property holds the current system locale string. - Pass it to \l {QtQml::Qt::locale()}{Qt.locale}() to - retrieve locale-specific properties. - - For example: - - \qml - import QtQuick 2.6 - import QtDeviceUtilities.LocaleSettings 1.0 - - Item { - property var currentLocale: Qt.locale(LocaleManager.locale) - Text { text: currentLocale.nativeLanguageName } - } - \endqml - - \sa LocaleFilter, {QtQml::}{Locale} -*/ - -/*! - \qmlproperty string LocaleManager::locale - - Holds the system locale string in the format \e language_country, - for example, "en_US". - - \sa QLocale::name() -*/ - -/*! - \qmltype LocaleFilter - \inqmlmodule QtDeviceUtilities.LocaleSettings - \brief Provides a filtered model for the available locales. - - There is no need to create an instance of this object. To use it, - simply import the \c {QtDeviceUtilities.LocaleSettings} module. - - The LocaleFilter QML type can be used as the model in a view - that lists the available locales. - - For example: - - \code - ListView { - model: LocaleFilter - delegate: Text { text: language + " | " + country } - } - \endcode - - Available \e roles in the locale model: - - \table - \header \li Role \li Description - - \row \li \c code \li Locale code string in the format \e language_country. - See QLocale::name() for details. - - \row \li \c country \li The name of the country. If available, the native - country name is used. - - \row \li \c language \li The name of the language. If available, the - native language name is used. - \endtable - - \sa LocaleManager -*/ - -/*! - \qmlproperty string LocaleFilter::filter - - Holds a string that filters out the locales in the model. - The filtering process is a case-insensitive match for - whether the region (country) name contains the \e filter - substring; it can be taken from user input. -*/ - -/*! - \qmlmethod object LocaleFilter::itemFromRow(int index) - - Returns the item at \a index in the model. This item can - assigned to \l [QML] {LocaleManager::locale} - {LocaleManager.locale}, when the user selects a locale - from a list. -*/ - -QT_BEGIN_NAMESPACE - -template -QObject *instance(QQmlEngine *engine, QJSEngine *) { - T *t = new T(engine); - t->setObjectName(T::staticMetaObject.className()); - return t; -} - -class LocaleSettingsQmlPlugin : 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); - qmlRegisterSingletonType(uri, 1, 0, "LocaleFilter", &instance); - } -}; - -QT_END_NAMESPACE - -#include "plugin.moc" diff --git a/src/imports/localesettings/plugins.qmltypes b/src/imports/localesettings/plugins.qmltypes deleted file mode 100644 index 01e66b5..0000000 --- a/src/imports/localesettings/plugins.qmltypes +++ /dev/null @@ -1,349 +0,0 @@ -import QtQuick.tooling 1.2 - -// 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 QtDeviceUtilities.LocaleSettings 1.0' - -Module { - dependencies: [] - Component { - name: "LocaleFilterModel" - prototype: "QSortFilterProxyModel" - exports: ["QtDeviceUtilities.LocaleSettings/LocaleFilter 1.0"] - isCreatable: false - isSingleton: true - exportMetaObjectRevisions: [0] - Property { name: "filter"; type: "string" } - Method { - name: "itemFromRow" - type: "QVariant" - Parameter { name: "row"; type: "int" } - } - } - Component { - name: "QAbstractItemModel" - prototype: "QObject" - Enum { - name: "LayoutChangeHint" - values: { - "NoLayoutChangeHint": 0, - "VerticalSortHint": 1, - "HorizontalSortHint": 2 - } - } - Signal { - name: "dataChanged" - Parameter { name: "topLeft"; type: "QModelIndex" } - Parameter { name: "bottomRight"; type: "QModelIndex" } - Parameter { name: "roles"; type: "QVector" } - } - Signal { - name: "dataChanged" - Parameter { name: "topLeft"; type: "QModelIndex" } - Parameter { name: "bottomRight"; type: "QModelIndex" } - } - Signal { - name: "headerDataChanged" - Parameter { name: "orientation"; type: "Qt::Orientation" } - Parameter { name: "first"; type: "int" } - Parameter { name: "last"; type: "int" } - } - Signal { - name: "layoutChanged" - Parameter { name: "parents"; type: "QList" } - Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" } - } - Signal { - name: "layoutChanged" - Parameter { name: "parents"; type: "QList" } - } - Signal { name: "layoutChanged" } - Signal { - name: "layoutAboutToBeChanged" - Parameter { name: "parents"; type: "QList" } - Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" } - } - Signal { - name: "layoutAboutToBeChanged" - Parameter { name: "parents"; type: "QList" } - } - Signal { name: "layoutAboutToBeChanged" } - Signal { - name: "rowsAboutToBeInserted" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "first"; type: "int" } - Parameter { name: "last"; type: "int" } - } - Signal { - name: "rowsInserted" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "first"; type: "int" } - Parameter { name: "last"; type: "int" } - } - Signal { - name: "rowsAboutToBeRemoved" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "first"; type: "int" } - Parameter { name: "last"; type: "int" } - } - Signal { - name: "rowsRemoved" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "first"; type: "int" } - Parameter { name: "last"; type: "int" } - } - Signal { - name: "columnsAboutToBeInserted" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "first"; type: "int" } - Parameter { name: "last"; type: "int" } - } - Signal { - name: "columnsInserted" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "first"; type: "int" } - Parameter { name: "last"; type: "int" } - } - Signal { - name: "columnsAboutToBeRemoved" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "first"; type: "int" } - Parameter { name: "last"; type: "int" } - } - Signal { - name: "columnsRemoved" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "first"; type: "int" } - Parameter { name: "last"; type: "int" } - } - Signal { name: "modelAboutToBeReset" } - Signal { name: "modelReset" } - Signal { - name: "rowsAboutToBeMoved" - Parameter { name: "sourceParent"; type: "QModelIndex" } - Parameter { name: "sourceStart"; type: "int" } - Parameter { name: "sourceEnd"; type: "int" } - Parameter { name: "destinationParent"; type: "QModelIndex" } - Parameter { name: "destinationRow"; type: "int" } - } - Signal { - name: "rowsMoved" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "start"; type: "int" } - Parameter { name: "end"; type: "int" } - Parameter { name: "destination"; type: "QModelIndex" } - Parameter { name: "row"; type: "int" } - } - Signal { - name: "columnsAboutToBeMoved" - Parameter { name: "sourceParent"; type: "QModelIndex" } - Parameter { name: "sourceStart"; type: "int" } - Parameter { name: "sourceEnd"; type: "int" } - Parameter { name: "destinationParent"; type: "QModelIndex" } - Parameter { name: "destinationColumn"; type: "int" } - } - Signal { - name: "columnsMoved" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "start"; type: "int" } - Parameter { name: "end"; type: "int" } - Parameter { name: "destination"; type: "QModelIndex" } - Parameter { name: "column"; type: "int" } - } - Method { name: "submit"; type: "bool" } - Method { name: "revert" } - Method { - name: "hasIndex" - type: "bool" - Parameter { name: "row"; type: "int" } - Parameter { name: "column"; type: "int" } - Parameter { name: "parent"; type: "QModelIndex" } - } - Method { - name: "hasIndex" - type: "bool" - Parameter { name: "row"; type: "int" } - Parameter { name: "column"; type: "int" } - } - Method { - name: "index" - type: "QModelIndex" - Parameter { name: "row"; type: "int" } - Parameter { name: "column"; type: "int" } - Parameter { name: "parent"; type: "QModelIndex" } - } - Method { - name: "index" - type: "QModelIndex" - Parameter { name: "row"; type: "int" } - Parameter { name: "column"; type: "int" } - } - Method { - name: "parent" - type: "QModelIndex" - Parameter { name: "child"; type: "QModelIndex" } - } - Method { - name: "sibling" - type: "QModelIndex" - Parameter { name: "row"; type: "int" } - Parameter { name: "column"; type: "int" } - Parameter { name: "idx"; type: "QModelIndex" } - } - Method { - name: "rowCount" - type: "int" - Parameter { name: "parent"; type: "QModelIndex" } - } - Method { name: "rowCount"; type: "int" } - Method { - name: "columnCount" - type: "int" - Parameter { name: "parent"; type: "QModelIndex" } - } - Method { name: "columnCount"; type: "int" } - Method { - name: "hasChildren" - type: "bool" - Parameter { name: "parent"; type: "QModelIndex" } - } - Method { name: "hasChildren"; type: "bool" } - Method { - name: "data" - type: "QVariant" - Parameter { name: "index"; type: "QModelIndex" } - Parameter { name: "role"; type: "int" } - } - Method { - name: "data" - type: "QVariant" - Parameter { name: "index"; type: "QModelIndex" } - } - Method { - name: "setData" - type: "bool" - Parameter { name: "index"; type: "QModelIndex" } - Parameter { name: "value"; type: "QVariant" } - Parameter { name: "role"; type: "int" } - } - Method { - name: "setData" - type: "bool" - Parameter { name: "index"; type: "QModelIndex" } - Parameter { name: "value"; type: "QVariant" } - } - Method { - name: "headerData" - type: "QVariant" - Parameter { name: "section"; type: "int" } - Parameter { name: "orientation"; type: "Qt::Orientation" } - Parameter { name: "role"; type: "int" } - } - Method { - name: "headerData" - type: "QVariant" - Parameter { name: "section"; type: "int" } - Parameter { name: "orientation"; type: "Qt::Orientation" } - } - Method { - name: "fetchMore" - Parameter { name: "parent"; type: "QModelIndex" } - } - Method { - name: "canFetchMore" - type: "bool" - Parameter { name: "parent"; type: "QModelIndex" } - } - Method { - name: "flags" - type: "Qt::ItemFlags" - Parameter { name: "index"; type: "QModelIndex" } - } - Method { - name: "match" - type: "QModelIndexList" - Parameter { name: "start"; type: "QModelIndex" } - Parameter { name: "role"; type: "int" } - Parameter { name: "value"; type: "QVariant" } - Parameter { name: "hits"; type: "int" } - Parameter { name: "flags"; type: "Qt::MatchFlags" } - } - Method { - name: "match" - type: "QModelIndexList" - Parameter { name: "start"; type: "QModelIndex" } - Parameter { name: "role"; type: "int" } - Parameter { name: "value"; type: "QVariant" } - Parameter { name: "hits"; type: "int" } - } - Method { - name: "match" - type: "QModelIndexList" - Parameter { name: "start"; type: "QModelIndex" } - Parameter { name: "role"; type: "int" } - Parameter { name: "value"; type: "QVariant" } - } - } - Component { - name: "QAbstractProxyModel" - prototype: "QAbstractItemModel" - Property { name: "sourceModel"; type: "QAbstractItemModel"; isPointer: true } - Method { - name: "mapToSource" - type: "QModelIndex" - Parameter { name: "proxyIndex"; type: "QModelIndex" } - } - Method { - name: "mapFromSource" - type: "QModelIndex" - Parameter { name: "sourceIndex"; type: "QModelIndex" } - } - Method { - name: "mapSelectionToSource" - type: "QItemSelection" - Parameter { name: "selection"; type: "QItemSelection" } - } - Method { - name: "mapSelectionFromSource" - type: "QItemSelection" - Parameter { name: "selection"; type: "QItemSelection" } - } - } - Component { - name: "QSortFilterProxyModel" - prototype: "QAbstractProxyModel" - Property { name: "filterRegExp"; type: "QRegExp" } - Property { name: "filterKeyColumn"; type: "int" } - Property { name: "dynamicSortFilter"; type: "bool" } - Property { name: "filterCaseSensitivity"; type: "Qt::CaseSensitivity" } - Property { name: "sortCaseSensitivity"; type: "Qt::CaseSensitivity" } - Property { name: "isSortLocaleAware"; type: "bool" } - Property { name: "sortRole"; type: "int" } - Property { name: "filterRole"; type: "int" } - Method { - name: "setFilterRegExp" - Parameter { name: "pattern"; type: "string" } - } - Method { - name: "setFilterWildcard" - Parameter { name: "pattern"; type: "string" } - } - Method { - name: "setFilterFixedString" - Parameter { name: "pattern"; type: "string" } - } - Method { name: "clear" } - Method { name: "invalidate" } - } - Component { - name: "SystemLocale" - prototype: "QObject" - exports: ["QtDeviceUtilities.LocaleSettings/LocaleManager 1.0"] - isCreatable: false - isSingleton: true - exportMetaObjectRevisions: [0] - Property { name: "locale"; type: "string" } - } -} diff --git a/src/imports/localesettings/qmldir b/src/imports/localesettings/qmldir deleted file mode 100644 index 0106d12..0000000 --- a/src/imports/localesettings/qmldir +++ /dev/null @@ -1,4 +0,0 @@ -module QtDeviceUtilities.LocaleSettings -plugin localesettingsplugin -classname LocaleSettingsQmlPlugin -typeinfo plugins.qmltypes diff --git a/src/imports/timedatesettings/plugin.cpp b/src/imports/timedatesettings/plugin.cpp deleted file mode 100644 index 70a766c..0000000 --- a/src/imports/timedatesettings/plugin.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include "timezonefiltermodel.h" - -/*! - \qmlmodule QtDeviceUtilities.TimeDateSettings 1.0 - \ingroup qtdevice-utilities-qml-modules - \ingroup qmlmodules - \title Qt Time and Date Settings QML Types - - \brief Provides singleton QML types for controlling date and time settings. - - Qt Time and Date Settings QML module provides singleton QML types for controlling - date and time settings in an embedded device. - - To import and use the module's QML types, use the following statement: - - \badcode - import QtDeviceUtilities.TimeDateSettings 1.0 - \endcode - - \note Some functions may not be available on all of the platforms. - - \section1 QML Types -*/ - -/*! - \qmltype TimeManager - \inqmlmodule QtDeviceUtilities.TimeDateSettings - \brief A singleton QML type for managing the system date and time. - - There is no need to create an instance of this object. To use it, - simply import the \c {QtDeviceUtilities.TimeDateSettings} module. -*/ - -/*! - \qmlproperty string TimeManager::timeZone - - Holds the current time zone string. -*/ - -/*! - \qmlproperty bool TimeManager::ntp - - Holds whether the system time is synchronized using NTP (Network - Time Protocol). -*/ - -/*! - \qmlproperty Date TimeManager::time - - Holds the current date and time. -*/ - -/*! - \qmltype TimezonesFilter - \inqmlmodule QtDeviceUtilities.TimeDateSettings - \brief Provides a filtered model for the available time zones. - - There is no need to create an instance of this object. To use it, - simply import the \c {QtDeviceUtilities.TimeDateSettings} module. - - The TimezonesFilter QML type can be used as the model in a view - that lists the available time zones. - - For example: - - \code - ListView { - model: TimezonesFilter - delegate: Text { text: name + " | " + country } - } - \endcode - - Available \e roles in the time zone model: - - \table - \header \li Role \li Description - - \row \li \c name - \li Display name of the time zone. See QTimeZone::displayName() for - details. - - \row \li \c country - \li Name of the country for the zone time. - - \row \li \c id - \li IANA time zone ID. - \endtable -*/ - -/*! - \qmlproperty string TimezonesFilter::filter - - Holds a string that filters out the time zones in the model. - The filtering process is a case-insensitive match for - whether the time zone's name or country name contain the - \e filter substring; it can be taken from user input. -*/ - -/*! - \qmlmethod object TimezonesFilter::itemFromRow(int index) - - Returns the item at \a index in the model. This item can - be assigned to \l [QML] {TimeManager::timeZone} - {TimeManager.timeZone}, when the user selects a time zone - from a list. -*/ - -QT_BEGIN_NAMESPACE - -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); - qmlRegisterSingletonType(uri, 1, 0, "TimezonesFilter", &instance); - } -}; - -QT_END_NAMESPACE - -#include "plugin.moc" diff --git a/src/imports/timedatesettings/plugins.qmltypes b/src/imports/timedatesettings/plugins.qmltypes deleted file mode 100644 index 26acfc4..0000000 --- a/src/imports/timedatesettings/plugins.qmltypes +++ /dev/null @@ -1,351 +0,0 @@ -import QtQuick.tooling 1.2 - -// 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 QtDeviceUtilities.TimeDateSettings 1.0' - -Module { - dependencies: [] - Component { - name: "QAbstractItemModel" - prototype: "QObject" - Enum { - name: "LayoutChangeHint" - values: { - "NoLayoutChangeHint": 0, - "VerticalSortHint": 1, - "HorizontalSortHint": 2 - } - } - Signal { - name: "dataChanged" - Parameter { name: "topLeft"; type: "QModelIndex" } - Parameter { name: "bottomRight"; type: "QModelIndex" } - Parameter { name: "roles"; type: "QVector" } - } - Signal { - name: "dataChanged" - Parameter { name: "topLeft"; type: "QModelIndex" } - Parameter { name: "bottomRight"; type: "QModelIndex" } - } - Signal { - name: "headerDataChanged" - Parameter { name: "orientation"; type: "Qt::Orientation" } - Parameter { name: "first"; type: "int" } - Parameter { name: "last"; type: "int" } - } - Signal { - name: "layoutChanged" - Parameter { name: "parents"; type: "QList" } - Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" } - } - Signal { - name: "layoutChanged" - Parameter { name: "parents"; type: "QList" } - } - Signal { name: "layoutChanged" } - Signal { - name: "layoutAboutToBeChanged" - Parameter { name: "parents"; type: "QList" } - Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" } - } - Signal { - name: "layoutAboutToBeChanged" - Parameter { name: "parents"; type: "QList" } - } - Signal { name: "layoutAboutToBeChanged" } - Signal { - name: "rowsAboutToBeInserted" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "first"; type: "int" } - Parameter { name: "last"; type: "int" } - } - Signal { - name: "rowsInserted" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "first"; type: "int" } - Parameter { name: "last"; type: "int" } - } - Signal { - name: "rowsAboutToBeRemoved" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "first"; type: "int" } - Parameter { name: "last"; type: "int" } - } - Signal { - name: "rowsRemoved" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "first"; type: "int" } - Parameter { name: "last"; type: "int" } - } - Signal { - name: "columnsAboutToBeInserted" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "first"; type: "int" } - Parameter { name: "last"; type: "int" } - } - Signal { - name: "columnsInserted" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "first"; type: "int" } - Parameter { name: "last"; type: "int" } - } - Signal { - name: "columnsAboutToBeRemoved" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "first"; type: "int" } - Parameter { name: "last"; type: "int" } - } - Signal { - name: "columnsRemoved" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "first"; type: "int" } - Parameter { name: "last"; type: "int" } - } - Signal { name: "modelAboutToBeReset" } - Signal { name: "modelReset" } - Signal { - name: "rowsAboutToBeMoved" - Parameter { name: "sourceParent"; type: "QModelIndex" } - Parameter { name: "sourceStart"; type: "int" } - Parameter { name: "sourceEnd"; type: "int" } - Parameter { name: "destinationParent"; type: "QModelIndex" } - Parameter { name: "destinationRow"; type: "int" } - } - Signal { - name: "rowsMoved" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "start"; type: "int" } - Parameter { name: "end"; type: "int" } - Parameter { name: "destination"; type: "QModelIndex" } - Parameter { name: "row"; type: "int" } - } - Signal { - name: "columnsAboutToBeMoved" - Parameter { name: "sourceParent"; type: "QModelIndex" } - Parameter { name: "sourceStart"; type: "int" } - Parameter { name: "sourceEnd"; type: "int" } - Parameter { name: "destinationParent"; type: "QModelIndex" } - Parameter { name: "destinationColumn"; type: "int" } - } - Signal { - name: "columnsMoved" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "start"; type: "int" } - Parameter { name: "end"; type: "int" } - Parameter { name: "destination"; type: "QModelIndex" } - Parameter { name: "column"; type: "int" } - } - Method { name: "submit"; type: "bool" } - Method { name: "revert" } - Method { - name: "hasIndex" - type: "bool" - Parameter { name: "row"; type: "int" } - Parameter { name: "column"; type: "int" } - Parameter { name: "parent"; type: "QModelIndex" } - } - Method { - name: "hasIndex" - type: "bool" - Parameter { name: "row"; type: "int" } - Parameter { name: "column"; type: "int" } - } - Method { - name: "index" - type: "QModelIndex" - Parameter { name: "row"; type: "int" } - Parameter { name: "column"; type: "int" } - Parameter { name: "parent"; type: "QModelIndex" } - } - Method { - name: "index" - type: "QModelIndex" - Parameter { name: "row"; type: "int" } - Parameter { name: "column"; type: "int" } - } - Method { - name: "parent" - type: "QModelIndex" - Parameter { name: "child"; type: "QModelIndex" } - } - Method { - name: "sibling" - type: "QModelIndex" - Parameter { name: "row"; type: "int" } - Parameter { name: "column"; type: "int" } - Parameter { name: "idx"; type: "QModelIndex" } - } - Method { - name: "rowCount" - type: "int" - Parameter { name: "parent"; type: "QModelIndex" } - } - Method { name: "rowCount"; type: "int" } - Method { - name: "columnCount" - type: "int" - Parameter { name: "parent"; type: "QModelIndex" } - } - Method { name: "columnCount"; type: "int" } - Method { - name: "hasChildren" - type: "bool" - Parameter { name: "parent"; type: "QModelIndex" } - } - Method { name: "hasChildren"; type: "bool" } - Method { - name: "data" - type: "QVariant" - Parameter { name: "index"; type: "QModelIndex" } - Parameter { name: "role"; type: "int" } - } - Method { - name: "data" - type: "QVariant" - Parameter { name: "index"; type: "QModelIndex" } - } - Method { - name: "setData" - type: "bool" - Parameter { name: "index"; type: "QModelIndex" } - Parameter { name: "value"; type: "QVariant" } - Parameter { name: "role"; type: "int" } - } - Method { - name: "setData" - type: "bool" - Parameter { name: "index"; type: "QModelIndex" } - Parameter { name: "value"; type: "QVariant" } - } - Method { - name: "headerData" - type: "QVariant" - Parameter { name: "section"; type: "int" } - Parameter { name: "orientation"; type: "Qt::Orientation" } - Parameter { name: "role"; type: "int" } - } - Method { - name: "headerData" - type: "QVariant" - Parameter { name: "section"; type: "int" } - Parameter { name: "orientation"; type: "Qt::Orientation" } - } - Method { - name: "fetchMore" - Parameter { name: "parent"; type: "QModelIndex" } - } - Method { - name: "canFetchMore" - type: "bool" - Parameter { name: "parent"; type: "QModelIndex" } - } - Method { - name: "flags" - type: "Qt::ItemFlags" - Parameter { name: "index"; type: "QModelIndex" } - } - Method { - name: "match" - type: "QModelIndexList" - Parameter { name: "start"; type: "QModelIndex" } - Parameter { name: "role"; type: "int" } - Parameter { name: "value"; type: "QVariant" } - Parameter { name: "hits"; type: "int" } - Parameter { name: "flags"; type: "Qt::MatchFlags" } - } - Method { - name: "match" - type: "QModelIndexList" - Parameter { name: "start"; type: "QModelIndex" } - Parameter { name: "role"; type: "int" } - Parameter { name: "value"; type: "QVariant" } - Parameter { name: "hits"; type: "int" } - } - Method { - name: "match" - type: "QModelIndexList" - Parameter { name: "start"; type: "QModelIndex" } - Parameter { name: "role"; type: "int" } - Parameter { name: "value"; type: "QVariant" } - } - } - Component { - name: "QAbstractProxyModel" - prototype: "QAbstractItemModel" - Property { name: "sourceModel"; type: "QAbstractItemModel"; isPointer: true } - Method { - name: "mapToSource" - type: "QModelIndex" - Parameter { name: "proxyIndex"; type: "QModelIndex" } - } - Method { - name: "mapFromSource" - type: "QModelIndex" - Parameter { name: "sourceIndex"; type: "QModelIndex" } - } - Method { - name: "mapSelectionToSource" - type: "QItemSelection" - Parameter { name: "selection"; type: "QItemSelection" } - } - Method { - name: "mapSelectionFromSource" - type: "QItemSelection" - Parameter { name: "selection"; type: "QItemSelection" } - } - } - Component { - name: "QSortFilterProxyModel" - prototype: "QAbstractProxyModel" - Property { name: "filterRegExp"; type: "QRegExp" } - Property { name: "filterKeyColumn"; type: "int" } - Property { name: "dynamicSortFilter"; type: "bool" } - Property { name: "filterCaseSensitivity"; type: "Qt::CaseSensitivity" } - Property { name: "sortCaseSensitivity"; type: "Qt::CaseSensitivity" } - Property { name: "isSortLocaleAware"; type: "bool" } - Property { name: "sortRole"; type: "int" } - Property { name: "filterRole"; type: "int" } - Method { - name: "setFilterRegExp" - Parameter { name: "pattern"; type: "string" } - } - Method { - name: "setFilterWildcard" - Parameter { name: "pattern"; type: "string" } - } - Method { - name: "setFilterFixedString" - Parameter { name: "pattern"; type: "string" } - } - Method { name: "clear" } - Method { name: "invalidate" } - } - Component { - name: "SystemTime" - prototype: "QObject" - exports: ["QtDeviceUtilities.TimeDateSettings/TimeManager 1.0"] - isCreatable: false - isSingleton: true - exportMetaObjectRevisions: [0] - Property { name: "timeZone"; type: "string" } - Property { name: "ntp"; type: "bool" } - Property { name: "time"; type: "QDateTime" } - } - Component { - name: "TimezoneFilterModel" - prototype: "QSortFilterProxyModel" - exports: ["QtDeviceUtilities.TimeDateSettings/TimezonesFilter 1.0"] - isCreatable: false - isSingleton: true - exportMetaObjectRevisions: [0] - Property { name: "filter"; type: "string" } - Method { - name: "itemFromRow" - type: "QVariant" - Parameter { name: "row"; type: "int" } - } - } -} diff --git a/src/imports/timedatesettings/qmldir b/src/imports/timedatesettings/qmldir deleted file mode 100644 index 3489ac2..0000000 --- a/src/imports/timedatesettings/qmldir +++ /dev/null @@ -1,4 +0,0 @@ -module QtDeviceUtilities.TimeDateSettings -plugin qmltimedatesettingsplugin -classname TimeDateSettingsQmlPlugin -typeinfo plugins.qmltypes diff --git a/src/imports/timedatesettings/timedatesettings.pro b/src/imports/timedatesettings/timedatesettings.pro deleted file mode 100644 index 7ef6756..0000000 --- a/src/imports/timedatesettings/timedatesettings.pro +++ /dev/null @@ -1,10 +0,0 @@ -QT += qml timedatesettings - -CONFIG += no_cxx_module - -TARGET = qmltimedatesettingsplugin -TARGETPATH = QtDeviceUtilities/TimeDateSettings - -SOURCES += plugin.cpp - -load(qml_plugin) diff --git a/src/localdevice/localdevice.pro b/src/localdevice/localdevice.pro deleted file mode 100644 index 9adc183..0000000 --- a/src/localdevice/localdevice.pro +++ /dev/null @@ -1,15 +0,0 @@ -load(qt_build_config) - -TARGET = QtLocalDevice -VERSION = 1.0 - -QT = core - -MODULE = localdevice -load(qt_module) - -HEADERS += \ - $$PWD/qlocaldevice.h - -SOURCES += \ - $$PWD/qlocaldevice.cpp diff --git a/src/localdevice/qlocaldevice.cpp b/src/localdevice/qlocaldevice.cpp deleted file mode 100644 index fc17eae..0000000 --- a/src/localdevice/qlocaldevice.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qlocaldevice.h" -#include -#include - -QT_BEGIN_NAMESPACE - -/*! - \module QtLocalDeviceSettings - \qtvariable localdevice - \ingroup qtdevice-utilities-cpp-modules - \ingroup modules - \title QtLocalDeviceSettings C++ Classes - \brief Provides functionality for controlling a local device settings. - - To use classes from this module, add this directive into the C++ files: - - \code - #include - \endcode - - To link against the corresponding C++ libraries, add the following to your - qmake project file: - - \code - QT += localdevice - \endcode -*/ - -/*! - \class QLocalDevice - \inmodule QtLocalDeviceSettings - - \brief The QLocalDevice class provides utility functions for controlling an - embedded device. - - The methods in this class enable shutting down and rebooting an embedded - device. -*/ - -/*! - Creates a new local device with the parent \a parent. -*/ -QLocalDevice::QLocalDevice(QObject *parent) - : QObject(parent) -{ -} - -/*! - Deletes the local device. -*/ -QLocalDevice::~QLocalDevice() -{ -} - -/*! - * Reboots the system. Does not return. - * - * \sa powerOff() - */ -void QLocalDevice::reboot() -{ - sync(); - ::reboot(RB_AUTOBOOT); - qWarning("reboot returned"); -} - - -/*! - * Shuts down the system. Does not return. - * - * \sa reboot() - */ -void QLocalDevice::powerOff() -{ - sync(); - ::reboot(RB_POWER_OFF); - qWarning("powerOff returned"); -} - -QT_END_NAMESPACE diff --git a/src/localdevice/qlocaldevice.h b/src/localdevice/qlocaldevice.h deleted file mode 100644 index 4a0071a..0000000 --- a/src/localdevice/qlocaldevice.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QLOCALDEVICE_H -#define QLOCALDEVICE_H - -#include - -QT_BEGIN_NAMESPACE - -class Q_DECL_EXPORT QLocalDevice : public QObject -{ - Q_OBJECT - -public: - QLocalDevice(QObject *parent = Q_NULLPTR); - ~QLocalDevice(); - -public Q_SLOTS: - void reboot(); - void powerOff(); -}; - -QT_END_NAMESPACE - -#endif // QLOCALDEVICE_H diff --git a/src/localesettings/locale.xml b/src/localesettings/locale.xml deleted file mode 100644 index b722456..0000000 --- a/src/localesettings/locale.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/src/localesettings/localefiltermodel.cpp b/src/localesettings/localefiltermodel.cpp deleted file mode 100644 index e3eecd4..0000000 --- a/src/localesettings/localefiltermodel.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "localemodel.h" -#include "localefiltermodel.h" - -QT_BEGIN_NAMESPACE - -/*! - \module QtLocaleSettings - \qtvariable localesettings - \ingroup qtdevice-utilities-cpp-modules - \ingroup modules - \title Qt Locale Settings C++ Classes - \brief Provides functionality for controlling locale settings. - - To use classes from this module, add this directive into the C++ files: - - \code - #include - \endcode - - To link against the corresponding C++ libraries, add the following to your - qmake project file: - - \code - QT += localesettings - \endcode -*/ - -/*! - \class LocaleFilterModel - \inmodule QtLocaleSettings - - \brief The LocaleFilterModel class provides a filtered model for the - available locales. - - This class can be used as the model in a view that lists the available - locales. - - \sa LocaleModel -*/ - -/*! - \property LocaleFilterModel::filter - \brief Holds a string that filters out the locales in the model. - - The filtering process is a case-insensitive matching for whether the region - (country) name contains this string. The string can be taken from user - input. - - \sa LocaleItem::country -*/ - -/*! - Creates a locale filer model with the parent \a parent. -*/ -LocaleFilterModel::LocaleFilterModel(QObject* parent) - :QSortFilterProxyModel(parent) -{ - connect(this, &LocaleFilterModel::filterChanged, this, &LocaleFilterModel::invalidate); - LocaleModel *localeModel = new LocaleModel(this); - setSourceModel(localeModel); -} - -/*! - Deletes the locale filter model. -*/ -LocaleFilterModel::~LocaleFilterModel() -{ - -} - -/*! - Returns the locale filter string. -*/ -QString LocaleFilterModel::filter() const -{ - return m_filter; -} - -/*! - Sets the locale filter string to \a aFilter. -*/ -void LocaleFilterModel::setFilter(const QString& aFilter) -{ - m_filter = aFilter; - emit filterChanged(); -} - -/*! - Returns whether the row \a source_row has the country role and whether it is - found in the locale model \a source_parent. -*/ -bool LocaleFilterModel::filterAcceptsRow( int source_row, const QModelIndex& source_parent ) const -{ - bool ret = false; - if (this->sourceModel()) - { - QModelIndex index = this->sourceModel()->index( source_row, 0, source_parent ); - if (index.isValid()) - { - QVariant nameRole = index.data(LocaleModel::Country); - if (nameRole.isValid()) - { - QString name = nameRole.toString(); - if (name.contains(m_filter, Qt::CaseInsensitive)) { - ret = true; - } - } - } - } - return ret; -} - -/*! - Returns the locale item at \a row in the locale filter model. - - This item can be assigned to LocaleManager::locale(), when the user selects - a locale from a list. - - \sa LocaleItem -*/ -QVariant LocaleFilterModel::itemFromRow(const int row) const -{ - QModelIndex idx = index(row, 0); - QModelIndex mapped = mapToSource(idx); - if (mapped.isValid()) - { - QVariant nameRole = mapped.data(LocaleModel::Code); - if (nameRole.isValid()) - { - return nameRole; - } - } - return QVariant(); -} - -/*! - Returns the index for the country \a country in the locale filter model. - - The index is used by item views, delegates, and selection models to locate - an item in the model. -*/ -int LocaleFilterModel::indexForCountry(const QString &country) const -{ - QAbstractItemModel *model = this->sourceModel(); - LocaleModel *localModel = qobject_cast(model); - QModelIndex i = localModel->indexForCountry(country); - QModelIndex ret = mapFromSource(i); - return ret.row(); -} - -QT_END_NAMESPACE diff --git a/src/localesettings/localefiltermodel.h b/src/localesettings/localefiltermodel.h deleted file mode 100644 index 1ddcb9c..0000000 --- a/src/localesettings/localefiltermodel.h +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef LOCALEFILTERMODEL_H -#define LOCALEFILTERMODEL_H - - -#include - -QT_BEGIN_NAMESPACE - -class Q_DECL_EXPORT LocaleFilterModel : public QSortFilterProxyModel -{ - Q_OBJECT - Q_PROPERTY(QString filter READ filter WRITE setFilter NOTIFY filterChanged) -public: - explicit LocaleFilterModel(QObject* parent); - virtual ~LocaleFilterModel(); - bool filterAcceptsRow( int source_row, const QModelIndex& source_parent ) const override; - QString filter() const; - void setFilter(const QString& aFilter); - Q_INVOKABLE QVariant itemFromRow(const int row) const; - Q_INVOKABLE int indexForCountry(const QString &country) const; -Q_SIGNALS: - void filterChanged(); -private: - QString m_filter; - -}; - -QT_END_NAMESPACE - -#endif // LOCALEFILTERMODEL_H diff --git a/src/localesettings/localemodel.cpp b/src/localesettings/localemodel.cpp deleted file mode 100644 index 043376a..0000000 --- a/src/localesettings/localemodel.cpp +++ /dev/null @@ -1,324 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include -#include -#include -#include -#include "localemodel.h" - -QT_BEGIN_NAMESPACE - -/*! - \class LocaleItem - \inmodule QtLocaleSettings - - \brief The LocaleItem class represents a locale. - - This class holds the name, language, and country code of a locale. - - If available, the native country name and language are used. For example, - \e Deutsch and \e Deutschland for the German locale. - - \sa QLocale, LocaleModel -*/ - -/*! - \property LocaleItem::code - \brief The locale code string. - - The locale code is in the format \e language_country, where \e language is - a lowercase, two-letter ISO 639 language code, and \e country is an - uppercase, two- or three-letter ISO 3166 country code. - - \sa QLocale::name() -*/ - -/*! - \property LocaleItem::country - \brief The name of the country. - - \sa QLocale::Country -*/ - -/*! - \property LocaleItem::language - \brief The name of the language. - - \sa QLocale::Language -*/ - - -/*! - Creates the locale item \a locale with the parent \a parent. -*/ -LocaleItem::LocaleItem(const QLocale& locale, QObject *parent) - :QObject(parent) -{ - m_code = locale.name(); - m_country = locale.nativeCountryName(); - if (m_country.isEmpty()) { - m_country = locale.countryToString(locale.country()); - } - - m_language = locale.nativeLanguageName(); - if (m_language.isEmpty()) { - m_language = locale.languageToString(locale.language()); - } -} - -/*! - Returns the language of the country. -*/ -QString LocaleItem::language() const -{ - return m_language; -} - -/*! - Returns the name of the country. -*/ -QString LocaleItem::country() const -{ - return m_country; -} - -/*! - Returns the country code of the country. -*/ -QString LocaleItem::code() const -{ - return m_code; -} - -/*! - \class LocaleModel - \inmodule QtLocaleSettings - - \brief The LocaleModel class provides a model for the available locales. - - Each item in the model has a set of data elements associated with it, each - with its own role. The roles are used by the view to indicate to the model - which type of data it needs. Custom models should return data in these - types. - - The data in a locale model can be filtered according to the country code, - name, or language. - - \sa LocaleItem, LocaleFilterModel -*/ - -/*! - \enum LocaleModel::Roles - - This enum holds the role of the locale item. - - For user roles, it is up to the developer to decide which types to use and - ensure that components use the correct types when accessing and setting - data. - - \value Language - The language of the country. - \value Country - The name of the country. - \value Code - The locale code string in the format \e language_country. - - \sa Qt::UserRole -*/ - -/*! - \fn LocaleModel::addItem(LocaleItem* item) - - This signal is emitted when the locale item \a item is added to the locale - model. -*/ - -/*! - \fn LocaleModel::ready() - - This signal is emitted when the locale model has been reset. -*/ - -/*! - Creates a locale model with the parent \a parent. -*/ -LocaleModel::LocaleModel(QObject *parent) - : QAbstractListModel(parent) -{ - m_roleNames.insert(Qt::UserRole, "modelData"); - m_roleNames.insert(Country, "country"); - m_roleNames.insert(Language, "language"); - m_roleNames.insert(Code, "code"); - - QFutureWatcher *watcher = new QFutureWatcher(this); - QFuture future = QtConcurrent::run(LocaleModel::generateModel, this); - watcher->setFuture(future); - connect(watcher, SIGNAL(finished()), this, SLOT(modelReady())); -} - -/*! - This signal is emitted when the locale model has been reset. -*/ -void LocaleModel::modelReady() -{ - beginResetModel(); - sort(0); - endResetModel(); - - emit ready(); -} - -/*! - Creates the locale model \a model. -*/ -void LocaleModel::generateModel(LocaleModel* model) -{ - QList allLocales = QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript, QLocale::AnyCountry); - - for (const QLocale &locale : allLocales) { - if (locale.name() != QStringLiteral("C")) { - LocaleItem *l = new LocaleItem(locale); - l->moveToThread(model->thread()); - QMetaObject::invokeMethod(model, "addNewItem", Q_ARG( QObject*, qobject_cast(l))); - } - } -} - -void LocaleModel::addNewItem(QObject *item) -{ - beginInsertRows(QModelIndex(), m_items.count(), m_items.count()); - LocaleItem* newItem = qobject_cast(item); - if (newItem) - m_items.append(newItem); - endInsertRows(); -} - -/*! - Deletes the locale model. -*/ -LocaleModel::~LocaleModel() -{ - qDeleteAll(m_items); -} - -/*! - Returns an array of user roles. - - \sa Roles -*/ -QHash LocaleModel::roleNames() const -{ - return m_roleNames; -} - -/*! - Returns the number of rows in the locale model that has \a parent. -*/ -int LocaleModel::rowCount(const QModelIndex & parent) const -{ - Q_UNUSED(parent); - return m_items.count(); -} - -/*! - Returns the locale item at \a index in the locale model for \a role. - - This item can be assigned to LocaleManager::locale(), when the user selects - a locale from a list. - - \sa LocaleItem, Roles -*/ -QVariant LocaleModel::data(const QModelIndex & index, int role) const -{ - if (!index.isValid()) return QVariant(); - - LocaleItem *item = m_items[index.row()]; - - switch (role) { - case Qt::UserRole: - return QVariant::fromValue(static_cast(item)); - break; - case Country: - return item->country(); - break; - case Language: - return item->language(); - break; - case Code: - return item->code(); - break; - default: - return QVariant(); - } -} - -/*! - Returns whether the locale item has more than one languages specified. - - If the language variant of the locale item if \a v1 is less than \a v2 ##? - -*/ -bool LocaleModel::variantLessThan(const LocaleItem* v1, const LocaleItem* v2) -{ - return v1->language() < v2->language(); -} - -/*! - Sets the sorting order of the \a column items in the locale model to \a order. - - The sort order can be either \l {Qt::AscendingOrder}{ascending} or - \l {Qt::DescendingOrder}{descending}. -*/ -void LocaleModel::sort(int column, Qt::SortOrder order) -{ - Q_UNUSED(column); - Q_UNUSED(order); - std::sort(m_items.begin(), m_items.end(), LocaleModel::variantLessThan); -} - -/*! - Returns the index for the country \a country in the locale model. - - The index is used by item views, delegates, and selection models to locate - an item in the model. -*/ -QModelIndex LocaleModel::indexForCountry(const QString &country) const -{ - for (int i = 0; i < m_items.count(); i++) { - LocaleItem *item = m_items.at(i); - if (item->country() == country || - item->language() == country) { - return index(i); - } - } - return QModelIndex(); -} - -QT_END_NAMESPACE diff --git a/src/localesettings/localemodel.h b/src/localesettings/localemodel.h deleted file mode 100644 index fac0b94..0000000 --- a/src/localesettings/localemodel.h +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef LOCALEMODEL_H -#define LOCALEMODEL_H - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class LocaleItem : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString code READ code CONSTANT) - Q_PROPERTY(QString country READ country CONSTANT) - Q_PROPERTY(QString language READ language CONSTANT) -public: - explicit LocaleItem(const QLocale &locale, QObject *parent = Q_NULLPTR); - QString country() const; - QString language() const; - QString code() const; - -private: - QString m_country; - QString m_language; - QString m_code; -}; - -class Q_DECL_EXPORT LocaleModel : public QAbstractListModel -{ - Q_OBJECT - -public: - explicit LocaleModel(QObject *parent = Q_NULLPTR); - virtual ~LocaleModel(); - // from QAbstractItemModel - int rowCount(const QModelIndex & parent = QModelIndex()) const; - QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const; - QHash roleNames() const; - void sort(int column, Qt::SortOrder order=Qt::AscendingOrder); - static bool variantLessThan(const LocaleItem* v1, const LocaleItem* v2); - QModelIndex indexForCountry(const QString &country) const; - - enum Roles { - Language = Qt::UserRole + 1, - Country, - Code - }; - - static void generateModel(LocaleModel* model); - -Q_SIGNALS: - void addItem(LocaleItem* item); - void ready(); - -private Q_SLOTS: - void addNewItem(QObject* item); - void modelReady(); - -private: - QList m_items; - QHash m_roleNames; -}; - -QT_END_NAMESPACE - -#endif // LOCALEMODEL_H diff --git a/src/localesettings/localesettings.pro b/src/localesettings/localesettings.pro deleted file mode 100644 index 7f5f98a..0000000 --- a/src/localesettings/localesettings.pro +++ /dev/null @@ -1,21 +0,0 @@ -load(qt_build_config) - -TARGET = QtLocaleSettings -VERSION = 1.0 - -QT = core dbus - -MODULE = localesettings -load(qt_module) - -DBUS_INTERFACES = locale.xml - -HEADERS = \ - systemlocale.h \ - systemlocale_p.h \ - localemodel.h \ - localefiltermodel.h -SOURCES += systemlocale.cpp \ - localemodel.cpp \ - localefiltermodel.cpp - diff --git a/src/localesettings/systemlocale.cpp b/src/localesettings/systemlocale.cpp deleted file mode 100644 index e6de431..0000000 --- a/src/localesettings/systemlocale.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include "systemlocale.h" -#include "systemlocale_p.h" - -QT_BEGIN_NAMESPACE - -SystemLocale::SystemLocale(QObject *parent) - :QObject(parent) - ,d_ptr(new SystemLocalePrivate(this)) -{ -} - -QString SystemLocale::locale() const -{ - Q_D(const SystemLocale); - return d->locale(); -} - -void SystemLocale::setLocale(const QString& aLocale) -{ - Q_D(SystemLocale); - d->setLocale(aLocale); - emit localeChanged(); -} - -QT_END_NAMESPACE diff --git a/src/localesettings/systemlocale.h b/src/localesettings/systemlocale.h deleted file mode 100644 index b10c5a1..0000000 --- a/src/localesettings/systemlocale.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef LOCALE_H -#define LOCALE_H - -#include - -QT_BEGIN_NAMESPACE - -class SystemLocalePrivate; - -class Q_DECL_EXPORT SystemLocale : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString locale READ locale WRITE setLocale NOTIFY localeChanged) -public: - explicit SystemLocale(QObject *parent = Q_NULLPTR); - QString locale() const; - void setLocale(const QString& aLocale); -Q_SIGNALS: - void localeChanged(); -public Q_SLOTS: - -protected: - SystemLocalePrivate *d_ptr; - - Q_DISABLE_COPY(SystemLocale) - Q_DECLARE_PRIVATE(SystemLocale) -}; - -QT_END_NAMESPACE - -#endif // LOCALE_H diff --git a/src/localesettings/systemlocale_p.h b/src/localesettings/systemlocale_p.h deleted file mode 100644 index a3d1a5f..0000000 --- a/src/localesettings/systemlocale_p.h +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef LOCALE_P_H -#define LOCALE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "systemlocale.h" -#include "locale_interface.h" - -QT_BEGIN_NAMESPACE - -class SystemLocalePrivate -{ - Q_DECLARE_PUBLIC(SystemLocale) -public: - SystemLocalePrivate(SystemLocale *qq) - :q_ptr(qq) - { - m_localeInterface = new OrgFreedesktopLocale1Interface(QStringLiteral("org.freedesktop.locale1"), - QStringLiteral("/org/freedesktop/locale1"), - QDBusConnection::systemBus(), qq); - - QStringList locale = m_localeInterface->locale(); - foreach (QString l, locale) { - QStringList nameValue = l.split('='); - if (nameValue.length() == 2) - m_localeCache[nameValue.at(0)] = nameValue.at(1); - } - } - - QString locale() const { - return m_localeCache[QStringLiteral("LANG")]; - } - - void setLocale(const QString& aLocale) { - m_localeCache[QStringLiteral("LANG")] = aLocale; - updateLocale(); - } - - void updateLocale() { - QStringList newLocale; - QMap::iterator i; - for (i = m_localeCache.begin(); i != m_localeCache.end(); ++i) { - QString val = i.key() + QLatin1String("=") + i.value(); - newLocale.append(val); - } - m_localeInterface->SetLocale(newLocale, true); - } - - -private: - QMap m_localeCache; - OrgFreedesktopLocale1Interface *m_localeInterface; - SystemLocale *q_ptr; -}; - -QT_END_NAMESPACE - -#endif // LOCALE_P_H diff --git a/src/networksettings/connman/qnetworksettingsmanager_p.cpp b/src/networksettings/connman/qnetworksettingsmanager_p.cpp index a56edca..fe62bbe 100644 --- a/src/networksettings/connman/qnetworksettingsmanager_p.cpp +++ b/src/networksettings/connman/qnetworksettingsmanager_p.cpp @@ -39,8 +39,6 @@ QT_BEGIN_NAMESPACE const QString ConnManServiceName(QStringLiteral("net.connman")); -const QString QdbdFileName(QStringLiteral("/etc/default/qdbd")); -const char* SearchKeyword("USB_ETHERNET_PROTOCOL="); QNetworkSettingsManagerPrivate::QNetworkSettingsManagerPrivate(QNetworkSettingsManager *parent) :QObject(parent) @@ -324,86 +322,4 @@ void QNetworkSettingsManagerPrivate::serviceReady() } } -QString QNetworkSettingsManagerPrivate::usbEthernetInternetProtocolAddress() -{ - QString usbEthernetIp = QLatin1String("Not connected"); - QNetworkInterface interface = QNetworkInterface::interfaceFromName(QLatin1String("usb0")); - if (interface.flags().testFlag(QNetworkInterface::IsUp)) { - for (QNetworkAddressEntry &entry:interface.addressEntries()) { - if (entry.ip().protocol() == QAbstractSocket::IPv4Protocol){ - usbEthernetIp = entry.ip().toString(); - break; - } - } - } - return usbEthernetIp; -} - -QString QNetworkSettingsManagerPrivate::usbVirtualEthernetLinkProtocol() -{ - QByteArray line(QNetworkSettingsManagerPrivate::readUsbEthernetProtocolLine()); - QString protocol; - if (line.size()) { - int keywordStartIndex(line.indexOf("=")); - line = line.trimmed(); - protocol = QString::fromLatin1( line.mid(keywordStartIndex + 1, (line.length() - 1)).toUpper() ); - } - return protocol; -} - -bool QNetworkSettingsManagerPrivate::hasUsbEthernetProtocolConfiguration() -{ - return !(QNetworkSettingsManagerPrivate::readUsbEthernetProtocolLine().isEmpty()); -} - -void QNetworkSettingsManagerPrivate::setUsbVirtualEthernetLinkProtocol(const QString &protocol) -{ - if (QLatin1String("RNDIS") == protocol || QLatin1String("CDCECM") == protocol) { - QByteArray fileContent(QNetworkSettingsManagerPrivate::readQdbdFileContent()); - writeUsbEthernetProtocolToFileContent(fileContent, protocol); - } else{ - qWarning("Unsupported USB Ethernet protocol"); - } -} - -QByteArray QNetworkSettingsManagerPrivate::readQdbdFileContent() -{ - QFile qdbdFile(QdbdFileName); - QByteArray fileContent; - if (qdbdFile.open(QIODevice::ReadOnly | QIODevice::Text)) - fileContent = qdbdFile.readAll(); - - return fileContent; -} - -QByteArray QNetworkSettingsManagerPrivate::readUsbEthernetProtocolLine() -{ - QByteArray fileContent(QNetworkSettingsManagerPrivate::readQdbdFileContent()); - int keywordStartIndex(fileContent.indexOf(SearchKeyword, 0)); - int keywordLineEndIndex(fileContent.indexOf("\n", keywordStartIndex)); - QByteArray keywordLine = fileContent.mid(keywordStartIndex, keywordLineEndIndex); - return keywordLine; -} - -void QNetworkSettingsManagerPrivate::writeUsbEthernetProtocolToFileContent(QByteArray &fileContent, const QString &protocol) -{ - int keywordStartIndex(fileContent.indexOf(SearchKeyword)); - QByteArray previousLines = fileContent.mid(0, keywordStartIndex); - int keywordLineEndIndex(fileContent.indexOf("\n", keywordStartIndex)); - QByteArray keywordLine = fileContent.mid(keywordStartIndex, keywordLineEndIndex); - QByteArray followingLines = fileContent.mid((keywordLineEndIndex), (fileContent.length() - 1)); - QByteArray updatedLines = previousLines.append(SearchKeyword); - updatedLines.append(protocol.toLatin1().toLower()); - updatedLines.append(followingLines); - QFile qdbdFile(QdbdFileName); - if (qdbdFile.open(QIODevice::WriteOnly | QIODevice::Text)) { - int result = qdbdFile.write(updatedLines); - if (-1 == result) - qDebug("USB Ethernet protocol write to file failed"); - - } else { - qDebug("USB Ethernet protocol file open failed"); - } -} - QT_END_NAMESPACE diff --git a/src/networksettings/connman/qnetworksettingsmanager_p.h b/src/networksettings/connman/qnetworksettingsmanager_p.h index c6f31e6..c199621 100644 --- a/src/networksettings/connman/qnetworksettingsmanager_p.h +++ b/src/networksettings/connman/qnetworksettingsmanager_p.h @@ -74,10 +74,6 @@ public: QNetworkSettingsService* currentWifiConnection() const {return m_currentWifiConnection;} void setCurrentWiredConnection(QNetworkSettingsService *connection) {m_currentWiredConnection = connection;} QNetworkSettingsService* currentWiredConnection() const {return m_currentWiredConnection;} - QString usbEthernetInternetProtocolAddress(); - QString usbVirtualEthernetLinkProtocol(); - bool hasUsbEthernetProtocolConfiguration(); - void setUsbVirtualEthernetLinkProtocol(const QString &protocol); public slots: void getServicesFinished(QDBusPendingCallWatcher *watcher); @@ -92,9 +88,6 @@ public slots: private: bool initialize(); void handleNewService(const QString &servicePath); - void writeUsbEthernetProtocolToFileContent(QByteArray &fileContent, const QString &protocol); - static QByteArray readQdbdFileContent(); - static QByteArray readUsbEthernetProtocolLine(); protected: QNetworkSettingsInterfaceModel m_interfaceModel; diff --git a/src/networksettings/qnetworksettingsmanager.cpp b/src/networksettings/qnetworksettingsmanager.cpp index a128049..667004f 100644 --- a/src/networksettings/qnetworksettingsmanager.cpp +++ b/src/networksettings/qnetworksettingsmanager.cpp @@ -330,41 +330,4 @@ QNetworkSettingsUserAgent* QNetworkSettingsManager::userAgent() return d->userAgent(); } -/*! - Returns the ip address of usb ethernet network. -*/ -QString QNetworkSettingsManager::usbEthernetInternetProtocolAddress() -{ - Q_D(QNetworkSettingsManager); - return d->usbEthernetInternetProtocolAddress(); -} - -/*! - Returns the usb ethernet protocol -*/ -QString QNetworkSettingsManager::usbVirtualEthernetLinkProtocol() -{ - Q_D(QNetworkSettingsManager); - return d->usbVirtualEthernetLinkProtocol(); -} - - -/*! - Returns true if usb ethernet protocol is configured by file and configuration file exists. -*/ -bool QNetworkSettingsManager::hasUsbEthernetProtocolConfiguration() -{ - Q_D(QNetworkSettingsManager); - return d->hasUsbEthernetProtocolConfiguration(); -} - -/*! - Set the usb ethernet protocol according to parameter. -*/ -void QNetworkSettingsManager::setUsbVirtualEthernetLinkProtocol(const QString &protocol) -{ - Q_D(QNetworkSettingsManager); - d->setUsbVirtualEthernetLinkProtocol(protocol); -} - QT_END_NAMESPACE diff --git a/src/networksettings/qnetworksettingsmanager.h b/src/networksettings/qnetworksettingsmanager.h index 16ed539..4d20179 100644 --- a/src/networksettings/qnetworksettingsmanager.h +++ b/src/networksettings/qnetworksettingsmanager.h @@ -52,8 +52,6 @@ class Q_DECL_EXPORT QNetworkSettingsManager : public QObject Q_PROPERTY(QNetworkSettingsUserAgent* userAgent READ userAgent CONSTANT) Q_PROPERTY(QNetworkSettingsService* currentWifiConnection READ currentWifiConnection NOTIFY currentWifiConnectionChanged) Q_PROPERTY(QNetworkSettingsService* currentWiredConnection READ currentWiredConnection NOTIFY currentWiredConnectionChanged) - Q_PROPERTY(QString usbEthernetIpAddress READ usbEthernetInternetProtocolAddress NOTIFY usbEthernetInternetProtocolAddressChanged) - Q_PROPERTY(QString usbEthernetProtocol READ usbVirtualEthernetLinkProtocol NOTIFY usbVirtualEthernetLinkProtocolChanged) public: explicit QNetworkSettingsManager(QObject* parent = Q_NULLPTR); @@ -71,18 +69,12 @@ public: QNetworkSettingsService* currentWifiConnection(); QNetworkSettingsService* currentWiredConnection(); Q_INVOKABLE QNetworkSettingsInterface* interface(int type, int instance); - Q_INVOKABLE QString usbEthernetInternetProtocolAddress(); - Q_INVOKABLE QString usbVirtualEthernetLinkProtocol(); - Q_INVOKABLE bool hasUsbEthernetProtocolConfiguration(); - Q_INVOKABLE void setUsbVirtualEthernetLinkProtocol(const QString &protocol); Q_SIGNALS: void servicesChanged(); void interfacesChanged(); void currentWifiConnectionChanged(); void currentWiredConnectionChanged(); - void usbEthernetInternetProtocolAddressChanged(const QString &newusbEthernetIpAddress); - void usbVirtualEthernetLinkProtocolChanged(const QString &newUsbEthernetProtocol); protected: QNetworkSettingsManagerPrivate *d_ptr; diff --git a/src/settingsui/ViewSettings.qml b/src/settingsui/ViewSettings.qml index e9a1c74..9bbbc10 100644 --- a/src/settingsui/ViewSettings.qml +++ b/src/settingsui/ViewSettings.qml @@ -40,5 +40,4 @@ Item { property string buttonGrayColor: "#9d9faa" property string buttonActiveColor: "#216729" property string scrollBarColor: "#41cd52" - property bool usbEthernetSettingVisible: false } diff --git a/src/settingsui/bluetooth/Bluetooth.qml b/src/settingsui/bluetooth/Bluetooth.qml deleted file mode 100644 index d4cec78..0000000 --- a/src/settingsui/bluetooth/Bluetooth.qml +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.0 -import QtDeviceUtilities.BluetoothSettings 1.0 -import "../common" - -Item { - id: root - - Row { - id: bluetoothRow - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - spacing: parent.width * 0.025 - - Text { - id: bluetoothSwitchText - anchors.verticalCenter: parent.verticalCenter - font.pixelSize: pluginMain.subTitleFontSize - font.family: appFont - color: "white" - text: qsTr("Bluetooth") - } - CustomSwitch { - anchors.verticalCenter: parent.verticalCenter - indicatorWidth: root.width * 0.15 - indicatorHeight: root.height * 0.06 - - enabled: BtDevice.available - checked: BtDevice.powered - onCheckedChanged: BtDevice.powered = checked - } - - Text { - id: scanningText - anchors.verticalCenter: parent.verticalCenter - verticalAlignment: Text.AlignVCenter - font.pixelSize: pluginMain.valueFontSize - color: "white" - text: "Scanning" - font.family: appFont - opacity: (BtDevice.scanning && BtDevice.powered) ? 1.0 : 0.0 - visible: opacity > 0 - Behavior on opacity { - NumberAnimation {duration: 150} - } - - Timer { - id: scanningTimer - interval: 1000 - repeat: true - running: BtDevice.scanning - - onTriggered: { - if (scanningText.text.indexOf("...") !== -1) - scanningText.text = "Scanning" - else - scanningText.text += "." - } - } - } - - Connections { - target: BtDevice - function onPoweredChanged() { - if (BtDevice.powered) - BtDevice.scanning = true - } - } - } - - Discovery { - id: discovery - anchors.top: bluetoothRow.bottom - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.bottomMargin: parent.height * 0.085 - visible: BtDevice.powered - } -} diff --git a/src/settingsui/bluetooth/Discovery.qml b/src/settingsui/bluetooth/Discovery.qml deleted file mode 100644 index 515d37a..0000000 --- a/src/settingsui/bluetooth/Discovery.qml +++ /dev/null @@ -1,138 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.0 -import QtDeviceUtilities.BluetoothSettings 1.0 -import QtDeviceUtilities.QtButtonImageProvider 1.0 - -Item { - id: top - - ListView { - id: mainList - anchors.fill: parent - opacity: BtDevice.scanning ? .5 : 1.0 - interactive: !BtDevice.scanning - clip: true - model: BtDevice.deviceModel - - function getIcon(deviceType) { - switch (deviceType) { - case BtDeviceItem.Computer: - return "../icons/Laptop_qt_1x.png" - case BtDeviceItem.Headphones: - return "../icons/Headphones_qt_1x.png" - case BtDeviceItem.Microphone: - return "../icons/Microphone_qt_1x.png" - case BtDeviceItem.Mouse: - return "../icons/Mouse_qt_1x.png" - case BtDeviceItem.Keyboard: - return "../icons/Keyboard_qt_1x.png" - default: - return "../icons/Bluetooth_qt_1x.png" - } - } - - delegate: Item { - id: btDelegate - width: parent.width - height: expanded || connected ? mainList.height * 0.175 + mainList.height * 0.05 : mainList.height * 0.175 - property bool expanded: false - MouseArea { - anchors.fill: parent - onClicked: { - if (!connected){ - btDelegate.expanded = !btDelegate.expanded - } - } - } - Image { - id: bticon - sourceSize.width: parent.width - sourceSize.height: parent.height - height: parent.height * 0.5 - width: height - anchors.left: parent.left - anchors.verticalCenter: parent.verticalCenter - source: mainList.getIcon(type) - } - Column { - anchors.left: bticon.right - anchors.leftMargin: parent.width * 0.025 - anchors.right: connectButton.left - anchors.verticalCenter: parent.verticalCenter - Label { - id: bttext - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - font.pixelSize: mainList.height * 0.06 - text: name - color: connected ? viewSettings.buttonGreenColor : "white" - font.family: appFont - font.styleName: connected ? "SemiBold" : "Regular" - } - Label { - id: details - height: btDelegate.height * 0.275 * opacity - opacity: btDelegate.expanded || connected ? 1 : 0.0 - visible: opacity > 0 - text: address - color: connected ? viewSettings.buttonGreenColor : "white" - font.family: appFont - Behavior on opacity { NumberAnimation { duration: 200} } - } - } - QtButton { - id: connectButton - height: mainList.height * 0.125 - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - opacity: (expanded || connected) && !BtDevice.scanning ? 1.0 : 0.0 - visible: opacity > 0 - fillColor: connected ? viewSettings.buttonGrayColor : viewSettings.buttonGreenColor - borderColor: "transparent" - text: connected ? qsTr("Disconnect") : qsTr("Connect") - onClicked : connected ? BtDevice.requestDisconnect(address) : BtDevice.requestPairing(address); - Behavior on opacity { NumberAnimation { duration: 200 } } - } - Behavior on height { NumberAnimation { duration: 200} } - - Rectangle { - id: delegateBottom - width: btDelegate.width - color: viewSettings.borderColor - height: 2 - anchors.bottom: btDelegate.bottom - anchors.horizontalCenter: btDelegate.horizontalCenter - } - } - focus: true - } -} diff --git a/src/settingsui/display/Display.qml b/src/settingsui/display/Display.qml deleted file mode 100644 index 97d05a2..0000000 --- a/src/settingsui/display/Display.qml +++ /dev/null @@ -1,193 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.0 -import QtDeviceUtilities.DisplaySettings 1.0 -import QtDeviceUtilities.QtButtonImageProvider 1.0 - -Item { - id: root - anchors.fill: parent - - Column { - spacing: pluginMain.spacing - anchors.top: parent.top - - Text { - verticalAlignment: Text.AlignVCenter - font.pixelSize: pluginMain.subTitleFontSize - font.family: appFont - text: qsTr("Brightness ") + (brightnessSlider.value / 255 * 100).toFixed(1) + "%" - color: "white" - height: pluginMain.fieldTextHeight - } - - Slider { - id: brightnessSlider - width: root.width - height: pluginMain.buttonHeight - Layout.alignment: Qt.AlignVCenter - Layout.fillWidth: true - from: 0 - to: 255 - onValueChanged: DisplaySettings.setDisplayBrightness(value) - - background: Rectangle { - id: sliderBackground - x: brightnessSlider.leftPadding - y: brightnessSlider.topPadding + brightnessSlider.availableHeight / 2 - height / 2 - implicitWidth: root.width - implicitHeight: root.height * 0.01 - width: brightnessSlider.availableWidth - height: implicitHeight - radius: 2 - color: viewSettings.buttonGrayColor - Rectangle { - width: brightnessSlider.visualPosition * parent.width - height: parent.height - color: "white" - radius: 2 - } - } - handle: Rectangle { - x: brightnessSlider.leftPadding + brightnessSlider.visualPosition * (brightnessSlider.availableWidth - width) - y: brightnessSlider.topPadding + brightnessSlider.availableHeight / 2 - height / 2 - height: sliderBackground.height * 7 - width: height - radius: width * 0.5 - antialiasing: true - color: viewSettings.buttonGreenColor - } - - Component.onCompleted: brightnessSlider.value = DisplaySettings.displayBrightness - } - - Text { - verticalAlignment: Text.AlignVCenter - height: pluginMain.fieldTextHeight - font.pixelSize: pluginMain.subTitleFontSize - font.family: appFont - text: qsTr("Physical screen size in millimeters") - Layout.preferredWidth: root.width * 0.3 - Layout.alignment: Qt.AlignVCenter - wrapMode: Label.WordWrap - color: "white" - } - - Column { - leftPadding: pluginMain.margin - spacing: pluginMain.spacing - - Row { - spacing: pluginMain.spacing - - Text { - id: widthText - height: pluginMain.buttonHeight - text: qsTr("Width") - color: "white" - font.pixelSize: pluginMain.valueFontSize - font.family: appFont - verticalAlignment: Text.AlignVCenter - } - TextField { - id: widthField - leftPadding: pluginMain.margin - rightPadding: pluginMain.margin - bottomPadding: 6 - topPadding: 6 - height: pluginMain.buttonHeight - width: root.width * 0.13 - color: "black" - font.pixelSize: pluginMain.valueFontSize - text: DisplaySettings.physicalScreenWidthMm - horizontalAlignment: Text.AlignHCenter - inputMethodHints: Qt.ImhDigitsOnly - background: Rectangle { - border.color: widthField.focus ? viewSettings.buttonGreenColor : "transparent" - border.width: parent.width * 0.05 - } - } - Text { - id: heightText - height: pluginMain.buttonHeight - text: qsTr("Height") - color: "white" - font.pixelSize: pluginMain.valueFontSize - font.family: appFont - verticalAlignment: Text.AlignVCenter - } - TextField { - id: heightField - leftPadding: pluginMain.margin - rightPadding: pluginMain.margin - bottomPadding: 6 - topPadding: 6 - width: widthField.width - height: pluginMain.buttonHeight - color: "black" - font.pixelSize: pluginMain.valueFontSize - text: DisplaySettings.physicalScreenHeightMm - horizontalAlignment: Text.AlignHCenter - inputMethodHints: Qt.ImhDigitsOnly - background: Rectangle { - border.color: heightField.focus ? viewSettings.buttonGreenColor : "transparent" - border.width: parent.width * 0.05 - } - } - } - - Row { - spacing: pluginMain.margin - - QtButton { - id: setButton - height: pluginMain.buttonHeight - text: qsTr("SET") - onClicked: { - DisplaySettings.physicalScreenHeightMm = parseInt(heightField.text) - DisplaySettings.physicalScreenWidthMm = parseInt(widthField.text) - } - } - QtButton { - id: resetButton - height: pluginMain.buttonHeight - borderColor: "transparent" - fillColor: viewSettings.buttonGrayColor - text: qsTr("RESET TO DEFAULT") - onClicked: { - DisplaySettings.physicalScreenHeightMm = 90 - DisplaySettings.physicalScreenWidthMm = 154 - } - } - } - } - } -} diff --git a/src/settingsui/locale/Language.qml b/src/settingsui/locale/Language.qml deleted file mode 100644 index 23d1b64..0000000 --- a/src/settingsui/locale/Language.qml +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.0 -import QtDeviceUtilities.LocaleSettings 1.0 -import QtQml 2.2 -import QtDeviceUtilities.QtButtonImageProvider 1.0 - -Item { - id: root - property var currentRegion: Qt.locale(LocaleManager.locale) - - Column { - spacing: pluginMain.spacing - - Text { - color: "white" - text: qsTr("Region") - font.pixelSize: pluginMain.subTitleFontSize - font.family: appFont - } - - Row { - leftPadding: pluginMain.margin - spacing: pluginMain.spacing - Text { - color: "white" - text: root.currentRegion.nativeCountryName == "" ? "Default" : root.currentRegion.nativeCountryName - font.pixelSize: pluginMain.valueFontSize - font.family: appFont - verticalAlignment: Text.AlignVCenter - height: parent.height - } - QtButton { - id: regionButton - height: pluginMain.buttonHeight - text: qsTr("CHANGE") - onClicked: settingsLoader.source = "qrc:/locale/RegionSelect.qml" - } - } - - Text { - color: "white" - text: qsTr("Format") - font.pixelSize: pluginMain.subTitleFontSize - font.family: appFont - } - - Grid { - columns: 2 - leftPadding: pluginMain.margin - spacing: pluginMain.spacing - - TableKey { - text: qsTr("Region") - } - TableValue { - text: root.currentRegion.nativeCountryName - } - - TableKey { - text: qsTr("Short date:") - } - TableValue { - text: root.currentRegion.dateFormat(1) - } - TableKey { - text: qsTr("Short time:") - } - TableValue { - text: root.currentRegion.timeFormat(1) - } - TableKey { - text: qsTr("Currency:") - } - TableValue { - text: root.currentRegion.currencySymbol(1) - } - TableKey { - text: qsTr("First day of week:") - } - TableValue { - text: root.currentRegion.firstDayOfWeek - } - } - } -} diff --git a/src/settingsui/locale/RegionSelect.qml b/src/settingsui/locale/RegionSelect.qml deleted file mode 100644 index b811a77..0000000 --- a/src/settingsui/locale/RegionSelect.qml +++ /dev/null @@ -1,158 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.0 -import QtDeviceUtilities.LocaleSettings 1.0 -import "../common" -import QtGraphicalEffects 1.0 - -Item { - id: root - property var currentRegion: Qt.locale(LocaleManager.locale) - - Row { - id: backRow - anchors.top: parent.top - anchors.left: parent.left - width: parent.width * 0.2 - height: parent.height * 0.04 - Image { - id: languageBackIcon - anchors.verticalCenter: parent.verticalCenter - height: parent.height * 0.8 - width: height - fillMode: Image.PreserveAspectFit - source: "../newIcons/back_icon.svg" - - ColorOverlay { - source: languageBackIcon - anchors.fill: languageBackIcon - color: viewSettings.buttonGreenColor - visible: true - } - MouseArea { - anchors.fill: parent - onClicked: settingsLoader.source = "qrc:/locale/Language.qml" - } - } - Text { - anchors.top: parent.top - height: parent.height - anchors.verticalCenter: parent.verticalCenter - verticalAlignment: Text.AlignVCenter - font.pixelSize: pluginMain.subTitleFontSize - color: viewSettings.buttonGreenColor - text: "Back" - font.family: appFont - MouseArea { - anchors.fill: parent - onClicked: settingsLoader.source = "qrc:/locale/Language.qml" - } - } - } - - Text { - id: changeLanguageText - anchors.top: backRow.bottom - anchors.topMargin: parent.height * 0.05 - anchors.left: parent.left - font.pixelSize: pluginMain.subTitleFontSize - color: "white" - text: qsTr("Change Language") - font.family: appFont - font.styleName: "Bold" - } - Rectangle { - id: btmLine - anchors.top: changeLanguageText.bottom - anchors.topMargin: parent.height * 0.025 - anchors.left: changeLanguageText.left - width: parent.width * 0.275 - height: parent.height * 0.005 - } - - ColumnLayout { - id: content - anchors.top: btmLine.bottom - anchors.left: parent.left - anchors.bottom: parent.bottom - anchors.right: parent.right - anchors.topMargin: parent.height * 0.025 - TextField { - id: country - Layout.preferredWidth: root.width * 0.5 - font.pixelSize: pluginMain.valueFontSize - leftPadding: pluginMain.margin - rightPadding: pluginMain.margin - bottomPadding: 6 - topPadding: 6 - color: "white" - text: "" - placeholderText: "Search..." - placeholderTextColor: "white" - font.family: appFont - font.styleName: "Regular" - onTextChanged: LocaleFilter.filter = country.text - Layout.alignment: Qt.AlignVCenter - background: Rectangle { - color: "transparent" - border.color: viewSettings.borderColor - border.width: 1 - } - } - - CustomTableView { - id: localeTableView - headerTexts: [qsTr("Language"), qsTr("Country")] - roleNames: ["language", "country"] - model: LocaleFilter - onClicked: { - var val = model.itemFromRow(index); - if (val !== "") { - LocaleManager.locale = val; - settingsLoader.source = "qrc:/locale/Language.qml" - } - } - } - } - Component.onCompleted: { - country.text = LocaleFilter.filter - var n = LocaleFilter.indexForCountry(root.currentRegion.nativeCountryName) - localeTableView.localeIndex = n - } - - Connections { - target: LocaleFilter.sourceModel - function onReady() { - var n = LocaleFilter.indexForCountry(root.currentRegion.nativeCountryName) - localeTableView.localeIndex = n - } - } -} diff --git a/src/settingsui/locale/TableKey.qml b/src/settingsui/locale/TableKey.qml deleted file mode 100644 index 523f0dd..0000000 --- a/src/settingsui/locale/TableKey.qml +++ /dev/null @@ -1,35 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 - -Text { - color: "white" - font.pixelSize: pluginMain.valueFontSize - font.family: appFont -} diff --git a/src/settingsui/locale/TableValue.qml b/src/settingsui/locale/TableValue.qml deleted file mode 100644 index 523f0dd..0000000 --- a/src/settingsui/locale/TableValue.qml +++ /dev/null @@ -1,35 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 - -Text { - color: "white" - font.pixelSize: pluginMain.valueFontSize - font.family: appFont -} diff --git a/src/settingsui/network/NetworkSettings.qml b/src/settingsui/network/NetworkSettings.qml index f18173e..8aa8cc0 100644 --- a/src/settingsui/network/NetworkSettings.qml +++ b/src/settingsui/network/NetworkSettings.qml @@ -31,147 +31,13 @@ import QtQuick.Layouts 1.3 import QtQuick.Controls 2.2 import QtDeviceUtilities.NetworkSettings 1.0 import QtDeviceUtilities.QtButtonImageProvider 1.0 -import QtDeviceUtilities.LocalDeviceSettings 1.0 import "../common" -import "../timedate" Item { id: networkSettingsRoot property string title: qsTr("Network Settings") - property bool usbEthernetSettingVisibility: ( viewSettings.usbEthernetSettingVisible && NetworkSettingsManager.hasUsbEthernetProtocolConfiguration() ) ? true : false anchors.fill: parent - Text { - id: usbEthernetTitleText - visible: usbEthernetSettingVisibility - text: qsTr("USB Ethernet") - font.pixelSize: pluginMain.subTitleFontSize - font.family: appFont - font.styleName: "SemiBold" - color: "white" - anchors.left: parent.left - } - TextArea { - id: ipAddressTextArea - visible: usbEthernetSettingVisibility - text: qsTr("IP Address:") + NetworkSettingsManager.usbEthernetIpAddress - color: viewSettings.buttonGreenColor - font.family: appFont - font.styleName: "SemiBold" - font.pixelSize: pluginMain.subTitleFontSize - 2 - opacity: 1.0 - readOnly: true - anchors.left: usbEthernetTitleText.left - anchors.verticalCenter: usbEthernetCustomComboBox.verticalCenter - anchors.leftMargin: 15 - } - CustomComboBox { - id: usbEthernetCustomComboBox - visible: usbEthernetSettingVisibility - width: root.width * 0.15 - height: pluginMain.buttonHeight - anchors.top: usbEthernetTitleText.bottom - anchors.left: ipAddressTextArea.right - anchors.right: setUsbEthernetButton.left - anchors.rightMargin: 15 - anchors.leftMargin: 15 - model: ["RNDIS", "CDCECM" ] - currentIndex: 0 - delegate: ItemDelegate { - id: usbEthernetDelegate - contentItem: Text { - anchors.left: usbEthernetDelegate.left - anchors.leftMargin: pluginMain.margin - text: modelData - color: usbEthernetCustomComboBox.currentIndex == index ? viewSettings.buttonGreenColor : "white" - elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter - font.pixelSize: pluginMain.valueFontSize - font.family: appFont - font.styleName: "Regular" - } - } - Component.onCompleted: { - usbEthernetCustomComboBox.currentIndex = "RNDIS" === NetworkSettingsManager.usbEthernetProtocol ? 0 : 1 - } - } - QtButton { - id: setUsbEthernetButton - visible: usbEthernetSettingVisibility - height: pluginMain.buttonHeight - text: qsTr("SAVE & REBOOT") - anchors.right: parent.right - anchors.verticalCenter: usbEthernetCustomComboBox.verticalCenter - onClicked: { - showRebootAcceptPopup(); - } - } - - function showRebootAcceptPopup() { - messageDialog.visible = true - } - Dialog { - function rebootAccepted() { - NetworkSettingsManager.setUsbVirtualEthernetLinkProtocol(usbEthernetCustomComboBox.currentText) - LocalDevice.reboot() - } - id: messageDialog - anchors.centerIn: parent - width: parent.width - height: parent.height - opacity: 0.9 - background: Rectangle{ - id: messageDialogMainRectangle - width: parent.width - height: parent.height - color: viewSettings.backgroundColor - } - Rectangle { - id: messageDialogPopupRectangle - color: viewSettings.backgroundColor - border.color: viewSettings.borderColor - border.width: 3 - anchors.centerIn: parent - width: parent.width * 0.75 - height: parent.height * 0.75 - Column { - anchors.centerIn: parent - spacing: viewSettings.pageMargin - Text { - id: shutDownConfirmText - width: messageDialogPopupRectangle.width * 0.75 - height: messageDialogPopupRectangle.height * 0.25 - horizontalAlignment: Text.AlignHCenter - anchors.horizontalCenter: parent.horizontalCenter - fontSizeMode: Text.Fit - minimumPixelSize: 1 - font.pixelSize: messageDialogPopupRectangle.width * 0.3 - color: "white" - font.family: viewSettings.appFont - font.styleName: "SemiBold" - text: "Save and reboot the system?" - } - QtButton { - id: saveRebootConfirm - height: pluginMain.buttonHeight - anchors.horizontalCenter: parent.horizontalCenter - text: "OK" - onClicked: messageDialog.rebootAccepted(); - } - QtButton { - id: saveRebootCancel - height: pluginMain.buttonHeight - anchors.horizontalCenter: parent.horizontalCenter - borderColor: "transparent" - fillColor: viewSettings.buttonGrayColor - text: qsTr("CANCEL") - onClicked: { - messageDialog.visible = false - } - } - } - } - } Text { id: wlanText text: qsTr("WLAN") @@ -179,7 +45,7 @@ Item { font.family: appFont font.styleName: "SemiBold" color: "white" - anchors.top: usbEthernetSettingVisibility ? usbEthernetCustomComboBox.bottom : networkSettingsRoot.top + anchors.top: networkSettingsRoot.top anchors.left: parent.left } CustomSwitch { diff --git a/src/settingsui/power/Power.qml b/src/settingsui/power/Power.qml deleted file mode 100644 index 1bcc658..0000000 --- a/src/settingsui/power/Power.qml +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 -import QtQuick.Controls 2.1 -import QtDeviceUtilities.QtButtonImageProvider 1.0 - -Item { - id: root - - Column { - anchors.top: parent.top - spacing: pluginMain.margin - - QtButton { - id: shutdownButton - width: root.width * 0.4 - height: pluginMain.fieldHeight - text: qsTr("SHUTDOWN") - onClicked: shutdownPopup.open(true) - } - QtButton { - id: rebootButton - width: root.width * 0.4 - height: pluginMain.fieldHeight - text: qsTr("REBOOT") - onClicked: shutdownPopup.open(false) - } - } -} diff --git a/src/settingsui/settingsuiapp.qrc b/src/settingsui/settingsuiapp.qrc index 110cf83..844ba29 100644 --- a/src/settingsui/settingsuiapp.qrc +++ b/src/settingsui/settingsuiapp.qrc @@ -3,16 +3,8 @@ main.qml common/HandwritingModeButton.qml AutoScroller.qml - power/Power.qml - timedate/ManualTime.qml - timedate/CustomComboBox.qml common/CustomSwitch.qml network/PassphraseEnter.qml - locale/TableKey.qml - locale/TableValue.qml - display/Display.qml - locale/Language.qml - locale/RegionSelect.qml network/AddressListEntry.qml network/ComboBoxEntry.qml network/EditWiredSettings.qml @@ -28,9 +20,6 @@ settingsuiplugin/SettingsDelegate.qml settingsuiplugin/SettingsHeader.qml settingsuiplugin/SettingsTitleItem.qml - settingsuiplugin/ShutdownPopup.qml - bluetooth/Bluetooth.qml - bluetooth/Discovery.qml ViewSettings.qml diff --git a/src/settingsui/settingsuiplugin/ShutdownPopup.qml b/src/settingsui/settingsuiplugin/ShutdownPopup.qml deleted file mode 100644 index 4ae9480..0000000 --- a/src/settingsui/settingsuiplugin/ShutdownPopup.qml +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 -import QtDeviceUtilities.QtButtonImageProvider 1.0 - -Rectangle { - id: shutdownPopup - width: parent.width - height: parent.height - color: viewSettings.backgroundColor - opacity: 0.9 - - signal accepted() - property bool shutdown: false - - function open(sd) - { - shutdown = sd - if (sd) { - shutDownConfirmText.text = qsTr("Shut down the system?") - shutDownConfirm.text = qsTr("SHUT DOWN") - } - else { - shutDownConfirmText.text = qsTr("Reboot the system?") - shutDownConfirm.text = qsTr("REBOOT") - } - - visible = true; - } - - function close() - { - visible = false; - } - - Rectangle { - id: frame - color: viewSettings.backgroundColor - border.color: viewSettings.borderColor - border.width: 3 - anchors.centerIn: parent - width: parent.width * 0.35 - height: parent.height * 0.4 - - Column { - anchors.centerIn: parent - spacing: viewSettings.pageMargin - - Text { - id: shutDownConfirmText - width: frame.width * 0.75 - height: frame.height * 0.25 - horizontalAlignment: Text.AlignHCenter - anchors.horizontalCenter: parent.horizontalCenter - fontSizeMode: Text.Fit - minimumPixelSize: 1 - font.pixelSize: frame.width * 0.3 - color: "white" - font.family: viewSettings.appFont - font.styleName: "SemiBold" - text: "" - } - QtButton { - id: shutDownConfirm - height: frame.height * 0.15 - width: frame.width * 0.45 - anchors.horizontalCenter: parent.horizontalCenter - text: "" - onClicked: shutdownPopup.accepted() - } - QtButton { - height: frame.height * 0.15 - width: frame.width * 0.45 - anchors.horizontalCenter: parent.horizontalCenter - borderColor: "transparent" - fillColor: viewSettings.buttonGrayColor - text: qsTr("CANCEL") - onClicked: shutdownPopup.close() - } - } - } -} diff --git a/src/settingsui/settingsuiplugin/icons.qrc b/src/settingsui/settingsuiplugin/icons.qrc index 91c3a76..eddec64 100644 --- a/src/settingsui/settingsuiplugin/icons.qrc +++ b/src/settingsui/settingsuiplugin/icons.qrc @@ -31,21 +31,16 @@ icons/Chevron-left_black.png icons/Power_black_6x.png newIcons/back_icon.svg - newIcons/bluetooth_icon.svg newIcons/close_icon.svg - newIcons/date-time_icon.svg newIcons/detail_icon.svg - newIcons/display_icon.svg newIcons/grid_icon.svg newIcons/header_toggle_icon.svg newIcons/info_icon.svg - newIcons/language_icon.svg newIcons/mouse_icon.svg newIcons/mute_icon.svg newIcons/network_icon.svg newIcons/pause_icon.svg newIcons/play_icon.svg - newIcons/power_icon.svg newIcons/settings_icon.svg newIcons/settingsmenu_launcher_icon.svg newIcons/stop_icon.svg diff --git a/src/settingsui/settingsuiplugin/newIcons/bluetooth_icon.svg b/src/settingsui/settingsuiplugin/newIcons/bluetooth_icon.svg deleted file mode 100644 index 5dfaa97..0000000 --- a/src/settingsui/settingsuiplugin/newIcons/bluetooth_icon.svg +++ /dev/null @@ -1 +0,0 @@ -bluetooth_icon \ No newline at end of file diff --git a/src/settingsui/settingsuiplugin/newIcons/date-time_icon.svg b/src/settingsui/settingsuiplugin/newIcons/date-time_icon.svg deleted file mode 100644 index 2b86128..0000000 --- a/src/settingsui/settingsuiplugin/newIcons/date-time_icon.svg +++ /dev/null @@ -1 +0,0 @@ -date-time_icon \ No newline at end of file diff --git a/src/settingsui/settingsuiplugin/newIcons/display_icon.svg b/src/settingsui/settingsuiplugin/newIcons/display_icon.svg deleted file mode 100644 index 598d2ee..0000000 --- a/src/settingsui/settingsuiplugin/newIcons/display_icon.svg +++ /dev/null @@ -1 +0,0 @@ -display_icon \ No newline at end of file diff --git a/src/settingsui/settingsuiplugin/newIcons/language_icon.svg b/src/settingsui/settingsuiplugin/newIcons/language_icon.svg deleted file mode 100644 index f1235c5..0000000 --- a/src/settingsui/settingsuiplugin/newIcons/language_icon.svg +++ /dev/null @@ -1 +0,0 @@ -language_icon \ No newline at end of file diff --git a/src/settingsui/settingsuiplugin/newIcons/power_icon.svg b/src/settingsui/settingsuiplugin/newIcons/power_icon.svg deleted file mode 100644 index b922c0e..0000000 --- a/src/settingsui/settingsuiplugin/newIcons/power_icon.svg +++ /dev/null @@ -1 +0,0 @@ -power_icon \ No newline at end of file diff --git a/src/settingsui/settingsuiplugin/pluginMain.qml b/src/settingsui/settingsuiplugin/pluginMain.qml index 28e2464..5701034 100644 --- a/src/settingsui/settingsuiplugin/pluginMain.qml +++ b/src/settingsui/settingsuiplugin/pluginMain.qml @@ -31,7 +31,6 @@ import QtQuick.Layouts 1.2 import QtQuick.Controls 2.0 import Qt.labs.settings 1.0 import QtQuick.XmlListModel 2.0 -import QtDeviceUtilities.LocalDeviceSettings 1.0 import QtDeviceUtilities.NetworkSettings 1.0 import QtGraphicalEffects 1.0 @@ -125,20 +124,4 @@ Rectangle { anchors.leftMargin: pluginMain.margin * 2 anchors.rightMargin: pluginMain.margin * 2 } - - ShutdownPopup { - id: shutdownPopup - visible: false - - onAccepted: { - if (shutdown) { - console.log("Powering off!") - LocalDevice.powerOff() - } - else { - console.log("Rebooting!") - LocalDevice.reboot() - } - } - } } diff --git a/src/settingsui/settingsuiplugin/settingsui.qrc b/src/settingsui/settingsuiplugin/settingsui.qrc index ad2a9b6..673bb6a 100644 --- a/src/settingsui/settingsuiplugin/settingsui.qrc +++ b/src/settingsui/settingsuiplugin/settingsui.qrc @@ -1,13 +1,8 @@ pluginMain.qml - ../bluetooth/Bluetooth.qml - ../bluetooth/Discovery.qml ../common/CustomTableView.qml ../common/HandwritingModeButton.qml - ../display/Display.qml - ../locale/Language.qml - ../locale/RegionSelect.qml ../network/AddressListEntry.qml ../network/ComboBoxEntry.qml ../network/EditWiredSettings.qml @@ -18,24 +13,13 @@ ../network/WifiSettings.qml ../network/WifiSignalMonitor.qml ../network/WiredSettings.qml - ../timedate/AnalogClock.qml - ../timedate/ClockHand.qml - ../timedate/CustomCalendar.qml - ../timedate/TimeDate.qml - ../timedate/TimezonesView.qml settingsview.xml - ../power/Power.qml - ../timedate/ManualTime.qml - ../timedate/CustomComboBox.qml ../common/CustomSwitch.qml ../network/NetworkListView.qml ../network/PassphraseEnter.qml - ../locale/TableKey.qml - ../locale/TableValue.qml SettingsHeader.qml SettingsDelegate.qml SettingsTitleItem.qml - ShutdownPopup.qml icons/Alert_yellow_1x.png icons/Audio_qt_6x.png icons/Bluetooth_qt_1x.png @@ -67,21 +51,16 @@ icons/Chevron-left_black.png icons/Power_black_6x.png newIcons/back_icon.svg - newIcons/bluetooth_icon.svg newIcons/close_icon.svg - newIcons/date-time_icon.svg newIcons/detail_icon.svg - newIcons/display_icon.svg newIcons/grid_icon.svg newIcons/header_toggle_icon.svg newIcons/info_icon.svg - newIcons/language_icon.svg newIcons/mouse_icon.svg newIcons/mute_icon.svg newIcons/network_icon.svg newIcons/pause_icon.svg newIcons/play_icon.svg - newIcons/power_icon.svg newIcons/settings_icon.svg newIcons/settingsmenu_launcher_icon.svg newIcons/stop_icon.svg diff --git a/src/settingsui/settingsuiplugin/settingsview.xml b/src/settingsui/settingsuiplugin/settingsview.xml index 2749cb8..d7285ea 100644 --- a/src/settingsui/settingsuiplugin/settingsview.xml +++ b/src/settingsui/settingsuiplugin/settingsview.xml @@ -7,35 +7,5 @@ network newIcons/network_icon.svg - - Display - Display - display - newIcons/display_icon.svg - - - Date & Time - TimeDate - timedate - newIcons/date-time_icon.svg - - - Language & Region - Language - locale - newIcons/language_icon.svg - - - Bluetooth - Bluetooth - bluetooth - newIcons/bluetooth_icon.svg - - - Power - Power - power - newIcons/power_icon.svg - diff --git a/src/settingsui/timedate/AnalogClock.qml b/src/settingsui/timedate/AnalogClock.qml deleted file mode 100644 index e9c655e..0000000 --- a/src/settingsui/timedate/AnalogClock.qml +++ /dev/null @@ -1,172 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Controls 2.0 -import QtDeviceUtilities.TimeDateSettings 1.0 - -Item { - property var currentTime: TimeManager.time - property var newTime: new Date - property bool editMode: false - property alias handPressed: mouseArea.pressed - - onEditModeChanged: if (editMode) newTime = new Date - - Rectangle { - border.color: "#bdbebf" - border.width: 1 - color: "white" - anchors.fill: parent - - Connections { - target: TimeManager - function onTimeChanged() { if (!mouseArea.pressed) newTime.setSeconds(currentTime.getSeconds()) } - function onTimeZoneChanged() { Date.timeZoneUpdated() } - } - Label { - id: timeLabel - anchors.horizontalCenter: parent.horizontalCenter - anchors.topMargin: 10 - anchors.top: parent.top - text: currentTime.toTimeString() - } - Rectangle { - id: root - anchors.fill: parent - anchors.margins: 40 - color: "white" - border.color: editMode ? "#d6d6d6" : "#5caa15" - border.width: Math.round(root.width * 0.120) - radius: parent.width / 2 - property int handOffset: Math.round(root.width * 0.040) - antialiasing: true - - MouseArea { - id: mouseArea - anchors.fill: parent - enabled: editMode - property var handleItem: undefined - - function findHandle(item, point) { - if (item.objectName === "handle") { - var mapped = mouseArea.mapToItem(item, point.x, point.y) - if (item.contains(mapped)) { - return item.parent; - } - } - - for (var i=0; i < item.children.length; i++) { - var ret = findHandle(item.children[i], point) - if (ret) - return ret; - } - return undefined; - } - - onPressed: { - handleItem = findHandle(root, Qt.point(mouse.x, mouse.y)) - currentTime.setSeconds(0); - currentTime.setMilliseconds(0); - newTime.setSeconds(0); - newTime.setMilliseconds(0); - } - - onReleased: { - handleItem = undefined - } - - onPositionChanged: { - if (!handleItem) - return; - - var angle = (90 + Math.atan2((mouse.y-mouseArea.height/2), (mouse.x-mouseArea.width/2))*180/Math.PI) - - if (handleItem.angle < 60 && handleItem.angle > 0 && angle <= 0) { - - if (handleItem === hours) { - hours.pm = !hours.pm - } else { - var a = hours.angle - 30 - if (a > 360) a -= 360 - hours.angle = a - } - - } else if (handleItem.angle > 300 && handleItem.angle < 360 && angle >= 0) { - - if (handleItem === hours) { - hours.pm = !hours.pm - } else { - var a = hours.angle + 30 - if (a < 0) a += 360 - hours.angle = a - } - } - - if (angle < 0) { - angle += 360 - } else if (angle > 360) { - angle -= 360 - } - - handleItem.angle = angle - - var newhours = Math.floor(hours.angle / 30); - if (hours.pm) - newhours += 12 - - newTime.setHours(newhours); - newTime.setMinutes(Math.round(minutes.angle / 6)); - - newTime.setSeconds(0); - newTime.setMilliseconds(0); - - TimeManager.time = newTime; - } - } - ClockHand { - id: minutes - value: currentTime.getMinutes() * 6 - } - ClockHand { - id: hours - height: root.height / 2 * 0.4 + root.handOffset - value: (currentTime.getHours() * 30) + (currentTime.getMinutes() * 0.5) - property bool pm: false - } - ClockHand { - id: seconds - visible: !editMode - color: "#46a2da" - width: root.width * 0.0128 - height: root.height / 2 * 0.74 - value: currentTime.getSeconds() * 6 - } - } - } -} diff --git a/src/settingsui/timedate/ClockHand.qml b/src/settingsui/timedate/ClockHand.qml deleted file mode 100644 index 56fa314..0000000 --- a/src/settingsui/timedate/ClockHand.qml +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.6 - -Rectangle { - id: hand - objectName: "hand" - x: root.height / 2 - width / 2 - y: root.height / 2 - height + root.handOffset - color: editMode ? "#d6d6d6" : "#5caa15" - width: root.width * 0.080 - height: root.height / 2 * 0.65 + root.handOffset - antialiasing: true - property alias angle: handRotation.angle - property alias value: angleBinding.value - transform: Rotation { - id: handRotation - origin.x: Math.round(hand.width / 2) - origin.y: Math.round(hand.height - root.handOffset) - Behavior on angle { - enabled: !mouseArea.pressed - SpringAnimation { spring: 2; damping: 0.2; modulus: 360 } - } - - Binding on angle { - id: angleBinding - when: !mouseArea.pressed - } - } - Item { - objectName: "handle" - anchors.verticalCenter: parent.top - anchors.horizontalCenter: parent.horizontalCenter - height: parent.width * 3 - width: parent.width * 3 - visible: editMode - Rectangle { - anchors.fill: parent - anchors.margins: parent.width * .1 - radius: width / 2 - color: "#5caa15" - } - } -} diff --git a/src/settingsui/timedate/CustomCalendar.qml b/src/settingsui/timedate/CustomCalendar.qml deleted file mode 100644 index a1deff0..0000000 --- a/src/settingsui/timedate/CustomCalendar.qml +++ /dev/null @@ -1,216 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.0 -import Qt.labs.calendar 1.0 -import QtQml 2.2 -import QtDeviceUtilities.TimeDateSettings 1.0 - -Rectangle { - id: root - border.color: "#bdbebf" - border.width: 1 - color: "white" - height: cal.height - - function updateDate() { - var date = new Date() - grid.month = date.getMonth() - grid.date = date.getDate() - grid.year = date.getFullYear() - } - - ColumnLayout { - id: cal - width: root.width - spacing: 10 - enabled: !automatic.checked - - RowLayout { - spacing: 0 - Layout.alignment: Qt.AlignTop - - Button { - id: previousMonth - Layout.preferredWidth: height - visible: enabled - contentItem: Rectangle { - anchors.fill: parent - color: "#d6d6d6" - - Image { - anchors.fill: parent - anchors.margins: parent.height * .2 - source: "../icons/Chevron-left_black.png" - fillMode: Image.PreserveAspectFit - } - } - onClicked: { - if (grid.month === Calendar.January) { - grid.year-- - grid.month = Calendar.December - return; - } - grid.month-- - } - } - Rectangle { - Layout.fillWidth: true - color: enabled ? "#d6d6d6" : "#80c342" - height: previousMonth.height - - Label { - id: title - text: Qt.locale().monthName(grid.month, Locale.LongFormat) + " " + grid.year - anchors.fill: parent - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - } - Button { - id: nextMonth - Layout.preferredWidth: height - visible: enabled - contentItem: Rectangle { - anchors.fill: parent - color: "#d6d6d6" - - Image { - anchors.fill: parent - anchors.margins: parent.height * .2 - source: "../icons/Chevron-left_black.png" - mirror: true - fillMode: Image.PreserveAspectFit - } - } - onClicked: { - if (grid.month === Calendar.December) { - grid.year++ - grid.month = Calendar.January - } - grid.month++ - } - } - } - DayOfWeekRow { - locale: grid.locale - Layout.column: 1 - Layout.fillWidth: true - Layout.alignment: Qt.AlignTop - delegate: Text { - text: model.narrowName.charAt(0) - font.bold: true - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - } - MonthGrid { - id: grid - Layout.alignment: Qt.AlignTop - Layout.fillWidth: true - property int date: -1 - property Item currentItem: null - delegate: Label { - id: gridDelegate - objectName: "gridDelegate" - text: delegateDay - opacity: model.month === grid.month ? 1 : .2 - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - font.bold: delegateDay === grid.date && delegateMonth === grid.month - color: delegateDay === grid.date && delegateMonth === grid.month && enabled ? "white" : "black" - property int delegateDay: model.day - property int delegateMonth: model.month - } - Component.onCompleted: updateDate() - - Rectangle { - z: -1 - id: highlight - x: grid.currentItem ? grid.currentItem.x + grid.currentItem.width / 2 - width / 2: 0 - y: grid.currentItem ? grid.currentItem.y + grid.currentItem.height / 2- height / 2: 0 - width: grid.currentItem ? grid.currentItem.width : 0 - visible: grid.currentItem - height: width - color: enabled? "#80c342" : "#d6d6d6" - radius: width / 2 - } - - onMonthChanged: updateHighlightPosition() - onYearChanged: updateHighlightPosition() - onDateChanged: updateHighlightPosition() - - function updateHighlightPosition() { - var date = new Date() - - date.setFullYear(grid.year) - date.setMonth(grid.month) - date.setDate(grid.date) - - var index = grid.source.indexOf(date) - var delegate = grid.contentItem.children[index] - - if (delegate) - grid.currentItem = delegate - } - - MouseArea { - anchors.fill: parent - - onClicked: { - var item = grid.contentItem.childAt(mouse.x, mouse.y) - - if (item) { - if (item.objectName !== "gridDelegate") - item = grid.contentItem.children[0] - - if (!item) - return; - - grid.currentItem = item - grid.date = item.delegateDay - grid.month = item.delegateMonth - - var currentTime = TimeManager.time; - var newDate = new Date(); - - newDate.setFullYear(grid.year) - newDate.setMonth(grid.month) - newDate.setDate(grid.date) - newDate.setHours(currentTime.getHours()); - newDate.setMinutes(currentTime.getMinutes()); - newDate.setSeconds(currentTime.getSeconds()); - TimeManager.time = newDate; - } - } - } - } - } -} diff --git a/src/settingsui/timedate/CustomComboBox.qml b/src/settingsui/timedate/CustomComboBox.qml deleted file mode 100644 index 66c3559..0000000 --- a/src/settingsui/timedate/CustomComboBox.qml +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 -import QtQuick.Controls 2.0 -import QtGraphicalEffects 1.0 - -ComboBox { - id: comboBox - property int itemsVisible: 5 - indicator: Image { - id: indicatorImage - height: comboBox.height * 0.4 - anchors.right: comboBox.right - anchors.rightMargin: pluginMain.margin - anchors.verticalCenter: comboBox.verticalCenter - fillMode: Image.PreserveAspectFit - rotation: -90 - source: "../newIcons/back_icon.svg" - } - ColorOverlay { - id: indicatorOverlay - source: indicatorImage - anchors.fill: indicatorImage - color: viewSettings.buttonGreenColor - visible: false - rotation: -90 - } - contentItem: Text { - anchors.left: comboBox.left - anchors.leftMargin: pluginMain.margin - verticalAlignment: Text.AlignVCenter - font.pixelSize: pluginMain.valueFontSize - font.family: appFont - font.styleName: "SemiBold" - color: "white" - elide: Text.ElideRight - text: comboBox.displayText - } - background: Rectangle { - color: "transparent" - border.color: viewSettings.borderColor - border.width: comboBox.visualFocus ? 2 : 1 - } - popup: Popup { - y: comboBox.height -1 - width: comboBox.width - height: comboBox.height * comboBox.itemsVisible - padding: 1 - - contentItem: ListView { - id: listView - clip: true - model: comboBox.popup.visible ? comboBox.delegateModel : null - currentIndex: comboBox.currentIndex - onCurrentIndexChanged: positionViewAtIndex(listView.currentIndex, ListView.beginning) - } - onOpened: { - listView.currentIndex = comboBox.currentIndex - indicatorImage.visible = false - indicatorOverlay.visible = true - } - onClosed: { - indicatorImage.visible = true - indicatorOverlay.visible = false - } - background: Rectangle { - border.color: viewSettings.borderColor - color: viewSettings.backgroundColor - opacity: 0.95 - } - } -} diff --git a/src/settingsui/timedate/ManualTime.qml b/src/settingsui/timedate/ManualTime.qml deleted file mode 100644 index 87e0f7e..0000000 --- a/src/settingsui/timedate/ManualTime.qml +++ /dev/null @@ -1,248 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Controls 2.0 -import QtDeviceUtilities.QtButtonImageProvider 1.0 -import QtDeviceUtilities.TimeDateSettings 1.0 - -Item { - id: root - property int margin: root.width * 0.05 - property var selectedDate: new Date() - property int firstYear: 2017 - - function zeroPadTime(timeToPad) { - return timeToPad < 10 ? "0" + timeToPad : timeToPad - } - - Column { - spacing: pluginMain.spacing - - Text { - color: "white" - text: qsTr("Set Date") - font.pixelSize: pluginMain.subTitleFontSize - font.family: appFont - } - - // Row of date comboboxes - Row { - spacing: pluginMain.spacing - leftPadding: pluginMain.margin - - CustomComboBox { - id: dayBox - width: root.width * 0.15 - height: pluginMain.buttonHeight - displayText: currentIndex + 1 - - model: 31 - itemsVisible: 10 - currentIndex: selectedDate.getDate() - 1 - - delegate: ItemDelegate { - id: dayDelegate - height: dayBox.height - width: dayBox.width - contentItem: Text { - anchors.left: dayDelegate.left - anchors.leftMargin: pluginMain.margin - text: modelData + 1 - color: dayBox.currentIndex == index ? viewSettings.buttonGreenColor : "white" - elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter - font.pixelSize: pluginMain.valueFontSize - font.family: appFont - font.styleName: "Regular" - } - } - - onCurrentIndexChanged: selectedDate.setDate(currentIndex + 1) - } - - CustomComboBox { - id: monthBox - width: root.width * 0.35 - height: pluginMain.buttonHeight - model: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] - currentIndex: selectedDate.getMonth() - - itemsVisible: 12 - delegate: ItemDelegate { - id: monthDelegate - height: monthBox.height - width: monthBox.width - contentItem: Text { - anchors.left: monthDelegate.left - anchors.leftMargin: pluginMain.margin - color: monthBox.currentIndex == index ? viewSettings.buttonGreenColor : "white" - elide: Text.ElideRight - text: modelData - verticalAlignment: Text.AlignVCenter - font.pixelSize: pluginMain.valueFontSize - font.family: appFont - font.styleName: "Regular" - - } - } - onCurrentIndexChanged: selectedDate.setMonth(currentIndex) - } - - CustomComboBox { - id: yearBox - width: root.width * 0.2 - height: pluginMain.buttonHeight - displayText: currentIndex + firstYear - - model: 50 - itemsVisible: 8 - currentIndex: (selectedDate.getFullYear() >= firstYear) ? - selectedDate.getFullYear() - firstYear : 0 - - delegate: ItemDelegate { - id: yearDelegate - height: yearBox.height - width: yearBox.width - contentItem: Text { - anchors.left: yearDelegate.left - anchors.leftMargin: pluginMain.margin - text: index + firstYear - color: yearBox.currentIndex == index ? viewSettings.buttonGreenColor : "white" - elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter - font.pixelSize: pluginMain.valueFontSize - font.family: appFont - font.styleName: "Regular" - } - } - onCurrentIndexChanged: selectedDate.setFullYear(currentIndex + firstYear) - } - } // Row of date comboboxes - - Text { - color: "white" - text: qsTr("Set Time") - font.pixelSize: pluginMain.subTitleFontSize - font.family: appFont - } - - // Row of time comboboxes - Row { - spacing: pluginMain.spacing - leftPadding: pluginMain.margin - - CustomComboBox { - id: hourBox - width: root.width * 0.15 - height: pluginMain.buttonHeight - displayText: zeroPadTime(currentIndex) - - model: 24 - itemsVisible: 8 - currentIndex: selectedDate.getHours() - - delegate: ItemDelegate { - id: hourDelegate - height: hourBox.height - width: hourBox.width - contentItem: Text { - anchors.left: hourDelegate.left - anchors.leftMargin: pluginMain.margin - text: zeroPadTime(parseInt(modelData)) - color: hourBox.currentIndex == index ? viewSettings.buttonGreenColor : "white" - elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter - font.pixelSize: pluginMain.valueFontSize - font.family: appFont - font.styleName: "Regular" - } - } - onCurrentIndexChanged: selectedDate.setHours(currentIndex) - } - CustomComboBox { - id: minuteBox - width: root.width * 0.15 - height: pluginMain.buttonHeight - displayText: zeroPadTime(currentIndex) - - model: 60 - itemsVisible: 8 - currentIndex: selectedDate.getMinutes() - - delegate: ItemDelegate { - id: minuteDelegate - height: minuteBox.height - width: minuteBox.width - contentItem: Text { - anchors.left: minuteDelegate.left - anchors.leftMargin: pluginMain.margin - text: zeroPadTime(parseInt(modelData)) - color: minuteBox.currentIndex == index ? viewSettings.buttonGreenColor : "white" - elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter - font.pixelSize: pluginMain.valueFontSize - font.family: appFont - font.styleName: "Regular" - } - } - onCurrentIndexChanged: selectedDate.setMinutes(currentIndex) - } - } // Row of time comboboxes - - // Row of set/cancel buttons - Row { - spacing: pluginMain.spacing - - QtButton { - id: dateSetButton - height: pluginMain.buttonHeight - text: qsTr("SET") - - onClicked: { - selectedDate.setSeconds(0); - TimeManager.ntp = false - TimeManager.time = selectedDate; - console.log("Set date to: " + selectedDate) - console.log("TimeManager.time: " + TimeManager.time) - settingsLoader.source = "qrc:/timedate/TimeDate.qml" - } - } - QtButton { - id: dateCancelButton - height: pluginMain.buttonHeight - fillColor: viewSettings.buttonGrayColor - borderColor: "transparent" - text: qsTr("CANCEL") - onClicked: { - settingsLoader.source = "qrc:/timedate/TimeDate.qml" - } - } - } // Row of set/cancel buttons - } // Main column -} diff --git a/src/settingsui/timedate/TimeDate.qml b/src/settingsui/timedate/TimeDate.qml deleted file mode 100644 index f6f75f1..0000000 --- a/src/settingsui/timedate/TimeDate.qml +++ /dev/null @@ -1,162 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.0 -import QtDeviceUtilities.TimeDateSettings 1.0 -import QtDeviceUtilities.LocaleSettings 1.0 -import QtDeviceUtilities.QtButtonImageProvider 1.0 - -Item { - id: root - property int margin: root.width * 0.05 - - Column { - spacing: pluginMain.spacing - anchors.top: parent.top - - // Display current date - Text { - color: "white" - text: qsTr("Current date") - font.pixelSize: pluginMain.subTitleFontSize - font.family: appFont - } - - Text { - id: dateText - leftPadding: pluginMain.margin - color: "white" - font.pixelSize: pluginMain.valueFontSize - font.family: appFont - Timer { - id: dateTimer - interval: 1000 - running: true - repeat: true - triggeredOnStart: true - onTriggered: { - var date = new Date(); - dateText.text = date.toLocaleString(Qt.locale(LocaleManager.locale), Locale.LongFormat) - } - } - } - - // Set date automatically / manually - Text { - color: "white" - text: qsTr("Set Date & Time") - font.pixelSize: pluginMain.subTitleFontSize - font.family: appFont - } - - Row { - spacing: pluginMain.spacing - leftPadding: pluginMain.margin - QtButton { - id: automaticButton - height: pluginMain.buttonHeight - text: qsTr("AUTOMATICALLY") - onClicked: TimeManager.ntp = true - } - QtButton { - id: manualButton - height: pluginMain.buttonHeight - fillColor: viewSettings.buttonGrayColor - borderColor: "transparent" - text: qsTr("MANUALLY") - onClicked: { - settingsLoader.source = "qrc:/timedate/ManualTime.qml" - } - } - } - - // Select timezone - Text { - color: "white" - text: qsTr("Time Zone") - font.pixelSize: pluginMain.subTitleFontSize - font.family: appFont - } - - Row { - leftPadding: pluginMain.margin - CustomComboBox { - id: timeZoneBox - width: automaticButton.width + manualButton.width + pluginMain.spacing - height: pluginMain.buttonHeight - textRole: "id" - itemsVisible: 7 - currentIndex: -1 - model: TimezonesFilter - delegate: ItemDelegate { - id: timeZoneDelegate - height: timeZoneBox.height - width: timeZoneBox.width - contentItem: Text { - anchors.left: timeZoneDelegate.left - anchors.leftMargin: pluginMain.margin - text: modelData["id"] - color: timeZoneBox.currentIndex == index ? viewSettings.buttonGreenColor : "white" - elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter - font.pixelSize: pluginMain.valueFontSize - font.family: appFont - font.styleName: "Regular" - } - } - - Component.onCompleted: { - var n = TimezonesFilter.indexForTimezone(TimeManager.timeZone) - timeZoneBox.currentIndex = n - } - - Connections { - target: TimezonesFilter.sourceModel - function onReady() { - var n = TimezonesFilter.indexForTimezone(TimeManager.timeZone) - timeZoneBox.currentIndex = n - } - } - - onCurrentIndexChanged: { - var val = TimezonesFilter.itemFromRow(currentIndex); - if (val && val !== "") { - TimeManager.timeZone = val - } - } - } - } - - Component { - id: zoneselect - TimezonesView {} - } - } -} diff --git a/src/settingsui/timedate/TimezonesView.qml b/src/settingsui/timedate/TimezonesView.qml deleted file mode 100644 index bbcffe4..0000000 --- a/src/settingsui/timedate/TimezonesView.qml +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.0 -import QtDeviceUtilities.TimeDateSettings 1.0 -import "../common" -Item { - id: root - property string title: qsTr("Timezone settings") - Component.onCompleted: timezone.text = TimezonesFilter.filter - - ColumnLayout { - id: content - anchors.fill: parent - anchors.margins: 20 - spacing: 10 - - RowLayout { - spacing: 10 - - Label { - text: qsTr("Search area: ") - Layout.alignment: Qt.AlignVCenter - } - TextField { - id: timezone - text: "" - onTextChanged: TimezonesFilter.filter = timezone.text - Layout.alignment: Qt.AlignVCenter - } - } - CustomTableView { - headerTexts: [qsTr("Timezone"), qsTr("Country")] - roleNames: ["id", "country"] - model: TimezonesFilter - onClicked: { - var val = model.itemFromRow(index); - if (val !== "") { - TimeManager.timeZone = val; - stackView.pop(); - } - } - } - } -} diff --git a/src/src.pro b/src/src.pro index 014e517..1765381 100644 --- a/src/src.pro +++ b/src/src.pro @@ -4,15 +4,10 @@ CONFIG += ordered qtHaveModule(dbus) { SUBDIRS += \ networksettings \ - localesettings \ - timedatesettings \ - qtHaveModule(bluetooth): SUBDIRS += bluetoothsettings } SUBDIRS += \ - displaysettings \ - localdevice \ settingsui/settingsuiplugin \ settingsui/qtbuttonimageproviderplugin \ settingsui \ diff --git a/src/timedatesettings/systemtime.cpp b/src/timedatesettings/systemtime.cpp deleted file mode 100644 index 9382fd9..0000000 --- a/src/timedatesettings/systemtime.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "systemtime.h" -#include "systemtime_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \module QtTimeDateSettings - \qtvariable timedatesettings - \ingroup qtdevice-utilities-cpp-modules - \ingroup modules - \title Qt Time and Date Settings C++ Classes - \brief Provides functionality for controlling time and date settings. - - To use classes from this module, add this directive into the C++ files: - - \code - #include - \endcode - - To link against the corresponding C++ libraries, add the following to your - qmake project file: - - \code - QT += timedatesettings - \endcode -*/ - -/*! - \class SystemTime - \inmodule QtTimeDateSettings - \inheaderfile systemtime.h - \brief The SystemTime class manages the system date and time. -*/ - -/*! - \property SystemTime::timeZone - \brief Holds the current time zone string. -*/ - -/*! - \property SystemTime::ntp - - Holds whether the system time is synchronized using NTP (Network - Time Protocol). -*/ - -/*! - \property SystemTime::time - \brief Holds the current date and time. -*/ - -SystemTime::SystemTime(QObject *parent) : - QObject(parent) - ,d_ptr(new SystemTimePrivate(this)) -{ - QTimer *secTimer = new QTimer(this); - connect(secTimer, &QTimer::timeout, this, &SystemTime::timeChanged); - secTimer->setInterval(1001); - secTimer->setSingleShot(false); - secTimer->start(); -} - -bool SystemTime::ntp() const -{ - const Q_D(SystemTime); - return d->ntp(); -} - -void SystemTime::setNtp(const bool aNtp) -{ - Q_D(SystemTime); - d->setNtp(aNtp); -} - -void SystemTime::setTime(const QDateTime& aTime) -{ - Q_D(SystemTime); - d->setTime(aTime.toMSecsSinceEpoch()*1000); - emit timeChanged(); -} - -QString SystemTime::timeZone() const -{ - Q_D(const SystemTime); - return d->timeZone(); -} - -void SystemTime::setTimeZone(const QString& aTimeZone) -{ - Q_D(SystemTime); - d->setTimeZone(aTimeZone); - emit timeZoneChanged(); -} - -QDateTime SystemTime::time() const -{ - return QDateTime::currentDateTime(); -} - -QT_END_NAMESPACE diff --git a/src/timedatesettings/systemtime.h b/src/timedatesettings/systemtime.h deleted file mode 100644 index bcb46df..0000000 --- a/src/timedatesettings/systemtime.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef SYSTEMTIME_H -#define SYSTEMTIME_H - -#include -#include - -QT_BEGIN_NAMESPACE - -class SystemTimePrivate; - -class Q_DECL_EXPORT SystemTime : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString timeZone READ timeZone WRITE setTimeZone NOTIFY timeZoneChanged) - Q_PROPERTY(bool ntp READ ntp WRITE setNtp NOTIFY ntpChanged) - Q_PROPERTY(QDateTime time READ time WRITE setTime NOTIFY timeChanged) -public: - explicit SystemTime(QObject *parent = Q_NULLPTR); - bool ntp() const; - void setNtp(const bool aNtp); - void setTime(const QDateTime& aTime); - QString timeZone() const; - QDateTime time() const; - void setTimeZone(const QString& aTimeZone); - -Q_SIGNALS: - void timeZoneChanged(); - void ntpChanged(); - void timeChanged(); - -public Q_SLOTS: - -protected: - SystemTimePrivate *d_ptr; - - Q_DISABLE_COPY(SystemTime) - Q_DECLARE_PRIVATE(SystemTime) -}; - -QT_END_NAMESPACE - -#endif // SYSTEMTIME_H diff --git a/src/timedatesettings/systemtime_p.h b/src/timedatesettings/systemtime_p.h deleted file mode 100644 index b294598..0000000 --- a/src/timedatesettings/systemtime_p.h +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef SYSTEMTIME_P_H -#define SYSTEMTIME_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "systemtime.h" -#include "timedated_interface.h" - -QT_BEGIN_NAMESPACE - -class SystemTimePrivate -{ - Q_DECLARE_PUBLIC(SystemTime) -public: - SystemTimePrivate(SystemTime *qq) - :q_ptr(qq) - { - m_timeInterface = new OrgFreedesktopTimedate1Interface(QStringLiteral("org.freedesktop.timedate1"), - QStringLiteral("/org/freedesktop/timedate1"), - QDBusConnection::systemBus(), qq); - - } - - bool ntp() const { - if (m_timeInterface) - return m_timeInterface->nTP(); - return false; - } - - void setNtp(bool val) { - if (m_timeInterface) - m_timeInterface->SetNTP(val, true).waitForFinished(); - } - - QString timeZone() const { - if (m_timeInterface) - return m_timeInterface->timezone(); - return QString(); - } - - void setTimeZone(const QString& aTimeZone) { - if (m_timeInterface) - m_timeInterface->SetTimezone(aTimeZone, true); - } - - void setTime(qlonglong usecsSinceEpoch) { - if (m_timeInterface) - m_timeInterface->SetTime(usecsSinceEpoch, false, true); - } - -private: - OrgFreedesktopTimedate1Interface *m_timeInterface; - SystemTime *q_ptr; -}; - -QT_END_NAMESPACE - -#endif // SYSTEMTIME_P_H diff --git a/src/timedatesettings/timedated.xml b/src/timedatesettings/timedated.xml deleted file mode 100644 index 95bafb8..0000000 --- a/src/timedatesettings/timedated.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/timedatesettings/timedatesettings.pro b/src/timedatesettings/timedatesettings.pro deleted file mode 100644 index 6c35777..0000000 --- a/src/timedatesettings/timedatesettings.pro +++ /dev/null @@ -1,22 +0,0 @@ -load(qt_build_config) - -TARGET = QtTimeDateSettings -VERSION = 1.0 - -QT = core dbus - -MODULE = timedatesettings -load(qt_module) - -DBUS_INTERFACES = timedated.xml - -SOURCES += systemtime.cpp \ - timezonemodel.cpp \ - timezonefiltermodel.cpp - -HEADERS += \ - systemtime.h \ - systemtime_p.h \ - timezonemodel.h \ - timezonefiltermodel.h - diff --git a/src/timedatesettings/timezonefiltermodel.cpp b/src/timedatesettings/timezonefiltermodel.cpp deleted file mode 100644 index b566624..0000000 --- a/src/timedatesettings/timezonefiltermodel.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "timezonemodel.h" -#include "timezonefiltermodel.h" - -QT_BEGIN_NAMESPACE - -TimezoneFilterModel::TimezoneFilterModel(QObject* parent) - :QSortFilterProxyModel(parent) -{ - connect(this, &TimezoneFilterModel::filterChanged, this, &TimezoneFilterModel::invalidate); - TimezoneModel* timezoneModel = new TimezoneModel(this); - setSourceModel(timezoneModel); -} - -TimezoneFilterModel::~TimezoneFilterModel() -{ - -} - -QString TimezoneFilterModel::filter() const -{ - return m_filter; -} - -void TimezoneFilterModel::setFilter(const QString& aFilter) -{ - m_filter = aFilter; - emit filterChanged(); -} - -bool TimezoneFilterModel::filterAcceptsRow( int source_row, const QModelIndex& source_parent ) const -{ - bool ret = false; - if (this->sourceModel()) - { - QModelIndex index = this->sourceModel()->index( source_row, 0, source_parent ); - if (index.isValid()) - { - QVariant nameRole = index.data(TimezoneModel::Name); - if (nameRole.isValid()) - { - QString name = nameRole.toString(); - if (name.contains(m_filter, Qt::CaseInsensitive)) { - ret = true; - } - } - QVariant countryRole = index.data(TimezoneModel::Country); - if (ret == false && countryRole.isValid()) - { - QString country = countryRole.toString(); - if (country.contains(m_filter, Qt::CaseInsensitive)) { - ret = true; - } - } - } - } - return ret; -} - -QVariant TimezoneFilterModel::itemFromRow(const int row) const -{ - QModelIndex idx = index(row, 0); - QModelIndex mapped = mapToSource(idx); - if (mapped.isValid()) - { - QVariant nameRole = mapped.data(TimezoneModel::Name); - if (nameRole.isValid()) - { - return nameRole; - } - } - return QVariant(); -} - -int TimezoneFilterModel::indexForTimezone(const QString &timezone) const -{ - TimezoneModel *model = qobject_cast(sourceModel()); - QList data = model->getModel(); - int row = 0; - foreach (TimezoneItem *item, data) { - if (item->id() == timezone) { - QModelIndex mapped = mapFromSource(model->index(row)); - return mapped.row(); - } - row++; - } - - return -1; -} - -QT_END_NAMESPACE diff --git a/src/timedatesettings/timezonefiltermodel.h b/src/timedatesettings/timezonefiltermodel.h deleted file mode 100644 index ead5eb0..0000000 --- a/src/timedatesettings/timezonefiltermodel.h +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef TIMEZONEFILTERMODEL_H -#define TIMEZONEFILTERMODEL_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -QT_BEGIN_NAMESPACE - -class Q_DECL_EXPORT TimezoneFilterModel : public QSortFilterProxyModel -{ - Q_OBJECT - Q_PROPERTY(QString filter READ filter WRITE setFilter NOTIFY filterChanged) -public: - explicit TimezoneFilterModel(QObject* parent); - virtual ~TimezoneFilterModel(); - bool filterAcceptsRow( int source_row, const QModelIndex& source_parent ) const override; - QString filter() const; - void setFilter(const QString& aFilter); - Q_INVOKABLE QVariant itemFromRow(const int row) const; - Q_INVOKABLE int indexForTimezone(const QString &timezone) const; -Q_SIGNALS: - void filterChanged(); - void selectedIndexChanged(); -private: - QString m_filter; - -}; - -QT_END_NAMESPACE - -#endif // TIMEZONEFILTERMODEL_H diff --git a/src/timedatesettings/timezonemodel.cpp b/src/timedatesettings/timezonemodel.cpp deleted file mode 100644 index d30f22e..0000000 --- a/src/timedatesettings/timezonemodel.cpp +++ /dev/null @@ -1,244 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include -#include -#include -#include -#include "timezonemodel.h" - -QT_BEGIN_NAMESPACE - -/*! - \class TimezoneItem - \inmodule QtTimeDateSettings - \inheaderfile timezonemodel.h - \brief The TimezoneItem class represents a time zone. -*/ - -/*! - \property TimezoneItem::id - \brief Holds the IANA time zone ID. - - \sa QTimeZone::id(), {IANA Time Zone IDs} -*/ - -/*! - \property TimezoneItem::name - \brief Holds the localized display name of the time zone. - - \sa QTimeZone::displayName() -*/ - -/*! - \property TimezoneItem::country - \brief Holds the name of the country for the time zone. - - \sa QTimeZone::country() -*/ - -/*! - Creates a time zone item with the IANA time zone ID \a id and parent - \a parent. -*/ -TimezoneItem::TimezoneItem(const QByteArray& id, QObject *parent) - :QObject(parent) -{ - QTimeZone tz = QTimeZone(id); - m_name = tz.displayName(QTimeZone::StandardTime); - m_country = QLocale::countryToString(tz.country()); - m_id = QString::fromUtf8(id); -} - -/*! - Returns the localized display name of the time zone. - - \sa QTimeZone::displayName() -*/ -QString TimezoneItem::name() const -{ - return m_name; -} - -/*! - Returns the name of the country for the time zone. - - \sa QTimeZone::country() -*/ -QString TimezoneItem::country() const -{ - return m_country; -} - -/*! - Returns the IANA time zone ID. - - \sa QTimeZone::id(), {IANA Time Zone IDs} -*/ -QString TimezoneItem::id() const -{ - return m_id; -} - -/*! - \class TimezoneModel - \inmodule QtTimeDateSettings - \inheaderfile timezonemodel.h - \brief The TimezoneModel class provides a model for the available time - zones. - - This class can be used as the model in a view that lists the available time - zones. -*/ - -/*! - \enum TimezoneModel::Roles - - This enum type holds information about a time zone. - - \value Name - Localized display name of the time zone - \value Country - Name of the country for the time zone - \value Id - IANA time zone ID -*/ - -/*! - \fn QList TimezoneModel::getModel() const - - Returns the time zone model for a time zone item. -*/ - -/*! - \fn TimezoneModel::ready() - - This signal is emitted when the model is ready. -*/ - -/*! - Creates a new time zone model with the parent \a parent. -*/ -TimezoneModel::TimezoneModel(QObject *parent) - : QAbstractListModel(parent) -{ - m_roleNames.insert(Qt::UserRole, "modelData"); - m_roleNames.insert(Country, "country"); - m_roleNames.insert(Name, "name"); - m_roleNames.insert(Id, "id"); - - - QFutureWatcher *watcher = new QFutureWatcher(this); - QFuture future = QtConcurrent::run(TimezoneModel::generateModel, this); - watcher->setFuture(future); - connect(watcher, SIGNAL(finished()), this, SIGNAL(ready())); -} - -/*! - Creates the time zone model \a model. -*/ -void TimezoneModel::generateModel(TimezoneModel* model) -{ - QList ids = QTimeZone::availableTimeZoneIds(); - foreach (QByteArray id, ids) { - TimezoneItem *zone = new TimezoneItem(id); - zone->moveToThread(model->thread()); - QMetaObject::invokeMethod(model, "addNewItem", Q_ARG( QObject*, qobject_cast(zone))); - } -} - -/*! - Adds the time zone item \a item to the time zone model. -*/ -void TimezoneModel::addNewItem(QObject* item) -{ - beginInsertRows(QModelIndex(), m_items.count(), m_items.count()); - TimezoneItem* newItem = qobject_cast(item); - if (newItem) - m_items.append(newItem); - endInsertRows(); -} - -/*! - Deletes the time zone model. -*/ -TimezoneModel::~TimezoneModel() -{ - qDeleteAll(m_items); -} - -/*! - Returns an array of the names of the roles in the model. -*/ -QHash TimezoneModel::roleNames() const -{ - return m_roleNames; -} - -/*! - Returns the number of rows in the model with the parent \a parent. -*/ -int TimezoneModel::rowCount(const QModelIndex & parent) const -{ - Q_UNUSED(parent); - return m_items.count(); -} - -/*! - Returns the data at the index \a index in the model for the type of data - specified by \a role. -*/ -QVariant TimezoneModel::data(const QModelIndex & index, int role) const -{ - if (!index.isValid()) return QVariant(); - - TimezoneItem *item = m_items[index.row()]; - - switch (role) { - case Qt::UserRole: - return QVariant::fromValue(static_cast(item)); - break; - case Name: - return item->id(); - break; - case Country: - return item->country(); - break; - case Id: - return item->id(); - break; - case Qt::DisplayRole: - return item->id(); - break; - default: - return QVariant(); - } -} - -QT_END_NAMESPACE diff --git a/src/timedatesettings/timezonemodel.h b/src/timedatesettings/timezonemodel.h deleted file mode 100644 index 6684472..0000000 --- a/src/timedatesettings/timezonemodel.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef TIMEZONEMODEL_H -#define TIMEZONEMODEL_H - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class TimezoneItem : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString id READ id CONSTANT) - Q_PROPERTY(QString name READ name CONSTANT) - Q_PROPERTY(QString country READ country CONSTANT) -public: - explicit TimezoneItem(const QByteArray& id, QObject *parent = Q_NULLPTR); - QString name() const; - QString country() const; - QString id() const; - -private: - QString m_name; - QString m_country; - QString m_id; -}; - -class Q_DECL_EXPORT TimezoneModel : public QAbstractListModel -{ - Q_OBJECT - -public: - explicit TimezoneModel(QObject *parent = Q_NULLPTR); - virtual ~TimezoneModel(); - // from QAbstractItemModel - int rowCount(const QModelIndex & parent = QModelIndex()) const; - QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const; - QHash roleNames() const; - QList getModel() const - { - return m_items; - } - - enum Roles { - Name = Qt::UserRole + 1, - Country, - Id - }; - - static void generateModel(TimezoneModel* model); - -Q_SIGNALS: - void ready(); - -private Q_SLOTS: - void addNewItem(QObject* item); - -private: - QList m_items; - QHash m_roleNames; -}; - -QT_END_NAMESPACE - -#endif // TIMEZONEMODEL_H diff --git a/sync.profile b/sync.profile index 9e75dde..ab04eaf 100644 --- a/sync.profile +++ b/sync.profile @@ -1,10 +1,5 @@ %modules = ( # path to module name map - "QtNetworkSettings" => "$basedir/src/networksettings", - "QtBluetoothSettings" => "$basedir/src/bluetoothsettings", - "QtLocaleSettings" => "$basedir/src/localesettings", - "QtTimeDateSettings" => "$basedir/src/timedatesettings", - "QtDisplaySettings" => "$basedir/src/displaysettings", - "QtLocalDevice" => "$basedir/src/localdevice" + "QtNetworkSettings" => "$basedir/src/networksettings" ); %moduleheaders = ( # restrict the module headers to those found in relative path ); -- cgit v1.2.3