@@ -22,21 +22,21 @@ Item {
2222 property int changeWallpaperMode: Enum .ChangeWallpaperMode .Slideshow
2323 property int changeWallpaperTimerMinutes: 10
2424 property int changeWallpaperTimerHours: 0
25- property int changeWallpaperTimerTime: (changeWallpaperTimerHours* 60 + changeWallpaperTimerMinutes)* 60 * 1000
25+ property int changeWallpaperTimerTime: (changeWallpaperTimerHours * 60 + changeWallpaperTimerMinutes) * 60 * 1000
2626 property bool resumeLastVideo: true
2727
2828 // Crossfade must not be longer than the shortest video or the fade becomes glitchy
2929 // we don't know the length until a video gets played, so the crossfade duration
3030 // will decrease below the configured duration if needed as videos get played
3131 // Split the crossfade duration between the two videos. If either video is too short,
3232 // reduce only it's part of the crossfade duration accordingly
33- property int crossfadeMinDurationLast: Math .min (root .targetCrossfadeDuration / 2 , otherPlayer .actualDuration / 3 );
34- property int crossfadeMinDurationCurrent: Math .min (root .targetCrossfadeDuration / 2 , player .actualDuration / 3 );
33+ property int crossfadeMinDurationLast: Math .min (root .targetCrossfadeDuration / 2 , otherPlayer .actualDuration / 3 )
34+ property int crossfadeMinDurationCurrent: Math .min (root .targetCrossfadeDuration / 2 , player .actualDuration / 3 )
3535 property int crossfadeDuration: {
36- if (! root .crossfadeEnabled ){
36+ if (! root .crossfadeEnabled ) {
3737 return 0 ;
38- }else if (root .changeWallpaperMode === Enum .ChangeWallpaperMode .OnATimer ){
39- return Math .min (root .targetCrossfadeDuration , changeWallpaperTimerTime/ 3 * 2 );
38+ } else if (root .changeWallpaperMode === Enum .ChangeWallpaperMode .OnATimer ) {
39+ return Math .min (root .targetCrossfadeDuration , changeWallpaperTimerTime / 3 * 2 );
4040 } else {
4141 return crossfadeMinDurationLast + crossfadeMinDurationCurrent;
4242 }
@@ -64,34 +64,33 @@ Item {
6464 videoPlayer2 .play ();
6565 root .primaryPlayer = false ;
6666 videoPlayer1 .opacity = 0 ;
67-
6867 } else {
6968 videoPlayer1 .playerSource = root .currentSource ;
7069 videoPlayer1 .play ();
7170 root .primaryPlayer = true ;
7271 videoPlayer1 .opacity = 1 ;
7372 }
7473
75- if (root .changeWallpaperMode === Enum .ChangeWallpaperMode .OnATimer ){
74+ if (root .changeWallpaperMode === Enum .ChangeWallpaperMode .OnATimer ) {
7675 changeTimer .restart ();
7776 }
7877 }
7978 signal setNextSource
8079
81- Timer{
80+ Timer {
8281 id: changeTimer
8382 running: root .changeWallpaperMode === Enum .ChangeWallpaperMode .OnATimer
8483 interval: ! running ? 0 : changeWallpaperTimerTime - (root .crossfadeEnabled ? root .crossfadeMinDurationCurrent : 0 )
8584 repeat: true
8685 onTriggered: {
87- if (root .debugEnabled ){
86+ if (root .debugEnabled ) {
8887 console .log (" Timer triggered, changing wallpaper" );
8988 }
9089 root .next (true );
9190 }
9291 onIntervalChanged: {
93- if (running){
94- if (root .debugEnabled ){
92+ if (running) {
93+ if (root .debugEnabled ) {
9594 console .log (" Timer started. Interval:" , interval);
9695 }
9796 changeTimer .restart ();
@@ -113,11 +112,11 @@ Item {
113112 opacity: 1
114113 fillMode: root .fillMode
115114 loops: {
116- if (! root .multipleVideos || (root .currentSource .loop && ! root .crossfadeEnabled ))
115+ if (! root .multipleVideos || (root .currentSource .loop && ! root .crossfadeEnabled ))
117116 return MediaPlayer .Infinite ;
118- else if (root .changeWallpaperMode === Enum .ChangeWallpaperMode .Slideshow )
117+ else if (root .changeWallpaperMode === Enum .ChangeWallpaperMode .Slideshow )
119118 return 1 ;
120- else // all other (future) modes
119+ else
121120 return MediaPlayer .Infinite ;
122121 }
123122 onPositionChanged: {
@@ -132,8 +131,7 @@ Item {
132131 if ((position / playbackRate) > (actualDuration - root .crossfadeMinDurationCurrent )) {
133132 if (root .changeWallpaperMode === Enum .ChangeWallpaperMode .Slideshow ) {
134133 root .next (true );
135- }
136- else if (root .changeWallpaperMode === Enum .ChangeWallpaperMode .Never ) {
134+ } else if (root .changeWallpaperMode === Enum .ChangeWallpaperMode .Never ) {
137135 root .next (false );
138136 }
139137 }
@@ -143,8 +141,7 @@ Item {
143141 if (mediaStatus == MediaPlayer .EndOfMedia ) {
144142 if (root .crossfadeEnabled ) {
145143 return ;
146- }
147- else if (root .changeWallpaperMode === Enum .ChangeWallpaperMode .Slideshow ) {
144+ } else if (root .changeWallpaperMode === Enum .ChangeWallpaperMode .Slideshow ) {
148145 root .next (true );
149146 }
150147 }
@@ -159,8 +156,8 @@ Item {
159156 root .restoreLastPosition = false ;
160157 }
161158 }
162- onLoopsChanged: {
163- if (primaryPlayer){
159+ onLoopsChanged: {
160+ if (primaryPlayer) {
164161 // needed to correctly update player with new loops value
165162 let pos = videoPlayer1 .position ;
166163 videoPlayer1 .stop ();
@@ -176,7 +173,7 @@ Item {
176173 }
177174 }
178175 onOpacityChanged: {
179- if (opacity === 0 || opacity === 1 ) {
176+ if (opacity === 0 || opacity === 1 ) {
180177 // Reset other player source to empty to free resources
181178 otherPlayer .playerSource = Utils .createVideo (" " );
182179 }
@@ -202,11 +199,11 @@ Item {
202199 z: 1
203200 fillMode: root .fillMode
204201 loops: {
205- if (! root .multipleVideos || (root .currentSource .loop && ! root .crossfadeEnabled ))
202+ if (! root .multipleVideos || (root .currentSource .loop && ! root .crossfadeEnabled ))
206203 return MediaPlayer .Infinite ;
207- else if (root .changeWallpaperMode === Enum .ChangeWallpaperMode .Slideshow )
204+ else if (root .changeWallpaperMode === Enum .ChangeWallpaperMode .Slideshow )
208205 return 1 ;
209- else // all other (future) modes
206+ else
210207 return MediaPlayer .Infinite ;
211208 }
212209 onPositionChanged: {
@@ -215,12 +212,11 @@ Item {
215212 }
216213 root .lastVideoPosition = position;
217214
218- if (root .crossfadeEnabled ) {
215+ if (root .crossfadeEnabled ) {
219216 if ((position / playbackRate) > (actualDuration - root .crossfadeMinDurationCurrent )) {
220217 if (root .changeWallpaperMode === Enum .ChangeWallpaperMode .Slideshow ) {
221218 root .next (true );
222- }
223- else if (root .changeWallpaperMode === Enum .ChangeWallpaperMode .Never ) {
219+ } else if (root .changeWallpaperMode === Enum .ChangeWallpaperMode .Never ) {
224220 root .next (false );
225221 }
226222 }
@@ -230,14 +226,13 @@ Item {
230226 if (mediaStatus == MediaPlayer .EndOfMedia ) {
231227 if (root .crossfadeEnabled ) {
232228 return ;
233- }
234- else if (root .changeWallpaperMode === Enum .ChangeWallpaperMode .Slideshow ) {
229+ } else if (root .changeWallpaperMode === Enum .ChangeWallpaperMode .Slideshow ) {
235230 root .next (true );
236231 }
237232 }
238233 }
239- onLoopsChanged: {
240- if (! primaryPlayer){
234+ onLoopsChanged: {
235+ if (! primaryPlayer) {
241236 // needed to correctly update player with new loops value
242237 let pos = videoPlayer2 .position ;
243238 videoPlayer2 .stop ();
@@ -278,7 +273,7 @@ Item {
278273 text: " crossfade " + root .crossfadeEnabled
279274 }
280275 PlasmaComponents .Label {
281- text: " crossfadeDuration " + root .crossfadeDuration + " (" + root .crossfadeMinDurationLast + " , " + root .crossfadeMinDurationCurrent + " )"
276+ text: " crossfadeDuration " + root .crossfadeDuration + " (" + root .crossfadeMinDurationLast + " , " + root .crossfadeMinDurationCurrent + " )"
282277 }
283278 PlasmaComponents .Label {
284279 text: " multipleVideos " + root .multipleVideos
0 commit comments