Bug 230569

Summary: No visual cue for "Stop playing after current track" by shortcut
Product: [Applications] amarok Reporter: Bram Schoenmakers <me>
Component: PlaylistAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: normal CC: nhn, teo
Priority: NOR    
Version: 2.3-GIT   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:

Description Bram Schoenmakers 2010-03-13 14:20:48 UTC
Version:           2.2.2 (using KDE 4.4.1)
OS:                Linux
Installed from:    Archlinux Packages

Minor bug: when I trigger the Stop playing after current track with the keyboard shortcut (either 'local' or global shortcut), the stop icon does not appear at the current track. When I hover the track with the mouse, it is properly repainted.
Comment 1 Myriam Schweingruber 2010-03-14 09:26:20 UTC
Still present in current 2.3-git: the Global Shortcut Meta+Shift+V stops after current track, but there is no visual indicator in the track. Either hovering the mouse on that track or any other nearby track makes the stop button appear.
Comment 2 Nikolaj Hald Nielsen 2010-03-15 08:46:46 UTC
commit d55d35a8e705c1bb256c84d7cc9b4ecc7e2b8d75
Author: Nikolaj Hald Nielsen <nhn@kde.org>
Date:   Mon Mar 15 08:40:49 2010 +0100

    Trigger a repaint of The Playlist when using a shortcut to set/unset "stop after this track"
    
    BUG: 230569

diff --git a/src/ActionClasses.cpp b/src/ActionClasses.cpp
index 1b0b23c..c528e50 100644
--- a/src/ActionClasses.cpp
+++ b/src/ActionClasses.cpp
@@ -537,11 +537,13 @@ StopPlayingAfterCurrentTrackAction::stopPlayingAfterCurrentTrack()
     {
         The::playlistActions()->setStopAfterMode( Playlist::StopAfterCurrent );
         The::playlistActions()->setTrackToBeLast( Playlist::ModelStack::instance()->source()->activeId() );
+        The::playlistActions()->repaintPlaylist();
         Amarok::OSD::instance()->setImage( QImage( KIconLoader::global()->iconPath( "amarok", -KIconLoader::SizeHuge ) ) );
         Amarok::OSD::instance()->OSDWidget::show( i18n( "Stop after current track: On" ) );
     } else {
         The::playlistActions()->setStopAfterMode( Playlist::StopNever );
         The::playlistActions()->setTrackToBeLast( 0 );
+        The::playlistActions()->repaintPlaylist();
         Amarok::OSD::instance()->setImage( QImage( KIconLoader::global()->iconPath( "amarok", -KIconLoader::SizeHuge ) ) );
         Amarok::OSD::instance()->OSDWidget::show( i18n( "Stop after current track: Off" ) );
     }
diff --git a/src/playlist/PlaylistActions.cpp b/src/playlist/PlaylistActions.cpp
index 18d50d0..dc58e0f 100644
--- a/src/playlist/PlaylistActions.cpp
+++ b/src/playlist/PlaylistActions.cpp
@@ -439,6 +439,12 @@ Playlist::Actions::normalizeDynamicPlaylist()
     }
 }
 
+void
+Playlist::Actions::repaintPlaylist()
+{
+    The::mainWindow()->playlistWidget()->currentView()->repaint();
+}
+
 
 namespace The
 {
diff --git a/src/playlist/PlaylistActions.h b/src/playlist/PlaylistActions.h
index 196eac0..6e97a0d 100644
--- a/src/playlist/PlaylistActions.h
+++ b/src/playlist/PlaylistActions.h
@@ -111,6 +111,12 @@ public slots:
     void queue( QList<int> rows );
     void dequeue( QList<int> rows );
 
+    /**
+    * Repaint the playlist.
+    * Useful when triggering a change that will modify the visual appearance of one or more items in the playlist
+    */
+    void repaintPlaylist();
+
 signals:
     void navigatorChanged();