@@ -16,6 +16,10 @@ Screen {
1616 property string itemType
1717 property int volumeState
1818 property alias queueTimerControl : queueTimer
19+ property alias positionIndicatorWidth : volumeBar .width
20+ property alias positionIndicatorLeft : volumeBar .left
21+ property bool positionIndicatorDragActive : falso
22+ property int positionIndicatorX
1923
2024 onCustomButtonClicked: {
2125 if (app .favoritesScreen ) {
@@ -120,18 +124,17 @@ Screen {
120124 horizontalAlignment: Text .AlignHCenter
121125 anchors {
122126 top: parent .top
123- topMargin: isNxt ? 350 : 280
127+ topMargin: isNxt ? 325 : 260
124128 left: parent .left
125- leftMargin: isNxt ? 40 : 32
126129 }
127- width: isNxt ? 250 : 200
130+ width: isNxt ? 325 : 260
128131 }
129132
130133 Text {
131134 id: itemText
132135
133136 text: app .actualTitle
134- font .pixelSize : isNxt ? 20 : 16
137+ font .pixelSize : isNxt ? 15 : 12
135138 font .family : qfont .regular .name
136139 font .bold : true
137140 color: colors .tileTextColor
@@ -142,9 +145,8 @@ Screen {
142145 top: itemArtist .bottom
143146 topMargin: isNxt ? 5 : 4
144147 left: parent .left
145- leftMargin: isNxt ? 40 : 32
146148 }
147- width: isNxt ? 250 : 200
149+ width: isNxt ? 325 : 260
148150 }
149151
150152 // below you'll find the iconbuttons which are controlling your device (previous, play/pause, shuffle on and shuffle off and the next button)
@@ -242,7 +244,6 @@ Screen {
242244
243245 iconSource: " qrc:/tsc/right.png"
244246 onClicked: {
245- console .log (" next" );
246247 app .simpleSynchronous (" http://" + app .connectionPath + " /" + app .sonosName + " /next" );
247248 }
248249 }
@@ -385,12 +386,95 @@ Screen {
385386 }
386387 }
387388
389+ // this is the picture behind the slider.
390+ Image {
391+ id: volumeBar
392+ source: " drawables/volumeBarTile.png"
393+ width: isNxt ? 325 : 260
394+ height: isNxt ? 20 : 16
395+ anchors {
396+ bottom: volumeDown .top
397+ bottomMargin: isNxt ? 20 : 16
398+ left: parent .left
399+ }
400+ visible: app .showSlider
401+ }
402+
403+ // this image is the slider indicator.
404+ Image {
405+ id: positionIndicator
406+ source: " drawables/volumeIndicator.png"
407+ height: isNxt ? 35 : 28
408+ width: isNxt ? 35 : 28
409+ x: positionIndicatorX
410+ y: isNxt ? 417 : 333
388411
389- function pad (n , width ) {
390- n = n + ' ' ;
391- return n .length >= width ? n : new Array (width - n .length + 1 ).join (' 0' ) + n;
412+ MouseArea {
413+ id: mouseArea
414+ anchors .fill : parent
415+ drag {
416+ target: positionIndicator
417+ axis: Drag .XAxis
418+ minimumX: 0
419+ maximumX: isNxt ? 290 : 232
420+ }
421+ property bool dragActive: drag .active
422+ onDragActiveChanged: {
423+ if (! drag .active ) {
424+ positionIndicatorDragActive = false ;
425+ var xPos = positionIndicator .x ;
426+ if (xPos < 0 ) xPos = 0 ;
427+ app .simpleSynchronous (" http://" + app .connectionPath + " /" + app .sonosName + " /timeseek/" + Math .floor (xPos * app .trackDuration / volumeBar .width ));
428+ app .showSlider = false ;
429+ } else {
430+ positionIndicatorDragActive = true ;
431+ }
432+ }
433+ }
434+ onXChanged: {
435+ if (mouseArea .drag .active ) {
436+ app .trackElapsedTime = Math .floor (x * app .trackDuration / volumeBar .width );
437+ }
438+ }
439+ visible: app .showSlider
440+ }
441+
442+ Text {
443+ id: trackLength
444+
445+ text: new Date (app .trackDuration * 1000 ).toISOString ().substr (14 , 5 )
446+ font .pixelSize : isNxt ? 13 : 10
447+ font .family : qfont .regular .name
448+ font .bold : true
449+ color: colors .tileTextColor
450+
451+ anchors {
452+ bottom: volumeBar .top
453+ bottomMargin: isNxt ? 5 : 4
454+ right: volumeBar .right
455+ rightMargin: isNxt ? - 20 : - 16
456+ }
457+ visible: app .showSlider
458+ }
459+
460+ Text {
461+ id: trackPositionTime
462+
463+ text: new Date (app .trackElapsedTime * 1000 ).toISOString ().substr (14 , 5 )
464+ font .pixelSize : isNxt ? 13 : 10
465+ font .family : qfont .regular .name
466+ font .bold : true
467+ color: colors .tileTextColor
468+
469+ anchors {
470+ bottom: volumeBar .top
471+ bottomMargin: isNxt ? 5 : 4
472+ right: positionIndicator .right
473+ }
474+ visible: app .showSlider && ((positionIndicatorX / volumeBar .width ) < 0.85 )
392475 }
393476
477+
394478 // This function is to setup the playlist, export the information to: PlaylistItemsJS and configure the scrollable list (refresh and everything).
395479 function updateQueue () {
396480
0 commit comments