Fix Qt 5 and mpris2 build errors

This commit is contained in:
Jonas Kvinge 2024-03-22 20:26:13 +01:00
parent 5e725e0bbe
commit 1a691a103e
3 changed files with 11 additions and 5 deletions

View File

@ -351,7 +351,7 @@ void Mpris2::SetRate(double rate) {
bool Mpris2::Shuffle() const {
const PlaylistSequence::ShuffleMode shuffle_mode = app_->playlist_manager()->active() ? app_->playlist_manager()->active()->RepeatMode() : app_->playlist_manager()->sequence()->repeat_mode();
const PlaylistSequence::ShuffleMode shuffle_mode = app_->playlist_manager()->active() ? app_->playlist_manager()->active()->ShuffleMode() : app_->playlist_manager()->sequence()->shuffle_mode();
return shuffle_mode != PlaylistSequence::ShuffleMode::Off;
}

View File

@ -489,7 +489,7 @@ int Playlist::last_played_row() const {
return last_played_item_index_.isValid() ? last_played_item_index_.row() : -1;
}
void Playlist::ShuffleModeChanged(const PlaylistSequence::ShuffleMode mode) {
void Playlist::ShuffleModeChanged(const PlaylistSequence::ShuffleMode) {
ReshuffleIndices();
}
@ -731,9 +731,15 @@ void Playlist::set_current_row(const int i, const AutoScroll autoscroll, const b
if (current_item_index_.isValid()) {
last_played_item_index_ = current_item_index_;
played_indexes_.append(current_item_index_);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
if (played_indexes_.count() > kMaxPlayedIndexes) {
played_indexes_.remove(0, played_indexes_.count() - kMaxPlayedIndexes);
}
#else
while (played_indexes_.count() > kMaxPlayedIndexes) {
played_indexes_.removeFirst();
}
#endif
ScheduleSave();
}
@ -1729,7 +1735,7 @@ PlaylistItemPtrList Playlist::RemoveItemsWithoutUndo(const int row, const int co
virtual_items_[virtual_items_.indexOf(i)] = i - count;
}
else {
virtual_items_.remove(virtual_items_.indexOf(i));
virtual_items_.removeAt(virtual_items_.indexOf(i));
}
}
@ -1985,7 +1991,7 @@ void Playlist::ReshuffleIndices() {
QSet<QString> album_key_set; // unique keys
// Find all the unique albums in the playlist
for (QList<int>::const_iterator it = virtual_items_.begin(); it != virtual_items_.end(); ++it) {
for (QList<int>::const_iterator it = virtual_items_.constBegin(); it != virtual_items_.constEnd(); ++it) {
const int index = *it;
const QString key = items_[index]->Metadata().AlbumKey();
album_keys[index] = key;

View File

@ -298,7 +298,7 @@ class Playlist : public QAbstractListModel {
void RemoveUnavailableSongs();
void Shuffle();
void ShuffleModeChanged(const PlaylistSequence::ShuffleMode mode);
void ShuffleModeChanged(const PlaylistSequence::ShuffleMode);
void SetColumnAlignment(const ColumnAlignmentMap &alignment);