Add a "load" menu item to the library, files view, and radio view to replace the current playlist with the selection. Also add an option to make this the default. Fixes issue #311

This commit is contained in:
David Sansome 2010-05-15 17:45:04 +00:00
parent c5db4c025c
commit f7c08d375a
32 changed files with 237 additions and 18 deletions

View File

@ -82,6 +82,7 @@ void LibraryConfig::Save() {
s.beginGroup(LibraryView::kSettingsGroup);
s.setValue("auto_open", ui_->auto_open->isChecked());
s.setValue("autoclear_playlist", ui_->auto_load->isChecked());
}
void LibraryConfig::showEvent(QShowEvent *) {
@ -93,4 +94,5 @@ void LibraryConfig::Load() {
s.beginGroup(LibraryView::kSettingsGroup);
ui_->auto_open->setChecked(s.value("auto_open", true).toBool());
ui_->auto_load->setChecked(s.value("autoclear_playlist", false).toBool());
}

View File

@ -31,6 +31,8 @@ class LibraryConfig : public QWidget {
LibraryConfig(QWidget* parent = 0);
~LibraryConfig();
static const char* kSettingsGroup;
void SetModel(LibraryDirectoryModel* model);
public slots:
@ -47,8 +49,6 @@ class LibraryConfig : public QWidget {
void CurrentRowChanged(const QModelIndex& index);
private:
static const char* kSettingsGroup;
Ui_LibraryConfig* ui_;
LibraryDirectoryModel* model_;
};

View File

@ -34,7 +34,7 @@
<string>Add new folder...</string>
</property>
<property name="icon">
<iconset>
<iconset resource="../../data/data.qrc">
<normaloff>:/folder-new.png</normaloff>:/folder-new.png</iconset>
</property>
<property name="iconSize">
@ -91,6 +91,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="auto_load">
<property name="text">
<string>Double-clicking a song clears the playlist first</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -101,6 +108,8 @@
<tabstop>add</tabstop>
<tabstop>remove</tabstop>
</tabstops>
<resources/>
<resources>
<include location="../../data/data.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -86,7 +86,9 @@ LibraryView::LibraryView(QWidget* parent)
connect(this, SIGNAL(expanded(QModelIndex)), SLOT(ItemExpanded(QModelIndex)));
add_to_playlist_ = context_menu_->addAction(
load_ = context_menu_->addAction(QIcon(":/media-playback-start.png"),
tr("Load"), this, SLOT(Load()));
add_to_playlist_ = context_menu_->addAction(QIcon(":/media-playback-start.png"),
tr("Add to playlist"), this, SLOT(AddToPlaylist()));
context_menu_->addSeparator();
show_in_various_ = context_menu_->addAction(
@ -202,6 +204,7 @@ void LibraryView::contextMenuEvent(QContextMenuEvent *e) {
bool enable_add = type == LibraryItem::Type_Container ||
type == LibraryItem::Type_Song;
load_->setEnabled(enable_add);
add_to_playlist_->setEnabled(enable_add);
show_in_various_->setEnabled(enable_various);
no_show_in_various_->setEnabled(enable_various);
@ -226,6 +229,13 @@ void LibraryView::ShowInVarious(bool on) {
library_->backend()->ForceCompilation(artist, album, on);
}
void LibraryView::Load() {
if (!context_menu_index_.isValid())
return;
emit Load(context_menu_index_);
}
void LibraryView::AddToPlaylist() {
if (!context_menu_index_.isValid())
return;

View File

@ -44,6 +44,7 @@ class LibraryView : public QTreeView {
signals:
void ShowConfigDialog();
void Load(const QModelIndex& index);
void AddToPlaylist(const QModelIndex& index);
protected:
@ -57,6 +58,7 @@ class LibraryView : public QTreeView {
private slots:
void ItemExpanded(const QModelIndex& index);
void Load();
void AddToPlaylist();
void ShowInVarious();
void NoShowInVarious();
@ -77,6 +79,7 @@ class LibraryView : public QTreeView {
QMenu* context_menu_;
QModelIndex context_menu_index_;
QAction* load_;
QAction* add_to_playlist_;
QAction* show_in_various_;
QAction* no_show_in_various_;

View File

@ -124,6 +124,9 @@ msgstr "Různí umělci"
msgid "Unknown"
msgstr "Neznámý"
msgid "Load"
msgstr ""
msgid "Add to playlist"
msgstr "Přidat do seznamu skladeb"
@ -196,6 +199,9 @@ msgstr "Možnosti"
msgid "Automatically open single categories in the library tree"
msgstr "Automaticky otevře jednostlivé kategorie ve stromu knihovny"
msgid "Double-clicking a song clears the playlist first"
msgstr ""
msgid "Music Library"
msgstr "Knihovna hudby"

View File

@ -126,6 +126,9 @@ msgstr "Diverse kunstnere"
msgid "Unknown"
msgstr "Ukendt"
msgid "Load"
msgstr ""
msgid "Add to playlist"
msgstr "Føj til spilleliste"
@ -198,6 +201,9 @@ msgstr "Indstillinger"
msgid "Automatically open single categories in the library tree"
msgstr "Åbn automatisk enkelte kategorier i bibliotekstræet"
msgid "Double-clicking a song clears the playlist first"
msgstr ""
msgid "Music Library"
msgstr "Musikbibliotek"

View File

@ -123,6 +123,9 @@ msgstr "Verschiedene Interpreten"
msgid "Unknown"
msgstr "Unbekannt"
msgid "Load"
msgstr ""
msgid "Add to playlist"
msgstr "Zur Wiedergabeliste hinzufügen"
@ -195,6 +198,9 @@ msgstr "Einstellungen"
msgid "Automatically open single categories in the library tree"
msgstr "Kategorien in der Musiksammlung automatisch öffnen"
msgid "Double-clicking a song clears the playlist first"
msgstr ""
msgid "Music Library"
msgstr "Musiksammlung"

View File

@ -125,6 +125,9 @@ msgstr "Διάφοροι καλλιτέχνες"
msgid "Unknown"
msgstr "Άγνωστο"
msgid "Load"
msgstr ""
msgid "Add to playlist"
msgstr "Προσθήκη στη λίστα"
@ -198,6 +201,9 @@ msgstr "Επιλογές"
msgid "Automatically open single categories in the library tree"
msgstr "Άνοιξε αυτόμα τις μόνες κατηγορίες του δέντρου της βιβλιοθήκης"
msgid "Double-clicking a song clears the playlist first"
msgstr ""
msgid "Music Library"
msgstr "Μουσική βιβλιοθήκη"

View File

@ -123,6 +123,9 @@ msgstr "Various Artists"
msgid "Unknown"
msgstr "Unknown"
msgid "Load"
msgstr ""
msgid "Add to playlist"
msgstr "Add to playlist"
@ -195,6 +198,9 @@ msgstr "Options"
msgid "Automatically open single categories in the library tree"
msgstr "Automatically open single categories in the library tree"
msgid "Double-clicking a song clears the playlist first"
msgstr ""
msgid "Music Library"
msgstr "Music Library"

View File

@ -124,6 +124,9 @@ msgstr "Varios Artistas"
msgid "Unknown"
msgstr "Desconocido"
msgid "Load"
msgstr ""
msgid "Add to playlist"
msgstr "Añadir a la lista de reproducción"
@ -200,6 +203,9 @@ msgid "Automatically open single categories in the library tree"
msgstr ""
"Expandir automáticamente las categorías únicas en el árbol de la colección"
msgid "Double-clicking a song clears the playlist first"
msgstr ""
msgid "Music Library"
msgstr "Colección de Música"

View File

@ -123,6 +123,9 @@ msgstr "Useita artisteja"
msgid "Unknown"
msgstr "Tuntematon"
msgid "Load"
msgstr ""
msgid "Add to playlist"
msgstr "Lisää soittolistaan"
@ -195,6 +198,9 @@ msgstr ""
msgid "Automatically open single categories in the library tree"
msgstr ""
msgid "Double-clicking a song clears the playlist first"
msgstr ""
msgid "Music Library"
msgstr ""

View File

@ -124,6 +124,9 @@ msgstr "Compilations d'artistes"
msgid "Unknown"
msgstr "Inconnu"
msgid "Load"
msgstr ""
msgid "Add to playlist"
msgstr "Ajouter à la liste de lecture"
@ -200,6 +203,9 @@ msgstr "Options"
msgid "Automatically open single categories in the library tree"
msgstr ""
msgid "Double-clicking a song clears the playlist first"
msgstr ""
msgid "Music Library"
msgstr "Bibliothèque musicale"

View File

@ -123,6 +123,9 @@ msgstr "Vários Artistas"
msgid "Unknown"
msgstr "Descoñecido"
msgid "Load"
msgstr ""
msgid "Add to playlist"
msgstr "Engadir á lista de reproduzón"
@ -195,6 +198,9 @@ msgstr ""
msgid "Automatically open single categories in the library tree"
msgstr ""
msgid "Double-clicking a song clears the playlist first"
msgstr ""
msgid "Music Library"
msgstr ""

View File

@ -124,6 +124,9 @@ msgstr "Artisti vari"
msgid "Unknown"
msgstr "Sconosciuto"
msgid "Load"
msgstr ""
msgid "Add to playlist"
msgstr "Aggiungi alla scaletta"
@ -198,6 +201,9 @@ msgstr "Opzioni"
msgid "Automatically open single categories in the library tree"
msgstr "Apri automaticamente categorie singole nell'albero della raccolta"
msgid "Double-clicking a song clears the playlist first"
msgstr ""
msgid "Music Library"
msgstr "Raccolta musicale"

View File

@ -123,6 +123,9 @@ msgstr ""
msgid "Unknown"
msgstr "Белгісіз"
msgid "Load"
msgstr ""
msgid "Add to playlist"
msgstr ""
@ -195,6 +198,9 @@ msgstr ""
msgid "Automatically open single categories in the library tree"
msgstr ""
msgid "Double-clicking a song clears the playlist first"
msgstr ""
msgid "Music Library"
msgstr ""

View File

@ -123,6 +123,9 @@ msgstr "Diverse artister"
msgid "Unknown"
msgstr "Ukjent"
msgid "Load"
msgstr ""
msgid "Add to playlist"
msgstr "Legg til på spilleliste"
@ -196,6 +199,9 @@ msgstr "Instillinger"
msgid "Automatically open single categories in the library tree"
msgstr "Automatisk åpne enkeltkategorier i bibliotektreet"
msgid "Double-clicking a song clears the playlist first"
msgstr ""
msgid "Music Library"
msgstr "Musikkbibliotek"

View File

@ -124,6 +124,9 @@ msgstr "Różni wykonawcy"
msgid "Unknown"
msgstr "nieznany"
msgid "Load"
msgstr ""
msgid "Add to playlist"
msgstr "Dodaj do playlisty"
@ -196,6 +199,9 @@ msgstr "Opcje"
msgid "Automatically open single categories in the library tree"
msgstr "Automatycznie otwieraj pojedyńcze kategorie w drzewie Biblioteki"
msgid "Double-clicking a song clears the playlist first"
msgstr ""
msgid "Music Library"
msgstr "Biblioteka muzyki"

View File

@ -123,6 +123,9 @@ msgstr "Vários Artistas"
msgid "Unknown"
msgstr "Desconhecido"
msgid "Load"
msgstr ""
msgid "Add to playlist"
msgstr "Adicionar à lista de reprodução"
@ -195,6 +198,9 @@ msgstr "Opções"
msgid "Automatically open single categories in the library tree"
msgstr "Abrir categorias individuais automaticamente na biblioteca em árvore"
msgid "Double-clicking a song clears the playlist first"
msgstr ""
msgid "Music Library"
msgstr "Biblioteca de Música"

View File

@ -123,6 +123,9 @@ msgstr "Vários artistas"
msgid "Unknown"
msgstr "Desconhecido"
msgid "Load"
msgstr ""
msgid "Add to playlist"
msgstr ""
@ -195,6 +198,9 @@ msgstr ""
msgid "Automatically open single categories in the library tree"
msgstr ""
msgid "Double-clicking a song clears the playlist first"
msgstr ""
msgid "Music Library"
msgstr ""

View File

@ -123,6 +123,9 @@ msgstr "Diferiți artiști"
msgid "Unknown"
msgstr "Necunoscut"
msgid "Load"
msgstr ""
msgid "Add to playlist"
msgstr "Adaugă la lista de redare"
@ -195,6 +198,9 @@ msgstr "Opțiuni"
msgid "Automatically open single categories in the library tree"
msgstr ""
msgid "Double-clicking a song clears the playlist first"
msgstr ""
msgid "Music Library"
msgstr "Biblioteca audio"

View File

@ -122,6 +122,9 @@ msgstr "Разные исполнители"
msgid "Unknown"
msgstr "Неизвестный"
msgid "Load"
msgstr ""
msgid "Add to playlist"
msgstr "Добавить в плейлист"
@ -195,6 +198,9 @@ msgstr "Настройки"
msgid "Automatically open single categories in the library tree"
msgstr "Автоматически открывать одиночные категории в дереве коллекции"
msgid "Double-clicking a song clears the playlist first"
msgstr ""
msgid "Music Library"
msgstr "Музыкальная коллекция"

View File

@ -124,6 +124,9 @@ msgstr "Rôzni interpréti"
msgid "Unknown"
msgstr "neznámy"
msgid "Load"
msgstr ""
msgid "Add to playlist"
msgstr "Pridať do playlistu"
@ -196,6 +199,9 @@ msgstr "Možnosti"
msgid "Automatically open single categories in the library tree"
msgstr "Automaticky otvoriť jednotlivé kategórie v strome zbierky"
msgid "Double-clicking a song clears the playlist first"
msgstr ""
msgid "Music Library"
msgstr "Hudobná zbierka"

View File

@ -123,6 +123,9 @@ msgstr "Diverse artister"
msgid "Unknown"
msgstr "Okänt"
msgid "Load"
msgstr ""
msgid "Add to playlist"
msgstr "Lägg till i spellista"
@ -197,6 +200,9 @@ msgstr "Flaggor"
msgid "Automatically open single categories in the library tree"
msgstr "Öppna enkla kategorier i biblioteksträdet automatiskt"
msgid "Double-clicking a song clears the playlist first"
msgstr ""
msgid "Music Library"
msgstr "Musikbibliotek"

View File

@ -123,6 +123,9 @@ msgstr ""
msgid "Unknown"
msgstr "Bilinmiyor"
msgid "Load"
msgstr ""
msgid "Add to playlist"
msgstr "Çalma listesine ekle"
@ -195,6 +198,9 @@ msgstr ""
msgid "Automatically open single categories in the library tree"
msgstr ""
msgid "Double-clicking a song clears the playlist first"
msgstr ""
msgid "Music Library"
msgstr ""

View File

@ -114,6 +114,9 @@ msgstr ""
msgid "Unknown"
msgstr ""
msgid "Load"
msgstr ""
msgid "Add to playlist"
msgstr ""
@ -186,6 +189,9 @@ msgstr ""
msgid "Automatically open single categories in the library tree"
msgstr ""
msgid "Double-clicking a song clears the playlist first"
msgstr ""
msgid "Music Library"
msgstr ""

View File

@ -72,6 +72,7 @@
#include <cmath>
using boost::shared_ptr;
using boost::scoped_ptr;
#ifdef Q_OS_DARWIN
// Non exported mac-specific function.
@ -151,7 +152,9 @@ MainWindow::MainWindow(NetworkAccessManager* network, Engine::Type engine, QWidg
cover_manager_->Init();
// File view connections
connect(ui_->file_view, SIGNAL(Queue(QList<QUrl>)), SLOT(QueueFiles(QList<QUrl>)));
connect(ui_->file_view, SIGNAL(AddToPlaylist(QList<QUrl>)), SLOT(AddFilesToPlaylist(QList<QUrl>)));
connect(ui_->file_view, SIGNAL(Load(QList<QUrl>)), SLOT(LoadFilesToPlaylist(QList<QUrl>)));
connect(ui_->file_view, SIGNAL(DoubleClicked(QList<QUrl>)), SLOT(FilesDoubleClicked(QList<QUrl>)));
connect(ui_->file_view, SIGNAL(PathChanged(QString)), SLOT(FilePathChanged(QString)));
// Action connections
@ -236,7 +239,8 @@ MainWindow::MainWindow(NetworkAccessManager* network, Engine::Type engine, QWidg
connect(database_, SIGNAL(Error(QString)), SLOT(ReportError(QString)));
// Library connections
connect(ui_->library_view, SIGNAL(doubleClicked(QModelIndex)), SLOT(AddLibraryItemToPlaylist(QModelIndex)));
connect(ui_->library_view, SIGNAL(doubleClicked(QModelIndex)), SLOT(LibraryItemDoubleClicked(QModelIndex)));
connect(ui_->library_view, SIGNAL(Load(QModelIndex)), SLOT(LoadLibraryItemToPlaylist(QModelIndex)));
connect(ui_->library_view, SIGNAL(AddToPlaylist(QModelIndex)), SLOT(AddLibraryItemToPlaylist(QModelIndex)));
connect(ui_->library_view, SIGNAL(ShowConfigDialog()), ui_->library_filter, SLOT(ShowConfigDialog()));
connect(library_->model(), SIGNAL(TotalSongCountUpdated(int)), ui_->library_view, SLOT(TotalSongCountUpdated(int)));
@ -248,6 +252,7 @@ MainWindow::MainWindow(NetworkAccessManager* network, Engine::Type engine, QWidg
ui_->library_filter->SetLibraryModel(library_->model());
connect(ui_->library_filter, SIGNAL(LibraryConfigChanged()), ui_->library_view,
SLOT(ReloadSettings()));
connect(ui_->library_filter, SIGNAL(LibraryConfigChanged()), SLOT(ReloadSettings()));
// Playlist menu
QAction* playlist_undo = playlist_->undo_stack()->createUndoAction(this);
@ -365,11 +370,12 @@ MainWindow::MainWindow(NetworkAccessManager* network, Engine::Type engine, QWidg
ui_->file_view->SetPath(settings_.value("file_path", QDir::homePath()).toString());
ReloadSettings();
#ifndef Q_OS_DARWIN
StartupBehaviour behaviour =
StartupBehaviour(settings_.value("startupbehaviour", Startup_Remember).toInt());
bool hidden = settings_.value("hidden", false).toBool();
bool show_tray = settings_.value("showtray", true).toBool();
switch (behaviour) {
case Startup_AlwaysHide: hide(); break;
@ -377,11 +383,8 @@ MainWindow::MainWindow(NetworkAccessManager* network, Engine::Type engine, QWidg
case Startup_Remember: setVisible(!hidden); break;
}
if (show_tray)
tray_icon_->show();
// Force the window to show in case somehow the config has tray and window set to hide
if (hidden && !show_tray) {
if (hidden && !tray_icon_->isVisible()) {
settings_.setValue("hidden", false);
show();
}
@ -412,9 +415,29 @@ void MainWindow::ReloadSettings() {
if (!show_tray && !isVisible())
show();
#endif
QSettings library_settings;
library_settings.beginGroup(LibraryView::kSettingsGroup);
autoclear_playlist_ = library_settings.value("autoclear_playlist", false).toBool();
}
void MainWindow::QueueFiles(const QList<QUrl>& urls) {
void MainWindow::AddFilesToPlaylist(const QList<QUrl>& urls) {
AddFilesToPlaylist(false, urls);
}
void MainWindow::LoadFilesToPlaylist(const QList<QUrl>& urls) {
AddFilesToPlaylist(true, urls);
}
void MainWindow::FilesDoubleClicked(const QList<QUrl>& urls) {
AddFilesToPlaylist(autoclear_playlist_, urls);
}
void MainWindow::AddFilesToPlaylist(bool clear_first, const QList<QUrl>& urls) {
if (clear_first)
playlist_->Clear();
QModelIndex playlist_index = playlist_->InsertPaths(urls);
if (playlist_index.isValid() && player_->GetState() != Engine::Playing)
@ -510,11 +533,26 @@ void MainWindow::PlayIndex(const QModelIndex& index) {
player_->PlayAt(index.row(), Engine::Manual, true);
}
void MainWindow::LoadLibraryItemToPlaylist(const QModelIndex& index) {
AddLibraryItemToPlaylist(true, index);
}
void MainWindow::AddLibraryItemToPlaylist(const QModelIndex& index) {
AddLibraryItemToPlaylist(false, index);
}
void MainWindow::LibraryItemDoubleClicked(const QModelIndex &index) {
AddLibraryItemToPlaylist(autoclear_playlist_, index);
}
void MainWindow::AddLibraryItemToPlaylist(bool clear_first, const QModelIndex& index) {
QModelIndex idx = index;
if (idx.model() == library_sort_model_)
idx = library_sort_model_->mapToSource(idx);
if (clear_first)
playlist_->Clear();
QModelIndex first_song =
playlist_->InsertLibraryItems(library_->model()->GetChildSongs(idx));
@ -623,7 +661,19 @@ void MainWindow::Love() {
}
void MainWindow::RadioDoubleClick(const QModelIndex& index) {
InsertRadioItem(radio_model_->IndexToItem(index));
if (autoclear_playlist_)
playlist_->Clear();
scoped_ptr<QMimeData> data(
radio_model_->merged_model()->mimeData(QModelIndexList() << index));
if (!data)
return;
playlist_->dropMimeData(data.get(), Qt::CopyAction, -1, 0, QModelIndex());
QModelIndex first_song = playlist_->index(0, 0);
if (first_song.isValid() && player_->GetState() != Engine::Playing)
player_->PlayAt(first_song.row(), Engine::First, true);
}
void MainWindow::InsertRadioItem(RadioItem* item) {

View File

@ -84,7 +84,6 @@ class MainWindow : public QMainWindow {
bool event(QEvent* event);
private slots:
void QueueFiles(const QList<QUrl>& urls);
void FilePathChanged(const QString& path);
void ReportError(const QString& message);
@ -106,7 +105,13 @@ class MainWindow : public QMainWindow {
void PlayIndex(const QModelIndex& index);
void StopAfterCurrent();
void LoadLibraryItemToPlaylist(const QModelIndex& index);
void AddLibraryItemToPlaylist(const QModelIndex& index);
void LibraryItemDoubleClicked(const QModelIndex& index);
void LoadFilesToPlaylist(const QList<QUrl>& urls);
void AddFilesToPlaylist(const QList<QUrl>& urls);
void FilesDoubleClicked(const QList<QUrl>& urls);
void VolumeWheelEvent(int delta);
void TrayClicked(QSystemTrayIcon::ActivationReason reason);
@ -136,6 +141,8 @@ class MainWindow : public QMainWindow {
private:
void SaveGeometry();
void AddFilesToPlaylist(bool clear_first, const QList<QUrl>& urls);
void AddLibraryItemToPlaylist(bool clear_first, const QModelIndex& index);
private:
static const int kStateVersion;
@ -174,6 +181,7 @@ class MainWindow : public QMainWindow {
QSettings settings_;
bool was_maximized_;
bool autoclear_playlist_;
};
#endif // MAINWINDOW_H

View File

@ -42,7 +42,8 @@ FileView::FileView(QWidget* parent)
connect(ui_->list, SIGNAL(activated(QModelIndex)), SLOT(ItemActivated(QModelIndex)));
connect(ui_->list, SIGNAL(doubleClicked(QModelIndex)), SLOT(ItemDoubleClick(QModelIndex)));
connect(ui_->list, SIGNAL(AddToPlaylist(QList<QUrl>)), SIGNAL(Queue(QList<QUrl>)));
connect(ui_->list, SIGNAL(Load(QList<QUrl>)), SIGNAL(Load(QList<QUrl>)));
connect(ui_->list, SIGNAL(AddToPlaylist(QList<QUrl>)), SIGNAL(AddToPlaylist(QList<QUrl>)));
connect(ui_->list, SIGNAL(CopyToLibrary(QList<QUrl>)), SIGNAL(CopyToLibrary(QList<QUrl>)));
connect(ui_->list, SIGNAL(MoveToLibrary(QList<QUrl>)), SIGNAL(MoveToLibrary(QList<QUrl>)));
}
@ -108,7 +109,7 @@ void FileView::ItemDoubleClick(const QModelIndex& index) {
if (model_->isDir(index))
return;
emit Queue(QList<QUrl>() << QUrl::fromLocalFile(model_->filePath(index)));
emit DoubleClicked(QList<QUrl>() << QUrl::fromLocalFile(model_->filePath(index)));
}

View File

@ -39,7 +39,9 @@ class FileView : public QWidget {
signals:
void PathChanged(const QString& path);
void Queue(const QList<QUrl>& urls);
void Load(const QList<QUrl>& urls);
void AddToPlaylist(const QList<QUrl>& urls);
void DoubleClicked(const QList<QUrl>& urls);
void CopyToLibrary(const QList<QUrl>& urls);
void MoveToLibrary(const QList<QUrl>& urls);

View File

@ -25,6 +25,8 @@ FileViewList::FileViewList(QWidget* parent)
: QListView(parent),
menu_(new QMenu(this))
{
menu_->addAction(QIcon(":media-playback-start.png"), tr("Load"),
this, SLOT(LoadSlot()));
menu_->addAction(QIcon(":media-playback-start.png"), tr("Add to playlist"),
this, SLOT(AddToPlaylistSlot()));
menu_->addSeparator();
@ -51,6 +53,10 @@ QList<QUrl> FileViewList::UrlListFromSelection() const {
return urls;
}
void FileViewList::LoadSlot() {
emit Load(UrlListFromSelection());
}
void FileViewList::AddToPlaylistSlot() {
emit AddToPlaylist(UrlListFromSelection());
}

View File

@ -27,6 +27,7 @@ class FileViewList : public QListView {
FileViewList(QWidget* parent = 0);
signals:
void Load(const QList<QUrl>& urls);
void AddToPlaylist(const QList<QUrl>& urls);
void CopyToLibrary(const QList<QUrl>& urls);
void MoveToLibrary(const QList<QUrl>& urls);
@ -35,6 +36,7 @@ class FileViewList : public QListView {
void contextMenuEvent(QContextMenuEvent* e);
private slots:
void LoadSlot();
void AddToPlaylistSlot();
void CopyToLibrarySlot();
void MoveToLibrarySlot();