Commit 8c2606c1 authored by Igor Kushnir's avatar Igor Kushnir Committed by Nicolás Alvarez
Browse files

Don't call SourceFormatterSelectionEdit::resetUi() redundantly

When Configure KDevelop dialog is shown, this function is called once
for each source formatter plugin, plus one more time, which amounts to 3
times with the 2 enabled by default plugins. loadSettings() is always
called after the constructor, so let it make the one resetUi() call.
Note that resetUi() should not be called before loadSettings(), because
user-selected formatters and styles cannot be displayed before
loadSettings() reads them from configuration.
parent a3f748cc
Pipeline #95969 passed with stage
in 34 minutes and 29 seconds
......@@ -109,7 +109,7 @@ SourceFormatterSelectionEdit::SourceFormatterSelectionEdit(QWidget* parent)
this, &SourceFormatterSelectionEdit::removeSourceFormatter);
const auto& formatters = controller->formatters();
for (auto* formatter : formatters) {
addSourceFormatter(formatter);
addSourceFormatterNoUi(formatter); // loadSettings() calls resetUi() once later
}
}
......@@ -126,7 +126,7 @@ static void selectAvailableStyle(LanguageSettings& lang)
lang.selectedStyle = *lang.selectedFormatter->styles.begin();
}
void SourceFormatterSelectionEdit::addSourceFormatter(ISourceFormatter* ifmt)
void SourceFormatterSelectionEdit::addSourceFormatterNoUi(ISourceFormatter* ifmt)
{
Q_D(SourceFormatterSelectionEdit);
......@@ -161,7 +161,11 @@ void SourceFormatterSelectionEdit::addSourceFormatter(ISourceFormatter* ifmt)
}
}
}
}
void SourceFormatterSelectionEdit::addSourceFormatter(ISourceFormatter* ifmt)
{
addSourceFormatterNoUi(ifmt);
resetUi();
}
......
......@@ -49,6 +49,7 @@ private Q_SLOTS:
void styleNameChanged(QListWidgetItem* );
private:
void addSourceFormatterNoUi(KDevelop::ISourceFormatter* ifmt);
void resetUi();
void updatePreview();
QListWidgetItem* addStyle(const KDevelop::SourceFormatterStyle& s);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment