[amarok] src/playlist: Collapsed 4 actions in the Playlist toolbar into 1 menu.

Bart Cerneels bart.cerneels at kde.org
Thu Jun 16 22:45:16 CEST 2011


Can you make this conditional on the actual width of the playlist dock?

On Thu, Jun 16, 2011 at 22:26, Teo Mrnjavac <teo at kde.org> wrote:
> Git commit 4717b29a8c2718c1b99eebb5169683e99bab4f1a by Teo Mrnjavac.
> Committed on 16/06/2011 at 22:16.
> Pushed by mrnjavac into branch 'master'.
>
> Collapsed 4 actions in the Playlist toolbar into 1 menu.
>
> With the recent move of the tracks count from the status bar to the
> playlist toolbar, and the disposal of the status bar, the playlist
> toolbar has just grown too wide, and is not nicely usable on a netbook.
> This commit moves 4 of the playlist actions into a menu in the playlist
> toolbar, so we gain the horizontal space equivalent of 3 icons.
> I dislike useless clicking as much as anybody so this solution is not
> ideal, but not being able to make the playlist narrower is too much of
> a deal breaker on netbooks.
> Also, the icons are somewhat vertically misaligned by a pixel or two,
> probably because they were done in different moments. We might consider
> having them fixed.
>
> M  +15   -9    src/playlist/PlaylistDock.cpp
>
> http://commits.kde.org/amarok/4717b29a8c2718c1b99eebb5169683e99bab4f1a
>
> diff --git a/src/playlist/PlaylistDock.cpp b/src/playlist/PlaylistDock.cpp
> index 85328b7..c119f3e 100644
> --- a/src/playlist/PlaylistDock.cpp
> +++ b/src/playlist/PlaylistDock.cpp
> @@ -176,11 +176,17 @@ Playlist::Dock::polish()
>         plBar->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Preferred );
>         plBar->setMovable( false );
>
> -        plBar->addAction( Amarok::actionCollection()->action( "playlist_clear" ) );
> +        KActionMenu *playlistMenu = new KActionMenu( KIcon( "amarok_playlist" ),
> +                                                     i18n( "&Playlist" ), m_mainWidget );
> +        playlistMenu->setDelayed(false);
> +
> +        playlistMenu->addAction( Amarok::actionCollection()->action( "playlist_clear" ) );
>
>         m_savePlaylistMenu = new KActionMenu( KIcon( "document-save-amarok" ),
>                                               i18n("&Save Current Playlist"), m_mainWidget );
> +
>         m_saveActions = new KActionCollection( m_mainWidget );
> +
>         connect( m_savePlaylistMenu, SIGNAL( triggered( bool ) ),
>                  SLOT( slotSaveCurrentPlaylist() ) );
>         foreach( Playlists::PlaylistProvider *provider, The::playlistManager()->providersForCategory(
> @@ -198,20 +204,20 @@ Playlist::Dock::polish()
>                  SLOT( playlistProviderRemoved( Playlists::PlaylistProvider *, int ) )
>                  );
>
> -        plBar->addAction( m_savePlaylistMenu );
> +        playlistMenu->addAction( m_savePlaylistMenu );
>
> -        plBar->addSeparator();
> -        plBar->addAction( Amarok::actionCollection()->action( "playlist_undo" ) );
> -        plBar->addAction( Amarok::actionCollection()->action( "playlist_redo" ) );
> -        plBar->addSeparator();
> -
> -        plBar->addAction( Amarok::actionCollection()->action( "show_active_track" ) );
> -        plBar->addSeparator();
> +        playlistMenu->addSeparator();
> +        playlistMenu->addAction( Amarok::actionCollection()->action( "playlist_undo" ) );
> +        playlistMenu->addAction( Amarok::actionCollection()->action( "playlist_redo" ) );
> +        plBar->addAction( playlistMenu );
>
>         NavigatorConfigAction * navigatorConfig = new NavigatorConfigAction( m_mainWidget );
>         plBar->addAction( navigatorConfig );
>         plBar->addSeparator();
>
> +        plBar->addAction( Amarok::actionCollection()->action( "show_active_track" ) );
> +        plBar->addSeparator();
> +
>         QToolButton *toolButton =
>                 qobject_cast<QToolButton*>(plBar->widgetForAction( navigatorConfig ) );
>         if( toolButton )
>


More information about the Amarok-devel mailing list