MCPcopy Create free account
hub / github.com/KDE/kdevelop / updateWidgets

Method updateWidgets

plugins/astyle/astyle_preferences.cpp:131–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129}
130
131void AStylePreferences::updateWidgets()
132{
133 // block signals to avoid writing stuff to m_formatter
134 m_enableWidgetSignals = false;
135 //indent
136 if(m_formatter->option(QStringLiteral("Fill")).toString() == QLatin1String("Tabs")) {
137 chkConvertTabs->setEnabled(false);
138 chkConvertTabs->setChecked(false);
139 if (m_formatter->option(AStyleOptionKey::forceTabs()).toBool()) {
140 cbIndentType->setCurrentIndex(INDENT_TABSFORCE);
141 } else {
142 cbIndentType->setCurrentIndex(INDENT_TABS);
143 }
144 } else {
145 cbIndentType->setCurrentIndex(INDENT_SPACES);
146 chkConvertTabs->setEnabled(true);
147 chkConvertTabs->setChecked(m_formatter->option(AStyleOptionKey::tabSpaceConversion()).toBool());
148 }
149 inpNuberSpaces->setValue(m_formatter->option(QStringLiteral("FillCount")).toInt());
150 chkFillEmptyLines->setChecked(m_formatter->option(AStyleOptionKey::fillEmptyLines()).toBool());
151
152 // indent objects
153 setItemChecked(INDENT_BLOCK, m_formatter->option(QStringLiteral("IndentBlocks")).toBool());
154 setItemChecked(INDENT_BRACKET, m_formatter->option(QStringLiteral("IndentBrackets")).toBool());
155 setItemChecked(INDENT_CASE, m_formatter->option(QStringLiteral("IndentCases")).toBool());
156 setItemChecked(INDENT_CLASS, m_formatter->option(QStringLiteral("IndentClasses")).toBool());
157 setItemChecked(INDENT_LABEL, m_formatter->option(QStringLiteral("IndentLabels")).toBool());
158 setItemChecked(INDENT_NAMESPACE, m_formatter->option(QStringLiteral("IndentNamespaces")).toBool());
159 setItemChecked(INDENT_PREPROCESSOR, m_formatter->option(QStringLiteral("IndentPreprocessors")).toBool());
160 setItemChecked(INDENT_SWITCH, m_formatter->option(QStringLiteral("IndentSwitches")).toBool());
161
162 inpMaxStatement->setValue(m_formatter->option(QStringLiteral("MaxStatement")).toInt());
163 inpMinConditional->setValue(m_formatter->option(QStringLiteral("MinConditional")).toInt());
164
165 chkAfterParens->setChecked(m_formatter->option(QStringLiteral("AfterParens")).toBool());
166 inpContinuation->setValue(m_formatter->option(QStringLiteral("Continuation")).toInt());
167 inpContinuation->setEnabled(chkAfterParens->isChecked());
168
169 // brackets
170 QString s = m_formatter->option(QStringLiteral("Brackets")).toString();
171 if(s == QLatin1String("Attach"))
172 cbBrackets->setCurrentIndex(BRACKET_ATTACH);
173 else if(s == QLatin1String("Break"))
174 cbBrackets->setCurrentIndex(BRACKET_BREAK);
175 else if(s == QLatin1String("Linux"))
176 cbBrackets->setCurrentIndex(BRACKET_LINUX);
177 else
178 cbBrackets->setCurrentIndex(BRACKET_NOCHANGE);
179 chkBracketsCloseHeaders->setChecked(
180 m_formatter->option(QStringLiteral("BracketsCloseHeaders")).toBool());
181 chkBracesAdd->setChecked(m_formatter->option(AStyleOptionKey::bracesAdd()).toBool());
182
183 // blocks
184 chkBlockBreak->setChecked(m_formatter->option(QStringLiteral("BlockBreak")).toBool());
185 chkBlockBreakAll->setChecked(m_formatter->option(QStringLiteral("BlockBreakAll")).toBool());
186 chkBlockIfElse->setChecked(m_formatter->option(QStringLiteral("BlockIfElse")).toBool());
187 // enable or not chkBlockBreakAll
188 chkBlockBreakAll->setEnabled(chkBlockBreak->isChecked());

Callers 2

applyMethod · 0.80
resetMethod · 0.80

Calls 10

forceTabsFunction · 0.85
tabSpaceConversionFunction · 0.85
fillEmptyLinesFunction · 0.85
bracesAddFunction · 0.85
setCurrentIndexMethod · 0.80
toIntMethod · 0.80
toStringMethod · 0.45
optionMethod · 0.45
setEnabledMethod · 0.45
setValueMethod · 0.45

Tested by

no test coverage detected