From f1d884b6dad5a93d7a3077b6b05d3ec7fcd9a6ea Mon Sep 17 00:00:00 2001 From: Teemu Holappa Date: Thu, 11 Feb 2016 11:50:55 +0200 Subject: Refactored Qml plugins into modules. Separated C++ and Qml interfaces. All the UI's from plugins are moved to the settingsui folder. Change-Id: Id6a6623346b18321357bc42d24121c4d9cdfd098 Reviewed-by: Kimmo Ollila --- src/settingsui/bluetooth/Bluetooth.qml | 89 +++ src/settingsui/bluetooth/Discovery.qml | 142 +++++ src/settingsui/common/CustomCombobox.qml | 185 ++++++ .../common/FlatStyledDropdownDelegate.qml | 78 +++ src/settingsui/common/IconButton.qml | 54 ++ src/settingsui/common/TextLabel.qml | 48 ++ src/settingsui/deployment.pri | 27 + src/settingsui/display/Display.qml | 136 +++++ src/settingsui/icons.qrc | 12 + src/settingsui/icons/Alert_yellow_1x.png | Bin 0 -> 775 bytes src/settingsui/icons/Audio_qt_6x.png | Bin 0 -> 444 bytes src/settingsui/icons/Bluetooth_qt_1x.png | Bin 0 -> 858 bytes src/settingsui/icons/Bluetooth_qt_6x.png | Bin 0 -> 2349 bytes src/settingsui/icons/Camcorder_qt_1x.png | Bin 0 -> 719 bytes src/settingsui/icons/Camera_qt_1x.png | Bin 0 -> 1003 bytes src/settingsui/icons/Chevron-left_black_1x.png | Bin 0 -> 707 bytes src/settingsui/icons/Clock_qt_1x.png | Bin 0 -> 1185 bytes src/settingsui/icons/Clock_qt_6x.png | Bin 0 -> 3438 bytes src/settingsui/icons/Display_qt_6x.png | Bin 0 -> 1157 bytes src/settingsui/icons/Flag_qt_6x.png | Bin 0 -> 1888 bytes src/settingsui/icons/Headphones_qt_1x.png | Bin 0 -> 1041 bytes src/settingsui/icons/Heartbeat_qt_1x.png | Bin 0 -> 1061 bytes src/settingsui/icons/Keyboard_qt_1x.png | Bin 0 -> 1116 bytes src/settingsui/icons/Laptop_qt_1x.png | Bin 0 -> 861 bytes src/settingsui/icons/Microphone_qt_1x.png | Bin 0 -> 943 bytes src/settingsui/icons/MobilePhone_qt_1x.png | Bin 0 -> 785 bytes src/settingsui/icons/Mouse_qt_1x.png | Bin 0 -> 732 bytes src/settingsui/icons/Power_black_1x.png | Bin 0 -> 1161 bytes src/settingsui/icons/Tablet_qt_1x.png | Bin 0 -> 721 bytes src/settingsui/icons/Volume_down_qt_1x.png | Bin 0 -> 571 bytes src/settingsui/icons/Volume_mute_qt_1x.png | Bin 0 -> 778 bytes src/settingsui/icons/Volume_up_qt_1x.png | Bin 0 -> 632 bytes src/settingsui/icons/WifiAnim_black_2x.png | Bin 0 -> 1673 bytes src/settingsui/icons/Wifi_lightgray_2x.png | Bin 0 -> 924 bytes src/settingsui/icons/World_qt_6x.png | Bin 0 -> 5789 bytes src/settingsui/icons/generate_icons.sh | 27 + src/settingsui/icons/ref/Audio.png | Bin 0 -> 135 bytes src/settingsui/icons/ref/Back.png | Bin 0 -> 1725 bytes src/settingsui/icons/ref/Bluetooth.png | Bin 0 -> 1364 bytes src/settingsui/icons/ref/Camcorder.png | Bin 0 -> 1036 bytes src/settingsui/icons/ref/Camera.png | Bin 0 -> 1889 bytes src/settingsui/icons/ref/Chevron-left.png | Bin 0 -> 1475 bytes src/settingsui/icons/ref/Chevron-right.png | Bin 0 -> 1463 bytes src/settingsui/icons/ref/Circle-x.png | Bin 0 -> 3358 bytes src/settingsui/icons/ref/Clock.png | Bin 0 -> 2438 bytes src/settingsui/icons/ref/Cogs.png | Bin 0 -> 2756 bytes src/settingsui/icons/ref/Connections.png | Bin 0 -> 3226 bytes src/settingsui/icons/ref/Display.png | Bin 0 -> 754 bytes src/settingsui/icons/ref/Flag.png | Bin 0 -> 1395 bytes src/settingsui/icons/ref/Headphones.png | Bin 0 -> 2141 bytes src/settingsui/icons/ref/Heartbeat.png | Bin 0 -> 2280 bytes src/settingsui/icons/ref/Keyboard.png | Bin 0 -> 571 bytes src/settingsui/icons/ref/Laptop.png | Bin 0 -> 753 bytes src/settingsui/icons/ref/Lock.png | Bin 0 -> 1043 bytes src/settingsui/icons/ref/Microphone.png | Bin 0 -> 1891 bytes src/settingsui/icons/ref/MobilePhone.png | Bin 0 -> 1034 bytes src/settingsui/icons/ref/Mouse.png | Bin 0 -> 1560 bytes src/settingsui/icons/ref/Plus.png | Bin 0 -> 2888 bytes src/settingsui/icons/ref/Power.png | Bin 0 -> 2466 bytes src/settingsui/icons/ref/Settings.png | Bin 0 -> 2630 bytes src/settingsui/icons/ref/Tablet.png | Bin 0 -> 892 bytes src/settingsui/icons/ref/Volume_down.png | Bin 0 -> 505 bytes src/settingsui/icons/ref/Volume_mute.png | Bin 0 -> 1000 bytes src/settingsui/icons/ref/Volume_up.png | Bin 0 -> 513 bytes src/settingsui/icons/ref/Wifi.png | Bin 0 -> 2102 bytes src/settingsui/icons/ref/Wifi1.png | Bin 0 -> 824 bytes src/settingsui/icons/ref/Wifi2.png | Bin 0 -> 987 bytes src/settingsui/icons/ref/Wifi3.png | Bin 0 -> 1195 bytes src/settingsui/icons/ref/Wifi4.png | Bin 0 -> 2102 bytes src/settingsui/icons/ref/WifiAnim.png | Bin 0 -> 2830 bytes src/settingsui/icons/ref/World.png | Bin 0 -> 4559 bytes src/settingsui/icons/ref/Wrench.png | Bin 0 -> 1677 bytes src/settingsui/icons/ref/extra/Alert.png | Bin 0 -> 1502 bytes src/settingsui/icons/scripts/cimage.sh | 45 ++ src/settingsui/icons/scripts/cimages.sh | 28 + src/settingsui/icons/scripts/rimage.sh | 37 ++ src/settingsui/icons/scripts/rimages.sh | 25 + src/settingsui/locale/Language.qml | 111 ++++ src/settingsui/locale/RegionSelect.qml | 96 +++ src/settingsui/main.cpp | 41 ++ src/settingsui/main.qml | 171 ++++++ src/settingsui/network/EditWiredSettings.qml | 641 +++++++++++++++++++++ src/settingsui/network/IpAddressTextField.qml | 43 ++ src/settingsui/network/NetworkDetails.qml | 42 ++ src/settingsui/network/NetworkSettings.qml | 137 +++++ src/settingsui/network/WifiSelectorDelegate.qml | 90 +++ src/settingsui/network/WifiSettings.qml | 189 ++++++ src/settingsui/network/WifiSignalMonitor.qml | 83 +++ src/settingsui/network/WiredSettings.qml | 207 +++++++ src/settingsui/qml.qrc | 26 + src/settingsui/settingsui.pro | 17 + src/settingsui/settingsview.xml | 35 ++ src/settingsui/timedate/AnalogClock.qml | 255 ++++++++ src/settingsui/timedate/TimeDate.qml | 167 ++++++ src/settingsui/timedate/TimezonesView.qml | 94 +++ 95 files changed, 3378 insertions(+) create mode 100644 src/settingsui/bluetooth/Bluetooth.qml create mode 100644 src/settingsui/bluetooth/Discovery.qml create mode 100644 src/settingsui/common/CustomCombobox.qml create mode 100644 src/settingsui/common/FlatStyledDropdownDelegate.qml create mode 100644 src/settingsui/common/IconButton.qml create mode 100644 src/settingsui/common/TextLabel.qml create mode 100644 src/settingsui/deployment.pri create mode 100644 src/settingsui/display/Display.qml create mode 100644 src/settingsui/icons.qrc create mode 100644 src/settingsui/icons/Alert_yellow_1x.png create mode 100644 src/settingsui/icons/Audio_qt_6x.png create mode 100644 src/settingsui/icons/Bluetooth_qt_1x.png create mode 100644 src/settingsui/icons/Bluetooth_qt_6x.png create mode 100644 src/settingsui/icons/Camcorder_qt_1x.png create mode 100644 src/settingsui/icons/Camera_qt_1x.png create mode 100644 src/settingsui/icons/Chevron-left_black_1x.png create mode 100644 src/settingsui/icons/Clock_qt_1x.png create mode 100644 src/settingsui/icons/Clock_qt_6x.png create mode 100644 src/settingsui/icons/Display_qt_6x.png create mode 100644 src/settingsui/icons/Flag_qt_6x.png create mode 100644 src/settingsui/icons/Headphones_qt_1x.png create mode 100644 src/settingsui/icons/Heartbeat_qt_1x.png create mode 100644 src/settingsui/icons/Keyboard_qt_1x.png create mode 100644 src/settingsui/icons/Laptop_qt_1x.png create mode 100644 src/settingsui/icons/Microphone_qt_1x.png create mode 100644 src/settingsui/icons/MobilePhone_qt_1x.png create mode 100644 src/settingsui/icons/Mouse_qt_1x.png create mode 100644 src/settingsui/icons/Power_black_1x.png create mode 100644 src/settingsui/icons/Tablet_qt_1x.png create mode 100644 src/settingsui/icons/Volume_down_qt_1x.png create mode 100644 src/settingsui/icons/Volume_mute_qt_1x.png create mode 100644 src/settingsui/icons/Volume_up_qt_1x.png create mode 100644 src/settingsui/icons/WifiAnim_black_2x.png create mode 100644 src/settingsui/icons/Wifi_lightgray_2x.png create mode 100644 src/settingsui/icons/World_qt_6x.png create mode 100755 src/settingsui/icons/generate_icons.sh create mode 100644 src/settingsui/icons/ref/Audio.png create mode 100644 src/settingsui/icons/ref/Back.png create mode 100644 src/settingsui/icons/ref/Bluetooth.png create mode 100644 src/settingsui/icons/ref/Camcorder.png create mode 100644 src/settingsui/icons/ref/Camera.png create mode 100644 src/settingsui/icons/ref/Chevron-left.png create mode 100644 src/settingsui/icons/ref/Chevron-right.png create mode 100644 src/settingsui/icons/ref/Circle-x.png create mode 100644 src/settingsui/icons/ref/Clock.png create mode 100644 src/settingsui/icons/ref/Cogs.png create mode 100644 src/settingsui/icons/ref/Connections.png create mode 100644 src/settingsui/icons/ref/Display.png create mode 100644 src/settingsui/icons/ref/Flag.png create mode 100644 src/settingsui/icons/ref/Headphones.png create mode 100644 src/settingsui/icons/ref/Heartbeat.png create mode 100644 src/settingsui/icons/ref/Keyboard.png create mode 100644 src/settingsui/icons/ref/Laptop.png create mode 100644 src/settingsui/icons/ref/Lock.png create mode 100644 src/settingsui/icons/ref/Microphone.png create mode 100644 src/settingsui/icons/ref/MobilePhone.png create mode 100644 src/settingsui/icons/ref/Mouse.png create mode 100644 src/settingsui/icons/ref/Plus.png create mode 100644 src/settingsui/icons/ref/Power.png create mode 100644 src/settingsui/icons/ref/Settings.png create mode 100644 src/settingsui/icons/ref/Tablet.png create mode 100644 src/settingsui/icons/ref/Volume_down.png create mode 100644 src/settingsui/icons/ref/Volume_mute.png create mode 100644 src/settingsui/icons/ref/Volume_up.png create mode 100644 src/settingsui/icons/ref/Wifi.png create mode 100644 src/settingsui/icons/ref/Wifi1.png create mode 100644 src/settingsui/icons/ref/Wifi2.png create mode 100644 src/settingsui/icons/ref/Wifi3.png create mode 100644 src/settingsui/icons/ref/Wifi4.png create mode 100644 src/settingsui/icons/ref/WifiAnim.png create mode 100644 src/settingsui/icons/ref/World.png create mode 100644 src/settingsui/icons/ref/Wrench.png create mode 100644 src/settingsui/icons/ref/extra/Alert.png create mode 100755 src/settingsui/icons/scripts/cimage.sh create mode 100755 src/settingsui/icons/scripts/cimages.sh create mode 100755 src/settingsui/icons/scripts/rimage.sh create mode 100755 src/settingsui/icons/scripts/rimages.sh create mode 100644 src/settingsui/locale/Language.qml create mode 100644 src/settingsui/locale/RegionSelect.qml create mode 100644 src/settingsui/main.cpp create mode 100644 src/settingsui/main.qml create mode 100644 src/settingsui/network/EditWiredSettings.qml create mode 100644 src/settingsui/network/IpAddressTextField.qml create mode 100644 src/settingsui/network/NetworkDetails.qml create mode 100644 src/settingsui/network/NetworkSettings.qml create mode 100644 src/settingsui/network/WifiSelectorDelegate.qml create mode 100644 src/settingsui/network/WifiSettings.qml create mode 100644 src/settingsui/network/WifiSignalMonitor.qml create mode 100644 src/settingsui/network/WiredSettings.qml create mode 100644 src/settingsui/qml.qrc create mode 100644 src/settingsui/settingsui.pro create mode 100644 src/settingsui/settingsview.xml create mode 100644 src/settingsui/timedate/AnalogClock.qml create mode 100644 src/settingsui/timedate/TimeDate.qml create mode 100644 src/settingsui/timedate/TimezonesView.qml (limited to 'src/settingsui') diff --git a/src/settingsui/bluetooth/Bluetooth.qml b/src/settingsui/bluetooth/Bluetooth.qml new file mode 100644 index 0000000..d16bdb3 --- /dev/null +++ b/src/settingsui/bluetooth/Bluetooth.qml @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.5 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles.Flat 1.0 as Flat +import "../common" +import com.theqtcompany.settings.bluetooth 1.0 + +Item { + id: root + property string title: qsTr("Bluetooth Settings") + + Column { + id: content + anchors.fill: parent + anchors.margins: Math.round(40 * Flat.FlatStyle.scaleFactor) + + GroupBox { + id: groupBox + width: parent.width + title: qsTr("Bluetooth status") + Layout.fillWidth: true + + ColumnLayout { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + width: parent.width + Layout.fillWidth: true + + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + TextLabel { + id: off + text: qsTr("Off") + } + + Switch { + checked: BtDevice.powered + onCheckedChanged: BtDevice.powered = checked + } + + TextLabel { + text: qsTr("On") + } + } + } + } + + Discovery { + id: discovery + visible: BtDevice.powered + width: parent.width + height: Math.round(content.height - 100 * Flat.FlatStyle.scaleFactor) + } + } +} diff --git a/src/settingsui/bluetooth/Discovery.qml b/src/settingsui/bluetooth/Discovery.qml new file mode 100644 index 0000000..a2dda84 --- /dev/null +++ b/src/settingsui/bluetooth/Discovery.qml @@ -0,0 +1,142 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.5 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.4 +import QtBluetooth 5.2 +import QtQuick.Controls.Styles.Flat 1.0 as Flat +import "../common" +import com.theqtcompany.settings.bluetooth 1.0 + +Item { + id: top + property BluetoothService currentService + + GroupBox { + id: groupBox + title: qsTr("Devices") + width: parent.width + + ListView { + id: mainList + width: parent.width + height: top.height + + 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" + } + } + + model: BtDevice.deviceModel + delegate: Rectangle { + id: btDelegate + width: parent.width + height: Math.round(column.height + 10 * Flat.FlatStyle.scaleFactor) + + property bool expended: false; + clip: true + + MouseArea { + anchors.fill: parent + onClicked: btDelegate.expended = !btDelegate.expended + } + + RowLayout { + anchors.top: parent.top + anchors.left: parent.left + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + + Image { + id: bticon + source: mainList.getIcon(type) + } + + Column { + id: column + TextLabel { + id: bttext + text: name + } + + TextLabel { + id: details + opacity: btDelegate.expended ? 1 : 0.0 + text: address + Behavior on opacity { + NumberAnimation { duration: 200} + } + } + } + } + + Button { + anchors.right: parent.right + anchors.rightMargin: Math.round(10 * Flat.FlatStyle.scaleFactor) + visible: !BtDevice.scanning + text: connected ? qsTr("Disconnect") : qsTr("Connect") + + onClicked : connected ? BtDevice.requestDisconnect(address) : BtDevice.requestPairing(address); + } + + Behavior on height { NumberAnimation { duration: 200} } + + } + focus: true + } + } + + BusyIndicator { + anchors.right: groupBox.right + anchors.top: groupBox.top + anchors.topMargin: Math.round(40 * Flat.FlatStyle.scaleFactor) + anchors.rightMargin: Math.round(10 * Flat.FlatStyle.scaleFactor) + height: Math.round(20 * Flat.FlatStyle.scaleFactor) + width: Math.round(20 * Flat.FlatStyle.scaleFactor) + running: BtDevice.scanning + } +} diff --git a/src/settingsui/common/CustomCombobox.qml b/src/settingsui/common/CustomCombobox.qml new file mode 100644 index 0000000..37c7871 --- /dev/null +++ b/src/settingsui/common/CustomCombobox.qml @@ -0,0 +1,185 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.5 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles.Flat 1.0 as Flat +import QtQml.Models 2.1 + +Item { + id: control + property alias popupParent: popupView.parent + property bool popupVisible: popupView.visible + property int selectedIndex: -1 + property alias model: comboboxModel.model + property string textRole: "text" + property bool modified: false + property alias popupVisibility: popupView.visible + property alias textValue: label.text + property int popupHeight: comboboxModel.items.count * height + property bool enabled: true + property bool editable: true + property Component delegate + + implicitWidth: Math.round(100 * Flat.FlatStyle.scaleFactor) + implicitHeight: Math.round(26 * Flat.FlatStyle.scaleFactor) + + Component.onCompleted: { + //Find root window for parent + var p = control.parent + while (p.parent) { + p = p.parent; + } + popupParent = p; + } + + function hide() { + popupView.visible = false + button.checked = false + } + + function setSelectIndexToVal(value, role) { + if (model) { + for (var i=0, len=comboboxModel.items.count;i=0 ? comboboxModel.items.count>0 ? comboboxModel.items.get(selectedIndex).model[textRole]:"":"" + } + + Flat.LeftArrowIcon { + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + anchors.rightMargin: Math.round(10 * Flat.FlatStyle.scaleFactor) + width: Math.round(14 * Flat.FlatStyle.scaleFactor) + height: Math.round(14 * Flat.FlatStyle.scaleFactor) + rotation: popupVisibility ? 90 : -90 + color: button.hovered || button.checked ? Flat.FlatStyle.selectedTextColor:Flat.FlatStyle.styleColor + opacity: control.enabled || control.editable ? 1.0 : 0.2 + } + } + + Item { + id: popupView + y: 0 + x: 0 + height: control.popupHeight + width: control.width + visible: false + onVisibleChanged: { + if (visible) { + var pos = control.mapToItem(popupView.parent, 0, 0) + x = pos.x + y = pos.y + button.height + + if (y + control.popupHeight > popupParent.height) { + y = popupParent.height - control.popupHeight; + } + } + } + + Rectangle { + anchors.fill: parent + border.color: Flat.FlatStyle.darkFrameColor + border.width: 1 + color: "white" + + Column { + ExclusiveGroup { + id: exgroup + } + + DelegateModel { + id: comboboxModel + delegate: comboboxDelegate + } + + Repeater { + id: comboboxView + model: comboboxModel + } + } + } + } + + Component { + id: comboboxDelegate + Item { + id: comboboxViewDelegate + property bool checked + width: control.width + height: control.height + + Loader { + id: loader + sourceComponent: delegate + anchors.fill: parent + property var modelData: model + property string textRole: textRole + onLoaded : exgroup.bindCheckable(item) + } + + Connections { + target: loader.item + onClicked: { + popupView.visible = false; + button.checked = false + selectedIndex = index + } + } + } + } +} diff --git a/src/settingsui/common/FlatStyledDropdownDelegate.qml b/src/settingsui/common/FlatStyledDropdownDelegate.qml new file mode 100644 index 0000000..c1bd24c --- /dev/null +++ b/src/settingsui/common/FlatStyledDropdownDelegate.qml @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.5 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles.Flat 1.0 as Flat + +Item { + id: root + property bool checkable: true + property bool checked: false + property bool pressed: false + signal clicked() + + MouseArea { + id: delegateButton + anchors.fill: parent + hoverEnabled: true + + onPressed: root.pressed = true + onClicked: root.clicked(); + onEntered: checked = !checked; + + Rectangle { + anchors.fill: parent + color: root.checked ? Flat.FlatStyle.disabledColor : "transparent" + opacity: root.checked ? 0.15 : 1.0 + } + Rectangle { + color: Flat.FlatStyle.darkFrameColor + width: parent.width + height: Flat.FlatStyle.onePixel + anchors.bottom: parent.bottom + } + TextLabel { + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.margins: Math.round(10 * Flat.FlatStyle.scaleFactor) + horizontalAlignment: Text.AlignLeft + text: modelData.name + } + } +} diff --git a/src/settingsui/common/IconButton.qml b/src/settingsui/common/IconButton.qml new file mode 100644 index 0000000..898e5e0 --- /dev/null +++ b/src/settingsui/common/IconButton.qml @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.5 + +MouseArea { + id: root + property alias pressedIcon: pressedImage.source + property alias releasedIcon: releasedImage.source + width: pressedImage.sourceSize.width + height: pressedImage.sourceSize.height + + Image { + id: pressedImage + visible: root.pressed + } + + Image { + id: releasedImage + visible: !root.pressed + } +} diff --git a/src/settingsui/common/TextLabel.qml b/src/settingsui/common/TextLabel.qml new file mode 100644 index 0000000..e9f5d12 --- /dev/null +++ b/src/settingsui/common/TextLabel.qml @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.5 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles.Flat 1.0 as Flat + +Text { + color: systemPalette.text + font.family: Flat.FlatStyle.fontFamily + font.pixelSize: Math.round(12 * Flat.FlatStyle.scaleFactor) + renderType: Text.QtRendering + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter +} diff --git a/src/settingsui/deployment.pri b/src/settingsui/deployment.pri new file mode 100644 index 0000000..5441b63 --- /dev/null +++ b/src/settingsui/deployment.pri @@ -0,0 +1,27 @@ +android-no-sdk { + target.path = /data/user/qt + export(target.path) + INSTALLS += target +} else:android { + x86 { + target.path = /libs/x86 + } else: armeabi-v7a { + target.path = /libs/armeabi-v7a + } else { + target.path = /libs/armeabi + } + export(target.path) + INSTALLS += target +} else:unix { + isEmpty(target.path) { + qnx { + target.path = /tmp/$${TARGET}/bin + } else { + target.path = /opt/$${TARGET}/bin + } + export(target.path) + } + INSTALLS += target +} + +export(INSTALLS) diff --git a/src/settingsui/display/Display.qml b/src/settingsui/display/Display.qml new file mode 100644 index 0000000..8d45746 --- /dev/null +++ b/src/settingsui/display/Display.qml @@ -0,0 +1,136 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.5 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles.Flat 1.0 as Flat +import com.theqtcompany.settings.display 1.0 +import "../common" + +Item { + id: root + + property string title: qsTr("Display Settings") + + GroupBox { + title: qsTr("Display Settings") + anchors.fill: parent + anchors.margins: Math.round(40 * Flat.FlatStyle.scaleFactor) + Layout.fillWidth: true + + Column { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + RowLayout { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + + TextLabel { + text: qsTr("Brighness: ") + } + + Slider { + id: brightnessSlider + value: DisplaySettings.displayBrightness + Layout.fillWidth: true + } + } + + Binding { + target: DisplaySettings + property: "displayBrightness" + value: brightnessSlider.value + } + + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + + TextLabel { + text: qsTr("Physical screen size: ") + } + + ColumnLayout { + ExclusiveGroup { id: exgroup } + RadioButton { + text: qsTr("Default") + exclusiveGroup: exgroup + checked: !DisplaySettings.physicalScreenSizeOverride + } + RadioButton { + id: custom + text: qsTr("Custom") + exclusiveGroup: exgroup + checked: DisplaySettings.physicalScreenSizeOverride + + onCheckedChanged: DisplaySettings.physicalScreenSizeOverride = checked + } + + GroupBox { + title: qsTr("Size (in inches): " + sizeSlider.value) + Layout.fillWidth: true + flat: true + visible: custom.checked + + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + TextLabel { + text: sizeSlider.minimumValue + } + + Slider { + id: sizeSlider + value: DisplaySettings.physicalScreenSizeInch + Layout.fillWidth: true + stepSize: 1 + minimumValue: 4 + maximumValue: 60 + } + + TextLabel { + text: sizeSlider.maximumValue + } + + Binding { + target: DisplaySettings + property: "physicalScreenSizeInch" + value: sizeSlider.value + } + } + } + } + } + } + } +} + diff --git a/src/settingsui/icons.qrc b/src/settingsui/icons.qrc new file mode 100644 index 0000000..8099fbb --- /dev/null +++ b/src/settingsui/icons.qrc @@ -0,0 +1,12 @@ + + + icons/Audio_qt_6x.png + icons/Chevron-left_black_1x.png + icons/Power_black_1x.png + icons/Display_qt_6x.png + icons/Clock_qt_6x.png + icons/Flag_qt_6x.png + icons/World_qt_6x.png + icons/Bluetooth_qt_6x.png + + diff --git a/src/settingsui/icons/Alert_yellow_1x.png b/src/settingsui/icons/Alert_yellow_1x.png new file mode 100644 index 0000000..2306ff6 Binary files /dev/null and b/src/settingsui/icons/Alert_yellow_1x.png differ diff --git a/src/settingsui/icons/Audio_qt_6x.png b/src/settingsui/icons/Audio_qt_6x.png new file mode 100644 index 0000000..8251129 Binary files /dev/null and b/src/settingsui/icons/Audio_qt_6x.png differ diff --git a/src/settingsui/icons/Bluetooth_qt_1x.png b/src/settingsui/icons/Bluetooth_qt_1x.png new file mode 100644 index 0000000..af6968d Binary files /dev/null and b/src/settingsui/icons/Bluetooth_qt_1x.png differ diff --git a/src/settingsui/icons/Bluetooth_qt_6x.png b/src/settingsui/icons/Bluetooth_qt_6x.png new file mode 100644 index 0000000..55e4fb1 Binary files /dev/null and b/src/settingsui/icons/Bluetooth_qt_6x.png differ diff --git a/src/settingsui/icons/Camcorder_qt_1x.png b/src/settingsui/icons/Camcorder_qt_1x.png new file mode 100644 index 0000000..7ffb2c8 Binary files /dev/null and b/src/settingsui/icons/Camcorder_qt_1x.png differ diff --git a/src/settingsui/icons/Camera_qt_1x.png b/src/settingsui/icons/Camera_qt_1x.png new file mode 100644 index 0000000..b84e53a Binary files /dev/null and b/src/settingsui/icons/Camera_qt_1x.png differ diff --git a/src/settingsui/icons/Chevron-left_black_1x.png b/src/settingsui/icons/Chevron-left_black_1x.png new file mode 100644 index 0000000..225176b Binary files /dev/null and b/src/settingsui/icons/Chevron-left_black_1x.png differ diff --git a/src/settingsui/icons/Clock_qt_1x.png b/src/settingsui/icons/Clock_qt_1x.png new file mode 100644 index 0000000..ee58f95 Binary files /dev/null and b/src/settingsui/icons/Clock_qt_1x.png differ diff --git a/src/settingsui/icons/Clock_qt_6x.png b/src/settingsui/icons/Clock_qt_6x.png new file mode 100644 index 0000000..aba8b60 Binary files /dev/null and b/src/settingsui/icons/Clock_qt_6x.png differ diff --git a/src/settingsui/icons/Display_qt_6x.png b/src/settingsui/icons/Display_qt_6x.png new file mode 100644 index 0000000..e45c45c Binary files /dev/null and b/src/settingsui/icons/Display_qt_6x.png differ diff --git a/src/settingsui/icons/Flag_qt_6x.png b/src/settingsui/icons/Flag_qt_6x.png new file mode 100644 index 0000000..f549ebd Binary files /dev/null and b/src/settingsui/icons/Flag_qt_6x.png differ diff --git a/src/settingsui/icons/Headphones_qt_1x.png b/src/settingsui/icons/Headphones_qt_1x.png new file mode 100644 index 0000000..82b04e7 Binary files /dev/null and b/src/settingsui/icons/Headphones_qt_1x.png differ diff --git a/src/settingsui/icons/Heartbeat_qt_1x.png b/src/settingsui/icons/Heartbeat_qt_1x.png new file mode 100644 index 0000000..16a94bc Binary files /dev/null and b/src/settingsui/icons/Heartbeat_qt_1x.png differ diff --git a/src/settingsui/icons/Keyboard_qt_1x.png b/src/settingsui/icons/Keyboard_qt_1x.png new file mode 100644 index 0000000..cc6417d Binary files /dev/null and b/src/settingsui/icons/Keyboard_qt_1x.png differ diff --git a/src/settingsui/icons/Laptop_qt_1x.png b/src/settingsui/icons/Laptop_qt_1x.png new file mode 100644 index 0000000..2924015 Binary files /dev/null and b/src/settingsui/icons/Laptop_qt_1x.png differ diff --git a/src/settingsui/icons/Microphone_qt_1x.png b/src/settingsui/icons/Microphone_qt_1x.png new file mode 100644 index 0000000..f76a963 Binary files /dev/null and b/src/settingsui/icons/Microphone_qt_1x.png differ diff --git a/src/settingsui/icons/MobilePhone_qt_1x.png b/src/settingsui/icons/MobilePhone_qt_1x.png new file mode 100644 index 0000000..363d667 Binary files /dev/null and b/src/settingsui/icons/MobilePhone_qt_1x.png differ diff --git a/src/settingsui/icons/Mouse_qt_1x.png b/src/settingsui/icons/Mouse_qt_1x.png new file mode 100644 index 0000000..24d057d Binary files /dev/null and b/src/settingsui/icons/Mouse_qt_1x.png differ diff --git a/src/settingsui/icons/Power_black_1x.png b/src/settingsui/icons/Power_black_1x.png new file mode 100644 index 0000000..cca0fe8 Binary files /dev/null and b/src/settingsui/icons/Power_black_1x.png differ diff --git a/src/settingsui/icons/Tablet_qt_1x.png b/src/settingsui/icons/Tablet_qt_1x.png new file mode 100644 index 0000000..e218184 Binary files /dev/null and b/src/settingsui/icons/Tablet_qt_1x.png differ diff --git a/src/settingsui/icons/Volume_down_qt_1x.png b/src/settingsui/icons/Volume_down_qt_1x.png new file mode 100644 index 0000000..2068819 Binary files /dev/null and b/src/settingsui/icons/Volume_down_qt_1x.png differ diff --git a/src/settingsui/icons/Volume_mute_qt_1x.png b/src/settingsui/icons/Volume_mute_qt_1x.png new file mode 100644 index 0000000..1a41927 Binary files /dev/null and b/src/settingsui/icons/Volume_mute_qt_1x.png differ diff --git a/src/settingsui/icons/Volume_up_qt_1x.png b/src/settingsui/icons/Volume_up_qt_1x.png new file mode 100644 index 0000000..45a8b61 Binary files /dev/null and b/src/settingsui/icons/Volume_up_qt_1x.png differ diff --git a/src/settingsui/icons/WifiAnim_black_2x.png b/src/settingsui/icons/WifiAnim_black_2x.png new file mode 100644 index 0000000..76c850d Binary files /dev/null and b/src/settingsui/icons/WifiAnim_black_2x.png differ diff --git a/src/settingsui/icons/Wifi_lightgray_2x.png b/src/settingsui/icons/Wifi_lightgray_2x.png new file mode 100644 index 0000000..3e6183a Binary files /dev/null and b/src/settingsui/icons/Wifi_lightgray_2x.png differ diff --git a/src/settingsui/icons/World_qt_6x.png b/src/settingsui/icons/World_qt_6x.png new file mode 100644 index 0000000..9024031 Binary files /dev/null and b/src/settingsui/icons/World_qt_6x.png differ diff --git a/src/settingsui/icons/generate_icons.sh b/src/settingsui/icons/generate_icons.sh new file mode 100755 index 0000000..55867b8 --- /dev/null +++ b/src/settingsui/icons/generate_icons.sh @@ -0,0 +1,27 @@ +############################################################################ +## +## Copyright (C) 2015 Digia Plc +## All rights reserved. +## For any questions to Digia, please use the contact form at +## http://www.qt.io +## +## This file is part of Qt Enterprise Embedded. +## +## Licensees holding valid Qt Enterprise licenses may use this file in +## accordance with the Qt Enterprise License Agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and Digia. +## +## If you have questions regarding the use of this file, please use +## the contact form at http://www.qt.io +## +############################################################################# +#!/bin/bash +# +# This script resizes and sets correct brand colors for the icons in ref folder +# + +./scripts/cimages.sh ./ref/*.png +./scripts/cimage.sh ./ref/extra/Alert.png red +./scripts/cimage.sh ./ref/extra/Alert.png yellow +./scripts/rimages.sh *.png diff --git a/src/settingsui/icons/ref/Audio.png b/src/settingsui/icons/ref/Audio.png new file mode 100644 index 0000000..8434f0a Binary files /dev/null and b/src/settingsui/icons/ref/Audio.png differ diff --git a/src/settingsui/icons/ref/Back.png b/src/settingsui/icons/ref/Back.png new file mode 100644 index 0000000..9029fd0 Binary files /dev/null and b/src/settingsui/icons/ref/Back.png differ diff --git a/src/settingsui/icons/ref/Bluetooth.png b/src/settingsui/icons/ref/Bluetooth.png new file mode 100644 index 0000000..e7c80a9 Binary files /dev/null and b/src/settingsui/icons/ref/Bluetooth.png differ diff --git a/src/settingsui/icons/ref/Camcorder.png b/src/settingsui/icons/ref/Camcorder.png new file mode 100644 index 0000000..8c317a2 Binary files /dev/null and b/src/settingsui/icons/ref/Camcorder.png differ diff --git a/src/settingsui/icons/ref/Camera.png b/src/settingsui/icons/ref/Camera.png new file mode 100644 index 0000000..c71ab25 Binary files /dev/null and b/src/settingsui/icons/ref/Camera.png differ diff --git a/src/settingsui/icons/ref/Chevron-left.png b/src/settingsui/icons/ref/Chevron-left.png new file mode 100644 index 0000000..95006f4 Binary files /dev/null and b/src/settingsui/icons/ref/Chevron-left.png differ diff --git a/src/settingsui/icons/ref/Chevron-right.png b/src/settingsui/icons/ref/Chevron-right.png new file mode 100644 index 0000000..2860e9a Binary files /dev/null and b/src/settingsui/icons/ref/Chevron-right.png differ diff --git a/src/settingsui/icons/ref/Circle-x.png b/src/settingsui/icons/ref/Circle-x.png new file mode 100644 index 0000000..2bbfa97 Binary files /dev/null and b/src/settingsui/icons/ref/Circle-x.png differ diff --git a/src/settingsui/icons/ref/Clock.png b/src/settingsui/icons/ref/Clock.png new file mode 100644 index 0000000..1dae63e Binary files /dev/null and b/src/settingsui/icons/ref/Clock.png differ diff --git a/src/settingsui/icons/ref/Cogs.png b/src/settingsui/icons/ref/Cogs.png new file mode 100644 index 0000000..feaae50 Binary files /dev/null and b/src/settingsui/icons/ref/Cogs.png differ diff --git a/src/settingsui/icons/ref/Connections.png b/src/settingsui/icons/ref/Connections.png new file mode 100644 index 0000000..b042d3c Binary files /dev/null and b/src/settingsui/icons/ref/Connections.png differ diff --git a/src/settingsui/icons/ref/Display.png b/src/settingsui/icons/ref/Display.png new file mode 100644 index 0000000..cf1251a Binary files /dev/null and b/src/settingsui/icons/ref/Display.png differ diff --git a/src/settingsui/icons/ref/Flag.png b/src/settingsui/icons/ref/Flag.png new file mode 100644 index 0000000..485ed48 Binary files /dev/null and b/src/settingsui/icons/ref/Flag.png differ diff --git a/src/settingsui/icons/ref/Headphones.png b/src/settingsui/icons/ref/Headphones.png new file mode 100644 index 0000000..9e5c483 Binary files /dev/null and b/src/settingsui/icons/ref/Headphones.png differ diff --git a/src/settingsui/icons/ref/Heartbeat.png b/src/settingsui/icons/ref/Heartbeat.png new file mode 100644 index 0000000..168135e Binary files /dev/null and b/src/settingsui/icons/ref/Heartbeat.png differ diff --git a/src/settingsui/icons/ref/Keyboard.png b/src/settingsui/icons/ref/Keyboard.png new file mode 100644 index 0000000..c814e8e Binary files /dev/null and b/src/settingsui/icons/ref/Keyboard.png differ diff --git a/src/settingsui/icons/ref/Laptop.png b/src/settingsui/icons/ref/Laptop.png new file mode 100644 index 0000000..465bb54 Binary files /dev/null and b/src/settingsui/icons/ref/Laptop.png differ diff --git a/src/settingsui/icons/ref/Lock.png b/src/settingsui/icons/ref/Lock.png new file mode 100644 index 0000000..6afb6ac Binary files /dev/null and b/src/settingsui/icons/ref/Lock.png differ diff --git a/src/settingsui/icons/ref/Microphone.png b/src/settingsui/icons/ref/Microphone.png new file mode 100644 index 0000000..63cb500 Binary files /dev/null and b/src/settingsui/icons/ref/Microphone.png differ diff --git a/src/settingsui/icons/ref/MobilePhone.png b/src/settingsui/icons/ref/MobilePhone.png new file mode 100644 index 0000000..b186c09 Binary files /dev/null and b/src/settingsui/icons/ref/MobilePhone.png differ diff --git a/src/settingsui/icons/ref/Mouse.png b/src/settingsui/icons/ref/Mouse.png new file mode 100644 index 0000000..146305b Binary files /dev/null and b/src/settingsui/icons/ref/Mouse.png differ diff --git a/src/settingsui/icons/ref/Plus.png b/src/settingsui/icons/ref/Plus.png new file mode 100644 index 0000000..391fe94 Binary files /dev/null and b/src/settingsui/icons/ref/Plus.png differ diff --git a/src/settingsui/icons/ref/Power.png b/src/settingsui/icons/ref/Power.png new file mode 100644 index 0000000..b54a084 Binary files /dev/null and b/src/settingsui/icons/ref/Power.png differ diff --git a/src/settingsui/icons/ref/Settings.png b/src/settingsui/icons/ref/Settings.png new file mode 100644 index 0000000..d8b255c Binary files /dev/null and b/src/settingsui/icons/ref/Settings.png differ diff --git a/src/settingsui/icons/ref/Tablet.png b/src/settingsui/icons/ref/Tablet.png new file mode 100644 index 0000000..71b0065 Binary files /dev/null and b/src/settingsui/icons/ref/Tablet.png differ diff --git a/src/settingsui/icons/ref/Volume_down.png b/src/settingsui/icons/ref/Volume_down.png new file mode 100644 index 0000000..0773b1d Binary files /dev/null and b/src/settingsui/icons/ref/Volume_down.png differ diff --git a/src/settingsui/icons/ref/Volume_mute.png b/src/settingsui/icons/ref/Volume_mute.png new file mode 100644 index 0000000..36ab384 Binary files /dev/null and b/src/settingsui/icons/ref/Volume_mute.png differ diff --git a/src/settingsui/icons/ref/Volume_up.png b/src/settingsui/icons/ref/Volume_up.png new file mode 100644 index 0000000..61eebbd Binary files /dev/null and b/src/settingsui/icons/ref/Volume_up.png differ diff --git a/src/settingsui/icons/ref/Wifi.png b/src/settingsui/icons/ref/Wifi.png new file mode 100644 index 0000000..5d1e0d9 Binary files /dev/null and b/src/settingsui/icons/ref/Wifi.png differ diff --git a/src/settingsui/icons/ref/Wifi1.png b/src/settingsui/icons/ref/Wifi1.png new file mode 100644 index 0000000..f1b1489 Binary files /dev/null and b/src/settingsui/icons/ref/Wifi1.png differ diff --git a/src/settingsui/icons/ref/Wifi2.png b/src/settingsui/icons/ref/Wifi2.png new file mode 100644 index 0000000..a22b472 Binary files /dev/null and b/src/settingsui/icons/ref/Wifi2.png differ diff --git a/src/settingsui/icons/ref/Wifi3.png b/src/settingsui/icons/ref/Wifi3.png new file mode 100644 index 0000000..76d412b Binary files /dev/null and b/src/settingsui/icons/ref/Wifi3.png differ diff --git a/src/settingsui/icons/ref/Wifi4.png b/src/settingsui/icons/ref/Wifi4.png new file mode 100644 index 0000000..5d1e0d9 Binary files /dev/null and b/src/settingsui/icons/ref/Wifi4.png differ diff --git a/src/settingsui/icons/ref/WifiAnim.png b/src/settingsui/icons/ref/WifiAnim.png new file mode 100644 index 0000000..0694f63 Binary files /dev/null and b/src/settingsui/icons/ref/WifiAnim.png differ diff --git a/src/settingsui/icons/ref/World.png b/src/settingsui/icons/ref/World.png new file mode 100644 index 0000000..cf6eaf0 Binary files /dev/null and b/src/settingsui/icons/ref/World.png differ diff --git a/src/settingsui/icons/ref/Wrench.png b/src/settingsui/icons/ref/Wrench.png new file mode 100644 index 0000000..5b6e1c6 Binary files /dev/null and b/src/settingsui/icons/ref/Wrench.png differ diff --git a/src/settingsui/icons/ref/extra/Alert.png b/src/settingsui/icons/ref/extra/Alert.png new file mode 100644 index 0000000..80914fc Binary files /dev/null and b/src/settingsui/icons/ref/extra/Alert.png differ diff --git a/src/settingsui/icons/scripts/cimage.sh b/src/settingsui/icons/scripts/cimage.sh new file mode 100755 index 0000000..ae73622 --- /dev/null +++ b/src/settingsui/icons/scripts/cimage.sh @@ -0,0 +1,45 @@ +############################################################################ +## +## Copyright (C) 2015 Digia Plc +## All rights reserved. +## For any questions to Digia, please use the contact form at +## http://www.qt.io +## +## This file is part of Qt Enterprise Embedded. +## +## Licensees holding valid Qt Enterprise licenses may use this file in +## accordance with the Qt Enterprise License Agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and Digia. +## +## If you have questions regarding the use of this file, please use +## the contact form at http://www.qt.io +## +############################################################################# +#!/bin/bash + +fullfile=$1 +filename=$(basename "$fullfile") +extension="${filename##*.}" +filename="${filename%.*}" + +color=$2 +if [ "$color" = "qt" ]; then + fill='rgb(128,195,66)' +elif [ "$color" = "black" ]; then + fill='rgb(32,40,42)' +elif [ "$color" = "white" ]; then + fill='rgb(255,255,255)' +elif [ "$color" = "lightgray" ]; then + fill='rgb(214,214,214)' +elif [ "$color" = "red" ]; then + fill='rgb(228,30,37)' +elif [ "$color" = "yellow" ]; then + fill='rgb(250,206,32)' +else + fill="black" +fi + +separator="_" + +convert $fullfile -fuzz 100% -fill $fill -opaque black $filename$separator$color.$extension diff --git a/src/settingsui/icons/scripts/cimages.sh b/src/settingsui/icons/scripts/cimages.sh new file mode 100755 index 0000000..94ac1cd --- /dev/null +++ b/src/settingsui/icons/scripts/cimages.sh @@ -0,0 +1,28 @@ +############################################################################ +## +## Copyright (C) 2015 Digia Plc +## All rights reserved. +## For any questions to Digia, please use the contact form at +## http://www.qt.io +## +## This file is part of Qt Enterprise Embedded. +## +## Licensees holding valid Qt Enterprise licenses may use this file in +## accordance with the Qt Enterprise License Agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and Digia. +## +## If you have questions regarding the use of this file, please use +## the contact form at http://www.qt.io +## +############################################################################# +#!/bin/bash + +for dir in "$@" +do + echo "$dir" + scripts/cimage.sh $dir qt + scripts/cimage.sh $dir black + scripts/cimage.sh $dir white + scripts/cimage.sh $dir lightgray +done diff --git a/src/settingsui/icons/scripts/rimage.sh b/src/settingsui/icons/scripts/rimage.sh new file mode 100755 index 0000000..d98088f --- /dev/null +++ b/src/settingsui/icons/scripts/rimage.sh @@ -0,0 +1,37 @@ +############################################################################ +## +## Copyright (C) 2015 Digia Plc +## All rights reserved. +## For any questions to Digia, please use the contact form at +## http://www.qt.io +## +## This file is part of Qt Enterprise Embedded. +## +## Licensees holding valid Qt Enterprise licenses may use this file in +## accordance with the Qt Enterprise License Agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and Digia. +## +## If you have questions regarding the use of this file, please use +## the contact form at http://www.qt.io +## +############################################################################# +#!/bin/bash +fullfile=$1 +filename=$(basename "$fullfile") +extension="${filename##*.}" +filename="${filename%.*}" + +postix="_1x" +convert $fullfile -resize x16 $filename$postix.$extension +postix="_2x" +convert $fullfile -resize x32 $filename$postix.$extension +postix="_3x" +convert $fullfile -resize x48 $filename$postix.$extension +postix="_4x" +convert $fullfile -resize x64 $filename$postix.$extension +postix="_5x" +convert $fullfile -resize x80 $filename$postix.$extension +postix="_6x" +convert $fullfile -resize x96 $filename$postix.$extension + diff --git a/src/settingsui/icons/scripts/rimages.sh b/src/settingsui/icons/scripts/rimages.sh new file mode 100755 index 0000000..7b76da8 --- /dev/null +++ b/src/settingsui/icons/scripts/rimages.sh @@ -0,0 +1,25 @@ +############################################################################ +## +## Copyright (C) 2015 Digia Plc +## All rights reserved. +## For any questions to Digia, please use the contact form at +## http://www.qt.io +## +## This file is part of Qt Enterprise Embedded. +## +## Licensees holding valid Qt Enterprise licenses may use this file in +## accordance with the Qt Enterprise License Agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and Digia. +## +## If you have questions regarding the use of this file, please use +## the contact form at http://www.qt.io +## +############################################################################# +#!/bin/bash + +for dir in "$@" +do + echo "$dir" + scripts/rimage.sh $dir +done diff --git a/src/settingsui/locale/Language.qml b/src/settingsui/locale/Language.qml new file mode 100644 index 0000000..6e4e3ad --- /dev/null +++ b/src/settingsui/locale/Language.qml @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.5 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles.Flat 1.0 as Flat +import "../common" +import com.theqtcompany.settings.locale 1.0 + +Item { + id: root + property string title: qsTr("Language and Region") + + Column { + id: content + anchors.fill: parent + anchors.margins: Math.round(40 * Flat.FlatStyle.scaleFactor) + + GroupBox { + id: groupBox + width: parent.width + title: qsTr("Regional Format") + Layout.fillWidth: true + property var currentRegion: Qt.locale(LocaleManager.locale) + + ColumnLayout { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + width: parent.width + Layout.fillWidth: true + + Component { + id: regionSelect + RegionSelect { } + } + + 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"); + } + } + + flat: true + + ColumnLayout { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + Layout.fillWidth: true + width: parent.width + + TextLabel { + text: Date().toLocaleString(groupBox.currentRegion) + } + + TextLabel { + text: Number(2343.34).toLocaleString(groupBox.currentRegion) + } + + TextLabel { + text: Number(41334.34).toLocaleCurrencyString(groupBox.currentRegion) + } + } + } + + Button { + text: qsTr("Change region") + onClicked: stackView.push(regionSelect) + } + } + } + } +} diff --git a/src/settingsui/locale/RegionSelect.qml b/src/settingsui/locale/RegionSelect.qml new file mode 100644 index 0000000..2d13afe --- /dev/null +++ b/src/settingsui/locale/RegionSelect.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.5 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles.Flat 1.0 as Flat +import "../common" +import com.theqtcompany.settings.locale 1.0 + +Item { + id: root + property string title: qsTr("Select language") + + Component.onCompleted: country.text = LocaleFilter.filter + + Column { + id: content + anchors.fill: parent + anchors.margins: Math.round(20 * Flat.FlatStyle.scaleFactor) + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + + TextLabel { + text: qsTr("Search region: ") + } + + TextField { + id: country + text: "" + onTextChanged: LocaleFilter.filter = country.text + } + } + + TableView { + width: parent.width + height: Math.round(parent.height - 40 * Flat.FlatStyle.scaleFactor) + Layout.fillWidth: true + model: LocaleFilter + headerVisible: true + + TableViewColumn { + role: "language" + title: qsTr("Language") + width: Math.round(parent.width * 0.66) + } + + TableViewColumn { + role: "country" + title: qsTr("Region") + width: Math.round(parent.width * 0.33) + } + + onClicked: { + var val = model.itemFromRow(row); + if (val !== "") { + LocaleManager.locale = val; + stackView.pop(); + } + } + } + } +} diff --git a/src/settingsui/main.cpp b/src/settingsui/main.cpp new file mode 100644 index 0000000..b345225 --- /dev/null +++ b/src/settingsui/main.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the FOO module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + + QQmlApplicationEngine engine; + engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); + + return app.exec(); +} diff --git a/src/settingsui/main.qml b/src/settingsui/main.qml new file mode 100644 index 0000000..7d0d864 --- /dev/null +++ b/src/settingsui/main.qml @@ -0,0 +1,171 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the FOO 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.5 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles.Flat 1.0 as Flat +import QtQuick.XmlListModel 2.0 +import "common" +import com.theqtcompany.localdevice 1.0 + +ApplicationWindow { + id: root + title: qsTr("Device settings") + width: 800 + height: 600 + visible: true + property var service + + SystemPalette { id: systemPalette; colorGroup: SystemPalette.Active } + + toolBar:ToolBar { + id: titlebar + property string title: "" + implicitWidth: parent.width + implicitHeight: Math.round(40 * Flat.FlatStyle.scaleFactor) + Item { + anchors.fill: parent + + ToolButton { + iconSource: "../icons/Chevron-left_black_1x.png" + text: "" + visible: stackView.depth > 1 + height: parent.height + width: parent.height + onClicked: stackView.pop(); + } + TextLabel { + id: titleText + font.pixelSize: Math.round(16 * Flat.FlatStyle.scaleFactor) + anchors.fill: parent + text: stackView.currentItem.title + } + + + ToolButton { + iconSource: "../icons/Power_black_1x.png" + text: "" + visible: stackView.depth == 1 + height: parent.height + width: parent.height + anchors.right: parent.right + onClicked: { + menu.__xOffset = Math.round(-100 * Flat.FlatStyle.scaleFactor); + menu.popup(); + } + } + } + } + + Menu { + id: menu + title: "" + enabled: false + + MenuItem { + text: qsTr("Reboot") + onTriggered: LocalDevice.reboot() + } + + MenuItem { + text: qsTr("Shutdown") + onTriggered: LocalDevice.powerOff() + } + } + + StackView { + id: stackView + initialItem: mainView + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + + Component { + id: mainView + Item { + property string title: qsTr("Device Settings") + XmlListModel { + id: xmlModel + source: "settingsview.xml" + query: "/xml/settings/item" + XmlRole { name: "title"; query: "title/string()"} + XmlRole { name: "icon"; query: "icon/string()"} + XmlRole { name: "path"; query: "path/string()"} + XmlRole { name: "view"; query: "view/string()"} + } + + GridView { + id: grid + anchors.fill: parent + anchors.margins: Math.round(40 * Flat.FlatStyle.scaleFactor) + cellHeight: Math.round(133 * Flat.FlatStyle.scaleFactor) + spacing + cellWidth: Math.round(117 * Flat.FlatStyle.scaleFactor) + spacing + property int spacing: Math.round(20 * Flat.FlatStyle.scaleFactor) + + model: xmlModel + 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: Math.round(10 * Flat.FlatStyle.scaleFactor) + Image { + id: image + source: icon + anchors.horizontalCenter: parent.horizontalCenter + } + + TextLabel { + text: title + anchors.horizontalCenter: parent.horizontalCenter + font.pixelSize: Math.round(16 * Flat.FlatStyle.scaleFactor) + } + } + + onClicked: { + var url = 'import "' + path + '"; ' + view + ' {}'; + stackView.push({item: Qt.createQmlObject(url,stackView)}); + titlebar.title = title + } + } + } + } + } + } +} diff --git a/src/settingsui/network/EditWiredSettings.qml b/src/settingsui/network/EditWiredSettings.qml new file mode 100644 index 0000000..1249e46 --- /dev/null +++ b/src/settingsui/network/EditWiredSettings.qml @@ -0,0 +1,641 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.5 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles.Flat 1.0 as Flat +import "../common" +import com.theqtcompany.settings.network 1.0 + +Item { + id: root + property string title: qsTr("Ethernet Settings") + property var service: undefined + + property bool ipv4Changed: false + property bool ipv6Changed: false + property bool nameserversChanged: false + property bool domainsChanged: false + property bool proxyChanged: false + + Component.onDestruction: { + //Clear all unsaved changes from models + service.proxy.excludes.resetChanges(); + service.nameservers.resetChanges(); + service.domains.resetChanges(); + } + + Component.onCompleted: titlebar.title = service.name; + + Flickable { + anchors.fill: parent + anchors.top: saveButton.bottom + anchors.margins: Math.round(40 * Flat.FlatStyle.scaleFactor) + anchors.bottomMargin: Math.round(20 * Flat.FlatStyle.scaleFactor) + contentHeight: content.height + contentWidth: width + interactive: !ipv4Method.popupVisible && !ipv6Method.popupVisible && !proxyMethodSel.popupVisible + Column { + id: content + width: parent.width + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + property int titleWidth: Math.round(width * 0.382) + property int groupWidth: Math.round(width - saveButton.width - 10 * Flat.FlatStyle.scaleFactor) + + //IPv4 Config + GroupBox { + flat: false + width: content.groupWidth + Layout.fillWidth: true + title: qsTr("IPv4") + + ColumnLayout { + anchors.fill: parent + + ListModel { + id: methodsModel + + ListElement { + text: "DHCP" + method: NetworkSettingsIPv4.Dhcp + } + ListElement { + text: "Manual" + method: NetworkSettingsIPv4.Manual + } + ListElement { + text: "Off" + method: NetworkSettingsIPv4.Off + } + } + + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + TextLabel { + text: qsTr("Connection method") + width: content.titleWidth + horizontalAlignment: Text.AlignRight + } + + CustomCombobox { + id: ipv4Method + model: methodsModel + Component.onCompleted: selectedIndex = service.ipv4.method + + onSelectedIndexChanged : { + ipv4Changed = true; + service.ipv4.method = model.get(selectedIndex).method; + } + delegate: FlatStyledDropdownDelegate { } + } + } + + Column { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + visible: service.ipv4.method === NetworkSettingsIPv4.Dhcp + + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + TextLabel { + text: qsTr("Address") + width: content.titleWidth + horizontalAlignment: Text.AlignRight + } + TextLabel { + text: service.ipv4.address + } + } + + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + TextLabel { + text: qsTr("Mask") + width: content.titleWidth + horizontalAlignment: Text.AlignRight + } + TextLabel { + text: service.ipv4.mask + } + } + + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + TextLabel { + text: qsTr("Router") + width: content.titleWidth + horizontalAlignment: Text.AlignRight + } + TextLabel { + text: service.ipv4.gateway + } + } + } + + Column { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + visible: service.ipv4.method === NetworkSettingsIPv4.Manual + + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + TextLabel { + text: qsTr("Address") + width: content.titleWidth + horizontalAlignment: Text.AlignRight + } + IpAddressTextField { + id: ipv4Address + text: service.ipv4.address + onTextChanged: ipv4Changed = true; + + onAccepted: if (text.length > 0) service.ipv4.address = text + } + } + + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + TextLabel { + text: qsTr("Mask") + width: content.titleWidth + horizontalAlignment: Text.AlignRight + } + IpAddressTextField { + id: ipv4Mask + text: service.ipv4.mask + onTextChanged: ipv4Changed = true; + onAccepted: if (text.length > 0) service.ipv4.mask = text + } + } + + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + TextLabel { + text: qsTr("Router") + width: content.titleWidth + horizontalAlignment: Text.AlignRight + } + IpAddressTextField { + id: ipv4Gateway + text: service.ipv4.gateway + + onTextChanged: ipv4Changed = true + + onAccepted: if (text.length > 0) service.ipv4.gateway = text + } + } + } + } + } + + //IPv6 Config + GroupBox { + flat: false + width: content.groupWidth + Layout.fillWidth: true + title: qsTr("IPv6") + + ColumnLayout { + anchors.fill: parent + + ListModel { + id: ipv6methodsmodel + + ListElement { + text: qsTr("Auto") + method: NetworkSettingsIPv6.Auto + } + ListElement { + text: qsTr("Manual") + method: NetworkSettingsIPv6.Manual + } + ListElement { + text: qsTr("Off") + method: NetworkSettingsIPv6.Off + } + } + + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + TextLabel { + text: qsTr("Connection method: ") + width: content.titleWidth + horizontalAlignment: Text.AlignRight + } + + CustomCombobox { + id: ipv6Method + model: ipv6methodsmodel + Component.onCompleted: selectedIndex = service.ipv6.method + onSelectedIndexChanged : { + ipv6Changed = true; + service.ipv6.method = model.get(selectedIndex).method; + } + delegate: FlatStyledDropdownDelegate { } + } + } + + Column { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + visible: service.ipv6.method === NetworkSettingsIPv6.Auto + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + TextLabel { + text: qsTr("Address") + width: content.titleWidth + horizontalAlignment: Text.AlignRight + } + TextLabel { + text: service.ipv6.address + } + } + + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + TextLabel { + text: qsTr("Router") + width: content.titleWidth + horizontalAlignment: Text.AlignRight + } + TextLabel { + text: service.ipv6.gateway + } + } + + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + TextLabel { + text: qsTr("Prefix length") + width: content.titleWidth + horizontalAlignment: Text.AlignRight + } + TextLabel { + text: service.ipv6.prefixLength + } + } + } + + Column { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + visible: service.ipv6.method === NetworkSettingsIPv6.Manual + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + TextLabel { + text: qsTr("Address") + width: content.titleWidth + horizontalAlignment: Text.AlignRight + } + TextField { + id: ipv6Address + text: service.ipv6.address + onTextChanged: ipv6Changed = true; + onAccepted: if (text.length > 0) service.ipv6.address = text + } + } + + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + TextLabel { + text: qsTr("Router") + width: content.titleWidth + horizontalAlignment: Text.AlignRight + } + TextField { + id: ipv6Gateway + text: service.ipv6.gateway + onTextChanged: ipv6Changed = true; + onAccepted: if (text.length > 0) service.ipv4.gateway = text + } + } + + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + TextLabel { + text: qsTr("Prefix length") + width: content.titleWidth + horizontalAlignment: Text.AlignRight + } + TextField { + id: ipv6PrefixLength + text: service.ipv6.prefixLength + validator: IntValidator { bottom: 0; top: 255 } + + onTextChanged: ipv6Changed = true + + onAccepted: if (text.length > 0) service.ipv6.prefixLength = parseInt(text) + } + } + } + } + } + + GroupBox { + flat: false + width: content.groupWidth + Layout.fillWidth: true + title: qsTr("Name servers") + + ColumnLayout { + anchors.fill: parent + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + TextLabel { + text: qsTr("Address") + width: content.titleWidth + horizontalAlignment: Text.AlignRight + } + Column { + Repeater { + model: service.nameservers + + Row { + TextField { + text: edit + onTextChanged: { + nameserversChanged = true; + edit = text; + } + } + Button { + implicitWidth: height + text: "-" + onClicked: { + service.nameservers.remove(index); + nameserversChanged = true; + } + } + Button { + implicitWidth: height + visible: index==service.nameservers.count-1 + text: "+" + onClicked: service.nameservers.append("") + } + } + } + } + Row { + TextField { + id: nameServerEntryItem + visible: service.nameservers.count === 0 + text: "" + onAccepted: service.nameservers.append(text) + } + Button { + implicitWidth: height + visible: nameServerEntryItem.visible + text: "+" + onClicked: nameServerEntryItem.accepted() + } + } + } + } + } + + GroupBox { + flat: false + width: content.groupWidth + Layout.fillWidth: true + title: qsTr("Domains") + + ColumnLayout { + anchors.fill: parent + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + TextLabel { + text: qsTr("Address") + width: content.titleWidth + horizontalAlignment: Text.AlignRight + } + Column { + Repeater { + model: service.domains + Row { + TextField { + text: edit + onTextChanged: { + root.domainsChanged = true; + edit = text; + } + } + Button { + implicitWidth: height + text: "-" + onClicked: { + service.domains.remove(index); + domainsChanged.domainsChanged = true; + } + } + Button { + implicitWidth: height + visible: index==service.domains.count-1 + text: "+" + onClicked: service.domains.append("") + } + } + } + } + Row { + TextField { + id: domainsEntryItem + visible: service.domains.count === 0 + text: "" + onAccepted: service.domains.append(text) + } + Button { + implicitWidth: height + visible: domainsEntryItem.visible + text: "+" + onClicked: domainsEntryItem.accepted() + } + } + } + } + } + + GroupBox { + flat: false + width: content.groupWidth + Layout.fillWidth: true + title: qsTr("Proxy Settings") + + ColumnLayout { + anchors.fill: parent + + ListModel { + id: proxyMethodModel + + ListElement { + text: qsTr("Direct") + method: NetworkSettingsProxy.Direct + } + ListElement { + text: qsTr("Auto") + method: NetworkSettingsProxy.Auto + } + ListElement { + text: qsTr("Manual") + method: NetworkSettingsProxy.Manual + } + } + + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + TextLabel { + text: qsTr("Configuration") + width: content.titleWidth + horizontalAlignment: Text.AlignRight + } + + CustomCombobox { + id: proxyMethodSel + model: proxyMethodModel + Component.onCompleted: selectedIndex = service.proxy.method + onSelectedIndexChanged : { + proxyChanged = true; + service.proxy.method = model.get(selectedIndex).method; + } + delegate: FlatStyledDropdownDelegate { } + } + } + + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + visible: service.proxy.method !== NetworkSettingsProxy.Direct + TextLabel { + text: service.proxy.method === NetworkSettingsProxy.Manual ? qsTr("Proxy address") : qsTr("Automatic configuration URL") + + width: content.titleWidth + horizontalAlignment: Text.AlignRight + } + TextField { + id: proxyUrl + text: service.proxy.url + onTextChanged: proxyChanged = true; + onAccepted: service.proxy.url = text; + } + } + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + visible: service.proxy.method === NetworkSettingsProxy.Manual + + TextLabel { + text: qsTr("No proxy for") + width: content.titleWidth + horizontalAlignment: Text.AlignRight + } + + Column { + Repeater { + model: service.proxy.excludes + + Row { + TextField { + text: edit + onTextChanged: edit = text + } + Button { + implicitWidth: height + text: "-" + onClicked: { + service.proxy.excludes.remove(index); + proxyChanged = true; + } + } + Button { + implicitWidth: height + visible: index==service.proxy.excludes.count-1 + text: "+" + onClicked: service.proxy.excludes.append("") + } + } + } + } + Row { + TextField { + id: proxyEntryItem + visible: service.proxy.excludes.count === 0 + text: "" + onAccepted: service.proxy.excludes.append(text) + } + Button { + implicitWidth: height + visible: proxyEntryItem.visible + text: "+" + onClicked: proxyEntryItem.accepted() + } + } + } + } + } + } + } + + Button { + id: saveButton + anchors.right: parent.right + anchors.top: parent.top + anchors.margins: Math.round(10 * Flat.FlatStyle.scaleFactor) + anchors.rightMargin: Math.round(40 * Flat.FlatStyle.scaleFactor) + text: qsTr("Save") + + onClicked: { + if (ipv4Changed) { + ipv4Address.accepted(); + ipv4Mask.accepted(); + ipv4Gateway.accepted(); + service.setupIpv4Config(); + } + + if (ipv6Changed) { + ipv6Address.accepted(); + ipv6Gateway.accepted(); + ipv6PrefixLength.accepted(); + service.setupIpv6Config(); + } + + if (nameserversChanged) { + service.setupNameserversConfig(); + } + + if (domainsChanged) { + service.setupDomainsConfig(); + } + if (proxyChanged) { + proxyUrl.accepted(); + service.setupNetworkSettingsProxy(); + } + stackView.pop(); + } + } +} diff --git a/src/settingsui/network/IpAddressTextField.qml b/src/settingsui/network/IpAddressTextField.qml new file mode 100644 index 0000000..102d458 --- /dev/null +++ b/src/settingsui/network/IpAddressTextField.qml @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.5 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.4 + +TextField { + Layout.fillWidth: true + validator: RegExpValidator { regExp: /^(\d|[1-9]\d|1\d\d|2([0-4]\d|5[0-5]))\.(\d|[1-9]\d|1\d\d|2([0-4]\d|5[0-5]))\.(\d|[1-9]\d|1\d\d|2([0-4]\d|5[0-5]))\.(\d|[1-9]\d|1\d\d|2([0-4]\d|5[0-5]))$/ } +} diff --git a/src/settingsui/network/NetworkDetails.qml b/src/settingsui/network/NetworkDetails.qml new file mode 100644 index 0000000..3e71be0 --- /dev/null +++ b/src/settingsui/network/NetworkDetails.qml @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.5 + +Loader { + id: root + property var selectedInterface:undefined + anchors.fill: parent +} diff --git a/src/settingsui/network/NetworkSettings.qml b/src/settingsui/network/NetworkSettings.qml new file mode 100644 index 0000000..2eed812 --- /dev/null +++ b/src/settingsui/network/NetworkSettings.qml @@ -0,0 +1,137 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.5 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles.Flat 1.0 as Flat +import "../common" +import com.theqtcompany.settings.network 1.0 + +Item { + property string title: qsTr("Network Settings") + GroupBox { + id: networkSelect + anchors.fill: parent + anchors.rightMargin: parent.width * 0.618 + anchors.leftMargin: Math.round(20 * Flat.FlatStyle.scaleFactor) + anchors.topMargin: Math.round(20 * Flat.FlatStyle.scaleFactor) + 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: networkSelect.width + ExclusiveGroup { + id: exgroup + } + + Repeater { + model: NetworkSettingsManager.interfaces + + Button { + implicitWidth: networkSelect.width - Math.round(20 * Flat.FlatStyle.scaleFactor) + implicitHeight: Math.round(54 * Flat.FlatStyle.scaleFactor) + checkable: true + exclusiveGroup: exgroup + + Row { + anchors.fill: parent + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + + Image { + id: typeId + height: parent.height + width: height + } + + Column { + height: Math.round(parent.height * 0.7) + spacing: 0 + anchors.verticalCenter: parent.verticalCenter + TextLabel { + text: name + } + + TextLabel { + text: networkSelect.stateToStr(modelData.state) + font.pixelSize: Math.round(12 * Flat.FlatStyle.scaleFactor) + } + + } + } + + 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"; + } + } + } + } + } + } + } + + NetworkDetails { + id: networkDetails + anchors.fill: parent + anchors.leftMargin: networkSelect.width + Math.round(20 * Flat.FlatStyle.scaleFactor) + } +} diff --git a/src/settingsui/network/WifiSelectorDelegate.qml b/src/settingsui/network/WifiSelectorDelegate.qml new file mode 100644 index 0000000..72216a6 --- /dev/null +++ b/src/settingsui/network/WifiSelectorDelegate.qml @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.5 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.4 +import "../common" +import com.theqtcompany.settings.network 1.0 +import QtQuick.Controls.Styles.Flat 1.0 as Flat + +Item { + id: root + property bool checkable: true + property bool checked: false + property bool pressed: false + property bool connect: modelData["connected"] + signal clicked() + + MouseArea { + id: delegateButton + anchors.fill: parent + hoverEnabled: true + onPressed: root.pressed = true + onClicked: root.clicked() + onEntered: checked = !checked + + Rectangle { + anchors.fill: parent + color: root.checked ? Flat.FlatStyle.disabledColor : "transparent" + opacity: root.checked ? 0.15 : 1.0 + } + Rectangle { + color: Flat.FlatStyle.darkFrameColor + width: parent.width + height: Flat.FlatStyle.onePixel + anchors.bottom: parent.bottom + } + TextLabel { + id: text + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.margins: Math.round(10 * Flat.FlatStyle.scaleFactor) + horizontalAlignment: Text.AlignLeft + text: modelData["name"] + } + WifiSignalMonitor { + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.margins: Math.round(10 * Flat.FlatStyle.scaleFactor) + height: Math.round(parent.height * .8) + width: height + signalStrength: modelData["signalStrength"] + connected: modelData["connected"] + } + } +} diff --git a/src/settingsui/network/WifiSettings.qml b/src/settingsui/network/WifiSettings.qml new file mode 100644 index 0000000..352ec3c --- /dev/null +++ b/src/settingsui/network/WifiSettings.qml @@ -0,0 +1,189 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.5 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles.Flat 1.0 as Flat +import "../common" +import com.theqtcompany.settings.network 1.0 + +Item { + id: root + anchors.fill: parent + anchors.margins: Math.round(20 * Flat.FlatStyle.scaleFactor) + + Component.onCompleted: { + NetworkSettingsManager.services.type = NetworkSettingsType.Wifi; + } + GroupBox { + id: content + title: qsTr("Wireless Settings") + anchors.fill: parent + Layout.fillWidth: true + flat: true + + ColumnLayout { + spacing: Math.round(20 * Flat.FlatStyle.scaleFactor) + width: parent.width + Row { + id: enableSwitch + width: parent.width + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + TextLabel { + width: root.width*0.382 + horizontalAlignment: Text.AlignRight + text: selectedInterface.powered ? qsTr("Disable Wifi") : qsTr("Enable Wifi") + } + Switch { + checked: selectedInterface.powered + onCheckedChanged: selectedInterface.powered = checked + } + } + + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + width: parent.width + + TextLabel { + id: labelText + text: qsTr("Selected network ") + width: content.width*0.382 + horizontalAlignment: Text.AlignRight + } + + CustomCombobox { + id: networkSelection + model: NetworkSettingsManager.services + visible: selectedInterface.powered + width: Math.round(200 * Flat.FlatStyle.scaleFactor) + textRole: "name" + onSelectedIndexChanged : if (selectedIndex >= 0) model.itemFromRow(selectedIndex).connectService(); + + delegate: WifiSelectorDelegate { + id: delegate + onConnectChanged: if (connect) networkSelection.setSelectIndexToVal(modelData.name, "name"); + } + } + } + + GroupBox { + id: connectView + title: qsTr("Enter a password") + flat: false + visible: false + ColumnLayout { + Row { + id: errorView + property alias text: text.text + visible: text.text !== "" + + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + Image { + source: "../icons/Alert_yellow_1x.png" + } + Text { + id: text + color: "#face20" + text: "" + } + } + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + visible: false + TextLabel { + text: qsTr("User name") + width: root.width*0.382 + horizontalAlignment: Text.AlignRight + } + TextField { + text: "" + inputMethodHints: Qt.ImhNoPredictiveText + } + } + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + TextLabel { + text: qsTr("Password") + horizontalAlignment: Text.AlignRight + } + TextField { + id: password + text: "" + echoMode: TextInput.Password + inputMethodHints: Qt.ImhNoPredictiveText + } + } + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + Button { + text: qsTr("Connect") + onClicked: { + connectView.visible = false + NetworkSettingsUserAgent.setUserCredentials("", password.text) + } + } + Button { + text: qsTr("Cancel") + onClicked:connectView.visible = false + } + } + } + } + + Button { + id: disconnect + text: qsTr("Disconnect") + visible: selectedInterface.state === NetworkSettingsState.Online || + selectedInterface.state === NetworkSettingsState.Ready + onClicked: { + NetworkSettingsManager.services.itemFromRow(networkSelection.selectedIndex).disconnectService(); + networkSelection.selectedIndex = -1; + } + } + } + + Connections { + target: NetworkSettingsUserAgent + onShowUserCredentialsInput : { + connectView.visible = true + } + onError: { + errorView.visible = true + connectView.visible = true + } + } + } +} diff --git a/src/settingsui/network/WifiSignalMonitor.qml b/src/settingsui/network/WifiSignalMonitor.qml new file mode 100644 index 0000000..35d9e53 --- /dev/null +++ b/src/settingsui/network/WifiSignalMonitor.qml @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.5 + +Item { + id: root + + property bool scanning: false + property int signalStrength: 100 + property bool connected: false + + onSignalStrengthChanged: { + sprite.visible = true; + + if (signalStrength < 10) { + sprite.visible = false; + } + else if (signalStrength < 30) { + sprite.currentFrame = 0; + } + else if (signalStrength < 60) { + sprite.currentFrame = 1; + } + else if (signalStrength < 80) { + sprite.currentFrame = 2; + } + else if (signalStrength <= 100) { + sprite.currentFrame = 3; + } + } + + Image { + anchors.fill: parent + source: "Wifi_lightgray_2x.png" + } + + AnimatedSprite { + id: sprite + anchors.fill: parent + source: connected ? "WifiAnim_qt_2x.png" : "WifiAnim_black_2x.png" + frameDuration: 500 + frameCount: 4 + currentFrame: 3 + frameSync: false + frameWidth: 32 + frameHeight: 32 + loops: 40 + running: scanning + } +} diff --git a/src/settingsui/network/WiredSettings.qml b/src/settingsui/network/WiredSettings.qml new file mode 100644 index 0000000..aad97fe --- /dev/null +++ b/src/settingsui/network/WiredSettings.qml @@ -0,0 +1,207 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.5 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles.Flat 1.0 as Flat +import "../common" +import com.theqtcompany.settings.network 1.0 + +Item { + id: root + anchors.fill: parent + anchors.margins: Math.round(20 * Flat.FlatStyle.scaleFactor) + property bool editMode: false + property var service: null + property string title: qsTr("Network"); + + Component.onCompleted: { + NetworkSettingsManager.services.type = NetworkSettingsType.Wired; + root.service = NetworkSettingsManager.services.itemFromRow(0); + } + + ListModel { + id: methodsModel + + ListElement { + text: "DHCP" + method: NetworkSettingsIPv4.Dhcp + } + ListElement { + text: "Manual" + method: NetworkSettingsIPv4.Manual + } + ListElement { + text: "Off" + method: NetworkSettingsIPv4.Off + } + } + + GroupBox { + title: qsTr("Ethernet Connection") + anchors.fill: parent + Layout.fillWidth: true + flat: true + Column { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + Row { + TextLabel { + text: qsTr("Connection method: ") + } + + CustomCombobox { + id: ipv4Method + model: methodsModel + Component.onCompleted: selectedIndex = service.ipv4.method + onSelectedIndexChanged : { + if (model.get(selectedIndex).method !== NetworkSettingsIPv4.Dhcp) { + service.ipv4.method = model.get(selectedIndex).method; + editMode = true; + } + else { + //Enable DHCP + if (service.ipv4.method !== model.get(selectedIndex).method) { + service.ipv4.method = model.get(selectedIndex).method; + service.setupIpv4Config(); + } + + editMode = false; + } + } + delegate: FlatStyledDropdownDelegate { } + } + } + + Row { + visible: service.ipv4.method !== NetworkSettingsIPv4.Off + TextLabel { + text: qsTr("IP Address: ") + } + TextLabel { + text: service.ipv4.address + visible: !editMode + } + IpAddressTextField { + id: ipv4Address + placeholderText: service.ipv4.address + visible: editMode + onAccepted: if (text.length > 0) service.ipv4.address = text + } + } + + Row { + visible: service.ipv4.method !== NetworkSettingsIPv4.Off + TextLabel { + text: qsTr("Mask: ") + } + TextLabel { + text: service.ipv4.mask + visible: !editMode + } + IpAddressTextField { + id: ipv4Mask + placeholderText: service.ipv4.mask + visible: editMode + onAccepted: if (text.length > 0) service.ipv4.mask = text + } + } + + Row { + visible: service.ipv4.method !== NetworkSettingsIPv4.Off + TextLabel { + text: qsTr("Router: ") + } + TextLabel { + text: service.ipv4.gateway + visible: !editMode + } + IpAddressTextField { + id: ipv4Gateway + placeholderText: service.ipv4.gateway + visible: editMode + onAccepted: if (text.length > 0) service.ipv4.gateway = text + } + } + + Row { + visible: service.ipv4.method !== NetworkSettingsIPv4.Off + TextLabel { + text: qsTr("DNS server: ") + } + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + Repeater { + model: service.nameservers + + TextLabel { + text: display + } + } + } + } + + Row { + Button { + text: qsTr("Save") + visible: editMode + + onClicked: { + ipv4Address.accepted(); + ipv4Mask.accepted(); + ipv4Gateway.accepted(); + service.setupIpv4Config(); + editMode = false; + } + } + Button { + text: qsTr("Cancel") + visible: editMode + onClicked: { + editMode = false; + methodSelection.currentIndex = service.ipv4.method + } + } + } + Button { + text: qsTr("Edit") + visible: !editMode + + onClicked: stackView.push({item: Qt.resolvedUrl("EditWiredSettings.qml"), properties: {service: root.service}}); + } + } + } +} + diff --git a/src/settingsui/qml.qrc b/src/settingsui/qml.qrc new file mode 100644 index 0000000..5ed5504 --- /dev/null +++ b/src/settingsui/qml.qrc @@ -0,0 +1,26 @@ + + + main.qml + settingsview.xml + common/CustomCombobox.qml + common/FlatStyledDropdownDelegate.qml + common/IconButton.qml + common/TextLabel.qml + network/EditWiredSettings.qml + network/IpAddressTextField.qml + network/NetworkDetails.qml + network/NetworkSettings.qml + network/WifiSelectorDelegate.qml + network/WifiSettings.qml + network/WifiSignalMonitor.qml + network/WiredSettings.qml + bluetooth/Bluetooth.qml + bluetooth/Discovery.qml + display/Display.qml + locale/RegionSelect.qml + locale/Language.qml + timedate/AnalogClock.qml + timedate/TimeDate.qml + timedate/TimezonesView.qml + + diff --git a/src/settingsui/settingsui.pro b/src/settingsui/settingsui.pro new file mode 100644 index 0000000..026d911 --- /dev/null +++ b/src/settingsui/settingsui.pro @@ -0,0 +1,17 @@ +TEMPLATE = app + +QT += qml quick +SOURCES += main.cpp + +RESOURCES += \ + qml.qrc \ + icons.qrc + +# Additional import path used to resolve QML modules in Qt Creator's code model +QML_IMPORT_PATH = + +# Default rules for deployment. +include(deployment.pri) + +DISTFILES += \ + settingsview.xml diff --git a/src/settingsui/settingsview.xml b/src/settingsui/settingsview.xml new file mode 100644 index 0000000..4f3b52e --- /dev/null +++ b/src/settingsui/settingsview.xml @@ -0,0 +1,35 @@ + + + + + Network + NetworkSettings + network + ../icons/World_qt_6x.png + + + Display + Display + display + ../icons/Display_qt_6x.png + + + Date and Time + TimeDate + timedate + ../icons/Clock_qt_6x.png + + + Language + Language + locale + ../icons/Flag_qt_6x.png + + + Bluetooth + Bluetooth + bluetooth + ../icons/Bluetooth_qt_6x.png + + + diff --git a/src/settingsui/timedate/AnalogClock.qml b/src/settingsui/timedate/AnalogClock.qml new file mode 100644 index 0000000..9f871ed --- /dev/null +++ b/src/settingsui/timedate/AnalogClock.qml @@ -0,0 +1,255 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.5 +import "../common" +import com.theqtcompany.settings.timedate 1.0 + +Item { + property var currentTime: TimeManager.time + property var newTime: new Date + property bool editMode: false + + function showTime(time) { + return time.getHours() + ":" + time.getMinutes() + } + + onEditModeChanged: if (editMode) newTime = new Date + + Rectangle { + border.color: "#bdbebf" + border.width: 1 + color: "white" + anchors.fill: parent + + Connections { + target: TimeManager + onTimeChanged : newTime.setSeconds(currentTime.getSeconds()) + onTimeZoneChanged : Date.timeZoneUpdated() + } + + TextLabel { + anchors.horizontalCenter: parent.horizontalCenter + anchors.topMargin: 10 + anchors.top: parent.top + text: editMode ? newTime.toTimeString() : currentTime.toTimeString() + } + + Rectangle { + id: root + anchors.fill: parent + anchors.margins: Math.round(40 * Flat.FlatStyle.scaleFactor) + color: "white" + border.color: editMode ? "#d6d6d6" : "#5caa15" + border.width: Math.round(root.width * 0.120) + radius: parent.width / 2 + property int handOffset: Math.round(root.width * 0.040) + antialiasing: true + + Rectangle { + id: minutes + x: root.height / 2 - width / 2 + y: root.height / 2 - height + root.handOffset + color: editMode ? "#d6d6d6" : "#5caa15" + width: Math.round(root.width * 0.080) + height: Math.round(root.height / 2 * 0.65 + root.handOffset) + antialiasing: true + transform: Rotation { + id: minuteRotation + origin.x: Math.round(minutes.width / 2) + origin.y: Math.round(minutes.height - root.handOffset) + angle: currentTime.getMinutes() * 6 + Behavior on angle { + SpringAnimation { spring: 2; damping: 0.2; modulus: 360 } + } + } + } + + Rectangle { + id: hours + x: Math.round(root.height / 2 - width / 2) + y: Math.round(root.height / 2 - height + root.handOffset) + height: Math.round(root.height / 2 * 0.4 + root.handOffset) + width: Math.round(root.width * 0.080) + color: editMode ? "#d6d6d6" : "#80c342" + antialiasing: true + transform: Rotation { + id: hourRotation + origin.x: Math.round(hours.width / 2) + origin.y: hours.height - root.handOffset; + angle: (currentTime.getHours() * 30) + (currentTime.getMinutes() * 0.5) + Behavior on angle { + SpringAnimation { spring: 2; damping: 0.2; modulus: 360 } + } + } + } + + Rectangle { + id: seconds + x: root.height / 2 - width / 2 + y: root.height / 2 - height + root.handOffset + visible: !editMode + color: "#46a2da" + width: Math.round(root.width * 0.0128) + height: Math.round(root.height / 2 * 0.74) + radius: Math.round(width / 2) + antialiasing: true + transform: Rotation { + id: secondRotation + origin.x: Math.round(seconds.width / 2) + origin.y: Math.round(seconds.height - root.handOffset) + angle: currentTime.getSeconds() * 6 + Behavior on angle { + SpringAnimation { spring: 2; damping: 0.2; modulus: 360 } + } + } + } + + Component { + id: editor + + Rectangle { + id: rect + property var angle: mouseArea.drag ? mouseArea.angle : defaultAngle + property var defaultAngle: angleBinding + x: Math.round(Math.cos((-90+ angle)*Math.PI/180) * + (pos - root.handOffset - width /2 + radius) + root.width / 2 - width / 2) + y: Math.round(Math.sin((-90+ angle)*Math.PI/180) * + (pos - root.handOffset - width /2 + radius) + root.height / 2 - width / 2) + color: "#5caa15" + width: size + radius: width / 2 + height: width + antialiasing: true + + function calcAngle(mouse) { + var mouseGlobal = mapToItem(root, mouse.x, mouse.y) + var origin = root.width/2 + var angle = (90+Math.atan2((mouseGlobal.y-origin), (mouseGlobal.x-origin))*180/Math.PI) + if (angle < 0) + angle += 360; + updateAngle(angle); + return angle; + } + + MouseArea { + id: mouseArea + anchors.fill: parent + property int startX: 0 + property int startY: 0 + property bool drag: false + property var angle: 0.0 + preventStealing: true + + onPressed: { + var mouseGlobal = mapToItem(root, mouse.x, mouse.y); + startX = mouseGlobal.x; + startY = mouseGlobal.y; + angle = calcAngle(mouse); + drag = true; + } + onReleased: { + drag = false; + ready(angle) + } + onMouseXChanged: if (drag) angle = calcAngle(mouse) + } + } + } + + Loader { + property var angleBinding: (currentTime.getHours() * 30) + (currentTime.getMinutes() * 0.5) + property int size: Math.round(root.width * 0.120) + property int pos: hours.height + property bool pm: false + visible: editMode + + function updateAngle(angle) { + var newHour = Math.floor(angle / 30); + var preHour = newTime.getHours(); + + if (preHour == 11 && newHour == 0) { + newHour = 12; + pm = true; + } + else if (preHour === 23 && newHour === 0) { + pm = false; + } + else if (preHour == 0 && newHour === 11) { + pm = true; + } + else if (preHour == 12 && newHour == 11) { + pm = false; + } + + if (pm == true) { + newHour += 12; + } + + newTime.setHours(newHour); + } + + function ready(val) { + var newhours = Math.round(val / 30); + currentTime.setHours(newhours); + TimeManager.time = currentTime; + } + sourceComponent: editor + } + + Loader { + property var angleBinding: currentTime.getMinutes() * 6 + property int size: Math.round(root.width * 0.120) + property int pos: minutes.height + visible: editMode + sourceComponent: editor + + function updateAngle(angle) { + var newMin = Math.round(angle / 6); + var hours = newTime.getHours(); + newTime.setMinutes(newMin); + newTime.setHours(hours); + } + + function ready(val) { + var newmins = Math.round(val / 6); + currentTime.setMinutes(newmins); + TimeManager.time = currentTime; + } + } + } + } +} + diff --git a/src/settingsui/timedate/TimeDate.qml b/src/settingsui/timedate/TimeDate.qml new file mode 100644 index 0000000..439e4ac --- /dev/null +++ b/src/settingsui/timedate/TimeDate.qml @@ -0,0 +1,167 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.5 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles.Flat 1.0 as Flat +import "../common" +import com.theqtcompany.settings.timedate 1.0 + +Item { + id: root + property string title: qsTr("Time and Date settings") + + Flickable { + anchors.fill: parent + anchors.margins: Math.round(40 * Flat.FlatStyle.scaleFactor) + anchors.bottomMargin: Math.round(20 * Flat.FlatStyle.scaleFactor) + contentHeight: content.height + contentWidth: width + + Column { + id: content + width: parent.width + + GroupBox { + width: parent.width + title: qsTr("Time Settings") + Layout.fillWidth: true + + ColumnLayout { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + width: parent.width + Layout.fillWidth: true + + ExclusiveGroup { id: exgroup } + + RadioButton { + id: automatic + text: qsTr("Automatic time set") + exclusiveGroup: exgroup + checked: TimeManager.ntp + onCheckedChanged: if (checked) calloader.reload(); + } + RadioButton { + id: custom + text: qsTr("Manual") + exclusiveGroup: exgroup + checked: !TimeManager.ntp + onCheckedChanged: TimeManager.ntp = !checked + } + RowLayout { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + Layout.fillWidth: true + + Component { + id: calendar + + Item { + width: cal.width + height: cal.height + + Timer { + id: timer + } + function delay(delayTime, cb) { + timer.interval = delayTime; + timer.repeat = false; + timer.triggered.connect(cb); + timer.start(); + } + + Calendar { + id: cal + weekNumbersVisible: false + enabled: !automatic.checked + onClicked: { + var currentTime = TimeManager.time; + var newDate = date; + newDate.setHours(currentTime.getHours()); + newDate.setMinutes(currentTime.getMinutes()); + newDate.setSeconds(currentTime.getSeconds()); + TimeManager.time = newDate; + delay(100, function() { + calloader.reload(); + }); + } + } + } + } + + Loader { + id: calloader + sourceComponent: calendar + function reload() { + calloader.sourceComponent = undefined; + calloader.sourceComponent = calendar; + } + } + + AnalogClock { + id: clock + width: calloader.width + height: width + editMode: !automatic.checked + } + } + + Component { + id: zoneselect + TimezonesView { } + } + + GroupBox { + title: qsTr("Timezone Settings") + Layout.fillWidth: true + width: parent.width + visible: true + flat: true + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + TextLabel { + text: TimeManager.timeZone + } + Button { + text: "Change" + onClicked : stackView.push(zoneselect) + } + } + } + } + } + } + } +} diff --git a/src/settingsui/timedate/TimezonesView.qml b/src/settingsui/timedate/TimezonesView.qml new file mode 100644 index 0000000..4e09350 --- /dev/null +++ b/src/settingsui/timedate/TimezonesView.qml @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Device Utilities module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.5 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles.Flat 1.0 as Flat +import "../common" +import com.theqtcompany.settings.timedate 1.0 + + +Item { + id: root + Component.onCompleted: timezone.text = TimezonesFilter.filter + + Column { + id: content + anchors.fill: parent + anchors.margins: Math.round(20 * Flat.FlatStyle.scaleFactor) + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + Row { + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + + TextLabel { + text: qsTr("Search area: ") + } + + TextField { + id: timezone + text: "" + onTextChanged: TimezonesFilter.filter = timezone.text + } + } + + TableView { + width: parent.width + height: Math.round(parent.height - 40 * Flat.FlatStyle.scaleFactor) + Layout.fillWidth: true + model: TimezonesFilter + headerVisible: true + + TableViewColumn { + role: "name" + title: qsTr("Timezone") + width: Math.round(parent.width * 0.66) + } + TableViewColumn { + role: "country" + title: qsTr("Country") + width: Math.round(parent.width * 0.33) + } + + onClicked: { + var val = model.itemFromRow(row); + if (val !== "") { + TimeManager.timeZone = val; + stackView.pop(); + } + } + } + } +} -- cgit v1.2.3