More const detach fixes
This commit is contained in:
@@ -158,7 +158,7 @@ void CollectionFilterWidget::Init(CollectionModel *model, CollectionFilter *filt
|
||||
|
||||
const QList<QAction*> actions = filter_max_ages_.keys();
|
||||
for (QAction *action : actions) {
|
||||
int filter_max_age = filter_max_ages_[action];
|
||||
const int filter_max_age = filter_max_ages_.value(action);
|
||||
QObject::connect(action, &QAction::triggered, this, [this, filter_max_age]() { model_->SetFilterMaxAge(filter_max_age); } );
|
||||
}
|
||||
|
||||
|
||||
@@ -514,7 +514,7 @@ void CollectionModel::AddReAddOrUpdateSongsInternal(const SongList &songs) {
|
||||
songs_added << new_song;
|
||||
continue;
|
||||
}
|
||||
const Song &old_song = song_nodes_[new_song.id()]->metadata;
|
||||
const Song old_song = song_nodes_.value(new_song.id())->metadata;
|
||||
bool container_key_changed = false;
|
||||
bool has_unique_album_identifier_1 = false;
|
||||
bool has_unique_album_identifier_2 = false;
|
||||
@@ -606,7 +606,7 @@ void CollectionModel::UpdateSongsInternal(const SongList &songs) {
|
||||
qLog(Error) << "Song does not exist in model" << new_song.id() << new_song.PrettyTitleWithArtist();
|
||||
continue;
|
||||
}
|
||||
CollectionItem *item = song_nodes_[new_song.id()];
|
||||
CollectionItem *item = song_nodes_.value(new_song.id());
|
||||
const Song &old_song = item->metadata;
|
||||
const bool song_title_data_changed = IsSongTitleDataChanged(old_song, new_song);
|
||||
const bool art_changed = !old_song.IsArtEqual(new_song);
|
||||
@@ -648,7 +648,7 @@ void CollectionModel::RemoveSongsInternal(const SongList &songs) {
|
||||
for (const Song &song : songs) {
|
||||
|
||||
if (song_nodes_.contains(song.id())) {
|
||||
CollectionItem *node = song_nodes_[song.id()];
|
||||
CollectionItem *node = song_nodes_.value(song.id());
|
||||
|
||||
if (node->parent != root_) parents << node->parent;
|
||||
|
||||
@@ -706,7 +706,7 @@ void CollectionModel::RemoveSongsInternal(const SongList &songs) {
|
||||
}
|
||||
|
||||
// Remove the divider
|
||||
int row = divider_nodes_[divider_key]->row;
|
||||
const int row = divider_nodes_.value(divider_key)->row;
|
||||
beginRemoveRows(ItemToIndex(root_), row, row);
|
||||
root_->Delete(row);
|
||||
endRemoveRows();
|
||||
|
||||
@@ -611,7 +611,7 @@ void CollectionView::SearchForThis() {
|
||||
CollectionItem *item = app_->collection_model()->IndexToItem(index);
|
||||
const CollectionModel::GroupBy group_by = app_->collection_model()->GetGroupBy()[item->container_level];
|
||||
while (!item->children.isEmpty()) {
|
||||
item = item->children.first();
|
||||
item = item->children.constFirst();
|
||||
}
|
||||
|
||||
switch (group_by) {
|
||||
|
||||
@@ -1131,7 +1131,7 @@ void CollectionWatcher::RescanPathsNow() {
|
||||
if (stop_or_abort_requested()) break;
|
||||
ScanTransaction transaction(this, dir, false, false, mark_songs_unavailable_);
|
||||
|
||||
const QStringList paths = rescan_queue_[dir];
|
||||
const QStringList paths = rescan_queue_.value(dir);
|
||||
|
||||
QMap<QString, quint64> subdir_files_count;
|
||||
for (const QString &path : paths) {
|
||||
|
||||
Reference in New Issue
Block a user