Changeset View
Changeset View
Standalone View
Standalone View
wallpapers/image/imagepackage/contents/ui/config.qml
Show All 12 Lines | |||||
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. | ||
14 | * | 14 | * | ||
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. | 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | import QtQuick 2.5 | 20 | import QtQuick 2.5 | ||
21 | import QtQuick.Controls 1.0 as QtControls | | |||
22 | import QtQuick.Controls 2.3 as QtControls2 | 21 | import QtQuick.Controls 2.3 as QtControls2 | ||
23 | import QtQuick.Layouts 1.0 | 22 | import QtQuick.Layouts 1.0 | ||
24 | import QtQuick.Window 2.0 // for Screen | 23 | import QtQuick.Window 2.0 // for Screen | ||
25 | import org.kde.plasma.wallpapers.image 2.0 as Wallpaper | 24 | import org.kde.plasma.wallpapers.image 2.0 as Wallpaper | ||
26 | import org.kde.kquickcontrols 2.0 as KQuickControls | 25 | import org.kde.kquickcontrols 2.0 as KQuickControls | ||
27 | import org.kde.kquickcontrolsaddons 2.0 | 26 | import org.kde.kquickcontrolsaddons 2.0 | ||
28 | import org.kde.kconfig 1.0 // for KAuthorized | 27 | import org.kde.kconfig 1.0 // for KAuthorized | ||
29 | import org.kde.draganddrop 2.0 as DragDrop | 28 | import org.kde.draganddrop 2.0 as DragDrop | ||
30 | import org.kde.kcm 1.1 as KCM | 29 | import org.kde.kcm 1.1 as KCM | ||
31 | import org.kde.kirigami 2.5 as Kirigami | 30 | import org.kde.kirigami 2.5 as Kirigami | ||
32 | 31 | | |||
33 | ColumnLayout { | 32 | ColumnLayout { | ||
34 | id: root | 33 | id: root | ||
35 | property alias cfg_Color: colorButton.color | 34 | property alias cfg_Color: colorButton.color | ||
36 | property string cfg_Image | 35 | property string cfg_Image | ||
37 | property int cfg_FillMode | 36 | property int cfg_FillMode | ||
38 | property alias cfg_Blur: blurRadioButton.checked | 37 | property alias cfg_Blur: blurRadioButton.checked | ||
39 | property var cfg_SlidePaths: "" | 38 | property var cfg_SlidePaths: "" | ||
40 | property int cfg_SlideInterval: 0 | 39 | property int cfg_SlideInterval: 0 | ||
40 | property var cfg_UncheckedSlides: [] | ||||
41 | 41 | | |||
42 | function saveConfig() { | 42 | function saveConfig() { | ||
43 | imageWallpaper.commitDeletion(); | 43 | imageWallpaper.commitDeletion(); | ||
44 | } | 44 | } | ||
45 | 45 | | |||
46 | SystemPalette { | 46 | SystemPalette { | ||
47 | id: syspal | 47 | id: syspal | ||
48 | } | 48 | } | ||
49 | 49 | | |||
50 | Wallpaper.Image { | 50 | Wallpaper.Image { | ||
51 | id: imageWallpaper | 51 | id: imageWallpaper | ||
52 | targetSize: { | 52 | targetSize: { | ||
53 | if (typeof plasmoid !== "undefined") { | 53 | if (typeof plasmoid !== "undefined") { | ||
54 | return Qt.size(plasmoid.width, plasmoid.height) | 54 | return Qt.size(plasmoid.width, plasmoid.height) | ||
55 | } | 55 | } | ||
56 | // Lock screen configuration case | 56 | // Lock screen configuration case | ||
57 | return Qt.size(Screen.width, Screen.height) | 57 | return Qt.size(Screen.width, Screen.height) | ||
58 | } | 58 | } | ||
59 | onSlidePathsChanged: cfg_SlidePaths = slidePaths | 59 | onSlidePathsChanged: cfg_SlidePaths = slidePaths | ||
60 | onUncheckedSlidesChanged: cfg_UncheckedSlides = uncheckedSlides | ||||
60 | } | 61 | } | ||
61 | 62 | | |||
62 | onCfg_SlidePathsChanged: { | 63 | onCfg_SlidePathsChanged: { | ||
63 | imageWallpaper.slidePaths = cfg_SlidePaths | 64 | imageWallpaper.slidePaths = cfg_SlidePaths | ||
64 | } | 65 | } | ||
66 | onCfg_UncheckedSlidesChanged: { | ||||
67 | imageWallpaper.uncheckedSlides = cfg_UncheckedSlides | ||||
68 | } | ||||
65 | 69 | | |||
66 | property int hoursIntervalValue: Math.floor(cfg_SlideInterval / 3600) | 70 | property int hoursIntervalValue: Math.floor(cfg_SlideInterval / 3600) | ||
67 | property int minutesIntervalValue: Math.floor(cfg_SlideInterval % 3600) / 60 | 71 | property int minutesIntervalValue: Math.floor(cfg_SlideInterval % 3600) / 60 | ||
68 | property int secondsIntervalValue: cfg_SlideInterval % 3600 % 60 | 72 | property int secondsIntervalValue: cfg_SlideInterval % 3600 % 60 | ||
69 | 73 | | |||
70 | //Rectangle { color: "orange"; x: formAlignment; width: formAlignment; height: 20 } | 74 | //Rectangle { color: "orange"; x: formAlignment; width: formAlignment; height: 20 } | ||
71 | 75 | | |||
72 | TextMetrics { | 76 | Kirigami.FormLayout { | ||
73 | id: textMetrics | 77 | twinFormLayouts: parentLayout | ||
74 | text: "00" | 78 | QtControls2.ComboBox { | ||
75 | } | | |||
76 | | ||||
77 | Row { | | |||
78 | //x: formAlignment - positionLabel.paintedWidth | | |||
79 | spacing: Kirigami.Units.largeSpacing / 2 | | |||
80 | QtControls2.Label { | | |||
81 | id: positionLabel | | |||
82 | width: formAlignment - Kirigami.Units.largeSpacing | | |||
83 | anchors { | | |||
84 | verticalCenter: resizeComboBox.verticalCenter | | |||
85 | } | | |||
86 | text: i18nd("plasma_wallpaper_org.kde.image", "Positioning:") | | |||
87 | horizontalAlignment: Text.AlignRight | | |||
88 | } | | |||
89 | | ||||
90 | // TODO: port to QQC2 version once we've fixed https://bugs.kde.org/show_bug.cgi?id=403153 | | |||
91 | QtControls.ComboBox { | | |||
92 | id: resizeComboBox | 79 | id: resizeComboBox | ||
93 | TextMetrics { | 80 | Kirigami.FormData.label: i18nd("plasma_wallpaper_org.kde.image", "Positioning:") | ||
94 | id: resizeTextMetrics | | |||
95 | text: resizeComboBox.currentText | | |||
96 | } | | |||
97 | width: resizeTextMetrics.width + Kirigami.Units.smallSpacing * 2 + Kirigami.Units.gridUnit * 2 | | |||
98 | model: [ | 81 | model: [ | ||
99 | { | 82 | { | ||
100 | 'label': i18nd("plasma_wallpaper_org.kde.image", "Scaled and Cropped"), | 83 | 'label': i18nd("plasma_wallpaper_org.kde.image", "Scaled and Cropped"), | ||
101 | 'fillMode': Image.PreserveAspectCrop | 84 | 'fillMode': Image.PreserveAspectCrop | ||
102 | }, | 85 | }, | ||
103 | { | 86 | { | ||
104 | 'label': i18nd("plasma_wallpaper_org.kde.image","Scaled"), | 87 | 'label': i18nd("plasma_wallpaper_org.kde.image","Scaled"), | ||
105 | 'fillMode': Image.Stretch | 88 | 'fillMode': Image.Stretch | ||
Show All 21 Lines | 109 | for (var i = 0; i < model.length; i++) { | |||
127 | if (model[i]["fillMode"] === wallpaper.configuration.FillMode) { | 110 | if (model[i]["fillMode"] === wallpaper.configuration.FillMode) { | ||
128 | resizeComboBox.currentIndex = i; | 111 | resizeComboBox.currentIndex = i; | ||
129 | var tl = model[i]["label"].length; | 112 | var tl = model[i]["label"].length; | ||
130 | //resizeComboBox.textLength = Math.max(resizeComboBox.textLength, tl+5); | 113 | //resizeComboBox.textLength = Math.max(resizeComboBox.textLength, tl+5); | ||
131 | } | 114 | } | ||
132 | } | 115 | } | ||
133 | } | 116 | } | ||
134 | } | 117 | } | ||
135 | } | | |||
136 | 118 | | |||
137 | QtControls2.ButtonGroup { id: backgroundGroup } | 119 | QtControls2.ButtonGroup { id: backgroundGroup } | ||
138 | 120 | | |||
139 | Row { | | |||
140 | id: blurRow | | |||
141 | spacing: Kirigami.Units.largeSpacing / 2 | | |||
142 | visible: cfg_FillMode === Image.PreserveAspectFit || cfg_FillMode === Image.Pad | | |||
143 | QtControls2.Label { | | |||
144 | id: blurLabel | | |||
145 | width: formAlignment - Kirigami.Units.largeSpacing | | |||
146 | anchors.verticalCenter: blurRadioButton.verticalCenter | | |||
147 | horizontalAlignment: Text.AlignRight | | |||
148 | text: i18nd("plasma_wallpaper_org.kde.image", "Background:") | | |||
149 | } | | |||
150 | QtControls2.RadioButton { | 121 | QtControls2.RadioButton { | ||
151 | id: blurRadioButton | 122 | id: blurRadioButton | ||
123 | visible: cfg_FillMode === Image.PreserveAspectFit || cfg_FillMode === Image.Pad | ||||
124 | Kirigami.FormData.label: i18nd("plasma_wallpaper_org.kde.image", "Background:") | ||||
152 | text: i18nd("plasma_wallpaper_org.kde.image", "Blur") | 125 | text: i18nd("plasma_wallpaper_org.kde.image", "Blur") | ||
153 | QtControls2.ButtonGroup.group: backgroundGroup | 126 | QtControls2.ButtonGroup.group: backgroundGroup | ||
154 | } | 127 | } | ||
155 | } | | |||
156 | 128 | | |||
157 | Row { | 129 | RowLayout { | ||
158 | id: colorRow | 130 | id: colorRow | ||
159 | visible: cfg_FillMode === Image.PreserveAspectFit || cfg_FillMode === Image.Pad | 131 | visible: cfg_FillMode === Image.PreserveAspectFit || cfg_FillMode === Image.Pad | ||
160 | spacing: Kirigami.Units.largeSpacing / 2 | | |||
161 | QtControls2.Label { | | |||
162 | width: formAlignment - Kirigami.Units.largeSpacing | | |||
163 | } | | |||
164 | QtControls2.RadioButton { | 132 | QtControls2.RadioButton { | ||
165 | id: colorRadioButton | 133 | id: colorRadioButton | ||
166 | text: i18nd("plasma_wallpaper_org.kde.image", "Solid color") | 134 | text: i18nd("plasma_wallpaper_org.kde.image", "Solid color") | ||
167 | QtControls2.ButtonGroup.group: backgroundGroup | | |||
168 | checked: !cfg_Blur | 135 | checked: !cfg_Blur | ||
136 | QtControls2.ButtonGroup.group: backgroundGroup | ||||
169 | } | 137 | } | ||
170 | KQuickControls.ColorButton { | 138 | KQuickControls.ColorButton { | ||
171 | id: colorButton | 139 | id: colorButton | ||
172 | dialogTitle: i18nd("plasma_wallpaper_org.kde.image", "Select Background Color") | 140 | dialogTitle: i18nd("plasma_wallpaper_org.kde.image", "Select Background Color") | ||
173 | } | 141 | } | ||
174 | } | 142 | } | ||
143 | } | ||||
175 | 144 | | |||
176 | Component { | 145 | Component { | ||
177 | id: foldersComponent | 146 | id: foldersComponent | ||
178 | ColumnLayout { | 147 | ColumnLayout { | ||
179 | anchors.fill: parent | | |||
180 | Connections { | 148 | Connections { | ||
181 | target: root | 149 | target: root | ||
182 | onHoursIntervalValueChanged: hoursInterval.value = root.hoursIntervalValue | 150 | onHoursIntervalValueChanged: hoursInterval.value = root.hoursIntervalValue | ||
183 | onMinutesIntervalValueChanged: minutesInterval.value = root.minutesIntervalValue | 151 | onMinutesIntervalValueChanged: minutesInterval.value = root.minutesIntervalValue | ||
184 | onSecondsIntervalValueChanged: secondsInterval.value = root.secondsIntervalValue | 152 | onSecondsIntervalValueChanged: secondsInterval.value = root.secondsIntervalValue | ||
185 | } | 153 | } | ||
186 | //FIXME: there should be only one spinbox: QtControls spinboxes are still too limited for it tough | 154 | //FIXME: there should be only one spinbox: QtControls spinboxes are still too limited for it tough | ||
155 | Kirigami.FormLayout { | ||||
156 | twinFormLayouts: parentLayout | ||||
187 | RowLayout { | 157 | RowLayout { | ||
188 | Layout.fillWidth: true | 158 | Kirigami.FormData.label: i18nd("plasma_wallpaper_org.kde.image","Change every:") | ||
189 | spacing: Kirigami.Units.largeSpacing / 2 | | |||
190 | QtControls2.Label { | | |||
191 | Layout.minimumWidth: formAlignment - Kirigami.Units.largeSpacing | | |||
192 | horizontalAlignment: Text.AlignRight | | |||
193 | text: i18nd("plasma_wallpaper_org.kde.image","Change every:") | | |||
194 | } | | |||
195 | QtControls2.SpinBox { | 159 | QtControls2.SpinBox { | ||
196 | id: hoursInterval | 160 | id: hoursInterval | ||
197 | Layout.minimumWidth: textMetrics.width + Kirigami.Units.gridUnit | | |||
198 | width: Kirigami.Units.gridUnit * 3 | | |||
199 | value: root.hoursIntervalValue | 161 | value: root.hoursIntervalValue | ||
200 | from: 0 | 162 | from: 0 | ||
201 | to: 24 | 163 | to: 24 | ||
202 | editable: true | 164 | editable: true | ||
203 | onValueChanged: cfg_SlideInterval = hoursInterval.value * 3600 + minutesInterval.value * 60 + secondsInterval.value | 165 | onValueChanged: cfg_SlideInterval = hoursInterval.value * 3600 + minutesInterval.value * 60 + secondsInterval.value | ||
204 | } | 166 | } | ||
205 | QtControls2.Label { | 167 | QtControls2.Label { | ||
206 | text: i18nd("plasma_wallpaper_org.kde.image","Hours") | 168 | text: i18nd("plasma_wallpaper_org.kde.image","Hours") | ||
207 | } | 169 | } | ||
208 | Item { | | |||
209 | Layout.preferredWidth: Kirigami.Units.gridUnit | | |||
210 | } | | |||
211 | QtControls2.SpinBox { | 170 | QtControls2.SpinBox { | ||
212 | id: minutesInterval | 171 | id: minutesInterval | ||
213 | Layout.minimumWidth: textMetrics.width + Kirigami.Units.gridUnit | | |||
214 | width: Kirigami.Units.gridUnit * 3 | | |||
215 | value: root.minutesIntervalValue | 172 | value: root.minutesIntervalValue | ||
216 | from: 0 | 173 | from: 0 | ||
217 | to: 60 | 174 | to: 60 | ||
218 | editable: true | 175 | editable: true | ||
219 | onValueChanged: cfg_SlideInterval = hoursInterval.value * 3600 + minutesInterval.value * 60 + secondsInterval.value | 176 | onValueChanged: cfg_SlideInterval = hoursInterval.value * 3600 + minutesInterval.value * 60 + secondsInterval.value | ||
220 | } | 177 | } | ||
221 | QtControls2.Label { | 178 | QtControls2.Label { | ||
222 | text: i18nd("plasma_wallpaper_org.kde.image","Minutes") | 179 | text: i18nd("plasma_wallpaper_org.kde.image","Minutes") | ||
223 | } | 180 | } | ||
224 | Item { | | |||
225 | Layout.preferredWidth: Kirigami.Units.gridUnit | | |||
226 | } | | |||
227 | QtControls2.SpinBox { | 181 | QtControls2.SpinBox { | ||
228 | id: secondsInterval | 182 | id: secondsInterval | ||
229 | Layout.minimumWidth: textMetrics.width + Kirigami.Units.gridUnit | | |||
230 | width: Kirigami.Units.gridUnit * 3 | | |||
231 | value: root.secondsIntervalValue | 183 | value: root.secondsIntervalValue | ||
232 | from: root.hoursIntervalValue === 0 && root.minutesIntervalValue === 0 ? 1 : 0 | 184 | from: root.hoursIntervalValue === 0 && root.minutesIntervalValue === 0 ? 1 : 0 | ||
233 | to: 60 | 185 | to: 60 | ||
234 | editable: true | 186 | editable: true | ||
235 | onValueChanged: cfg_SlideInterval = hoursInterval.value * 3600 + minutesInterval.value * 60 + secondsInterval.value | 187 | onValueChanged: cfg_SlideInterval = hoursInterval.value * 3600 + minutesInterval.value * 60 + secondsInterval.value | ||
236 | } | 188 | } | ||
237 | QtControls2.Label { | 189 | QtControls2.Label { | ||
238 | text: i18nd("plasma_wallpaper_org.kde.image","Seconds") | 190 | text: i18nd("plasma_wallpaper_org.kde.image","Seconds") | ||
239 | } | 191 | } | ||
240 | } | 192 | } | ||
193 | } | ||||
241 | Kirigami.Heading { | 194 | Kirigami.Heading { | ||
242 | text: "Folders" | 195 | text: i18nd("plasma_wallpaper_org.kde.image","Folders") | ||
243 | level: 2 | 196 | level: 2 | ||
244 | } | 197 | } | ||
245 | GridLayout { | 198 | GridLayout { | ||
246 | columns: 2 | 199 | columns: 2 | ||
247 | Layout.fillWidth: true | 200 | Layout.fillWidth: true | ||
248 | Layout.fillHeight: true | 201 | Layout.fillHeight: true | ||
249 | columnSpacing: Kirigami.Units.largeSpacing | 202 | columnSpacing: Kirigami.Units.largeSpacing | ||
250 | QtControls2.ScrollView { | 203 | QtControls2.ScrollView { | ||
▲ Show 20 Lines • Show All 121 Lines • Show Last 20 Lines |