diff --git a/applets/weather/package/contents/ui/config/ConfigAppearance.qml b/applets/weather/package/contents/ui/config/ConfigAppearance.qml --- a/applets/weather/package/contents/ui/config/ConfigAppearance.qml +++ b/applets/weather/package/contents/ui/config/ConfigAppearance.qml @@ -15,15 +15,14 @@ * 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 @@ -56,84 +55,58 @@ } - 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 --- a/applets/weather/package/contents/ui/config/ConfigUnits.qml +++ b/applets/weather/package/contents/ui/config/ConfigUnits.qml @@ -15,14 +15,14 @@ * 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 @@ -56,76 +56,43 @@ 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 --- a/applets/weather/package/contents/ui/config/ConfigWeatherStation.qml +++ b/applets/weather/package/contents/ui/config/ConfigWeatherStation.qml @@ -16,16 +16,14 @@ */ 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 @@ -63,65 +61,49 @@ } } - 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(); } }