diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2013-07-17 00:01:45 +0300 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2013-07-17 11:11:25 +0200 |
commit | ad9e7ccab6e8476c0cb478ea2e4f13354dc21635 (patch) | |
tree | 9c67e7cfec7e7d0603e9279de9227cdef1cac530 /src | |
parent | c67f7f63497b321f42ee0081f29b7e3804023a10 (diff) | |
download | qt-creator-ad9e7ccab6e8476c0cb478ea2e4f13354dc21635.tar.gz |
Fix coding style for else statements
Change-Id: I1309db70e98d678e150388c76ce665e988fdf081
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Diffstat (limited to 'src')
92 files changed, 305 insertions, 435 deletions
diff --git a/src/app/main.cpp b/src/app/main.cpp index a48d6d4d7c..acccb28b49 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -400,12 +400,11 @@ int main(int argc, char **argv) QNetworkProxy proxy(QNetworkProxy::HttpProxy, proxyUrl.host(), proxyUrl.port(), proxyUrl.userName(), proxyUrl.password()); QNetworkProxy::setApplicationProxy(proxy); - } # if defined(Q_OS_MAC) // unix and mac - else { + } else { QNetworkProxyFactory::setUseSystemConfiguration(true); - } # endif + } #else // windows QNetworkProxyFactory::setUseSystemConfiguration(true); #endif diff --git a/src/libs/cplusplus/CppRewriter.cpp b/src/libs/cplusplus/CppRewriter.cpp index 0224da4b02..4e59c37738 100644 --- a/src/libs/cplusplus/CppRewriter.cpp +++ b/src/libs/cplusplus/CppRewriter.cpp @@ -129,9 +129,9 @@ public: virtual void visit(NamedType *type) { FullySpecifiedType ty = rewrite->env->apply(type->name(), rewrite); - if (! ty->isUndefinedType()) + if (! ty->isUndefinedType()) { temps.append(ty); - else { + } else { const Name *name = rewrite->rewriteName(type->name()); temps.append(control()->namedType(name)); } diff --git a/src/libs/cplusplus/DeprecatedGenTemplateInstance.cpp b/src/libs/cplusplus/DeprecatedGenTemplateInstance.cpp index 027c561cef..bbae274faf 100644 --- a/src/libs/cplusplus/DeprecatedGenTemplateInstance.cpp +++ b/src/libs/cplusplus/DeprecatedGenTemplateInstance.cpp @@ -264,7 +264,7 @@ private: if (! name) return name; - else if (const Identifier *nameId = name->asNameId()) { + if (const Identifier *nameId = name->asNameId()) { const Identifier *id = control()->identifier(nameId->chars(), nameId->size()); return id; diff --git a/src/libs/cplusplus/ExpressionUnderCursor.cpp b/src/libs/cplusplus/ExpressionUnderCursor.cpp index df002672ee..35e16ab0c1 100644 --- a/src/libs/cplusplus/ExpressionUnderCursor.cpp +++ b/src/libs/cplusplus/ExpressionUnderCursor.cpp @@ -263,19 +263,20 @@ int ExpressionUnderCursor::startOfFunctionCall(const QTextCursor &cursor) const forever { const Token &tk = scanner[index - 1]; - if (tk.is(T_EOF_SYMBOL)) + if (tk.is(T_EOF_SYMBOL)) { break; - else if (tk.is(T_LPAREN)) + } else if (tk.is(T_LPAREN)) { return scanner.startPosition() + tk.begin(); - else if (tk.is(T_RPAREN)) { + } else if (tk.is(T_RPAREN)) { int matchingBrace = scanner.startOfMatchingBrace(index); if (matchingBrace == index) // If no matching brace found return -1; index = matchingBrace; - } else + } else { --index; + } } return -1; diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp index f707601dba..5f7b7db312 100644 --- a/src/libs/cplusplus/LookupContext.cpp +++ b/src/libs/cplusplus/LookupContext.cpp @@ -57,7 +57,7 @@ static void addNames(const Name *name, QList<const Name *> *names, bool addAllNa { if (! name) return; - else if (const QualifiedNameId *q = name->asQualifiedNameId()) { + if (const QualifiedNameId *q = name->asQualifiedNameId()) { addNames(q->base(), names); addNames(q->name(), names, addAllNames); } else if (addAllNames || name->isNameId() || name->isTemplateNameId() || name->isAnonymousNameId()) { @@ -98,7 +98,7 @@ static inline bool compareName(const Name *name, const Name *other) if (name == other) return true; - else if (name && other) { + if (name && other) { const Identifier *id = name->identifier(); const Identifier *otherId = other->identifier(); @@ -599,10 +599,9 @@ QList<LookupItem> ClassOrNamespace::lookup_helper(const Name *name, bool searchI if (name) { if (const QualifiedNameId *q = name->asQualifiedNameId()) { - if (! q->base()) // e.g. ::std::string + if (! q->base()) { // e.g. ::std::string result = globalNamespace()->find(q->name()); - - else if (ClassOrNamespace *binding = lookupType(q->base())) { + } else if (ClassOrNamespace *binding = lookupType(q->base())) { result = binding->find(q->name()); QList<const Name *> fullName; @@ -864,7 +863,7 @@ ClassOrNamespace *ClassOrNamespace::lookupType_helper(const Name *name, if (ClassOrNamespace *e = nestedType(name, origin)) return e; - else if (_templateId) { + if (_templateId) { if (_usings.size() == 1) { ClassOrNamespace *delegate = _usings.first(); @@ -1265,8 +1264,7 @@ bool ClassOrNamespace::NestedClassInstantiator::isInstantiateNestedClassNeeded(c if (Declaration *declaration = memberAsSymbol->asDeclaration()) { if (containsTemplateType(declaration)) return true; - } - else if (Function *function = memberAsSymbol->asFunction()) { + } else if (Function *function = memberAsSymbol->asFunction()) { if (containsTemplateType(function)) return true; } @@ -1447,7 +1445,7 @@ void CreateBindings::process(Document::Ptr doc) if (! doc) return; - else if (Namespace *globalNamespace = doc->globalNamespace()) { + if (Namespace *globalNamespace = doc->globalNamespace()) { if (! _processed.contains(globalNamespace)) { _processed.insert(globalNamespace); diff --git a/src/libs/cplusplus/MatchingText.cpp b/src/libs/cplusplus/MatchingText.cpp index b6fb54011a..6dedaec364 100644 --- a/src/libs/cplusplus/MatchingText.cpp +++ b/src/libs/cplusplus/MatchingText.cpp @@ -244,7 +244,7 @@ QString MatchingText::insertParagraphSeparator(const QTextCursor &tc) const if (current.is(T_EOF_SYMBOL)) break; - else if (current.is(T_CLASS) || current.is(T_STRUCT) || current.is(T_UNION) || current.is(T_ENUM)) { + if (current.is(T_CLASS) || current.is(T_STRUCT) || current.is(T_UNION) || current.is(T_ENUM)) { // found a class key. QString str = QLatin1String("};"); diff --git a/src/libs/cplusplus/PreprocessorEnvironment.cpp b/src/libs/cplusplus/PreprocessorEnvironment.cpp index be736b8569..23327dfefa 100644 --- a/src/libs/cplusplus/PreprocessorEnvironment.cpp +++ b/src/libs/cplusplus/PreprocessorEnvironment.cpp @@ -170,8 +170,7 @@ bool Environment::isBuiltinMacro(const ByteArrayRef &s) } } } - } - else if (s[2] == 'F') { + } else if (s[2] == 'F') { if (s[3] == 'I') { if (s[4] == 'L') { if (s[5] == 'E') { @@ -183,8 +182,7 @@ bool Environment::isBuiltinMacro(const ByteArrayRef &s) } } } - } - else if (s[2] == 'L') { + } else if (s[2] == 'L') { if (s[3] == 'I') { if (s[4] == 'N') { if (s[5] == 'E') { @@ -196,8 +194,7 @@ bool Environment::isBuiltinMacro(const ByteArrayRef &s) } } } - } - else if (s[2] == 'T') { + } else if (s[2] == 'T') { if (s[3] == 'I') { if (s[4] == 'M') { if (s[5] == 'E') { diff --git a/src/libs/cplusplus/ResolveExpression.cpp b/src/libs/cplusplus/ResolveExpression.cpp index 63dc2b92b2..4b20466458 100644 --- a/src/libs/cplusplus/ResolveExpression.cpp +++ b/src/libs/cplusplus/ResolveExpression.cpp @@ -576,16 +576,14 @@ bool ResolveExpression::visit(SimpleNameAST *ast) if (n == 0) { item.setType(newType); item.setScope(typeItems[n].scope()); - } - else { + } else { LookupItem newItem(item); newItem.setType(newType); newItem.setScope(typeItems[n].scope()); newCandidates.push_back(newItem); } } - } - else { + } else { item.setType(item.declaration()->type()); item.setScope(item.declaration()->enclosingScope()); } diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp index 659b888327..0f678adf02 100644 --- a/src/libs/cplusplus/pp-engine.cpp +++ b/src/libs/cplusplus/pp-engine.cpp @@ -1862,12 +1862,11 @@ void Preprocessor::handleElseDirective(PPToken *tk, const PPToken £Token) else if (m_client && !wasSkipping && startSkipping) startSkippingBlocks(poundToken); } - } #ifndef NO_DEBUG - else { + } else { std::cerr << "*** WARNING #else without #if" << std::endl; - } #endif // NO_DEBUG + } } void Preprocessor::handleEndIfDirective(PPToken *tk, const PPToken £Token) @@ -1930,12 +1929,11 @@ void Preprocessor::handleIfDefDirective(bool checkUndefined, PPToken *tk) startSkippingBlocks(*tk); lex(tk); // consume the identifier - } #ifndef NO_DEBUG - else { + } else { std::cerr << "*** WARNING #ifdef without identifier" << std::endl; - } #endif // NO_DEBUG + } } void Preprocessor::handleUndefDirective(PPToken *tk) @@ -1948,12 +1946,11 @@ void Preprocessor::handleUndefDirective(PPToken *tk) if (m_client && macro) m_client->macroAdded(*macro); lex(tk); // consume macro name - } #ifndef NO_DEBUG - else { + } else { std::cerr << "*** WARNING #undef without identifier" << std::endl; - } #endif // NO_DEBUG + } } PPToken Preprocessor::generateToken(enum Kind kind, diff --git a/src/libs/cplusplus/pp-scanner.cpp b/src/libs/cplusplus/pp-scanner.cpp index 9f3320e4d3..2b23a3e228 100644 --- a/src/libs/cplusplus/pp-scanner.cpp +++ b/src/libs/cplusplus/pp-scanner.cpp @@ -259,13 +259,13 @@ const char *pp_skip_argument::operator () (const char *__first, const char *__la lines = 0; while (__first != __last) { - if (!depth && (*__first == ')' || *__first == ',')) + if (!depth && (*__first == ')' || *__first == ',')) { break; - else if (*__first == '(') + } else if (*__first == '(') { ++depth, ++__first; - else if (*__first == ')') + } else if (*__first == ')') { --depth, ++__first; - else if (*__first == '\"') { + } else if (*__first == '\"') { __first = skip_string_literal (__first, __last); lines += skip_string_literal.lines; } else if (*__first == '\'') { @@ -283,8 +283,9 @@ const char *pp_skip_argument::operator () (const char *__first, const char *__la } else if (*__first == '\n') { ++__first; ++lines; - } else + } else { ++__first; + } } return __first; diff --git a/src/libs/extensionsystem/pluginmanager.cpp b/src/libs/extensionsystem/pluginmanager.cpp index 87fa98b931..c8c6d0aaf6 100644 --- a/src/libs/extensionsystem/pluginmanager.cpp +++ b/src/libs/extensionsystem/pluginmanager.cpp @@ -1183,9 +1183,9 @@ void PluginManagerPrivate::readPluginPaths() PluginCollection *collection = 0; // find correct plugin collection or create a new one - if (pluginCategories.contains(spec->category())) + if (pluginCategories.contains(spec->category())) { collection = pluginCategories.value(spec->category()); - else { + } else { collection = new PluginCollection(spec->category()); pluginCategories.insert(spec->category(), collection); } diff --git a/src/libs/glsl/glslsymbols.cpp b/src/libs/glsl/glslsymbols.cpp index 69d02c5d0b..5c4978f021 100644 --- a/src/libs/glsl/glslsymbols.cpp +++ b/src/libs/glsl/glslsymbols.cpp @@ -109,9 +109,9 @@ QList<Symbol *> Namespace::members() const void Namespace::add(Symbol *symbol) { Symbol *&sym = _members[symbol->name()]; - if (! sym) + if (! sym) { sym = symbol; - else if (Function *fun = symbol->asFunction()) { + } else if (Function *fun = symbol->asFunction()) { if (OverloadSet *o = sym->asOverloadSet()) { o->addFunction(fun); } else if (Function *firstFunction = sym->asFunction()) { @@ -121,8 +121,7 @@ void Namespace::add(Symbol *symbol) o->addFunction(firstFunction); o->addFunction(fun); sym = o; - } - else { + } else { // ### warning? return false? } } else { diff --git a/src/libs/glsl/glsltypes.cpp b/src/libs/glsl/glsltypes.cpp index f23f3f14c1..1ac7222ac7 100644 --- a/src/libs/glsl/glsltypes.cpp +++ b/src/libs/glsl/glsltypes.cpp @@ -298,9 +298,9 @@ bool MatrixType::isLessThan(const Type *other) const Q_ASSERT(other != 0); const MatrixType *mat = other->asMatrixType(); Q_ASSERT(mat != 0); - if (_columns < mat->columns()) + if (_columns < mat->columns()) { return true; - else if (_columns == mat->columns()) { + } else if (_columns == mat->columns()) { if (_rows < mat->rows()) return true; else if (_rows == mat->rows() && _elementType < mat->elementType()) diff --git a/src/libs/qmleditorwidgets/easingpane/easingcontextpane.cpp b/src/libs/qmleditorwidgets/easingpane/easingcontextpane.cpp index d54efe5c59..6d6508ca0a 100644 --- a/src/libs/qmleditorwidgets/easingpane/easingcontextpane.cpp +++ b/src/libs/qmleditorwidgets/easingpane/easingcontextpane.cpp @@ -228,9 +228,9 @@ void EasingContextPane::setGraphDisplayMode(GraphDisplayMode newMode) void EasingContextPane::startAnimation() { - if (m_simulation->running()) + if (m_simulation->running()) { m_simulation->stop(); - else { + } else { m_simulation->animate(ui->durationSpinBox->value(), m_easingGraph->easingCurve()); ui->playButton->setIcon(QIcon(QLatin1String(":/stopicon.png"))); } diff --git a/src/libs/qmljs/parser/qmljslexer.cpp b/src/libs/qmljs/parser/qmljslexer.cpp index 99a800e2ef..68e5e9519d 100644 --- a/src/libs/qmljs/parser/qmljslexer.cpp +++ b/src/libs/qmljs/parser/qmljslexer.cpp @@ -905,7 +905,7 @@ bool Lexer::scanRegExp(RegExpBodyPrefix prefix) while (! _char.isNull() && ! isLineTerminator()) { if (_char == QLatin1Char(']')) break; - else if (_char == QLatin1Char('\\')) { + if (_char == QLatin1Char('\\')) { // regular expression backslash sequence _tokenText += _char; scanChar(); diff --git a/src/libs/qmljs/qmljsbind.cpp b/src/libs/qmljs/qmljsbind.cpp index 54b9a204f2..1e156933d5 100644 --- a/src/libs/qmljs/qmljsbind.cpp +++ b/src/libs/qmljs/qmljsbind.cpp @@ -154,9 +154,9 @@ ObjectValue *Bind::bindObject(UiQualifiedId *qualifiedTypeNameId, UiObjectInitia parentObjectValue = switchObjectValue(objectValue); - if (parentObjectValue) + if (parentObjectValue) { objectValue->setMember(QLatin1String("parent"), parentObjectValue); - else if (!_rootObjectValue) { + } else if (!_rootObjectValue) { _rootObjectValue = objectValue; _rootObjectValue->setClassName(_doc->componentName()); } diff --git a/src/libs/qmljs/qmljsreformatter.cpp b/src/libs/qmljs/qmljsreformatter.cpp index a9eede5e3e..b3d5d1e7d3 100644 --- a/src/libs/qmljs/qmljsreformatter.cpp +++ b/src/libs/qmljs/qmljsreformatter.cpp @@ -255,14 +255,13 @@ protected: qreal result = badnessFromSplits; foreach (const QString &line, lines) { // really long lines should be avoided at all cost - if (line.size() > strongMaxLineLength) + if (line.size() > strongMaxLineLength) { result += 50 + (line.size() - strongMaxLineLength); // having long lines is bad - else if (line.size() > maxLineLength) { + } else if (line.size() > maxLineLength) { result += 3 + (line.size() - maxLineLength); - } // and even ok-sized lines should have a cost - else { + } else { result += 1; } diff --git a/src/libs/qmljs/qmljsrewriter.cpp b/src/libs/qmljs/qmljsrewriter.cpp index b4957f08a2..012bad73ee 100644 --- a/src/libs/qmljs/qmljsrewriter.cpp +++ b/src/libs/qmljs/qmljsrewriter.cpp @@ -282,9 +282,8 @@ void Rewriter::changeBinding(UiObjectInitializer *ast, } break; - } // for grouped properties: - else if (!prefix.isEmpty()) { + } else if (!prefix.isEmpty()) { if (UiObjectDefinition *def = cast<UiObjectDefinition *>(member)) { if (toString(def->qualifiedTypeNameId) == prefix) changeBinding(def->initializer, suffix, newValue, binding); @@ -384,10 +383,10 @@ void Rewriter::removeBindingByName(UiObjectInitializer *ast, const QString &prop UiObjectMember *member = it->member; // run full name match (for ungrouped properties): - if (isMatchingPropertyMember(propertyName, member)) + if (isMatchingPropertyMember(propertyName, member)) { removeMember(member); // check for grouped properties: - else if (!prefix.isEmpty()) { + } else if (!prefix.isEmpty()) { if (UiObjectDefinition *def = cast<UiObjectDefinition *>(member)) { if (toString(def->qualifiedTypeNameId) == prefix) removeGroupedProperty(def, propertyName); diff --git a/src/libs/qmljs/qmljsscopebuilder.cpp b/src/libs/qmljs/qmljsscopebuilder.cpp index a68e9e28f2..2178132498 100644 --- a/src/libs/qmljs/qmljsscopebuilder.cpp +++ b/src/libs/qmljs/qmljsscopebuilder.cpp @@ -80,10 +80,10 @@ void ScopeBuilder::push(AST::Node *node) break; } // signals defined in QML - if (const ASTSignal *astsig = value_cast<ASTSignal>(value)) + if (const ASTSignal *astsig = value_cast<ASTSignal>(value)) { _scopeChain->appendJsScope(astsig->bodyScope()); // signals defined in C++ - else if (const CppComponentValue *qmlObject = value_cast<CppComponentValue>(owner)) { + } else if (const CppComponentValue *qmlObject = value_cast<CppComponentValue>(owner)) { if (const ObjectValue *scope = qmlObject->signalScope(name)) _scopeChain->appendJsScope(scope); } diff --git a/src/libs/qtcomponents/styleitem/qstyleitem.cpp b/src/libs/qtcomponents/styleitem/qstyleitem.cpp index d7f2333467..ecdde82d11 100644 --- a/src/libs/qtcomponents/styleitem/qstyleitem.cpp +++ b/src/libs/qtcomponents/styleitem/qstyleitem.cpp @@ -860,9 +860,8 @@ QRect QStyleItem::subControlRect(const QString &subcontrolString) subcontrol = QStyle::SC_SpinBoxDown; else if (subcontrolString == QLatin1String("up")) subcontrol = QStyle::SC_SpinBoxUp; - else if (subcontrolString == QLatin1String("edit")){ + else if (subcontrolString == QLatin1String("edit")) subcontrol = QStyle::SC_SpinBoxEditField; - } return qApp->style()->subControlRect(control, qstyleoption_cast<QStyleOptionComplex*>(m_styleoption), subcontrol, widget()); diff --git a/src/libs/ssh/ssh.qbs b/src/libs/ssh/ssh.qbs index 924e8918d7..87b0061840 100644 --- a/src/libs/ssh/ssh.qbs +++ b/src/libs/ssh/ssh.qbs @@ -66,9 +66,9 @@ QtcLibrary { } property var botanDefines: { var result = []; - if (useSystemBotan) + if (useSystemBotan) { result.push("USE_SYSTEM_BOTAN") - else { + } else { result.push("BOTAN_DLL=") if (qbs.toolchain === "msvc") result.push("BOTAN_BUILD_COMPILER_IS_MSVC", "BOTAN_TARGET_OS_HAS_GMTIME_S") diff --git a/src/libs/utils/fancymainwindow.cpp b/src/libs/utils/fancymainwindow.cpp index 2c3dd06cf0..8db1e21723 100644 --- a/src/libs/utils/fancymainwindow.cpp +++ b/src/libs/utils/fancymainwindow.cpp @@ -124,9 +124,9 @@ void FancyMainWindow::updateDockWidget(QDockWidget *dockWidget) : QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable; if (dockWidget->property("managed_dockwidget").isNull()) { // for the debugger tool bar QWidget *titleBarWidget = dockWidget->titleBarWidget(); - if (d->m_locked && !titleBarWidget && !dockWidget->isFloating()) + if (d->m_locked && !titleBarWidget && !dockWidget->isFloating()) { titleBarWidget = new QWidget(dockWidget); - else if ((!d->m_locked || dockWidget->isFloating()) && titleBarWidget) { + } else if ((!d->m_locked || dockWidget->isFloating()) && titleBarWidget) { delete titleBarWidget; titleBarWidget = 0; } diff --git a/src/libs/utils/tooltip/tooltip.cpp b/src/libs/utils/tooltip/tooltip.cpp index ab2ade2293..ea5659ba30 100644 --- a/src/libs/utils/tooltip/tooltip.cpp +++ b/src/libs/utils/tooltip/tooltip.cpp @@ -162,9 +162,9 @@ bool ToolTip::tipChanged(const QPoint &pos, const TipContent &content, QWidget * void ToolTip::setTipRect(QWidget *w, const QRect &rect) { - if (!m_rect.isNull() && !w) + if (!m_rect.isNull() && !w) { qWarning("ToolTip::show: Cannot pass null widget if rect is set"); - else{ + } else { m_widget = w; m_rect = rect; } diff --git a/src/libs/utils/unixutils.cpp b/src/libs/utils/unixutils.cpp index 07e85701a0..f049a8645c 100644 --- a/src/libs/utils/unixutils.cpp +++ b/src/libs/utils/unixutils.cpp @@ -75,15 +75,15 @@ QString UnixUtils::substituteFileBrowserParameters(const QString &pre, const QSt if (c == QLatin1Char('%') && i < pre.size()-1) { c = pre.at(++i); QString s; - if (c == QLatin1Char('d')) + if (c == QLatin1Char('d')) { s = QLatin1Char('"') + QFileInfo(file).path() + QLatin1Char('"'); - else if (c == QLatin1Char('f')) + } else if (c == QLatin1Char('f')) { s = QLatin1Char('"') + file + QLatin1Char('"'); - else if (c == QLatin1Char('n')) + } else if (c == QLatin1Char('n')) { s = QLatin1Char('"') + QFileInfo(file).fileName() + QLatin1Char('"'); - else if (c == QLatin1Char('%')) + } else if (c == QLatin1Char('%')) { s = c; - else { + } else { s = QLatin1Char('%'); s += c; } diff --git a/src/plugins/cmakeprojectmanager/cmakehighlighter.cpp b/src/plugins/cmakeprojectmanager/cmakehighlighter.cpp index 0a7c59ad96..8f91004c03 100644 --- a/src/plugins/cmakeprojectmanager/cmakehighlighter.cpp +++ b/src/plugins/cmakeprojectmanager/cmakehighlighter.cpp @@ -94,8 +94,7 @@ void CMakeHighlighter::highlightBlock(const QString &text) setFormat(i, 1, m_formats[CMakeStringFormat]); } inStringMode = !inStringMode; - } - else if (c == '\\') { + } else if (c == '\\') { setFormat(i, 1, emptyFormat); buf += c; i++; diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index c0939d2976..938f23f930 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -172,9 +172,9 @@ MainWindow::MainWindow() : if (Utils::HostOsInfo::isAnyUnixHost() && !Utils::HostOsInfo::isMacHost()) { if (baseName == QLatin1String("windows")) { // Sometimes we get the standard windows 95 style as a fallback - if (QStyleFactory::keys().contains(QLatin1String("Fusion"))) + if (QStyleFactory::keys().contains(QLatin1String("Fusion"))) { baseName = QLatin1String("fusion"); // Qt5 - else { // Qt4 + } else { // Qt4 // e.g. if we are running on a KDE4 desktop QByteArray desktopEnvironment = qgetenv("DESKTOP_SESSION"); if (desktopEnvironment == "kde") diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp index a07dbac946..15fcbfc977 100644 --- a/src/plugins/coreplugin/manhattanstyle.cpp +++ b/src/plugins/coreplugin/manhattanstyle.cpp @@ -274,18 +274,16 @@ void ManhattanStyle::polish(QWidget *widget) if (qobject_cast<QToolButton*>(widget)) { widget->setAttribute(Qt::WA_Hover); widget->setMaximumHeight(Utils::StyleHelper::navigationWidgetHeight() - 2); - } - else if (qobject_cast<QLineEdit*>(widget)) { + } else if (qobject_cast<QLineEdit*>(widget)) { widget->setAttribute(Qt::WA_Hover); widget->setMaximumHeight(Utils::StyleHelper::navigationWidgetHeight() - 2); - } - else if (qobject_cast<QLabel*>(widget)) + } else if (qobject_cast<QLabel*>(widget)) { widget->setPalette(panelPalette(widget->palette())); - else if (widget->property("panelwidget_singlerow").toBool()) + } else if (widget->property("panelwidget_singlerow").toBool()) { widget->setFixedHeight(Utils::StyleHelper::navigationWidgetHeight()); - else if (qobject_cast<QStatusBar*>(widget)) + } else if (qobject_cast<QStatusBar*>(widget)) { widget->setFixedHeight(Utils::StyleHelper::navigationWidgetHeight() + 2); - else if (qobject_cast<QComboBox*>(widget)) { + } else if (qobject_cast<QComboBox*>(widget)) { widget->setMaximumHeight(Utils::StyleHelper::navigationWidgetHeight() - 2); widget->setAttribute(Qt::WA_Hover); } diff --git a/src/plugins/coreplugin/styleanimator.cpp b/src/plugins/coreplugin/styleanimator.cpp index bd1a9ae4c1..eb1a311cbc 100644 --- a/src/plugins/coreplugin/styleanimator.cpp +++ b/src/plugins/coreplugin/styleanimator.cpp @@ -105,8 +105,7 @@ void Transition::paint(QPainter *painter, const QStyleOption *option) m_running = false; alpha = 1.0; } - } - else { + } else { m_running = false; } drawBlendedImage(painter, option->rect, alpha); diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index b8626fc4e1..c20217930c 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -303,7 +303,7 @@ struct CanonicalSymbol if (classId && classId->isEqualTo(declId)) continue; // skip it, it's a ctor or a dtor. - else if (Function *funTy = r.declaration()->type()->asFunctionType()) { + if (Function *funTy = r.declaration()->type()->asFunctionType()) { if (funTy->isVirtual()) return r.declaration(); } @@ -1481,10 +1481,9 @@ CPPEditorWidget::Link CPPEditorWidget::findLinkAt(const QTextCursor &cursor, boo int depth = 0; for (; j < tokens.size(); ++j) { - if (tokens.at(j).is(T_LPAREN)) + if (tokens.at(j).is(T_LPAREN)) { ++depth; - - else if (tokens.at(j).is(T_RPAREN)) { + } else if (tokens.at(j).is(T_RPAREN)) { if (! --depth) break; } @@ -1576,15 +1575,13 @@ CPPEditorWidget::Link CPPEditorWidget::findLinkAt(const QTextCursor &cursor, boo const QChar ch = document()->characterAt(pos); if (ch.isSpace()) continue; - else { - if (ch == QLatin1Char('(') && ! expression.isEmpty()) { - tc.setPosition(pos); - if (TextEditor::TextBlockUserData::findNextClosingParenthesis(&tc, true)) - expression.append(tc.selectedText()); - } - - break; + if (ch == QLatin1Char('(') && ! expression.isEmpty()) { + tc.setPosition(pos); + if (TextEditor::TextBlockUserData::findNextClosingParenthesis(&tc, true)) + expression.append(tc.selectedText()); } + + break; } TypeOfExpression typeOfExpression; @@ -2070,9 +2067,8 @@ void CPPEditorWidget::updateSemanticInfo(const SemanticInfo &semanticInfo) if (! m_renameSelections.isEmpty()) setExtraSelections(CodeSemanticsSelection, m_renameSelections); // ### - else { + else markSymbols(textCursor(), semanticInfo); - } m_lastSemanticInfo.forced = false; // clear the forced flag diff --git a/src/plugins/cppeditor/cppeditorplugin.cpp b/src/plugins/cppeditor/cppeditorplugin.cpp index 24c046e17b..56ddd686f8 100644 --- a/src/plugins/cppeditor/cppeditorplugin.cpp +++ b/src/plugins/cppeditor/cppeditorplugin.cpp @@ -376,9 +376,8 @@ void CppEditorPlugin::currentEditorChanged(Core::IEditor *editor) if (! editor) return; - else if (CPPEditorWidget *textEditor = qobject_cast<CPPEditorWidget *>(editor->widget())) { + if (CPPEditorWidget *textEditor = qobject_cast<CPPEditorWidget *>(editor->widget())) textEditor->semanticRehighlight(/*force = */ true); - } } void CppEditorPlugin::openTypeHierarchy() diff --git a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp index 2135ee25ad..35fa5ee86a 100644 --- a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp +++ b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp @@ -778,9 +778,8 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ FullySpecifiedType type = rewriteType(newParam->type(), &env, control); newTargetParam = overview.prettyType(type, newParam->name()); hadChanges = true; - } // otherwise preserve as much as possible from the existing parameter - else { + } else { Symbol *targetParam = targetFunction->argumentAt(existingParamIndex); Symbol *sourceParam = sourceFunction->argumentAt(existingParamIndex); ParameterDeclarationAST *targetParamAst = targetParameterDecls.at(existingParamIndex); @@ -833,9 +832,8 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ newTargetParam += overview.prettyType(replacementType, replacementName); newTargetParam += targetFile->textOf(parameterTypeEnd, parameterEnd); hadChanges = true; - } // change the name only? - else if (!namesEqual(targetParam->name(), replacementName)) { + } else if (!namesEqual(targetParam->name(), replacementName)) { DeclaratorIdAST *id = getDeclaratorId(targetParamAst->declarator); const QString &replacementNameStr = overview.prettyName(replacementName); if (id) { @@ -878,9 +876,8 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ newTargetParam += rest; } hadChanges = true; - } // change nothing - though the parameter might still have moved - else { + } else { if (existingParamIndex != newParamIndex) hadChanges = true; newTargetParam = targetFile->textOf(parameterStart, parameterEnd); @@ -934,9 +931,8 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ if (!targetFunction->isConst() && !targetFunction->isVolatile()) { cvString.prepend(QLatin1Char(' ')); changes.insert(targetFile->endOf(targetFunctionDeclarator->rparen_token), cvString); - } // modify/remove existing specifiers - else { + } else { SimpleSpecifierAST *constSpecifier = 0; SimpleSpecifierAST *volatileSpecifier = 0; for (SpecifierListAST *it = targetFunctionDeclarator->cv_qualifier_list; it; it = it->next) { @@ -954,9 +950,8 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ changes.remove(targetFile->endOf(constSpecifier->specifier_token - 1), targetFile->endOf(constSpecifier)); if (!newFunction->isVolatile()) changes.remove(targetFile->endOf(volatileSpecifier->specifier_token - 1), targetFile->endOf(volatileSpecifier)); - } // otherwise adjust, remove or extend the one existing specifier - else { + } else { SimpleSpecifierAST *specifier = constSpecifier ? constSpecifier : volatileSpecifier; QTC_ASSERT(specifier, return changes); diff --git a/src/plugins/cppeditor/cpphighlighter.cpp b/src/plugins/cppeditor/cpphighlighter.cpp index 5b02d92502..762f11ce19 100644 --- a/src/plugins/cppeditor/cpphighlighter.cpp +++ b/src/plugins/cppeditor/cpphighlighter.cpp @@ -160,13 +160,11 @@ void CppHighlighter::highlightBlock(const QString &text) onlyHighlightComments = true; } - } else if (tk.is(T_NUMERIC_LITERAL)) + } else if (tk.is(T_NUMERIC_LITERAL)) { setFormat(tk.begin(), tk.length(), m_formats[CppNumberFormat]); - - else if (tk.isStringLiteral() || tk.isCharLiteral()) + } else if (tk.isStringLiteral() || tk.isCharLiteral()) { highlightLine(text, tk.begin(), tk.length(), m_formats[CppStringFormat]); - - else if (tk.isComment()) { + } else if (tk.isComment()) { const int startPosition = initialState ? previousTokenEnd : tk.begin(); if (tk.is(T_COMMENT) || tk.is(T_CPP_COMMENT)) highlightLine(text, startPosition, tk.end() - startPosition, m_formats[CppCommentFormat]); @@ -192,18 +190,15 @@ void CppHighlighter::highlightBlock(const QString &text) initialState = 0; } - } else if (tk.isKeyword() || CppTools::isQtKeyword(text.midRef(tk.begin(), tk.length())) || tk.isObjCAtKeyword()) + } else if (tk.isKeyword() || CppTools::isQtKeyword(text.midRef(tk.begin(), tk.length())) || tk.isObjCAtKeyword()) { setFormat(tk.begin(), tk.length(), m_formats[CppKeywordFormat]); - - else if (tk.isOperator()) + } else if (tk.isOperator()) { setFormat(tk.begin(), tk.length(), m_formats[CppOperatorFormat]); - - else if (i == 0 && tokens.size() > 1 && tk.is(T_IDENTIFIER) && tokens.at(1).is(T_COLON)) + } else if (i == 0 && tokens.size() > 1 && tk.is(T_IDENTIFIER) && tokens.at(1).is(T_COLON)) { setFormat(tk.begin(), tk.length(), m_formats[CppLabelFormat]); - - else if (tk.is(T_IDENTIFIER)) + } else if (tk.is(T_IDENTIFIER)) { highlightWord(text.midRef(tk.begin(), tk.length()), tk.begin(), tk.length()); - + } } // mark the trailing white spaces diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index 5eb4a4152a..fdc931e50a 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -624,10 +624,9 @@ void SplitSimpleDeclaration::match(const CppQuickFixInterface &interface, for (int index = path.size() - 1; index != -1; --index) { AST *node = path.at(index); - if (CoreDeclaratorAST *coreDecl = node->asCoreDeclarator()) + if (CoreDeclaratorAST *coreDecl = node->asCoreDeclarator()) { core_declarator = coreDecl; - - else if (SimpleDeclarationAST *simpleDecl = node->asSimpleDeclaration()) { + } else if (SimpleDeclarationAST *simpleDecl = node->asSimpleDeclaration()) { if (checkDeclaration(simpleDecl)) { SimpleDeclarationAST *declaration = simpleDecl; @@ -1702,7 +1701,7 @@ void AddLocalDeclaration::match(const CppQuickFixInterface &interface, QuickFixO foreach (const LookupItem &r, results) { if (! r.declaration()) continue; - else if (Declaration *d = r.declaration()->asDeclaration()) { + if (Declaration *d = r.declaration()->asDeclaration()) { if (! d->type()->isFunctionType()) { decl = d; break; @@ -4078,8 +4077,7 @@ void MoveFuncDefToDecl::match(const CppQuickFixInterface &interface, QuickFixOpe if (!declText.isEmpty()) break; } - } - else if (Namespace *matchingNamespace = isNamespaceFunction(interface->context(), func)) { + } else if (Namespace *matchingNamespace = isNamespaceFunction(interface->context(), func)) { // Dealing with free functions bool isHeaderFile = false; declFileName = correspondingHeaderOrSource(interface->fileName(), &isHeaderFile); diff --git a/src/plugins/cpptools/builtinindexingsupport.cpp b/src/plugins/cpptools/builtinindexingsupport.cpp index cefa6894f8..7b73f88f47 100644 --- a/src/plugins/cpptools/builtinindexingsupport.cpp +++ b/src/plugins/cpptools/builtinindexingsupport.cpp @@ -57,10 +57,9 @@ static void parse(QFutureInterface<void> &future, const QString fileName = files.at(i); const bool isSourceFile = i < sourceCount; - if (isSourceFile) + if (isSourceFile) { (void) preproc->run(conf); - - else if (! processingHeaders) { + } else if (! processingHeaders) { (void) preproc->run(conf); processingHeaders = true; diff --git a/src/plugins/cpptools/cppchecksymbols.cpp b/src/plugins/cpptools/cppchecksymbols.cpp index 2f076eead9..da72e2a915 100644 --- a/src/plugins/cpptools/cppchecksymbols.cpp +++ b/src/plugins/cpptools/cppchecksymbols.cpp @@ -96,7 +96,7 @@ protected: { if (! doc) return; - else if (! processed->contains(doc->globalNamespace())) { + if (! processed->contains(doc->globalNamespace())) { processed->insert(doc->globalNamespace()); foreach (const Document::Include &i, doc->includes()) @@ -738,7 +738,7 @@ bool CheckSymbols::hasVirtualDestructor(Class *klass) const for (Symbol *s = klass->find(id); s; s = s->next()) { if (! s->name()) continue; - else if (s->name()->isDestructorNameId()) { + if (s->name()->isDestructorNameId()) { if (Function *funTy = s->type()->asFunctionType()) { if (funTy->isVirtual() && id->isEqualTo(s->identifier())) return true; @@ -1335,9 +1335,8 @@ NameAST *CheckSymbols::declaratorId(DeclaratorAST *ast) const if (ast && ast->core_declarator) { if (NestedDeclaratorAST *nested = ast->core_declarator->asNestedDeclarator()) return declaratorId(nested->declarator); - else if (DeclaratorIdAST *declId = ast->core_declarator->asDeclaratorId()) { + if (DeclaratorIdAST *declId = ast->core_declarator->asDeclaratorId()) return declId->name; - } } return 0; diff --git a/src/plugins/cpptools/cppcodeformatter.cpp b/src/plugins/cpptools/cppcodeformatter.cpp index 967bc9321c..cf1a90b8e7 100644 --- a/src/plugins/cpptools/cppcodeformatter.cpp +++ b/src/plugins/cpptools/cppcodeformatter.cpp @@ -519,9 +519,9 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block) int previousPreviousMarker = -1; for (int i = size - 1; i >= 0; --i) { if (m_currentState.at(i).type == cpp_macro_conditional) { - if (previousMarker == -1) + if (previousMarker == -1) { previousMarker = i; - else { + } else { previousPreviousMarker = i; break; } diff --git a/src/plugins/cpptools/cppcompletionassist.cpp b/src/plugins/cpptools/cppcompletionassist.cpp index f636c0a8e2..355ae975dd 100644 --- a/src/plugins/cpptools/cppcompletionassist.cpp +++ b/src/plugins/cpptools/cppcompletionassist.cpp @@ -572,7 +572,7 @@ Class *asClassOrTemplateClassType(FullySpecifiedType ty) { if (Class *classTy = ty->asClassType()) return classTy; - else if (Template *templ = ty->asTemplateType()) { + if (Template *templ = ty->asTemplateType()) { if (Symbol *decl = templ->declaration()) return decl->asClass(); } @@ -595,7 +595,7 @@ Function *asFunctionOrTemplateFunctionType(FullySpecifiedType ty) { if (Function *funTy = ty->asFunctionType()) return funTy; - else if (Template *templ = ty->asTemplateType()) { + if (Template *templ = ty->asTemplateType()) { if (Symbol *decl = templ->declaration()) return decl->asFunction(); } @@ -799,13 +799,11 @@ int CppCompletionAssistProcessor::startOfOperator(int pos, && *kind != T_DOT))) { *kind = T_EOF_SYMBOL; start = pos; - } // Include completion: can be triggered by slash, but only in a string - else if (*kind == T_SLASH && (tk.isNot(T_STRING_LITERAL) && tk.isNot(T_ANGLE_STRING_LITERAL))) { + } else if (*kind == T_SLASH && (tk.isNot(T_STRING_LITERAL) && tk.isNot(T_ANGLE_STRING_LITERAL))) { *kind = T_EOF_SYMBOL; start = pos; - } - else if (*kind == T_LPAREN) { + } else if (*kind == T_LPAREN) { if (tokenIdx > 0) { const Token &previousToken = tokens.at(tokenIdx - 1); // look at the token at the left of T_LPAREN switch (previousToken.kind()) { @@ -943,13 +941,11 @@ int CppCompletionAssistProcessor::startCompletionHelper() startOfExpression = endOfExpression - expression.length(); if (m_model->m_completionOperator == T_LPAREN) { - if (expression.endsWith(QLatin1String("SIGNAL"))) + if (expression.endsWith(QLatin1String("SIGNAL"))) { m_model->m_completionOperator = T_SIGNAL; - - else if (expression.endsWith(QLatin1String("SLOT"))) + } else if (expression.endsWith(QLatin1String("SLOT"))) { m_model->m_completionOperator = T_SLOT; - - else if (m_interface->position() != endOfOperator) { + } else if (m_interface->position() != endOfOperator) { // We don't want a function completion when the cursor isn't at the opening brace expression.clear(); m_model->m_completionOperator = T_EOF_SYMBOL; @@ -1225,7 +1221,7 @@ int CppCompletionAssistProcessor::startCompletionInternal(const QString fileName return m_startPosition; } - else if (m_model->m_completionOperator == T_SIGNAL || m_model->m_completionOperator == T_SLOT) { + if (m_model->m_completionOperator == T_SIGNAL || m_model->m_completionOperator == T_SLOT) { // Apply signal/slot completion on 'this' expression = QLatin1String("this"); } @@ -1335,7 +1331,7 @@ void CppCompletionAssistProcessor::globalCompletion(CPlusPlus::Scope *currentSco Symbol *member = scope->memberAt(i); if (! member->name()) continue; - else if (UsingNamespaceDirective *u = member->asUsingNamespaceDirective()) { + if (UsingNamespaceDirective *u = member->asUsingNamespaceDirective()) { if (ClassOrNamespace *b = binding->lookupType(u->name())) usingBindings.append(b); } diff --git a/src/plugins/cpptools/cpplocalsymbols.cpp b/src/plugins/cpptools/cpplocalsymbols.cpp index 361fd5d9d6..93bf125e11 100644 --- a/src/plugins/cpptools/cpplocalsymbols.cpp +++ b/src/plugins/cpptools/cpplocalsymbols.cpp @@ -84,7 +84,7 @@ protected: if (Symbol *member = scope->memberAt(i)) { if (member->isTypedef()) continue; - else if (! member->isGenerated() && (member->isDeclaration() || member->isArgument())) { + if (! member->isGenerated() && (member->isDeclaration() || member->isArgument())) { if (member->name() && member->name()->isNameId()) { const Identifier *id = member->identifier(); unsigned line, column; @@ -106,10 +106,10 @@ protected: const Identifier *id = identifier(simpleName->identifier_token); for (int i = _scopeStack.size() - 1; i != -1; --i) { if (Symbol *member = _scopeStack.at(i)->find(id)) { - if (member->isTypedef() || - !(member->isDeclaration() || member->isArgument())) + if (member->isTypedef() || !(member->isDeclaration() || member->isArgument())) continue; - else if (!member->isGenerated() && (member->sourceLocation() < firstToken || member->enclosingScope()->isFunction())) { + if (!member->isGenerated() && (member->sourceLocation() < firstToken + || member->enclosingScope()->isFunction())) { unsigned line, column; getTokenStartPosition(simpleName->identifier_token, &line, &column); localUses[member].append( diff --git a/src/plugins/cpptools/cpptoolseditorsupport.cpp b/src/plugins/cpptools/cpptoolseditorsupport.cpp index 1b73cf883c..b563e556a5 100644 --- a/src/plugins/cpptools/cpptoolseditorsupport.cpp +++ b/src/plugins/cpptools/cpptoolseditorsupport.cpp @@ -74,11 +74,10 @@ protected: if (_functionDefinition) return false; - else if (FunctionDefinitionAST *def = ast->asFunctionDefinition()) { + if (FunctionDefinitionAST *def = ast->asFunctionDefinition()) return checkDeclaration(def); - } - else if (ObjCMethodDeclarationAST *method = ast->asObjCMethodDeclaration()) { + if (ObjCMethodDeclarationAST *method = ast->asObjCMethodDeclaration()) { if (method->function_body) return checkDeclaration(method); } diff --git a/src/plugins/cpptools/includeutils.cpp b/src/plugins/cpptools/includeutils.cpp index d51a0a2cd7..9de8f5fe76 100644 --- a/src/plugins/cpptools/includeutils.cpp +++ b/src/plugins/cpptools/includeutils.cpp @@ -277,13 +277,11 @@ QList<IncludeGroup> IncludeGroup::detectIncludeGroupsByNewLines(QList<Document:: if (isFirst) { isFirst = false; currentIncludes << include; - } // Include belongs to current group - else if (lastLine + 1 == include.line()) { + } else if (lastLine + 1 == include.line()) { currentIncludes << include; - } // Include is member of new group - else { + } else { result << IncludeGroup(currentIncludes); currentIncludes.clear(); currentIncludes << include; @@ -312,13 +310,11 @@ QList<IncludeGroup> IncludeGroup::detectIncludeGroupsByIncludeDir(const QList<In if (isFirst) { isFirst = false; currentIncludes << include; - } // Include belongs to current group - else if (lastDir == currentDirPrefix) { + } else if (lastDir == currentDirPrefix) { currentIncludes << include; - } // Include is member of new group - else { + } else { result << IncludeGroup(currentIncludes); currentIncludes.clear(); currentIncludes << include; @@ -347,13 +343,11 @@ QList<IncludeGroup> IncludeGroup::detectIncludeGroupsByIncludeType(const QList<I if (isFirst) { isFirst = false; currentIncludes << include; - } // Include belongs to current group - else if (lastIncludeType == currentIncludeType) { + } else if (lastIncludeType == currentIncludeType) { currentIncludes << include; - } // Include is member of new group - else { + } else { result << IncludeGroup(currentIncludes); currentIncludes.clear(); currentIncludes << include; diff --git a/src/plugins/cpptools/symbolfinder.cpp b/src/plugins/cpptools/symbolfinder.cpp index 9acd841121..6a13157f51 100644 --- a/src/plugins/cpptools/symbolfinder.cpp +++ b/src/plugins/cpptools/symbolfinder.cpp @@ -176,7 +176,7 @@ Function *SymbolFinder::findMatchingDefinition(Symbol *declaration, foreach (Function *fun, viableFunctions) { if (! (fun->unqualifiedName() && fun->unqualifiedName()->isEqualTo(declaration->unqualifiedName()))) continue; - else if (fun->argumentCount() == declarationTy->argumentCount()) { + if (fun->argumentCount() == declarationTy->argumentCount()) { if (! strict && ! best) best = fun; @@ -287,13 +287,9 @@ void SymbolFinder::findMatchingDeclaration(const LookupContext &context, continue; for (Symbol *s = scope->find(funcId); s; s = s->next()) { - if (! s->name()) + if (! s->name() || ! funcId->isEqualTo(s->identifier()) || ! s->type()->isFunctionType()) continue; - else if (! funcId->isEqualTo(s->identifier())) - continue; - else if (! s->type()->isFunctionType()) - continue; - else if (Declaration *decl = s->asDeclaration()) { + if (Declaration *decl = s->asDeclaration()) { if (Function *declFunTy = decl->type()->asFunctionType()) { if (functionType->isEqualTo(declFunTy)) typeMatch->prepend(decl); diff --git a/src/plugins/debugger/debuggermainwindow.cpp b/src/plugins/debugger/debuggermainwindow.cpp index 4158b313d9..68e2732857 100644 --- a/src/plugins/debugger/debuggermainwindow.cpp +++ b/src/plugins/debugger/debuggermainwindow.cpp @@ -224,15 +224,13 @@ void DebuggerMainWindowPrivate::updateActiveLanguages() { DebuggerLanguages newLanguages = AnyLanguage; - if (m_engineDebugLanguages != AnyLanguage) + if (m_engineDebugLanguages != AnyLanguage) { newLanguages = m_engineDebugLanguages; - else { - if (m_previousRunConfiguration) { - if (m_previousRunConfiguration->extraAspect<Debugger::DebuggerRunConfigurationAspect>()->useCppDebugger()) - newLanguages |= CppLanguage; - if (m_previousRunConfiguration->extraAspect<Debugger::DebuggerRunConfigurationAspect>()->useQmlDebugger()) - newLanguages |= QmlLanguage; - } + } else if (m_previousRunConfiguration) { + if (m_previousRunConfiguration->extraAspect<Debugger::DebuggerRunConfigurationAspect>()->useCppDebugger()) + newLanguages |= CppLanguage; + if (m_previousRunConfiguration->extraAspect<Debugger::DebuggerRunConfigurationAspect>()->useQmlDebugger()) + newLanguages |= QmlLanguage; } if (newLanguages != m_activeDebugLanguages) { diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 2de263e202..25ef0454f5 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -1405,11 +1405,11 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it, QString key = arg.section(QLatin1Char('='), 0, 0); QString val = arg.section(QLatin1Char('='), 1, 1); if (val.isEmpty()) { - if (key.isEmpty()) + if (key.isEmpty()) { continue; - else if (sp.executable.isEmpty()) + } else if (sp.executable.isEmpty()) { sp.executable = key; - else { + } else { *errorMessage = DebuggerPlugin::tr("Only one executable allowed!"); return false; } @@ -1419,15 +1419,13 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it, sp.remoteChannel = val; sp.displayName = tr("Remote: \"%1\"").arg(sp.remoteChannel); sp.startMessage = tr("Attaching to remote server %1.").arg(sp.remoteChannel); - } - else if (key == QLatin1String("core")) { + } else if (key == QLatin1String("core")) { sp.startMode = AttachCore; sp.closeMode = DetachAtClose; sp.coreFile = val; sp.displayName = tr("Core file \"%1\"").arg(sp.coreFile); sp.startMessage = tr("Attaching to core file %1.").arg(sp.coreFile); - } - else if (key == QLatin1String("kit")) { + } else if (key == QLatin1String("kit")) { kit = KitManager::instance()->find(Id::fromString(val)); } } diff --git a/src/plugins/debugger/gdb/coregdbadapter.cpp b/src/plugins/debugger/gdb/coregdbadapter.cpp index b50f6c6e19..7807f1567c 100644 --- a/src/plugins/debugger/gdb/coregdbadapter.cpp +++ b/src/plugins/debugger/gdb/coregdbadapter.cpp @@ -150,9 +150,9 @@ void GdbCoreEngine::continueSetupEngine() } } } - if (isCore) + if (isCore) { startGdb(); - else { + } else { showMessageBox(QMessageBox::Warning, tr("Error Loading Core File"), tr("The specified file does not appear to be a core file.")); diff --git a/src/plugins/debugger/qml/qmlcppengine.cpp b/src/plugins/debugger/qml/qmlcppengine.cpp index 90237fab68..dbae89ae67 100644 --- a/src/plugins/debugger/qml/qmlcppengine.cpp +++ b/src/plugins/debugger/qml/qmlcppengine.cpp @@ -699,9 +699,9 @@ void QmlCppEngine::slaveEngineStateChanged break; } case InferiorShutdownOk: { - if (state() == InferiorShutdownRequested) + if (state() == InferiorShutdownRequested) { notifyInferiorShutdownOk(); - else { + } else { // we got InferiorExitOk before, but ignored it ... notifyInferiorExited(); } diff --git a/src/plugins/debugger/registerwindow.cpp b/src/plugins/debugger/registerwindow.cpp index 6e53eaef57..a489f35a6b 100644 --- a/src/plugins/debugger/registerwindow.cpp +++ b/src/plugins/debugger/registerwindow.cpp @@ -230,9 +230,9 @@ void RegisterTreeView::contextMenuEvent(QContextMenuEvent *ev) const QPoint position = ev->globalPos(); QAction *act = menu.exec(position); - if (act == actReload) + if (act == actReload) { engine->reloadRegisters(); - else if (act == actEditMemory) { + } else if (act == actEditMemory) { const QString registerName = QString::fromLatin1(aRegister.name); engine->openMemoryView(address, 0, RegisterMemoryView::registerMarkup(address, registerName), diff --git a/src/plugins/debugger/stackwindow.cpp b/src/plugins/debugger/stackwindow.cpp index fed2e8031f..39b112189e 100644 --- a/src/plugins/debugger/stackwindow.cpp +++ b/src/plugins/debugger/stackwindow.cpp @@ -182,9 +182,9 @@ void StackTreeView::contextMenuEvent(QContextMenuEvent *ev) if (!act) return; - if (act == actCopyContents) + if (act == actCopyContents) { copyContentsToClipboard(); - else if (act == actShowMemory) { + } else if (act == actShowMemory) { const QString title = tr("Memory at Frame #%1 (%2) 0x%3"). arg(row).arg(frame.function).arg(address, 0, 16); QList<MemoryMarkup> ml; diff --git a/src/plugins/diffeditor/diffeditorwidget.cpp b/src/plugins/diffeditor/diffeditorwidget.cpp index 8b3b098dcb..aff227c8b5 100644 --- a/src/plugins/diffeditor/diffeditorwidget.cpp +++ b/src/plugins/diffeditor/diffeditorwidget.cpp @@ -952,12 +952,10 @@ ChunkData DiffEditorWidget::calculateOriginalData(const QList<Diff> &diffList) c if (diff.command == Diff::Delete) { leftLines.last() += line; currentLeftPos += line.count(); - } - else if (diff.command == Diff::Insert) { + } else if (diff.command == Diff::Insert) { rightLines.last() += line; currentRightPos += line.count(); - } - else if (diff.command == Diff::Equal) { + } else if (diff.command == Diff::Equal) { if ((line.count() || (j && j < lines.count() - 1)) && // don't treat empty ending line as a line to be aligned unless a line is a one char '/n' only. currentLeftLine != lastAlignedLeftLine && currentRightLine != lastAlignedRightLine) { diff --git a/src/plugins/find/currentdocumentfind.cpp b/src/plugins/find/currentdocumentfind.cpp index c6b7e2940e..16481b98c1 100644 --- a/src/plugins/find/currentdocumentfind.cpp +++ b/src/plugins/find/currentdocumentfind.cpp @@ -246,8 +246,7 @@ void CurrentDocumentFind::aggregationChanged() m_candidateWidget = m_currentWidget; m_candidateFind = currentFind; acceptCandidate(); - } - else { + } else { clearFindSupport(); } } diff --git a/src/plugins/genericprojectmanager/pkgconfigtool.cpp b/src/plugins/genericprojectmanager/pkgconfigtool.cpp index a2f8b3b924..127d82d473 100644 --- a/src/plugins/genericprojectmanager/pkgconfigtool.cpp +++ b/src/plugins/genericprojectmanager/pkgconfigtool.cpp @@ -90,9 +90,7 @@ void PkgConfigTool::packages_helper() const if (ch.isSpace()) { do { ++index; } while (index < cflags.size() && cflags.at(index).isSpace()); - } - - else if (ch == QLatin1Char('-') && index + 1 < cflags.size()) { + } else if (ch == QLatin1Char('-') && index + 1 < cflags.size()) { ++index; const QChar opt = cflags.at(index); @@ -109,9 +107,7 @@ void PkgConfigTool::packages_helper() const qDebug() << "*** add include path:" << cflags.mid(start, index - start); package.includePaths.append(cflags.mid(start, index - start)); } - } - - else { + } else { for (; index < cflags.size(); ++index) { if (cflags.at(index).isSpace()) break; diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 9c036cca79..70cd8a6655 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -1463,9 +1463,9 @@ bool GitClient::synchronousInit(const QString &workingDirectory) const bool rc = fullySynchronousGit(workingDirectory, arguments, &outputText, &errorText); // '[Re]Initialized...' outputWindow()->append(commandOutputFromLocal8Bit(outputText)); - if (!rc) + if (!rc) { outputWindow()->appendError(commandOutputFromLocal8Bit(errorText)); - else { + } else { // TODO: Turn this into a VcsBaseClient and use resetCachedVcsInfo(...) Core::ICore::vcsManager()->resetVersionControlForDirectory(workingDirectory); } diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 3166313ca8..2ee39cddf2 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -920,9 +920,9 @@ void GitPlugin::gitkForCurrentFolder() * */ QDir dir(state.currentFileDirectory()); - if (QFileInfo(dir,QLatin1String(".git")).exists() || dir.cd(QLatin1String(".git"))) + if (QFileInfo(dir,QLatin1String(".git")).exists() || dir.cd(QLatin1String(".git"))) { m_gitClient->launchGitK(state.currentFileDirectory()); - else { + } else { QString folderName = dir.absolutePath(); dir.cdUp(); folderName = folderName.remove(0, dir.absolutePath().length() + 1); diff --git a/src/plugins/git/mergetool.cpp b/src/plugins/git/mergetool.cpp index 1bf3a439fd..05704c5413 100644 --- a/src/plugins/git/mergetool.cpp +++ b/src/plugins/git/mergetool.cpp @@ -102,8 +102,7 @@ bool MergeTool::start(const QString &workingDirectory, const QStringList &files) if (m_process->waitForStarted()) { connect(m_process, SIGNAL(finished(int)), this, SLOT(done())); connect(m_process, SIGNAL(readyRead()), this, SLOT(readData())); - } - else { + } else { delete m_process; m_process = 0; return false; diff --git a/src/plugins/glsleditor/glslautocompleter.cpp b/src/plugins/glsleditor/glslautocompleter.cpp index 22e2cb0cda..5f5747c469 100644 --- a/src/plugins/glsleditor/glslautocompleter.cpp +++ b/src/plugins/glsleditor/glslautocompleter.cpp @@ -85,8 +85,7 @@ bool GLSLCompleter::contextAllowsElectricCharacters(const QTextCursor &cursor) c if (pos < tk.end()) return false; - } - else if (tk.isStringLiteral() || tk.isCharLiteral()) { + } else if (tk.isStringLiteral() || tk.isCharLiteral()) { const unsigned pos = cursor.selectionEnd() - cursor.block().position(); if (pos <= tk.end()) return false; diff --git a/src/plugins/glsleditor/glslhighlighter.cpp b/src/plugins/glsleditor/glslhighlighter.cpp index 61b1e341d6..abe873b501 100644 --- a/src/plugins/glsleditor/glslhighlighter.cpp +++ b/src/plugins/glsleditor/glslhighlighter.cpp @@ -160,13 +160,13 @@ void Highlighter::highlightBlock(const QString &text) highlightLine(text, tk.begin(), tk.length, m_formats[GLSLPreprocessorFormat]); highlightAsPreprocessor = true; - } else if (highlightCurrentWordAsPreprocessor && isPPKeyword(text.midRef(tk.begin(), tk.length))) + } else if (highlightCurrentWordAsPreprocessor && isPPKeyword(text.midRef(tk.begin(), tk.length))) { setFormat(tk.begin(), tk.length, m_formats[GLSLPreprocessorFormat]); - else if (tk.is(GLSL::Parser::T_NUMBER)) + } else if (tk.is(GLSL::Parser::T_NUMBER)) { setFormat(tk.begin(), tk.length, m_formats[GLSLNumberFormat]); - else if (tk.is(GLSL::Parser::T_COMMENT)) { + } else if (tk.is(GLSL::Parser::T_COMMENT)) { highlightLine(text, tk.begin(), tk.length, m_formats[GLSLCommentFormat]); // we need to insert a close comment parenthesis, if @@ -362,11 +362,11 @@ void Highlighter::highlightBlock(const QString &text) for (int i = 0; i < tokens.size(); ++i) { const GLSL::Token &tk = tokens.at(i); - if (tk.is(GLSL::Parser::T_NUMBER)) + if (tk.is(GLSL::Parser::T_NUMBER)) { setFormat(tk.position, tk.length, m_formats[GLSLNumberFormat]); - else if (tk.is(GLSL::Parser::T_COMMENT)) + } else if (tk.is(GLSL::Parser::T_COMMENT)) { setFormat(tk.position, tk.length, Qt::darkGreen); // ### FIXME: m_formats[GLSLCommentFormat]); - else if (tk.is(GLSL::Parser::T_IDENTIFIER)) { + } else if (tk.is(GLSL::Parser::T_IDENTIFIER)) { int kind = lex.findKeyword(data.constData() + tk.position, tk.length); if (kind == GLSL::Parser::T_RESERVED) setFormat(tk.position, tk.length, m_formats[GLSLReservedKeyword]); diff --git a/src/plugins/madde/maemoqemuruntimeparser.cpp b/src/plugins/madde/maemoqemuruntimeparser.cpp index e013711fe5..1a88c73037 100644 --- a/src/plugins/madde/maemoqemuruntimeparser.cpp +++ b/src/plugins/madde/maemoqemuruntimeparser.cpp @@ -139,9 +139,9 @@ MaemoQemuRuntime MaemoQemuRuntimeParserV1::parseRuntime() && m_madInfoReader.name() == QLatin1String("installed")) { if (m_madInfoReader.readNext() == QXmlStreamReader::Characters && m_madInfoReader.text() == QLatin1String("true")) { - if (attrs.hasAttribute(QLatin1String("runtime_id"))) + if (attrs.hasAttribute(QLatin1String("runtime_id"))) { installedRuntimes << attrs.value(QLatin1String("runtime_id")).toString(); - else if (attrs.hasAttribute(QLatin1String("id"))) { + } else if (attrs.hasAttribute(QLatin1String("id"))) { // older MADDE seems to use only id installedRuntimes << attrs.value(QLatin1String("id")).toString(); } diff --git a/src/plugins/projectexplorer/cesdkhandler.cpp b/src/plugins/projectexplorer/cesdkhandler.cpp index b6b245cfd3..261506ed76 100644 --- a/src/plugins/projectexplorer/cesdkhandler.cpp +++ b/src/plugins/projectexplorer/cesdkhandler.cpp @@ -79,9 +79,9 @@ bool CeSdkHandler::parse(const QString &vsdir) xml.readNext(); if (xml.isStartElement()) { currentElement = xml.name().toString(); - if (currentElement == QLatin1String("Platform")) + if (currentElement == QLatin1String("Platform")) { currentItem = CeSdkInfo(); - else if (currentElement == QLatin1String("Directories")) { + } else if (currentElement == QLatin1String("Directories")) { QXmlStreamAttributes attr = xml.attributes(); currentItem.m_include = fixPaths(attr.value(QLatin1String("Include")).toString()); currentItem.m_lib = fixPaths(attr.value(QLatin1String("Library")).toString()); diff --git a/src/plugins/projectexplorer/target.cpp b/src/plugins/projectexplorer/target.cpp index 5a5585f485..a6b0fe796d 100644 --- a/src/plugins/projectexplorer/target.cpp +++ b/src/plugins/projectexplorer/target.cpp @@ -676,9 +676,9 @@ void Target::updateDefaultRunConfigurations() // Make sure a configured RC is active: if (activeRunConfiguration() && !activeRunConfiguration()->isConfigured()) { - if (!existingConfigured.isEmpty()) + if (!existingConfigured.isEmpty()) { setActiveRunConfiguration(existingConfigured.at(0)); - else if (!newConfigured.isEmpty()) { + } else if (!newConfigured.isEmpty()) { RunConfiguration *selected = newConfigured.at(0); // Try to find a runconfiguration that matches the project name. That is a good // candidate for something to run initially. diff --git a/src/plugins/projectexplorer/wincetoolchain.cpp b/src/plugins/projectexplorer/wincetoolchain.cpp index cb26749fed..f945c486fb 100644 --- a/src/plugins/projectexplorer/wincetoolchain.cpp +++ b/src/plugins/projectexplorer/wincetoolchain.cpp @@ -93,8 +93,7 @@ static QString winExpandDelayedEnvReferences(QString in, const Utils::Environmen if (replacement.isEmpty()) { qWarning() << "No replacement for var: " << var; pos = nextPos; - } - else { + } else { // Not sure about this, but we need to account for the case where // the end of the replacement doesn't have the directory seperator and // neither does the start of the insert. This solution assumes: diff --git a/src/plugins/qmldesigner/components/formeditor/selectiontool.cpp b/src/plugins/qmldesigner/components/formeditor/selectiontool.cpp index 6df144c783..aee421b2ff 100644 --- a/src/plugins/qmldesigner/components/formeditor/selectiontool.cpp +++ b/src/plugins/qmldesigner/components/formeditor/selectiontool.cpp @@ -164,9 +164,9 @@ void SelectionTool::hoverMoveEvent(const QList<QGraphicsItem*> &itemList, void SelectionTool::mouseReleaseEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) { - if (m_singleSelectionManipulator.isActive()) + if (m_singleSelectionManipulator.isActive()) { m_singleSelectionManipulator.end(event->scenePos()); - else if (m_rubberbandSelectionManipulator.isActive()) { + } else if (m_rubberbandSelectionManipulator.isActive()) { QPointF mouseMovementVector = m_rubberbandSelectionManipulator.beginPoint() - event->scenePos(); if (mouseMovementVector.toPoint().manhattanLength() < s_startDragDistance) { diff --git a/src/plugins/qmldesigner/components/itemlibrary/customdraganddrop.cpp b/src/plugins/qmldesigner/components/itemlibrary/customdraganddrop.cpp index f5dc94a079..934d037038 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/customdraganddrop.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/customdraganddrop.cpp @@ -101,8 +101,7 @@ void CustomDragAndDropIcon::mouseMoveEvent(QMouseEvent *event) resize(m_size); show(); update(); - } - else { + } else { move(-1000, -1000); // if no top level widget is found we are out of the main window } QWidget* target = QApplication::widgetAt(globalPos - QPoint(2,2)); //-(2, 2) because: diff --git a/src/plugins/qmldesigner/components/itemlibrary/qml/ItemsView.qml b/src/plugins/qmldesigner/components/itemlibrary/qml/ItemsView.qml index 8be1316212..20ecae2ce4 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/qml/ItemsView.qml +++ b/src/plugins/qmldesigner/components/itemlibrary/qml/ItemsView.qml @@ -193,9 +193,9 @@ reasons and then passed to the section views */ /* Limit the content position. Without this, resizing would get the content position out of scope regarding the scrollbar. */ function limitContentPos() { - if (contentY < 0) + if (contentY < 0) { contentY = 0; - else { + } else { var maxContentY = Math.max(0, contentHeight - height) if (contentY > maxContentY) contentY = maxContentY; diff --git a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp index e9340401c9..b1821e88d9 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp @@ -149,8 +149,7 @@ bool NavigatorTreeModel::dropMimeData(const QMimeData *data, return false; targetIndex -= visibleProperties(parentNode).count(); parentPropertyName = parentNode.metaInfo().defaultPropertyName(); - } - else { + } else { parentItemIndex = parentIndex.parent(); parentPropertyName = parentIndex.data(Qt::DisplayRole).toByteArray(); } @@ -295,8 +294,7 @@ void NavigatorTreeModel::updateItemRowOrder(const NodeListProperty &listProperty parentIdItem = parentRow.idItem; newRow += visibleProperties(listProperty.parentModelNode()).count(); } - } - else { + } else { parentIdItem = itemRow.idItem->parent(); } Q_ASSERT(parentIdItem); diff --git a/src/plugins/qmldesigner/components/navigator/navigatortreeview.cpp b/src/plugins/qmldesigner/components/navigator/navigatortreeview.cpp index 497318705d..58cb96790c 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatortreeview.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatortreeview.cpp @@ -145,8 +145,7 @@ public: if (option->rect.height() == 0) { if (option->rect.top()>0) painter->drawLine(rect.topLeft(), rect.topRight()); - } - else { + } else { highlight.setAlphaF(0.2); painter->setBrush(highlight); painter->drawRect(rect.adjusted(0, 0, -1, -1)); @@ -280,8 +279,7 @@ void NameItemDelegate::paint(QPainter *painter, displayString = fm.elidedText(displayString,Qt::ElideMiddle,option.rect.width()-extraSpace); displayStringOffset = QPoint(5+pixmapSide,-5); width = fm.width(displayString); - } - else { + } else { displayString = index.data(Qt::DisplayRole).toString(); displayStringOffset = QPoint(0, -2); } diff --git a/src/plugins/qmldesigner/components/propertyeditor/basicwidgets.cpp b/src/plugins/qmldesigner/components/propertyeditor/basicwidgets.cpp index ffc61704c9..a513410b5e 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/basicwidgets.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/basicwidgets.cpp @@ -1242,8 +1242,7 @@ void QGroupBoxDeclarativeUI::finish() gb->setUpdatesEnabled(true); //gb->resize(gb->sizeHint()); gb->finishFirstExpand(); - } - else { + } else { gb->setMinimumHeight(30); gb->setMaximumHeight(30); gb->resize(gb->sizeHint().width(), 30); @@ -1315,8 +1314,7 @@ void QGroupBoxDeclarativeUI::animate(int frame) if (m_expanded) { height = ((qreal(frame) / 5.0) * qreal(m_oldHeight)) + (30.0 * (1.0 - qreal(frame) / 5.0)); gb->setPixmap(m_contens, qreal(frame) / 5.0); - } - else { + } else { height = ((qreal(frame) / 5.0) * 30.0) + (qreal(m_oldHeight) * (1.0 - qreal(frame) / 5.0)); qreal alpha = 0.8 - qreal(frame) / 4.0; if (alpha < 0) diff --git a/src/plugins/qmldesigner/designercore/filemanager/changepropertyvisitor.cpp b/src/plugins/qmldesigner/designercore/filemanager/changepropertyvisitor.cpp index d03203d036..602888566c 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/changepropertyvisitor.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/changepropertyvisitor.cpp @@ -115,9 +115,8 @@ void ChangePropertyVisitor::replaceInMembers(UiObjectInitializer *initializer, } break; - } // for grouped properties: - else if (!prefix.isEmpty()) { + } else if (!prefix.isEmpty()) { if (UiObjectDefinition *def = cast<UiObjectDefinition *>(member)) { if (toString(def->qualifiedTypeNameId) == prefix) replaceInMembers(def->initializer, suffix); diff --git a/src/plugins/qmldesigner/designercore/filemanager/removepropertyvisitor.cpp b/src/plugins/qmldesigner/designercore/filemanager/removepropertyvisitor.cpp index e1ab75919d..94af7278d6 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/removepropertyvisitor.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/removepropertyvisitor.cpp @@ -83,10 +83,10 @@ void RemovePropertyVisitor::removeFrom(QmlJS::AST::UiObjectInitializer *ast) UiObjectMember *member = it->member; // run full name match (for ungrouped properties): - if (memberNameMatchesPropertyName(propertyName, member)) + if (memberNameMatchesPropertyName(propertyName, member)) { removeMember(member); // check for grouped properties: - else if (!prefix.isEmpty()) { + } else if (!prefix.isEmpty()) { if (UiObjectDefinition *def = cast<UiObjectDefinition *>(member)) { if (toString(def->qualifiedTypeNameId) == prefix) removeGroupedProperty(def); diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp index 0700c35d88..3dcb940372 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp @@ -294,23 +294,23 @@ void NodeInstanceServerProxy::dispatchCommand(const QVariant &command) static const int tokenCommandType = QMetaType::type("TokenCommand"); static const int debugOutputCommandType = QMetaType::type("DebugOutputCommand"); - if (command.userType() == informationChangedCommandType) + if (command.userType() == informationChangedCommandType) { nodeInstanceClient()->informationChanged(command.value<InformationChangedCommand>()); - else if (command.userType() == valuesChangedCommandType) + } else if (command.userType() == valuesChangedCommandType) { nodeInstanceClient()->valuesChanged(command.value<ValuesChangedCommand>()); - else if (command.userType() == pixmapChangedCommandType) + } else if (command.userType() == pixmapChangedCommandType) { nodeInstanceClient()->pixmapChanged(command.value<PixmapChangedCommand>()); - else if (command.userType() == childrenChangedCommandType) + } else if (command.userType() == childrenChangedCommandType) { nodeInstanceClient()->childrenChanged(command.value<ChildrenChangedCommand>()); - else if (command.userType() == statePreviewImageChangedCommandType) + } else if (command.userType() == statePreviewImageChangedCommandType) { nodeInstanceClient()->statePreviewImagesChanged(command.value<StatePreviewImageChangedCommand>()); - else if (command.userType() == componentCompletedCommandType) + } else if (command.userType() == componentCompletedCommandType) { nodeInstanceClient()->componentCompleted(command.value<ComponentCompletedCommand>()); - else if (command.userType() == tokenCommandType) + } else if (command.userType() == tokenCommandType) { nodeInstanceClient()->token(command.value<TokenCommand>()); - else if (command.userType() == debugOutputCommandType) + } else if (command.userType() == debugOutputCommandType) { nodeInstanceClient()->debugOutput(command.value<DebugOutputCommand>()); - else if (command.userType() == synchronizeCommandType) { + } else if (command.userType() == synchronizeCommandType) { SynchronizeCommand synchronizeCommand = command.value<SynchronizeCommand>(); m_synchronizeId = synchronizeCommand.synchronizeId(); } else diff --git a/src/plugins/qmljseditor/qmljscompletionassist.cpp b/src/plugins/qmljseditor/qmljscompletionassist.cpp index 8cb43496e8..d5ef230dcc 100644 --- a/src/plugins/qmljseditor/qmljscompletionassist.cpp +++ b/src/plugins/qmljseditor/qmljscompletionassist.cpp @@ -286,9 +286,8 @@ private: { if (! value) return; - else if (const ObjectValue *object = value->asObjectValue()) { + if (const ObjectValue *object = value->asObjectValue()) processProperties(object); - } } void processProperties(const ObjectValue *object) diff --git a/src/plugins/qmljseditor/qmljshoverhandler.cpp b/src/plugins/qmljseditor/qmljshoverhandler.cpp index 6f91d6b0f3..3193298a30 100644 --- a/src/plugins/qmljseditor/qmljshoverhandler.cpp +++ b/src/plugins/qmljseditor/qmljshoverhandler.cpp @@ -379,17 +379,10 @@ void HoverHandler::operateTooltip(TextEditor::ITextEditor *editor, const QPoint { if (toolTip().isEmpty()) Utils::ToolTip::instance()->hide(); - else { - if (m_colorTip.isValid()) { - Utils::ToolTip::instance()->show(point, - Utils::ColorContent(m_colorTip), - editor->widget()); - } else { - Utils::ToolTip::instance()->show(point, - Utils::TextContent(toolTip()), - editor->widget()); - } - } + else if (m_colorTip.isValid()) + Utils::ToolTip::instance()->show(point, Utils::ColorContent(m_colorTip), editor->widget()); + else + Utils::ToolTip::instance()->show(point, Utils::TextContent(toolTip()), editor->widget()); } void HoverHandler::prettyPrintTooltip(const QmlJS::Value *value, diff --git a/src/plugins/qmljstools/qmlconsoleview.cpp b/src/plugins/qmljstools/qmlconsoleview.cpp index 872b4ae867..f74e858cd9 100644 --- a/src/plugins/qmljstools/qmlconsoleview.cpp +++ b/src/plugins/qmljstools/qmlconsoleview.cpp @@ -107,9 +107,9 @@ QmlConsoleView::QmlConsoleView(QWidget *parent) : if (Utils::HostOsInfo::isAnyUnixHost() && !Utils::HostOsInfo::isMacHost() && baseName == QLatin1String("windows")) { // Sometimes we get the standard windows 95 style as a fallback - if (QStyleFactory::keys().contains(QLatin1String("Fusion"))) + if (QStyleFactory::keys().contains(QLatin1String("Fusion"))) { baseName = QLatin1String("fusion"); // Qt5 - else { // Qt4 + } else { // Qt4 // e.g. if we are running on a KDE4 desktop QByteArray desktopEnvironment = qgetenv("DESKTOP_SESSION"); if (desktopEnvironment == "kde") diff --git a/src/plugins/qmljstools/qmljsfindexportedcpptypes.cpp b/src/plugins/qmljstools/qmljsfindexportedcpptypes.cpp index 74078654db..0d2bd263f5 100644 --- a/src/plugins/qmljstools/qmljsfindexportedcpptypes.cpp +++ b/src/plugins/qmljstools/qmljsfindexportedcpptypes.cpp @@ -309,9 +309,8 @@ protected: if (QString::fromUtf8(id->chars(), id->size()) != QLatin1String("QVariant")) return ast; return call->expression_list->value; - } // QVariant::fromValue(foo) -> foo - else if (QualifiedNameAST *q = idExp->name->asQualifiedName()) { + } else if (QualifiedNameAST *q = idExp->name->asQualifiedName()) { SimpleNameAST *simpleRhsName = q->unqualified_name->asSimpleName(); if (!simpleRhsName || !q->nested_name_specifier_list diff --git a/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d.cpp b/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d.cpp index 62e7f09207..5121aac332 100644 --- a/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d.cpp +++ b/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d.cpp @@ -511,17 +511,17 @@ QString Context2D::textBaseline() void Context2D::setTextBaseline(const QString &baseline) { - if (baseline==QLatin1String("alphabetic")) + if (baseline==QLatin1String("alphabetic")) { m_state.textBaseline = Context2D::Alphabetic; - else if (baseline == QLatin1String("hanging")) + } else if (baseline == QLatin1String("hanging")) { m_state.textBaseline = Context2D::Hanging; - else if (baseline == QLatin1String("top")) + } else if (baseline == QLatin1String("top")) { m_state.textBaseline = Context2D::Top; - else if (baseline == QLatin1String("bottom")) + } else if (baseline == QLatin1String("bottom")) { m_state.textBaseline = Context2D::Bottom; - else if (baseline == QLatin1String("middle")) + } else if (baseline == QLatin1String("middle")) { m_state.textBaseline = Context2D::Middle; - else { + } else { m_state.textBaseline = Context2D::Alphabetic; qWarning() << (QLatin1String("Context2D: invalid baseline:") + baseline); } @@ -550,17 +550,17 @@ QString Context2D::textAlign() void Context2D::setTextAlign(const QString &baseline) { - if (baseline==QLatin1String("start")) + if (baseline==QLatin1String("start")) { m_state.textAlign = Context2D::Start; - else if (baseline == QLatin1String("end")) + } else if (baseline == QLatin1String("end")) { m_state.textAlign = Context2D::End; - else if (baseline == QLatin1String("left")) + } else if (baseline == QLatin1String("left")) { m_state.textAlign = Context2D::Left; - else if (baseline == QLatin1String("right")) + } else if (baseline == QLatin1String("right")) { m_state.textAlign = Context2D::Right; - else if (baseline == QLatin1String("center")) + } else if (baseline == QLatin1String("center")) { m_state.textAlign = Context2D::Center; - else { + } else { m_state.textAlign= Context2D::Start; qWarning("Context2D: invalid text align"); } @@ -574,11 +574,11 @@ void Context2D::setFont(const QString &fontString) // ### this is simplified and incomplete QStringList tokens = fontString.split(QLatin1Char(QLatin1Char(' '))); foreach (const QString &token, tokens) { - if (token == QLatin1String("italic")) + if (token == QLatin1String("italic")) { font.setItalic(true); - else if (token == QLatin1String("bold")) + } else if (token == QLatin1String("bold")) { font.setBold(true); - else if (token.endsWith(QLatin1String("px"))) { + } else if (token.endsWith(QLatin1String("px"))) { QString number = token; number.remove(QLatin1String("px")); #ifdef Q_OS_MACX @@ -589,8 +589,9 @@ void Context2D::setFont(const QString &fontString) #else font.setPointSizeF(number.trimmed().toFloat()); #endif - } else + } else { font.setFamily(token); + } } m_state.font = font; m_state.flags |= DirtyFont; diff --git a/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp b/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp index d6091ef9a1..640b206d2b 100644 --- a/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp @@ -310,9 +310,9 @@ void QmlProfilerDataModel::addRangedEvent(int type, int bindingType, qint64 star setState(AcquiringData); // generate details string - if (data.isEmpty()) + if (data.isEmpty()) { details = tr("Source code not available."); - else { + } else { details = data.join(QLatin1String(" ")).replace(QLatin1Char('\n'),QLatin1Char(' ')).simplified(); QRegExp rewrite(QLatin1String("\\(function \\$(\\w+)\\(\\) \\{ (return |)(.+) \\}\\)")); bool match = rewrite.exactMatch(details); @@ -613,18 +613,14 @@ qint64 QmlProfilerDataModel::firstTimeMark() const { if (d->startInstanceList.isEmpty()) return 0; - else { - return d->startInstanceList[0].startTime; - } + return d->startInstanceList[0].startTime; } qint64 QmlProfilerDataModel::lastTimeMark() const { if (d->endInstanceList.isEmpty()) return 0; - else { - return d->endInstanceList.last().endTime; - } + return d->endInstanceList.last().endTime; } //////////////////////////////////////////////////////////////////////////////////// @@ -1046,9 +1042,9 @@ void QmlProfilerDataModel::QmlProfilerDataModelPrivate::computeNestingDepth() for (int i = 0; i < endInstanceList.count(); i++) { int type = endInstanceList[i].description->eventType; int nestingInType = startInstanceList[endInstanceList[i].startTimeIndex].nestingLevel; - if (!nestingDepth.contains(type)) + if (!nestingDepth.contains(type)) { nestingDepth[type] = nestingInType; - else { + } else { int nd = nestingDepth[type]; nestingDepth[type] = nd > nestingInType ? nd : nestingInType; } diff --git a/src/plugins/qmlprofiler/qmlprofilereventview.cpp b/src/plugins/qmlprofiler/qmlprofilereventview.cpp index d04a0203e0..d956fa61bc 100644 --- a/src/plugins/qmlprofiler/qmlprofilereventview.cpp +++ b/src/plugins/qmlprofiler/qmlprofilereventview.cpp @@ -970,8 +970,7 @@ void QmlProfilerEventsParentsAndChildrenView::displayEvent(int eventId) if (isChildren) { QList <QV8EventSub *> childrenList = v8event->childrenHash.values(); rebuildTree((QObject *)&childrenList); - } - else { + } else { QList <QV8EventSub *> parentList = v8event->parentHash.values(); rebuildTree((QObject *)&parentList); } @@ -982,8 +981,7 @@ void QmlProfilerEventsParentsAndChildrenView::displayEvent(int eventId) if (isChildren) { QList <QmlRangeEventRelative *> childrenList = qmlEvent->childrenHash.values(); rebuildTree((QObject *)&childrenList); - } - else { + } else { QList <QmlRangeEventRelative *> parentList = qmlEvent->parentHash.values(); rebuildTree((QObject *)&parentList); } diff --git a/src/plugins/qnx/qnxutils.cpp b/src/plugins/qnx/qnxutils.cpp index 64eff9cea1..2da2c9bc19 100644 --- a/src/plugins/qnx/qnxutils.cpp +++ b/src/plugins/qnx/qnxutils.cpp @@ -117,8 +117,7 @@ QMultiMap<QString, QString> QnxUtils::parseEnvironmentFile(const QString &fileNa else value = systemVarRegExp.cap(3); } - } - else if (Utils::HostOsInfo::isAnyUnixHost()) { + } else if (Utils::HostOsInfo::isAnyUnixHost()) { QRegExp systemVarRegExp(QLatin1String("\\$\\{([\\w\\d]+):=([\\w\\d]+)\\}")); // to match e.g. "${QNX_HOST_VERSION:=10_0_9_52}" if (value.contains(systemVarRegExp)) { Utils::Environment sysEnv = Utils::Environment::systemEnvironment(); diff --git a/src/plugins/qtsupport/debugginghelperbuildtask.cpp b/src/plugins/qtsupport/debugginghelperbuildtask.cpp index 5a53d2b3f5..9f77184182 100644 --- a/src/plugins/qtsupport/debugginghelperbuildtask.cpp +++ b/src/plugins/qtsupport/debugginghelperbuildtask.cpp @@ -101,9 +101,8 @@ DebuggingHelperBuildTask::DebuggingHelperBuildTask(const BaseQtVersion *version, // explicitly set 32 or 64 bit in case Qt is compiled with both if (toolChain->targetAbi().wordWidth() == 32) m_qmakeArguments << QLatin1String("CONFIG+=x86"); - else if (toolChain->targetAbi().wordWidth() == 64) { + else if (toolChain->targetAbi().wordWidth() == 64) m_qmakeArguments << QLatin1String("CONFIG+=x86_64"); - } } m_makeCommand = toolChain->makeCommand(m_environment); m_mkspec = version->mkspec(); diff --git a/src/plugins/texteditor/autocompleter.cpp b/src/plugins/texteditor/autocompleter.cpp index 37d251e536..3b89850868 100644 --- a/src/plugins/texteditor/autocompleter.cpp +++ b/src/plugins/texteditor/autocompleter.cpp @@ -122,8 +122,7 @@ QString AutoCompleter::autoComplete(QTextCursor &cursor, const QString &textToIn str += QLatin1String("}") + QString(QChar::ParagraphSeparator); else str += QString(QChar::ParagraphSeparator) + QLatin1String("}"); - } - else { + } else { str += QLatin1String("}"); } return str; diff --git a/src/plugins/texteditor/basetextdocumentlayout.cpp b/src/plugins/texteditor/basetextdocumentlayout.cpp index 263c78eb1a..f8bccb4e4c 100644 --- a/src/plugins/texteditor/basetextdocumentlayout.cpp +++ b/src/plugins/texteditor/basetextdocumentlayout.cpp @@ -680,10 +680,8 @@ void BaseTextDocumentLayout::setFolded(const QTextBlock &block, bool folded) { if (folded) userData(block)->setFolded(true); - else { - if (TextBlockUserData *userData = testUserData(block)) - return userData->setFolded(false); - } + else if (TextBlockUserData *userData = testUserData(block)) + return userData->setFolded(false); } void BaseTextDocumentLayout::requestExtraAreaUpdate() diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index cb5d4f33c1..17fca6633f 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -1424,55 +1424,44 @@ bool BaseTextEditorWidget::cursorMoveKeyEvent(QKeyEvent *e) QTextCursor::MoveMode mode = QTextCursor::MoveAnchor; QTextCursor::MoveOperation op = QTextCursor::NoMove; - if (e == QKeySequence::MoveToNextChar) + if (e == QKeySequence::MoveToNextChar) { op = QTextCursor::Right; - else if (e == QKeySequence::MoveToPreviousChar) + } else if (e == QKeySequence::MoveToPreviousChar) { op = QTextCursor::Left; - else if (e == QKeySequence::SelectNextChar) { + } else if (e == QKeySequence::SelectNextChar) { op = QTextCursor::Right; mode = QTextCursor::KeepAnchor; - } - else if (e == QKeySequence::SelectPreviousChar) { + } else if (e == QKeySequence::SelectPreviousChar) { op = QTextCursor::Left; mode = QTextCursor::KeepAnchor; - } - else if (e == QKeySequence::SelectNextWord) { + } else if (e == QKeySequence::SelectNextWord) { op = QTextCursor::WordRight; mode = QTextCursor::KeepAnchor; - } - else if (e == QKeySequence::SelectPreviousWord) { + } else if (e == QKeySequence::SelectPreviousWord) { op = QTextCursor::WordLeft; mode = QTextCursor::KeepAnchor; - } - else if (e == QKeySequence::SelectStartOfLine) { + } else if (e == QKeySequence::SelectStartOfLine) { op = QTextCursor::StartOfLine; mode = QTextCursor::KeepAnchor; - } - else if (e == QKeySequence::SelectEndOfLine) { + } else if (e == QKeySequence::SelectEndOfLine) { op = QTextCursor::EndOfLine; mode = QTextCursor::KeepAnchor; - } - else if (e == QKeySequence::SelectStartOfBlock) { + } else if (e == QKeySequence::SelectStartOfBlock) { op = QTextCursor::StartOfBlock; mode = QTextCursor::KeepAnchor; - } - else if (e == QKeySequence::SelectEndOfBlock) { + } else if (e == QKeySequence::SelectEndOfBlock) { op = QTextCursor::EndOfBlock; mode = QTextCursor::KeepAnchor; - } - else if (e == QKeySequence::SelectStartOfDocument) { + } else if (e == QKeySequence::SelectStartOfDocument) { op = QTextCursor::Start; mode = QTextCursor::KeepAnchor; - } - else if (e == QKeySequence::SelectEndOfDocument) { + } else if (e == QKeySequence::SelectEndOfDocument) { op = QTextCursor::End; mode = QTextCursor::KeepAnchor; - } - else if (e == QKeySequence::SelectPreviousLine) { + } else if (e == QKeySequence::SelectPreviousLine) { op = QTextCursor::Up; mode = QTextCursor::KeepAnchor; - } - else if (e == QKeySequence::SelectNextLine) { + } else if (e == QKeySequence::SelectNextLine) { op = QTextCursor::Down; mode = QTextCursor::KeepAnchor; { @@ -1483,41 +1472,29 @@ bool BaseTextEditorWidget::cursorMoveKeyEvent(QKeyEvent *e) && line.lineNumber() == block.layout()->lineCount() - 1) op = QTextCursor::End; } - } - else if (e == QKeySequence::MoveToNextWord) { + } else if (e == QKeySequence::MoveToNextWord) { op = QTextCursor::WordRight; - } - else if (e == QKeySequence::MoveToPreviousWord) { + } else if (e == QKeySequence::MoveToPreviousWord) { op = QTextCursor::WordLeft; - } - else if (e == QKeySequence::MoveToEndOfBlock) { + } else if (e == QKeySequence::MoveToEndOfBlock) { op = QTextCursor::EndOfBlock; - } - else if (e == QKeySequence::MoveToStartOfBlock) { + } else if (e == QKeySequence::MoveToStartOfBlock) { op = QTextCursor::StartOfBlock; - } - else if (e == QKeySequence::MoveToNextLine) { + } else if (e == QKeySequence::MoveToNextLine) { op = QTextCursor::Down; - } - else if (e == QKeySequence::MoveToPreviousLine) { + } else if (e == QKeySequence::MoveToPreviousLine) { op = QTextCursor::Up; - } - else if (e == QKeySequence::MoveToPreviousLine) { + } else if (e == QKeySequence::MoveToPreviousLine) { op = QTextCursor::Up; - } - else if (e == QKeySequence::MoveToStartOfLine) { + } else if (e == QKeySequence::MoveToStartOfLine) { op = QTextCursor::StartOfLine; - } - else if (e == QKeySequence::MoveToEndOfLine) { + } else if (e == QKeySequence::MoveToEndOfLine) { op = QTextCursor::EndOfLine; - } - else if (e == QKeySequence::MoveToStartOfDocument) { + } else if (e == QKeySequence::MoveToStartOfDocument) { op = QTextCursor::Start; - } - else if (e == QKeySequence::MoveToEndOfDocument) { + } else if (e == QKeySequence::MoveToEndOfDocument) { op = QTextCursor::End; - } - else { + } else { return false; } @@ -1865,9 +1842,7 @@ void BaseTextEditorWidget::keyPressEvent(QKeyEvent *e) } if (ro || e->text().isEmpty() || !e->text().at(0).isPrint()) { - if (cursorMoveKeyEvent(e)) - ; - else { + if (!cursorMoveKeyEvent(e)) { QTextCursor cursor = textCursor(); bool cursorWithinSnippet = false; if (d->m_snippetOverlay->isVisible() @@ -4001,9 +3976,9 @@ void BaseTextEditorWidget::slotModificationChanged(bool m) void BaseTextEditorWidget::slotUpdateRequest(const QRect &r, int dy) { - if (dy) + if (dy) { d->m_extraArea->scroll(0, dy); - else if (r.width() > 4) { // wider than cursor width, not just cursor blinking + } else if (r.width() > 4) { // wider than cursor width, not just cursor blinking d->m_extraArea->update(0, r.y(), d->m_extraArea->width(), r.height()); if (!d->m_searchExpr.isEmpty()) { const int m = d->m_searchResultOverlay->dropShadowWidth(); diff --git a/src/plugins/texteditor/fontsettingspage.cpp b/src/plugins/texteditor/fontsettingspage.cpp index a1a52cfd79..e3cd7e496a 100644 --- a/src/plugins/texteditor/fontsettingspage.cpp +++ b/src/plugins/texteditor/fontsettingspage.cpp @@ -260,15 +260,15 @@ QColor FormatDescription::foreground() const QColor FormatDescription::background() const { - if (m_id == C_TEXT) + if (m_id == C_TEXT) { return Qt::white; - else if (m_id == C_LINE_NUMBER) + } else if (m_id == C_LINE_NUMBER) { return QApplication::palette().background().color(); - else if (m_id == C_SEARCH_RESULT) + } else if (m_id == C_SEARCH_RESULT) { return QColor(0xffef0b); - else if (m_id == C_PARENTHESES) + } else if (m_id == C_PARENTHESES) { return QColor(0xb4, 0xee, 0xb4); - else if (m_id == C_CURRENT_LINE || m_id == C_SEARCH_SCOPE) { + } else if (m_id == C_CURRENT_LINE || m_id == C_SEARCH_SCOPE) { const QPalette palette = QApplication::palette(); const QColor &fg = palette.color(QPalette::Highlight); const QColor &bg = palette.color(QPalette::Base); diff --git a/src/plugins/texteditor/generichighlighter/managedefinitionsdialog.cpp b/src/plugins/texteditor/generichighlighter/managedefinitionsdialog.cpp index f01fcf6621..d1e8ef6ac7 100644 --- a/src/plugins/texteditor/generichighlighter/managedefinitionsdialog.cpp +++ b/src/plugins/texteditor/generichighlighter/managedefinitionsdialog.cpp @@ -84,9 +84,9 @@ void ManageDefinitionsDialog::populateDefinitionsWidget() for (int j = 0; j < 3; ++j) { QTableWidgetItem *item = new QTableWidgetItem; - if (j == 0) + if (j == 0) { item->setText(downloadData.name); - else if (j == 1) { + } else if (j == 1) { item->setText(dirVersion); item->setTextAlignment(Qt::AlignCenter); } else if (j == 2) { diff --git a/src/plugins/texteditor/refactoringchanges.cpp b/src/plugins/texteditor/refactoringchanges.cpp index 99b0312f72..f5e43b32ac 100644 --- a/src/plugins/texteditor/refactoringchanges.cpp +++ b/src/plugins/texteditor/refactoringchanges.cpp @@ -214,7 +214,7 @@ QTextDocument *RefactoringFile::mutableDocument() const { if (m_editor) return m_editor->document(); - else if (!m_document) { + if (!m_document) { QString fileContents; if (!m_fileName.isEmpty()) { QString error; @@ -238,7 +238,7 @@ const QTextCursor RefactoringFile::cursor() const { if (m_editor) return m_editor->textCursor(); - else if (!m_fileName.isEmpty()) { + if (!m_fileName.isEmpty()) { if (QTextDocument *doc = mutableDocument()) return QTextCursor(doc); } diff --git a/src/plugins/todo/todoitemsprovider.cpp b/src/plugins/todo/todoitemsprovider.cpp index 28e691bc7d..eb491cc4e4 100644 --- a/src/plugins/todo/todoitemsprovider.cpp +++ b/src/plugins/todo/todoitemsprovider.cpp @@ -79,10 +79,8 @@ void TodoItemsProvider::updateList() if (m_settings.scanningScope == ScanningScopeCurrentFile) { if (m_currentEditor) m_itemsList = m_itemsHash.value(m_currentEditor->document()->filePath()); - } - // Show only items of the startup project if any - else { + } else { if (m_startupProject) setItemsListWithinStartupProject(); } diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp index 38e530c02e..a2cc8d12a1 100644 --- a/src/plugins/valgrind/callgrindtool.cpp +++ b/src/plugins/valgrind/callgrindtool.cpp @@ -408,8 +408,7 @@ void CallgrindToolPrivate::handleFilterProjectCosts() if (m_filterProjectCosts->isChecked()) { const QString projectDir = pro->projectDirectory(); m_proxyModel->setFilterBaseDir(projectDir); - } - else { + } else { m_proxyModel->setFilterBaseDir(QString()); } } diff --git a/src/plugins/valgrind/callgrindvisualisation.cpp b/src/plugins/valgrind/callgrindvisualisation.cpp index 9da37c6711..b70eee9528 100644 --- a/src/plugins/valgrind/callgrindvisualisation.cpp +++ b/src/plugins/valgrind/callgrindvisualisation.cpp @@ -188,8 +188,7 @@ void FunctionGraphicsItem::paint(QPainter *painter, gradient.setColorAt(0.5, color.lighter(200)); gradient.setColorAt(1, color.darker(100)); painter->setBrush(gradient); - } - else { + } else { painter->setBrush(color); } @@ -256,9 +255,9 @@ void Visualisation::Private::handleMousePressEvent(QMouseEvent *event, if (itemAtPos) { const Function *func = q->functionForItem(itemAtPos); - if (doubleClicked) + if (doubleClicked) { q->functionActivated(func); - else { + } else { q->scene()->clearSelection(); itemAtPos->setSelected(true); q->functionSelected(func); diff --git a/src/plugins/valgrind/xmlprotocol/parser.cpp b/src/plugins/valgrind/xmlprotocol/parser.cpp index ca76a006f5..d029009b6d 100644 --- a/src/plugins/valgrind/xmlprotocol/parser.cpp +++ b/src/plugins/valgrind/xmlprotocol/parser.cpp @@ -440,29 +440,27 @@ void Parser::Private::parseError() if (reader.isStartElement()) lastAuxWhat++; const QStringRef name = reader.name(); - if (name == QLatin1String("unique")) + if (name == QLatin1String("unique")) { e.setUnique(parseHex(blockingReadElementText(), QLatin1String("unique"))); - else if (name == QLatin1String("tid")) + } else if (name == QLatin1String("tid")) { e.setTid(parseInt64(blockingReadElementText(), QLatin1String("error/tid"))); - else if (name == QLatin1String("kind")) //TODO this is memcheck-specific: + } else if (name == QLatin1String("kind")) { //TODO this is memcheck-specific: e.setKind(parseErrorKind(blockingReadElementText())); - else if (name == QLatin1String("suppression")) + } else if (name == QLatin1String("suppression")) { e.setSuppression(parseSuppression()); - else if (name == QLatin1String("xwhat")) { + } else if (name == QLatin1String("xwhat")) { const XWhat xw = parseXWhat(); e.setWhat(xw.text); e.setLeakedBlocks(xw.leakedblocks); e.setLeakedBytes(xw.leakedbytes); e.setHelgrindThreadId(xw.hthreadid); - } - else if (name == QLatin1String("what")) + } else if (name == QLatin1String("what")) { e.setWhat(blockingReadElementText()); - else if (name == QLatin1String("xauxwhat")) { + } else if (name == QLatin1String("xauxwhat")) { if (!currentAux.text.isEmpty()) auxs.push_back(currentAux); currentAux = parseXauxWhat(); - } - else if (name == QLatin1String("auxwhat")) { + } else if (name == QLatin1String("auxwhat")) { const QString aux = blockingReadElementText(); //concatenate multiple consecutive <auxwhat> tags if (lastAuxWhat > 1) { @@ -476,12 +474,11 @@ void Parser::Private::parseError() currentAux.text.append(aux); } lastAuxWhat = 0; - } - else if (name == QLatin1String("stack")) { + } else if (name == QLatin1String("stack")) { frames.push_back(parseStack()); - } - else if (reader.isStartElement()) + } else if (reader.isStartElement()) { reader.skipCurrentElement(); + } } if (!currentAux.text.isEmpty()) diff --git a/src/plugins/vcsbase/vcsbaseclient.cpp b/src/plugins/vcsbase/vcsbaseclient.cpp index e9f7d7a74c..14778f13ca 100644 --- a/src/plugins/vcsbase/vcsbaseclient.cpp +++ b/src/plugins/vcsbase/vcsbaseclient.cpp @@ -600,13 +600,11 @@ Command *VcsBaseClient::createCommand(const QString &workingDirectory, if (editor) { // assume that the commands output is the important thing connect(cmd, SIGNAL(outputData(QByteArray)), ::vcsOutputWindow(), SLOT(appendDataSilently(QByteArray))); - } - else { + } else { connect(cmd, SIGNAL(outputData(QByteArray)), ::vcsOutputWindow(), SLOT(appendData(QByteArray))); } - } - else if (editor) { + } else if (editor) { connect(cmd, SIGNAL(outputData(QByteArray)), editor, SLOT(setPlainTextData(QByteArray))); } diff --git a/src/shared/cpaster/cgi.cpp b/src/shared/cpaster/cgi.cpp index 0c64e02c52..6bee94682e 100644 --- a/src/shared/cpaster/cgi.cpp +++ b/src/shared/cpaster/cgi.cpp @@ -44,11 +44,11 @@ QString CGI::encodeURL(const QString &rawText) const char ch = *it; if (('A' <= ch && ch <= 'Z') || ('a' <= ch && ch <= 'z') - || ('0' <= ch && ch <= '9')) + || ('0' <= ch && ch <= '9')) { enc.append(QLatin1Char(ch)); - else if (ch == ' ') + } else if (ch == ' ') { enc.append(QLatin1Char('+')); - else { + } else { switch (ch) { case '-': case '_': case '(': case ')': diff --git a/src/shared/help/bookmarkmanager.cpp b/src/shared/help/bookmarkmanager.cpp index 7cf164d0f0..ad9b266046 100644 --- a/src/shared/help/bookmarkmanager.cpp +++ b/src/shared/help/bookmarkmanager.cpp @@ -236,8 +236,7 @@ void BookmarkDialog::customContextMenuRequested(const QPoint &point) if (index.isValid()) name = index.data().toString(); ui.bookmarkFolders->setCurrentIndex(ui.bookmarkFolders->findText(name)); - } - else if (picked == renameItem) { + } else if (picked == renameItem) { BookmarkModel *model = bookmarkManager->treeBookmarkModel(); if (QStandardItem *item = model->itemFromIndex(proxyIndex)) { item->setEditable(true); @@ -397,15 +396,14 @@ void BookmarkWidget::customContextMenuRequested(const QPoint &point) if (!pickedAction) return; - if (pickedAction == showItem) + if (pickedAction == showItem) { emit linkActivated(data); - else if (pickedAction == showItemNewTab) + } else if (pickedAction == showItemNewTab) { emit createPage(QUrl(data), false); - else if (pickedAction == removeItem) { + } else if (pickedAction == removeItem) { bookmarkManager->removeBookmarkItem(treeView, filterBookmarkModel->mapToSource(index)); - } - else if (pickedAction == renameItem) { + } else if (pickedAction == renameItem) { const QModelIndex &source = filterBookmarkModel->mapToSource(index); QStandardItem *item = bookmarkManager->treeBookmarkModel()->itemFromIndex(source); diff --git a/src/shared/help/indexwindow.cpp b/src/shared/help/indexwindow.cpp index 60b86b7fc4..bbe713f899 100644 --- a/src/shared/help/indexwindow.cpp +++ b/src/shared/help/indexwindow.cpp @@ -149,9 +149,8 @@ bool IndexWindow::eventFilter(QObject *obj, QEvent *e) QAction *action = menu.exec(); if (curTab == action) m_indexWidget->activateCurrentItem(); - else if (newTab == action) { + else if (newTab == action) open(m_indexWidget, idx); - } } } else if (m_indexWidget && obj == m_indexWidget->viewport() && e->type() == QEvent::MouseButtonRelease) { diff --git a/src/tools/valgrindfake/outputgenerator.cpp b/src/tools/valgrindfake/outputgenerator.cpp index 9826277386..578b9c1d51 100644 --- a/src/tools/valgrindfake/outputgenerator.cpp +++ b/src/tools/valgrindfake/outputgenerator.cpp @@ -98,8 +98,7 @@ void OutputGenerator::produceRuntimeError() int i = 1 / zero; Q_UNUSED(i); Q_ASSERT(false); - } - else if (m_garbage) { + } else if (m_garbage) { std::cerr << "Writing garbage" << std::endl; blockingWrite(m_output, "<</GARBAGE = '\"''asdfaqre"); m_output->flush(); |