[kde-doc-english] [amarok] /: Make playlist-related actions consistent throughout Amarok code (behaviour change)
Matěj Laitl
matej at laitl.cz
Sat May 25 11:15:43 UTC 2013
Git commit a43e7e6f5a14307f543e7807a8d2351af027635a by Matěj Laitl.
Committed on 23/05/2013 at 18:54.
Pushed by laitl into branch 'master'.
Make playlist-related actions consistent throughout Amarok code (behaviour change)
This commits boasts a couple of changes, starting with the
uncontroversial ones:
1. The Playlist::AddOptions enum is extended with extended with
"convenience consistency" aliases:
OnDoubleClickOnSelectedItems
OnMiddleClickOnSelectedItems
OnReturnPressedOnSelectedItems
OnPlayMediaAction
OnAppendToPlaylistAction
OnReplacePlaylistAction
OnQueueToPlaylistAction
...and all callers of PlaylistController::insertOptioned() are modified
to use one of these values instead of the "low-level" flags like
DirectPlay that are actually tested for in the insertOptioned()
implementation. This serves that we remain consistent across Amarok
from now on.
2. The actual "low-level" enum values have been changed and
insertOptioned() was updated accordingly:
a) PrependToQueue, which implies Queue, was added.
b) StartPlay (start playing unless something is already playing)
was removed. No caller uses it anymore (see below) and this was
convoluted anyway, IMO.
c) DirectPlay now implies PrependToQueue. This may seem strange,
but the rationale is following: when you directplay just one
track (which is the case 90% of the time), it is played
immediately, and this should apply even when you add more
tracks. PrependToQueue makes this possible without hacks and is
invisible in case of just one track, because it is immediately
popped from the queue. Plus it has a positive side-effect of
inserting the track at a meaningful place (affects what track is
played next).
d) LoadAndPlay and LoadAndPlayImmediatelly were removed, because
they were replaces with consistency aliases.
3. Thanks to 2b), 2c) and implementation changes, the actual action
performed upon a certain trigger no longer depends on any state.
The state of playlist search no longer affects whether a track will
be played in case of DirectPlay.
4. insertOptioned() was cleaned up and changed, for example it tries
to choose the best place to insert tracks according to
PrependToQueue or Queue.
5. The convenience aliases were assigned as follows:
OnDoubleClickOnSelectedItems = OnReturnPressedOnSelectedItems =
= OnPlayMediaAction = DirectPlay.
OnMiddleClickOnSelectedItems = OnAppendToPlaylistAction = Append (0).
OnReplacePlaylistAction = Replace (no-brainer).
OnQueueToPlaylistAction = Queue (no-brainer).
These aren't of course set in stone, they were however chosen to be
as much consistent with other KDE apps as possible.
Especially the "DirectPlay implies PrependToQueue" change is a bit
controversial, my opinion in that matter is anything but strong and I'm
open to any discussion. But perhaps try to use it for a couple of days
to get over the barrier of change.
CHANGES:
* Playlist-related actions were harmonized: double-clicking, pressing
enter or using any "play media" action will prepend tracks to queue
and immediately start playing; middle-clicking appends to playlist;
append or replace actions will no longer start playback.
CCMAIL: amarok-promo at kde.org
CCMAIL: amarok-devel at kde.org
BUG: 145468
BUG: 145490
BUG: 194549
FIXED-IN: 2.8
GUI: Behavioural change in some places, to increase consistency. Please
check that the docs don't mention the old behaviour, see CHANGES.
DIGEST: Amarok harmonizes playlist-related actions (double-clicking,
pressing Enter, middle clicking...)
M +4 -0 ChangeLog
M +4 -5 playground/src/context/applets/coverbling/CoverBlingApplet.cpp
M +1 -1 playground/src/context/applets/coverbling/CoverBlingApplet.h
M +1 -1 playground/src/context/applets/covergrid/AlbumItem.cpp
M +5 -8 src/App.cpp
M +5 -5 src/MainWindow.cpp
M +1 -1 src/amarokurls/BookmarkTreeView.cpp
M +8 -11 src/browsers/CollectionTreeView.cpp
M +1 -1 src/browsers/CollectionTreeView.h
M +7 -7 src/browsers/filebrowser/FileView.cpp
M +1 -1 src/browsers/playlistbrowser/DynamicView.cpp
M +10 -12 src/browsers/playlistbrowser/PlaylistBrowserView.cpp
M +3 -3 src/browsers/playlistbrowser/PlaylistBrowserView.h
M +12 -6 src/context/applets/albums/AlbumsView.cpp
M +2 -1 src/context/applets/albums/AlbumsView.h
M +2 -2 src/context/applets/similarartists/ArtistWidget.cpp
M +2 -1 src/dbus/mpris1/TrackListHandler.cpp
M +1 -1 src/dbus/mpris2/MediaPlayer2Player.cpp
M +63 -48 src/playlist/PlaylistController.cpp
M +19 -7 src/playlist/PlaylistController.h
M +0 -1 src/playlist/PlaylistModel.cpp
M +12 -18 src/playlist/view/listview/InlineEditorWidget.cpp
M +9 -9 src/playlist/view/listview/PrettyListView.cpp
M +1 -1 src/playlistgenerator/Preset.cpp
M +2 -2 src/scriptengine/AmarokPlaylistScript.cpp
M +1 -1 src/services/amazon/AmazonStore.cpp
M +1 -1 src/services/lastfm/LastFmService.cpp
M +3 -3 src/services/lastfm/LastFmTreeView.cpp
M +1 -1 src/services/lastfm/SimilarArtistsAction.cpp
http://commits.kde.org/amarok/a43e7e6f5a14307f543e7807a8d2351af027635a
diff --git a/ChangeLog b/ChangeLog
index 6057091..602b0d2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -31,6 +31,10 @@ VERSION 2.8-Beta 1
* Added Ctrl+H shortcut to randomize playlist, patch by Harsh Gupta. (BR 208061)
CHANGES:
+ * Playlist-related actions were harmonized: double-clicking, pressing enter or using
+ any "play media" action will prepend tracks to queue and immediately start playing;
+ middle-clicking appends to playlist; append or replace actions will no longer start
+ playback. (BR 145468, BR 145490, BR 194549)
* When a new collection plugin is enabled, its collections appear immediately without a
need for restart.
* Update the MusicBrainz tagger to MusicBrainz web service 2, make it show some more
diff --git a/playground/src/context/applets/coverbling/CoverBlingApplet.cpp b/playground/src/context/applets/coverbling/CoverBlingApplet.cpp
index 9739317..258fad3 100644
--- a/playground/src/context/applets/coverbling/CoverBlingApplet.cpp
+++ b/playground/src/context/applets/coverbling/CoverBlingApplet.cpp
@@ -183,9 +183,9 @@ void CoverBlingApplet::slotAlbumQueryResult( Meta::AlbumList albums ) //SLOT
{
DEBUG_BLOCK
m_pictureflow->fillAlbums( albums );
-
+
connect( m_pictureflow, SIGNAL(centerIndexChanged(int)), this, SLOT(slideChanged(int)) );
- connect( m_pictureflow, SIGNAL(doubleClicked(int)), this, SLOT(appendAlbum(int)) );
+ connect( m_pictureflow, SIGNAL(doubleClicked(int)), this, SLOT(slotDoubleClicked(int)) );
connect( m_blingtofirst, SIGNAL(clicked()), this, SLOT(skipToFirst()) );
connect( m_blingtolast, SIGNAL(clicked()), this, SLOT(skipToLast()) );
connect( m_blingfastback, SIGNAL(clicked()), m_pictureflow, SLOT(fastBackward()) );
@@ -241,12 +241,11 @@ void CoverBlingApplet::slideChanged( int islideindex )
}
}
-void CoverBlingApplet::appendAlbum( int islideindex )
+void CoverBlingApplet::slotDoubleClicked( int islideindex )
{
Meta::AlbumPtr album = m_pictureflow->album( islideindex );
if ( album )
- // this is connected to the doubleClicked signal:
- The::playlistController()->insertOptioned( album->tracks(), Playlist::StartPlay );
+ The::playlistController()->insertOptioned( album->tracks(), Playlist::OnDoubleClickOnSelectedItems );
}
void CoverBlingApplet::constraintsEvent( Plasma::Constraints constraints )
diff --git a/playground/src/context/applets/coverbling/CoverBlingApplet.h b/playground/src/context/applets/coverbling/CoverBlingApplet.h
index 41eb657..a29a40a 100644
--- a/playground/src/context/applets/coverbling/CoverBlingApplet.h
+++ b/playground/src/context/applets/coverbling/CoverBlingApplet.h
@@ -50,7 +50,7 @@ class CoverBlingApplet : public Context::Applet
public slots:
void slotAlbumQueryResult( Meta::AlbumList albums);
void slideChanged( int islideindex );
- void appendAlbum( int islideindex );
+ void slotDoubleClicked( int islideindex );
void toggleFullscreen();
void jumpToPlaying();
void saveSettings();
diff --git a/playground/src/context/applets/covergrid/AlbumItem.cpp b/playground/src/context/applets/covergrid/AlbumItem.cpp
index 333e566..c2c4f88 100644
--- a/playground/src/context/applets/covergrid/AlbumItem.cpp
+++ b/playground/src/context/applets/covergrid/AlbumItem.cpp
@@ -70,7 +70,7 @@ void
AlbumItem::mouseDoubleClickEvent( QMouseEvent *event )
{
Q_UNUSED( event )
- The::playlistController()->insertOptioned( m_album->tracks(), Playlist::StartPlay );
+ The::playlistController()->insertOptioned( m_album->tracks(), Playlist::OnDoubleClickOnSelectedItems );
}
void
diff --git a/src/App.cpp b/src/App.cpp
index dcdd1e6..7ebfbb9 100644
--- a/src/App.cpp
+++ b/src/App.cpp
@@ -285,16 +285,13 @@ App::handleCliArgs() //static
Playlist::AddOptions options;
if( args->isSet( "queue" ) )
- options = Playlist::Queue;
+ options = Playlist::OnQueueToPlaylistAction;
else if( args->isSet( "append" ) )
- options = 0; // append is the default
+ options = Playlist::OnAppendToPlaylistAction;
else if( args->isSet( "load" ) )
- options = Playlist::Replace;
+ options = Playlist::OnReplacePlaylistAction;
else
- options = Playlist::StartPlay;
-
- if( args->isSet( "play" ) )
- options |= Playlist::DirectPlay;
+ options = Playlist::OnPlayMediaAction;
The::playlistController()->insertOptioned( list, options );
}
@@ -605,7 +602,7 @@ bool App::event( QEvent *event )
QString file = static_cast<QFileOpenEvent*>( event )->file();
//we are only going to receive local files here
QList<KUrl> urls = QList<KUrl>() << KUrl( file );
- The::playlistController()->insertOptioned( urls, Playlist::StartPlay );
+ The::playlistController()->insertOptioned( urls, Playlist::OnPlayMediaAction );
return true;
}
default:
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index a1ac027..38472a4 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -555,7 +555,9 @@ MainWindow::slotAddLocation( bool directPlay ) //SLOT
if( files.isEmpty() )
return;
- The::playlistController()->insertOptioned( files, directPlay ? Playlist::DirectPlay : Playlist::StartPlay );
+ Playlist::AddOptions options = directPlay ? Playlist::OnPlayMediaAction
+ : Playlist::OnAppendToPlaylistAction;
+ The::playlistController()->insertOptioned( files, options );
}
void
@@ -569,7 +571,7 @@ MainWindow::slotAddStream() //SLOT
Meta::TrackPtr track = CollectionManager::instance()->trackForUrl( KUrl( url ) );
- The::playlistController()->insertOptioned( track );
+ The::playlistController()->insertOptioned( track, Playlist::OnAppendToPlaylistAction );
}
void
@@ -1374,9 +1376,7 @@ MainWindow::playAudioCd()
return false;
}
- The::engineController()->stop( true );
- The::playlistController()->clear();
- The::playlistController()->insertOptioned( cdColl->trackMap().values(), Playlist::DirectPlay );
+ The::playlistController()->insertOptioned( cdColl->trackMap().values(), Playlist::OnPlayMediaAction );
m_waitingForCd = false;
return true;
}
diff --git a/src/amarokurls/BookmarkTreeView.cpp b/src/amarokurls/BookmarkTreeView.cpp
index 21e36c5..6d6df74 100644
--- a/src/amarokurls/BookmarkTreeView.cpp
+++ b/src/amarokurls/BookmarkTreeView.cpp
@@ -392,7 +392,7 @@ void BookmarkTreeView::slotCreateTimecodeTrack() const
dialog->show();
//now add it to the playlist
- The::playlistController()->insertOptioned( Meta::TrackPtr::staticCast( track ), Playlist::StartPlay );
+ The::playlistController()->insertOptioned( Meta::TrackPtr::staticCast( track ) );
}
void BookmarkTreeView::setProxy( QSortFilterProxyModel *proxy )
diff --git a/src/browsers/CollectionTreeView.cpp b/src/browsers/CollectionTreeView.cpp
index 6ecbd98..b3cbd4f 100644
--- a/src/browsers/CollectionTreeView.cpp
+++ b/src/browsers/CollectionTreeView.cpp
@@ -340,7 +340,7 @@ CollectionTreeView::mouseDoubleClickEvent( QMouseEvent *event )
!wouldExpand )
{
CollectionTreeItem *item = getItemFromIndex( index );
- playChildTracks( item, Playlist::StartPlay );
+ playChildTracks( item, Playlist::OnDoubleClickOnSelectedItems );
event->accept();
return;
}
@@ -368,7 +368,7 @@ CollectionTreeView::mouseReleaseEvent( QMouseEvent *event )
if( event->button() == Qt::MidButton )
{
CollectionTreeItem *item = getItemFromIndex( index );
- playChildTracks( item, Playlist::StartPlay );
+ playChildTracks( item, Playlist::OnMiddleClickOnSelectedItems );
event->accept();
return;
}
@@ -426,7 +426,7 @@ CollectionTreeView::keyPressEvent( QKeyEvent *event )
{
case Qt::Key_Enter:
case Qt::Key_Return:
- slotAppendChildTracks();
+ playChildTracks( m_currentItems, Playlist::OnReturnPressedOnSelectedItems );
return;
case Qt::Key_Delete:
if( !onlyOneCollection( indices ) )
@@ -876,7 +876,7 @@ CollectionTreeView::slotAddFilteredTracksToPlaylist()
items.insert( item );
}
if( !items.isEmpty() )
- playChildTracks( items, 0 );
+ playChildTracks( items, Playlist::OnAppendToPlaylistAction );
emit addingFilteredTracksDone();
}
}
@@ -893,10 +893,7 @@ CollectionTreeView::createBasicActions( const QModelIndexList &indices )
m_appendAction = new QAction( KIcon( "media-track-add-amarok" ),
i18n( "&Add to Playlist" ), this );
m_appendAction->setProperty( "popupdropper_svg_id", "append" );
- // key shortcut is only for display purposes here, actual one is determined by View in Model/View classes
- m_appendAction->setShortcut( Qt::Key_Enter );
- connect( m_appendAction, SIGNAL(triggered()), this,
- SLOT(slotAppendChildTracks()) );
+ connect( m_appendAction, SIGNAL(triggered()), this, SLOT(slotAppendChildTracks()) );
}
actions.append( m_appendAction );
@@ -1170,19 +1167,19 @@ CollectionTreeView::getCollection( const QModelIndex &index )
void
CollectionTreeView::slotReplacePlaylistWithChildTracks()
{
- playChildTracks( m_currentItems, Playlist::LoadAndPlay );
+ playChildTracks( m_currentItems, Playlist::OnReplacePlaylistAction );
}
void
CollectionTreeView::slotAppendChildTracks()
{
- playChildTracks( m_currentItems, Playlist::StartPlay );
+ playChildTracks( m_currentItems, Playlist::OnAppendToPlaylistAction );
}
void
CollectionTreeView::slotQueueChildTracks()
{
- playChildTracks( m_currentItems, Playlist::Queue );
+ playChildTracks( m_currentItems, Playlist::OnQueueToPlaylistAction );
}
void
diff --git a/src/browsers/CollectionTreeView.h b/src/browsers/CollectionTreeView.h
index 2b4a25e..7585df2 100644
--- a/src/browsers/CollectionTreeView.h
+++ b/src/browsers/CollectionTreeView.h
@@ -83,7 +83,7 @@ class CollectionTreeView: public Amarok::PrettyTreeView
void contextMenuEvent( QContextMenuEvent *event );
void mouseDoubleClickEvent( QMouseEvent *event );
void mouseReleaseEvent( QMouseEvent *event );
- void keyPressEvent( QKeyEvent * event );
+ void keyPressEvent( QKeyEvent *event );
void dragEnterEvent( QDragEnterEvent *event );
void dragMoveEvent( QDragMoveEvent *event );
void startDrag( Qt::DropActions supportedActions );
diff --git a/src/browsers/filebrowser/FileView.cpp b/src/browsers/filebrowser/FileView.cpp
index 9b3c500..ad200eb 100644
--- a/src/browsers/filebrowser/FileView.cpp
+++ b/src/browsers/filebrowser/FileView.cpp
@@ -156,7 +156,7 @@ FileView::mouseReleaseEvent( QMouseEvent *event )
if( state() == QAbstractItemView::NoState && event->button() == Qt::MidButton )
{
- addIndexToPlaylist( index, Playlist::StartPlay );
+ addIndexToPlaylist( index, Playlist::OnMiddleClickOnSelectedItems );
event->accept();
return;
}
@@ -198,7 +198,7 @@ FileView::mouseDoubleClickEvent( QMouseEvent *event )
KFileItem file = index.data( KDirModel::FileItemRole ).value<KFileItem>();
KUrl url = file.url();
if( !file.isNull() && ( Playlists::isPlaylist( url ) || MetaFile::Track::isTrack( url ) ) )
- addIndexToPlaylist( index, Playlist::StartPlay );
+ addIndexToPlaylist( index, Playlist::OnDoubleClickOnSelectedItems );
else
emit navigateToDirectory( index );
@@ -218,12 +218,14 @@ FileView::keyPressEvent( QKeyEvent *event )
switch( event->key() )
{
+ case Qt::Key_Enter:
case Qt::Key_Return:
{
KFileItem file = index.data( KDirModel::FileItemRole ).value<KFileItem>();
KUrl url = file.url();
if( !file.isNull() && ( Playlists::isPlaylist( url ) || MetaFile::Track::isTrack( url ) ) )
- addIndexToPlaylist( index, Playlist::StartPlay );
+ // right, we test the current item, but then add the selection to playlist
+ addSelectionToPlaylist( Playlist::OnReturnPressedOnSelectedItems );
else
emit navigateToDirectory( index );
@@ -245,13 +247,13 @@ FileView::keyPressEvent( QKeyEvent *event )
void
FileView::slotAppendToPlaylist()
{
- addSelectionToPlaylist( Playlist::StartPlay );
+ addSelectionToPlaylist( Playlist::OnAppendToPlaylistAction );
}
void
FileView::slotReplacePlaylist()
{
- addSelectionToPlaylist( Playlist::Replace );
+ addSelectionToPlaylist( Playlist::OnReplacePlaylistAction );
}
void
@@ -382,8 +384,6 @@ FileView::actionsForIndices( const QModelIndexList &indices, ActionType type )
m_appendAction = new QAction( KIcon( "media-track-add-amarok" ), i18n( "&Add to Playlist" ),
this );
m_appendAction->setProperty( "popupdropper_svg_id", "append" );
- // key shortcut is only for display purposes here, actual one is determined by View in Model/View classes
- m_appendAction->setShortcut( Qt::Key_Enter );
connect( m_appendAction, SIGNAL(triggered()), this, SLOT(slotAppendToPlaylist()) );
}
if( type & PlaylistAction )
diff --git a/src/browsers/playlistbrowser/DynamicView.cpp b/src/browsers/playlistbrowser/DynamicView.cpp
index 3f6376f..a1a0205 100644
--- a/src/browsers/playlistbrowser/DynamicView.cpp
+++ b/src/browsers/playlistbrowser/DynamicView.cpp
@@ -170,8 +170,8 @@ PlaylistBrowserNS::DynamicView::keyPressEvent( QKeyEvent *event )
case Qt::Key_Delete:
removeSelected();
return;
- case Qt::Key_Return:
case Qt::Key_Enter:
+ case Qt::Key_Return:
editSelected();
return;
}
diff --git a/src/browsers/playlistbrowser/PlaylistBrowserView.cpp b/src/browsers/playlistbrowser/PlaylistBrowserView.cpp
index 0a0083f..bd4f6d6 100644
--- a/src/browsers/playlistbrowser/PlaylistBrowserView.cpp
+++ b/src/browsers/playlistbrowser/PlaylistBrowserView.cpp
@@ -69,8 +69,6 @@ PlaylistBrowserNS::PlaylistBrowserView::PlaylistBrowserView( QAbstractItemModel
m_appendAction = new QAction( KIcon( "media-track-add-amarok" ),
i18n( "&Add to Playlist" ), this );
- // key shortcut is only for display purposes here, actual one is determined by View in Model/View classes
- m_appendAction->setShortcut( Qt::Key_Enter );
m_appendAction->setProperty( "popupdropper_svg_id", "append" );
connect( m_appendAction, SIGNAL(triggered()), this, SLOT(slotAppend()) );
@@ -143,7 +141,7 @@ PlaylistBrowserNS::PlaylistBrowserView::mouseReleaseEvent( QMouseEvent *event )
if( event->button() == Qt::MidButton )
{
- appendAndPlay( index );
+ insertIntoPlaylist( index, Playlist::OnMiddleClickOnSelectedItems );
event->accept();
return;
}
@@ -200,7 +198,7 @@ PlaylistBrowserNS::PlaylistBrowserView::keyPressEvent( QKeyEvent *event )
//activated() only works for current index, not all selected
case Qt::Key_Enter:
case Qt::Key_Return:
- appendAndPlay( indices );
+ insertIntoPlaylist( indices, Playlist::OnReturnPressedOnSelectedItems );
return;
case Qt::Key_Delete:
{
@@ -243,7 +241,7 @@ PlaylistBrowserNS::PlaylistBrowserView::mouseDoubleClickEvent( QMouseEvent *even
event->modifiers() == Qt::NoModifier &&
!wouldExpand )
{
- appendAndPlay( index );
+ insertIntoPlaylist( index, Playlist::OnDoubleClickOnSelectedItems );
event->accept();
return;
}
@@ -418,13 +416,13 @@ PlaylistBrowserView::slotCreateEmptyPlaylist()
void
PlaylistBrowserView::slotAppend()
{
- insertToPlayQueue( Playlist::StartPlay );
+ insertIntoPlaylist( Playlist::OnAppendToPlaylistAction );
}
void
PlaylistBrowserView::slotLoad()
{
- insertToPlayQueue( Playlist::LoadAndPlay );
+ insertIntoPlaylist( Playlist::OnReplacePlaylistAction );
}
void
@@ -539,21 +537,21 @@ PlaylistBrowserView::slotExport()
}
void
-PlaylistBrowserNS::PlaylistBrowserView::appendAndPlay( const QModelIndex &index )
+PlaylistBrowserView::insertIntoPlaylist( const QModelIndex &index, Playlist::AddOptions options )
{
- appendAndPlay( QModelIndexList() << index );
+ insertIntoPlaylist( QModelIndexList() << index, options );
}
void
-PlaylistBrowserNS::PlaylistBrowserView::appendAndPlay( const QModelIndexList &list )
+PlaylistBrowserView::insertIntoPlaylist( const QModelIndexList &list, Playlist::AddOptions options )
{
actionsFor( list ); // sets action targets
- insertToPlayQueue( Playlist::StartPlay );
+ insertIntoPlaylist( options );
resetActionTargets();
}
void
-PlaylistBrowserView::insertToPlayQueue( Playlist::AddOptions options )
+PlaylistBrowserView::insertIntoPlaylist( Playlist::AddOptions options )
{
Meta::TrackList tracks;
diff --git a/src/browsers/playlistbrowser/PlaylistBrowserView.h b/src/browsers/playlistbrowser/PlaylistBrowserView.h
index bc2eb20..e5eb057 100644
--- a/src/browsers/playlistbrowser/PlaylistBrowserView.h
+++ b/src/browsers/playlistbrowser/PlaylistBrowserView.h
@@ -68,9 +68,9 @@ private slots:
void slotExport();
private:
- void appendAndPlay( const QModelIndex &index );
- void appendAndPlay( const QModelIndexList &list );
- void insertToPlayQueue( Playlist::AddOptions options );
+ void insertIntoPlaylist( const QModelIndex &index, Playlist::AddOptions options );
+ void insertIntoPlaylist( const QModelIndexList &list, Playlist::AddOptions options );
+ void insertIntoPlaylist( Playlist::AddOptions options );
/**
* Gets action for a list of indices and sets internal action targets to these.
diff --git a/src/context/applets/albums/AlbumsView.cpp b/src/context/applets/albums/AlbumsView.cpp
index 9e5a004..088c844 100644
--- a/src/context/applets/albums/AlbumsView.cpp
+++ b/src/context/applets/albums/AlbumsView.cpp
@@ -113,7 +113,7 @@ AlbumsView::AlbumsView( QGraphicsWidget *parent )
m_treeProxy = new QGraphicsProxyWidget( this );
m_treeView = new AlbumsTreeView( 0 );
connect( m_treeView, SIGNAL(clicked(QModelIndex)), this, SLOT(itemClicked(QModelIndex)) );
- connect( m_treeView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(slotAppendSelected()) );
+ connect( m_treeView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(slotDoubleClicked()) );
m_treeProxy->setWidget( m_treeView );
m_model = new AlbumsModel( this );
@@ -249,7 +249,7 @@ AlbumsView::contextMenuEvent( QGraphicsSceneContextMenuEvent *event )
menu.addAction( editAction );
connect( appendAction, SIGNAL(triggered()), this, SLOT(slotAppendSelected()) );
- connect( loadAction , SIGNAL(triggered()), this, SLOT(slotPlaySelected()) );
+ connect( loadAction , SIGNAL(triggered()), this, SLOT(slotReplaceWithSelected()) );
connect( queueAction , SIGNAL(triggered()), this, SLOT(slotQueueSelected()) );
connect( editAction , SIGNAL(triggered()), this, SLOT(slotEditSelected()) );
@@ -295,25 +295,31 @@ AlbumsView::resizeEvent( QGraphicsSceneResizeEvent *event )
}
}
+void AlbumsView::slotDoubleClicked()
+{
+ Meta::TrackList selected = getSelectedTracks();
+ The::playlistController()->insertOptioned( selected, Playlist::OnDoubleClickOnSelectedItems );
+}
+
void
AlbumsView::slotAppendSelected()
{
Meta::TrackList selected = getSelectedTracks();
- The::playlistController()->insertOptioned( selected, Playlist::StartPlay );
+ The::playlistController()->insertOptioned( selected, Playlist::OnAppendToPlaylistAction );
}
void
-AlbumsView::slotPlaySelected()
+AlbumsView::slotReplaceWithSelected()
{
Meta::TrackList selected = getSelectedTracks();
- The::playlistController()->insertOptioned( selected, Playlist::LoadAndPlay );
+ The::playlistController()->insertOptioned( selected, Playlist::OnReplacePlaylistAction );
}
void
AlbumsView::slotQueueSelected()
{
Meta::TrackList selected = getSelectedTracks();
- The::playlistController()->insertOptioned( selected, Playlist::Queue );
+ The::playlistController()->insertOptioned( selected, Playlist::OnQueueToPlaylistAction );
}
void
diff --git a/src/context/applets/albums/AlbumsView.h b/src/context/applets/albums/AlbumsView.h
index 5ea4e5b..ac9341a 100644
--- a/src/context/applets/albums/AlbumsView.h
+++ b/src/context/applets/albums/AlbumsView.h
@@ -70,9 +70,10 @@ protected:
private slots:
void itemClicked( const QModelIndex &index );
+ void slotDoubleClicked();
void slotAppendSelected();
void slotEditSelected();
- void slotPlaySelected();
+ void slotReplaceWithSelected();
void slotQueueSelected();
void slotScrollBarRangeChanged( int min, int max );
diff --git a/src/context/applets/similarartists/ArtistWidget.cpp b/src/context/applets/similarartists/ArtistWidget.cpp
index da97df4..511f641 100644
--- a/src/context/applets/similarartists/ArtistWidget.cpp
+++ b/src/context/applets/similarartists/ArtistWidget.cpp
@@ -559,7 +559,7 @@ ArtistWidget::fullBio() const
void
ArtistWidget::addTopTrackToPlaylist()
{
- The::playlistController()->insertOptioned( m_topTrack, Playlist::StartPlay );
+ The::playlistController()->insertOptioned( m_topTrack, Playlist::OnAppendToPlaylistAction );
}
void
@@ -577,7 +577,7 @@ ArtistWidget::addLastfmArtistStation()
{
const QString url = "lastfm://artist/" + m_artist->name() + "/similarartists";
Meta::TrackPtr lastfmtrack = CollectionManager::instance()->trackForUrl( KUrl( url ) );
- The::playlistController()->insertOptioned( lastfmtrack, Playlist::StartPlay );
+ The::playlistController()->insertOptioned( lastfmtrack, Playlist::OnAppendToPlaylistAction );
}
ArtistsListWidget::ArtistsListWidget( QGraphicsWidget *parent )
diff --git a/src/dbus/mpris1/TrackListHandler.cpp b/src/dbus/mpris1/TrackListHandler.cpp
index b472425..b1f01cf 100644
--- a/src/dbus/mpris1/TrackListHandler.cpp
+++ b/src/dbus/mpris1/TrackListHandler.cpp
@@ -47,7 +47,8 @@ namespace Mpris1
Meta::TrackPtr track = CollectionManager::instance()->trackForUrl( url );
if( track )
{
- Playlist::AddOptions options = playImmediately ? Playlist::DirectPlay : Playlist::AddOptions();
+ Playlist::AddOptions options = playImmediately ?
+ Playlist::OnPlayMediaAction : Playlist::OnAppendToPlaylistAction;
The::playlistController()->insertOptioned( track, options );
return 0;
}
diff --git a/src/dbus/mpris2/MediaPlayer2Player.cpp b/src/dbus/mpris2/MediaPlayer2Player.cpp
index 681bc29..4d2691a 100644
--- a/src/dbus/mpris2/MediaPlayer2Player.cpp
+++ b/src/dbus/mpris2/MediaPlayer2Player.cpp
@@ -171,7 +171,7 @@ void MediaPlayer2Player::SetPosition( const QDBusObjectPath& TrackId, qlonglong
void MediaPlayer2Player::OpenUri( QString Uri ) const
{
KUrl url( Uri );
- The::playlistController()->insertOptioned( KUrl::List() << url, Playlist::DirectPlay );
+ The::playlistController()->insertOptioned( KUrl::List() << url, Playlist::OnPlayMediaAction );
}
QString MediaPlayer2Player::PlaybackStatus() const
diff --git a/src/playlist/PlaylistController.cpp b/src/playlist/PlaylistController.cpp
index 1c7b56a..95d2b82 100644
--- a/src/playlist/PlaylistController.cpp
+++ b/src/playlist/PlaylistController.cpp
@@ -25,18 +25,18 @@
#include "PlaylistController.h"
-#include "amarokconfig.h"
-#include "core/support/Debug.h"
#include "EngineController.h"
+#include "amarokconfig.h"
#include "core/collections/QueryMaker.h"
+#include "core/support/Debug.h"
#include "core-impl/meta/cue/CueFileSupport.h"
+#include "core-impl/meta/file/File.h"
+#include "core-impl/meta/multi/MultiTrack.h"
+#include "core-impl/playlists/types/file/PlaylistFileSupport.h"
+#include "core-impl/support/TrackLoader.h"
#include "playlist/PlaylistActions.h"
#include "playlist/PlaylistModelStack.h"
#include "playlistmanager/PlaylistManager.h"
-#include "core-impl/playlists/types/file/PlaylistFileSupport.h"
-#include "core-impl/meta/multi/MultiTrack.h"
-#include "core-impl/meta/file/File.h"
-#include "core-impl/support/TrackLoader.h"
#include <QAction>
@@ -99,8 +99,7 @@ Controller::~Controller() {}
void
Controller::insertOptioned( Meta::TrackPtr track, AddOptions options )
{
- DEBUG_BLOCK
- if( ! track )
+ if( !track )
return;
Meta::TrackList list;
@@ -112,18 +111,25 @@ void
Controller::insertOptioned( Meta::TrackList list, AddOptions options )
{
DEBUG_BLOCK
+ /* Note: don't use (options & flag) here to test whether flag is present in options.
+ * We have compound flags and for example (Queue & DirectPlay) == Queue, which
+ * evaluates to true, which isn't usually what you want.
+ *
+ * Use (options & flag == flag) instead, or rather QFlag's convenience method:
+ * options.testFlag( flag )
+ */
if( list.isEmpty() )
return;
QString actionName = i18nc( "name of the action in undo stack", "Add tracks to playlist" );
- if( options & Queue )
+ if( options.testFlag( Queue ) )
actionName = i18nc( "name of the action in undo stack", "Queue tracks" );
- if( options & Replace )
+ if( options.testFlag( Replace ) )
actionName = i18nc( "name of the action in undo stack", "Replace playlist" );
m_undoStack->beginMacro( actionName );
- if( options & Replace )
+ if( options.testFlag( Replace ) )
{
emit replacingPlaylist(); //make sure that we clear filters
clear();
@@ -133,29 +139,38 @@ Controller::insertOptioned( Meta::TrackList list, AddOptions options )
int bottomModelRowCount = m_bottomModel->qaim()->rowCount();
int bottomModelInsertRow;
- if( options & Queue )
+ if( options.testFlag( Queue ) )
{
// queue is a list of playlist item ids
QQueue<quint64> queue = Actions::instance()->queue();
- if( !queue.isEmpty() )
+ int activeRow = m_bottomModel->activeRow();
+
+ if( options.testFlag( PrependToQueue ) )
{
- int lastQueueRow = m_bottomModel->rowForId( queue.last() );
- bottomModelInsertRow = ( lastQueueRow >= 0 ) ? lastQueueRow + 1 : bottomModelRowCount;
+ if( activeRow >= 0 )
+ bottomModelInsertRow = activeRow + 1; // right after active track
+ else if( !queue.isEmpty() )
+ bottomModelInsertRow = m_bottomModel->rowForId( queue.first() ); // prepend to queue
+ else
+ bottomModelInsertRow = bottomModelRowCount; // fallback: append to end
}
- else
+ else // append to queue
{
- int activeRow = m_bottomModel->activeRow();
- bottomModelInsertRow = ( activeRow >= 0 ) ? activeRow + 1 : bottomModelRowCount;
+ if( !queue.isEmpty() )
+ bottomModelInsertRow = m_bottomModel->rowForId( queue.last() ) + 1; // after queue
+ else if( activeRow >= 0 )
+ bottomModelInsertRow = activeRow + 1; // after active track
+ else
+ bottomModelInsertRow = bottomModelRowCount; // fallback: append to end
}
}
else
- bottomModelInsertRow = m_bottomModel->qaim()->rowCount();
+ bottomModelInsertRow = bottomModelRowCount;
- int oldVisibleRowCount = m_topModel->qaim()->rowCount();
+ // this guy does the thing:
insertionHelper( bottomModelInsertRow, list );
- int visibleInsertedRowCount = m_topModel->qaim()->rowCount() - oldVisibleRowCount;
- if( options & Queue )
+ if( options.testFlag( Queue ) )
{
// Construct list of rows to be queued
QList<quint64> ids;
@@ -164,34 +179,24 @@ Controller::insertOptioned( Meta::TrackList list, AddOptions options )
{
ids << m_bottomModel->idAt( bottomModelRow );
}
- Actions::instance()->queue( ids );
- }
- m_undoStack->endMacro();
- bool playNow = false;
- if( options & DirectPlay )
- playNow = true;
+ if( options.testFlag( PrependToQueue ) ) // PrependToQueue implies Queue
+ {
+ // append current queue to new queue and remove it
+ foreach( const quint64 id, Actions::instance()->queue() )
+ {
+ Actions::instance()->dequeue( id );
+ ids << id;
+ }
+ }
- if( options & StartPlay )
- {
- bool isDynamic = AmarokConfig::dynamicMode();
- bool isPaused = The::engineController()->isPaused();
- bool isPlaying = The::engineController()->isPlaying();
-
- // when not in dyanmic mode: start playing when paused
- // when in dyanmic mode: do not start playing when paused
- if( !isPlaying && (!isDynamic || (isDynamic && !isPaused)) )
- playNow = true;
+ Actions::instance()->queue( ids );
}
- if( playNow && visibleInsertedRowCount > 0 )
- {
- int fuzz = 0;
- if ( AmarokConfig::trackProgression() == AmarokConfig::EnumTrackProgression::RandomTrack ||
- AmarokConfig::trackProgression() == AmarokConfig::EnumTrackProgression::RandomAlbum )
- fuzz = qrand() % visibleInsertedRowCount;
- Actions::instance()->play( m_topModel->rowFromBottomModel( bottomModelInsertRow ) + fuzz );
- }
+ m_undoStack->endMacro();
+
+ if( options.testFlag( DirectPlay ) ) // implies PrependToQueue
+ Actions::instance()->requestUserNextTrack(); // inserted track will be first in queue
emit changed();
}
@@ -206,7 +211,7 @@ void
Controller::insertOptioned( Playlists::PlaylistList list, AddOptions options )
{
// if we are going to play, we need full metadata (playable tracks)
- TrackLoader::Flags flags = ( options & ( StartPlay | DirectPlay ) )
+ TrackLoader::Flags flags = ( options.testFlag( DirectPlay ) )
? TrackLoader::FullMetadataRequired : TrackLoader::NoFlags;
TrackLoader *loader = new TrackLoader( flags ); // auto-deletes itself
loader->setProperty( "options", QVariant::fromValue<AddOptions>( options ) );
@@ -219,7 +224,7 @@ void
Controller::insertOptioned( QList<KUrl> &urls, AddOptions options )
{
// if we are going to play, we need full metadata (playable tracks)
- TrackLoader::Flags flags = ( options & ( StartPlay | DirectPlay ) )
+ TrackLoader::Flags flags = ( options.testFlag( DirectPlay ) )
? TrackLoader::FullMetadataRequired : TrackLoader::NoFlags;
TrackLoader *loader = new TrackLoader( flags ); // auto-deletes itself
loader->setProperty( "options", QVariant::fromValue<AddOptions>( options ) );
@@ -259,6 +264,16 @@ Controller::insertPlaylists( int topModelRow, Playlists::PlaylistList playlists
}
void
+Controller::insertUrls( int topModelRow, QList<KUrl> &urls )
+{
+ TrackLoader *loader = new TrackLoader(); // auto-deletes itself
+ loader->setProperty( "topModelRow", QVariant( topModelRow ) );
+ connect( loader, SIGNAL(finished(Meta::TrackList)),
+ SLOT(slotLoaderWithRowFinished(Meta::TrackList)) );
+ loader->init( urls );
+}
+
+void
Controller::removeRow( int topModelRow )
{
DEBUG_BLOCK
diff --git a/src/playlist/PlaylistController.h b/src/playlist/PlaylistController.h
index a70b55f..6ecf304 100644
--- a/src/playlist/PlaylistController.h
+++ b/src/playlist/PlaylistController.h
@@ -41,13 +41,24 @@ class AbstractModel;
*/
enum AddOption
{
- Queue = 1, ///< inserts media after the currentTrack instead of default appending
- Replace = 2, ///< replaces the playlists instead of default appending (or queueing)
- DirectPlay = 4, ///< start playback of the first item in the list
- StartPlay = 8, ///< start playback of the first item in the list if nothing else playing
-
- LoadAndPlay = Replace | StartPlay,
- LoadAndPlayImmediately = Replace | DirectPlay ///< replace and begin playing of new item
+ Replace = 1, ///< replaces the playlist instead of default appending (or queueing)
+ Queue = 2, ///< inserts media into the queue after the currentTrack instead of default
+ /// appending to the end of the playlist
+ PrependToQueue = Queue | 4, ///< prepends media to the queue (after current track), implies Queue
+ DirectPlay = PrependToQueue | 8, ///< start playback of the first item in the list, implies PrependToQueue
+
+ // following are "consistency convenience enums" so that it is easy for us to make the
+ // bahaviour of similarly-looking UI elements the same. These enums are the preferred
+ // ones on calling sites. Feel free to add a new one if you find another UI element
+ // that appears on multiple places. Prefix these with On*.
+ OnDoubleClickOnSelectedItems = DirectPlay,
+ OnMiddleClickOnSelectedItems = 0, // append
+ OnReturnPressedOnSelectedItems = OnDoubleClickOnSelectedItems, // these should be kept same
+
+ OnPlayMediaAction = OnDoubleClickOnSelectedItems,
+ OnAppendToPlaylistAction = 0, // no-brainer, just for consistency, applied to popup-dropper too
+ OnReplacePlaylistAction = Replace, // ditto
+ OnQueueToPlaylistAction = Queue,
};
Q_DECLARE_FLAGS( AddOptions, AddOption )
@@ -104,6 +115,7 @@ public slots:
void insertTracks( int topModelRow, Meta::TrackList list );
void insertPlaylist( int topModelRow, Playlists::PlaylistPtr playlist );
void insertPlaylists( int topModelRow, Playlists::PlaylistList playlists );
+ void insertUrls( int topModelRow, QList<KUrl> &urls );
/**
* Handles the removal of a single track from the playlist.
diff --git a/src/playlist/PlaylistModel.cpp b/src/playlist/PlaylistModel.cpp
index aa34c2b..a562bdb 100644
--- a/src/playlist/PlaylistModel.cpp
+++ b/src/playlist/PlaylistModel.cpp
@@ -636,7 +636,6 @@ Playlist::Model::mimeData( const QModelIndexList &indexes ) const
bool
Playlist::Model::dropMimeData( const QMimeData* data, Qt::DropAction action, int row, int, const QModelIndex &parent )
{
- DEBUG_BLOCK
if ( action == Qt::IgnoreAction )
return true;
diff --git a/src/playlist/view/listview/InlineEditorWidget.cpp b/src/playlist/view/listview/InlineEditorWidget.cpp
index 727fb71..cd9c9d9 100644
--- a/src/playlist/view/listview/InlineEditorWidget.cpp
+++ b/src/playlist/view/listview/InlineEditorWidget.cpp
@@ -394,36 +394,30 @@ bool
InlineEditorWidget::eventFilter( QObject *obj, QEvent *event )
{
QList<QWidget *> editWidgets = m_editorRoleMap.keys();
-
- QWidget * widget = qobject_cast<QWidget *>( obj );
-
+ QWidget *widget = qobject_cast<QWidget *>( obj );
if( editWidgets.contains( widget ) )
{
if( event->type() == QEvent::KeyPress )
{
- QKeyEvent * keyEvent = static_cast<QKeyEvent *>( event );
- if( keyEvent->key() == Qt::Key_Return )
+ QKeyEvent *keyEvent = static_cast<QKeyEvent *>( event );
+ switch( keyEvent->key() )
{
- debug() << "InlineEditorWidget ate a return press for a child widget";
- if( widget )
- {
- widget->clearFocus ();
- debug() << "emitting editingDone!";
- emit editingDone( this );
- }
-
- return true;
+ case Qt::Key_Enter:
+ case Qt::Key_Return:
+ if( widget )
+ {
+ widget->clearFocus();
+ emit editingDone( this );
+ }
+ return true;
}
- else
- return false;
+ return false;
}
else
return false;
-
}
else
return KHBox::eventFilter( obj, event );
}
#include "InlineEditorWidget.moc"
-
diff --git a/src/playlist/view/listview/PrettyListView.cpp b/src/playlist/view/listview/PrettyListView.cpp
index 30c465e..8723875 100644
--- a/src/playlist/view/listview/PrettyListView.cpp
+++ b/src/playlist/view/listview/PrettyListView.cpp
@@ -519,19 +519,19 @@ Playlist::PrettyListView::dropEvent( QDropEvent* event )
}
void
-Playlist::PrettyListView::keyPressEvent( QKeyEvent* event )
+Playlist::PrettyListView::keyPressEvent( QKeyEvent *event )
{
- if ( event->matches( QKeySequence::Delete ) )
+ if( event->matches( QKeySequence::Delete ) )
{
removeSelection();
event->accept();
}
- else if ( event->key() == Qt::Key_Return )
+ else if( event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return )
{
trackActivated( currentIndex() );
event->accept();
}
- else if ( event->matches( QKeySequence::SelectAll ) )
+ else if( event->matches( QKeySequence::SelectAll ) )
{
QModelIndex topIndex = model()->index( 0, 0 );
QModelIndex bottomIndex = model()->index( model()->rowCount() - 1, 0 );
@@ -540,9 +540,7 @@ Playlist::PrettyListView::keyPressEvent( QKeyEvent* event )
event->accept();
}
else
- {
QListView::keyPressEvent( event );
- }
}
void
@@ -589,9 +587,11 @@ Playlist::PrettyListView::mousePressEvent( QMouseEvent* event )
KUrl url( QApplication::clipboard()->text() );
if ( url.isValid() )
{
- QList<KUrl> list;
- list.append( url );
- The::playlistController()->insertOptioned( list, Playlist::StartPlay );
+ QList<KUrl> urls = QList<KUrl>() << url;
+ if( index.isValid() )
+ The::playlistController()->insertUrls( index.row() + 1, urls );
+ else
+ The::playlistController()->insertOptioned( urls, Playlist::OnAppendToPlaylistAction );
}
}
diff --git a/src/playlistgenerator/Preset.cpp b/src/playlistgenerator/Preset.cpp
index 98411e0..f670647 100644
--- a/src/playlistgenerator/Preset.cpp
+++ b/src/playlistgenerator/Preset.cpp
@@ -150,7 +150,7 @@ APG::Preset::solverFinished( ThreadWeaver::Job* job )
"try loosening or removing some constraints and then generating a "
"new playlist.") );
}
- The::playlistController()->insertOptioned( solver->getSolution(), Playlist::Replace );
+ The::playlistController()->insertOptioned( solver->getSolution(), Playlist::OnReplacePlaylistAction );
} else {
debug() << "Ignoring results from aborted Solver" << solver->serial();
}
diff --git a/src/scriptengine/AmarokPlaylistScript.cpp b/src/scriptengine/AmarokPlaylistScript.cpp
index 29e8b35..63150c0 100644
--- a/src/scriptengine/AmarokPlaylistScript.cpp
+++ b/src/scriptengine/AmarokPlaylistScript.cpp
@@ -95,7 +95,7 @@ void
AmarokPlaylistScript::playMedia( const QUrl &url )
{
QList<KUrl> list = QList<KUrl>() << url;
- The::playlistController()->insertOptioned( list, Playlist::DirectPlay );
+ The::playlistController()->insertOptioned( list, Playlist::OnPlayMediaAction );
}
void
@@ -104,7 +104,7 @@ AmarokPlaylistScript::playMediaList(const QVariantList& urls)
QList<KUrl> list;
foreach( const QVariant &url, urls )
list << url.toUrl();
- The::playlistController()->insertOptioned( list, Playlist::DirectPlay );
+ The::playlistController()->insertOptioned( list, Playlist::OnPlayMediaAction );
}
void
diff --git a/src/services/amazon/AmazonStore.cpp b/src/services/amazon/AmazonStore.cpp
index a42d7d7..50e6ace 100644
--- a/src/services/amazon/AmazonStore.cpp
+++ b/src/services/amazon/AmazonStore.cpp
@@ -272,7 +272,7 @@ AmazonStore::itemDoubleClicked( QModelIndex index )
Meta::TrackPtr trackPtr( track );
- The::playlistController()->instance()->insertOptioned( trackPtr );
+ The::playlistController()->instance()->insertOptioned( trackPtr, Playlist::OnDoubleClickOnSelectedItems );
}
}
diff --git a/src/services/lastfm/LastFmService.cpp b/src/services/lastfm/LastFmService.cpp
index 3dd135c..4c100c4 100644
--- a/src/services/lastfm/LastFmService.cpp
+++ b/src/services/lastfm/LastFmService.cpp
@@ -528,7 +528,7 @@ void LastFmService::playCustomStation()
void LastFmService::playLastFmStation( const KUrl &url )
{
Meta::TrackPtr track = CollectionManager::instance()->trackForUrl( url );
- The::playlistController()->insertOptioned( track, Playlist::StartPlay );
+ The::playlistController()->insertOptioned( track, Playlist::OnPlayMediaAction );
}
Collections::Collection * LastFmService::collection()
diff --git a/src/services/lastfm/LastFmTreeView.cpp b/src/services/lastfm/LastFmTreeView.cpp
index 292f2a1..99ed50e 100644
--- a/src/services/lastfm/LastFmTreeView.cpp
+++ b/src/services/lastfm/LastFmTreeView.cpp
@@ -122,7 +122,7 @@ void LastFmTreeView::mouseDoubleClickEvent( QMouseEvent *event )
if( index.isValid() && index.internalPointer() )
{
- playChildTracks( index, Playlist::StartPlay );
+ playChildTracks( index, Playlist::OnDoubleClickOnSelectedItems );
}
}
@@ -209,13 +209,13 @@ LastFmTreeView::startDrag(Qt::DropActions supportedActions)
void
LastFmTreeView::slotReplacePlaylistByChildTracks()
{
- playChildTracks ( m_currentItems, Playlist::LoadAndPlay );
+ playChildTracks( m_currentItems, Playlist::OnReplacePlaylistAction );
}
void
LastFmTreeView::slotAppendChildTracks()
{
- playChildTracks ( m_currentItems, Playlist::StartPlay );
+ playChildTracks( m_currentItems, Playlist::OnAppendToPlaylistAction );
}
void
diff --git a/src/services/lastfm/SimilarArtistsAction.cpp b/src/services/lastfm/SimilarArtistsAction.cpp
index 7fafd4c..e71828a 100644
--- a/src/services/lastfm/SimilarArtistsAction.cpp
+++ b/src/services/lastfm/SimilarArtistsAction.cpp
@@ -35,7 +35,7 @@ void SimilarArtistsAction::slotTriggered()
{
const QString url = "lastfm://artist/" + artist()->prettyName() + "/similarartists";
Meta::TrackPtr lastfmtrack = CollectionManager::instance()->trackForUrl( KUrl( url ) );
- The::playlistController()->insertOptioned( lastfmtrack, Playlist::StartPlay );
+ The::playlistController()->insertOptioned( lastfmtrack, Playlist::OnPlayMediaAction );
}
#include "SimilarArtistsAction.moc"
More information about the kde-doc-english
mailing list