diff --git a/src/ui/edittagdialog.cpp b/src/ui/edittagdialog.cpp index 814ea03fb..a75878236 100644 --- a/src/ui/edittagdialog.cpp +++ b/src/ui/edittagdialog.cpp @@ -428,11 +428,7 @@ void EditTagDialog::SelectionChanged() { if (sel.isEmpty()) return; // Set the editable fields - ignore_edits_ = true; - for (const FieldData& field : fields_) { - InitFieldValue(field, sel); - } - ignore_edits_ = false; + UpdateUI(sel); // If we're editing multiple songs then we have to disable certain tabs const bool multiple = sel.count() > 1; @@ -446,6 +442,14 @@ void EditTagDialog::SelectionChanged() { } } +void EditTagDialog::UpdateUI(const QModelIndexList& sel){ + ignore_edits_ = true; + for (const FieldData& field : fields_) { + InitFieldValue(field, sel); + } + ignore_edits_ = false; +} + static void SetText(QLabel* label, int value, const QString& suffix, const QString& def = QString()) { label->setText(value <= 0 ? def : (QString::number(value) + " " + suffix)); @@ -857,10 +861,6 @@ void EditTagDialog::FetchTagSongChosen(const Song& original_song, // Yes! Additionally update UI const QModelIndexList sel = ui_->song_list->selectionModel()->selectedIndexes(); - ignore_edits_ = true; - for (const FieldData& field : fields_) { - InitFieldValue(field, sel); - } - ignore_edits_ = false; + UpdateUI(sel); } } diff --git a/src/ui/edittagdialog.h b/src/ui/edittagdialog.h index 87a136c02..9cd35b4d8 100644 --- a/src/ui/edittagdialog.h +++ b/src/ui/edittagdialog.h @@ -133,6 +133,8 @@ signals: void UpdateSummaryTab(const Song& song); void UpdateStatisticsTab(const Song& song); + void UpdateUI(const QModelIndexList& sel); + bool SetLoading(const QString& message); void SetSongListVisibility(bool visible);