mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-31 11:35:24 +01:00
Merge pull request #4107 from goetzc/master
playlist context menu entry: Show in library. Fixes #1162
This commit is contained in:
commit
e5274db222
@ -212,6 +212,10 @@ void LibraryFilterWidget::SetQueryMode(QueryOptions::QueryMode query_mode) {
|
||||
model_->SetFilterQueryMode(query_mode);
|
||||
}
|
||||
|
||||
void LibraryFilterWidget::ShowInLibrary(const QString& search) {
|
||||
ui_->filter->setText(search);
|
||||
}
|
||||
|
||||
void LibraryFilterWidget::SetAgeFilterEnabled(bool enabled) {
|
||||
filter_age_menu_->setEnabled(enabled);
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ class LibraryFilterWidget : public QWidget {
|
||||
void SetDelayBehaviour(DelayBehaviour behaviour) { delay_behaviour_ = behaviour; }
|
||||
void SetAgeFilterEnabled(bool enabled);
|
||||
void SetGroupByEnabled(bool enabled);
|
||||
void ShowInLibrary(const QString& search);
|
||||
|
||||
QMenu* menu() const { return library_menu_; }
|
||||
void AddMenuAction(QAction* action);
|
||||
|
@ -509,6 +509,7 @@ MainWindow::MainWindow(Application* app,
|
||||
playlist_copy_to_device_ = playlist_menu_->addAction(IconLoader::Load("multimedia-player-ipod-mini-blue"), tr("Copy to device..."), this, SLOT(PlaylistCopyToDevice()));
|
||||
playlist_delete_ = playlist_menu_->addAction(IconLoader::Load("edit-delete"), tr("Delete from disk..."), this, SLOT(PlaylistDelete()));
|
||||
playlist_open_in_browser_ = playlist_menu_->addAction(IconLoader::Load("document-open-folder"), tr("Show in file browser..."), this, SLOT(PlaylistOpenInBrowser()));
|
||||
playlist_show_in_library_ = playlist_menu_->addAction(IconLoader::Load("edit-find"), tr("Show in library..."), this, SLOT(ShowInLibrary()));
|
||||
playlist_menu_->addSeparator();
|
||||
playlistitem_actions_separator_ = playlist_menu_->addSeparator();
|
||||
playlist_menu_->addAction(ui_->action_clear_playlist);
|
||||
@ -1360,6 +1361,7 @@ void MainWindow::PlaylistRightClick(const QPoint& global_pos, const QModelIndex&
|
||||
ui_->action_edit_value->setVisible(editable);
|
||||
ui_->action_remove_from_playlist->setEnabled(!selection.isEmpty());
|
||||
|
||||
playlist_show_in_library_->setVisible(false);
|
||||
playlist_copy_to_library_->setVisible(false);
|
||||
playlist_move_to_library_->setVisible(false);
|
||||
playlist_organise_->setVisible(false);
|
||||
@ -1408,6 +1410,7 @@ void MainWindow::PlaylistRightClick(const QPoint& global_pos, const QModelIndex&
|
||||
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(source_index.row());
|
||||
if (item->IsLocalLibraryItem() && item->Metadata().id() != -1) {
|
||||
playlist_organise_->setVisible(editable);
|
||||
playlist_show_in_library_->setVisible(editable);
|
||||
} else {
|
||||
playlist_copy_to_library_->setVisible(editable);
|
||||
playlist_move_to_library_->setVisible(editable);
|
||||
@ -1676,6 +1679,22 @@ void MainWindow::AddCDTracks() {
|
||||
AddToPlaylist(data);
|
||||
}
|
||||
|
||||
void MainWindow::ShowInLibrary() {
|
||||
// Show the first valid selected track artist/album in LibraryView
|
||||
QModelIndexList proxy_indexes = ui_->playlist->view()->selectionModel()->selectedRows();
|
||||
SongList songs;
|
||||
|
||||
foreach (const QModelIndex& proxy_index, proxy_indexes) {
|
||||
QModelIndex index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
||||
if (app_->playlist_manager()->current()->item_at(index.row())->IsLocalLibraryItem()) {
|
||||
songs << app_->playlist_manager()->current()->item_at(index.row())->Metadata();
|
||||
break;
|
||||
}
|
||||
}
|
||||
QString search = "artist:"+songs[0].artist()+" album:"+songs[0].album();
|
||||
library_view_->filter()->ShowInLibrary(search);
|
||||
}
|
||||
|
||||
void MainWindow::PlaylistRemoveCurrent() {
|
||||
ui_->playlist->view()->RemoveSelected();
|
||||
}
|
||||
|
@ -171,6 +171,7 @@ class MainWindow : public QMainWindow, public PlatformInterface {
|
||||
void PlaylistOrganiseSelected(bool copy);
|
||||
void PlaylistDelete();
|
||||
void PlaylistOpenInBrowser();
|
||||
void ShowInLibrary();
|
||||
|
||||
void ChangeLibraryQueryMode(QAction* action);
|
||||
|
||||
@ -329,6 +330,7 @@ class MainWindow : public QMainWindow, public PlatformInterface {
|
||||
QAction* playlist_stop_after_;
|
||||
QAction* playlist_undoredo_;
|
||||
QAction* playlist_organise_;
|
||||
QAction* playlist_show_in_library_;
|
||||
QAction* playlist_copy_to_library_;
|
||||
QAction* playlist_move_to_library_;
|
||||
QAction* playlist_copy_to_device_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user