Commit 007a86a6 authored by Nate Graham's avatar Nate Graham 🔩

[Weather] Port settings window to QQC2+Kirigami FormLayout and modernize UI

Summary:
- Port to QQC2+Kirigami FormLayout style
- Adjust some strings to sound a bit more natural
- Hide "Compact Mode" header since all the settings currently apply to compact mode; it only makes sense to display this when there's an additional mode to contrast with it

Test Plan:
Weather station page, before selecting a station: {F6800371}
Weather station page, after selecting a station: {F6800190}
Appearance page: {F6800372}
Units page: {F6800193}

The blank {nav Visibility} combobox is a pre-existing bug not introduced (or fixed)
with this patch.

Reviewers: #vdg, #plasma, kossebau, filipf

Reviewed By: #vdg, filipf

Subscribers: filipf, plasma-devel

Tags: #plasma

Maniphest Tasks: T10586

Differential Revision: https://phabricator.kde.org/D20896
parent ad66b200
......@@ -15,15 +15,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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 @@ ColumnLayout {
}
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();
}
}
......@@ -15,14 +15,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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 @@ ColumnLayout {
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();
}
}
......@@ -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 @@ ColumnLayout {
}
}
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();
}
}
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