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 | // Only reload the image once a second when the widget is being resized | ||||
davidedmundson: Isn't this doing the opposite of the comment and /always/ reloading an image after 250ms with a… | |||||
184 | // So we don't read the file too often | ||||
185 | Timer { | ||||
186 | id: imageReloadTimer | ||||
187 | interval: 1000 | ||||
188 | running: true | ||||
189 | onTriggered: { | ||||
190 | console.log('Timer fired; reloading image on disk') | ||||
191 | frontImage.sourceSize.width = width | ||||
192 | frontImage.sourceSize.height = height | ||||
193 | } | ||||
194 | } | ||||
195 | | ||||
183 | Image { | 196 | Image { | ||
184 | id: bufferImage | 197 | id: bufferImage | ||
185 | 198 | | |||
186 | 199 | | |||
187 | anchors.fill: parent | 200 | anchors.fill: parent | ||
188 | fillMode: plasmoid.configuration.fillMode | 201 | fillMode: plasmoid.configuration.fillMode | ||
189 | 202 | | |||
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 | 203 | opacity: 0 | ||
191 | 204 | | |||
192 | cache: false | 205 | cache: false | ||
193 | source: transitionSource | 206 | source: transitionSource | ||
194 | 207 | | |||
195 | asynchronous: true | 208 | asynchronous: true | ||
196 | autoTransform: true | 209 | autoTransform: true | ||
197 | } | 210 | } | ||
198 | 211 | | |||
199 | Image { | 212 | Image { | ||
200 | id: frontImage | 213 | id: frontImage | ||
201 | 214 | | |||
202 | anchors.fill: parent | 215 | anchors.fill: parent | ||
203 | fillMode: plasmoid.configuration.fillMode | 216 | fillMode: plasmoid.configuration.fillMode | ||
204 | 217 | | |||
205 | cache: false | 218 | cache: false | ||
206 | source: activeSource | 219 | source: activeSource | ||
207 | 220 | | |||
208 | asynchronous: true | 221 | asynchronous: true | ||
209 | autoTransform: true | 222 | autoTransform: true | ||
210 | 223 | | |||
224 | onWidthChanged: imageReloadTimer.start() | ||||
225 | onHeightChanged: imageReloadTimer.start() | ||||
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… | |||||
226 | | ||||
211 | MouseArea { | 227 | MouseArea { | ||
212 | anchors.fill: parent | 228 | anchors.fill: parent | ||
213 | onClicked: Qt.openUrlExternally(activeSource) | 229 | onClicked: Qt.openUrlExternally(activeSource) | ||
214 | enabled: plasmoid.configuration.leftClickOpenImage | 230 | enabled: plasmoid.configuration.leftClickOpenImage | ||
215 | } | 231 | } | ||
216 | 232 | | |||
217 | } | 233 | } | ||
218 | } | 234 | } | ||
▲ 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?