Changeset View
Changeset View
Standalone View
Standalone View
applets/mediaframe/package/contents/ui/main.qml
Show First 20 Lines • Show All 174 Lines • ▼ Show 20 Line(s) | 160 | Item { | |||
---|---|---|---|---|---|
175 | } | 175 | } | ||
176 | */ | 176 | */ | ||
177 | 177 | | |||
178 | Item { | 178 | Item { | ||
179 | id: imageView | 179 | id: imageView | ||
180 | visible: hasItems | 180 | visible: hasItems | ||
181 | anchors.fill: parent | 181 | anchors.fill: parent | ||
182 | 182 | | |||
183 | // This timer prevents reloading the image too often when resizing, | ||||
davidedmundson: Isn't this doing the opposite of the comment and /always/ reloading an image after 250ms with a… | |||||
184 | // to minimize excessively re-reading the file on disk | ||||
185 | Timer { | ||||
186 | id: imageReloadTimer | ||||
187 | interval: 250 | ||||
188 | running: false | ||||
189 | onTriggered: { | ||||
190 | frontImage.sourceSize.width = width | ||||
191 | frontImage.sourceSize.height = height | ||||
192 | } | ||||
193 | } | ||||
194 | | ||||
183 | Image { | 195 | Image { | ||
184 | id: bufferImage | 196 | id: bufferImage | ||
185 | 197 | | |||
186 | 198 | | |||
187 | anchors.fill: parent | 199 | anchors.fill: parent | ||
188 | fillMode: plasmoid.configuration.fillMode | 200 | fillMode: plasmoid.configuration.fillMode | ||
189 | 201 | | |||
Note that this will cause the image to be reloaded everytime the size changes, so make sure the image isn't loaded repeatedly on start (as the applet is laid out) and/or while resizing the widget broulik: Note that this will cause the image to be reloaded everytime the size changes, so make sure the… | |||||
190 | opacity: 0 | 202 | opacity: 0 | ||
191 | 203 | | |||
192 | cache: false | 204 | cache: false | ||
193 | source: transitionSource | 205 | source: transitionSource | ||
194 | 206 | | |||
195 | asynchronous: true | 207 | asynchronous: true | ||
196 | autoTransform: true | 208 | autoTransform: true | ||
197 | } | 209 | } | ||
198 | 210 | | |||
199 | Image { | 211 | Image { | ||
200 | id: frontImage | 212 | id: frontImage | ||
201 | 213 | | |||
202 | anchors.fill: parent | 214 | anchors.fill: parent | ||
203 | fillMode: plasmoid.configuration.fillMode | 215 | fillMode: plasmoid.configuration.fillMode | ||
204 | 216 | | |||
205 | cache: false | 217 | cache: false | ||
206 | source: activeSource | 218 | source: activeSource | ||
207 | 219 | | |||
208 | asynchronous: true | 220 | asynchronous: true | ||
209 | autoTransform: true | 221 | autoTransform: true | ||
210 | 222 | | |||
223 | onWidthChanged: imageReloadTimer.restart() | ||||
224 | onHeightChanged: imageReloadTimer.restart() | ||||
Maybe restart is better, you can resize more than a second, so it'll wait a timer interval with no resize activity. After that you can make timer.interval say 100 ms. anthonyfieroni: Maybe restart is better, you can resize more than a second, so it'll wait a timer interval with… | |||||
225 | | ||||
226 | sourceSize.width: width | ||||
227 | sourceSize.height: height | ||||
228 | | ||||
211 | MouseArea { | 229 | MouseArea { | ||
212 | anchors.fill: parent | 230 | anchors.fill: parent | ||
213 | onClicked: Qt.openUrlExternally(activeSource) | 231 | onClicked: Qt.openUrlExternally(activeSource) | ||
214 | enabled: plasmoid.configuration.leftClickOpenImage | 232 | enabled: plasmoid.configuration.leftClickOpenImage | ||
215 | } | 233 | } | ||
216 | 234 | | |||
217 | } | 235 | } | ||
218 | } | 236 | } | ||
▲ Show 20 Lines • Show All 229 Lines • Show Last 20 Lines |
Isn't this doing the opposite of the comment and /always/ reloading an image after 250ms with a new source size?