Changeset View
Changeset View
Standalone View
Standalone View
applets/weather/package/contents/ui/config/ConfigUnits.qml
Show All 9 Lines | |||||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | 12 | * GNU General Public License for more details. | ||
13 | * | 13 | * | ||
14 | * You should have received a copy of the GNU General Public License | 14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | 16 | */ | ||
17 | 17 | | |||
18 | import QtQuick 2.0 | 18 | import QtQuick 2.5 | ||
19 | import QtQuick.Controls 2.2 as QtControls | 19 | import QtQuick.Controls 2.5 as QtControls | ||
20 | import QtQuick.Layouts 1.3 | | |||
21 | 20 | | |||
21 | import org.kde.kirigami 2.5 as Kirigami | ||||
22 | import org.kde.plasma.private.weather 1.0 | 22 | import org.kde.plasma.private.weather 1.0 | ||
23 | 23 | | |||
24 | 24 | | |||
25 | ColumnLayout { | 25 | Kirigami.FormLayout { | ||
26 | id: unitsConfigPage | 26 | id: unitsConfigPage | ||
27 | 27 | | |||
28 | signal configurationChanged | 28 | signal configurationChanged | ||
29 | 29 | | |||
30 | function saveConfig() { | 30 | function saveConfig() { | ||
31 | var config = {}; | 31 | var config = {}; | ||
32 | 32 | | |||
33 | config.temperatureUnitId = | 33 | config.temperatureUnitId = | ||
Show All 17 Lines | 46 | Component.onCompleted: { | |||
51 | pressureComboBox.currentIndex = | 51 | pressureComboBox.currentIndex = | ||
52 | PressureUnitListModel.listIndexForUnitId(config.pressureUnitId); | 52 | PressureUnitListModel.listIndexForUnitId(config.pressureUnitId); | ||
53 | windSpeedComboBox.currentIndex = | 53 | windSpeedComboBox.currentIndex = | ||
54 | WindSpeedUnitListModel.listIndexForUnitId(config.windSpeedUnitId); | 54 | WindSpeedUnitListModel.listIndexForUnitId(config.windSpeedUnitId); | ||
55 | visibilityComboBox.currentIndex = | 55 | visibilityComboBox.currentIndex = | ||
56 | VisibilityUnitListModel.listIndexForUnitId(config.visibilityUnitId); | 56 | VisibilityUnitListModel.listIndexForUnitId(config.visibilityUnitId); | ||
57 | } | 57 | } | ||
58 | 58 | | |||
59 | | ||||
60 | GridLayout { | | |||
61 | columns: 2 | | |||
62 | | ||||
63 | QtControls.Label { | | |||
64 | Layout.row: 0 | | |||
65 | Layout.column: 0 | | |||
66 | Layout.alignment: Qt.AlignRight | | |||
67 | text: i18nc("@label:listbox", "Temperature:") | | |||
68 | } | | |||
69 | | ||||
70 | QtControls.ComboBox { | 59 | QtControls.ComboBox { | ||
71 | id: temperatureComboBox | 60 | id: temperatureComboBox | ||
72 | Layout.row: 0 | 61 | | ||
73 | Layout.column: 1 | 62 | Kirigami.FormData.label: i18nc("@label:listbox", "Temperature:") | ||
63 | | ||||
74 | model: TemperatureUnitListModel | 64 | model: TemperatureUnitListModel | ||
75 | textRole: "display" | 65 | textRole: "display" | ||
76 | onCurrentIndexChanged: unitsConfigPage.configurationChanged(); | 66 | onCurrentIndexChanged: unitsConfigPage.configurationChanged(); | ||
77 | } | 67 | } | ||
78 | 68 | | |||
79 | QtControls.Label { | | |||
80 | Layout.row: 1 | | |||
81 | Layout.column: 0 | | |||
82 | Layout.alignment: Qt.AlignRight | | |||
83 | text: i18nc("@label:listbox", "Pressure:") | | |||
84 | } | | |||
85 | | ||||
86 | QtControls.ComboBox { | 69 | QtControls.ComboBox { | ||
87 | id: pressureComboBox | 70 | id: pressureComboBox | ||
88 | Layout.row: 1 | 71 | | ||
89 | Layout.column: 1 | 72 | Kirigami.FormData.label: i18nc("@label:listbox", "Pressure:") | ||
73 | | ||||
90 | model: PressureUnitListModel | 74 | model: PressureUnitListModel | ||
91 | textRole: "display" | 75 | textRole: "display" | ||
92 | onCurrentIndexChanged: unitsConfigPage.configurationChanged(); | 76 | onCurrentIndexChanged: unitsConfigPage.configurationChanged(); | ||
93 | } | 77 | } | ||
94 | 78 | | |||
95 | QtControls.Label { | | |||
96 | Layout.row: 2 | | |||
97 | Layout.column: 0 | | |||
98 | Layout.alignment: Qt.AlignRight | | |||
99 | text: i18nc("@label:listbox", "Wind speed:") | | |||
100 | } | | |||
101 | | ||||
102 | QtControls.ComboBox { | 79 | QtControls.ComboBox { | ||
103 | id: windSpeedComboBox | 80 | id: windSpeedComboBox | ||
104 | Layout.row: 2 | 81 | | ||
105 | Layout.column: 1 | 82 | Kirigami.FormData.label: i18nc("@label:listbox", "Wind speed:") | ||
83 | | ||||
106 | model: WindSpeedUnitListModel | 84 | model: WindSpeedUnitListModel | ||
107 | textRole: "display" | 85 | textRole: "display" | ||
108 | onCurrentIndexChanged: unitsConfigPage.configurationChanged(); | 86 | onCurrentIndexChanged: unitsConfigPage.configurationChanged(); | ||
109 | } | 87 | } | ||
110 | 88 | | |||
111 | QtControls.Label { | | |||
112 | Layout.row: 3 | | |||
113 | Layout.column: 0 | | |||
114 | Layout.alignment: Qt.AlignRight | | |||
115 | text: i18nc("@label:listbox", "Visibility:") | | |||
116 | } | | |||
117 | | ||||
118 | QtControls.ComboBox { | 89 | QtControls.ComboBox { | ||
filipf: It was the same before the patch, but how come there's no preselected value for this option? | |||||
filipf: Ignore this, but I can add I'm hitting this bug in 5.15 as well. | |||||
kossebau: Which version of KDE Frameworks? | |||||
filipf: 5.56 | |||||
119 | id: visibilityComboBox | 90 | id: visibilityComboBox | ||
120 | Layout.row: 3 | 91 | | ||
121 | Layout.column: 1 | 92 | Kirigami.FormData.label: i18nc("@label:listbox", "Visibility:") | ||
93 | | ||||
122 | model: VisibilityUnitListModel | 94 | model: VisibilityUnitListModel | ||
123 | textRole: "display" | 95 | textRole: "display" | ||
124 | onCurrentIndexChanged: unitsConfigPage.configurationChanged(); | 96 | onCurrentIndexChanged: unitsConfigPage.configurationChanged(); | ||
125 | } | 97 | } | ||
126 | } | 98 | } | ||
127 | | ||||
128 | Item { // tighten layout | | |||
129 | Layout.fillHeight: true | | |||
130 | } | | |||
131 | } | |
It was the same before the patch, but how come there's no preselected value for this option?