[kde-doc-english] [amarok] /: PlaylistDock: provide Repopulate and Turn off links in "Dynamic mode enabled" msg

Matěj Laitl matej at laitl.cz
Sat May 5 20:43:20 UTC 2012


Git commit aa5bb1b8afef82a081ff3856d2e85317f0a348d5 by Matěj Laitl.
Committed on 05/05/2012 at 22:32.
Pushed by laitl into branch 'master'.

PlaylistDock: provide Repopulate and Turn off links in "Dynamic mode enabled" msg

I hope this will be agreed upon. The link's colour is rather similar to
background in my palette, but still readable. Any improvements welcome,
I can even make these small buttons.

Or perhaps we may move the "turn dynamic playlist on/off" button down
to the playlist statusbar? Perhaps hiding "track progression" button
that has no sense when dynamic is enabled? I have no strong opinion.

FEATURES:
 * Provide Repopulate and Turn off link in "Dynamic Mode Enabled" bagde.

DIGEST: Feature
GUI: Repopulate and Turn off links added to "Dynamic Mode Enabled" message

M  +1    -0    ChangeLog
M  +18   -1    src/playlist/PlaylistDock.cpp
M  +1    -0    src/playlist/PlaylistDock.h

http://commits.kde.org/amarok/aa5bb1b8afef82a081ff3856d2e85317f0a348d5

diff --git a/ChangeLog b/ChangeLog
index c4062ef..573c15c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@ Amarok ChangeLog
 
 VERSION 2.6-Beta 1
   FEATURES:
+    * Provide Repopulate and Turn off link in "Dynamic Mode Enabled" bagde.
     * Support for setting cover images for albums on USB Mass Storage devices.
     * Support for setting and unsetting cover images for iPod albums, can
       write back covers to file meta-data too, respects configuration.
diff --git a/src/playlist/PlaylistDock.cpp b/src/playlist/PlaylistDock.cpp
index 2d5d101..6eb56f3 100644
--- a/src/playlist/PlaylistDock.cpp
+++ b/src/playlist/PlaylistDock.cpp
@@ -50,6 +50,10 @@
 #include <QToolBar>
 #include <QHBoxLayout>
 
+
+static const QString s_repopulate( "repopulate" );
+static const QString s_turnOff( "turn_off" );
+
 Playlist::Dock::Dock( QWidget* parent )
     : AmarokDockWidget( i18n( "&Playlist" ), parent )
     , m_barBox( 0 )
@@ -102,8 +106,12 @@ Playlist::Dock::polish()
     // show visual indication of dynamic playlists  being enabled
     connect( The::playlistActions(), SIGNAL( navigatorChanged() ),
              SLOT( showDynamicHint() ) );
-    m_dynamicHintWidget = new QLabel( i18n( "Dynamic Mode Enabled" ), m_mainWidget );
+    m_dynamicHintWidget = new QLabel( i18n( "Dynamic Mode Enabled. <a href='%1'>Repopulate</a> "
+        "| <a href='%2'>Turn off</a>", s_repopulate, s_turnOff ), m_mainWidget );
     m_dynamicHintWidget->setAlignment( Qt::AlignCenter );
+    m_dynamicHintWidget->setTextInteractionFlags( Qt::LinksAccessibleByKeyboard | Qt::LinksAccessibleByMouse );
+    m_dynamicHintWidget->setMinimumSize( 1, 1 ); // so that it doesn't prevent playlist from shrinking
+    connect( m_dynamicHintWidget, SIGNAL(linkActivated(QString)), SLOT(slotDynamicHintLinkActivated(QString)) );
 
     QFont dynamicHintWidgetFont = m_dynamicHintWidget->font();
     dynamicHintWidgetFont.setPointSize( dynamicHintWidgetFont.pointSize() + 1 );
@@ -350,3 +358,12 @@ Playlist::Dock::clearFilterIfActive() // slot
     if( filterActive )
         m_searchWidget->slotFilterClear();
 }
+
+void
+Playlist::Dock::slotDynamicHintLinkActivated( const QString &href )
+{
+    if( href == s_repopulate )
+        The::playlistActions()->repopulateDynamicPlaylist();
+    else if( href == s_turnOff )
+        The::playlistActions()->enableDynamicMode( false );
+}
diff --git a/src/playlist/PlaylistDock.h b/src/playlist/PlaylistDock.h
index 9354ae1..b30f032 100644
--- a/src/playlist/PlaylistDock.h
+++ b/src/playlist/PlaylistDock.h
@@ -71,6 +71,7 @@ private slots:
     void playlistProviderRemoved( Playlists::PlaylistProvider *provider, int category );
     void slotSaveCurrentPlaylist();
     void slotEditQueue();
+    void slotDynamicHintLinkActivated( const QString &href );
 
 private:
     KActionMenu *m_savePlaylistMenu;


More information about the kde-doc-english mailing list