diff --git a/applets/weather/package/contents/ui/config/ConfigAppearance.qml b/applets/weather/package/contents/ui/config/ConfigAppearance.qml index a2cfda2bb..9479128d8 100644 --- a/applets/weather/package/contents/ui/config/ConfigAppearance.qml +++ b/applets/weather/package/contents/ui/config/ConfigAppearance.qml @@ -1,139 +1,112 @@ /* * Copyright 2018 Friedrich W. H. Kossebau * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -import QtQuick 2.0 -import QtQuick.Controls 1.4 as QtControls1 -import QtQuick.Controls 2.2 as QtControls -import QtQuick.Layouts 1.3 +import QtQuick 2.5 +import QtQuick.Controls 2.5 as QtControls +import org.kde.kirigami 2.5 as Kirigami import org.kde.plasma.private.weather 1.0 -ColumnLayout { +Kirigami.FormLayout { id: displayConfigPage readonly property bool canShowMoreInCompactMode: !plasmoid.nativeInterface.needsToBeSquare signal configurationChanged function saveConfig() { var config = {}; config.showTemperatureInTooltip = showTemperatureInTooltipCheckBox.checked; config.showWindInTooltip = showWindInTooltipCheckBox.checked; config.showPressureInTooltip = showPressureInTooltipCheckBox.checked; config.showHumidityInTooltip = showHumidityInTooltipCheckBox.checked; config.showTemperatureInCompactMode = showTemperatureInCompactModeCheckBox.checked; plasmoid.nativeInterface.saveConfig(config); plasmoid.nativeInterface.configChanged(); } Component.onCompleted: { var config = plasmoid.nativeInterface.configValues(); showTemperatureInTooltipCheckBox.checked = config.showTemperatureInTooltip; showWindInTooltipCheckBox.checked = config.showWindInTooltip; showPressureInTooltipCheckBox.checked = config.showPressureInTooltip; showHumidityInTooltipCheckBox.checked = config.showHumidityInTooltip; showTemperatureInCompactModeCheckBox.checked = config.showTemperatureInCompactMode; } - QtControls1.GroupBox { - Layout.fillWidth: true - flat: true + Item { + Kirigami.FormData.isSection: true + Kirigami.FormData.label: i18nc("@title:group", "Compact Mode") - title: i18nc("@title:group", "Compact Mode") - - GridLayout { - columns: 2 - - QtControls.Label { - Layout.row: 0 - Layout.column: 0 - Layout.alignment: Qt.AlignRight - enabled: canShowMoreInCompactMode - text: i18nc("@label", "Display:") - } - - QtControls.CheckBox { - id: showTemperatureInCompactModeCheckBox - - Layout.row: 0 - Layout.column: 1 - enabled: canShowMoreInCompactMode + // TODO: conditionalize this once there are also settings for non-compact mode + visible: false + } - text: i18nc("@option:check", "Show temperature") - onCheckedChanged: displayConfigPage.configurationChanged(); - } + QtControls.CheckBox { + id: showTemperatureInCompactModeCheckBox - QtControls.Label { - Layout.row: 1 - Layout.column: 0 - Layout.alignment: Qt.AlignRight - text: i18nc("@label", "Tooltip:") - } + Kirigami.FormData.label: i18nc("@label", "Show beside widget icon:") - QtControls.CheckBox { - id: showTemperatureInTooltipCheckBox + enabled: canShowMoreInCompactMode - Layout.row: 1 - Layout.column: 1 + text: i18nc("@option:check Show on widget icon: temperature", "Temperature") + onCheckedChanged: displayConfigPage.configurationChanged(); + } - text: i18nc("@option:check", "Show temperature") - onCheckedChanged: displayConfigPage.configurationChanged(); - } - QtControls.CheckBox { - id: showWindInTooltipCheckBox + Item { + Kirigami.FormData.isSection: true + } - Layout.row: 2 - Layout.column: 1 - text: i18nc("@option:check", "Show wind") - onCheckedChanged: displayConfigPage.configurationChanged(); - } + QtControls.CheckBox { + id: showTemperatureInTooltipCheckBox - QtControls.CheckBox { - id: showPressureInTooltipCheckBox + Kirigami.FormData.label: i18nc("@label", "Show in tooltip:") - Layout.row: 3 - Layout.column: 1 + text: i18nc("@option:check", "Temperature") + onCheckedChanged: displayConfigPage.configurationChanged(); + } - text: i18nc("@option:check", "Show pressure") - onCheckedChanged: displayConfigPage.configurationChanged(); - } + QtControls.CheckBox { + id: showWindInTooltipCheckBox - QtControls.CheckBox { - id: showHumidityInTooltipCheckBox + text: i18nc("@option:check Show in tooltip: wind", "Wind") + onCheckedChanged: displayConfigPage.configurationChanged(); + } - Layout.row: 4 - Layout.column: 1 + QtControls.CheckBox { + id: showPressureInTooltipCheckBox - text: i18nc("@option:check", "Show humidity") - onCheckedChanged: displayConfigPage.configurationChanged(); - } - } + text: i18nc("@option:check Show in tooltip: pressure", "Pressure") + onCheckedChanged: displayConfigPage.configurationChanged(); } - Item { // tighten layout - Layout.fillHeight: true + QtControls.CheckBox { + id: showHumidityInTooltipCheckBox + + text: i18nc("@option:check Show in tooltip: humidity", "Humidity") + onCheckedChanged: displayConfigPage.configurationChanged(); } } diff --git a/applets/weather/package/contents/ui/config/ConfigUnits.qml b/applets/weather/package/contents/ui/config/ConfigUnits.qml index a4df9dee3..b0ac78337 100644 --- a/applets/weather/package/contents/ui/config/ConfigUnits.qml +++ b/applets/weather/package/contents/ui/config/ConfigUnits.qml @@ -1,131 +1,98 @@ /* * Copyright 2016 Friedrich W. H. Kossebau * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -import QtQuick 2.0 -import QtQuick.Controls 2.2 as QtControls -import QtQuick.Layouts 1.3 +import QtQuick 2.5 +import QtQuick.Controls 2.5 as QtControls +import org.kde.kirigami 2.5 as Kirigami import org.kde.plasma.private.weather 1.0 -ColumnLayout { +Kirigami.FormLayout { id: unitsConfigPage signal configurationChanged function saveConfig() { var config = {}; config.temperatureUnitId = TemperatureUnitListModel.unitIdForListIndex(temperatureComboBox.currentIndex); config.pressureUnitId = PressureUnitListModel.unitIdForListIndex(pressureComboBox.currentIndex); config.windSpeedUnitId = WindSpeedUnitListModel.unitIdForListIndex(windSpeedComboBox.currentIndex); config.visibilityUnitId = VisibilityUnitListModel.unitIdForListIndex(visibilityComboBox.currentIndex); plasmoid.nativeInterface.saveConfig(config); plasmoid.nativeInterface.configChanged(); } Component.onCompleted: { var config = plasmoid.nativeInterface.configValues(); temperatureComboBox.currentIndex = TemperatureUnitListModel.listIndexForUnitId(config.temperatureUnitId); pressureComboBox.currentIndex = PressureUnitListModel.listIndexForUnitId(config.pressureUnitId); windSpeedComboBox.currentIndex = WindSpeedUnitListModel.listIndexForUnitId(config.windSpeedUnitId); visibilityComboBox.currentIndex = VisibilityUnitListModel.listIndexForUnitId(config.visibilityUnitId); } + QtControls.ComboBox { + id: temperatureComboBox - GridLayout { - columns: 2 - - QtControls.Label { - Layout.row: 0 - Layout.column: 0 - Layout.alignment: Qt.AlignRight - text: i18nc("@label:listbox", "Temperature:") - } - - QtControls.ComboBox { - id: temperatureComboBox - Layout.row: 0 - Layout.column: 1 - model: TemperatureUnitListModel - textRole: "display" - onCurrentIndexChanged: unitsConfigPage.configurationChanged(); - } - - QtControls.Label { - Layout.row: 1 - Layout.column: 0 - Layout.alignment: Qt.AlignRight - text: i18nc("@label:listbox", "Pressure:") - } - - QtControls.ComboBox { - id: pressureComboBox - Layout.row: 1 - Layout.column: 1 - model: PressureUnitListModel - textRole: "display" - onCurrentIndexChanged: unitsConfigPage.configurationChanged(); - } - - QtControls.Label { - Layout.row: 2 - Layout.column: 0 - Layout.alignment: Qt.AlignRight - text: i18nc("@label:listbox", "Wind speed:") - } - - QtControls.ComboBox { - id: windSpeedComboBox - Layout.row: 2 - Layout.column: 1 - model: WindSpeedUnitListModel - textRole: "display" - onCurrentIndexChanged: unitsConfigPage.configurationChanged(); - } - - QtControls.Label { - Layout.row: 3 - Layout.column: 0 - Layout.alignment: Qt.AlignRight - text: i18nc("@label:listbox", "Visibility:") - } - - QtControls.ComboBox { - id: visibilityComboBox - Layout.row: 3 - Layout.column: 1 - model: VisibilityUnitListModel - textRole: "display" - onCurrentIndexChanged: unitsConfigPage.configurationChanged(); - } + Kirigami.FormData.label: i18nc("@label:listbox", "Temperature:") + + model: TemperatureUnitListModel + textRole: "display" + onCurrentIndexChanged: unitsConfigPage.configurationChanged(); + } + + QtControls.ComboBox { + id: pressureComboBox + + Kirigami.FormData.label: i18nc("@label:listbox", "Pressure:") + + model: PressureUnitListModel + textRole: "display" + onCurrentIndexChanged: unitsConfigPage.configurationChanged(); } - Item { // tighten layout - Layout.fillHeight: true + QtControls.ComboBox { + id: windSpeedComboBox + + Kirigami.FormData.label: i18nc("@label:listbox", "Wind speed:") + + model: WindSpeedUnitListModel + textRole: "display" + onCurrentIndexChanged: unitsConfigPage.configurationChanged(); + } + + QtControls.ComboBox { + id: visibilityComboBox + + Kirigami.FormData.label: i18nc("@label:listbox", "Visibility:") + + model: VisibilityUnitListModel + textRole: "display" + onCurrentIndexChanged: unitsConfigPage.configurationChanged(); } } diff --git a/applets/weather/package/contents/ui/config/ConfigWeatherStation.qml b/applets/weather/package/contents/ui/config/ConfigWeatherStation.qml index daad660e6..598e9d6f4 100644 --- a/applets/weather/package/contents/ui/config/ConfigWeatherStation.qml +++ b/applets/weather/package/contents/ui/config/ConfigWeatherStation.qml @@ -1,127 +1,109 @@ /* * Copyright 2016,2018 Friedrich W. H. Kossebau * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ import QtQuick 2.9 - -import QtQuick.Controls 1.4 as QtControls +import QtQuick.Controls 2.5 as QtControls import QtQuick.Layouts 1.3 -import org.kde.plasma.components 2.0 as PlasmaComponents - +import org.kde.kirigami 2.5 as Kirigami import org.kde.plasma.private.weather 1.0 -ColumnLayout { +Kirigami.FormLayout { id: weatherStationConfigPage property string source signal configurationChanged function saveConfig() { var config = { services: stationPicker.selectedServices, source: source, updateInterval: updateIntervalSpin.value }; plasmoid.nativeInterface.saveConfig(config); plasmoid.nativeInterface.configChanged(); } Component.onCompleted: { var config = plasmoid.nativeInterface.configValues(); stationPicker.selectedServices = config.services; source = config.source; updateIntervalSpin.value = config.updateInterval; } WeatherStationPickerDialog { id: stationPicker onAccepted: { weatherStationConfigPage.source = source; weatherStationConfigPage.configurationChanged(); } } - GridLayout { - columns: 2 - QtControls.Label { - Layout.row: 0 - Layout.column: 0 - Layout.alignment: Qt.AlignRight - text: i18nc("@label", "Location:") - } + RowLayout { + Kirigami.FormData.label: i18nc("@label", "Location:") + Layout.fillWidth: true - RowLayout { - Layout.row: 0 - Layout.column: 1 + QtControls.Label { + id: locationDisplay Layout.fillWidth: true - - QtControls.Label { - id: locationDisplay - Layout.fillWidth: true - elide: Text.ElideRight - - text: { - var sourceDetails = source.split('|'); - if (sourceDetails.length > 2) { - return i18nc("A weather station location and the weather service it comes from", - "%1 (%2)", sourceDetails[2], sourceDetails[0]); - } - return i18nc("no weather station", "-"); + elide: Text.ElideRight + visible: text != "" + + text: { + var sourceDetails = source.split('|'); + if (sourceDetails.length > 2) { + return i18nc("A weather station location and the weather service it comes from", + "%1 (%2)", sourceDetails[2], sourceDetails[0]); } - } - - QtControls.Button { - id: selectButton - iconName: "edit-find" - text: i18nc("@action:button", "Select") - onClicked: stationPicker.visible = true; + return "" } } - - QtControls.Label { - Layout.row: 1 - Layout.column: 0 - Layout.alignment: Qt.AlignRight - text: i18nc("@label:spinbox", "Update every:") - } - QtControls.SpinBox { - id: updateIntervalSpin - Layout.row: 1 - Layout.column: 1 - Layout.minimumWidth: units.gridUnit * 8 - suffix: i18nc("@item:valuesuffix spacing to number + unit (minutes)", " min") - stepSize: 5 - minimumValue: 30 - maximumValue: 3600 - onValueChanged: weatherStationConfigPage.configurationChanged(); + QtControls.Button { + id: selectButton + Layout.fillWidth: true + icon.name: "find-location" + text: i18nc("@action:button", "Choose...") + onClicked: stationPicker.visible = true; } } - Item { // tighten layout - Layout.fillHeight: true + QtControls.SpinBox { + id: updateIntervalSpin + + Kirigami.FormData.label: i18nc("@label:spinbox", "Update every:") + + textFromValue: function(value) { + return (i18np("%1 minute", "%1 minutes", value)); + } + + stepSize: 5 + from: 30 + to: 3600 + + onValueChanged: weatherStationConfigPage.configurationChanged(); } }