New shortcut: remove current playing song from playlist (#5723)

This commit is contained in:
Alex Bikadorov 2017-05-31 18:59:36 +02:00 committed by John Maguire
parent 583eb25cfc
commit 8953227c65
5 changed files with 12 additions and 0 deletions

View File

@ -79,6 +79,9 @@ GlobalShortcuts::GlobalShortcuts(QWidget* parent)
SIGNAL(Love()));
AddShortcut("ban_last_fm_scrobbling", tr("Ban (Last.fm scrobbling)"),
SIGNAL(Ban()));
AddShortcut("remove_current_song_from_playlist",
tr("Remove current song from playlist"),
SIGNAL(RemoveCurrentSong()));
AddRatingShortcut("rate_zero_star", tr("Rate the current song 0 stars"),
rating_signals_mapper_, 0);

View File

@ -82,6 +82,7 @@ signals:
void ToggleScrobbling();
void Love();
void Ban();
void RemoveCurrentSong();
private:
void AddShortcut(const QString& id, const QString& name, const char* signal,

View File

@ -494,6 +494,10 @@ void PlaylistManager::RemoveItemsWithoutUndo(int id,
playlists_[id].p->RemoveItemsWithoutUndo(indices);
}
void PlaylistManager::RemoveCurrentSong() {
active()->removeRows(active()->current_index().row(), 1);
}
void PlaylistManager::InvalidateDeletedSongs() {
for (Playlist* playlist : GetAllPlaylists()) {
playlist->InvalidateDeletedSongs();

View File

@ -225,6 +225,8 @@ class PlaylistManager : public PlaylistManagerInterface {
// Removes items with given indices from the playlist. This operation is not
// undoable.
void RemoveItemsWithoutUndo(int id, const QList<int>& indices);
// Remove the current playing song
void RemoveCurrentSong();
private slots:
void SetActivePlaying();

View File

@ -848,6 +848,8 @@ MainWindow::MainWindow(Application* app, SystemTrayIcon* tray_icon, OSD* osd,
connect(global_shortcuts_, SIGNAL(RateCurrentSong(int)),
app_->playlist_manager(), SLOT(RateCurrentSong(int)));
connect(global_shortcuts_, SIGNAL(RemoveCurrentSong()),
app_->playlist_manager(), SLOT(RemoveCurrentSong()));
// Fancy tabs
connect(ui_->tabs, SIGNAL(ModeChanged(FancyTabWidget::Mode)),