diff options
author | Juho Annunen <juho.annunen@qt.io> | 2017-10-11 13:30:52 +0300 |
---|---|---|
committer | Sami Nurmenniemi <sami.nurmenniemi@qt.io> | 2017-11-22 10:40:45 +0000 |
commit | 3895b8504f65346a1de19aa1ceb9570175337283 (patch) | |
tree | 3c97b2b57874bc1d3932350b4db7a779ddd80840 /src/settingsui | |
parent | 61e9e8c83e817b3692beae03bd8e683d247207b0 (diff) |
Update API and settings UI
Implemented new UI design for Settings and minor changes to API
Task-number: QTBUG-63091
Change-Id: Id72e20b53bc33ca0a3068d1e9b664fc5836a1cda
Reviewed-by: Kari Oikarinen <kari.oikarinen@qt.io>
Reviewed-by: Teemu Holappa <teemu.holappa@qt.io>
Diffstat (limited to 'src/settingsui')
43 files changed, 2150 insertions, 548 deletions
diff --git a/src/settingsui/bluetooth/Bluetooth.qml b/src/settingsui/bluetooth/Bluetooth.qml index 72b4ae6..dba1a5c 100644 --- a/src/settingsui/bluetooth/Bluetooth.qml +++ b/src/settingsui/bluetooth/Bluetooth.qml @@ -35,51 +35,97 @@ Item { id: root property string title: qsTr("Bluetooth Settings") - ColumnLayout { - anchors.margins: 20 - anchors.fill: parent - id: content - spacing: 20 + Text { + id: bluetoothText + anchors.top: parent.top + anchors.left: parent.left + fontSizeMode: Text.Fit + minimumPixelSize: 1 + font.pixelSize: parent.height * 0.05 + color: "white" + text: qsTr("Bluetooth") + font.family: appFont + font.styleName: "Bold" + } - GroupBox { - id: groupBox - width: parent.width - title: qsTr("Bluetooth status") - Layout.fillWidth: true - Layout.alignment: Qt.AlignTop - enabled: BtDevice.available + Rectangle { + id: btmLine + anchors.top: bluetoothText.bottom + anchors.topMargin: parent.height * 0.025 + anchors.left: bluetoothText.left + width: parent.width * 0.275 + height: parent.height * 0.005 + } + Row { + id: bluetoothRow + anchors.top: btmLine.bottom + anchors.topMargin: parent.height * 0.05 + anchors.left: parent.left + anchors.right: parent.right + height: parent.height * 0.2 + spacing: parent.width * 0.025 + Text { + anchors.verticalCenter: parent.verticalCenter + font.pixelSize: parent.height * 0.2 + color: "white" + text: "Bluetooth" + font.family: appFont + font.styleName: "Bold" + } + CustomSwitch { + anchors.verticalCenter: parent.verticalCenter + indicatorWidth: root.width * 0.25 + indicatorHeight: root.height * 0.1 - RowLayout { - spacing: 10 - Label { - id: off - text: qsTr("Off") - } - Switch { - checked: BtDevice.powered - onCheckedChanged: { - BtDevice.powered = checked - } - } + checked: BtDevice.powered + onCheckedChanged: BtDevice.powered = checked + } - Connections { - target: BtDevice - onPoweredChanged: { - if (BtDevice.powered) - BtDevice.scanning = true - } - } + Text { + id: scanningText + anchors.verticalCenter: parent.verticalCenter + verticalAlignment: Text.AlignVCenter + font.pixelSize: parent.height * 0.2 + color: "white" + text: "Scanning" + font.family: appFont + opacity: BtDevice.scanning ? 1.0 : 0.0 + visible: opacity > 0 + Behavior on opacity { + NumberAnimation {duration: 150} + } + + Timer { + id: scanningTimer + interval: 1000 + repeat: true + running: BtDevice.scanning - Label { - text: qsTr("On") + onTriggered: { + if (scanningText.text.indexOf("...") !== -1) + scanningText.text = "Scanning" + else + scanningText.text += "." } } } - Discovery { - id: discovery - visible: BtDevice.powered - Layout.fillWidth: true - Layout.fillHeight: true + + Connections { + target: BtDevice + 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/CustomSwitch.qml b/src/settingsui/bluetooth/CustomSwitch.qml new file mode 100644 index 0000000..9c7c180 --- /dev/null +++ b/src/settingsui/bluetooth/CustomSwitch.qml @@ -0,0 +1,120 @@ +/**************************************************************************** +** +** 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 QtDemoLauncher.QtButtonImageProvider 1.0 +import QtQuick.Controls 2.1 + +Switch { + id: control + + property alias indicatorWidth: indicatorImg.width + property alias indicatorHeight: indicatorImg.height + + indicator: Image { + id: indicatorImg + width: 200 + height: 75 + sourceSize: Qt.size(width, height) + anchors.horizontalCenter: control.horizontalCenter + y: parent.height / 2 - height / 2 + source: "image://QtButton/10/#848895/transparent" + Text { + id: offText + anchors.left: parent.left + anchors.leftMargin: parent.width * 0.075 + anchors.verticalCenter: parent.verticalCenter + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + fontSizeMode: Text.Fit + minimumPixelSize: 1 + font.pixelSize: parent.height * 0.55 + color: "#3b4155" + text: "OFF" + font.family: appFont + } + Text { + id: onText + anchors.right: parent.right + anchors.rightMargin: parent.width * 0.1 + anchors.verticalCenter: parent.verticalCenter + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + fontSizeMode: Text.Fit + minimumPixelSize: 1 + font.pixelSize: parent.height * 0.55 + color: "#3b4155" + text: "ON" + font.family: appFont + } + + Binding { + target: qtHandle + property: "x" + value: control.checked ? indicatorImg.width - qtHandle.width - indicatorImg.width * 0.025 : indicatorImg.width * 0.025 + when: !mousearea.drag.active + } + + MouseArea { + anchors.fill: parent + onClicked: control.checked = !control.checked + } + + QtButton { + id: qtHandle + anchors.verticalCenter: parent.verticalCenter + width: parent.width * 0.475 + height: parent.height * 0.9 + fillColor: control.checked ? "#41cd52" : "#9d9faa" + text: control.checked ? "ON" : "OFF" + borderColor: "transparent" + Behavior on x { + NumberAnimation { duration: 50 } + } + + MouseArea { + id: mousearea + anchors.fill: parent + drag.target: qtHandle + drag.axis: Drag.XAxis + drag.minimumX: indicatorImg.width * 0.005 + drag.maximumX: indicatorImg.width - width - indicatorImg.width * 0.005 + + onClicked: control.checked = !control.checked + + onReleased: { + if (qtHandle.x > indicatorImg.width / 5 ) { + control.checked = true + } else { + control.checked = false + } + } + } + } + } +} diff --git a/src/settingsui/bluetooth/Discovery.qml b/src/settingsui/bluetooth/Discovery.qml index 1b3184a..bde88aa 100644 --- a/src/settingsui/bluetooth/Discovery.qml +++ b/src/settingsui/bluetooth/Discovery.qml @@ -30,93 +30,109 @@ import QtQuick 2.6 import QtQuick.Layouts 1.3 import QtQuick.Controls 2.0 import QtDeviceUtilities.BluetoothSettings 1.0 +import QtDemoLauncher.QtButtonImageProvider 1.0 Item { id: top - GroupBox { - id: groupBox - title: qsTr("Devices") + ListView { + id: mainList anchors.fill: parent + opacity: BtDevice.scanning ? .5 : 1.0 + interactive: !BtDevice.scanning + clip: true + model: BtDevice.deviceModel - 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" - } + 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 ? column.height + 10 : bttext.height + 10 - property bool expanded: false; - - MouseArea { - anchors.fill: parent - onClicked: { - if (!connected) - btDelegate.expanded = !btDelegate.expanded + 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 - anchors.left: parent.left - anchors.top: parent.top - anchors.topMargin: 4 - source: mainList.getIcon(type) - } - Column { - id: column - anchors.left: bticon.right - anchors.leftMargin: 10 - anchors.right: connectButton.left - anchors.rightMargin: 10 - - Label { - id: bttext - text: name - } - Label { - id: details - opacity: btDelegate.expanded || connected ? 1 : 0.0 - text: address - Behavior on opacity { NumberAnimation { duration: 200} } - } + } + 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 ? "#41cd52" : "white" + font.family: appFont + font.styleName: connected ? "SemiBold" : "Regular" } - Button { - id: connectButton - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - visible: (expanded || connected) && !BtDevice.scanning - text: connected ? qsTr("Disconnect") : qsTr("Connect") - onClicked : connected ? BtDevice.requestDisconnect(address) : BtDevice.requestPairing(address); + Label { + id: details + height: btDelegate.height * 0.275 * opacity + opacity: btDelegate.expanded || connected ? 1 : 0.0 + visible: opacity > 0 + text: address + color: connected ? "#41cd52" : "white" + font.family: appFont + Behavior on opacity { NumberAnimation { duration: 200} } } - Behavior on height { NumberAnimation { duration: 200} } } - focus: true + 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 ? "#9d9faa" : "#41cd52" + 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: "#9d9faa" + height: 2 + anchors.bottom: btDelegate.bottom + anchors.horizontalCenter: btDelegate.horizontalCenter + } } - } - BusyIndicator { - anchors.centerIn: parent - running: BtDevice.scanning + focus: true } } diff --git a/src/settingsui/common/CustomTableView.qml b/src/settingsui/common/CustomTableView.qml index 6b0505a..9efd584 100644 --- a/src/settingsui/common/CustomTableView.qml +++ b/src/settingsui/common/CustomTableView.qml @@ -32,56 +32,46 @@ import QtQuick.Controls 2.0 ColumnLayout { id: root - spacing: 0 + Layout.fillHeight: true Layout.fillWidth: true property var headerTexts: [] property var roleNames: [] property alias model: listView.model + property alias localeIndex: listView.currentIndex signal clicked(int index) - Rectangle { - height: 40 - Layout.fillWidth: true - color: "#80c342" - - Row { - anchors.fill: parent - anchors.leftMargin: 10 - spacing: 10 - - Repeater { - model: root.headerTexts.length - Text { - width: parent.width / root.headerTexts.length - text: root.headerTexts[index] - color: "white" - font.bold: true - anchors.verticalCenter: parent.verticalCenter - } - } - } + Timer { //A workaround to position the listView.. + interval: 250 + running: true + onTriggered: listView.positionViewAtIndex(listView.currentIndex, ListView.Beginning) } + ListView { id: listView Layout.fillHeight: true Layout.fillWidth: true clip: true - Rectangle { - anchors.fill: parent - border.color: "#bdbebf" - border.width: 1 - color: "transparent" + onCurrentIndexChanged: { + if (listView.model) { + positionViewAtIndex(listView.currentIndex, ListView.beginning) + } } - ScrollBar.vertical: ScrollBar {} + ScrollBar.vertical: ScrollBar { + contentItem: Rectangle { + implicitWidth: listView.width * 0.0175 + implicitHeight: listView.height * 0.5 + color: "#41cd52" + } + } - delegate: Rectangle { + delegate: Item { + id: delegateRectangle width: parent.width - height: 30 - color: index % 2 ? "#e3e3e3" : "white" + height: listView.height * 0.1 property var delegateData: modelData Row { @@ -96,9 +86,13 @@ ColumnLayout { width: parent.width / root.roleNames.length text: delegateData[root.roleNames[index]] anchors.verticalCenter: parent.verticalCenter + verticalAlignment: Text.AlignVCenter + font.pixelSize: delegateRectangle.height * 0.5 antialiasing: false smooth: false renderType: listView.moving ? Text.NativeRendering : Text.QtRendering + color: listView.currentIndex == delegateRectangle.index ? "#41cd52" : "white" + font.family: appFont } } } diff --git a/src/settingsui/display/Display.qml b/src/settingsui/display/Display.qml index 450ac41..908bd95 100644 --- a/src/settingsui/display/Display.qml +++ b/src/settingsui/display/Display.qml @@ -30,101 +30,181 @@ import QtQuick 2.6 import QtQuick.Layouts 1.3 import QtQuick.Controls 2.0 import QtDeviceUtilities.DisplaySettings 1.0 +import QtDemoLauncher.QtButtonImageProvider 1.0 Item { id: root property string title: qsTr("Display Settings") property int titleWidth: width * 0.382 + property int margin: root.width * 0.05 - GroupBox { - title: qsTr("Display Settings") - anchors.margins: 20 - anchors.left: parent.left + Text { + id: displayText anchors.top: parent.top - anchors.right:parent.right + anchors.left: parent.left + font.pixelSize: parent.height * 0.045 + color: "white" + text: qsTr("Display") + } - ColumnLayout { - anchors.fill: parent + Rectangle { + id: btmLine + anchors.top: displayText.bottom + anchors.topMargin: parent.height * 0.025 + anchors.left: displayText.left + width: parent.width * 0.275 + height: parent.height * 0.005 + } - RowLayout { - width: parent.width - spacing: 10 + Label { + id: brightnessLabel + anchors.top: btmLine.bottom + anchors.topMargin: parent.height * 0.1 + font.pixelSize: parent.height * 0.04 + text: qsTr("Brightness ") + (brightnessSlider.valueAt(brightnessSlider.position) / 255 * 100).toFixed(1) + "%" + horizontalAlignment: Text.AlignRight + color: "white" + } - Label { - text: qsTr("Brightness:") - Layout.preferredWidth: root.titleWidth - Layout.alignment: Qt.AlignVCenter - horizontalAlignment: Text.AlignRight - } - Slider { - id: brightnessSlider - value: DisplaySettings.displayBrightness - Layout.alignment: Qt.AlignVCenter - Layout.fillWidth: true - from: 0 - to: 255 - } - } - Binding { - target: DisplaySettings - property: "displayBrightness" - value: brightnessSlider.position * brightnessSlider.to + Slider { + id: brightnessSlider + anchors.top: brightnessLabel.bottom + anchors.topMargin: parent.height * 0.05 + anchors.left: parent.left + anchors.right: parent.right + value: DisplaySettings.displayBrightness + Layout.alignment: Qt.AlignVCenter + Layout.fillWidth: true + from: 0 + to: 255 + 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: "#9d9faa" + Rectangle { + width: brightnessSlider.visualPosition * parent.width + height: parent.height + color: "white" + radius: 2 } - GridLayout { - columns: 2 - rows: 3 - rowSpacing: 10 + } + 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: 1000 + antialiasing: true + color: "#41cd52" + } + } - Label { - text: qsTr("Physical screen size:") - Layout.preferredWidth: root.titleWidth - Layout.alignment: Qt.AlignVCenter - horizontalAlignment: Text.AlignRight - wrapMode: Label.WordWrap - } - RadioButton { - text: qsTr("Default") - checked: !DisplaySettings.physicalScreenSizeOverride - } - RadioButton { - id: custom - Layout.column: 1 - Layout.row: 1 - text: qsTr("Custom") - checked: DisplaySettings.physicalScreenSizeOverride - onCheckedChanged: DisplaySettings.physicalScreenSizeOverride = checked - } - GroupBox { - title: qsTr("Size (in inches): %1").arg(DisplaySettings.physicalScreenSizeInch) - Layout.column: 1 - Layout.row: 2 - Layout.fillWidth: true - visible: custom.checked + Label { + id: screenSizeLabel + anchors.top: brightnessSlider.bottom + anchors.topMargin: parent.height * 0.1 + font.pixelSize: parent.height * 0.04 + text: qsTr("Physical screen size") + Layout.preferredWidth: root.titleWidth + Layout.alignment: Qt.AlignVCenter + horizontalAlignment: Text.AlignRight + wrapMode: Label.WordWrap + color: "white" + } - RowLayout { - spacing: 10 - width: parent.width + Row { + id: widthRow + height: parent.height * 0.075 + anchors.top: screenSizeLabel.bottom + anchors.topMargin: parent.height * 0.035 + anchors.left: parent.left + Text { + id: widthText + height: parent.height + width: root.width * 0.075 + text: qsTr("Width") + color: "white" + font.pixelSize: height * 0.35 + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignLeft + } + TextField { + id: widthField + width: root.width * 0.1 + height: parent.height + color: "black" + text: DisplaySettings.physicalScreenWidthMm + inputMethodHints: Qt.ImhDigitsOnly + background: Rectangle { + border.color: widthField.focus ? "#41cd52" : "transparent" + border.width: parent.width * 0.05 + } + } + } - Label { - text: sizeSlider.from - Layout.alignment: Qt.AlignVCenter - } - Slider { - id: sizeSlider - value: DisplaySettings.physicalScreenSizeInch - Layout.fillWidth: true - stepSize: 1 - from: 4 - to: 60 - onPositionChanged: DisplaySettings.physicalScreenSizeInch = sizeSlider.from + Math.floor(sizeSlider.position * (sizeSlider.to - sizeSlider.from)) - } - Label { - text: sizeSlider.to - Layout.alignment: Qt.AlignVCenter | Qt.AlignRight - } - } - } + Row { + id: heightRow + height: parent.height * 0.075 + anchors.top: screenSizeLabel.bottom + anchors.topMargin: parent.height * 0.035 + anchors.left: widthRow.right + anchors.leftMargin: root.margin * 0.5 + Text { + id: heightText + height: parent.height + width: root.width * 0.085 + text: qsTr("Height") + color: "white" + font.pixelSize: height * 0.35 + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignLeft + } + TextField { + id: heightField + width: root.width * 0.1 + height: parent.height + color: "black" + text: DisplaySettings.physicalScreenHeightMm + inputMethodHints: Qt.ImhDigitsOnly + background: Rectangle { + border.color: heightField.focus ? "#41cd52" : "transparent" + border.width: parent.width * 0.05 } } } + + QtButton { + id: setButton + height: parent.height * 0.075 + anchors.top: heightRow.bottom + anchors.topMargin: parent.height * 0.035 + fillColor: "#41cd52" + borderColor: "transparent" + text: qsTr("SET") + onClicked: { + DisplaySettings.physicalScreenHeightMm = parseInt(heightField.text) + DisplaySettings.physicalScreenWidthMm = parseInt(widthField.text) + } + } + QtButton { + id: resetButton + height: parent.height * 0.075 + anchors.top: heightRow.bottom + anchors.topMargin: parent.height * 0.035 + anchors.left: setButton.right + anchors.leftMargin: root.margin * 0.5 + borderColor: "transparent" + fillColor: "#9d9faa" + 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 index d4257c3..e536583 100644 --- a/src/settingsui/locale/Language.qml +++ b/src/settingsui/locale/Language.qml @@ -31,59 +31,142 @@ import QtQuick.Layouts 1.3 import QtQuick.Controls 2.0 import QtDeviceUtilities.LocaleSettings 1.0 import QtQml 2.2 +import QtDemoLauncher.QtButtonImageProvider 1.0 Item { id: root - property string title: qsTr("Language and Region") + property var currentRegion: Qt.locale(LocaleManager.locale) - GroupBox { - id: groupBox - title: qsTr("Regional Format") - anchors.left: parent.left + Text { + id: languageAndRegionTitle anchors.top: parent.top - anchors.right: parent.right - anchors.margins: 20 - property var currentRegion: Qt.locale(LocaleManager.locale) + anchors.left: parent.left + fontSizeMode: Text.Fit + minimumPixelSize: 1 + font.pixelSize: parent.height * 0.05 + color: "white" + text: qsTr("Language & Region") + font.family: appFont + font.styleName: "Bold" + } + Rectangle { + id: btmLine + anchors.top: languageAndRegionTitle.bottom + anchors.topMargin: parent.height * 0.025 + anchors.left: languageAndRegionTitle.left + width: parent.width * 0.275 + height: parent.height * 0.005 + } + + Row { + id: regionRow + anchors.top: btmLine.bottom + anchors.topMargin: parent.height * 0.075 + anchors.left: parent.left + height: parent.height * 0.075 - ColumnLayout { - width: parent.width + Text { + width: root.width * 0.2 + height: root.height * 0.04 + anchors.verticalCenter: parent.verticalCenter + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + font.pixelSize: height + color: "white" + text: qsTr("Region") + font.family: appFont + font.styleName: "Bold" + } + QtButton { + id: regionButton + height: parent.height + fillColor: "#41cd52" + text: root.currentRegion.nativeCountryName + onClicked: settingsLoader.source = "qrc:/locale/RegionSelect.qml" + } + } + + Text { + id: formatText + width: root.width * 0.2 + anchors.top: regionRow.bottom + anchors.topMargin: parent.height * 0.1 + anchors.left: parent.left + font.pixelSize: parent.height * 0.04 + text: qsTr("Format") + horizontalAlignment: Text.AlignLeft + color: "white" + font.family: appFont + font.styleName: "Bold" + } - Component { - id: regionSelect - RegionSelect {} + Column { + id: localeColumn + anchors.bottom: parent.bottom + anchors.top: formatText.bottom + anchors.topMargin: parent.height * 0.025 + anchors.left: formatText.right + width: parent.width * 0.5 + spacing: parent.height * 0.01 + Row { + id: regionFormat + anchors.left: parent.left + anchors.right: parent.right + height: parent.height * 0.1 + TableKey { + text: qsTr("Region") } - GroupBox { - width: parent.width - title: { - if (groupBox.currentRegion.name === "C" || groupBox.currentRegion.name === "POSIX") { - return qsTr("Default"); - } - else if (groupBox.currentRegion.name !== "") { - return qsTr("%L1/%L2").arg(groupBox.currentRegion.nativeLanguageName).arg(groupBox.currentRegion.nativeCountryName) - } - else { - return qsTr("Region not set"); - } - } - ColumnLayout { - spacing: 10 - Layout.fillWidth: true - width: parent.width + TableValue { + text: root.currentRegion.nativeCountryName + } + } + Row { + id: shortDateFormat + anchors.left: parent.left + anchors.right: parent.right + height: parent.height * 0.1 + TableKey { + text: qsTr("Short date:") + } + TableValue { + text: root.currentRegion.dateFormat(1) + } + } + Row { + id: shortTimeFormat + anchors.left: parent.left - Label { - text: Date().toLocaleString(groupBox.currentRegion) - } - Label { - text: Number(2343.34).toLocaleString(groupBox.currentRegion) - } - Label { - text: Number(41334.34).toLocaleCurrencyString(groupBox.currentRegion) - } - } + anchors.right: parent.right + height: parent.height * 0.1 + TableKey { + text: qsTr("Short time:") + } + TableValue { + text: root.currentRegion.timeFormat(1) + } + } + Row { + id: currencyFormat + anchors.left: parent.left + anchors.right: parent.right + height: parent.height * 0.1 + TableKey { + text: qsTr("Currency:") + } + TableValue { + text: root.currentRegion.currencySymbol(1) + } + } + Row { + id: firstDayFormat + anchors.left: parent.left + anchors.right: parent.right + height: parent.height * 0.1 + TableKey { + text: qsTr("First day of week:") } - Button { - text: qsTr("Change region") - onClicked: stackView.push(regionSelect) + TableValue { + text: root.currentRegion.firstDayOfWeek } } } diff --git a/src/settingsui/locale/RegionSelect.qml b/src/settingsui/locale/RegionSelect.qml index 89042b6..ca8debe 100644 --- a/src/settingsui/locale/RegionSelect.qml +++ b/src/settingsui/locale/RegionSelect.qml @@ -31,33 +31,119 @@ import QtQuick.Layouts 1.3 import QtQuick.Controls 2.0 import QtDeviceUtilities.LocaleSettings 1.0 import "../common" +import QtGraphicalEffects 1.0 +import QtDemoLauncher.QtButtonImageProvider 1.0 Item { id: root - property string title: qsTr("Select language") + property var currentRegion: Qt.locale(LocaleManager.locale) - Component.onCompleted: country.text = LocaleFilter.filter + 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: "#41cd52" + 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 + fontSizeMode: Text.Fit + minimumPixelSize: 1 + font.pixelSize: height + color: "#41cd52" + 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 + fontSizeMode: Text.Fit + minimumPixelSize: 1 + font.pixelSize: parent.height * 0.05 + 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.fill: parent - anchors.margins: 20 - spacing: 10 + anchors.top: btmLine.bottom + anchors.left: parent.left + anchors.bottom: parent.bottom + anchors.right: parent.right + anchors.topMargin: parent.height * 0.025 RowLayout { spacing: 10 - - Label { - text: qsTr("Search region: ") - Layout.alignment: Qt.AlignVCenter - } + Layout.fillHeight: false + Layout.preferredHeight: root.height * 0.075 TextField { id: country + Layout.fillHeight: true + Layout.preferredWidth: root.width * 0.5 + font.pixelSize: parent.height * 0.5 + color: "white" text: "" + placeholderText: "Search..." + font.family: appFont + font.styleName: "Light" onTextChanged: LocaleFilter.filter = country.text Layout.alignment: Qt.AlignVCenter + background: Rectangle { + color: "transparent" + border.color: "#9d9faa" + border.width: 2 + } + } + + QtButton { + id: searchButton + Layout.fillHeight: true + Layout.preferredWidth: root.width * 0.1 + fillColor: "#41cd52" + borderColor: "transparent" } } + CustomTableView { + id: localeTableView headerTexts: [qsTr("Language"), qsTr("Country")] roleNames: ["language", "country"] model: LocaleFilter @@ -65,9 +151,22 @@ Item { var val = model.itemFromRow(index); if (val !== "") { LocaleManager.locale = val; - stackView.pop(); + 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 + 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 new file mode 100644 index 0000000..27e3fd4 --- /dev/null +++ b/src/settingsui/locale/TableKey.qml @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** 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 { + width: root.width * 0.325 + height: parent.height + anchors.verticalCenter: parent.verticalCenter + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + font.pixelSize: parent.height * 0.55 + color: "white" + font.family: appFont +} diff --git a/src/settingsui/locale/TableValue.qml b/src/settingsui/locale/TableValue.qml new file mode 100644 index 0000000..f5ac00d --- /dev/null +++ b/src/settingsui/locale/TableValue.qml @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** 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 { + width: root.width * 0.2 + height: parent.height + anchors.verticalCenter: parent.verticalCenter + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + font.pixelSize: parent.height * 0.55 + color: "white" + font.family: appFont +} diff --git a/src/settingsui/network/NetworkListView.qml b/src/settingsui/network/NetworkListView.qml new file mode 100644 index 0000000..c42d7e1 --- /dev/null +++ b/src/settingsui/network/NetworkListView.qml @@ -0,0 +1,155 @@ +/**************************************************************************** +** +** 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 QtQml 2.0 +import QtDeviceUtilities.NetworkSettings 1.0 +import QtDemoLauncher.QtButtonImageProvider 1.0 +import QtQuick.Controls 2.1 + +ListView { + id: list + clip: true + property bool connecting: false + + Component.onCompleted: NetworkSettingsManager.services.type = NetworkSettingsType.Unknown; + model: NetworkSettingsManager.services + + delegate: Item { + id: networkDelegate + width: list.width + height: expanded ? list.height * 0.15 + list.height * 0.05 : list.height * 0.15 + property bool expanded: false + MouseArea { + anchors.fill: parent + onClicked: networkDelegate.expanded = !networkDelegate.expanded + } + Rectangle { + id: img + height: parent.height * 0.6 + width: height + anchors.left: parent.left + anchors.leftMargin: parent.width * 0.075 + anchors.verticalCenter: parent.verticalCenter + } + Column { + anchors.left: img.right + anchors.leftMargin: parent.width * 0.025 + anchors.verticalCenter: parent.verticalCenter + width: parent.width * 0.5 + Text { + id: networkName + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + font.pixelSize: list.height * 0.06 + color: connected ? "#41cd52" : "white" + text: name + font.family: appFont + font.styleName: connected ? "SemiBold" : "Regular" + } + Row { + id: ipRow + height: networkDelegate.height * 0.275 * opacity + opacity: networkDelegate.expanded ? 1 : 0.0 + visible: opacity > 0 + spacing: networkDelegate.width * 0.0075 + Behavior on opacity { NumberAnimation { duration: 200} } + Text { + id: ipAddressLabel + height: parent.height + anchors.verticalCenter: parent.verticalCenter + text: qsTr("IP Address:") + color: connected ? "#41cd52" : "white" + font.pixelSize: height * 0.8 + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignLeft + font.family: appFont + font.styleName: connected ? "SemiBold" : "Regular" + } + Text { + id: ipAddress + width: root.width * 0.15 + height: parent.height + anchors.verticalCenter: parent.verticalCenter + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignLeft + color: connected ? "#41cd52" : "white" + visible: ipRow.opacity > 0 + text: connected ? NetworkSettingsManager.services.itemFromRow(index).ipv4.address : qsTr("Not connected") + font.family: appFont + font.styleName: connected ? "SemiBold" : "Regular" + } + } + } + QtButton { + id: connectButton + height: list.height * 0.1 + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + fillColor: connected ? "#9d9faa" : "#41cd52" + borderColor: "transparent" + text: connected ? qsTr("DISCONNECT") : qsTr("CONNECT") + opacity: expanded || connected ? 1.0 : 0.0 + visible: opacity > 0.0 + Behavior on opacity { NumberAnimation { duration: 200 } } + onClicked: { + if (connected) { + NetworkSettingsManager.services.itemFromRow(index).disconnectService(); + } else { + var service = NetworkSettingsManager.services.itemFromRow(index) + if (service) { + list.connecting = true + service.connectService(); + } + } + } + } + Rectangle { + id: delegateBottom + width: networkDelegate.width + color: "#9d9faa" + height: 2 + anchors.bottom: networkDelegate.bottom + anchors.horizontalCenter: networkDelegate.horizontalCenter + } + Behavior on height { NumberAnimation { duration: 200} } + + Connections { + target: NetworkSettingsManager.userAgent + onShowUserCredentialsInput : { + settingsLoader.source = "qrc:/network/PassphraseEnter.qml" + list.connecting = false + } + onError: { + list.connecting = false + console.log("ERROR OCCURRED") + } + } + } + focus: true +} diff --git a/src/settingsui/network/NetworkSettings.qml b/src/settingsui/network/NetworkSettings.qml index 947aae5..56c62a8 100644 --- a/src/settingsui/network/NetworkSettings.qml +++ b/src/settingsui/network/NetworkSettings.qml @@ -28,108 +28,39 @@ ****************************************************************************/ import QtQuick 2.6 import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.2 import QtDeviceUtilities.NetworkSettings 1.0 +import QtDemoLauncher.QtButtonImageProvider 1.0 Item { - property string title: qsTr("Network Settings") - - GroupBox { - id: networkSelect - anchors.rightMargin: parent.width * 0.618 - anchors.left: parent.left - anchors.leftMargin: 20 + Text { + id: networkText anchors.top: parent.top - anchors.topMargin: 20 - - title: qsTr("Select Connection") - - function stateToStr(serviceState) { - switch (serviceState) { - case NetworkService.Idle: - return qsTr("Idle"); - case NetworkService.Failure: - return qsTr("Failure"); - case NetworkService.Association: - return qsTr("Association"); - case NetworkService.Configuration: - return qsTr("Configuration"); - case NetworkService.Ready: - return qsTr("Ready"); - case NetworkService.Disconnect: - return qsTr("Disconnect"); - case NetworkService.Online: - return qsTr("Online"); - default: - return qsTr("Undefined"); - } - } - ColumnLayout { - width: parent.width - - Repeater { - model: NetworkSettingsManager.interfaces - - RadioButton { - id: btn - enabled: (type != NetworkSettingsType.Wired) || NetworkSettingsManager.services.wiredNetworksAvailable - Layout.fillWidth: true - implicitHeight: 54 - - contentItem: Rectangle { - color: checked ? "#80c342" : "white" - border.color: "#bdbebf" - border.width: 1 - anchors.fill: parent - - Row { - anchors.fill: parent - spacing: 10 - - Image { - id: typeId - height: parent.height - width: height - } - Column { - height: parent.height * .7 - spacing: 0 - anchors.verticalCenter: parent.verticalCenter - Label { - text: name - } - Label { - text: ((type == NetworkSettingsType.Wired) && !NetworkSettingsManager.services.wiredNetworksAvailable) ? - qsTr("No networks") : networkSelect.stateToStr(modelData.state) - font.pixelSize: 12 - } - } - } - } + anchors.left: parent.left + fontSizeMode: Text.Fit + minimumPixelSize: 1 + font.pixelSize: parent.height * 0.05 + color: "white" + text: qsTr("Network") + font.family: appFont + font.styleName: "Bold" + } - onCheckedChanged: { - if (checked) { - networkDetails.selectedInterface = modelData - networkDetails.selectedInterface.scanServices() - if (type === NetworkSettingsType.Wired) { - networkDetails.source = "WiredSettings.qml"; - } - else if (type === NetworkSettingsType.Wifi) { - networkDetails.source = "WifiSettings.qml"; - } - } - } - } - } - } + Rectangle { + id: btmLine + anchors.top: networkText.bottom + anchors.topMargin: parent.height * 0.025 + anchors.left: networkText.left + width: parent.width * 0.275 + height: parent.height * 0.005 } - NetworkDetails { - id: networkDetails - anchors.leftMargin: networkSelect.width + 40 - anchors.topMargin: 20 - anchors.rightMargin: 20 - anchors.bottomMargin: 20 - anchors.fill: parent + NetworkListView { + id: networkList + anchors.top: btmLine.bottom + anchors.topMargin: parent.height * 0.025 + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom } } diff --git a/src/settingsui/network/PassphraseEnter.qml b/src/settingsui/network/PassphraseEnter.qml new file mode 100644 index 0000000..2936afa --- /dev/null +++ b/src/settingsui/network/PassphraseEnter.qml @@ -0,0 +1,142 @@ +/**************************************************************************** +** +** 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 QtGraphicalEffects 1.0 +import QtQuick.Controls 2.0 +import QtDemoLauncher.QtButtonImageProvider 1.0 +import QtDeviceUtilities.NetworkSettings 1.0 + +Item { + id: root + Row { + id: backRow + anchors.top: parent.top + anchors.left: parent.left + width: parent.width * 0.2 + height: parent.height * 0.035 + Image { + id: passBackIcon + anchors.verticalCenter: parent.verticalCenter + height: parent.height + width: height + fillMode: Image.PreserveAspectFit + source: "../newIcons/back_icon.svg" + + ColorOverlay { + source: passBackIcon + anchors.fill: passBackIcon + color: "#41cd52" + visible: true + } + MouseArea { + anchors.fill: parent + onClicked: settingsLoader.source = "qrc:/network/NetworkSettings.qml" + } + } + Text { + id: backText + anchors.top: parent.top + height: parent.height + anchors.verticalCenter: parent.verticalCenter + verticalAlignment: Text.AlignVCenter + fontSizeMode: Text.Fit + minimumPixelSize: 1 + font.pixelSize: height + color: "#41cd52" + text: "Back" + MouseArea { + anchors.fill: parent + onClicked: settingsLoader.source = "qrc:/network/NetworkSettings.qml" + } + } + } + + Text { + id: enterPassphraseText + anchors.top: backRow.bottom + anchors.topMargin: parent.height * 0.05 + anchors.left: parent.left + fontSizeMode: Text.Fit + minimumPixelSize: 1 + font.pixelSize: parent.height * 0.045 + color: "white" + text: qsTr("Enter Passphrase") + } + Rectangle { + id: btmLine + anchors.top: enterPassphraseText.bottom + anchors.topMargin: parent.height * 0.025 + anchors.left: enterPassphraseText.left + width: parent.width * 0.275 + height: parent.height * 0.005 + } + + TextField { + id: passField + width: root.width * 0.4 + height: parent.height * 0.075 + anchors.top: btmLine.bottom + anchors.topMargin: parent.height * 0.05 + color: "white" + echoMode: TextInput.Password + background: Rectangle { + color: "transparent" + border.color: passField.focus ? "#41cd52" : "#9d9faa" + border.width: passField.focus ? width * 0.01 : 2 + } + } + Row { + height: passField.height + anchors.top: passField.bottom + anchors.topMargin: parent.height * 0.025 + spacing: parent.width * 0.025 + QtButton { + id: setButton + height: parent.height + text: qsTr("SET") + borderColor: "transparent" + fillColor: "#41cd52" + onClicked: { + passField.focus = false + NetworkSettingsManager.userAgent.setPassphrase(passField.text) + } + } + QtButton { + id: cancelButton + height: parent.height + text: qsTr("CANCEL") + borderColor: "transparent" + fillColor: "#9d9faa" + onClicked: { + passField.focus = false + passField.clear() + } + } + } +} diff --git a/src/settingsui/power/Power.qml b/src/settingsui/power/Power.qml new file mode 100644 index 0000000..5adaaa6 --- /dev/null +++ b/src/settingsui/power/Power.qml @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** 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 QtDemoLauncher.QtButtonImageProvider 1.0 + +Item { + id: root + property int margin: root.width * 0.05 + + Text { + id: powerText + anchors.top: parent.top + anchors.left: parent.left + fontSizeMode: Text.Fit + minimumPixelSize: 1 + font.pixelSize: parent.height * 0.05 + color: "white" + text: qsTr("Power") + font.family: appFont + font.styleName: "Bold" + } + Rectangle { + id: btmLine + anchors.top: powerText.bottom + anchors.topMargin: parent.height * 0.025 + anchors.left: powerText.left + width: parent.width * 0.275 + height: parent.height * 0.005 + } + + QtButton { + id: shutdownButton + width: btmLine.width + height: parent.height * 0.075 + anchors.top: btmLine.bottom + anchors.topMargin: parent.height * 0.05 + fillColor: "#41cd52" + borderColor: "transparent" + text: qsTr("SHUTDOWN") + onClicked: { + shutdownPopup.powerOffText = qsTr("Shut down the system?") + shutdownPopup.buttonText = qsTr("SHUT DOWN") + shutdownPopup.open() + } + } + QtButton { + id: rebootButton + width: btmLine.width + height: parent.height * 0.075 + anchors.top: shutdownButton.bottom + anchors.topMargin: parent.height * 0.05 + fillColor: "#41cd52" + borderColor: "transparent" + text: qsTr("REBOOT") + onClicked: { + shutdownPopup.powerOffText = qsTr("Reboot the system?") + shutdownPopup.buttonText = qsTr("REBOOT") + shutdownPopup.open() + } + } +} diff --git a/src/settingsui/settingsuiapp.qrc b/src/settingsui/settingsuiapp.qrc index 58687e0..5af642c 100644 --- a/src/settingsui/settingsuiapp.qrc +++ b/src/settingsui/settingsuiapp.qrc @@ -3,5 +3,12 @@ <file>main.qml</file> <file>common/HandwritingModeButton.qml</file> <file>AutoScroller.qml</file> + <file>power/Power.qml</file> + <file>timedate/ManualTime.qml</file> + <file>timedate/CustomComboBox.qml</file> + <file>bluetooth/CustomSwitch.qml</file> + <file>network/PassphraseEnter.qml</file> + <file>locale/TableKey.qml</file> + <file>locale/TableValue.qml</file> </qresource> </RCC> diff --git a/src/settingsui/settingsuiplugin/icons.qrc b/src/settingsui/settingsuiplugin/icons.qrc index 88bdeac..91c3a76 100644 --- a/src/settingsui/settingsuiplugin/icons.qrc +++ b/src/settingsui/settingsuiplugin/icons.qrc @@ -30,5 +30,27 @@ <file>icons/Chevron-left_black_6x.png</file> <file>icons/Chevron-left_black.png</file> <file>icons/Power_black_6x.png</file> + <file>newIcons/back_icon.svg</file> + <file>newIcons/bluetooth_icon.svg</file> + <file>newIcons/close_icon.svg</file> + <file>newIcons/date-time_icon.svg</file> + <file>newIcons/detail_icon.svg</file> + <file>newIcons/display_icon.svg</file> + <file>newIcons/grid_icon.svg</file> + <file>newIcons/header_toggle_icon.svg</file> + <file>newIcons/info_icon.svg</file> + <file>newIcons/language_icon.svg</file> + <file>newIcons/mouse_icon.svg</file> + <file>newIcons/mute_icon.svg</file> + <file>newIcons/network_icon.svg</file> + <file>newIcons/pause_icon.svg</file> + <file>newIcons/play_icon.svg</file> + <file>newIcons/power_icon.svg</file> + <file>newIcons/settings_icon.svg</file> + <file>newIcons/settingsmenu_launcher_icon.svg</file> + <file>newIcons/stop_icon.svg</file> + <file>newIcons/touch_icon.svg</file> + <file>newIcons/volume_icon.svg</file> + <file>newIcons/qt_logo_green_rgb.svg</file> </qresource> </RCC> diff --git a/src/settingsui/settingsuiplugin/newIcons/back_icon.svg b/src/settingsui/settingsuiplugin/newIcons/back_icon.svg new file mode 100644 index 0000000..6034bd7 --- /dev/null +++ b/src/settingsui/settingsuiplugin/newIcons/back_icon.svg @@ -0,0 +1 @@ +<svg id="back" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><title>back_icon</title><path d="M26.57,43.5a2.61,2.61,0,0,1-2.1-1.06L10.74,24a2.62,2.62,0,0,1,0-3.12L25.06,1.56a2.62,2.62,0,1,1,4.2,3.12L16.1,22.4,28.67,39.32a2.62,2.62,0,0,1-2.1,4.18Z" style="fill:#fff"/></svg>
\ No newline at end of file diff --git a/src/settingsui/settingsuiplugin/newIcons/bluetooth_icon.svg b/src/settingsui/settingsuiplugin/newIcons/bluetooth_icon.svg new file mode 100644 index 0000000..5dfaa97 --- /dev/null +++ b/src/settingsui/settingsuiplugin/newIcons/bluetooth_icon.svg @@ -0,0 +1 @@ +<svg id="bluetooth" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><title>bluetooth_icon</title><path d="M22.38,43.5a1.79,1.79,0,0,1-1.79-1.79V25.82l-9.08,7.86A1.79,1.79,0,1,1,9.18,31l10.37-9L9.1,13a1.79,1.79,0,0,1,2.34-2.7l9.16,7.92V2.29a1.79,1.79,0,0,1,3-1.35l11.34,9.81a1.79,1.79,0,0,1,0,2.7L25,22l9.88,8.55a1.79,1.79,0,0,1,0,2.7L23.55,43.06A1.79,1.79,0,0,1,22.38,43.5ZM24.17,26V37.81L31,31.9Zm0-19.8V18L31,12.1Z" style="fill:#fff"/></svg>
\ No newline at end of file diff --git a/src/settingsui/settingsuiplugin/newIcons/close_icon.svg b/src/settingsui/settingsuiplugin/newIcons/close_icon.svg new file mode 100644 index 0000000..c98fe51 --- /dev/null +++ b/src/settingsui/settingsuiplugin/newIcons/close_icon.svg @@ -0,0 +1 @@ +<svg id="close" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><title>close_icon</title><path d="M25.5,22,42.09,4.78a2.52,2.52,0,1,0-3.64-3.5L22,18.36,5.55,1.27a2.53,2.53,0,0,0-3.64,3.5L18.49,22,1.91,39.22a2.53,2.53,0,0,0,3.64,3.5L22,25.64,38.45,42.73a2.52,2.52,0,1,0,3.64-3.5Z" style="fill:#fff"/></svg>
\ 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 new file mode 100644 index 0000000..2b86128 --- /dev/null +++ b/src/settingsui/settingsuiplugin/newIcons/date-time_icon.svg @@ -0,0 +1 @@ +<svg id="date_time" data-name="date time" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><title>date-time_icon</title><polygon points="9.98 20.74 6.69 20.74 6.69 24.03 9.98 24.03 9.98 20.74 9.98 20.74" style="fill:#fff"/><polygon points="15.68 20.74 12.39 20.74 12.39 24.03 15.68 24.03 15.68 20.74 15.68 20.74" style="fill:#fff"/><polygon points="21.39 20.74 18.09 20.74 18.09 24.03 21.39 24.03 21.39 20.74 21.39 20.74" style="fill:#fff"/><polygon points="9.98 26.03 6.69 26.03 6.69 29.32 9.98 29.32 9.98 26.03 9.98 26.03" style="fill:#fff"/><polygon points="15.68 26.03 12.39 26.03 12.39 29.32 15.68 29.32 15.68 26.03 15.68 26.03" style="fill:#fff"/><polygon points="21.39 26.03 18.09 26.03 18.09 29.32 21.39 29.32 21.39 26.03 21.39 26.03" style="fill:#fff"/><path d="M38.59,21.72V7.28a1.7,1.7,0,0,0-1.7-1.7H32.08V4.45a1.7,1.7,0,1,0-3.4,0V5.58H10.44V4.45a1.7,1.7,0,1,0-3.4,0V5.58H2a1.7,1.7,0,0,0-1.7,1.7V35A1.7,1.7,0,0,0,2,36.69H24.43v0a10.53,10.53,0,1,0,14.16-15ZM3.74,9H7V10.1a1.7,1.7,0,0,0,3.4,0V9H28.68V10.1a1.7,1.7,0,0,0,3.4,0V9h3.11V15.6H3.74Zm0,24.33v-16H35.19v3.08a11,11,0,0,0-2.08-.2,10.43,10.43,0,0,0-6,1.9V20.74h-3.3V24H25A10.53,10.53,0,0,0,22.9,33.3Zm29.37,6.25A8.84,8.84,0,1,1,42,30.71,8.85,8.85,0,0,1,33.11,39.55Z" style="fill:#fff"/><path d="M39.47,30.71a.87.87,0,0,1-.88.88H33.11a.89.89,0,0,1-.88-.88V25.24a.88.88,0,1,1,1.76,0v4.59h4.6A.88.88,0,0,1,39.47,30.71Z" style="fill:#fff"/><path d="M33.2,31.59h-.09a.81.81,0,0,1-.62-.27.84.84,0,0,0,.62.26Z" style="fill:#fff"/></svg>
\ No newline at end of file diff --git a/src/settingsui/settingsuiplugin/newIcons/detail_icon.svg b/src/settingsui/settingsuiplugin/newIcons/detail_icon.svg new file mode 100644 index 0000000..f0dc4ec --- /dev/null +++ b/src/settingsui/settingsuiplugin/newIcons/detail_icon.svg @@ -0,0 +1 @@ +<svg id="detail" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><title>detail</title><path d="M42.31,5.08H1.69A1.69,1.69,0,0,0,0,6.77V37.23a1.69,1.69,0,0,0,1.69,1.69H42.31A1.69,1.69,0,0,0,44,37.23V6.77A1.69,1.69,0,0,0,42.31,5.08ZM40.61,26.71H24V8.46H40.61Zm-7.16,8.82H24V28.29h9.43Zm-12.57,0H14.59V28.29h6.29Zm0-27.08V26.71H3.38V8.46ZM3.38,28.29h8.07v7.25H3.38ZM35,35.54V28.29h5.59v7.25Z" style="fill:#fff"/><rect x="6.74" y="11" width="12.57" height="1.57" style="fill:#fff"/><rect x="6.74" y="18.86" width="12.57" height="1.57" style="fill:#fff"/><rect x="6.74" y="14.14" width="12.57" height="1.57" style="fill:#fff"/><rect x="6.74" y="22" width="12.57" height="1.57" style="fill:#fff"/></svg>
\ No newline at end of file diff --git a/src/settingsui/settingsuiplugin/newIcons/display_icon.svg b/src/settingsui/settingsuiplugin/newIcons/display_icon.svg new file mode 100644 index 0000000..598d2ee --- /dev/null +++ b/src/settingsui/settingsuiplugin/newIcons/display_icon.svg @@ -0,0 +1 @@ +<svg id="display" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><title>display_icon</title><path d="M42.16,32.5H1.83A1.83,1.83,0,0,1,0,30.67V5A1.83,1.83,0,0,1,1.83,3.17H42.16A1.83,1.83,0,0,1,44,5V30.67a1.83,1.83,0,0,1-1.84,1.83ZM3.67,28.84H40.33v-22H3.67v22Z" style="fill:#fff"/><path d="M28.76,40.83H15.24a1.83,1.83,0,1,1,0-3.67H28.76a1.83,1.83,0,1,1,0,3.67Z" style="fill:#fff"/><path d="M17.34,40.29a1.83,1.83,0,0,1-1.83-1.83V31.05a1.83,1.83,0,1,1,3.67,0v7.41a1.83,1.83,0,0,1-1.83,1.83Z" style="fill:#fff"/><path d="M26.66,40.29a1.83,1.83,0,0,1-1.83-1.83V31.05a1.83,1.83,0,1,1,3.67,0v7.41a1.83,1.83,0,0,1-1.83,1.83Z" style="fill:#fff"/></svg>
\ No newline at end of file diff --git a/src/settingsui/settingsuiplugin/newIcons/grid_icon.svg b/src/settingsui/settingsuiplugin/newIcons/grid_icon.svg new file mode 100644 index 0000000..decd8e2 --- /dev/null +++ b/src/settingsui/settingsuiplugin/newIcons/grid_icon.svg @@ -0,0 +1 @@ +<svg id="grid" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><title>grid_icon</title><path d="M42.31,5.08H1.69A1.69,1.69,0,0,0,0,6.77V37.23a1.69,1.69,0,0,0,1.69,1.69H42.31A1.69,1.69,0,0,0,44,37.23V6.77A1.69,1.69,0,0,0,42.31,5.08ZM40.62,21.26H29.19V8.46H40.62Zm-23.79,0V8.46H27.24v12.8Zm10.41,1.3v13H16.83v-13ZM14.88,8.46v12.8H3.39V8.46ZM3.39,22.56H14.88v13H3.39Zm25.81,13v-13H40.62v13Z" style="fill:#fff"/></svg>
\ No newline at end of file diff --git a/src/settingsui/settingsuiplugin/newIcons/header_toggle_icon.svg b/src/settingsui/settingsuiplugin/newIcons/header_toggle_icon.svg new file mode 100644 index 0000000..06d0b6a --- /dev/null +++ b/src/settingsui/settingsuiplugin/newIcons/header_toggle_icon.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><title>header_toggle_icon</title><g style="isolation:isolate"><g id="toggle"><g style="opacity:0.35000000000000003;mix-blend-mode:multiply"><polygon points="3.36 15 23.27 33 42.64 15 3.36 15" style="fill:none;stroke:#09102b;stroke-linejoin:round;stroke-width:2px"/></g><polygon points="2.36 13 22.27 31 41.64 13 2.36 13" style="fill:none;stroke:#fff;stroke-linejoin:round;stroke-width:2px"/></g></g></svg>
\ No newline at end of file diff --git a/src/settingsui/settingsuiplugin/newIcons/info_icon.svg b/src/settingsui/settingsuiplugin/newIcons/info_icon.svg new file mode 100644 index 0000000..64d24c0 --- /dev/null +++ b/src/settingsui/settingsuiplugin/newIcons/info_icon.svg @@ -0,0 +1 @@ +<svg id="info" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><title>info_icon</title><path d="M21.86,15.59a2,2,0,0,1-1.33-.48A1.69,1.69,0,0,1,20,13.77a1.68,1.68,0,0,1,.56-1.3A1.91,1.91,0,0,1,21.86,12a1.93,1.93,0,0,1,1.28.46,1.65,1.65,0,0,1,.56,1.35,1.7,1.7,0,0,1-.54,1.34,1.88,1.88,0,0,1-1.29.48m1.83,3.83V30.14a2.39,2.39,0,0,1-.53,1.68,1.76,1.76,0,0,1-1.35.57,1.67,1.67,0,0,1-1.32-.58A2.47,2.47,0,0,1,20,30.14V19.53a2.38,2.38,0,0,1,.51-1.66,1.71,1.71,0,0,1,1.32-.56,1.78,1.78,0,0,1,1.35.56,2.16,2.16,0,0,1,.53,1.55" style="fill:#fff"/><path d="M21.89,43.5A21.5,21.5,0,0,1,6.7,6.8,21.5,21.5,0,0,1,37.11,37.2a21.38,21.38,0,0,1-15.21,6.3m0-39.35A17.85,17.85,0,0,0,9.28,34.62,17.85,17.85,0,1,0,34.52,9.38,17.73,17.73,0,0,0,21.9,4.15" style="fill:#fff"/></svg>
\ No newline at end of file diff --git a/src/settingsui/settingsuiplugin/newIcons/language_icon.svg b/src/settingsui/settingsuiplugin/newIcons/language_icon.svg new file mode 100644 index 0000000..f1235c5 --- /dev/null +++ b/src/settingsui/settingsuiplugin/newIcons/language_icon.svg @@ -0,0 +1 @@ +<svg id="language" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><title>language_icon</title><path d="M22,43.5A21.5,21.5,0,1,1,43.5,22,21.52,21.52,0,0,1,22,43.5ZM22,4.12A17.88,17.88,0,1,0,39.88,22,17.9,17.9,0,0,0,22,4.12Z" style="fill:#fff"/><path d="M22,42.6C15.22,42.6,9.7,33.36,9.7,22S15.22,1.41,22,1.41,34.29,10.64,34.29,22,28.78,42.6,22,42.6ZM22,3.22c-5.78,0-10.48,8.43-10.48,18.78S16.22,40.78,22,40.78,32.48,32.36,32.48,22,27.78,3.22,22,3.22Z" style="fill:#fff"/><path d="M22,42.6a.9.9,0,0,1-.91-.91V2.31A.9.9,0,0,1,22,1.41,20.59,20.59,0,0,1,22,42.6ZM22.9,3.24V40.76a18.78,18.78,0,0,0,0-37.53Z" style="fill:#fff"/><path d="M40.41,29.85H3.59a.91.91,0,0,1-.85-.59,20.37,20.37,0,0,1,0-14.52.91.91,0,0,1,.85-.59H40.41a.91.91,0,0,1,.85.59,20.34,20.34,0,0,1,0,14.52.91.91,0,0,1-.85.59ZM4.23,28H39.77a18.45,18.45,0,0,0,0-12.07H4.23A18.49,18.49,0,0,0,4.23,28Z" style="fill:#fff"/></svg>
\ No newline at end of file diff --git a/src/settingsui/settingsuiplugin/newIcons/mouse_icon.svg b/src/settingsui/settingsuiplugin/newIcons/mouse_icon.svg new file mode 100644 index 0000000..5843fe1 --- /dev/null +++ b/src/settingsui/settingsuiplugin/newIcons/mouse_icon.svg @@ -0,0 +1 @@ +<svg id="mouse" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 44 44"><defs><clipPath id="clip-path"><polygon points="26.94 20.62 29.12 14.45 30.87 5.33 28.23 5.83 22.8 4.3 18.92 7.24 9.96 3.31 29 -5.98 42.56 8.54 26.94 20.62" style="fill:none"/></clipPath></defs><title>mouse_icon</title><path d="M5,22.1a1.06,1.06,0,0,1,0-1.5l4.23-4.25a1.06,1.06,0,0,1,1.5,0l8.48,8.46h0a1.06,1.06,0,0,1,0,1.5L15,30.56a1.06,1.06,0,0,1-1.5,0L5,22.1Zm5-3.5L7.24,21.35l7,7,2.73-2.74-7-7Z" style="fill:#fff"/><path d="M24.18,5.35a1,1,0,0,1,0,1.36l-4.41,4.41a3.68,3.68,0,0,1,.77.48l4.33-4.44a1,1,0,0,1,1.36,1.36l-4.31,4.42.62.62,4.12-4.23A1,1,0,1,1,28,10.68l-4.15,4.26a6,6,0,0,1,.5.81l4-4a.86.86,0,0,1,1.27,0,1,1,0,0,1,0,1.36L24,18.8,22.73,20,19.5,23.26a2.38,2.38,0,0,1-1.39.66l-6.57-6.56a2.59,2.59,0,0,1,.22-.76l1.38-5a1,1,0,0,1,.26-.44l3.05-3.05a.91.91,0,1,1,1.29,1.29L16.5,10.62l-.22,1.26,6.54-6.54a1,1,0,0,1,1.36,0m1.5-1.5a3.09,3.09,0,0,0-4.36,0l-2.4,2.4a3.07,3.07,0,0,0-4,.34L11.9,9.64A3.12,3.12,0,0,0,11.09,11L9.76,15.89a4.74,4.74,0,0,0-.32,1.19,2.12,2.12,0,0,0,.6,1.79h0l6.56,6.56a2.12,2.12,0,0,0,1.78.6A4.48,4.48,0,0,0,21,24.76l3.23-3.23,1.23-1.23,5.41-5.49a3.09,3.09,0,0,0,0-4.36,3,3,0,0,0-.7-.52,3.08,3.08,0,0,0-1.85-2.51,3.08,3.08,0,0,0-.64-1.31,2.33,2.33,0,0,0-1.14-.53,3.07,3.07,0,0,0-.87-1.74Z" style="fill:#fff"/><g style="clip-path:url(#clip-path)"><path d="M18.34,16.84A9,9,0,0,1,16.4,14c-1.14-2.88,1-6.75,2.41-8.18l4.11-4.11a4.79,4.79,0,0,1,6.63,0l4,4a4.8,4.8,0,0,1,0,6.66l-4.1,4.1c-1.44,1.41-5.3,3.56-8.17,2.42a9,9,0,0,1-2.9-1.95Zm14-10.08L28.4,2.85a3.14,3.14,0,0,0-4.28,0L20,7c-1.32,1.35-2.78,4.51-2,6.37a7.43,7.43,0,0,0,3.92,3.91c1.84.73,5-.73,6.36-2.06l4.1-4.1a3.15,3.15,0,0,0,0-4.32Z" style="fill:#fff"/></g><path d="M37,25.09a1.16,1.16,0,0,1-.51-.12,5.58,5.58,0,0,1-3.22-3.78,7.76,7.76,0,0,1,1.65-6.1c.68-.86,1.4-1.67,2.1-2.44,2.18-2.42,4.06-4.51,3.51-7.11a3.24,3.24,0,0,0-2.21-2.48c-1.87-.62-4.3.1-6.35,1.88a1.16,1.16,0,1,1-1.53-1.76C33.1.82,36.32-.06,39,.84A5.56,5.56,0,0,1,42.76,5c.81,3.76-1.66,6.51-4.05,9.16-.67.75-1.37,1.53-2,2.33a5.5,5.5,0,0,0-1.21,4.14,3.31,3.31,0,0,0,2,2.21A1.17,1.17,0,0,1,37,25.09Z" style="fill:#fff"/><path d="M1.08,35.78h2l1.59,5.57,1.59-5.57h2v7.13H7.13V37.06H7L5.29,42.62H4.08L2.39,37.06H2.24v5.85H1.08Z" style="fill:#fff"/><path d="M9.62,39.38c0-2.38.68-3.71,2.9-3.71s2.89,1.32,2.89,3.71S14.75,43,12.52,43,9.62,41.78,9.62,39.38Zm4.6,0c0-1.77-.32-2.7-1.7-2.7s-1.71.94-1.71,2.7S11.14,42,12.52,42,14.22,41.19,14.22,39.38Z" style="fill:#fff"/><path d="M19.31,42c1,0,1.47-.43,1.47-1.38V35.78h1.17v4.83c0,1.72-.93,2.41-2.63,2.41s-2.61-.7-2.61-2.41V35.78h1.17v4.85C17.86,41.6,18.36,42,19.31,42Z" style="fill:#fff"/><path d="M27.68,36.84s-1.46-.17-2.06-.17c-.87,0-1.32.31-1.32.93s.37.82,1.59,1.15c1.5.42,2,.81,2,2A2.09,2.09,0,0,1,25.54,43a15.19,15.19,0,0,1-2.33-.28l.11-.93s1.41.19,2.14.19,1.29-.4,1.29-1.14-.32-.81-1.41-1.07c-1.54-.4-2.21-.86-2.21-2.1,0-1.44.95-2,2.37-2a15.76,15.76,0,0,1,2.26.25Z" style="fill:#fff"/><path d="M29.18,35.78h4.49v1H30.33v2H33v1H30.33v2.08h3.34v1H29.18Z" style="fill:#fff"/></svg>
\ No newline at end of file diff --git a/src/settingsui/settingsuiplugin/newIcons/mute_icon.svg b/src/settingsui/settingsuiplugin/newIcons/mute_icon.svg new file mode 100644 index 0000000..2ffd61f --- /dev/null +++ b/src/settingsui/settingsuiplugin/newIcons/mute_icon.svg @@ -0,0 +1 @@ +<svg id="mute" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><title>mute_icon</title><path d="M17.92,40.48A2,2,0,0,1,16.68,40L7.59,32.77H2a2,2,0,0,1-2-2V13.22a2,2,0,0,1,2-2h5.6L16.68,4A2,2,0,0,1,19.9,5.5v33a2,2,0,0,1-2,2ZM4,28.8H8.29a2,2,0,0,1,1.24.44l6.41,5.13V9.64L9.52,14.77a2,2,0,0,1-1.24.44H4V28.8Z" style="fill:#fff"/><path d="M42,32.41a2,2,0,0,1-1.4-.58L23.77,15a2,2,0,0,1,2.81-2.81L43.42,29A2,2,0,0,1,42,32.41Z" style="fill:#fff"/><path d="M25.29,32.52a2,2,0,0,1-1.42-3.37L40.48,12.08a2,2,0,0,1,2.85,2.77L26.71,31.92a2,2,0,0,1-1.42.6Z" style="fill:#fff"/></svg>
\ No newline at end of file diff --git a/src/settingsui/settingsuiplugin/newIcons/network_icon.svg b/src/settingsui/settingsuiplugin/newIcons/network_icon.svg new file mode 100644 index 0000000..6280828 --- /dev/null +++ b/src/settingsui/settingsuiplugin/newIcons/network_icon.svg @@ -0,0 +1 @@ +<svg id="network" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><title>network_icon</title><path d="M8.22,28.71A6.71,6.71,0,1,1,14.93,22a6.72,6.72,0,0,1-6.71,6.71Zm0-10A3.25,3.25,0,1,0,11.47,22a3.25,3.25,0,0,0-3.25-3.25Z" style="fill:#fff"/><path d="M35.78,13.92a6.71,6.71,0,1,1,6.71-6.71,6.72,6.72,0,0,1-6.71,6.71Zm0-10A3.25,3.25,0,1,0,39,7.21,3.25,3.25,0,0,0,35.78,4Z" style="fill:#fff"/><path d="M35.78,43.5a6.71,6.71,0,1,1,6.71-6.71,6.72,6.72,0,0,1-6.71,6.71Zm0-10A3.25,3.25,0,1,0,39,36.79a3.25,3.25,0,0,0-3.25-3.25Z" style="fill:#fff"/><path d="M30.66,35.89a1.73,1.73,0,0,1-.86-.23L12.12,25.46a1.73,1.73,0,0,1,1.73-3L31.52,32.66a1.73,1.73,0,0,1-.87,3.23Z" style="fill:#fff"/><path d="M13,21.77a1.73,1.73,0,0,1-.87-3.23L29.79,8.34a1.73,1.73,0,1,1,1.73,3L13.85,21.54a1.71,1.71,0,0,1-.86.23Z" style="fill:#fff"/></svg>
\ No newline at end of file diff --git a/src/settingsui/settingsuiplugin/newIcons/pause_icon.svg b/src/settingsui/settingsuiplugin/newIcons/pause_icon.svg new file mode 100644 index 0000000..04000f9 --- /dev/null +++ b/src/settingsui/settingsuiplugin/newIcons/pause_icon.svg @@ -0,0 +1 @@ +<svg id="pause" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><title>pause_icon</title><path d="M15.51,43.5H9.76a4.65,4.65,0,0,1-4.64-4.64V5.14A4.65,4.65,0,0,1,9.76.5h5.75a4.65,4.65,0,0,1,4.64,4.64V38.86a4.65,4.65,0,0,1-4.64,4.64ZM9.76,4.55a.6.6,0,0,0-.59.59V38.86a.6.6,0,0,0,.59.59h5.75a.6.6,0,0,0,.59-.59V5.14a.6.6,0,0,0-.59-.59Z" style="fill:#fff"/><path d="M34.24,43.5H28.49a4.65,4.65,0,0,1-4.64-4.64V5.14A4.65,4.65,0,0,1,28.49.5h5.75a4.65,4.65,0,0,1,4.64,4.64V38.86a4.65,4.65,0,0,1-4.64,4.64ZM28.49,4.55a.6.6,0,0,0-.59.59V38.86a.6.6,0,0,0,.59.59h5.75a.6.6,0,0,0,.59-.59V5.14a.6.6,0,0,0-.59-.59Z" style="fill:#fff"/></svg>
\ No newline at end of file diff --git a/src/settingsui/settingsuiplugin/newIcons/play_icon.svg b/src/settingsui/settingsuiplugin/newIcons/play_icon.svg new file mode 100644 index 0000000..ab27771 --- /dev/null +++ b/src/settingsui/settingsuiplugin/newIcons/play_icon.svg @@ -0,0 +1 @@ +<svg id="play" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><title>play_icon</title><path d="M6.58,43.82c-2.4,0-4.08-1.91-4.08-4.65V4.83C2.5,2.09,4.18.18,6.58.18A5.29,5.29,0,0,1,9.22.95L39,18.12A4.56,4.56,0,0,1,41.5,22,4.56,4.56,0,0,1,39,25.88L9.22,43.05a5.28,5.28,0,0,1-2.65.77ZM6.64,4.28a5.24,5.24,0,0,0,0,.55V39.17a1.56,1.56,0,0,0,.08.55,1.74,1.74,0,0,0,.51-.21L36.92,22.33a1.61,1.61,0,0,0,.46-.36c-.06,0-.19-.16-.46-.31L7.18,4.49a1.6,1.6,0,0,0-.54-.22Z" style="fill:#fff"/></svg>
\ No newline at end of file diff --git a/src/settingsui/settingsuiplugin/newIcons/power_icon.svg b/src/settingsui/settingsuiplugin/newIcons/power_icon.svg new file mode 100644 index 0000000..b922c0e --- /dev/null +++ b/src/settingsui/settingsuiplugin/newIcons/power_icon.svg @@ -0,0 +1 @@ +<svg id="power" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><title>power_icon</title><path d="M22,17.4a1.82,1.82,0,0,1-1.82-1.82V2.3a1.82,1.82,0,0,1,3.65,0V15.57A1.82,1.82,0,0,1,22,17.4Z" style="fill:#fff"/><path d="M22,43.48A19.15,19.15,0,0,1,15.7,6.25,1.82,1.82,0,0,1,16.9,9.7a15.51,15.51,0,1,0,10.19,0,1.82,1.82,0,0,1,1.2-3.45A19.15,19.15,0,0,1,22,43.48Z" style="fill:#fff"/></svg>
\ No newline at end of file diff --git a/src/settingsui/settingsuiplugin/newIcons/qt_logo_green_rgb.svg b/src/settingsui/settingsuiplugin/newIcons/qt_logo_green_rgb.svg new file mode 100644 index 0000000..bdb07d1 --- /dev/null +++ b/src/settingsui/settingsuiplugin/newIcons/qt_logo_green_rgb.svg @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generator: Adobe Illustrator 20.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> +<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" + viewBox="0 0 293.4 216.1" style="enable-background:new 0 0 293.4 216.1;" xml:space="preserve"> +<style type="text/css"> + .st0{fill:#41CD52;} + .st1{fill:#FFFFFF;} +</style> +<g> + <polygon class="st0" points="265.2,0 255,0 40.7,0 40.7,0 0,40.7 0,176.8 0,187.9 0,216.1 28.2,216.1 38.4,216.1 252.7,216.1 + 252.7,216.1 293.4,175.4 293.4,39.3 293.4,28.2 293.4,0 "/> + <path class="st1" d="M109.2,169.2c-19.3,0-32.8-5.2-40.4-15.6c-7.6-10.4-11.4-26.9-11.4-49.3c0-22.5,3.9-39.2,11.6-50.1 + c7.7-10.9,21.2-16.4,40.2-16.4c19.1,0,32.5,5.4,40.1,16.3c7.7,10.8,11.5,27.5,11.5,50.1c0,14.9-1.6,26.9-4.7,36 + c-3.2,9.2-8.3,16.2-15.5,21l15.6,25.1l-19.1,8.9l-16.5-27.1C118.2,168.9,114.4,169.2,109.2,169.2z M85.1,140.3 + c4.2,7.2,12.3,10.9,24.2,10.9s19.9-3.6,24.1-10.7c4.1-7.1,6.2-19.2,6.2-36.1c0-17-2.1-29.3-6.4-37S121,55.9,109.3,55.9 + c-11.6,0-19.6,3.8-24,11.5c-4.3,7.7-6.5,19.9-6.5,36.8C78.8,121,80.9,133.1,85.1,140.3z"/> + <path class="st1" d="M232.4,89.2h-25.6v40.9c0,7.6,0.6,12.6,1.7,15.1s4,3.7,8.5,3.7l15.2-0.6l0.9,16.2c-8.3,1.6-14.6,2.4-19,2.4 + c-10.5,0-17.7-2.4-21.6-7.2c-3.9-4.8-5.9-13.9-5.9-27.3V89.3h-14.1V72h14.2V45.1h20.1V72h25.6V89.2z"/> +</g> +</svg> diff --git a/src/settingsui/settingsuiplugin/newIcons/settings_icon.svg b/src/settingsui/settingsuiplugin/newIcons/settings_icon.svg new file mode 100644 index 0000000..7f5dbde --- /dev/null +++ b/src/settingsui/settingsuiplugin/newIcons/settings_icon.svg @@ -0,0 +1 @@ +<svg id="settings" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><title>settings_icon</title><path d="M41,17.82H35a14.73,14.73,0,0,0-1.47-3.24l4-4a2.38,2.38,0,0,0,0-3.38L35.83,5.53a2.39,2.39,0,0,0-3.38,0l-4,4a14.34,14.34,0,0,0-3.53-1.43V2.89A2.39,2.39,0,0,0,22.49.5H20.1a2.39,2.39,0,0,0-2.39,2.39V8.14a14,14,0,0,0-3.84,1.61L10.49,6.37a2.4,2.4,0,0,0-3.38,0L5.42,8.06a2.4,2.4,0,0,0,0,3.38l3.44,3.44A14.24,14.24,0,0,0,7.28,19H2.79A2.39,2.39,0,0,0,.39,21.4v2.39a2.39,2.39,0,0,0,2.39,2.38h4.8a14,14,0,0,0,1.93,4L6.27,33.4a2.4,2.4,0,0,0,0,3.38L8,38.47a2.4,2.4,0,0,0,3.38,0L15,34.84a13.89,13.89,0,0,0,3.94,1.27v5A2.4,2.4,0,0,0,21.3,43.5h2.39a2.4,2.4,0,0,0,2.39-2.39V35.5a14,14,0,0,0,3.38-1.72l3.85,3.85a2.4,2.4,0,0,0,3.38,0l1.69-1.69a2.38,2.38,0,0,0,0-3.38l-4.21-4.22A14.15,14.15,0,0,0,35.31,25H41a2.39,2.39,0,0,0,2.39-2.39V20.21A2.4,2.4,0,0,0,41,17.82ZM21.3,31.5A9.5,9.5,0,1,1,30.8,22,9.5,9.5,0,0,1,21.3,31.5Z" style="fill:#fff"/></svg>
\ No newline at end of file diff --git a/src/settingsui/settingsuiplugin/newIcons/settingsmenu_launcher_icon.svg b/src/settingsui/settingsuiplugin/newIcons/settingsmenu_launcher_icon.svg new file mode 100644 index 0000000..479a79f --- /dev/null +++ b/src/settingsui/settingsuiplugin/newIcons/settingsmenu_launcher_icon.svg @@ -0,0 +1 @@ +<svg id="settings_menu_launcher" data-name="settings menu launcher" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><title>settingsmenu_launcher_icon</title><rect y="1.86" width="44" height="9.43" style="fill:#9d9faa"/><rect y="17.57" width="44" height="9.43" style="fill:#9d9faa"/><rect y="33.29" width="44" height="7.86" style="fill:#9d9faa"/><rect y="1.86" width="44" height="9.43" style="fill:#9ca0aa"/><rect y="17.57" width="44" height="9.43" style="fill:#9ca0aa"/><rect y="33.29" width="44" height="7.86" style="fill:#9ca0aa"/></svg>
\ No newline at end of file diff --git a/src/settingsui/settingsuiplugin/newIcons/stop_icon.svg b/src/settingsui/settingsuiplugin/newIcons/stop_icon.svg new file mode 100644 index 0000000..2eeff5f --- /dev/null +++ b/src/settingsui/settingsuiplugin/newIcons/stop_icon.svg @@ -0,0 +1 @@ +<svg id="stop" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><title>stop_icon</title><path d="M37.66,44H6.34A6.35,6.35,0,0,1,0,37.66V6.34A6.35,6.35,0,0,1,6.34,0H37.66A6.35,6.35,0,0,1,44,6.34V37.66A6.35,6.35,0,0,1,37.66,44ZM6.34,4.14a2.2,2.2,0,0,0-2.2,2.2V37.66a2.2,2.2,0,0,0,2.2,2.2H37.66a2.2,2.2,0,0,0,2.2-2.2V6.34a2.2,2.2,0,0,0-2.2-2.2Z" style="fill:#fff"/></svg>
\ No newline at end of file diff --git a/src/settingsui/settingsuiplugin/newIcons/touch_icon.svg b/src/settingsui/settingsuiplugin/newIcons/touch_icon.svg new file mode 100644 index 0000000..40ce016 --- /dev/null +++ b/src/settingsui/settingsuiplugin/newIcons/touch_icon.svg @@ -0,0 +1 @@ +<svg id="touch" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><title>touch_icon</title><path d="M10.64,21.23a1.06,1.06,0,0,1,0-1.5l4.23-4.25a1.06,1.06,0,0,1,1.5,0l8.48,8.46h0a1.06,1.06,0,0,1,0,1.5l-4.24,4.25a1.06,1.06,0,0,1-1.5,0l-8.47-8.45Zm5-3.5-2.74,2.74,7,7,2.73-2.74-7-7Z" style="fill:#fff"/><path d="M29.83,4.48a1,1,0,0,1,0,1.36l-4.41,4.41a3.68,3.68,0,0,1,.77.48l.44-.44A1,1,0,0,1,28,11.64l-.42.42.62.62.23-.23a1,1,0,1,1,1.36,1.36l-.25.25a3.68,3.68,0,0,1,.48.76,1,1,0,0,1,1.36,1.36l-1.74,1.74-1.23,1.23-3.23,3.23a2.38,2.38,0,0,1-1.39.66L17.2,16.49a2.52,2.52,0,0,1,.22-.76l1.37-5a1,1,0,0,1,.26-.44l3.05-3.05A.91.91,0,1,1,23.4,8.51L22.15,9.75,21.93,11l6.54-6.54a1,1,0,0,1,1.36,0M31.33,3A3.09,3.09,0,0,0,27,3l-2.4,2.4a3.08,3.08,0,0,0-4,.34L17.55,8.77a3.13,3.13,0,0,0-.81,1.39L15.42,15a4.74,4.74,0,0,0-.32,1.19A2.12,2.12,0,0,0,15.7,18h0l6.57,6.56a2.11,2.11,0,0,0,1.78.6,4.49,4.49,0,0,0,2.61-1.27l3.23-3.23,1.23-1.23,1.74-1.74a3.09,3.09,0,0,0,0-4.36,3,3,0,0,0-.7-.52,3.08,3.08,0,0,0-1.85-2.51A3.09,3.09,0,0,0,29.68,9l1.65-1.65a3.09,3.09,0,0,0,0-4.36Z" style="fill:#fff"/><path d="M6.65,34.69h5.2v1h-2v6.1H8.68v-6.1h-2Z" style="fill:#fff"/><path d="M12.38,38.29c0-2.38.68-3.71,2.9-3.71s2.89,1.32,2.89,3.71-.67,3.64-2.89,3.64S12.38,40.69,12.38,38.29Zm4.6,0c0-1.77-.32-2.7-1.7-2.7s-1.71.94-1.71,2.7.32,2.63,1.71,2.63S17,40.1,17,38.29Z" style="fill:#fff"/><path d="M22.07,40.92c1,0,1.47-.43,1.47-1.38V34.69H24.7v4.83c0,1.72-.93,2.41-2.63,2.41s-2.61-.7-2.61-2.41V34.69h1.17v4.85C20.62,40.5,21.12,40.92,22.07,40.92Z" style="fill:#fff"/><path d="M30.71,41.7a11.23,11.23,0,0,1-2,.23c-2.17,0-2.67-1.24-2.67-3.67s.54-3.68,2.67-3.68a10,10,0,0,1,2,.26l0,.94a13.25,13.25,0,0,0-1.84-.17c-1.31,0-1.63.64-1.63,2.65s.26,2.64,1.66,2.64a13.87,13.87,0,0,0,1.81-.16Z" style="fill:#fff"/><path d="M36.18,38.73H33.1v3.08H31.95V34.69H33.1v3h3.08v-3h1.17v7.13H36.18Z" style="fill:#fff"/></svg>
\ No newline at end of file diff --git a/src/settingsui/settingsuiplugin/newIcons/volume_icon.svg b/src/settingsui/settingsuiplugin/newIcons/volume_icon.svg new file mode 100644 index 0000000..12f944e --- /dev/null +++ b/src/settingsui/settingsuiplugin/newIcons/volume_icon.svg @@ -0,0 +1 @@ +<svg id="volume" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><title>volume_icon</title><path d="M33.13,40.13a2,2,0,0,1-1.4-3.39,20.87,20.87,0,0,0,0-29.48,2,2,0,1,1,2.81-2.81,24.85,24.85,0,0,1,0,35.09,2,2,0,0,1-1.4.58Z" style="fill:#fff"/><path d="M27.38,34.38A2,2,0,0,1,26,31a12.72,12.72,0,0,0,0-18,2,2,0,0,1,2.81-2.81,16.69,16.69,0,0,1,0,23.59,2,2,0,0,1-1.4.58Z" style="fill:#fff"/><path d="M20.13,40.48A2,2,0,0,1,18.89,40L9.8,32.77H4.19a2,2,0,0,1-2-2V13.22a2,2,0,0,1,2-2h5.6L18.89,4A2,2,0,0,1,22.12,5.5v33a2,2,0,0,1-2,2ZM6.18,28.8h4.32a2,2,0,0,1,1.24.44l6.41,5.13V9.64l-6.42,5.14a2,2,0,0,1-1.24.44H6.18V28.8Z" style="fill:#fff"/></svg>
\ No newline at end of file diff --git a/src/settingsui/settingsuiplugin/plugin.qrc b/src/settingsui/settingsuiplugin/plugin.qrc index 58cb4af..9449ab1 100644 --- a/src/settingsui/settingsuiplugin/plugin.qrc +++ b/src/settingsui/settingsuiplugin/plugin.qrc @@ -24,5 +24,13 @@ <file>../timedate/TimeDate.qml</file> <file>../timedate/TimezonesView.qml</file> <file>settingsview.xml</file> + <file>../power/Power.qml</file> + <file>../timedate/ManualTime.qml</file> + <file>../timedate/CustomComboBox.qml</file> + <file>../bluetooth/CustomSwitch.qml</file> + <file>../network/NetworkListView.qml</file> + <file>../network/PassphraseEnter.qml</file> + <file>../locale/TableKey.qml</file> + <file>../locale/TableValue.qml</file> </qresource> </RCC> diff --git a/src/settingsui/settingsuiplugin/pluginMain.qml b/src/settingsui/settingsuiplugin/pluginMain.qml index 3f15c57..e8df0de 100644 --- a/src/settingsui/settingsuiplugin/pluginMain.qml +++ b/src/settingsui/settingsuiplugin/pluginMain.qml @@ -32,134 +32,296 @@ 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 +import QtDemoLauncher.QtButtonImageProvider 1.0 -Rectangle { +Item { id: root anchors.fill: parent - color: "white" visible: true property var service + property int margin: (root.width / 3 * 2) * 0.05 + property alias model: xmlModel.source + property alias backgroundColor: background.color + signal closed() - ToolBar { - id: titlebar - property string title: "" - width: parent.width - height: 40 - z: 2 + Rectangle { + id: background + anchors.fill:parent + color: "#09102b" + } - ToolButton { - height: parent.height + Item { + id: header + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top + height: parent.height * 0.125 + + Image { + id: backButton + sourceSize.width: parent.width + sourceSize.height: parent.height + height: parent.height * 0.5 width: height - contentItem: Image { - fillMode: Image.PreserveAspectFit - source: "../icons/Chevron-left_black_6x.png" + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + anchors.margins: parent.height * .25 + fillMode: Image.PreserveAspectFit + source: "../newIcons/back_icon.svg" + MouseArea { anchors.fill: parent - anchors.margins: parent.height * .2 + onClicked: { + root.closed() + } } - - visible: stackView.depth > 1 - onClicked: stackView.pop(); } - Label { - id: titleText - font.pixelSize: 20 - text: stackView.currentItem.title - horizontalAlignment: Qt.AlignHCenter - verticalAlignment: Qt.AlignVCenter - anchors.centerIn: parent + + Text { + id: settingsText + anchors.left: backButton.right + anchors.verticalCenter: parent.verticalCenter + font.pixelSize: parent.height * 0.45 + text: qsTr("Settings") + color: "white" + font.family: appFont + font.styleName: "SemiBold" } - ToolButton { + + Item { + id: ipItem + width: parent.width * 0.25 height: parent.height - width: height - contentItem: Image { - fillMode: Image.PreserveAspectFit - source: "../icons/Power_black_6x.png" + anchors.right: parent.right + anchors.rightMargin: root.margin + property alias ipAddressText: ipText.text + property var lastService + property var currentService: NetworkSettingsManager.services.itemFromRow(0) + Text { + id: ipText anchors.fill: parent - anchors.margins: parent.height * .2 + horizontalAlignment: Text.AlignRight + verticalAlignment: Text.AlignVCenter + font.pixelSize: parent.height * 0.25 + color: "white" + text: qsTr("Device IP: ") + font.family: appFont + font.styleName: "SemiBold" } - anchors.right: parent.right - visible: stackView.depth === 1 - onClicked: menu.open(); + MouseArea { + anchors.fill: parent + onClicked: { + parent.refreshIP() + } + } - Menu { - id: menu - x: parent.width - width + function refreshIP() { + var networkCount = NetworkSettingsManager.services.sourceModel.rowCount(); + var ipAddress = "Not Found"; + for (var i = 0; i < networkCount; ++i) { + var networkService = NetworkSettingsManager.services.itemFromRow(i); + var tmp = NetworkSettingsManager.services.itemFromRow(i).ipv4.address; + if (tmp !== "" && ipAddress === "Not Found") + ipAddress = tmp; - MenuItem { - text: qsTr("Reboot") - onTriggered: LocalDevice.reboot() + if (networkService.type === NetworkSettingsType.Wired && + (networkService.status === NetworkSettingsState.Ready || + networkService.status === NetworkSettingsState.Online)) { + break; + } } - MenuItem { - text: qsTr("Shutdown") - onTriggered: LocalDevice.powerOff() + ipText.text = qsTr("Device IP: ") + ipAddress; + } + + Component.onCompleted: { + var networkCount = NetworkSettingsManager.services.sourceModel.rowCount(); + for (var i = 0; i < networkCount; ++i) { + NetworkSettingsManager.services.itemFromRow(i).ipv4Changed.connect(refreshIP); } + refreshIP() } } } - - StackView { - id: stackView - initialItem: mainView - anchors.top: titlebar.bottom - anchors.bottom: parent.bottom + Item { + id: listHolder + anchors.top: header.bottom anchors.left: parent.left - anchors.right: parent.right + anchors.bottom: parent.bottom + width: parent.width / 3 + + XmlListModel { + id: xmlModel + source: "settingsview.xml" + query: "/xml/settings/item" + XmlRole { name: "title"; query: "title/string()"} + XmlRole { name: "icon"; query: "icon/string()"} + XmlRole { name: "view"; query: "view/string()"} + XmlRole { name: "path"; query: "path/string()"} + } + + ListView { + id: settingsList + anchors.fill: parent - Component { - id: mainView + model: xmlModel + delegate: Item { + id: delegateItem + width: settingsList.width + height: settingsList.height * 0.08 - Item { - property string title: qsTr("Device Settings") + property bool isSelected: settingsList.currentIndex == index - XmlListModel { - id: xmlModel - source: "settingsview.xml" - query: "/xml/settings/item" - XmlRole { name: "title"; query: "title/string()"} - XmlRole { name: "icon"; query: "icon/string()"} - XmlRole { name: "view"; query: "view/string()"} - XmlRole { name: "path"; query: "path/string()"} + Image { + id: img + sourceSize.width: parent.width + sourceSize.height: parent.height + source: icon + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: parent.width * 0.075 + height: Math.min(parent.width * 0.5, parent.height * 0.6) + width: height + fillMode: Image.PreserveAspectFit + visible: parent.isSelected ? false : true + } + ColorOverlay { + source: img + anchors.fill: img + visible: parent.isSelected ? true : false + color: "#41cd52" } - GridView { - id: grid + Label { + text: title + height: parent.height * 0.75 + anchors.right: parent.right + anchors.left: img.right + anchors.leftMargin: parent.width * 0.025 + anchors.verticalCenter: parent.verticalCenter + fontSizeMode: Text.Fit + minimumPixelSize: 1 + font.pixelSize: Math.min(parent.width * 0.25, parent.height) + color: parent.isSelected ? "#41cd52" : "white" + wrapMode: Text.WordWrap + verticalAlignment: Text.AlignVCenter + font.family: appFont + font.styleName: parent.isSelected ? "Bold" : "Regular" + } + MouseArea { + id: mouseArea anchors.fill: parent - anchors.margins: 40 - cellHeight: 133 + spacing - cellWidth: 117 + spacing - model: xmlModel - property int spacing: 20 - delegate: MouseArea { - width: grid.cellWidth - grid.spacing - height: grid.cellHeight - grid.spacing - - Rectangle { - anchors.fill: parent - color: "#d6d6d6" - radius: 5 - visible: pressed - } - Column { - anchors.fill: parent - anchors.topMargin: 10 - Image { - id: image - source: icon - anchors.horizontalCenter: parent.horizontalCenter - width: grid.cellWidth - fillMode: Image.PreserveAspectFit - } - Label { - text: title - anchors.horizontalCenter: parent.horizontalCenter - font.pixelSize: grid.cellHeight * .1 - } - } - onClicked: { - var component = Qt.createComponent(path+'/'+view+'.qml'); - stackView.push(component.createObject(stackView)); - } + onClicked: { + settingsList.currentIndex = index + settingsLoader.source = path + '/' + view + '.qml' + } + } + Component.onCompleted: { + if (xmlModel.count == 0) { + console.error("Empty xmlModel") + return } + settingsLoader.source = xmlModel.get(0).path + '/' + xmlModel.get(0).view + '.qml' + } + } + } + } + + Rectangle { + id: rightLine + width: parent.width * 0.002 + height: parent.height * 0.8 + anchors.horizontalCenter: listHolder.right + anchors.top: header.bottom + color: "#9d9faa" + } + + Item { + id: loaderItem + anchors.top: header.bottom + anchors.left: listHolder.right + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.bottomMargin: root.margin + anchors.leftMargin: root.margin + anchors.rightMargin: root.margin + + Loader { + id: settingsLoader + anchors.fill: parent + } + } + + Popup { + id: shutdownPopup + width: parent.width + height: parent.height + leftPadding: width * 0.3 + rightPadding: leftPadding + topPadding: height * 0.275 + bottomPadding: topPadding + + property alias powerOffText: poweroffConfirmText.text + property alias buttonText: shutdownConfirm.text + + background: Rectangle { + color: "#09102b" + opacity: 0.9 + } + contentItem: Rectangle { + color: "#09102b" + border.color: "#9d9faa" + border.width: 3 + Text { + id: poweroffConfirmText + width: parent.width * 0.75 + height: parent.height * 0.1 + anchors.top: parent.top + anchors.topMargin: parent.height * 0.175 + anchors.horizontalCenter: parent.horizontalCenter + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + fontSizeMode: Text.Fit + minimumPixelSize: 1 + font.pixelSize: height * 0.9 + color: "white" + font.family: appFont + font.styleName: "Light" + } + QtButton { + id: shutdownConfirm + width: parent.width * 0.5 + height: parent.height * 0.15 + anchors.top: poweroffConfirmText.bottom + anchors.topMargin: parent.height * 0.15 + anchors.horizontalCenter: parent.horizontalCenter + fillColor: "#41cd52" + borderColor: "transparent" + + onClicked: { + if (shutdownConfirm.text === qsTr("SHUT DOWN")) { + console.log("Powering off!") + LocalDevice.powerOff() + } + else if (shutdownConfirm.text === qsTr("REBOOT")) { + console.log("Rebooting!") + LocalDevice.reboot() + } + } + } + QtButton { + id: shutdownCancel + width: parent.width * 0.5 + height: parent.height * 0.15 + anchors.top: shutdownConfirm.bottom + anchors.topMargin: parent.height * 0.1 + anchors.horizontalCenter: parent.horizontalCenter + fillColor: "#9d9faa" + borderColor: "transparent" + text: qsTr("CANCEL") + + onClicked: { + shutdownPopup.close() } } } diff --git a/src/settingsui/settingsuiplugin/settingsview.xml b/src/settingsui/settingsuiplugin/settingsview.xml index 23915db..2749cb8 100644 --- a/src/settingsui/settingsuiplugin/settingsview.xml +++ b/src/settingsui/settingsuiplugin/settingsview.xml @@ -5,31 +5,37 @@ <title>Network</title> <view>NetworkSettings</view> <path>network</path> - <icon>icons/World_qt_6x.png</icon> + <icon>newIcons/network_icon.svg</icon> </item> <item> <title>Display</title> <view>Display</view> <path>display</path> - <icon>icons/Display_qt_6x.png</icon> + <icon>newIcons/display_icon.svg</icon> </item> <item> - <title>Date and Time</title> + <title>Date & Time</title> <view>TimeDate</view> <path>timedate</path> - <icon>icons/Clock_qt_6x.png</icon> + <icon>newIcons/date-time_icon.svg</icon> </item> <item> - <title>Language</title> + <title>Language & Region</title> <view>Language</view> <path>locale</path> - <icon>icons/Flag_qt_6x.png</icon> + <icon>newIcons/language_icon.svg</icon> </item> <item> <title>Bluetooth</title> <view>Bluetooth</view> <path>bluetooth</path> - <icon>icons/Bluetooth_qt_6x.png</icon> + <icon>newIcons/bluetooth_icon.svg</icon> + </item> + <item> + <title>Power</title> + <view>Power</view> + <path>power</path> + <icon>newIcons/power_icon.svg</icon> </item> </settings> </xml> diff --git a/src/settingsui/timedate/CustomComboBox.qml b/src/settingsui/timedate/CustomComboBox.qml new file mode 100644 index 0000000..22c0bd1 --- /dev/null +++ b/src/settingsui/timedate/CustomComboBox.qml @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** 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 + delegate: ItemDelegate { + id: del + background: Item {} + width: comboBox.width + contentItem: Text { + anchors.left: del.left + anchors.leftMargin: del.width * 0.15 + verticalAlignment: Text.AlignVCenter + font.pixelSize: comboBox.height * 0.375 + color: comboBox.currentIndex == index ? "#41cd52" : "white" + text: modelData + font.family: appFont + font.styleName: comboBox.currentIndex == index ? "Bold" : "Regular" + elide: Text.ElideRight + } + } + indicator: Image { + id: indicatorImage + height: comboBox.height * 0.4 + anchors.right: comboBox.right + anchors.rightMargin: comboBox.width * 0.15 + anchors.verticalCenter: comboBox.verticalCenter + fillMode: Image.PreserveAspectFit + rotation: -90 + source: "../newIcons/back_icon.svg" + } + ColorOverlay { + id: indicatorOverlay + source: indicatorImage + anchors.fill: indicatorImage + color: "#41cd52" + visible: false + rotation: -90 + } + contentItem: Text { + anchors.left: comboBox.left + anchors.leftMargin: comboBox.width * 0.15 + verticalAlignment: Text.AlignVCenter + font.pixelSize: comboBox.height * 0.375 + font.bold: true + color: "white" + elide: Text.ElideRight + text: comboBox.displayText + font.family: appFont + font.styleName: "SemiBold" + } + background: Rectangle { + color: "transparent" + border.color: "#9d9faa" + border.width: comboBox.visualFocus ? 2 : 1 + } + popup: Popup { + y: comboBox.height -1 + width: comboBox.width + implicitHeight: contentItem.implicitHeight + padding: 1 + + contentItem: ListView { + id: listView + clip: true + implicitHeight: root.height - (comboBox.y + comboBox.height) + 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: "#9d9faa" + color: "#09102b" + opacity: 0.95 + } + } +} diff --git a/src/settingsui/timedate/ManualTime.qml b/src/settingsui/timedate/ManualTime.qml new file mode 100644 index 0000000..b2b3f48 --- /dev/null +++ b/src/settingsui/timedate/ManualTime.qml @@ -0,0 +1,299 @@ +/**************************************************************************** +** +** 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 QtDemoLauncher.QtButtonImageProvider 1.0 +import QtDeviceUtilities.TimeDateSettings 1.0 + +Item { + id: root + property int margin: root.width * 0.05 + + property int firstYear: 2017 + + function zeroPadTime(timeToPad) { + return timeToPad < 10 ? "0" + timeToPad : timeToPad + } + + Text { + id: setDateAndTimeText + anchors.top: parent.top + anchors.left: parent.left + fontSizeMode: Text.Fit + minimumPixelSize: 1 + font.pixelSize: parent.height * 0.05 + color: "white" + text: qsTr("Set Date & Time") + font.family: appFont + font.styleName: "Bold" + } + Rectangle { + id: btmLine + anchors.top: setDateAndTimeText.bottom + anchors.topMargin: parent.height * 0.025 + anchors.left: setDateAndTimeText.left + width: parent.width * 0.275 + height: parent.height * 0.005 + } + + Text { + id: setDateText + anchors.top: btmLine.bottom + anchors.topMargin: parent.height * 0.075 + anchors.left: parent.left + color: "white" + font.pixelSize: parent.height * 0.04 + text: qsTr("Set Date") + font.family: appFont + font.styleName: "Bold" + } + + CustomComboBox { + id: dayBox + width: parent.width * 0.15 + height: parent.height * 0.075 + anchors.left: parent.left + anchors.top: setDateText.bottom + anchors.topMargin: parent.height * 0.025 + displayText: currentIndex + 1 + property var date: new Date(firstYear, 1, 0) + + model: date.getDate() + + delegate: ItemDelegate { + id: dayDelegate + background: Item {} + width: dayBox.width + contentItem: Text { + anchors.left: dayDelegate.left + anchors.leftMargin: dayDelegate.width * 0.15 + verticalAlignment: Text.AlignVCenter + font.pixelSize: dayBox.height * 0.35 + color: dayBox.currentIndex == index ? "#41cd52" : "white" + text: modelData + 1 + font.family: appFont + font.styleName: dayBox.currentIndex == index ? "Bold" : "Regular" + elide: Text.ElideRight + } + } + + property int month: monthBox.currentIndex + 1 + onMonthChanged: updateDate() + + property int year: yearBox.currentIndex + firstYear + onYearChanged: updateDate() + + function updateDate() { + date = new Date(year, month, 0) + } + } + + CustomComboBox { + id: monthBox + width: parent.width * 0.35 + height: parent.height * 0.075 + anchors.top: setDateText.bottom + anchors.topMargin: parent.height * 0.025 + anchors.left: dayBox.right + anchors.leftMargin: root.margin * 0.5 + + model: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] + } + CustomComboBox { + id: yearBox + width: parent.width * 0.2 + height: parent.height * 0.075 + anchors.top: setDateText.bottom + anchors.topMargin: parent.height * 0.025 + anchors.left: monthBox.right + anchors.leftMargin: root.margin * 0.5 + + model: 50 + delegate: ItemDelegate { + id: yearDelegate + background: Item {} + width: yearBox.width + contentItem: Text { + anchors.left: yearDelegate.left + anchors.leftMargin: yearDelegate.width * 0.15 + verticalAlignment: Text.AlignVCenter + font.pixelSize: yearBox.height * 0.35 + text: index + firstYear + color: yearBox.currentIndex == index ? "#41cd52" : "white" + font.family: appFont + font.styleName: yearBox.currentIndex == index ? "Bold" : "Regular" + elide: Text.ElideRight + + } + } + contentItem: Text { + property var date: new Date() + anchors.left: yearBox.left + anchors.leftMargin: yearBox.width * 0.15 + verticalAlignment: Text.AlignVCenter + font.pixelSize: yearBox.height * 0.35 + color: "white" + elide: Text.ElideRight + text: yearBox.currentIndex + date.getFullYear() + font.family: appFont + font.styleName: "SemiBold" + } + } + + Text { + id: setTimeText + anchors.top: dayBox.bottom + anchors.topMargin: parent.height * 0.075 + anchors.left: parent.left + color: "white" + font.pixelSize: parent.height * 0.04 + text: qsTr("Set Time") + font.family: appFont + font.styleName: "Bold" + } + + CustomComboBox { + id: hourBox + width: parent.width * 0.15 + height: parent.height * 0.075 + anchors.top: setTimeText.bottom + anchors.topMargin: parent.height * 0.025 + anchors.left: parent.left + property int hour: currentIndex + + model: 24 + + delegate: ItemDelegate { + id: hourDelegate + background: Item {} + width: hourBox.width + contentItem: Text { + anchors.left: hourDelegate.left + anchors.leftMargin: hourDelegate.width * 0.15 + verticalAlignment: Text.AlignVCenter + font.pixelSize: hourBox.height * 0.35 + color: hourBox.currentIndex == index ? "#41cd52" : "white" + text: zeroPadTime(parseInt(modelData)) + elide: Text.ElideRight + font.family: appFont + font.styleName: hourBox.currentIndex == index ? "Bold" : "Regular" + } + } + contentItem: Text { + anchors.left: hourBox.left + anchors.leftMargin: hourBox.width * 0.15 + verticalAlignment: Text.AlignVCenter + font.pixelSize: hourBox.height * 0.35 + font.bold: true + color: "white" + elide: Text.ElideRight + text: zeroPadTime(hourBox.displayText) + font.family: appFont + font.styleName: "SemiBold" + } + } + CustomComboBox { + id: minuteBox + width: parent.width * 0.15 + height: parent.height * 0.075 + anchors.top: setTimeText.bottom + anchors.topMargin: parent.height * 0.025 + anchors.left: hourBox.right + anchors.leftMargin: root.margin * 0.5 + property int minute: currentIndex + + model: 60 + + delegate: ItemDelegate { + id: minuteDelegate + background: Item {} + width: minuteBox.width + contentItem: Text { + anchors.left: minuteDelegate.left + anchors.leftMargin: minuteDelegate.width * 0.15 + verticalAlignment: Text.AlignVCenter + font.pixelSize: minuteBox.height * 0.35 + color: minuteBox.currentIndex == index ? "#41cd52" : "white" + text: zeroPadTime(parseInt(modelData)) + font.family: appFont + font.styleName: minuteBox.currentIndex == index ? "Bold" : "Regular" + elide: Text.ElideRight + } + } + contentItem: Text { + anchors.left: minuteBox.left + anchors.leftMargin: minuteBox.width * 0.15 + verticalAlignment: Text.AlignVCenter + font.pixelSize: minuteBox.height * 0.35 + font.family: appFont + font.styleName: "SemiBold" + color: "white" + elide: Text.ElideRight + text: zeroPadTime(parseInt(minuteBox.displayText)) + } + } + + QtButton { + id: dateSetButton + height: parent.height * 0.075 + anchors.top: hourBox.bottom + anchors.topMargin: parent.height * 0.1 + anchors.left: parent.left + fillColor: "#41cd52" + borderColor: "transparent" + text: qsTr("SET") + + onClicked: { + var currentTime = TimeManager.time; + var newDate = new Date(); + + newDate.setFullYear(dayBox.year) + newDate.setMonth(dayBox.month - 1) + newDate.setDate(dayBox.currentIndex+1) + + newDate.setHours(hourBox.hour) + newDate.setMinutes(minuteBox.minute) + newDate.setSeconds(currentTime.getSeconds()) + TimeManager.ntp = false + TimeManager.time = newDate; + } + } + QtButton { + id: dateCancelButton + height: parent.height * 0.075 + anchors.top: hourBox.bottom + anchors.topMargin: parent.height * 0.1 + anchors.left: dateSetButton.right + anchors.leftMargin: root.margin * 0.5 + fillColor: "#9d9faa" + borderColor: "transparent" + text: qsTr("CANCEL") + onClicked: settingsLoader.source = "qrc:/timedate/TimeDate.qml" + } +} diff --git a/src/settingsui/timedate/TimeDate.qml b/src/settingsui/timedate/TimeDate.qml index e269fa5..5e9c34c 100644 --- a/src/settingsui/timedate/TimeDate.qml +++ b/src/settingsui/timedate/TimeDate.qml @@ -30,92 +30,199 @@ 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 QtDemoLauncher.QtButtonImageProvider 1.0 Item { id: root - property string title: qsTr("Time and Date settings") + property int margin: root.width * 0.05 Flickable { id: flickable - anchors.margins: 20 anchors.fill: parent - contentHeight: content.height + contentHeight: height contentWidth: width - interactive: !clock.handPressed - ColumnLayout { - id: content - spacing: 20 + Text { + id: dateAndTimeTitle + anchors.top: parent.top + anchors.left: parent.left + fontSizeMode: Text.Fit + minimumPixelSize: 1 + font.pixelSize: parent.height * 0.05 + color: "white" + text: qsTr("Date & Time") + font.family: appFont + font.styleName: "Bold" + } + + Rectangle { + id: btmLine + anchors.top: dateAndTimeTitle.bottom + anchors.topMargin: parent.height * 0.025 + anchors.left: dateAndTimeTitle.left + width: parent.width * 0.275 + height: parent.height * 0.005 + } + + Text { + id: dateText width: parent.width + height: parent.height * 0.055 + anchors.top: btmLine.bottom + anchors.left: parent.left + anchors.topMargin: parent.height * 0.05 + fontSizeMode: Text.Fit + minimumPixelSize: 1 + font.pixelSize: height + color: "white" + font.family: appFont + Timer { + id: dateTimer + interval: 1000 + running: true + repeat: true + triggeredOnStart: true + onTriggered: { + var date = new Date(); + var hours = date.getHours(); + var minutes = date.getMinutes(); + var seconds = date.getSeconds(); + var days = date.getDate(); - GroupBox { - width: parent.width - title: qsTr("Time Settings") - Layout.fillWidth: true - - ColumnLayout { - spacing: 10 - width: parent.width - Layout.fillWidth: true - - RadioButton { - id: automatic - text: qsTr("Automatic time set") - checked: TimeManager.ntp - onCheckedChanged: if (checked) updateTimer.restart() - - Timer { - id: updateTimer - interval: 300 - onTriggered: calendar.updateDate() - } - } - RadioButton { - id: custom - text: qsTr("Manual") - checked: !TimeManager.ntp - onCheckedChanged: TimeManager.ntp = !checked - } - RowLayout - { - id: layout - spacing: 10 - - CustomCalendar { - id: calendar - width: height - } - AnalogClock { - id: clock - height: calendar.height - width: height - editMode: !automatic.checked - } - } - Component { - id: zoneselect - TimezonesView { } + dateText.text = date.toLocaleString(Qt.locale(LocaleManager.locale), Locale.LongFormat) + } + function nth(days) { + if (days > 3 && days < 21) return 'th'; + switch (days % 10) { + case 1: return "st"; + case 2: return "nd"; + case 3: return "rd"; + default: return "th"; } } } - GroupBox { - title: qsTr("Timezone Settings") - Layout.fillWidth: true - width: parent.width - visible: true - - RowLayout { - spacing: 10 - Label { - text: TimeManager.timeZone - Layout.alignment: Qt.AlignVCenter - } - Button { - text: qsTr("Change") - onClicked : stackView.push(zoneselect) - } + } + + Text { + id: setDateText + width: parent.width * 0.3 + height: parent.height * 0.05 + anchors.left: parent.left + anchors.top: dateText.bottom + anchors.topMargin: parent.height * 0.05 + fontSizeMode: Text.Fit + minimumPixelSize: 1 + font.pixelSize: height + color: "white" + text: qsTr("Set Date & Time") + font.family: appFont + font.styleName: "Bold" + } + + QtButton { + id: automaticButton + anchors.top: setDateText.bottom + anchors.topMargin: parent.height * 0.025 + anchors.left: parent.left + height: parent.height * 0.075 + fillColor: "#41cd52" + borderColor: "transparent" + text: qsTr("AUTOMATICALLY") + onClicked: TimeManager.ntp = true + } + + QtButton { + id: manualButton + anchors.top: setDateText.bottom + anchors.topMargin: parent.height * 0.025 + anchors.left: automaticButton.right + anchors.leftMargin: root.margin * 0.5 + height: parent.height * 0.075 + fillColor: "#9d9faa" + borderColor: "transparent" + text: qsTr("MANUALLY") + onClicked: settingsLoader.source = "qrc:/timedate/ManualTime.qml" + } + + Text { + id: timeZoneText + width: parent.width * 0.3 + height: parent.height * 0.05 + anchors.left: parent.left + anchors.top: automaticButton.bottom + anchors.topMargin: parent.height * 0.05 + fontSizeMode: Text.Fit + minimumPixelSize: 1 + font.pixelSize: height + color: "white" + text: qsTr("Time Zone") + font.family: appFont + font.styleName: "Bold" + } + + CustomComboBox { + id: timeZoneBox + width: automaticButton.width + manualButton.width + root.margin * 0.5 + height: parent.height * 0.075 + anchors.top: timeZoneText.bottom + anchors.topMargin: parent.height * 0.025 + anchors.left: parent.left + textRole: "id" + model: TimezonesFilter + delegate: ItemDelegate { + id: timeZoneDelegate + background: Item {} + width: timeZoneBox.width + contentItem: Text { + anchors.left: timeZoneDelegate.left + anchors.leftMargin: timeZoneDelegate.width * 0.05 + text: modelData["id"] + font.family: appFont + font.styleName: timeZoneBox.currentIndex == index ? "Bold" : "Regular" + color: timeZoneBox.currentIndex == index ? "#41cd52" : "white" + elide: Text.ElideRight + verticalAlignment: Text.AlignVCenter + } + } + + Component.onCompleted: { + var n = TimezonesFilter.indexForTimezone(TimeManager.timeZone) + timeZoneBox.currentIndex = n + } + + Connections { + target: TimezonesFilter.sourceModel + onReady: { + var n = TimezonesFilter.indexForTimezone(TimeManager.timeZone) + timeZoneBox.currentIndex = n + } + } + + + onCurrentIndexChanged: { + var val = TimezonesFilter.itemFromRow(currentIndex); + if (val !== "") { + TimeManager.timeZone = val } } + contentItem: Text { + anchors.left: timeZoneBox.left + anchors.leftMargin: timeZoneBox.width * 0.05 + verticalAlignment: Text.AlignVCenter + font.pixelSize: timeZoneBox.height * 0.35 + font.bold: true + color: "white" + elide: Text.ElideRight + text: timeZoneBox.displayText + font.family: appFont + font.styleName: "SemiBold" + } + } + + Component { + id: zoneselect + TimezonesView {} } } } |