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 | ||
Show All 39 Lines | 32 | ColumnLayout { | |||
69 | } | 68 | } | ||
70 | 69 | | |||
71 | property int hoursIntervalValue: Math.floor(cfg_SlideInterval / 3600) | 70 | property int hoursIntervalValue: Math.floor(cfg_SlideInterval / 3600) | ||
72 | property int minutesIntervalValue: Math.floor(cfg_SlideInterval % 3600) / 60 | 71 | property int minutesIntervalValue: Math.floor(cfg_SlideInterval % 3600) / 60 | ||
73 | property int secondsIntervalValue: cfg_SlideInterval % 3600 % 60 | 72 | property int secondsIntervalValue: cfg_SlideInterval % 3600 % 60 | ||
74 | 73 | | |||
75 | //Rectangle { color: "orange"; x: formAlignment; width: formAlignment; height: 20 } | 74 | //Rectangle { color: "orange"; x: formAlignment; width: formAlignment; height: 20 } | ||
76 | 75 | | |||
77 | TextMetrics { | 76 | Kirigami.FormLayout { | ||
78 | id: textMetrics | 77 | twinFormLayouts: parentLayout | ||
79 | text: "00" | 78 | QtControls2.ComboBox { | ||
80 | } | | |||
81 | | ||||
82 | Row { | | |||
83 | //x: formAlignment - positionLabel.paintedWidth | | |||
84 | spacing: Kirigami.Units.largeSpacing / 2 | | |||
85 | QtControls2.Label { | | |||
86 | id: positionLabel | | |||
87 | width: formAlignment - Kirigami.Units.largeSpacing | | |||
88 | anchors { | | |||
89 | verticalCenter: resizeComboBox.verticalCenter | | |||
90 | } | | |||
91 | text: i18nd("plasma_wallpaper_org.kde.image", "Positioning:") | | |||
92 | horizontalAlignment: Text.AlignRight | | |||
93 | } | | |||
94 | | ||||
95 | // TODO: port to QQC2 version once we've fixed https://bugs.kde.org/show_bug.cgi?id=403153 | | |||
96 | QtControls.ComboBox { | | |||
97 | id: resizeComboBox | 79 | id: resizeComboBox | ||
98 | TextMetrics { | 80 | Kirigami.FormData.label: i18nd("plasma_wallpaper_org.kde.image", "Positioning:") | ||
99 | id: resizeTextMetrics | | |||
100 | text: resizeComboBox.currentText | | |||
101 | } | | |||
102 | width: resizeTextMetrics.width + Kirigami.Units.smallSpacing * 2 + Kirigami.Units.gridUnit * 2 | | |||
103 | model: [ | 81 | model: [ | ||
104 | { | 82 | { | ||
105 | 'label': i18nd("plasma_wallpaper_org.kde.image", "Scaled and Cropped"), | 83 | 'label': i18nd("plasma_wallpaper_org.kde.image", "Scaled and Cropped"), | ||
106 | 'fillMode': Image.PreserveAspectCrop | 84 | 'fillMode': Image.PreserveAspectCrop | ||
107 | }, | 85 | }, | ||
108 | { | 86 | { | ||
109 | 'label': i18nd("plasma_wallpaper_org.kde.image","Scaled"), | 87 | 'label': i18nd("plasma_wallpaper_org.kde.image","Scaled"), | ||
110 | 'fillMode': Image.Stretch | 88 | 'fillMode': Image.Stretch | ||
Show All 21 Lines | 109 | for (var i = 0; i < model.length; i++) { | |||
132 | if (model[i]["fillMode"] === wallpaper.configuration.FillMode) { | 110 | if (model[i]["fillMode"] === wallpaper.configuration.FillMode) { | ||
133 | resizeComboBox.currentIndex = i; | 111 | resizeComboBox.currentIndex = i; | ||
134 | var tl = model[i]["label"].length; | 112 | var tl = model[i]["label"].length; | ||
135 | //resizeComboBox.textLength = Math.max(resizeComboBox.textLength, tl+5); | 113 | //resizeComboBox.textLength = Math.max(resizeComboBox.textLength, tl+5); | ||
136 | } | 114 | } | ||
137 | } | 115 | } | ||
138 | } | 116 | } | ||
139 | } | 117 | } | ||
140 | } | | |||
141 | 118 | | |||
142 | QtControls2.ButtonGroup { id: backgroundGroup } | 119 | QtControls2.ButtonGroup { id: backgroundGroup } | ||
143 | 120 | | |||
144 | Row { | | |||
145 | id: blurRow | | |||
146 | spacing: Kirigami.Units.largeSpacing / 2 | | |||
147 | visible: cfg_FillMode === Image.PreserveAspectFit || cfg_FillMode === Image.Pad | | |||
148 | QtControls2.Label { | | |||
149 | id: blurLabel | | |||
150 | width: formAlignment - Kirigami.Units.largeSpacing | | |||
151 | anchors.verticalCenter: blurRadioButton.verticalCenter | | |||
152 | horizontalAlignment: Text.AlignRight | | |||
153 | text: i18nd("plasma_wallpaper_org.kde.image", "Background:") | | |||
154 | } | | |||
155 | QtControls2.RadioButton { | 121 | QtControls2.RadioButton { | ||
156 | 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:") | ||||
157 | text: i18nd("plasma_wallpaper_org.kde.image", "Blur") | 125 | text: i18nd("plasma_wallpaper_org.kde.image", "Blur") | ||
158 | QtControls2.ButtonGroup.group: backgroundGroup | 126 | QtControls2.ButtonGroup.group: backgroundGroup | ||
159 | } | 127 | } | ||
160 | } | | |||
161 | 128 | | |||
162 | Row { | 129 | RowLayout { | ||
163 | id: colorRow | 130 | id: colorRow | ||
164 | visible: cfg_FillMode === Image.PreserveAspectFit || cfg_FillMode === Image.Pad | 131 | visible: cfg_FillMode === Image.PreserveAspectFit || cfg_FillMode === Image.Pad | ||
165 | spacing: Kirigami.Units.largeSpacing / 2 | | |||
166 | QtControls2.Label { | | |||
167 | width: formAlignment - Kirigami.Units.largeSpacing | | |||
168 | } | | |||
169 | QtControls2.RadioButton { | 132 | QtControls2.RadioButton { | ||
170 | id: colorRadioButton | 133 | id: colorRadioButton | ||
171 | text: i18nd("plasma_wallpaper_org.kde.image", "Solid color") | 134 | text: i18nd("plasma_wallpaper_org.kde.image", "Solid color") | ||
172 | QtControls2.ButtonGroup.group: backgroundGroup | | |||
173 | checked: !cfg_Blur | 135 | checked: !cfg_Blur | ||
136 | QtControls2.ButtonGroup.group: backgroundGroup | ||||
174 | } | 137 | } | ||
175 | KQuickControls.ColorButton { | 138 | KQuickControls.ColorButton { | ||
176 | id: colorButton | 139 | id: colorButton | ||
177 | dialogTitle: i18nd("plasma_wallpaper_org.kde.image", "Select Background Color") | 140 | dialogTitle: i18nd("plasma_wallpaper_org.kde.image", "Select Background Color") | ||
178 | } | 141 | } | ||
179 | } | 142 | } | ||
143 | } | ||||
180 | 144 | | |||
181 | Component { | 145 | Component { | ||
182 | id: foldersComponent | 146 | id: foldersComponent | ||
183 | ColumnLayout { | 147 | ColumnLayout { | ||
184 | anchors.fill: parent | | |||
185 | Connections { | 148 | Connections { | ||
186 | target: root | 149 | target: root | ||
187 | onHoursIntervalValueChanged: hoursInterval.value = root.hoursIntervalValue | 150 | onHoursIntervalValueChanged: hoursInterval.value = root.hoursIntervalValue | ||
188 | onMinutesIntervalValueChanged: minutesInterval.value = root.minutesIntervalValue | 151 | onMinutesIntervalValueChanged: minutesInterval.value = root.minutesIntervalValue | ||
189 | onSecondsIntervalValueChanged: secondsInterval.value = root.secondsIntervalValue | 152 | onSecondsIntervalValueChanged: secondsInterval.value = root.secondsIntervalValue | ||
190 | } | 153 | } | ||
191 | //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 | ||||
192 | RowLayout { | 157 | RowLayout { | ||
193 | Layout.fillWidth: true | 158 | Kirigami.FormData.label: i18nd("plasma_wallpaper_org.kde.image","Change every:") | ||
194 | spacing: Kirigami.Units.largeSpacing / 2 | | |||
195 | QtControls2.Label { | | |||
196 | Layout.minimumWidth: formAlignment - Kirigami.Units.largeSpacing | | |||
197 | horizontalAlignment: Text.AlignRight | | |||
198 | text: i18nd("plasma_wallpaper_org.kde.image","Change every:") | | |||
199 | } | | |||
200 | QtControls2.SpinBox { | 159 | QtControls2.SpinBox { | ||
201 | id: hoursInterval | 160 | id: hoursInterval | ||
202 | Layout.minimumWidth: textMetrics.width + Kirigami.Units.gridUnit | | |||
203 | width: Kirigami.Units.gridUnit * 3 | | |||
204 | value: root.hoursIntervalValue | 161 | value: root.hoursIntervalValue | ||
205 | from: 0 | 162 | from: 0 | ||
206 | to: 24 | 163 | to: 24 | ||
207 | editable: true | 164 | editable: true | ||
208 | onValueChanged: cfg_SlideInterval = hoursInterval.value * 3600 + minutesInterval.value * 60 + secondsInterval.value | 165 | onValueChanged: cfg_SlideInterval = hoursInterval.value * 3600 + minutesInterval.value * 60 + secondsInterval.value | ||
209 | } | 166 | } | ||
210 | QtControls2.Label { | 167 | QtControls2.Label { | ||
211 | text: i18nd("plasma_wallpaper_org.kde.image","Hours") | 168 | text: i18nd("plasma_wallpaper_org.kde.image","Hours") | ||
212 | } | 169 | } | ||
213 | Item { | | |||
214 | Layout.preferredWidth: Kirigami.Units.gridUnit | | |||
215 | } | | |||
216 | QtControls2.SpinBox { | 170 | QtControls2.SpinBox { | ||
217 | id: minutesInterval | 171 | id: minutesInterval | ||
218 | Layout.minimumWidth: textMetrics.width + Kirigami.Units.gridUnit | | |||
219 | width: Kirigami.Units.gridUnit * 3 | | |||
220 | value: root.minutesIntervalValue | 172 | value: root.minutesIntervalValue | ||
221 | from: 0 | 173 | from: 0 | ||
222 | to: 60 | 174 | to: 60 | ||
223 | editable: true | 175 | editable: true | ||
224 | onValueChanged: cfg_SlideInterval = hoursInterval.value * 3600 + minutesInterval.value * 60 + secondsInterval.value | 176 | onValueChanged: cfg_SlideInterval = hoursInterval.value * 3600 + minutesInterval.value * 60 + secondsInterval.value | ||
225 | } | 177 | } | ||
226 | QtControls2.Label { | 178 | QtControls2.Label { | ||
227 | text: i18nd("plasma_wallpaper_org.kde.image","Minutes") | 179 | text: i18nd("plasma_wallpaper_org.kde.image","Minutes") | ||
228 | } | 180 | } | ||
229 | Item { | | |||
230 | Layout.preferredWidth: Kirigami.Units.gridUnit | | |||
231 | } | | |||
232 | QtControls2.SpinBox { | 181 | QtControls2.SpinBox { | ||
233 | id: secondsInterval | 182 | id: secondsInterval | ||
234 | Layout.minimumWidth: textMetrics.width + Kirigami.Units.gridUnit | | |||
235 | width: Kirigami.Units.gridUnit * 3 | | |||
236 | value: root.secondsIntervalValue | 183 | value: root.secondsIntervalValue | ||
237 | from: root.hoursIntervalValue === 0 && root.minutesIntervalValue === 0 ? 1 : 0 | 184 | from: root.hoursIntervalValue === 0 && root.minutesIntervalValue === 0 ? 1 : 0 | ||
238 | to: 60 | 185 | to: 60 | ||
239 | editable: true | 186 | editable: true | ||
240 | onValueChanged: cfg_SlideInterval = hoursInterval.value * 3600 + minutesInterval.value * 60 + secondsInterval.value | 187 | onValueChanged: cfg_SlideInterval = hoursInterval.value * 3600 + minutesInterval.value * 60 + secondsInterval.value | ||
241 | } | 188 | } | ||
242 | QtControls2.Label { | 189 | QtControls2.Label { | ||
243 | text: i18nd("plasma_wallpaper_org.kde.image","Seconds") | 190 | text: i18nd("plasma_wallpaper_org.kde.image","Seconds") | ||
244 | } | 191 | } | ||
245 | } | 192 | } | ||
193 | } | ||||
246 | Kirigami.Heading { | 194 | Kirigami.Heading { | ||
247 | text: "Folders" | 195 | text: i18nd("plasma_wallpaper_org.kde.image","Folders") | ||
248 | level: 2 | 196 | level: 2 | ||
249 | } | 197 | } | ||
250 | GridLayout { | 198 | GridLayout { | ||
251 | columns: 2 | 199 | columns: 2 | ||
252 | Layout.fillWidth: true | 200 | Layout.fillWidth: true | ||
253 | Layout.fillHeight: true | 201 | Layout.fillHeight: true | ||
254 | columnSpacing: Kirigami.Units.largeSpacing | 202 | columnSpacing: Kirigami.Units.largeSpacing | ||
255 | QtControls2.ScrollView { | 203 | QtControls2.ScrollView { | ||
▲ Show 20 Lines • Show All 121 Lines • Show Last 20 Lines |