Commit c96809b1 authored by Nate Graham's avatar Nate Graham 🔩
Browse files

[applets/Weather] Port config UI mostly to QQC2 and away from Plasma components

Summary:
Everything is ported to QQC2 except for the TableView since there is no direct analogue
in QQC2. The correct porting path is a ScrollView+ListView, but I can't do this right
now since the search/weather station selection functionality is currently broken for me,
making it impossible to test changes to the table.

Test Plan: Everything that was working before still works now

Reviewers: spstarr, #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D25509
parent 241be8fc
......@@ -16,7 +16,7 @@
*/
import QtQuick 2.9
import QtQuick.Controls 2.5 as QtControls
import QtQuick.Controls 2.5 as QQC2
import QtQuick.Layouts 1.3
import org.kde.kirigami 2.5 as Kirigami
......@@ -66,7 +66,7 @@ Kirigami.FormLayout {
Kirigami.FormData.label: i18nc("@label", "Location:")
Layout.fillWidth: true
QtControls.Label {
QQC2.Label {
id: locationDisplay
Layout.fillWidth: true
elide: Text.ElideRight
......@@ -82,7 +82,7 @@ Kirigami.FormLayout {
}
}
QtControls.Button {
QQC2.Button {
id: selectButton
Layout.fillWidth: true
icon.name: "find-location"
......@@ -91,7 +91,7 @@ Kirigami.FormLayout {
}
}
QtControls.SpinBox {
QQC2.SpinBox {
id: updateIntervalSpin
Kirigami.FormData.label: i18nc("@label:spinbox", "Update every:")
......
......@@ -17,11 +17,10 @@
import QtQuick 2.9
import QtQuick.Controls 1.4 as QtControls
import QtQuick.Controls 1.4 as QQC1
import QtQuick.Controls 2.5 as QQC2
import QtQuick.Layouts 1.3
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.private.weather 1.0
......@@ -64,12 +63,12 @@ ColumnLayout {
id: serviceListModel
}
QtControls.Menu {
QQC2.Menu {
id: serviceSelectionMenu
Instantiator {
model: serviceListModel
delegate: QtControls.MenuItem {
delegate: QQC2.MenuItem {
text: model.display
checkable: true
checked: model.checked
......@@ -89,7 +88,7 @@ ColumnLayout {
RowLayout {
Layout.fillWidth: true
QtControls.TextField {
QQC2.TextField {
id: searchStringEdit
Layout.fillWidth: true
......@@ -100,30 +99,25 @@ ColumnLayout {
}
}
QtControls.Button {
QQC2.Button {
id: serviceSelectionButton
iconName: "services"
tooltip: i18nc("@info:tooltip", "Select weather services providers")
menu: serviceSelectionMenu
}
Item {
Layout.preferredHeight: Math.max(searchButton.height, searchStringEdit.height)
Layout.preferredWidth: Layout.preferredHeight
icon.name: "services"
PlasmaComponents.BusyIndicator {
id: busy
checkable: true
checked: serviceSelectionMenu.opened
onClicked: serviceSelectionMenu.popup(serviceSelectionButton, serviceSelectionButton.width - serviceSelectionMenu.width, serviceSelectionButton.height)
anchors.fill: parent
visible: locationListModel.validatingInput
QQC2.ToolTip {
text: i18nc("@info:tooltip", "Select weather services providers")
visible: hovered
}
}
QtControls.Button {
QQC2.Button {
id: searchButton
iconName: "edit-find"
icon.name: "edit-find"
text: i18nc("@action:button", "Search")
enabled: canSearch
......@@ -133,7 +127,7 @@ ColumnLayout {
}
}
QtControls.TableView {
QQC1.TableView {
id: locationListView
Layout.minimumWidth: implicitWidth
......@@ -150,7 +144,7 @@ ColumnLayout {
}
}
QtControls.TableViewColumn {
QQC1.TableViewColumn {
id: locationListViewStationColumn
movable: false
......@@ -158,7 +152,7 @@ ColumnLayout {
role: "display"
}
QtControls.Label {
QQC2.Label {
id: noSearchResultReport
anchors.fill: parent
......@@ -167,6 +161,16 @@ ColumnLayout {
wrapMode: Text.WordWrap
visible: false
}
QQC2.BusyIndicator {
id: busy
anchors.centerIn: parent
width: Kirigami.Units.gridUnit
height: width
visible: locationListModel.validatingInput
}
}
Component.onCompleted: {
......
......@@ -18,10 +18,9 @@
import QtQuick 2.9
import QtQuick.Window 2.2
import QtQuick.Controls 1.4 as QtControls
import QtQuick.Controls 2.5 as QQC2
import QtQuick.Layouts 1.3
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.kirigami 2.5 as Kirigami
......@@ -54,7 +53,7 @@ Window {
id: syspal
}
QtControls.Action {
QQC2.Action {
id: acceptAction
shortcut: "Return"
......@@ -65,7 +64,7 @@ Window {
}
}
QtControls.Action {
QQC2.Action {
id: cancelAction
shortcut: "Escape"
......@@ -78,7 +77,7 @@ Window {
id: mainColumn
anchors {
fill: parent
margins: mainColumn.spacing * units.devicePixelRatio //margins are hardcoded in QStyle we should match that here
margins: mainColumn.spacing * Screen.devicePixelRatio //margins are hardcoded in QStyle we should match that here
}
WeatherStationPicker {
......@@ -93,16 +92,16 @@ Window {
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
QtControls.Button {
QQC2.Button {
enabled: !!source
iconName: "dialog-ok"
icon.name: "dialog-ok"
text: i18nc("@action:button", "Select")
onClicked: {
acceptAction.trigger();
}
}
QtControls.Button {
iconName: "dialog-cancel"
QQC2.Button {
icon.name: "dialog-cancel"
text: i18nc("@action:button", "Cancel")
onClicked: {
cancelAction.trigger();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment