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
|
// We need to advance i until we get something else on the same album
|
||||||
Song last_song = current_item_metadata();
|
Song last_song = current_item_metadata();
|
||||||
for (int j=i+1 ; j<virtual_items_.count(); ++j) {
|
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();
|
Song this_song = item_at(virtual_items_[j])->Metadata();
|
||||||
if (((last_song.is_compilation() && this_song.is_compilation()) ||
|
if (((last_song.is_compilation() && this_song.is_compilation()) ||
|
||||||
last_song.artist() == this_song.artist()) &&
|
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
|
// We need to decrement i until we get something else on the same album
|
||||||
Song last_song = current_item_metadata();
|
Song last_song = current_item_metadata();
|
||||||
for (int j=i-1 ; j>=0; --j) {
|
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();
|
Song this_song = item_at(virtual_items_[j])->Metadata();
|
||||||
if (((last_song.is_compilation() && this_song.is_compilation()) ||
|
if (((last_song.is_compilation() && this_song.is_compilation()) ||
|
||||||
last_song.artist() == this_song.artist()) &&
|
last_song.artist() == this_song.artist()) &&
|
||||||
|
@ -2023,5 +2029,12 @@ void Playlist::SkipTracks(const QModelIndexList &source_indexes) {
|
||||||
foreach (const QModelIndex& source_index, source_indexes) {
|
foreach (const QModelIndex& source_index, source_indexes) {
|
||||||
PlaylistItemPtr track_to_skip = item_at(source_index.row());
|
PlaylistItemPtr track_to_skip = item_at(source_index.row());
|
||||||
track_to_skip->SetToSkip(!((track_to_skip)->GetToSkip()));
|
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 ItemReloadComplete();
|
||||||
void ItemsLoaded();
|
void ItemsLoaded();
|
||||||
void SongInsertVetoListenerDestroyed();
|
void SongInsertVetoListenerDestroyed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool is_loading_;
|
bool is_loading_;
|
||||||
PlaylistFilter* proxy_;
|
PlaylistFilter* proxy_;
|
||||||
|
|
|
@ -33,7 +33,8 @@ class SqlRow;
|
||||||
class PlaylistItem : public boost::enable_shared_from_this<PlaylistItem> {
|
class PlaylistItem : public boost::enable_shared_from_this<PlaylistItem> {
|
||||||
public:
|
public:
|
||||||
PlaylistItem(const QString& type)
|
PlaylistItem(const QString& type)
|
||||||
: to_skip_(false), type_(type) {}
|
: to_skip_(false),
|
||||||
|
type_(type) {}
|
||||||
virtual ~PlaylistItem();
|
virtual ~PlaylistItem();
|
||||||
|
|
||||||
static PlaylistItem* NewFromType(const QString& type);
|
static PlaylistItem* NewFromType(const QString& type);
|
||||||
|
|
|
@ -48,17 +48,6 @@ bool Queue::ContainsSourceRow(int source_row) const {
|
||||||
return false;
|
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 {
|
QModelIndex Queue::mapToSource(const QModelIndex& proxy_index) const {
|
||||||
if (!proxy_index.isValid())
|
if (!proxy_index.isValid())
|
||||||
return QModelIndex();
|
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 {
|
int Queue::PositionOf(const QModelIndex& source_index) const {
|
||||||
return mapFromSource(source_index).row();
|
return mapFromSource(source_index).row();
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,13 +34,11 @@ public:
|
||||||
bool is_empty() const;
|
bool is_empty() const;
|
||||||
int PositionOf(const QModelIndex& source_index) const;
|
int PositionOf(const QModelIndex& source_index) const;
|
||||||
bool ContainsSourceRow(int source_row) const;
|
bool ContainsSourceRow(int source_row) const;
|
||||||
bool SkipSourceRow(int source_row) const;
|
|
||||||
int PeekNext() const;
|
int PeekNext() const;
|
||||||
|
|
||||||
// Modify the queue
|
// Modify the queue
|
||||||
int TakeNext();
|
int TakeNext();
|
||||||
void ToggleTracks(const QModelIndexList& source_indexes);
|
void ToggleTracks(const QModelIndexList& source_indexes);
|
||||||
void SkipTracks(const QModelIndexList& source_indexes);
|
|
||||||
void Clear();
|
void Clear();
|
||||||
void Move(const QList<int>& proxy_rows, int pos);
|
void Move(const QList<int>& proxy_rows, int pos);
|
||||||
void MoveUp(int row);
|
void MoveUp(int row);
|
||||||
|
@ -71,8 +69,6 @@ private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<QPersistentModelIndex> source_indexes_;
|
QList<QPersistentModelIndex> source_indexes_;
|
||||||
QList<QPersistentModelIndex> skipped_indexes_;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QUEUE_H
|
#endif // QUEUE_H
|
||||||
|
|
Loading…
Reference in New Issue