summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKimmo Ollila <kimmo.ollila@theqtcompany.com>2016-02-23 09:13:21 +0200
committerKimmo Ollila <kimmo.ollila@theqtcompany.com>2016-03-02 12:51:24 +0000
commitc6b5855b446c73f8a60cc3d4427fc445e0ba400d (patch)
treeb57f45df2a297335392f56953410a4c3ab599a8d
parentf1d884b6dad5a93d7a3077b6b05d3ec7fcd9a6ea (diff)
Migrate settings UI to use Qt Quick Controls 2
Task-number: QTEE-1057 Change-Id: I389d784241d4b68384765dfde4b572e7652eb76c Reviewed-by: Teemu Holappa <teemu.holappa@theqtcompany.com>
-rw-r--r--src/bluetoothsettings/bluez/bluetoothdevice_p.cpp5
-rw-r--r--src/bluetoothsettings/discoverymodel.cpp2
-rw-r--r--src/localesettings/localefiltermodel.cpp2
-rw-r--r--src/localesettings/localemodel.cpp10
-rw-r--r--src/localesettings/localemodel.h4
-rw-r--r--src/localesettings/systemlocale_p.h4
-rw-r--r--src/settingsui/bluetooth/Bluetooth.qml55
-rw-r--r--src/settingsui/bluetooth/Discovery.qml99
-rw-r--r--src/settingsui/common/CustomCombobox.qml185
-rw-r--r--src/settingsui/common/CustomTableView.qml120
-rw-r--r--src/settingsui/common/FlatStyledDropdownDelegate.qml78
-rw-r--r--src/settingsui/common/TextLabel.qml48
-rw-r--r--src/settingsui/display/Display.qml149
-rw-r--r--src/settingsui/icons.qrc6
-rw-r--r--src/settingsui/locale/Language.qml102
-rw-r--r--src/settingsui/locale/RegionSelect.qml50
-rw-r--r--src/settingsui/main.cpp1
-rw-r--r--src/settingsui/main.qml162
-rw-r--r--src/settingsui/network/AddressListEntry.qml108
-rw-r--r--src/settingsui/network/ComboBoxEntry.qml (renamed from src/settingsui/common/IconButton.qml)37
-rw-r--r--src/settingsui/network/EditWiredSettings.qml615
-rw-r--r--src/settingsui/network/IpAddressTextField.qml8
-rw-r--r--src/settingsui/network/NetworkSettings.qml54
-rw-r--r--src/settingsui/network/WifiSelectorDelegate.qml61
-rw-r--r--src/settingsui/network/WifiSettings.qml108
-rw-r--r--src/settingsui/network/WifiSignalMonitor.qml38
-rw-r--r--src/settingsui/network/WiredSettings.qml151
-rw-r--r--src/settingsui/qml.qrc8
-rw-r--r--src/settingsui/timedate/AnalogClock.qml124
-rw-r--r--src/settingsui/timedate/CustomCalendar.qml221
-rw-r--r--src/settingsui/timedate/TimeDate.qml143
-rw-r--r--src/settingsui/timedate/TimezonesView.qml52
-rw-r--r--src/timedatesettings/systemtime_p.h2
-rw-r--r--src/timedatesettings/timezonefiltermodel.cpp2
-rw-r--r--src/timedatesettings/timezonemodel.cpp10
-rw-r--r--src/timedatesettings/timezonemodel.h2
36 files changed, 1287 insertions, 1539 deletions
diff --git a/src/bluetoothsettings/bluez/bluetoothdevice_p.cpp b/src/bluetoothsettings/bluez/bluetoothdevice_p.cpp
index ded84f2..5badc74 100644
--- a/src/bluetoothsettings/bluez/bluetoothdevice_p.cpp
+++ b/src/bluetoothsettings/bluez/bluetoothdevice_p.cpp
@@ -68,8 +68,8 @@ OrgBluezDevice1Interface* BluetoothDevicePrivate::findDevice()
const QString &iface = jt.key();
const QVariantMap &ifaceValues = jt.value();
if (iface == QStringLiteral("org.bluez.Device1")) {
- if (ifaceValues["Address"] == m_address) {
- OrgBluezDevice1Interface *devIf = new OrgBluezDevice1Interface("org.bluez", path.path(), QDBusConnection::systemBus());
+ if (ifaceValues[QStringLiteral("Address")] == m_address) {
+ OrgBluezDevice1Interface *devIf = new OrgBluezDevice1Interface(QStringLiteral("org.bluez"), path.path(), QDBusConnection::systemBus());
return devIf;
}
}
@@ -78,7 +78,6 @@ OrgBluezDevice1Interface* BluetoothDevicePrivate::findDevice()
return NULL;
}
-
void BluetoothDevicePrivate::connectDevice()
{
OrgBluezDevice1Interface *dev = findDevice();
diff --git a/src/bluetoothsettings/discoverymodel.cpp b/src/bluetoothsettings/discoverymodel.cpp
index 36d3a2e..1a9410b 100644
--- a/src/bluetoothsettings/discoverymodel.cpp
+++ b/src/bluetoothsettings/discoverymodel.cpp
@@ -222,7 +222,7 @@ QVariant DiscoveryModel::data(const QModelIndex & index, int role) const
case DiscoveryModel::Connected:
return item->connected();
default:
- return "";
+ return QVariant();
}
}
diff --git a/src/localesettings/localefiltermodel.cpp b/src/localesettings/localefiltermodel.cpp
index 027caba..a45c568 100644
--- a/src/localesettings/localefiltermodel.cpp
+++ b/src/localesettings/localefiltermodel.cpp
@@ -91,6 +91,6 @@ QVariant LocaleFilterModel::itemFromRow(const int row) const
return nameRole;
}
}
- return QVariant::fromValue(QString(""));
+ return QVariant();
}
diff --git a/src/localesettings/localemodel.cpp b/src/localesettings/localemodel.cpp
index 40d5fc8..f1f50da 100644
--- a/src/localesettings/localemodel.cpp
+++ b/src/localesettings/localemodel.cpp
@@ -98,13 +98,12 @@ void LocaleModel::generateModel(LocaleModel* model)
QList<QLocale> allLocales = QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript, QLocale::AnyCountry);
for (const QLocale &locale : allLocales) {
- if (locale.name() != "C") {
+ if (locale.name() != QStringLiteral("C")) {
LocaleItem *l = new LocaleItem(locale);
l->moveToThread(model->thread());
QMetaObject::invokeMethod(model, "addNewItem", Q_ARG( QObject*, qobject_cast<QObject*>(l)));
}
}
-
}
void LocaleModel::addNewItem(QObject *item)
@@ -139,6 +138,9 @@ QVariant LocaleModel::data(const QModelIndex & index, int role) const
LocaleItem *item = m_items[index.row()];
switch (role) {
+ case Qt::UserRole:
+ return QVariant::fromValue(static_cast<QObject*>(item));
+ break;
case Country:
return item->country();
break;
@@ -149,7 +151,7 @@ QVariant LocaleModel::data(const QModelIndex & index, int role) const
return item->code();
break;
default:
- return "";
+ return QVariant();
}
}
@@ -162,5 +164,5 @@ void LocaleModel::sort(int column, Qt::SortOrder order)
{
Q_UNUSED(column);
Q_UNUSED(order);
- qSort(m_items.begin(), m_items.end(), LocaleModel::variantLessThan);
+ std::sort(m_items.begin(), m_items.end(), LocaleModel::variantLessThan);
}
diff --git a/src/localesettings/localemodel.h b/src/localesettings/localemodel.h
index 6ed5844..a1525b8 100644
--- a/src/localesettings/localemodel.h
+++ b/src/localesettings/localemodel.h
@@ -74,8 +74,8 @@ public:
static bool variantLessThan(const LocaleItem* v1, const LocaleItem* v2);
enum Roles {
- Language = Qt::DisplayPropertyRole,
- Country = Qt::UserRole,
+ Language = Qt::UserRole + 1,
+ Country,
Code
};
diff --git a/src/localesettings/systemlocale_p.h b/src/localesettings/systemlocale_p.h
index 417b958..0f3e6df 100644
--- a/src/localesettings/systemlocale_p.h
+++ b/src/localesettings/systemlocale_p.h
@@ -59,11 +59,11 @@ public:
}
QString locale() const {
- return m_localeCache["LANG"];
+ return m_localeCache[QStringLiteral("LANG")];
}
void setLocale(const QString& aLocale) {
- m_localeCache["LANG"] = aLocale;
+ m_localeCache[QStringLiteral("LANG")] = aLocale;
updateLocale();
}
diff --git a/src/settingsui/bluetooth/Bluetooth.qml b/src/settingsui/bluetooth/Bluetooth.qml
index d16bdb3..2bffe5b 100644
--- a/src/settingsui/bluetooth/Bluetooth.qml
+++ b/src/settingsui/bluetooth/Bluetooth.qml
@@ -33,57 +33,50 @@
** $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 QtQuick 2.6
+import QtQuick.Layouts 1.3
+import Qt.labs.controls 1.0
+import Qt.labs.controls.material 1.0
+import Qt.labs.controls.universal 1.0
import com.theqtcompany.settings.bluetooth 1.0
Item {
id: root
property string title: qsTr("Bluetooth Settings")
- Column {
- id: content
+ ColumnLayout {
+ anchors.margins: 20
anchors.fill: parent
- anchors.margins: Math.round(40 * Flat.FlatStyle.scaleFactor)
+ id: content
+ spacing: 20
GroupBox {
id: groupBox
width: parent.width
title: qsTr("Bluetooth status")
Layout.fillWidth: true
+ Layout.alignment: Qt.AlignTop
- 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")
- }
+ RowLayout {
+ spacing: 10
+ Label {
+ id: off
+ text: qsTr("Off")
+ }
+ Switch {
+ checked: BtDevice.powered
+ onCheckedChanged: BtDevice.powered = checked
+ }
+ Label {
+ text: qsTr("On")
}
}
}
-
Discovery {
id: discovery
visible: BtDevice.powered
- width: parent.width
- height: Math.round(content.height - 100 * Flat.FlatStyle.scaleFactor)
+ Layout.fillWidth: true
+ Layout.fillHeight: true
}
}
}
diff --git a/src/settingsui/bluetooth/Discovery.qml b/src/settingsui/bluetooth/Discovery.qml
index a2dda84..9c1b674 100644
--- a/src/settingsui/bluetooth/Discovery.qml
+++ b/src/settingsui/bluetooth/Discovery.qml
@@ -33,27 +33,28 @@
** $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 QtQuick 2.6
+import QtQuick.Layouts 1.3
+import Qt.labs.controls 1.0
+import Qt.labs.controls.material 1.0
+import Qt.labs.controls.universal 1.0
import com.theqtcompany.settings.bluetooth 1.0
Item {
id: top
- property BluetoothService currentService
GroupBox {
id: groupBox
title: qsTr("Devices")
- width: parent.width
+ anchors.fill: parent
ListView {
id: mainList
- width: parent.width
- height: top.height
+ anchors.fill: parent
+ opacity: BtDevice.scanning ? .5 : 1.0
+ interactive: !BtDevice.scanning
+ clip: true
+ model: BtDevice.deviceModel
function getIcon(deviceType) {
switch (deviceType) {
@@ -72,71 +73,59 @@ Item {
}
}
- model: BtDevice.deviceModel
- delegate: Rectangle {
+ delegate: Item {
id: btDelegate
width: parent.width
- height: Math.round(column.height + 10 * Flat.FlatStyle.scaleFactor)
-
- property bool expended: false;
- clip: true
+ height: expanded || connected ? column.height + 10 : bttext.height + 10
+ property bool expanded: false;
MouseArea {
anchors.fill: parent
- onClicked: btDelegate.expended = !btDelegate.expended
+ onClicked: {
+ if (!connected)
+ btDelegate.expanded = !btDelegate.expanded
+ }
}
-
- RowLayout {
- anchors.top: parent.top
+ Image {
+ id: bticon
anchors.left: parent.left
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
-
- Image {
- id: bticon
- source: mainList.getIcon(type)
+ anchors.top: parent.top
+ anchors.topMargin: 4
+ source: mainList.getIcon(type)
+ }
+ Column {
+ id: column
+ anchors.left: bticon.right
+ anchors.leftMargin: 10
+ anchors.right: connectButton.left
+ anchors.rightMargin: 10
+
+ Label {
+ id: bttext
+ text: name
}
-
- 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}
- }
- }
+ Label {
+ id: details
+ opacity: btDelegate.expanded || connected ? 1 : 0.0
+ text: address
+ Behavior on opacity { NumberAnimation { duration: 200} }
}
}
-
Button {
+ id: connectButton
anchors.right: parent.right
- anchors.rightMargin: Math.round(10 * Flat.FlatStyle.scaleFactor)
- visible: !BtDevice.scanning
+ anchors.verticalCenter: parent.verticalCenter
+ visible: (expanded || connected) && !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)
+ anchors.centerIn: parent
running: BtDevice.scanning
- }
+ }
}
diff --git a/src/settingsui/common/CustomCombobox.qml b/src/settingsui/common/CustomCombobox.qml
deleted file mode 100644
index 37c7871..0000000
--- a/src/settingsui/common/CustomCombobox.qml
+++ /dev/null
@@ -1,185 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Device Utilities module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-import QtQuick 2.5
-import QtQuick.Layouts 1.1
-import QtQuick.Controls 1.4
-import QtQuick.Controls.Styles.Flat 1.0 as Flat
-import 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<len;i++) {
- if (comboboxModel.items.get(i).model[role] === value) {
- selectedIndex = i;
- return;
- }
- }
- }
- selectedIndex = -1;
- }
-
- Button {
- id: button
- checkable: true
- enabled: true
- anchors.fill: parent
- checked: popupView.visible
- onClicked: popupView.visible = !popupView.visible
-
- TextLabel {
- id: label
- anchors.fill: parent
- anchors.margins: 10 * Flat.FlatStyle.scaleFactor
- color: button.hovered || button.checked ? Flat.FlatStyle.selectedTextColor:Flat.FlatStyle.styleColor
- horizontalAlignment: Text.AlignLeft
- text: selectedIndex>=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/CustomTableView.qml b/src/settingsui/common/CustomTableView.qml
new file mode 100644
index 0000000..6073683
--- /dev/null
+++ b/src/settingsui/common/CustomTableView.qml
@@ -0,0 +1,120 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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.6
+import QtQuick.Layouts 1.3
+import Qt.labs.controls 1.0
+import Qt.labs.controls.material 1.0
+import Qt.labs.controls.universal 1.0
+
+ColumnLayout {
+ id: root
+ spacing: 0
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+
+ property var headerTexts: []
+ property var roleNames: []
+ property alias model: listView.model
+ signal clicked(int index)
+
+ Rectangle {
+ height: 40
+ Layout.fillWidth: true
+ color: "#80c342"
+
+ Row {
+ anchors.fill: parent
+ anchors.leftMargin: 10
+ spacing: 10
+
+ Repeater {
+ model: root.headerTexts.length
+ Text {
+ width: parent.width / root.headerTexts.length
+ text: root.headerTexts[index]
+ color: "white"
+ font.bold: true
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+ }
+ }
+ ListView {
+ id: listView
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ clip: true
+
+ Rectangle {
+ anchors.fill: parent
+ border.color: "#bdbebf"
+ border.width: 1
+ color: "transparent"
+ }
+
+ ScrollBar.vertical: ScrollBar {}
+
+ delegate: Rectangle {
+ width: parent.width
+ height: 30
+ color: index % 2 ? "#e3e3e3" : "white"
+ property var delegateData: modelData
+
+ Row {
+ anchors.fill: parent
+ anchors.leftMargin: 10
+ spacing: 10
+
+ Repeater {
+ model: root.roleNames.length
+
+ Text {
+ width: parent.width / root.roleNames.length
+ text: delegateData[root.roleNames[index]]
+ anchors.verticalCenter: parent.verticalCenter
+ antialiasing: false
+ smooth: false
+ renderType: listView.moving ? Text.NativeRendering : Text.QtRendering
+ }
+ }
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: root.clicked(index)
+ }
+ }
+ }
+}
diff --git a/src/settingsui/common/FlatStyledDropdownDelegate.qml b/src/settingsui/common/FlatStyledDropdownDelegate.qml
deleted file mode 100644
index c1bd24c..0000000
--- a/src/settingsui/common/FlatStyledDropdownDelegate.qml
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Device Utilities module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-import QtQuick 2.5
-import QtQuick.Layouts 1.1
-import QtQuick.Controls 1.4
-import QtQuick.Controls.Styles.Flat 1.0 as Flat
-
-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/TextLabel.qml b/src/settingsui/common/TextLabel.qml
deleted file mode 100644
index e9f5d12..0000000
--- a/src/settingsui/common/TextLabel.qml
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Device Utilities module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-import QtQuick 2.5
-import QtQuick.Layouts 1.1
-import QtQuick.Controls 1.4
-import QtQuick.Controls.Styles.Flat 1.0 as Flat
-
-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/display/Display.qml b/src/settingsui/display/Display.qml
index 8d45746..68561f0 100644
--- a/src/settingsui/display/Display.qml
+++ b/src/settingsui/display/Display.qml
@@ -33,99 +33,103 @@
** $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"
+import QtQuick 2.6
+import QtQuick.Layouts 1.3
+import Qt.labs.controls 1.0
+import Qt.labs.controls.material 1.0
+import Qt.labs.controls.universal 1.0
+import B2Qt.Utils 1.0
Item {
id: root
-
property string title: qsTr("Display Settings")
+ property int titleWidth: width * 0.382
GroupBox {
title: qsTr("Display Settings")
- anchors.fill: parent
- anchors.margins: Math.round(40 * Flat.FlatStyle.scaleFactor)
- Layout.fillWidth: true
+ anchors.margins: 20
+ anchors.left: parent.left
+ anchors.top: parent.top
+ anchors.right:parent.right
- Column {
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
- RowLayout {
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
+ ColumnLayout {
+ anchors.fill: parent
- TextLabel {
- text: qsTr("Brighness: ")
+ RowLayout {
+ width: parent.width
+ spacing: 10
+
+ Label {
+ text: qsTr("Brightness:")
+ Layout.preferredWidth: root.titleWidth
+ Layout.alignment: Qt.AlignVCenter
+ horizontalAlignment: Text.AlignRight
}
-
Slider {
id: brightnessSlider
- value: DisplaySettings.displayBrightness
+ value: B2QtDevice.displayBrightness
+ Layout.alignment: Qt.AlignVCenter
Layout.fillWidth: true
+ from: 0
+ to: 255
}
}
-
Binding {
- target: DisplaySettings
+ target: B2QtDevice
property: "displayBrightness"
- value: brightnessSlider.value
+ value: brightnessSlider.position * brightnessSlider.to
}
-
- Row {
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
-
- TextLabel {
- text: qsTr("Physical screen size: ")
+ GridLayout {
+ columns: 2
+ rows: 3
+ rowSpacing: 10
+
+ Label {
+ text: qsTr("Physical screen size:")
+ Layout.preferredWidth: root.titleWidth
+ Layout.alignment: Qt.AlignVCenter
+ horizontalAlignment: Text.AlignRight
+ wrapMode: Label.WordWrap
}
+ RadioButton {
+ text: qsTr("Default")
+ checked: !B2QtDevice.physicalScreenSizeOverride
+ }
+ RadioButton {
+ id: custom
+ Layout.column: 1
+ Layout.row: 1
+ text: qsTr("Custom")
+ checked: B2QtDevice.physicalScreenSizeOverride
+ onCheckedChanged: B2QtDevice.physicalScreenSizeOverride = checked
+ }
+ GroupBox {
+ title: qsTr("Size (in inches): %1").arg(B2QtDevice.physicalScreenSizeInch)
+ Layout.column: 1
+ Layout.row: 2
+ Layout.fillWidth: true
+ visible: custom.checked
- 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
- }
+ RowLayout {
+ spacing: 10
+ width: parent.width
- Binding {
- target: DisplaySettings
- property: "physicalScreenSizeInch"
- value: sizeSlider.value
- }
+ Label {
+ text: sizeSlider.from
+ Layout.alignment: Qt.AlignVCenter
+ }
+ Slider {
+ id: sizeSlider
+ value: B2QtDevice.physicalScreenSizeInch
+ Layout.fillWidth: true
+ stepSize: 1
+ from: 4
+ to: 60
+ onPositionChanged: B2QtDevice.physicalScreenSizeInch = sizeSlider.from + Math.floor(sizeSlider.position * (sizeSlider.to - sizeSlider.from))
+ }
+ Label {
+ text: sizeSlider.to
+ Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
}
}
}
@@ -133,4 +137,3 @@ Item {
}
}
}
-
diff --git a/src/settingsui/icons.qrc b/src/settingsui/icons.qrc
index 8099fbb..c616ead 100644
--- a/src/settingsui/icons.qrc
+++ b/src/settingsui/icons.qrc
@@ -8,5 +8,11 @@
<file>icons/Flag_qt_6x.png</file>
<file>icons/World_qt_6x.png</file>
<file>icons/Bluetooth_qt_6x.png</file>
+ <file>icons/Bluetooth_qt_1x.png</file>
+ <file>icons/Headphones_qt_1x.png</file>
+ <file>icons/Keyboard_qt_1x.png</file>
+ <file>icons/Laptop_qt_1x.png</file>
+ <file>icons/Microphone_qt_1x.png</file>
+ <file>icons/Mouse_qt_1x.png</file>
</qresource>
</RCC>
diff --git a/src/settingsui/locale/Language.qml b/src/settingsui/locale/Language.qml
index 6e4e3ad..bdcfbef 100644
--- a/src/settingsui/locale/Language.qml
+++ b/src/settingsui/locale/Language.qml
@@ -33,79 +33,67 @@
** $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 QtQuick 2.6
+import QtQuick.Layouts 1.3
+import Qt.labs.controls 1.0
+import Qt.labs.controls.material 1.0
+import Qt.labs.controls.universal 1.0
import com.theqtcompany.settings.locale 1.0
+import QtQml 2.2
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
+ title: qsTr("Regional Format")
+ anchors.left: parent.left
+ anchors.top: parent.top
+ anchors.right: parent.right
+ anchors.margins: 20
+ property var currentRegion: Qt.locale(LocaleManager.locale)
- GroupBox {
- id: groupBox
+ ColumnLayout {
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)
+ Component {
+ id: regionSelect
+ RegionSelect {}
+ }
+ GroupBox {
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");
- }
+ title: {
+ if (groupBox.currentRegion.name === "C" || groupBox.currentRegion.name === "POSIX") {
+ return qsTr("Default");
}
-
- 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)
- }
+ else if (groupBox.currentRegion.name !== "") {
+ return qsTr("%L1/%L2").arg(groupBox.currentRegion.nativeLanguageName).arg(groupBox.currentRegion.nativeCountryName)
+ }
+ else {
+ return qsTr("Region not set");
}
}
+ ColumnLayout {
+ spacing: 10
+ Layout.fillWidth: true
+ width: parent.width
- Button {
- text: qsTr("Change region")
- onClicked: stackView.push(regionSelect)
+ Label {
+ text: Date().toLocaleString(groupBox.currentRegion)
+ }
+ Label {
+ text: Number(2343.34).toLocaleString(groupBox.currentRegion)
+ }
+ Label {
+ 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
index 2d13afe..9282177 100644
--- a/src/settingsui/locale/RegionSelect.qml
+++ b/src/settingsui/locale/RegionSelect.qml
@@ -33,12 +33,13 @@
** $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 QtQuick 2.6
+import QtQuick.Layouts 1.3
+import Qt.labs.controls 1.0
+import Qt.labs.controls.material 1.0
+import Qt.labs.controls.universal 1.0
import com.theqtcompany.settings.locale 1.0
+import "../common"
Item {
id: root
@@ -46,46 +47,31 @@ Item {
Component.onCompleted: country.text = LocaleFilter.filter
- Column {
+ ColumnLayout {
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)
+ anchors.margins: 20
+ spacing: 10
+ RowLayout {
+ spacing: 10
- TextLabel {
+ Label {
text: qsTr("Search region: ")
+ Layout.alignment: Qt.AlignVCenter
}
-
TextField {
id: country
text: ""
onTextChanged: LocaleFilter.filter = country.text
+ Layout.alignment: Qt.AlignVCenter
}
}
-
- TableView {
- width: parent.width
- height: Math.round(parent.height - 40 * Flat.FlatStyle.scaleFactor)
- Layout.fillWidth: true
+ CustomTableView {
+ headerTexts: [qsTr("Language"), qsTr("Country")]
+ roleNames: ["language", "country"]
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);
+ var val = model.itemFromRow(index);
if (val !== "") {
LocaleManager.locale = val;
stackView.pop();
diff --git a/src/settingsui/main.cpp b/src/settingsui/main.cpp
index b345225..9b26327 100644
--- a/src/settingsui/main.cpp
+++ b/src/settingsui/main.cpp
@@ -32,6 +32,7 @@
int main(int argc, char *argv[])
{
+ QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
diff --git a/src/settingsui/main.qml b/src/settingsui/main.qml
index 7d0d864..9129ff5 100644
--- a/src/settingsui/main.qml
+++ b/src/settingsui/main.qml
@@ -26,13 +26,13 @@
** $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 2.6
+import QtQuick.Layouts 1.3
+import Qt.labs.controls 1.0
+import Qt.labs.controls.material 1.0
+import Qt.labs.controls.universal 1.0
+import Qt.labs.settings 1.0
import QtQuick.XmlListModel 2.0
-import "common"
-import com.theqtcompany.localdevice 1.0
ApplicationWindow {
id: root
@@ -42,60 +42,54 @@ ApplicationWindow {
visible: true
property var service
- SystemPalette { id: systemPalette; colorGroup: SystemPalette.Active }
-
- toolBar:ToolBar {
+ header: ToolBar {
id: titlebar
property string title: ""
- implicitWidth: parent.width
- implicitHeight: Math.round(40 * Flat.FlatStyle.scaleFactor)
- Item {
+
+ RowLayout {
+ spacing: 20
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();
+ label: Image {
+ source: "../icons/Chevron-left_black_1x.png"
+ anchors.centerIn: parent
+ }
+ visible: stackView.depth > 1
+ onClicked: stackView.pop();
}
- TextLabel {
+ Label {
id: titleText
- font.pixelSize: Math.round(16 * Flat.FlatStyle.scaleFactor)
- anchors.fill: parent
+ font.pixelSize: 20
text: stackView.currentItem.title
+ horizontalAlignment: Qt.AlignHCenter
+ verticalAlignment: Qt.AlignVCenter
+ anchors.centerIn: parent
}
-
-
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();
- }
- }
- }
- }
+ label: Image {
+ source: "../icons/Power_black_1x.png"
+ anchors.centerIn: parent
+ }
+ anchors.right: parent.right
- Menu {
- id: menu
- title: ""
- enabled: false
+ visible: stackView.depth === 1
+ onClicked: menu.open();
- MenuItem {
- text: qsTr("Reboot")
- onTriggered: LocalDevice.reboot()
- }
+ Menu {
+ id: menu
+ x: parent.width - width
- MenuItem {
- text: qsTr("Shutdown")
- onTriggered: LocalDevice.powerOff()
+ MenuItem {
+ text: qsTr("Reboot")
+ onTriggered: B2QtDevice.reboot()
+ }
+ MenuItem {
+ text: qsTr("Shutdown")
+ onTriggered: B2QtDevice.powerOff()
+ }
+ }
+ }
}
}
@@ -109,60 +103,58 @@ ApplicationWindow {
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()"}
+ XmlRole { name: "path"; query: "path/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)
-
+ anchors.margins: 40
+ cellHeight: 133 + spacing
+ cellWidth: 117 + spacing
model: xmlModel
- delegate:
- MouseArea {
- width: grid.cellWidth - grid.spacing
- height: grid.cellHeight - grid.spacing
-
- Rectangle {
- anchors.fill: parent
- color: "#d6d6d6"
- radius: 5
- visible: pressed
+ property int spacing: 20
+ delegate: MouseArea {
+ width: grid.cellWidth - grid.spacing
+ height: grid.cellHeight - grid.spacing
+
+ Rectangle {
+ anchors.fill: parent
+ color: "#d6d6d6"
+ radius: 5
+ visible: pressed
+ }
+ Column {
+ anchors.fill: parent
+ anchors.topMargin: 10
+ Image {
+ id: image
+ source: icon
+ anchors.horizontalCenter: parent.horizontalCenter
+ width: grid.cellWidth
+ fillMode: Image.PreserveAspectFit
}
-
- 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)
- }
+ Label {
+ text: title
+ anchors.horizontalCenter: parent.horizontalCenter
+ font.pixelSize: grid.cellHeight * .1
}
-
- onClicked: {
- var url = 'import "' + path + '"; ' + view + ' {}';
- stackView.push({item: Qt.createQmlObject(url,stackView)});
- titlebar.title = title
- }
+ }
+ onClicked: {
+ var component = Qt.createComponent(path + '/' +view+'.qml');
+ stackView.push(component.createObject(stackView));
+ titlebar.title = title
+ }
}
}
}
diff --git a/src/settingsui/network/AddressListEntry.qml b/src/settingsui/network/AddressListEntry.qml
new file mode 100644
index 0000000..45c161f
--- /dev/null
+++ b/src/settingsui/network/AddressListEntry.qml
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** 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.6
+import QtQuick.Layouts 1.3
+import Qt.labs.controls 1.0
+import Qt.labs.controls.material 1.0
+import Qt.labs.controls.universal 1.0
+
+RowLayout {
+ id: root
+ spacing: 10
+ property alias model: repeater.model
+ property bool modified: false
+ property alias title: label.text
+
+ Label {
+ id: label
+ Layout.preferredWidth: content.titleWidth
+ horizontalAlignment: Text.AlignRight
+ Layout.alignment: Qt.AlignTop
+ Layout.topMargin: 10
+ }
+ ColumnLayout {
+ spacing: 10
+ Layout.fillWidth: true
+
+ Repeater {
+ id: repeater
+ visible: count > 0
+ RowLayout {
+ spacing: 10
+ TextField {
+ text: edit
+ Layout.fillWidth: true
+ onEditingFinished: {
+ root.modified = true;
+ edit = text;
+ }
+ }
+ Button {
+ Layout.preferredWidth: height
+ text: "-"
+ visible: repeater.count > 0
+ onClicked: {
+ root.modified = true;
+ root.model.remove(index);
+ }
+ }
+ Button {
+ Layout.preferredWidth: height
+ visible: index === repeater.count - 1
+ text: "+"
+ onClicked: root.model.append("")
+
+ Layout.alignment: Qt.AlignRight
+ }
+ }
+ }
+ RowLayout {
+ visible: repeater.count === 0
+ spacing: 10
+ TextField {
+ id: nameServerEntryItem
+ Layout.fillWidth: true
+ text: ""
+ onAccepted: root.model.append(text)
+ }
+ Button {
+ Layout.preferredWidth: height
+ text: "+"
+ onClicked: nameServerEntryItem.accepted()
+ }
+ }
+ }
+}
diff --git a/src/settingsui/common/IconButton.qml b/src/settingsui/network/ComboBoxEntry.qml
index 898e5e0..791f2d5 100644
--- a/src/settingsui/common/IconButton.qml
+++ b/src/settingsui/network/ComboBoxEntry.qml
@@ -33,22 +33,33 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-import QtQuick 2.5
+import QtQuick 2.6
+import QtQuick.Layouts 1.3
+import Qt.labs.controls 1.0
+import Qt.labs.controls.material 1.0
+import Qt.labs.controls.universal 1.0
-MouseArea {
+RowLayout {
id: root
- property alias pressedIcon: pressedImage.source
- property alias releasedIcon: releasedImage.source
- width: pressedImage.sourceSize.width
- height: pressedImage.sourceSize.height
+ spacing: 10
+ width: parent.width
- Image {
- id: pressedImage
- visible: root.pressed
- }
+ property alias title: label.text
+ property alias currentIndex: cb.currentIndex
+ property alias delegate: cb.delegate
+ property alias textRole: cb.textRole
+ property alias model: cb.model
+ property int titleWidth: -1
- Image {
- id: releasedImage
- visible: !root.pressed
+ Label {
+ id: label
+ Layout.preferredWidth: root.titleWidth
+ horizontalAlignment: Text.AlignRight
+ Layout.alignment: Qt.AlignVCenter
+ }
+ ComboBox {
+ id: cb
+ textRole: "text"
+ Layout.fillWidth: true
}
}
diff --git a/src/settingsui/network/EditWiredSettings.qml b/src/settingsui/network/EditWiredSettings.qml
index 1249e46..48a6abb 100644
--- a/src/settingsui/network/EditWiredSettings.qml
+++ b/src/settingsui/network/EditWiredSettings.qml
@@ -33,18 +33,17 @@
** $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 QtQuick 2.6
+import QtQuick.Layouts 1.3
+import Qt.labs.controls 1.0
+import Qt.labs.controls.material 1.0
+import Qt.labs.controls.universal 1.0
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
@@ -63,21 +62,19 @@ Item {
Flickable {
anchors.fill: parent
anchors.top: saveButton.bottom
- anchors.margins: Math.round(40 * Flat.FlatStyle.scaleFactor)
- anchors.bottomMargin: Math.round(20 * Flat.FlatStyle.scaleFactor)
+ anchors.margins: 20
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)
+ spacing: 10
+ property int titleWidth: width * 0.382
+ property int groupWidth: width - saveButton.width - 10
//IPv4 Config
GroupBox {
- flat: false
width: content.groupWidth
Layout.fillWidth: true
title: qsTr("IPv4")
@@ -85,135 +82,74 @@ Item {
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
- }
- }
+ ComboBoxEntry {
+ title: qsTr("Connection method:")
+ titleWidth: content.titleWidth
+ model: ListModel {
+ id: methodsModel
- 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;
+ ListElement {
+ text: "DHCP"
+ method: NetworkSettingsIPv4.Dhcp
}
- 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
+ ListElement {
+ text: "Manual"
+ method: NetworkSettingsIPv4.Manual
}
- TextLabel {
- text: service.ipv4.address
+ ListElement {
+ text: "Off"
+ method: NetworkSettingsIPv4.Off
}
}
-
- 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
- }
+ Component.onCompleted: currentIndex = service.ipv4.method
+ onCurrentIndexChanged: {
+ ipv4Changed = true;
+ service.ipv4.method = model.get(currentIndex).method;
}
}
- Column {
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
- visible: service.ipv4.method === NetworkSettingsIPv4.Manual
+ GridLayout {
+ columnSpacing: 10
+ rows: 3
+ columns: 2
+ visible: service.ipv4.method !== NetworkSettingsIPv4.Off
+ width: parent.width
- 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
- }
+ Label {
+ text: qsTr("Address:")
+ Layout.preferredWidth: content.titleWidth
+ horizontalAlignment: Text.AlignRight
}
-
- 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
- }
+ IpAddressTextField {
+ id: ipv4Address
+ text: service.ipv4.address
+ onTextChanged: ipv4Changed = true;
+ onAccepted: if (text.length > 0) service.ipv4.address = text
+ enabled: service.ipv4.method === NetworkSettingsIPv4.Manual
}
-
- 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
- }
+ Label {
+ text: qsTr("Mask:")
+ Layout.preferredWidth: content.titleWidth
+ horizontalAlignment: Text.AlignRight
+ }
+ IpAddressTextField {
+ id: ipv4Mask
+ text: service.ipv4.mask
+ onTextChanged: ipv4Changed = true;
+ onAccepted: if (text.length > 0) service.ipv4.mask = text
+ enabled: service.ipv4.method === NetworkSettingsIPv4.Manual
+ }
+ Label {
+ text: qsTr("Router:")
+ Layout.preferredWidth: content.titleWidth
+ horizontalAlignment: Text.AlignRight
+ }
+ IpAddressTextField {
+ id: ipv4Gateway
+ text: service.ipv4.gateway
+ onTextChanged: ipv4Changed = true
+ onAccepted: if (text.length > 0) service.ipv4.gateway = text
+ enabled: service.ipv4.method === NetworkSettingsIPv4.Manual
}
}
}
@@ -221,7 +157,6 @@ Item {
//IPv6 Config
GroupBox {
- flat: false
width: content.groupWidth
Layout.fillWidth: true
title: qsTr("IPv6")
@@ -229,384 +164,179 @@ Item {
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
- }
- }
+ ComboBoxEntry {
+ title: qsTr("Connection method:")
+ titleWidth: content.titleWidth
+ model: ListModel {
+ id: ipv6methodsmodel
- 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;
+ ListElement {
+ text: qsTr("Auto")
+ method: NetworkSettingsIPv6.Auto
}
- 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
+ ListElement {
+ text: qsTr("Manual")
+ method: NetworkSettingsIPv6.Manual
}
- TextLabel {
- text: service.ipv6.address
+ ListElement {
+ text: qsTr("Off")
+ method: NetworkSettingsIPv6.Off
}
}
- Row {
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
- TextLabel {
- text: qsTr("Router")
- width: content.titleWidth
- horizontalAlignment: Text.AlignRight
- }
- TextLabel {
- text: service.ipv6.gateway
- }
- }
+ Component.onCompleted: currentIndex = service.ipv6.method
- Row {
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
- TextLabel {
- text: qsTr("Prefix length")
- width: content.titleWidth
- horizontalAlignment: Text.AlignRight
- }
- TextLabel {
- text: service.ipv6.prefixLength
- }
+ onCurrentIndexChanged: {
+ ipv6Changed = true;
+ service.ipv6.method = model.get(currentIndex).method;
}
}
-
- 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
- }
+ GridLayout {
+ columnSpacing: 10
+ rows: 3
+ columns: 2
+ visible: service.ipv6.method !== NetworkSettingsIPv6.Off
+
+ Label {
+ text: qsTr("Address:")
+ Layout.preferredWidth: content.titleWidth
+ horizontalAlignment: Text.AlignRight
}
-
- 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
- }
+ TextField {
+ id: ipv6Address
+ text: service.ipv6.address
+ Layout.fillWidth: true
+ onTextChanged: ipv6Changed = true;
+ onAccepted: if (text.length > 0) service.ipv6.address = text
+ enabled: service.ipv6.method === NetworkSettingsIPv6.Manual
+ }
+ Label {
+ text: qsTr("Router:")
+ Layout.preferredWidth: content.titleWidth
+ horizontalAlignment: Text.AlignRight
}
-
- 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)
- }
+ TextField {
+ id: ipv6Gateway
+ text: service.ipv6.gateway
+ Layout.fillWidth: true
+ onTextChanged: ipv6Changed = true;
+ onAccepted: if (text.length > 0) service.ipv4.gateway = text
+ enabled: service.ipv6.method === NetworkSettingsIPv6.Manual
+ }
+ Label {
+ text: qsTr("Prefix length:")
+ Layout.preferredWidth: content.titleWidth
+ horizontalAlignment: Text.AlignRight
+ }
+ TextField {
+ id: ipv6PrefixLength
+ text: service.ipv6.prefixLength
+ Layout.fillWidth: true
+ validator: IntValidator { bottom: 0; top: 255 }
+ onTextChanged: ipv6Changed = true
+ onAccepted: if (text.length > 0) service.ipv6.prefixLength = parseInt(text)
+ enabled: service.ipv6.method === NetworkSettingsIPv6.Manual
}
}
}
}
-
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()
- }
- }
+ AddressListEntry {
+ title: qsTr("Address:")
+ model: service.nameservers
+ modified: nameserversChanged
}
}
}
-
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()
- }
- }
+ AddressListEntry {
+ title: qsTr("Address:")
+ model: service.domains
+ modified: domainsChanged
}
}
}
-
GroupBox {
- flat: false
width: content.groupWidth
Layout.fillWidth: true
title: qsTr("Proxy Settings")
ColumnLayout {
- anchors.fill: parent
-
- ListModel {
- id: proxyMethodModel
+ id: proxyLayout
+ width: parent.width
- ListElement {
- text: qsTr("Direct")
- method: NetworkSettingsProxy.Direct
- }
- ListElement {
- text: qsTr("Auto")
- method: NetworkSettingsProxy.Auto
- }
- ListElement {
- text: qsTr("Manual")
- method: NetworkSettingsProxy.Manual
- }
- }
+ ComboBoxEntry {
+ title: qsTr("Configuration:")
+ titleWidth: content.titleWidth
+ model: ListModel {
+ id: proxyMethodModel
- Row {
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
- TextLabel {
- text: qsTr("Configuration")
- width: content.titleWidth
- horizontalAlignment: Text.AlignRight
+ ListElement {
+ text: qsTr("Direct")
+ method: NetworkSettingsProxy.Direct
+ }
+ ListElement {
+ text: qsTr("Auto")
+ method: NetworkSettingsProxy.Auto
+ }
+ ListElement {
+ text: qsTr("Manual")
+ method: NetworkSettingsProxy.Manual
+ }
}
+ Component.onCompleted: currentIndex = service.proxy.method
- CustomCombobox {
- id: proxyMethodSel
- model: proxyMethodModel
- Component.onCompleted: selectedIndex = service.proxy.method
- onSelectedIndexChanged : {
- proxyChanged = true;
- service.proxy.method = model.get(selectedIndex).method;
- }
- delegate: FlatStyledDropdownDelegate { }
+ onCurrentIndexChanged: {
+ proxyChanged = true;
+ service.proxy.method = model.get(currentIndex).method;
}
}
-
- Row {
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
+ RowLayout {
+ spacing: 10
visible: service.proxy.method !== NetworkSettingsProxy.Direct
- TextLabel {
- text: service.proxy.method === NetworkSettingsProxy.Manual ? qsTr("Proxy address") : qsTr("Automatic configuration URL")
- width: content.titleWidth
+ Label {
+ text: service.proxy.method === NetworkSettingsProxy.Manual ? qsTr("Proxy address:") : qsTr("Configuration URL:")
+ Layout.preferredWidth: content.titleWidth
horizontalAlignment: Text.AlignRight
+ Layout.alignment: Qt.AlignVCenter
+ elide: Label.ElideRight
}
TextField {
id: proxyUrl
text: service.proxy.url
+ Layout.fillWidth: true
onTextChanged: proxyChanged = true;
onAccepted: service.proxy.url = text;
}
}
- Row {
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
+ AddressListEntry {
+ model: service.proxy.excludes
+ modified: proxyChanged
+ title: qsTr("No proxy for:")
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)
+ anchors.margins: 20
text: qsTr("Save")
onClicked: {
@@ -631,6 +361,7 @@ Item {
if (domainsChanged) {
service.setupDomainsConfig();
}
+
if (proxyChanged) {
proxyUrl.accepted();
service.setupNetworkSettingsProxy();
diff --git a/src/settingsui/network/IpAddressTextField.qml b/src/settingsui/network/IpAddressTextField.qml
index 102d458..e7e90ab 100644
--- a/src/settingsui/network/IpAddressTextField.qml
+++ b/src/settingsui/network/IpAddressTextField.qml
@@ -33,9 +33,11 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-import QtQuick 2.5
-import QtQuick.Layouts 1.1
-import QtQuick.Controls 1.4
+import QtQuick 2.6
+import QtQuick.Layouts 1.3
+import Qt.labs.controls 1.0
+import Qt.labs.controls.material 1.0
+import Qt.labs.controls.universal 1.0
TextField {
Layout.fillWidth: true
diff --git a/src/settingsui/network/NetworkSettings.qml b/src/settingsui/network/NetworkSettings.qml
index 2eed812..d516426 100644
--- a/src/settingsui/network/NetworkSettings.qml
+++ b/src/settingsui/network/NetworkSettings.qml
@@ -33,21 +33,22 @@
** $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 QtQuick 2.6
+import QtQuick.Layouts 1.3
+import Qt.labs.controls 1.0
+import Qt.labs.controls.material 1.0
+import Qt.labs.controls.universal 1.0
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)
+ anchors.leftMargin: 20
+ anchors.topMargin: 20
+ anchors.bottomMargin: 20
+ anchors.fill: parent
title: qsTr("Select Connection")
function stateToStr(serviceState) {
@@ -70,45 +71,37 @@ Item {
return qsTr("Undefined");
}
}
-
ColumnLayout {
- width: networkSelect.width
- ExclusiveGroup {
- id: exgroup
- }
+ width: parent.width
Repeater {
model: NetworkSettingsManager.interfaces
Button {
- implicitWidth: networkSelect.width - Math.round(20 * Flat.FlatStyle.scaleFactor)
- implicitHeight: Math.round(54 * Flat.FlatStyle.scaleFactor)
+ Layout.fillWidth: true
+ implicitHeight: 54
checkable: true
- exclusiveGroup: exgroup
- Row {
+ label: Row {
anchors.fill: parent
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
+ spacing: 10
Image {
- id: typeId
- height: parent.height
- width: height
+ id: typeId
+ height: parent.height
+ width: height
}
-
Column {
- height: Math.round(parent.height * 0.7)
+ height: parent.height * .7
spacing: 0
anchors.verticalCenter: parent.verticalCenter
- TextLabel {
+ Label {
text: name
}
-
- TextLabel {
+ Label {
text: networkSelect.stateToStr(modelData.state)
- font.pixelSize: Math.round(12 * Flat.FlatStyle.scaleFactor)
+ font.pixelSize: 12
}
-
}
}
@@ -131,7 +124,10 @@ Item {
NetworkDetails {
id: networkDetails
+ anchors.leftMargin: networkSelect.width + 40
+ anchors.topMargin: 20
+ anchors.rightMargin: 20
+ anchors.bottomMargin: 20
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
index 72216a6..17ec931 100644
--- a/src/settingsui/network/WifiSelectorDelegate.qml
+++ b/src/settingsui/network/WifiSelectorDelegate.qml
@@ -33,58 +33,39 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-import QtQuick 2.5
-import QtQuick.Layouts 1.1
-import QtQuick.Controls 1.4
-import "../common"
+import QtQuick 2.6
+import QtQuick.Layouts 1.3
+import Qt.labs.controls 1.0
+import Qt.labs.controls.material 1.0
+import Qt.labs.controls.universal 1.0
import com.theqtcompany.settings.network 1.0
-import QtQuick.Controls.Styles.Flat 1.0 as Flat
-Item {
+ItemDelegate {
id: root
- property bool checkable: true
- property bool checked: false
- property bool pressed: false
+ autoExclusive: true
+ checkable: true
property bool connect: modelData["connected"]
- signal clicked()
+ width: parent.width
+ contentItem: Item {
+ width: root.width
- 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 {
+ Label {
id: text
+ leftPadding: root.indicator.width + root.spacing
anchors.left: parent.left
- anchors.right: parent.right
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- anchors.margins: Math.round(10 * Flat.FlatStyle.scaleFactor)
+ anchors.top:parent.top
+ anchors.right: signalMonitor.left
+ anchors.bottom:parent.bottom
+ elide: Text.ElideRight
horizontalAlignment: Text.AlignLeft
- text: modelData["name"]
+ verticalAlignment: Text.AlignVCenter
+ text:modelData["name"]
}
WifiSignalMonitor {
- anchors.verticalCenter: parent.verticalCenter
+ id: signalMonitor
anchors.right: parent.right
- anchors.margins: Math.round(10 * Flat.FlatStyle.scaleFactor)
- height: Math.round(parent.height * .8)
+ height: parent.height
width: height
- signalStrength: modelData["signalStrength"]
- connected: modelData["connected"]
}
}
}
diff --git a/src/settingsui/network/WifiSettings.qml b/src/settingsui/network/WifiSettings.qml
index 352ec3c..b51452d 100644
--- a/src/settingsui/network/WifiSettings.qml
+++ b/src/settingsui/network/WifiSettings.qml
@@ -33,121 +33,130 @@
** $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 QtQuick 2.6
+import QtQuick.Layouts 1.3
+import Qt.labs.controls 1.0
+import Qt.labs.controls.material 1.0
+import Qt.labs.controls.universal 1.0
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;
- 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)
+ spacing: 20
width: parent.width
- Row {
+
+ RowLayout {
+ spacing: 10
id: enableSwitch
width: parent.width
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
- TextLabel {
- width: root.width*0.382
+
+ Label {
+ Layout.preferredWidth: root.width * 0.382
+ Layout.alignment: Qt.AlignVCenter
horizontalAlignment: Text.AlignRight
- text: selectedInterface.powered ? qsTr("Disable Wifi") : qsTr("Enable Wifi")
+ text: selectedInterface.powered ? qsTr("Wi-Fi OFF") : qsTr("Wi-Fi ON")
}
Switch {
checked: selectedInterface.powered
onCheckedChanged: selectedInterface.powered = checked
}
}
-
- Row {
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
+ RowLayout {
+ spacing: 10
width: parent.width
- TextLabel {
- id: labelText
- text: qsTr("Selected network ")
- width: content.width*0.382
+ Label {
+ Layout.preferredWidth: root.width * 0.382
+ text: qsTr("Current network")
horizontalAlignment: Text.AlignRight
+ Layout.alignment: Qt.AlignVCenter
}
-
- CustomCombobox {
+ ComboBoxEntry {
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();
+ Layout.fillWidth: true
+ onCurrentIndexChanged: if (currentIndex >= 0) model.itemFromRow(currentIndex).connectService();
delegate: WifiSelectorDelegate {
- id: delegate
- onConnectChanged: if (connect) networkSelection.setSelectIndexToVal(modelData.name, "name");
+ onConnectChanged: if (connect) networkSelection.currentIndex = networkSelection.find(modelData.name)
}
}
}
-
GroupBox {
id: connectView
title: qsTr("Enter a password")
- flat: false
visible: false
+ Layout.fillWidth: true
ColumnLayout {
- Row {
+ width: parent.width
+
+ RowLayout {
id: errorView
- property alias text: text.text
visible: text.text !== ""
+ spacing: 10
+ property alias text: text.text
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
Image {
- source: "../icons/Alert_yellow_1x.png"
+ source: "Alert_yellow_1x.png"
+ Layout.alignment: Qt.AlignVCenter
}
Text {
id: text
color: "#face20"
text: ""
+ Layout.alignment: Qt.AlignVCenter
}
}
- Row {
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
+ RowLayout {
+ spacing: 10
visible: false
- TextLabel {
- text: qsTr("User name")
- width: root.width*0.382
+ width: parent.width
+
+ Label {
+ text: qsTr("User name:")
horizontalAlignment: Text.AlignRight
+ Layout.preferredWidth: root.width * 0.382
+ Layout.alignment: Qt.AlignVCenter
}
TextField {
text: ""
inputMethodHints: Qt.ImhNoPredictiveText
+ Layout.alignment: Qt.AlignVCenter
+ Layout.fillWidth: true
}
}
- Row {
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
- TextLabel {
- text: qsTr("Password")
+ RowLayout {
+ spacing: 10
+ width: parent.width
+
+ Label {
+ text: qsTr("Password:")
horizontalAlignment: Text.AlignRight
+ Layout.preferredWidth: root.width * 0.382
+ Layout.alignment: Qt.AlignVCenter
}
TextField {
id: password
text: ""
echoMode: TextInput.Password
inputMethodHints: Qt.ImhNoPredictiveText
+ Layout.alignment: Qt.AlignVCenter
+ Layout.fillWidth: true
}
}
- Row {
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
+ RowLayout {
+ spacing: 10
+
Button {
text: qsTr("Connect")
onClicked: {
@@ -162,19 +171,18 @@ Item {
}
}
}
-
Button {
id: disconnect
text: qsTr("Disconnect")
visible: selectedInterface.state === NetworkSettingsState.Online ||
selectedInterface.state === NetworkSettingsState.Ready
onClicked: {
+ console.log("disconnect");
NetworkSettingsManager.services.itemFromRow(networkSelection.selectedIndex).disconnectService();
networkSelection.selectedIndex = -1;
}
}
}
-
Connections {
target: NetworkSettingsUserAgent
onShowUserCredentialsInput : {
diff --git a/src/settingsui/network/WifiSignalMonitor.qml b/src/settingsui/network/WifiSignalMonitor.qml
index 35d9e53..40a0837 100644
--- a/src/settingsui/network/WifiSignalMonitor.qml
+++ b/src/settingsui/network/WifiSignalMonitor.qml
@@ -33,11 +33,10 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-import QtQuick 2.5
+import QtQuick 2.6
Item {
id: root
-
property bool scanning: false
property int signalStrength: 100
property bool connected: false
@@ -63,21 +62,30 @@ Item {
}
Image {
+ id: sprite
+ property int currentFrame: 0
anchors.fill: parent
source: "Wifi_lightgray_2x.png"
- }
+ clip: true
- 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
+ Timer {
+ id: scanningTimer
+ running: scanning
+ interval: 250
+ repeat: true
+ onTriggered: {
+ if (sprite.currentFrame < 4)
+ sprite.currentFrame++
+ else
+ sprite.currentFrame = 0
+ }
+ }
+
+ Image {
+ height: parent.height
+ width: parent.width * 4
+ source: "WifiAnim_black_2x.png"
+ x: -parent.currentFrame * width / 4
+ }
}
}
diff --git a/src/settingsui/network/WiredSettings.qml b/src/settingsui/network/WiredSettings.qml
index aad97fe..9359484 100644
--- a/src/settingsui/network/WiredSettings.qml
+++ b/src/settingsui/network/WiredSettings.qml
@@ -33,17 +33,16 @@
** $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 QtQuick 2.6
+import QtQuick.Layouts 1.3
+import Qt.labs.controls 1.0
+import Qt.labs.controls.material 1.0
+import Qt.labs.controls.universal 1.0
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");
@@ -51,129 +50,103 @@ Item {
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
- }
+ ipv4Method.currentIndex = service.ipv4.method
}
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: ")
+ spacing: 10
+ width: parent.width
+
+ ComboBoxEntry {
+ id: ipv4Method
+ title: qsTr("Connection method:")
+ model: ListModel {
+ id: methodsModel
+
+ ListElement {
+ text: "DHCP"
+ method: NetworkSettingsIPv4.Dhcp
+ }
+ ListElement {
+ text: "Manual"
+ method: NetworkSettingsIPv4.Manual
+ }
+ ListElement {
+ text: "Off"
+ method: NetworkSettingsIPv4.Off
+ }
}
- 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;
+ Component.onCompleted: currentIndex = service.ipv4.method
+ onCurrentIndexChanged: {
+ if (model.get(currentIndex).method !== NetworkSettingsIPv4.Dhcp) {
+ service.ipv4.method = model.get(currentIndex).method;
+ editMode = true;
+ }
+ else if (service){
+ //Enable DHCP
+ if (service.ipv4.method !== model.get(currentIndex).method) {
+ service.ipv4.method = model.get(currentIndex).method;
+ service.setupIpv4Config();
}
+ editMode = false;
}
- delegate: FlatStyledDropdownDelegate { }
}
}
-
- Row {
+ GridLayout {
+ columns: 2
+ rows: 4
+ width: parent.width
visible: service.ipv4.method !== NetworkSettingsIPv4.Off
- TextLabel {
+
+ Label {
text: qsTr("IP Address: ")
- }
- TextLabel {
- text: service.ipv4.address
- visible: !editMode
+ width: parent.width * .3
}
IpAddressTextField {
id: ipv4Address
- placeholderText: service.ipv4.address
- visible: editMode
+ text: service.ipv4.address
+ enabled: editMode
onAccepted: if (text.length > 0) service.ipv4.address = text
}
- }
-
- Row {
- visible: service.ipv4.method !== NetworkSettingsIPv4.Off
- TextLabel {
+ Label {
text: qsTr("Mask: ")
}
- TextLabel {
- text: service.ipv4.mask
- visible: !editMode
- }
IpAddressTextField {
id: ipv4Mask
- placeholderText: service.ipv4.mask
- visible: editMode
+ text: service.ipv4.mask
+ enabled: editMode
onAccepted: if (text.length > 0) service.ipv4.mask = text
}
- }
-
- Row {
- visible: service.ipv4.method !== NetworkSettingsIPv4.Off
- TextLabel {
+ Label {
text: qsTr("Router: ")
}
- TextLabel {
- text: service.ipv4.gateway
- visible: !editMode
- }
IpAddressTextField {
id: ipv4Gateway
- placeholderText: service.ipv4.gateway
- visible: editMode
+ text: service.ipv4.gateway
+ enabled: editMode
onAccepted: if (text.length > 0) service.ipv4.gateway = text
}
- }
-
- Row {
- visible: service.ipv4.method !== NetworkSettingsIPv4.Off
- TextLabel {
+ Label {
text: qsTr("DNS server: ")
}
Row {
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
+ spacing: 10
Repeater {
model: service.nameservers
- TextLabel {
+ Label {
text: display
}
}
}
}
-
Row {
+ spacing: 10
Button {
text: qsTr("Save")
visible: editMode
@@ -191,17 +164,15 @@ Item {
visible: editMode
onClicked: {
editMode = false;
- methodSelection.currentIndex = service.ipv4.method
+ ipv4Method.currentIndex = service.ipv4.method
}
}
}
Button {
text: qsTr("Edit")
visible: !editMode
-
- onClicked: stackView.push({item: Qt.resolvedUrl("EditWiredSettings.qml"), properties: {service: root.service}});
+ onClicked: stackView.push(Qt.resolvedUrl("EditWiredSettings.qml"), {service: root.service});
}
}
}
}
-
diff --git a/src/settingsui/qml.qrc b/src/settingsui/qml.qrc
index 5ed5504..3c82bc5 100644
--- a/src/settingsui/qml.qrc
+++ b/src/settingsui/qml.qrc
@@ -2,10 +2,6 @@
<qresource prefix="/">
<file>main.qml</file>
<file>settingsview.xml</file>
- <file>common/CustomCombobox.qml</file>
- <file>common/FlatStyledDropdownDelegate.qml</file>
- <file>common/IconButton.qml</file>
- <file>common/TextLabel.qml</file>
<file>network/EditWiredSettings.qml</file>
<file>network/IpAddressTextField.qml</file>
<file>network/NetworkDetails.qml</file>
@@ -22,5 +18,9 @@
<file>timedate/AnalogClock.qml</file>
<file>timedate/TimeDate.qml</file>
<file>timedate/TimezonesView.qml</file>
+ <file>network/AddressListEntry.qml</file>
+ <file>network/ComboBoxEntry.qml</file>
+ <file>timedate/CustomCalendar.qml</file>
+ <file>common/CustomTableView.qml</file>
</qresource>
</RCC>
diff --git a/src/settingsui/timedate/AnalogClock.qml b/src/settingsui/timedate/AnalogClock.qml
index 9f871ed..eb46852 100644
--- a/src/settingsui/timedate/AnalogClock.qml
+++ b/src/settingsui/timedate/AnalogClock.qml
@@ -33,8 +33,10 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-import QtQuick 2.5
-import "../common"
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+import Qt.labs.controls.material 1.0
+import Qt.labs.controls.universal 1.0
import com.theqtcompany.settings.timedate 1.0
Item {
@@ -59,18 +61,16 @@ Item {
onTimeChanged : newTime.setSeconds(currentTime.getSeconds())
onTimeZoneChanged : Date.timeZoneUpdated()
}
-
- TextLabel {
+ Label {
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)
+ anchors.margins: 40
color: "white"
border.color: editMode ? "#d6d6d6" : "#5caa15"
border.width: Math.round(root.width * 0.120)
@@ -96,7 +96,6 @@ Item {
}
}
}
-
Rectangle {
id: hours
x: Math.round(root.height / 2 - width / 2)
@@ -115,7 +114,6 @@ Item {
}
}
}
-
Rectangle {
id: seconds
x: root.height / 2 - width / 2
@@ -136,59 +134,56 @@ Item {
}
}
}
-
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)
- }
- }
- }
-
+ 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)
@@ -213,11 +208,9 @@ Item {
else if (preHour == 12 && newHour == 11) {
pm = false;
}
-
if (pm == true) {
newHour += 12;
}
-
newTime.setHours(newHour);
}
@@ -228,13 +221,12 @@ Item {
}
sourceComponent: editor
}
-
Loader {
+ visible: editMode
+ sourceComponent: editor
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);
@@ -242,7 +234,6 @@ Item {
newTime.setMinutes(newMin);
newTime.setHours(hours);
}
-
function ready(val) {
var newmins = Math.round(val / 6);
currentTime.setMinutes(newmins);
@@ -252,4 +243,3 @@ Item {
}
}
}
-
diff --git a/src/settingsui/timedate/CustomCalendar.qml b/src/settingsui/timedate/CustomCalendar.qml
new file mode 100644
index 0000000..09d4e3e
--- /dev/null
+++ b/src/settingsui/timedate/CustomCalendar.qml
@@ -0,0 +1,221 @@
+/****************************************************************************
+**
+** 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.6
+import QtQuick.Layouts 1.3
+import Qt.labs.controls 1.0
+import Qt.labs.controls.material 1.0
+import Qt.labs.controls.universal 1.0
+import Qt.labs.calendar 1.0
+import QtQml 2.2
+import com.theqtcompany.settings.timedate 1.0
+
+Rectangle {
+ id: root
+ border.color: "#bdbebf"
+ border.width: 1
+ color: "white"
+ height: cal.height
+
+ function updateDate() {
+ var date = new Date()
+ grid.month = date.getMonth()
+ grid.date = date.getDate()
+ grid.year = date.getFullYear()
+ }
+
+ ColumnLayout {
+ id: cal
+ width: root.width
+ spacing: 10
+ enabled: !automatic.checked
+
+ RowLayout {
+ spacing: 0
+ Layout.alignment: Qt.AlignTop
+
+ Button {
+ id: previousMonth
+ Layout.preferredWidth: height
+ visible: enabled
+ label: Rectangle {
+ anchors.fill: parent
+ color: "#d6d6d6"
+
+ Image {
+ anchors.centerIn: parent
+ source: "../icons/Chevron-left_black_1x.png"
+ }
+ }
+ onClicked: {
+ if (grid.month === Calendar.January) {
+ grid.year--
+ grid.month = Calendar.December
+ return;
+ }
+ grid.month--
+ }
+ }
+ Rectangle {
+ Layout.fillWidth: true
+ color: enabled ? "#d6d6d6" : "#80c342"
+ height: previousMonth.height
+
+ Label {
+ id: title
+ text: Qt.locale().monthName(grid.month, Locale.LongFormat) + " " + grid.year
+ anchors.fill: parent
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+ }
+ Button {
+ id: nextMonth
+ Layout.preferredWidth: height
+ visible: enabled
+ label: Rectangle {
+ anchors.fill: parent
+ color: "#d6d6d6"
+
+ Image {
+ anchors.centerIn: parent
+ source: "../icons/Chevron-left_black_1x.png"
+ mirror: true
+ }
+ }
+ onClicked: {
+ if (grid.month === Calendar.December) {
+ grid.year++
+ grid.month = Calendar.January
+ }
+ grid.month++
+ }
+ }
+ }
+ DayOfWeekRow {
+ locale: grid.locale
+ Layout.column: 1
+ Layout.fillWidth: true
+ Layout.alignment: Qt.AlignTop
+ delegate: Text {
+ text: model.narrowName.charAt(0)
+ font.bold: true
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+ }
+ MonthGrid {
+ id: grid
+ Layout.alignment: Qt.AlignTop
+ Layout.fillWidth: true
+ property int date: -1
+ property Item currentItem: null
+ delegate: Label {
+ id: gridDelegate
+ objectName: "gridDelegate"
+ text: delegateDay
+ opacity: model.month === grid.month ? 1 : .2
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ font.bold: delegateDay === grid.date && delegateMonth === grid.month
+ color: delegateDay === grid.date && delegateMonth === grid.month && enabled ? "white" : "black"
+ property int delegateDay: model.day
+ property int delegateMonth: model.month
+ }
+ Component.onCompleted: updateDate()
+
+ Rectangle {
+ z: -1
+ id: highlight
+ x: grid.currentItem ? grid.currentItem.x + grid.currentItem.width / 2 - width / 2: 0
+ y: grid.currentItem ? grid.currentItem.y + grid.currentItem.height / 2- height / 2: 0
+ width: grid.currentItem ? grid.currentItem.width : 0
+ visible: grid.currentItem
+ height: width
+ color: enabled? "#80c342" : "#d6d6d6"
+ radius: width / 2
+ }
+
+ onMonthChanged: updateHighlightPosition()
+ onYearChanged: updateHighlightPosition()
+ onDateChanged: updateHighlightPosition()
+
+ function updateHighlightPosition() {
+ var date = new Date()
+
+ date.setFullYear(grid.year)
+ date.setMonth(grid.month)
+ date.setDate(grid.date)
+
+ var index = grid.source.indexOf(date)
+ var delegate = grid.contentItem.children[index]
+
+ if (delegate)
+ grid.currentItem = delegate
+ }
+
+ MouseArea {
+ anchors.fill: parent
+
+ onClicked: {
+ var item = grid.contentItem.childAt(mouse.x, mouse.y)
+
+ if (item) {
+ if (item.objectName !== "gridDelegate")
+ item = grid.contentItem.children[0]
+
+ if (!item)
+ return;
+
+ grid.currentItem = item
+ grid.date = item.delegateDay
+ grid.month = item.delegateMonth
+
+ var currentTime = TimeManager.time;
+ var newDate = new Date();
+
+ newDate.setFullYear(grid.year)
+ newDate.setMonth(grid.month)
+ newDate.setDate(grid.date)
+ newDate.setHours(currentTime.getHours());
+ newDate.setMinutes(currentTime.getMinutes());
+ newDate.setSeconds(currentTime.getSeconds());
+ TimeManager.time = newDate;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/settingsui/timedate/TimeDate.qml b/src/settingsui/timedate/TimeDate.qml
index 439e4ac..5ba8dfa 100644
--- a/src/settingsui/timedate/TimeDate.qml
+++ b/src/settingsui/timedate/TimeDate.qml
@@ -33,11 +33,11 @@
** $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 QtQuick 2.6
+import QtQuick.Layouts 1.3
+import Qt.labs.controls 1.0
+import Qt.labs.controls.material 1.0
+import Qt.labs.controls.universal 1.0
import com.theqtcompany.settings.timedate 1.0
Item {
@@ -46,14 +46,14 @@ Item {
Flickable {
anchors.fill: parent
- anchors.margins: Math.round(40 * Flat.FlatStyle.scaleFactor)
- anchors.bottomMargin: Math.round(20 * Flat.FlatStyle.scaleFactor)
+ anchors.margins: 20
contentHeight: content.height
contentWidth: width
- Column {
+ ColumnLayout {
id: content
width: parent.width
+ spacing: 20
GroupBox {
width: parent.width
@@ -61,105 +61,68 @@ Item {
Layout.fillWidth: true
ColumnLayout {
- spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
+ spacing: 10
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();
+ onCheckedChanged: if (checked) updateTimer.restart()
+
+ Timer {
+ id: updateTimer
+ interval: 300
+ onTriggered: calendar.updateDate()
+ }
}
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();
- });
- }
- }
- }
- }
+ }
+ RowLayout
+ {
+ id: layout
+ spacing: 10
- Loader {
- id: calloader
- sourceComponent: calendar
- function reload() {
- calloader.sourceComponent = undefined;
- calloader.sourceComponent = calendar;
- }
- }
+ CustomCalendar {
+ id: calendar
+ width: height
+ }
- AnalogClock {
- id: clock
- width: calloader.width
- height: width
- editMode: !automatic.checked
- }
- }
+ AnalogClock {
+ id: clock
+ height: calendar.height
+ width: height
+ editMode: !automatic.checked
+ }
+ }
+ Component {
+ id: zoneselect
+ TimezonesView { }
+ }
- Component {
- id: zoneselect
- TimezonesView { }
- }
+ }
+ }
+ GroupBox {
+ title: qsTr("Timezone Settings")
+ Layout.fillWidth: true
+ width: parent.width
+ visible: true
- 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)
- }
- }
- }
+ RowLayout {
+ spacing: 10
+ Label {
+ text: TimeManager.timeZone
+ Layout.alignment: Qt.AlignVCenter
+ }
+ Button {
+ text: qsTr("Change")
+ onClicked : stackView.push(zoneselect)
+ }
}
}
}
diff --git a/src/settingsui/timedate/TimezonesView.qml b/src/settingsui/timedate/TimezonesView.qml
index 4e09350..16ac10e 100644
--- a/src/settingsui/timedate/TimezonesView.qml
+++ b/src/settingsui/timedate/TimezonesView.qml
@@ -33,57 +33,45 @@
** $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 QtQuick 2.6
+import QtQuick.Layouts 1.3
+import Qt.labs.controls 1.0
+import Qt.labs.controls.material 1.0
+import Qt.labs.controls.universal 1.0
import com.theqtcompany.settings.timedate 1.0
-
+import "../common"
Item {
id: root
+ property string title: qsTr("Timezone settings")
Component.onCompleted: timezone.text = TimezonesFilter.filter
- Column {
+ ColumnLayout {
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)
+ anchors.margins: 20
+ spacing: 10
- TextLabel {
+ RowLayout {
+ spacing: 10
+
+ Label {
text: qsTr("Search area: ")
+ Layout.alignment: Qt.AlignVCenter
}
-
TextField {
id: timezone
text: ""
onTextChanged: TimezonesFilter.filter = timezone.text
+ Layout.alignment: Qt.AlignVCenter
}
}
-
- TableView {
- width: parent.width
- height: Math.round(parent.height - 40 * Flat.FlatStyle.scaleFactor)
- Layout.fillWidth: true
+ CustomTableView {
+ headerTexts: [qsTr("Timezone"), qsTr("Country")]
+ roleNames: ["id", "country"]
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);
+ var val = model.itemFromRow(index);
if (val !== "") {
TimeManager.timeZone = val;
stackView.pop();
diff --git a/src/timedatesettings/systemtime_p.h b/src/timedatesettings/systemtime_p.h
index 5ee6eef..5722259 100644
--- a/src/timedatesettings/systemtime_p.h
+++ b/src/timedatesettings/systemtime_p.h
@@ -66,7 +66,7 @@ public:
QString timeZone() const {
if (m_timeInterface)
return m_timeInterface->timezone();
- return "";
+ return QString();
}
void setTimeZone(const QString& aTimeZone) {
diff --git a/src/timedatesettings/timezonefiltermodel.cpp b/src/timedatesettings/timezonefiltermodel.cpp
index 3d1c0a4..69ed0c7 100644
--- a/src/timedatesettings/timezonefiltermodel.cpp
+++ b/src/timedatesettings/timezonefiltermodel.cpp
@@ -99,6 +99,6 @@ QVariant TimezoneFilterModel::itemFromRow(const int row) const
return nameRole;
}
}
- return QVariant::fromValue(QString(""));
+ return QVariant();
}
diff --git a/src/timedatesettings/timezonemodel.cpp b/src/timedatesettings/timezonemodel.cpp
index 2a8d0ed..cca90eb 100644
--- a/src/timedatesettings/timezonemodel.cpp
+++ b/src/timedatesettings/timezonemodel.cpp
@@ -46,7 +46,7 @@ TimezoneItem::TimezoneItem(const QByteArray& id, QObject *parent)
QTimeZone tz = QTimeZone(id);
m_name = tz.displayName(QTimeZone::StandardTime);
m_country = QLocale::countryToString(tz.country());
- m_id = id;
+ m_id = QString::fromUtf8(id);
}
QString TimezoneItem::name() const
@@ -116,11 +116,11 @@ QVariant TimezoneModel::data(const QModelIndex & index, int role) const
if (!index.isValid()) return QVariant();
TimezoneItem *item = m_items[index.row()];
- if (role == Qt::UserRole) {
- return item->id();
- }
switch (role) {
+ case Qt::UserRole:
+ return QVariant::fromValue(static_cast<QObject*>(item));
+ break;
case Name:
return item->id();
break;
@@ -134,6 +134,6 @@ QVariant TimezoneModel::data(const QModelIndex & index, int role) const
return item->id();
break;
default:
- return "";
+ return QVariant();
}
}
diff --git a/src/timedatesettings/timezonemodel.h b/src/timedatesettings/timezonemodel.h
index 7404954..a57be04 100644
--- a/src/timedatesettings/timezonemodel.h
+++ b/src/timedatesettings/timezonemodel.h
@@ -45,6 +45,8 @@ class TimezoneItem : public QObject
{
Q_OBJECT
Q_PROPERTY(QString id READ id CONSTANT)
+ Q_PROPERTY(QString name READ name CONSTANT)
+ Q_PROPERTY(QString country READ country CONSTANT)
public:
explicit TimezoneItem(const QByteArray& id, QObject *parent=0);
QString name() const;