Vastly simplify image wallpaper code
ClosedPublic

Authored by davidedmundson on Mar 26 2018, 6:03 PM.

Details

Summary

The image wallpaper is a mess of 4 different fade functions, some not in
sync, and very complicated swapping images about.

This simplifies the whole thing by using a StackView, we just pop our
setup with a new configuration on and it handles deleting old objects
when the transition ends.

Code is 1/3 the size, whilst doing the same thing and should result in
having fewer items about.

In addition with this patch changing the transition effect in future
would be super trivial.

Test Plan

Set as both image and wallpaper
Renders stuff as before

Diff Detail

Repository
R120 Plasma Workspace
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
davidedmundson created this revision.Mar 26 2018, 6:03 PM
Restricted Application added a project: Plasma. · View Herald TranscriptMar 26 2018, 6:03 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
davidedmundson requested review of this revision.Mar 26 2018, 6:03 PM
davidedmundson updated this revision to Diff 30648.

use a better variable name before anyone sees it

davidedmundson edited the summary of this revision. (Show Details)Mar 26 2018, 6:06 PM
mart added a subscriber: mart.Mar 27 2018, 2:56 PM
mart added inline comments.
wallpapers/image/imagepackage/contents/ui/main.qml
62

are you sure none of the *changed signals will be triggered i nthe beginning? this could call loadImage twice

124

the result will be the same with a 0 interval, but would be more correct-correct using loadTimer.restart() instead?

148

if the new image is fading in, i don't think the old image should be fading out, as at some point of the anmiation both items would be semitransparent, in that case the black on the back of everything would be creeping in for a while, so if you transition between 2 light wallpaper, you would see a transition to a darker result, then going lighter again

replaceExit: Transition {

    PauseAnimation {
        duration: wallpaper.configuration.TransitionAnimationDuration
    }
}

seems to have a more pleasing effect

broulik requested changes to this revision.Mar 27 2018, 3:20 PM
broulik added a subscriber: broulik.

Can you please incorporate the changes I did in 34454b17f3c54c701418c0e921ca1bea155b4539, most notably Qt.callLater instead of a Timer and putting the Rectangle outside rather than behind (z) the Image so it fades nicely together with the image.

This revision now requires changes to proceed.Mar 27 2018, 3:20 PM

Thanks, in future can you use arc if you're going to build off another patch.

  • Only push image item when it's finished (or failed) loading

is already this code uploaded here, but wasn't in that branch. :/

I don't understand the need for the wrapper you added, opacity is inherited from the parent item, so the background should still fade with it?

Code comments

broulik accepted this revision.Mar 29 2018, 12:24 PM
This revision is now accepted and ready to land.Mar 29 2018, 12:24 PM
This revision was automatically updated to reflect the committed changes.