diff options
Diffstat (limited to 'src/settingsui/timedate')
-rw-r--r-- | src/settingsui/timedate/AnalogClock.qml | 172 | ||||
-rw-r--r-- | src/settingsui/timedate/ClockHand.qml | 70 | ||||
-rw-r--r-- | src/settingsui/timedate/CustomCalendar.qml | 216 | ||||
-rw-r--r-- | src/settingsui/timedate/CustomComboBox.qml | 98 | ||||
-rw-r--r-- | src/settingsui/timedate/ManualTime.qml | 248 | ||||
-rw-r--r-- | src/settingsui/timedate/TimeDate.qml | 162 | ||||
-rw-r--r-- | src/settingsui/timedate/TimezonesView.qml | 72 |
7 files changed, 0 insertions, 1038 deletions
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(); - } - } - } - } -} |