Edit tag dialog: merged duplicate code
This commit is contained in:
parent
ff86ecddc5
commit
9d413ad01d
@ -428,11 +428,7 @@ void EditTagDialog::SelectionChanged() {
|
|||||||
if (sel.isEmpty()) return;
|
if (sel.isEmpty()) return;
|
||||||
|
|
||||||
// Set the editable fields
|
// Set the editable fields
|
||||||
ignore_edits_ = true;
|
UpdateUI(sel);
|
||||||
for (const FieldData& field : fields_) {
|
|
||||||
InitFieldValue(field, sel);
|
|
||||||
}
|
|
||||||
ignore_edits_ = false;
|
|
||||||
|
|
||||||
// If we're editing multiple songs then we have to disable certain tabs
|
// If we're editing multiple songs then we have to disable certain tabs
|
||||||
const bool multiple = sel.count() > 1;
|
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,
|
static void SetText(QLabel* label, int value, const QString& suffix,
|
||||||
const QString& def = QString()) {
|
const QString& def = QString()) {
|
||||||
label->setText(value <= 0 ? def : (QString::number(value) + " " + suffix));
|
label->setText(value <= 0 ? def : (QString::number(value) + " " + suffix));
|
||||||
@ -857,10 +861,6 @@ void EditTagDialog::FetchTagSongChosen(const Song& original_song,
|
|||||||
// Yes! Additionally update UI
|
// Yes! Additionally update UI
|
||||||
const QModelIndexList sel =
|
const QModelIndexList sel =
|
||||||
ui_->song_list->selectionModel()->selectedIndexes();
|
ui_->song_list->selectionModel()->selectedIndexes();
|
||||||
ignore_edits_ = true;
|
UpdateUI(sel);
|
||||||
for (const FieldData& field : fields_) {
|
|
||||||
InitFieldValue(field, sel);
|
|
||||||
}
|
|
||||||
ignore_edits_ = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,6 +133,8 @@ signals:
|
|||||||
void UpdateSummaryTab(const Song& song);
|
void UpdateSummaryTab(const Song& song);
|
||||||
void UpdateStatisticsTab(const Song& song);
|
void UpdateStatisticsTab(const Song& song);
|
||||||
|
|
||||||
|
void UpdateUI(const QModelIndexList& sel);
|
||||||
|
|
||||||
bool SetLoading(const QString& message);
|
bool SetLoading(const QString& message);
|
||||||
void SetSongListVisibility(bool visible);
|
void SetSongListVisibility(bool visible);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user