From c8174315933054263e0aee7f2e810f9db37d4cad Mon Sep 17 00:00:00 2001 From: asiviero Date: Mon, 20 Jan 2014 21:42:00 -0200 Subject: [PATCH] Greying out song and added verification to next on album mode --- src/playlist/playlist.cpp | 13 +++++++++++++ src/playlist/playlist.h | 1 + src/playlist/playlistitem.h | 3 ++- src/playlist/queue.cpp | 31 ------------------------------- src/playlist/queue.h | 4 ---- src/ui/mainwindow.cpp | 6 +++--- 6 files changed, 19 insertions(+), 39 deletions(-) diff --git a/src/playlist/playlist.cpp b/src/playlist/playlist.cpp index 4e0da93f2..25284ba9f 100644 --- a/src/playlist/playlist.cpp +++ b/src/playlist/playlist.cpp @@ -452,6 +452,9 @@ int Playlist::NextVirtualIndex(int i, bool ignore_repeat_track) const { // We need to advance i until we get something else on the same album Song last_song = current_item_metadata(); for (int j=i+1 ; jGetToSkip()) { + continue; + } Song this_song = item_at(virtual_items_[j])->Metadata(); if (((last_song.is_compilation() && this_song.is_compilation()) || last_song.artist() == this_song.artist()) && @@ -492,6 +495,9 @@ int Playlist::PreviousVirtualIndex(int i, bool ignore_repeat_track) const { // We need to decrement i until we get something else on the same album Song last_song = current_item_metadata(); for (int j=i-1 ; j>=0; --j) { + if (item_at(virtual_items_[j])->GetToSkip()) { + continue; + } Song this_song = item_at(virtual_items_[j])->Metadata(); if (((last_song.is_compilation() && this_song.is_compilation()) || last_song.artist() == this_song.artist()) && @@ -2023,5 +2029,12 @@ void Playlist::SkipTracks(const QModelIndexList &source_indexes) { foreach (const QModelIndex& source_index, source_indexes) { PlaylistItemPtr track_to_skip = item_at(source_index.row()); track_to_skip->SetToSkip(!((track_to_skip)->GetToSkip())); + // gray out the song if it's now to be skipped; + // otherwise undo the gray color + if (track_to_skip->GetToSkip()) { + track_to_skip->SetForegroundColor(kInvalidSongPriority, kInvalidSongColor); + } else { + track_to_skip->RemoveForegroundColor(kInvalidSongPriority); + } } } diff --git a/src/playlist/playlist.h b/src/playlist/playlist.h index ac0a54615..0ec99805e 100644 --- a/src/playlist/playlist.h +++ b/src/playlist/playlist.h @@ -356,6 +356,7 @@ class Playlist : public QAbstractListModel { void ItemReloadComplete(); void ItemsLoaded(); void SongInsertVetoListenerDestroyed(); + private: bool is_loading_; PlaylistFilter* proxy_; diff --git a/src/playlist/playlistitem.h b/src/playlist/playlistitem.h index 5dce559ba..1c53d9e01 100644 --- a/src/playlist/playlistitem.h +++ b/src/playlist/playlistitem.h @@ -33,7 +33,8 @@ class SqlRow; class PlaylistItem : public boost::enable_shared_from_this { public: PlaylistItem(const QString& type) - : to_skip_(false), type_(type) {} + : to_skip_(false), + type_(type) {} virtual ~PlaylistItem(); static PlaylistItem* NewFromType(const QString& type); diff --git a/src/playlist/queue.cpp b/src/playlist/queue.cpp index 5b160e34b..691402dd2 100644 --- a/src/playlist/queue.cpp +++ b/src/playlist/queue.cpp @@ -48,17 +48,6 @@ bool Queue::ContainsSourceRow(int source_row) const { return false; } -bool Queue::SkipSourceRow(int source_row) const { - qDebug() << "Entrou aqui"; - qDebug() << source_row; - for (int i=0 ; i& proxy_rows, int pos); void MoveUp(int row); @@ -71,8 +69,6 @@ private slots: private: QList source_indexes_; - QList skipped_indexes_; - }; #endif // QUEUE_H diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index f804e0b3b..bfb002c1d 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -1386,9 +1386,9 @@ void MainWindow::PlaylistRightClick(const QPoint& global_pos, const QModelIndex& else if (in_skipped > 1 && not_in_skipped == 0) playlist_skip_->setText(tr("Unskip selected tracks")); else if (in_skipped == 0 && not_in_skipped == 1) - playlist_skip_->setText(tr("Skip track")); - else if (in_skipped == 0 && not_in_skipped > 1) - playlist_skip_->setText(tr("Skip selected tracks")); + playlist_skip_->setText(tr("Skip track")); + else if (in_skipped == 0 && not_in_skipped > 1) + playlist_skip_->setText(tr("Skip selected tracks"));