@@ -81,7 +81,8 @@ pub enum UIEvent {
8181 VolumeSlider ( f32 ) ,
8282 VolumeUp ,
8383 VolumeDown ,
84- SeekBar ( f32 ) ,
84+ SeekBarMoved ( f32 ) ,
85+ SeekBarFinished ( f32 ) ,
8586 DroppedFiles ( String ) ,
8687 HideQueue ,
8788 HideConnectionWindow ,
@@ -413,7 +414,6 @@ impl UIThread {
413414 self . gui . reset ( ) ;
414415
415416 self . update_status ( ) ;
416- self . update_right_status ( ) ;
417417 }
418418 UIUpdateEvent :: SetTime ( elapsed, total) => {
419419 // TODO: switch between elapsed and remaining on there
@@ -452,8 +452,6 @@ impl UIThread {
452452 }
453453 }
454454 UIUpdateEvent :: UserListChanged => {
455- self . update_right_status ( ) ;
456-
457455 let s = self . state . blocking_read ( ) ;
458456
459457 self . gui . users . clear ( ) ;
@@ -476,11 +474,12 @@ impl UIThread {
476474 } else {
477475 // not connected
478476 }
477+
478+ drop ( s) ;
479+ self . update_status ( ) ;
479480 }
480481 UIUpdateEvent :: RoomChanged => { }
481482 UIUpdateEvent :: QueueChanged => {
482- self . update_right_status ( ) ;
483-
484483 let s = self . state . blocking_read ( ) ;
485484
486485 self . queue_gui . queue_browser . clear ( ) ;
@@ -547,8 +546,7 @@ impl UIThread {
547546 }
548547
549548 drop ( s) ;
550-
551- self . update_right_status ( ) ;
549+ self . update_status ( ) ;
552550 }
553551 UIUpdateEvent :: UpdateConnectionTree ( list) => {
554552 self . connection_gui . populate ( list) ;
@@ -562,21 +560,6 @@ impl UIThread {
562560 }
563561 }
564562
565- fn update_right_status ( & mut self ) {
566- let s = self . state . blocking_read ( ) ;
567-
568- let ( users, queue) = s
569- . connection
570- . as_ref ( )
571- . and_then ( |c| c. room . as_ref ( ) )
572- . map ( |r| ( r. connected_users . len ( ) , r. queue . len ( ) ) )
573- . unwrap_or_default ( ) ;
574-
575- self . gui
576- . status_right_display
577- . set_label ( & format ! ( "U{:0>2} Q{:0>2}" , users, queue) ) ;
578- }
579-
580563 // set status based on state and priorities
581564 fn update_status ( & mut self ) {
582565 let status = self . get_status ( ) ;
@@ -585,21 +568,11 @@ impl UIThread {
585568 // and the little thingy too
586569 let play_status = self . get_play_status ( ) ;
587570 self . gui . play_status . update ( play_status) ;
588- }
589571
590- fn get_play_status ( & self ) -> PlayStatusIcon {
591- let state = self . state . blocking_read ( ) ;
592-
593- // i love shared and reusable logic ^-^
594- if state. is_stopped ( ) {
595- PlayStatusIcon :: Stop
596- } else if state. is_paused ( ) {
597- PlayStatusIcon :: Pause
598- } else if state. is_transmitter ( ) {
599- PlayStatusIcon :: PlayTx
600- } else {
601- PlayStatusIcon :: PlayRx
602- }
572+ // and probably just do the right status at the same time too
573+ // if we really want fine grained updates then we should do something else
574+ let right_status = self . get_right_status ( ) ;
575+ self . gui . status_right_display . set_label ( & right_status) ;
603576 }
604577
605578 fn get_status ( & self ) -> String {
@@ -647,6 +620,38 @@ impl UIThread {
647620 "<not connected>" . to_string ( )
648621 }
649622 }
623+
624+ fn get_play_status ( & self ) -> PlayStatusIcon {
625+ let state = self . state . blocking_read ( ) ;
626+
627+ // i love shared and reusable logic ^-^
628+ if state. is_stopped ( ) {
629+ PlayStatusIcon :: Stop
630+ } else if state. is_paused ( ) {
631+ PlayStatusIcon :: Pause
632+ } else if state. is_transmitter ( ) {
633+ PlayStatusIcon :: PlayTx
634+ } else {
635+ PlayStatusIcon :: PlayRx
636+ }
637+ }
638+
639+ fn get_right_status ( & self ) -> String {
640+ let s = self . state . blocking_read ( ) ;
641+
642+ if let Some ( seek_pos) = s. seek_position {
643+ return format ! ( "[{}]" , min_secs( seek_pos) ) ;
644+ }
645+
646+ let ( users, queue) = s
647+ . connection
648+ . as_ref ( )
649+ . and_then ( |c| c. room . as_ref ( ) )
650+ . map ( |r| ( r. connected_users . len ( ) , r. queue . len ( ) ) )
651+ . unwrap_or_default ( ) ;
652+
653+ format ! ( "U{:0>2} Q{:0>2}" , users, queue)
654+ }
650655}
651656
652657fn handle_window_drag (
0 commit comments