Greying out song and added verification to next on album mode
This commit is contained in:
parent
5c21768760
commit
c817431593
@ -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 ; j<virtual_items_.count(); ++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()) &&
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -356,6 +356,7 @@ class Playlist : public QAbstractListModel {
|
||||
void ItemReloadComplete();
|
||||
void ItemsLoaded();
|
||||
void SongInsertVetoListenerDestroyed();
|
||||
|
||||
private:
|
||||
bool is_loading_;
|
||||
PlaylistFilter* proxy_;
|
||||
|
@ -33,7 +33,8 @@ class SqlRow;
|
||||
class PlaylistItem : public boost::enable_shared_from_this<PlaylistItem> {
|
||||
public:
|
||||
PlaylistItem(const QString& type)
|
||||
: to_skip_(false), type_(type) {}
|
||||
: to_skip_(false),
|
||||
type_(type) {}
|
||||
virtual ~PlaylistItem();
|
||||
|
||||
static PlaylistItem* NewFromType(const QString& type);
|
||||
|
@ -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<skipped_indexes_.count() ; ++i) {
|
||||
qDebug() << skipped_indexes_[i].row();
|
||||
if (skipped_indexes_[i].row() == source_row)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
QModelIndex Queue::mapToSource(const QModelIndex& proxy_index) const {
|
||||
if (!proxy_index.isValid())
|
||||
return QModelIndex();
|
||||
@ -167,26 +156,6 @@ void Queue::ToggleTracks(const QModelIndexList &source_indexes) {
|
||||
}
|
||||
}
|
||||
|
||||
void Queue::SkipTracks(const QModelIndexList &source_indexes) {
|
||||
qDebug() << "Enqueuing";
|
||||
foreach (const QModelIndex& source_index, source_indexes) {
|
||||
QModelIndex proxy_index = mapFromSource(source_index);
|
||||
if (proxy_index.isValid()) {
|
||||
// Dequeue the track
|
||||
const int row = proxy_index.row();
|
||||
beginRemoveRows(QModelIndex(), row, row);
|
||||
skipped_indexes_.removeAt(row);
|
||||
endRemoveRows();
|
||||
} else {
|
||||
// Enqueue the track
|
||||
const int row = source_indexes_.count();
|
||||
beginInsertRows(QModelIndex(), row, row);
|
||||
skipped_indexes_ << QPersistentModelIndex(source_index);
|
||||
endInsertRows();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int Queue::PositionOf(const QModelIndex& source_index) const {
|
||||
return mapFromSource(source_index).row();
|
||||
}
|
||||
|
@ -34,13 +34,11 @@ public:
|
||||
bool is_empty() const;
|
||||
int PositionOf(const QModelIndex& source_index) const;
|
||||
bool ContainsSourceRow(int source_row) const;
|
||||
bool SkipSourceRow(int source_row) const;
|
||||
int PeekNext() const;
|
||||
|
||||
// Modify the queue
|
||||
int TakeNext();
|
||||
void ToggleTracks(const QModelIndexList& source_indexes);
|
||||
void SkipTracks(const QModelIndexList& source_indexes);
|
||||
void Clear();
|
||||
void Move(const QList<int>& proxy_rows, int pos);
|
||||
void MoveUp(int row);
|
||||
@ -71,8 +69,6 @@ private slots:
|
||||
|
||||
private:
|
||||
QList<QPersistentModelIndex> source_indexes_;
|
||||
QList<QPersistentModelIndex> skipped_indexes_;
|
||||
|
||||
};
|
||||
|
||||
#endif // QUEUE_H
|
||||
|
@ -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"));
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user