summaryrefslogtreecommitdiffstats
path: root/src/qtdevicesettings/timedateplugin
diff options
context:
space:
mode:
Diffstat (limited to 'src/qtdevicesettings/timedateplugin')
-rw-r--r--src/qtdevicesettings/timedateplugin/AnalogClock.qml255
-rw-r--r--src/qtdevicesettings/timedateplugin/TimeDate.qml167
-rw-r--r--src/qtdevicesettings/timedateplugin/TimezonesView.qml94
-rw-r--r--src/qtdevicesettings/timedateplugin/icons.qrc4
-rw-r--r--src/qtdevicesettings/timedateplugin/plugin.cpp77
-rw-r--r--src/qtdevicesettings/timedateplugin/qml.qrc7
-rw-r--r--src/qtdevicesettings/timedateplugin/qmldir3
-rw-r--r--src/qtdevicesettings/timedateplugin/systemtime.cpp85
-rw-r--r--src/qtdevicesettings/timedateplugin/systemtime.h73
-rw-r--r--src/qtdevicesettings/timedateplugin/systemtime_p.h88
-rw-r--r--src/qtdevicesettings/timedateplugin/timedated.xml30
-rw-r--r--src/qtdevicesettings/timedateplugin/timedateplugin.pro42
-rw-r--r--src/qtdevicesettings/timedateplugin/timezonefiltermodel.cpp104
-rw-r--r--src/qtdevicesettings/timedateplugin/timezonefiltermodel.h59
-rw-r--r--src/qtdevicesettings/timedateplugin/timezonemodel.cpp140
-rw-r--r--src/qtdevicesettings/timedateplugin/timezonemodel.h89
16 files changed, 0 insertions, 1317 deletions
diff --git a/src/qtdevicesettings/timedateplugin/AnalogClock.qml b/src/qtdevicesettings/timedateplugin/AnalogClock.qml
deleted file mode 100644
index 2b89401..0000000
--- a/src/qtdevicesettings/timedateplugin/AnalogClock.qml
+++ /dev/null
@@ -1,255 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Device Utilities module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-import QtQuick 2.5
-import com.theqtcompany.settings.common 1.0
-import com.theqtcompany.settings.timedate 1.0
-
-Item {
- property var currentTime: TimeManager.time
- property var newTime: new Date
- property bool editMode: false
-
- function showTime(time) {
- return time.getHours() + ":" + time.getMinutes()
- }
-
- onEditModeChanged: if (editMode) newTime = new Date
-
- Rectangle {
- border.color: "#bdbebf"
- border.width: 1
- color: "white"
- anchors.fill: parent
-
- Connections {
- target: TimeManager
- onTimeChanged : newTime.setSeconds(currentTime.getSeconds())
- onTimeZoneChanged : Date.timeZoneUpdated()
- }
-
- TextLabel {
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.topMargin: 10
- anchors.top: parent.top
- text: editMode ? newTime.toTimeString() : currentTime.toTimeString()
- }
-
- Rectangle {
- id: root
- anchors.fill: parent
- anchors.margins: Math.round(40 * Flat.FlatStyle.scaleFactor)
- 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
-
- Rectangle {
- id: minutes
- x: root.height / 2 - width / 2
- y: root.height / 2 - height + root.handOffset
- color: editMode ? "#d6d6d6" : "#5caa15"
- width: Math.round(root.width * 0.080)
- height: Math.round(root.height / 2 * 0.65 + root.handOffset)
- antialiasing: true
- transform: Rotation {
- id: minuteRotation
- origin.x: Math.round(minutes.width / 2)
- origin.y: Math.round(minutes.height - root.handOffset)
- angle: currentTime.getMinutes() * 6
- Behavior on angle {
- SpringAnimation { spring: 2; damping: 0.2; modulus: 360 }
- }
- }
- }
-
- Rectangle {
- id: hours
- x: Math.round(root.height / 2 - width / 2)
- y: Math.round(root.height / 2 - height + root.handOffset)
- height: Math.round(root.height / 2 * 0.4 + root.handOffset)
- width: Math.round(root.width * 0.080)
- color: editMode ? "#d6d6d6" : "#80c342"
- antialiasing: true
- transform: Rotation {
- id: hourRotation
- origin.x: Math.round(hours.width / 2)
- origin.y: hours.height - root.handOffset;
- angle: (currentTime.getHours() * 30) + (currentTime.getMinutes() * 0.5)
- Behavior on angle {
- SpringAnimation { spring: 2; damping: 0.2; modulus: 360 }
- }
- }
- }
-
- Rectangle {
- id: seconds
- x: root.height / 2 - width / 2
- y: root.height / 2 - height + root.handOffset
- visible: !editMode
- color: "#46a2da"
- width: Math.round(root.width * 0.0128)
- height: Math.round(root.height / 2 * 0.74)
- radius: Math.round(width / 2)
- antialiasing: true
- transform: Rotation {
- id: secondRotation
- origin.x: Math.round(seconds.width / 2)
- origin.y: Math.round(seconds.height - root.handOffset)
- angle: currentTime.getSeconds() * 6
- Behavior on angle {
- SpringAnimation { spring: 2; damping: 0.2; modulus: 360 }
- }
- }
- }
-
- Component {
- id: editor
-
- Rectangle {
- id: rect
- property var angle: mouseArea.drag ? mouseArea.angle : defaultAngle
- property var defaultAngle: angleBinding
- x: Math.round(Math.cos((-90+ angle)*Math.PI/180) *
- (pos - root.handOffset - width /2 + radius) + root.width / 2 - width / 2)
- y: Math.round(Math.sin((-90+ angle)*Math.PI/180) *
- (pos - root.handOffset - width /2 + radius) + root.height / 2 - width / 2)
- color: "#5caa15"
- width: size
- radius: width / 2
- height: width
- antialiasing: true
-
- function calcAngle(mouse) {
- var mouseGlobal = mapToItem(root, mouse.x, mouse.y)
- var origin = root.width/2
- var angle = (90+Math.atan2((mouseGlobal.y-origin), (mouseGlobal.x-origin))*180/Math.PI)
- if (angle < 0)
- angle += 360;
- updateAngle(angle);
- return angle;
- }
-
- MouseArea {
- id: mouseArea
- anchors.fill: parent
- property int startX: 0
- property int startY: 0
- property bool drag: false
- property var angle: 0.0
- preventStealing: true
-
- onPressed: {
- var mouseGlobal = mapToItem(root, mouse.x, mouse.y);
- startX = mouseGlobal.x;
- startY = mouseGlobal.y;
- angle = calcAngle(mouse);
- drag = true;
- }
- onReleased: {
- drag = false;
- ready(angle)
- }
- onMouseXChanged: if (drag) angle = calcAngle(mouse)
- }
- }
- }
-
- Loader {
- property var angleBinding: (currentTime.getHours() * 30) + (currentTime.getMinutes() * 0.5)
- property int size: Math.round(root.width * 0.120)
- property int pos: hours.height
- property bool pm: false
- visible: editMode
-
- function updateAngle(angle) {
- var newHour = Math.floor(angle / 30);
- var preHour = newTime.getHours();
-
- if (preHour == 11 && newHour == 0) {
- newHour = 12;
- pm = true;
- }
- else if (preHour === 23 && newHour === 0) {
- pm = false;
- }
- else if (preHour == 0 && newHour === 11) {
- pm = true;
- }
- else if (preHour == 12 && newHour == 11) {
- pm = false;
- }
-
- if (pm == true) {
- newHour += 12;
- }
-
- newTime.setHours(newHour);
- }
-
- function ready(val) {
- var newhours = Math.round(val / 30);
- currentTime.setHours(newhours);
- TimeManager.time = currentTime;
- }
- sourceComponent: editor
- }
-
- Loader {
- property var angleBinding: currentTime.getMinutes() * 6
- property int size: Math.round(root.width * 0.120)
- property int pos: minutes.height
- visible: editMode
- sourceComponent: editor
-
- function updateAngle(angle) {
- var newMin = Math.round(angle / 6);
- var hours = newTime.getHours();
- newTime.setMinutes(newMin);
- newTime.setHours(hours);
- }
-
- function ready(val) {
- var newmins = Math.round(val / 6);
- currentTime.setMinutes(newmins);
- TimeManager.time = currentTime;
- }
- }
- }
- }
-}
-
diff --git a/src/qtdevicesettings/timedateplugin/TimeDate.qml b/src/qtdevicesettings/timedateplugin/TimeDate.qml
deleted file mode 100644
index 6731805..0000000
--- a/src/qtdevicesettings/timedateplugin/TimeDate.qml
+++ /dev/null
@@ -1,167 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Device Utilities module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-import QtQuick 2.5
-import QtQuick.Layouts 1.1
-import QtQuick.Controls 1.4
-import QtQuick.Controls.Styles.Flat 1.0 as Flat
-import com.theqtcompany.settings.common 1.0
-import com.theqtcompany.settings.timedate 1.0
-
-Item {
- id: root
- property string title: qsTr("Time and Date settings")
-
- Flickable {
- anchors.fill: parent
- anchors.margins: Math.round(40 * Flat.FlatStyle.scaleFactor)
- anchors.bottomMargin: Math.round(20 * Flat.FlatStyle.scaleFactor)
- contentHeight: content.height
- contentWidth: width
-
- Column {
- id: content
- width: parent.width
-
- GroupBox {
- width: parent.width
- title: qsTr("Time Settings")
- Layout.fillWidth: true
-
- ColumnLayout {
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
- width: parent.width
- Layout.fillWidth: true
-
- ExclusiveGroup { id: exgroup }
-
- RadioButton {
- id: automatic
- text: qsTr("Automatic time set")
- exclusiveGroup: exgroup
- checked: TimeManager.ntp
- onCheckedChanged: if (checked) calloader.reload();
- }
- RadioButton {
- id: custom
- text: qsTr("Manual")
- exclusiveGroup: exgroup
- checked: !TimeManager.ntp
- onCheckedChanged: TimeManager.ntp = !checked
- }
- RowLayout {
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
- Layout.fillWidth: true
-
- Component {
- id: calendar
-
- Item {
- width: cal.width
- height: cal.height
-
- Timer {
- id: timer
- }
- function delay(delayTime, cb) {
- timer.interval = delayTime;
- timer.repeat = false;
- timer.triggered.connect(cb);
- timer.start();
- }
-
- Calendar {
- id: cal
- weekNumbersVisible: false
- enabled: !automatic.checked
- onClicked: {
- var currentTime = TimeManager.time;
- var newDate = date;
- newDate.setHours(currentTime.getHours());
- newDate.setMinutes(currentTime.getMinutes());
- newDate.setSeconds(currentTime.getSeconds());
- TimeManager.time = newDate;
- delay(100, function() {
- calloader.reload();
- });
- }
- }
- }
- }
-
- Loader {
- id: calloader
- sourceComponent: calendar
- function reload() {
- calloader.sourceComponent = undefined;
- calloader.sourceComponent = calendar;
- }
- }
-
- AnalogClock {
- id: clock
- width: calloader.width
- height: width
- editMode: !automatic.checked
- }
- }
-
- Component {
- id: zoneselect
- TimezonesView { }
- }
-
- GroupBox {
- title: qsTr("Timezone Settings")
- Layout.fillWidth: true
- width: parent.width
- visible: true
- flat: true
- Row {
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
- TextLabel {
- text: TimeManager.timeZone
- }
- Button {
- text: "Change"
- onClicked : stackView.push(zoneselect)
- }
- }
- }
- }
- }
- }
- }
-}
diff --git a/src/qtdevicesettings/timedateplugin/TimezonesView.qml b/src/qtdevicesettings/timedateplugin/TimezonesView.qml
deleted file mode 100644
index 458d611..0000000
--- a/src/qtdevicesettings/timedateplugin/TimezonesView.qml
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Device Utilities module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-import QtQuick 2.5
-import QtQuick.Layouts 1.1
-import QtQuick.Controls 1.4
-import QtQuick.Controls.Styles.Flat 1.0 as Flat
-import com.theqtcompany.settings.common 1.0
-import com.theqtcompany.settings.timedate 1.0
-
-
-Item {
- id: root
- Component.onCompleted: timezone.text = TimezonesFilter.filter
-
- Column {
- id: content
- anchors.fill: parent
- anchors.margins: Math.round(20 * Flat.FlatStyle.scaleFactor)
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
- Row {
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
-
- TextLabel {
- text: qsTr("Search area: ")
- }
-
- TextField {
- id: timezone
- text: ""
- onTextChanged: TimezonesFilter.filter = timezone.text
- }
- }
-
- TableView {
- width: parent.width
- height: Math.round(parent.height - 40 * Flat.FlatStyle.scaleFactor)
- Layout.fillWidth: true
- model: TimezonesFilter
- headerVisible: true
-
- TableViewColumn {
- role: "name"
- title: qsTr("Timezone")
- width: Math.round(parent.width * 0.66)
- }
- TableViewColumn {
- role: "country"
- title: qsTr("Country")
- width: Math.round(parent.width * 0.33)
- }
-
- onClicked: {
- var val = model.itemFromRow(row);
- if (val !== "") {
- TimeManager.timeZone = val;
- stackView.pop();
- }
- }
- }
- }
-}
diff --git a/src/qtdevicesettings/timedateplugin/icons.qrc b/src/qtdevicesettings/timedateplugin/icons.qrc
deleted file mode 100644
index af8a564..0000000
--- a/src/qtdevicesettings/timedateplugin/icons.qrc
+++ /dev/null
@@ -1,4 +0,0 @@
-<RCC>
- <qresource prefix="/">
- </qresource>
-</RCC>
diff --git a/src/qtdevicesettings/timedateplugin/plugin.cpp b/src/qtdevicesettings/timedateplugin/plugin.cpp
deleted file mode 100644
index b092c2c..0000000
--- a/src/qtdevicesettings/timedateplugin/plugin.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Device Utilities module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtQml/QQmlExtensionPlugin>
-#include <QtQml/qqml.h>
-#include <qcoreapplication.h>
-#include <QQmlEngine>
-#include <QQmlContext>
-
-#include "systemtime.h"
-#include "timezonemodel.h"
-#include "timezonefiltermodel.h"
-
-template <typename T>
-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<SystemTime>(uri, 1, 0, "TimeManager", &instance<SystemTime>);
- }
-
- void initializeEngine(QQmlEngine * engine, const char * uri)
- {
- Q_ASSERT(QLatin1String(uri) == QLatin1String("com.theqtcompany.settings.timedate"));
- TimezoneModel* timezoneModel = new TimezoneModel(engine);
- TimezoneFilterModel* filter = new TimezoneFilterModel(engine);
- filter->setSourceModel(timezoneModel);
-
- engine->rootContext()->setContextProperty("Timezones", timezoneModel);
- engine->rootContext()->setContextProperty("TimezonesFilter", filter);
- }
-};
-
-#include "plugin.moc"
diff --git a/src/qtdevicesettings/timedateplugin/qml.qrc b/src/qtdevicesettings/timedateplugin/qml.qrc
deleted file mode 100644
index e04454d..0000000
--- a/src/qtdevicesettings/timedateplugin/qml.qrc
+++ /dev/null
@@ -1,7 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>TimeDate.qml</file>
- <file>AnalogClock.qml</file>
- <file>TimezonesView.qml</file>
- </qresource>
-</RCC>
diff --git a/src/qtdevicesettings/timedateplugin/qmldir b/src/qtdevicesettings/timedateplugin/qmldir
deleted file mode 100644
index 2d7a8a6..0000000
--- a/src/qtdevicesettings/timedateplugin/qmldir
+++ /dev/null
@@ -1,3 +0,0 @@
-module com.theqtcompany.settings.timedate
-TimeDate 1.0 TimeDate.qml
-plugin qmltimedatesettingsplugin
diff --git a/src/qtdevicesettings/timedateplugin/systemtime.cpp b/src/qtdevicesettings/timedateplugin/systemtime.cpp
deleted file mode 100644
index c84b036..0000000
--- a/src/qtdevicesettings/timedateplugin/systemtime.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Device Utilities module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "systemtime.h"
-#include "systemtime_p.h"
-
-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();
-}
diff --git a/src/qtdevicesettings/timedateplugin/systemtime.h b/src/qtdevicesettings/timedateplugin/systemtime.h
deleted file mode 100644
index 092712c..0000000
--- a/src/qtdevicesettings/timedateplugin/systemtime.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Device Utilities module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef SYSTEMTIME_H
-#define SYSTEMTIME_H
-
-#include <QObject>
-#include <QTime>
-
-class SystemTimePrivate;
-
-class 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 = 0);
- bool ntp() const;
- void setNtp(const bool aNtp);
- void setTime(const QDateTime& aTime);
- QString timeZone() const;
- QDateTime time() const;
- void setTimeZone(const QString& aTimeZone);
-
-signals:
- void timeZoneChanged();
- void ntpChanged();
- void timeChanged();
-
-public slots:
-
-protected:
- SystemTimePrivate *d_ptr;
-
- Q_DISABLE_COPY(SystemTime)
- Q_DECLARE_PRIVATE(SystemTime)
-};
-
-#endif // SYSTEMTIME_H
diff --git a/src/qtdevicesettings/timedateplugin/systemtime_p.h b/src/qtdevicesettings/timedateplugin/systemtime_p.h
deleted file mode 100644
index 5ee6eef..0000000
--- a/src/qtdevicesettings/timedateplugin/systemtime_p.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Device Utilities module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef SYSTEMTIME_P_H
-#define SYSTEMTIME_P_H
-
-#include "systemtime.h"
-#include "timedated_interface.h"
-
-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);
- }
-
- QString timeZone() const {
- if (m_timeInterface)
- return m_timeInterface->timezone();
- return "";
- }
-
- 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;
-};
-
-
-#endif // SYSTEMTIME_P_H
diff --git a/src/qtdevicesettings/timedateplugin/timedated.xml b/src/qtdevicesettings/timedateplugin/timedated.xml
deleted file mode 100644
index 95bafb8..0000000
--- a/src/qtdevicesettings/timedateplugin/timedated.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<node name="/Service" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
-<node>
- <interface name="org.freedesktop.timedate1">
- <property name="Timezone" type="s" access="read"/>
- <property name="LocalRTC" type="b" access="read"/>
- <property name="CanNTP" type="b" access="read"/>
- <property name="NTP" type="b" access="read"/>
- <method name="SetTime">
- <arg name="usec_utc" type="x" direction="in"/>
- <arg name="relative" type="b" direction="in"/>
- <arg name="user_interaction" type="b" direction="in"/>
- </method>
- <method name="SetTimezone">
- <arg name="timezone" type="s" direction="in"/>
- <arg name="user_interaction" type="b" direction="in"/>
- </method>
- <method name="SetLocalRTC">
- <arg name="local_rtc" type="b" direction="in"/>
- <arg name="fix_system" type="b" direction="in"/>
- <arg name="user_interaction" type="b" direction="in"/>
- </method>
- <method name="SetNTP">
- <arg name="use_ntp" type="b" direction="in"/>
- <arg name="user_interaction" type="b" direction="in"/>
- </method>
- </interface>
-</node>
-
-
diff --git a/src/qtdevicesettings/timedateplugin/timedateplugin.pro b/src/qtdevicesettings/timedateplugin/timedateplugin.pro
deleted file mode 100644
index d82529d..0000000
--- a/src/qtdevicesettings/timedateplugin/timedateplugin.pro
+++ /dev/null
@@ -1,42 +0,0 @@
-TEMPLATE = lib
-CONFIG += plugin
-QT += qml dbus
-
-uri = com.theqtcompany.settings.timedate
-
-DBUS_INTERFACES = timedated.xml
-
-DESTDIR = imports/TimeDate
-TARGET = qmltimedatesettingsplugin
-
-SOURCES += plugin.cpp \
- systemtime.cpp \
- timezonemodel.cpp \
- timezonefiltermodel.cpp
-
-pluginfiles.files += \
- qmldir
-
-
-pluginfiles.files += \
- AnalogClock.qml \
- TimeDate.qml \
- TimezonesView.qml \
-
-installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /)
-
-target.path = $$installPath
-pluginfiles.path += $$installPath
-INSTALLS += target pluginfiles
-
-
-RESOURCES += \
- icons.qrc
-
-HEADERS += \
- systemtime.h \
- systemtime_p.h \
- timezonemodel.h \
- timezonefiltermodel.h
-
-
diff --git a/src/qtdevicesettings/timedateplugin/timezonefiltermodel.cpp b/src/qtdevicesettings/timedateplugin/timezonefiltermodel.cpp
deleted file mode 100644
index 3d1c0a4..0000000
--- a/src/qtdevicesettings/timedateplugin/timezonefiltermodel.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Device Utilities module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "timezonemodel.h"
-#include "timezonefiltermodel.h"
-
-TimezoneFilterModel::TimezoneFilterModel(QObject* parent)
- :QSortFilterProxyModel(parent)
-{
- connect(this, &TimezoneFilterModel::filterChanged, this, &TimezoneFilterModel::invalidate);
-}
-
-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::fromValue(QString(""));
-}
-
diff --git a/src/qtdevicesettings/timedateplugin/timezonefiltermodel.h b/src/qtdevicesettings/timedateplugin/timezonefiltermodel.h
deleted file mode 100644
index dd9009f..0000000
--- a/src/qtdevicesettings/timedateplugin/timezonefiltermodel.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Device Utilities module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef TIMEZONEFILTERMODEL_H
-#define TIMEZONEFILTERMODEL_H
-
-#include <QSortFilterProxyModel>
-
-class 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;
-signals:
- void filterChanged();
-private:
- QString m_filter;
-
-};
-
-#endif // TIMEZONEFILTERMODEL_H
diff --git a/src/qtdevicesettings/timedateplugin/timezonemodel.cpp b/src/qtdevicesettings/timedateplugin/timezonemodel.cpp
deleted file mode 100644
index b6cf27b..0000000
--- a/src/qtdevicesettings/timedateplugin/timezonemodel.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Device Utilities module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QLocale>
-#include <QQmlPropertyMap>
-#include <QFuture>
-#include <QThread>
-#include <QtConcurrent/QtConcurrentRun>
-#include "timezonemodel.h"
-
-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 = id;
-}
-
-QString TimezoneItem::name() const
-{
- return m_name;
-}
-
-QString TimezoneItem::country() const
-{
- return m_country;
-}
-
-QString TimezoneItem::id() const
-{
- return m_id;
-}
-
-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");
-
- QFuture<void> t1 = QtConcurrent::run(TimezoneModel::generateModel, this);
-}
-
-void TimezoneModel::generateModel(TimezoneModel* model)
-{
- QList<QByteArray> 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<QObject*>(zone)));
- }
-}
-
-void TimezoneModel::addNewItem(QObject* item)
-{
- beginInsertRows(QModelIndex(), m_items.count(), m_items.count());
- TimezoneItem* newItem = qobject_cast<TimezoneItem*>(item);
- if (newItem)
- m_items.append(newItem);
- endInsertRows();
-}
-
-TimezoneModel::~TimezoneModel()
-{
- qDeleteAll(m_items);
-}
-
-QHash<int, QByteArray> TimezoneModel::roleNames() const
-{
- return m_roleNames;
-}
-
-
-int TimezoneModel::rowCount(const QModelIndex & parent) const
-{
- Q_UNUSED(parent);
- return m_items.count();
-}
-
-QVariant TimezoneModel::data(const QModelIndex & index, int role) const
-{
- if (!index.isValid()) return QVariant();
-
- TimezoneItem *item = m_items[index.row()];
- if (role == Qt::UserRole) {
- return item->id();
- }
-
- switch (role) {
- 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 "";
- }
-}
diff --git a/src/qtdevicesettings/timedateplugin/timezonemodel.h b/src/qtdevicesettings/timedateplugin/timezonemodel.h
deleted file mode 100644
index af86c75..0000000
--- a/src/qtdevicesettings/timedateplugin/timezonemodel.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Device Utilities module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef TIMEZONEMODEL_H
-#define TIMEZONEMODEL_H
-
-#include <QObject>
-#include <QAbstractListModel>
-#include <QTimeZone>
-#include <QMutex>
-
-class TimezoneItem : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QString id READ id CONSTANT)
-public:
- explicit TimezoneItem(const QByteArray& id, QObject *parent=0);
- QString name() const;
- QString country() const;
- QString id() const;
-
-private:
- QString m_name;
- QString m_country;
- QString m_id;
-};
-
-class TimezoneModel : public QAbstractListModel
-{
- Q_OBJECT
-
-public:
- explicit TimezoneModel(QObject *parent=0);
- virtual ~TimezoneModel();
- // from QAbstractItemModel
- int rowCount(const QModelIndex & parent = QModelIndex()) const;
- QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
- QHash<int, QByteArray> roleNames() const;
- Q_INVOKABLE QVariant itemFromRow(const int row) const;
-
- enum Roles {
- Name = Qt::UserRole + 1,
- Country,
- Id
- };
-
- static void generateModel(TimezoneModel* model);
-
-private slots:
- void addNewItem(QObject* item);
-
-private:
- QList<TimezoneItem*> m_items;
- QHash<int, QByteArray> m_roleNames;
-};
-
-#endif // TIMEZONEMODEL_H