Changeset View
Changeset View
Standalone View
Standalone View
src/plasma/wallpapers/earthglobe/contents/ui/config.qml
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright 2018 Friedrich W. H. Kossebau <kossebau@kde.org> | ||||
3 | * | ||||
4 | * This program is free software; you can redistribute it and/or | ||||
5 | * modify it under the terms of the GNU Lesser General Public | ||||
6 | * License as published by the Free Software Foundation; either | ||||
7 | * version 2.1 of the License, or (at your option) any later version. | ||||
8 | * | ||||
9 | * This program is distributed in the hope that it will be useful, | ||||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
12 | * Lesser General Public License for more details. | ||||
13 | * | ||||
14 | * You should have received a copy of the GNU Lesser General Public | ||||
15 | * License along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||
16 | */ | ||||
17 | | ||||
18 | import QtQuick 2.1 | ||||
19 | import QtQuick.Layouts 1.0 | ||||
20 | import QtQuick.Controls 1.0 as QtControls | ||||
21 | | ||||
22 | // for "units" | ||||
23 | import org.kde.plasma.core 2.0 as PlasmaCore | ||||
24 | | ||||
25 | | ||||
26 | ColumnLayout { | ||||
27 | id: root | ||||
28 | | ||||
29 | property int cfg_centerMode: wallpaper.configuration.centerMode // Enum needs manual set/get for now | ||||
30 | property alias cfg_fixedLongitude: longitudeSpinBox.value | ||||
31 | property alias cfg_fixedLatitude: latitudeSpinBox.value | ||||
32 | | ||||
33 | // To allow aligned integration in the settings form, | ||||
34 | // "formAlignment" is a property injected by the config containment | ||||
35 | // which defines the offset of the value fields | ||||
36 | readonly property int labelWidth: formAlignment - units.largeSpacing | ||||
37 | | ||||
38 | RowLayout { | ||||
39 | spacing: units.largeSpacing / 2 | ||||
40 | | ||||
41 | QtControls.Label { | ||||
42 | Layout.minimumWidth: labelWidth | ||||
43 | Layout.maximumWidth: labelWidth | ||||
44 | horizontalAlignment: Text.AlignRight | ||||
45 | anchors { | ||||
46 | verticalCenter: centerModeComboBox.verticalCenter | ||||
47 | } | ||||
48 | text: i18nd("plasma_wallpaper_org.kde.plasma.earthglobe", "Center on:") | ||||
49 | } | ||||
50 | | ||||
51 | QtControls.ComboBox { | ||||
52 | id: centerModeComboBox | ||||
53 | model: [ | ||||
54 | i18nd("plasma_wallpaper_org.kde.plasma.earthglobe", "Daylight"), | ||||
55 | i18nd("plasma_wallpaper_org.kde.plasma.earthglobe", "Longitude/Latitude"), | ||||
56 | i18nd("plasma_wallpaper_org.kde.plasma.earthglobe", "Location") | ||||
57 | ] | ||||
58 | onCurrentIndexChanged: { | ||||
59 | cfg_centerMode = currentIndex; | ||||
60 | } | ||||
61 | Component.onCompleted: { | ||||
62 | currentIndex = wallpaper.configuration.centerMode; | ||||
63 | } | ||||
64 | } | ||||
65 | | ||||
66 | } | ||||
67 | RowLayout { | ||||
68 | spacing: units.largeSpacing / 2 | ||||
69 | | ||||
70 | QtControls.Label { | ||||
71 | Layout.minimumWidth: labelWidth | ||||
72 | Layout.maximumWidth: labelWidth | ||||
73 | horizontalAlignment: Text.AlignRight | ||||
74 | anchors { | ||||
75 | verticalCenter: longitudeSpinBox.verticalCenter | ||||
76 | } | ||||
77 | enabled: (cfg_centerMode === 1) | ||||
78 | text: i18nd("plasma_wallpaper_org.kde.plasma.earthglobe", "Longitude:") | ||||
79 | } | ||||
80 | | ||||
81 | QtControls.SpinBox { | ||||
82 | enabled: (cfg_centerMode === 1) | ||||
83 | id: longitudeSpinBox | ||||
84 | maximumValue: 180.0 | ||||
85 | minimumValue: -180.0 | ||||
86 | decimals: 5 | ||||
87 | } | ||||
88 | } | ||||
89 | RowLayout { | ||||
90 | spacing: units.largeSpacing / 2 | ||||
91 | | ||||
92 | QtControls.Label { | ||||
93 | Layout.minimumWidth: labelWidth | ||||
94 | Layout.maximumWidth: labelWidth | ||||
95 | horizontalAlignment: Text.AlignRight | ||||
96 | anchors { | ||||
97 | verticalCenter: latitudeSpinBox.verticalCenter | ||||
98 | } | ||||
99 | enabled: (cfg_centerMode === 1) | ||||
100 | text: i18nd("plasma_wallpaper_org.kde.plasma.earthglobe", "Latitude:") | ||||
101 | } | ||||
102 | | ||||
103 | QtControls.SpinBox { | ||||
104 | enabled: (cfg_centerMode === 1) | ||||
105 | id: latitudeSpinBox | ||||
106 | maximumValue: 90.0 | ||||
107 | minimumValue: -90.0 | ||||
108 | decimals: 5 | ||||
109 | } | ||||
110 | } | ||||
111 | | ||||
112 | Item { // tighten layout | ||||
113 | Layout.fillHeight: true | ||||
114 | } | ||||
115 | } |