Add an "Enqueue to playlist" menu item. Thanks bendarb. Fixes issue #980

This commit is contained in:
David Sansome 2010-12-29 15:08:43 +00:00
parent 9c03677143
commit ca032eb445
53 changed files with 202 additions and 32 deletions

View File

@ -175,6 +175,8 @@ void LibraryView::contextMenuEvent(QContextMenuEvent *e) {
tr("Load"), this, SLOT(Load()));
add_to_playlist_ = context_menu_->addAction(IconLoader::Load("media-playback-start"),
tr("Add to playlist"), this, SLOT(AddToPlaylist()));
add_to_playlist_enqueue_ = context_menu_->addAction(IconLoader::Load("media-playback-start"),
tr("Enqueue to playlist"), this, SLOT(AddToPlaylistEnqueue()));
context_menu_->addSeparator();
new_smart_playlist_ = context_menu_->addAction(IconLoader::Load("document-new"),
@ -290,6 +292,13 @@ void LibraryView::AddToPlaylist() {
emit AddToPlaylist(selectedIndexes());
}
void LibraryView::AddToPlaylistEnqueue() {
if (!context_menu_index_.isValid())
return;
emit AddToPlaylistEnqueue(selectedIndexes());
}
void LibraryView::keyboardSearch(const QString& search) {
is_in_keyboard_search_ = true;
QTreeView::keyboardSearch(search);

View File

@ -68,6 +68,7 @@ class LibraryView : public AutoExpandingTreeView {
void ShowConfigDialog();
void Load(const QModelIndexList& indexes);
void AddToPlaylist(const QModelIndexList& indexes);
void AddToPlaylistEnqueue(const QModelIndexList& indexes);
protected:
// QWidget
@ -79,6 +80,7 @@ class LibraryView : public AutoExpandingTreeView {
private slots:
void Load();
void AddToPlaylist();
void AddToPlaylistEnqueue();
void Organise();
void CopyToDevice();
void Delete();
@ -113,6 +115,7 @@ class LibraryView : public AutoExpandingTreeView {
QModelIndex context_menu_index_;
QAction* load_;
QAction* add_to_playlist_;
QAction* add_to_playlist_enqueue_;
QAction* organise_;
QAction* copy_to_device_;
QAction* delete_;

View File

@ -121,12 +121,13 @@ Playlist::~Playlist() {
}
template<typename T>
QModelIndex InsertSongItems(Playlist* playlist, const SongList& songs, int pos) {
static QModelIndex InsertSongItems(Playlist* playlist, const SongList& songs,
int pos, bool enqueue = false) {
PlaylistItemList items;
foreach (const Song& song, songs) {
items << PlaylistItemPtr(new T(song));
}
return playlist->InsertItems(items, pos);
return playlist->InsertItems(items, pos, enqueue);
}
QVariant Playlist::headerData(int section, Qt::Orientation, int role) const {
@ -765,18 +766,18 @@ void Playlist::MoveItemsWithoutUndo(int start, const QList<int>& dest_rows) {
Save();
}
QModelIndex Playlist::InsertItems(const PlaylistItemList& items, int pos) {
QModelIndex Playlist::InsertItems(const PlaylistItemList& items, int pos, bool enqueue) {
if (items.isEmpty())
return QModelIndex();
const int start = pos == -1 ? items_.count() : pos;
undo_stack_->push(new PlaylistUndoCommands::InsertItems(this, items, pos));
undo_stack_->push(new PlaylistUndoCommands::InsertItems(this, items, pos, enqueue));
return index(start, 0);
}
QModelIndex Playlist::InsertItemsWithoutUndo(const PlaylistItemList& items,
int pos) {
int pos, bool enqueue) {
if (items.isEmpty())
return QModelIndex();
@ -804,21 +805,29 @@ QModelIndex Playlist::InsertItemsWithoutUndo(const PlaylistItemList& items,
}
endInsertRows();
if (enqueue) {
QModelIndexList indexes;
for (int i=start ; i<=end ; ++i) {
indexes << index(i, 0);
}
queue_->ToggleTracks(indexes);
}
Save();
ReshuffleIndices();
return index(start, 0);
}
QModelIndex Playlist::InsertLibraryItems(const SongList& songs, int pos) {
return InsertSongItems<LibraryPlaylistItem>(this, songs, pos);
QModelIndex Playlist::InsertLibraryItems(const SongList& songs, int pos, bool enqueue) {
return InsertSongItems<LibraryPlaylistItem>(this, songs, pos, enqueue);
}
QModelIndex Playlist::InsertSongs(const SongList& songs, int pos) {
return InsertSongItems<SongPlaylistItem>(this, songs, pos);
QModelIndex Playlist::InsertSongs(const SongList& songs, int pos, bool enqueue) {
return InsertSongItems<SongPlaylistItem>(this, songs, pos, enqueue);
}
QModelIndex Playlist::InsertSongsOrLibraryItems(const SongList& songs, int pos) {
QModelIndex Playlist::InsertSongsOrLibraryItems(const SongList& songs, int pos, bool enqueue) {
PlaylistItemList items;
foreach (const Song& song, songs) {
if (song.id() == -1)
@ -826,7 +835,7 @@ QModelIndex Playlist::InsertSongsOrLibraryItems(const SongList& songs, int pos)
else
items << PlaylistItemPtr(new LibraryPlaylistItem(song));
}
return InsertItems(items, pos);
return InsertItems(items, pos, enqueue);
}
QModelIndex Playlist::InsertRadioStations(const QList<RadioItem*>& items, int pos, bool play_now) {

View File

@ -166,10 +166,10 @@ class Playlist : public QAbstractListModel {
void set_scrobbled(bool v) { has_scrobbled_ = v; }
// Changing the playlist
QModelIndex InsertItems(const PlaylistItemList& items, int pos = -1);
QModelIndex InsertLibraryItems(const SongList& items, int pos = -1);
QModelIndex InsertSongs(const SongList& items, int pos = -1);
QModelIndex InsertSongsOrLibraryItems(const SongList& items, int pos = -1);
QModelIndex InsertItems(const PlaylistItemList& items, int pos = -1, bool enqueue = false);
QModelIndex InsertLibraryItems(const SongList& items, int pos = -1, bool enqueue = false);
QModelIndex InsertSongs(const SongList& items, int pos = -1, bool enqueue = false);
QModelIndex InsertSongsOrLibraryItems(const SongList& items, int pos = -1, bool enqueue = false);
QModelIndex InsertRadioStations(const QList<RadioItem*>& items, int pos = -1, bool play_now = false);
void InsertSmartPlaylist(smart_playlists::GeneratorPtr generator, int pos = -1, bool play_now = false);
void InsertUrls(const QList<QUrl>& urls, bool play_now, int pos = -1);
@ -235,7 +235,8 @@ class Playlist : public QAbstractListModel {
// Modify the playlist without changing the undo stack. These are used by
// our friends in PlaylistUndoCommands
QModelIndex InsertItemsWithoutUndo(const PlaylistItemList& items, int pos);
QModelIndex InsertItemsWithoutUndo(const PlaylistItemList& items, int pos,
bool enqueue = false);
PlaylistItemList RemoveItemsWithoutUndo(int pos, int count);
void MoveItemsWithoutUndo(const QList<int>& source_rows, int pos);
void MoveItemsWithoutUndo(int start, const QList<int>& dest_rows);

View File

@ -27,16 +27,18 @@ Base::Base(Playlist *playlist)
}
InsertItems::InsertItems(Playlist *playlist, const PlaylistItemList& items, int pos)
InsertItems::InsertItems(Playlist *playlist, const PlaylistItemList& items,
int pos, bool enqueue)
: Base(playlist),
items_(items),
pos_(pos)
pos_(pos),
enqueue_(enqueue)
{
setText(tr("add %n songs", "", items_.count()));
}
void InsertItems::redo() {
playlist_->InsertItemsWithoutUndo(items_, pos_);
playlist_->InsertItemsWithoutUndo(items_, pos_, enqueue_);
}
void InsertItems::undo() {

View File

@ -42,7 +42,8 @@ namespace PlaylistUndoCommands {
class InsertItems : public Base {
public:
InsertItems(Playlist* playlist, const PlaylistItemList& items, int pos);
InsertItems(Playlist* playlist, const PlaylistItemList& items, int pos,
bool enqueue = false);
void undo();
void redo();
@ -50,6 +51,7 @@ namespace PlaylistUndoCommands {
private:
PlaylistItemList items_;
int pos_;
bool enqueue_;
};
class RemoveItems : public Base {

View File

@ -849,6 +849,9 @@ msgstr ""
msgid "Enable shortcuts only when Clementine is focused"
msgstr ""
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr ""

View File

@ -863,6 +863,9 @@ msgstr ""
msgid "Enable shortcuts only when Clementine is focused"
msgstr ""
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr ""

View File

@ -849,6 +849,9 @@ msgstr ""
msgid "Enable shortcuts only when Clementine is focused"
msgstr ""
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr ""

View File

@ -849,6 +849,9 @@ msgstr ""
msgid "Enable shortcuts only when Clementine is focused"
msgstr ""
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr ""

View File

@ -876,6 +876,9 @@ msgstr "Habilitar l'equalitzador"
msgid "Enable shortcuts only when Clementine is focused"
msgstr "Habilitar les dreceres només quan Clementine tengui el focus"
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr "Introduïu un nom per la nova llista de reproducció"

View File

@ -871,6 +871,9 @@ msgstr "Povolit ekvalizér"
msgid "Enable shortcuts only when Clementine is focused"
msgstr "Povolit zkratky jen když je Clementine zaměřena"
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr "Zadejte název pro nový seznam skladeb"

View File

@ -849,6 +849,9 @@ msgstr ""
msgid "Enable shortcuts only when Clementine is focused"
msgstr ""
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr ""

View File

@ -850,6 +850,9 @@ msgstr "Aktivér equalizer"
msgid "Enable shortcuts only when Clementine is focused"
msgstr ""
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr ""

View File

@ -875,6 +875,9 @@ msgstr "Equalizer aktivieren"
msgid "Enable shortcuts only when Clementine is focused"
msgstr "Tastenkürzel nur aktivieren, wenn Clementine fokussiert ist"
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr "Name der neuen Wiedergabeliste"

View File

@ -881,6 +881,9 @@ msgid "Enable shortcuts only when Clementine is focused"
msgstr ""
"Ενεργοποίηση των συντομεύσεων μόνο όταν ο Clementine είναι στο προσκήνιο"
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr "Εισάγετε ένα όνομα για την νέα λίστα αναπαραγωγής"

View File

@ -838,6 +838,9 @@ msgstr ""
msgid "Enable shortcuts only when Clementine is focused"
msgstr ""
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr ""

View File

@ -851,6 +851,9 @@ msgstr "Enable equalizer"
msgid "Enable shortcuts only when Clementine is focused"
msgstr ""
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr "Enter a name for the new playlist"

View File

@ -849,6 +849,9 @@ msgstr "Enable equalizer"
msgid "Enable shortcuts only when Clementine is focused"
msgstr ""
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr ""

View File

@ -849,6 +849,9 @@ msgstr ""
msgid "Enable shortcuts only when Clementine is focused"
msgstr ""
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr ""

View File

@ -878,6 +878,9 @@ msgstr "Habilitar el ecualizador"
msgid "Enable shortcuts only when Clementine is focused"
msgstr "Habilitar atajos sólo cuando Clementine tenga el foco"
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr "Ingrese un nombre para la nueva lista de reproducción"

View File

@ -849,6 +849,9 @@ msgstr ""
msgid "Enable shortcuts only when Clementine is focused"
msgstr ""
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr "Sisesta uuele esitusnimekirjale nimi"

View File

@ -849,6 +849,9 @@ msgstr ""
msgid "Enable shortcuts only when Clementine is focused"
msgstr ""
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr ""

View File

@ -849,6 +849,9 @@ msgstr ""
msgid "Enable shortcuts only when Clementine is focused"
msgstr ""
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr "Kirjoita uuden soittolistan nimi"

View File

@ -881,6 +881,9 @@ msgstr ""
"Autoriser les raccourcis uniquement lorsque la fenêtre de Clementine est "
"active"
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr "Saisissez un nom pour la nouvelle liste de lecture"

View File

@ -853,6 +853,9 @@ msgstr ""
msgid "Enable shortcuts only when Clementine is focused"
msgstr ""
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr ""

View File

@ -851,6 +851,9 @@ msgstr ""
msgid "Enable shortcuts only when Clementine is focused"
msgstr "אפשר קיצורי מקלדת רק כאשר Clementine נמצא בפוקוס"
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr "הזן שם עבור רשימת ההשמעה החדשה"

View File

@ -849,6 +849,9 @@ msgstr ""
msgid "Enable shortcuts only when Clementine is focused"
msgstr ""
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr ""

View File

@ -855,6 +855,9 @@ msgstr ""
msgid "Enable shortcuts only when Clementine is focused"
msgstr ""
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr ""

View File

@ -872,6 +872,9 @@ msgid "Enable shortcuts only when Clementine is focused"
msgstr ""
"Gyorsbillentyűk engedélyezése csak akkor, ha a Clementine fókuszba kerül"
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr "Adjon nevet az új lejátszási listának"

View File

@ -875,6 +875,9 @@ msgstr "Abilita equalizzatore"
msgid "Enable shortcuts only when Clementine is focused"
msgstr "Abilita le scorciatoie solo quando Clementine è in primo piano"
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr "Inserisci un nome per la nuova scaletta"

View File

@ -866,6 +866,9 @@ msgstr "イコライザーを有効にする"
msgid "Enable shortcuts only when Clementine is focused"
msgstr "Clementine にフォーカスがあるときのみショートカットを有効にする"
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr "新しいプレイリストの名前を入力します"

View File

@ -849,6 +849,9 @@ msgstr ""
msgid "Enable shortcuts only when Clementine is focused"
msgstr ""
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr ""

View File

@ -849,6 +849,9 @@ msgstr ""
msgid "Enable shortcuts only when Clementine is focused"
msgstr ""
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr ""

View File

@ -860,6 +860,9 @@ msgstr "Slå på equalizer"
msgid "Enable shortcuts only when Clementine is focused"
msgstr ""
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr ""

View File

@ -867,6 +867,9 @@ msgstr "Equalizer inschakelen"
msgid "Enable shortcuts only when Clementine is focused"
msgstr "Sneltoetsen alleen inschakelen wanneer Clementine de focus heeft"
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr "Voer een naam in voor de nieuwe afspeellijst"

View File

@ -849,6 +849,9 @@ msgstr ""
msgid "Enable shortcuts only when Clementine is focused"
msgstr ""
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr ""

View File

@ -870,6 +870,9 @@ msgstr "Włącz korektor dźwięku"
msgid "Enable shortcuts only when Clementine is focused"
msgstr "Włącz skróty tylko gdy Clementine jest aktywne"
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr "Wprowadź nazwę nowej listy odtwarzania"

View File

@ -875,6 +875,9 @@ msgstr "Ativar equalizador"
msgid "Enable shortcuts only when Clementine is focused"
msgstr "Apenas ativar os atalhos se o Clementine estiver realçado"
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr "Indique o nome para a lista de reprodução"

View File

@ -868,6 +868,9 @@ msgstr "Habilitar equalizador"
msgid "Enable shortcuts only when Clementine is focused"
msgstr "Habilitar atalhos só quando o Clementine tiver foco"
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr "Entre com um nome para a nova lista de reprodução"

View File

@ -849,6 +849,9 @@ msgstr ""
msgid "Enable shortcuts only when Clementine is focused"
msgstr ""
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr ""

View File

@ -868,6 +868,9 @@ msgstr "Включить эквалайзер"
msgid "Enable shortcuts only when Clementine is focused"
msgstr "Разрешить горячие клавиши только когда окно программы активно"
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr "Введите имя для списка воспроизведения"

View File

@ -867,6 +867,9 @@ msgstr "Povoliť ekvalizér"
msgid "Enable shortcuts only when Clementine is focused"
msgstr "Povoliť skratky len keď je Clementine zameraný"
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr "Zadajte názov pre nový playlist"

View File

@ -869,6 +869,9 @@ msgstr "Omogoči izenačevalnik"
msgid "Enable shortcuts only when Clementine is focused"
msgstr "Omogoči bližnjice le, ko je Clementine v žarišču"
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr "Vnesite ime za nov seznam predvajanja"

View File

@ -851,6 +851,9 @@ msgstr "Укључи еквилајзер"
msgid "Enable shortcuts only when Clementine is focused"
msgstr ""
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr "Упишите име нове листе нумера"

View File

@ -873,6 +873,9 @@ msgstr "Aktivera equalizer"
msgid "Enable shortcuts only when Clementine is focused"
msgstr "Aktivera endast snabbknappar när Clementine är fokuserat"
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr "Ange ett namn för den nya spellistan"

View File

@ -866,6 +866,9 @@ msgstr "Ekolayzırı etkinleştir"
msgid "Enable shortcuts only when Clementine is focused"
msgstr "Kısayolları sadece Clementine odaktayken etkinleştir"
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr "Yeni çalma listesi için isim girin"

View File

@ -839,6 +839,9 @@ msgstr ""
msgid "Enable shortcuts only when Clementine is focused"
msgstr ""
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr ""

View File

@ -870,6 +870,9 @@ msgstr "Увімкнути еквалайзер"
msgid "Enable shortcuts only when Clementine is focused"
msgstr "Вмикати комбінації клавіш лише коли Clementine у фокусі"
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr "Введіть назву нового списку відтворення"

View File

@ -851,6 +851,9 @@ msgstr ""
msgid "Enable shortcuts only when Clementine is focused"
msgstr ""
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr "输入新播放列表的名称"

View File

@ -853,6 +853,9 @@ msgstr "啟用等化器"
msgid "Enable shortcuts only when Clementine is focused"
msgstr ""
msgid "Enqueue to playlist"
msgstr ""
msgid "Enter a name for the new playlist"
msgstr "輸入新播放清單的名稱"

View File

@ -395,6 +395,7 @@ MainWindow::MainWindow(QWidget* parent)
connect(library_view_->view(), SIGNAL(doubleClicked(QModelIndex)), SLOT(LibraryItemDoubleClicked(QModelIndex)));
connect(library_view_->view(), SIGNAL(Load(QModelIndexList)), SLOT(LoadLibraryItemToPlaylist(QModelIndexList)));
connect(library_view_->view(), SIGNAL(AddToPlaylist(QModelIndexList)), SLOT(AddLibraryItemToPlaylist(QModelIndexList)));
connect(library_view_->view(), SIGNAL(AddToPlaylistEnqueue(QModelIndexList)), SLOT(AddLibraryItemToPlaylistEnqueue(QModelIndexList)));
connect(library_view_->view(), SIGNAL(ShowConfigDialog()), SLOT(ShowLibraryConfig()));
connect(library_->model(), SIGNAL(TotalSongCountUpdated(int)), library_view_->view(), SLOT(TotalSongCountUpdated(int)));
@ -674,15 +675,15 @@ void MainWindow::AddUrls(bool play_now, const QList<QUrl> &urls) {
}
void MainWindow::AddLibrarySongsToPlaylist(const SongList &songs) {
AddLibrarySongsToPlaylist(false, songs);
AddLibrarySongsToPlaylist(false, false, songs);
}
void MainWindow::LoadLibrarySongsToPlaylist(const SongList &songs) {
AddLibrarySongsToPlaylist(true, songs);
AddLibrarySongsToPlaylist(true, false, songs);
}
void MainWindow::LibrarySongsDoubleClicked(const SongList &songs) {
AddLibrarySongsToPlaylist(autoclear_playlist_, songs);
AddLibrarySongsToPlaylist(autoclear_playlist_, false, songs);
}
void MainWindow::AddSmartPlaylistToPlaylist(bool clear_first, smart_playlists::GeneratorPtr gen) {
@ -693,11 +694,12 @@ void MainWindow::AddSmartPlaylistToPlaylist(bool clear_first, smart_playlists::G
playlists_->current()->InsertSmartPlaylist(gen, -1, play_now);
}
void MainWindow::AddLibrarySongsToPlaylist(bool clear_first, const SongList &songs) {
void MainWindow::AddLibrarySongsToPlaylist(bool clear_first, bool enqueue,
const SongList &songs) {
if (clear_first)
playlists_->ClearCurrent();
QModelIndex first_song = playlists_->current()->InsertLibraryItems(songs);
QModelIndex first_song = playlists_->current()->InsertLibraryItems(songs, -1, enqueue);
if (!playlists_->current()->proxy()->mapFromSource(first_song).isValid()) {
// The first song doesn't match the filter, so don't play it
@ -863,18 +865,23 @@ void MainWindow::PlayIndex(const QModelIndex& index) {
}
void MainWindow::LoadLibraryItemToPlaylist(const QModelIndexList& indexes) {
AddLibraryItemToPlaylist(true, indexes);
AddLibraryItemToPlaylist(true, false, indexes);
}
void MainWindow::AddLibraryItemToPlaylist(const QModelIndexList& indexes) {
AddLibraryItemToPlaylist(false, indexes);
AddLibraryItemToPlaylist(false, false, indexes);
}
void MainWindow::AddLibraryItemToPlaylistEnqueue(const QModelIndexList& indexes) {
AddLibraryItemToPlaylist(false, true, indexes);
}
void MainWindow::LibraryItemDoubleClicked(const QModelIndex &index) {
AddLibraryItemToPlaylist(autoclear_playlist_, QModelIndexList() << index);
AddLibraryItemToPlaylist(autoclear_playlist_, false, QModelIndexList() << index);
}
void MainWindow::AddLibraryItemToPlaylist(bool clear_first, const QModelIndexList& indexes) {
void MainWindow::AddLibraryItemToPlaylist(bool clear_first, bool enqueue,
const QModelIndexList& indexes) {
QModelIndexList source_indexes;
foreach (const QModelIndex& index, indexes) {
if (index.model() == library_sort_model_)
@ -892,7 +899,8 @@ void MainWindow::AddLibraryItemToPlaylist(bool clear_first, const QModelIndexLis
return;
}
AddLibrarySongsToPlaylist(clear_first, library_->model()->GetChildSongs(source_indexes));
AddLibrarySongsToPlaylist(clear_first, enqueue,
library_->model()->GetChildSongs(source_indexes));
}
void MainWindow::VolumeWheelEvent(int delta) {

View File

@ -140,6 +140,7 @@ class MainWindow : public QMainWindow, public PlatformInterface {
void LoadLibraryItemToPlaylist(const QModelIndexList& indexes);
void AddLibraryItemToPlaylist(const QModelIndexList& indexes);
void AddLibraryItemToPlaylistEnqueue(const QModelIndexList& indexes);
void LibraryItemDoubleClicked(const QModelIndex& index);
void LoadFilesToPlaylist(const QList<QUrl>& urls);
@ -213,8 +214,8 @@ class MainWindow : public QMainWindow, public PlatformInterface {
private:
void AddFilesToPlaylist(bool clear_first, const QList<QUrl>& urls);
void AddLibraryItemToPlaylist(bool clear_first, const QModelIndexList& indexes);
void AddLibrarySongsToPlaylist(bool clear_first, const SongList& songs);
void AddLibraryItemToPlaylist(bool clear_first, bool enqueue, const QModelIndexList& indexes);
void AddLibrarySongsToPlaylist(bool clear_first, bool enqueue, const SongList& songs);
void AddSmartPlaylistToPlaylist(bool clear_first, smart_playlists::GeneratorPtr gen);
void AddDeviceSongsToPlaylist(bool clear_first, const SongList& songs);
void AddUrls(bool play_now, const QList<QUrl>& urls);