diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2013-01-08 03:32:53 +0200 |
---|---|---|
committer | hjk <qthjk@ovi.com> | 2013-01-08 10:48:18 +0100 |
commit | 29a93998df8405e8799ad23934a56cd99fb36403 (patch) | |
tree | c0e4a341efeef78fbe530a618caaa50254daad59 | |
parent | 73a2717bed511cffd0163195c314f7d919e5128b (diff) | |
download | qt-creator-29a93998df8405e8799ad23934a56cd99fb36403.tar.gz |
Remove braces for single lines of conditions
#!/usr/bin/env ruby
Dir.glob('**/*.cpp') { |file|
# skip ast (excluding paste, astpath, and canv'ast'imer)
next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i
s = File.read(file)
next if s.include?('qlalr')
orig = s.dup
s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m|
res = $&
if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces
res
else
res.gsub!('} else', 'else')
res.gsub!(/\n +} *\n/m, "\n")
res.gsub(/ *{$/, '')
end
}
s.gsub!(/ *$/, '')
File.open(file, 'wb').write(s) if s != orig
}
Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc
Reviewed-by: hjk <qthjk@ovi.com>
396 files changed, 1856 insertions, 3135 deletions
diff --git a/src/libs/3rdparty/cplusplus/Bind.cpp b/src/libs/3rdparty/cplusplus/Bind.cpp index ef71f2900e..909ef24e78 100644 --- a/src/libs/3rdparty/cplusplus/Bind.cpp +++ b/src/libs/3rdparty/cplusplus/Bind.cpp @@ -129,9 +129,8 @@ void Bind::setDeclSpecifiers(Symbol *symbol, const FullySpecifiedType &declSpeci symbol->setStorage(storage); if (Function *funTy = symbol->asFunction()) { - if (declSpecifiers.isVirtual()) { + if (declSpecifiers.isVirtual()) funTy->setVirtual(true); - } } if (declSpecifiers.isDeprecated()) @@ -466,9 +465,8 @@ void Bind::enumerator(EnumeratorAST *ast, Enum *symbol) EnumeratorDeclaration *e = control()->newEnumeratorDeclaration(ast->identifier_token, name); e->setType(control()->integerType(IntegerType::Int)); // ### introduce IntegerType::Enumerator - if (ExpressionAST *expr = ast->expression) { + if (ExpressionAST *expr = ast->expression) e->setConstantValue(asStringLiteral(expr->firstToken(), expr->lastToken())); - } symbol->addMember(e); } @@ -1845,9 +1843,8 @@ bool Bind::visit(SimpleDeclarationAST *ast) const Name *declName = 0; unsigned sourceLocation = location(it->value, ast->firstToken()); - if (declaratorId && declaratorId->name) { + if (declaratorId && declaratorId->name) declName = declaratorId->name->name; - } Declaration *decl = control()->newDeclaration(sourceLocation, declName); decl->setType(declTy); diff --git a/src/libs/3rdparty/cplusplus/Literals.cpp b/src/libs/3rdparty/cplusplus/Literals.cpp index 20e3a967a9..ca0cfc8735 100644 --- a/src/libs/3rdparty/cplusplus/Literals.cpp +++ b/src/libs/3rdparty/cplusplus/Literals.cpp @@ -206,9 +206,8 @@ bool Identifier::isEqualTo(const Name *other) const return true; else if (other) { - if (const Identifier *nameId = other->asNameId()) { + if (const Identifier *nameId = other->asNameId()) return equalTo(nameId); - } } return false; } diff --git a/src/libs/3rdparty/cplusplus/Parser.cpp b/src/libs/3rdparty/cplusplus/Parser.cpp index be92fcf673..dc9448cd72 100644 --- a/src/libs/3rdparty/cplusplus/Parser.cpp +++ b/src/libs/3rdparty/cplusplus/Parser.cpp @@ -898,9 +898,8 @@ bool Parser::parseConversionFunctionId(NameAST *&node) return false; unsigned operator_token = consumeToken(); SpecifierListAST *type_specifier = 0; - if (! parseTypeSpecifier(type_specifier)) { + if (! parseTypeSpecifier(type_specifier)) return false; - } PtrOperatorListAST *ptr_operators = 0, **ptr_operators_tail = &ptr_operators; while (parsePtrOperator(*ptr_operators_tail)) ptr_operators_tail = &(*ptr_operators_tail)->next; @@ -1550,9 +1549,8 @@ bool Parser::parseDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_specif for (SpecifierListAST *iter = decl_specifier_list; !hasAuto && iter; iter = iter->next) { SpecifierAST *spec = iter->value; if (SimpleSpecifierAST *simpleSpec = spec->asSimpleSpecifier()) { - if (_translationUnit->tokenKind(simpleSpec->specifier_token) == T_AUTO) { + if (_translationUnit->tokenKind(simpleSpec->specifier_token) == T_AUTO) hasAuto = true; - } } } @@ -1567,9 +1565,8 @@ bool Parser::parseDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_specif } else if (LA() == T_LBRACKET) { ArrayDeclaratorAST *ast = new (_pool) ArrayDeclaratorAST; ast->lbracket_token = consumeToken(); - if (LA() == T_RBRACKET || parseConstantExpression(ast->expression)) { + if (LA() == T_RBRACKET || parseConstantExpression(ast->expression)) match(T_RBRACKET, &ast->rbracket_token); - } *postfix_ptr = new (_pool) PostfixDeclaratorListAST(ast); postfix_ptr = &(*postfix_ptr)->next; } else @@ -1715,9 +1712,8 @@ bool Parser::parseEnumSpecifier(SpecifierListAST *&node) skipUntil(T_IDENTIFIER); } - if (parseEnumerator(*enumerator_ptr)) { + if (parseEnumerator(*enumerator_ptr)) enumerator_ptr = &(*enumerator_ptr)->next; - } if (LA() == T_COMMA && LA(2) == T_RBRACE) ast->stray_comma_token = consumeToken(); @@ -2182,11 +2178,10 @@ bool Parser::parseQtPropertyDeclaration(DeclarationAST *&node) SimpleNameAST *property_name = new (_pool) SimpleNameAST; // special case: keywords are allowed for property names! - if (tok().isKeyword()) { + if (tok().isKeyword()) property_name->identifier_token = consumeToken(); - } else { + else match(T_IDENTIFIER, &property_name->identifier_token); - } ast->property_name = property_name; QtPropertyDeclarationItemListAST **iter = &ast->property_declaration_item_list; @@ -3484,11 +3479,10 @@ bool Parser::parseForStatement(StatementAST *&node) ast->colon_token = consumeToken(); blockErrors(blocked); - if (LA() == T_LBRACE) { + if (LA() == T_LBRACE) parseBracedInitList0x(ast->expression); - } else { + else parseExpression(ast->expression); - } match(T_RPAREN, &ast->rparen_token); parseStatement(ast->statement); @@ -5093,11 +5087,10 @@ bool Parser::parseNewArrayDeclarator(NewArrayDeclaratorListAST *&node) bool Parser::parseNewInitializer(ExpressionAST *&node) { DEBUG_THIS_RULE(); - if (LA() == T_LPAREN) { + if (LA() == T_LPAREN) return parseExpressionListParen(node); - } else if (_cxx0xEnabled && LA() == T_LBRACE) { + else if (_cxx0xEnabled && LA() == T_LBRACE) return parseBracedInitList0x(node); - } return false; } @@ -5787,9 +5780,8 @@ bool Parser::parseObjCMethodDefinition(DeclarationAST *&node) // - (void) foo; { body; } // so a method is a forward declaration when it doesn't have a _body_. // However, we still need to read the semicolon. - if (LA() == T_SEMICOLON) { + if (LA() == T_SEMICOLON) ast->semicolon_token = consumeToken(); - } parseFunctionBody(ast->function_body); diff --git a/src/libs/3rdparty/cplusplus/Templates.cpp b/src/libs/3rdparty/cplusplus/Templates.cpp index 3cf6ff62be..fd1ee873d9 100644 --- a/src/libs/3rdparty/cplusplus/Templates.cpp +++ b/src/libs/3rdparty/cplusplus/Templates.cpp @@ -499,9 +499,8 @@ Symbol *Clone::instantiate(Template *templ, const FullySpecifiedType *const args if (argc < templ->templateParameterCount()) { for (unsigned i = argc; i < templ->templateParameterCount(); ++i) { Symbol *formal = templ->templateParameterAt(i); - if (TypenameArgument *tn = formal->asTypenameArgument()) { + if (TypenameArgument *tn = formal->asTypenameArgument()) subst.bind(name(formal->name(), &subst), type(tn->type(), &subst)); - } } } if (Symbol *inst = symbol(templ->declaration(), &subst)) { diff --git a/src/libs/cplusplus/CppDocument.cpp b/src/libs/cplusplus/CppDocument.cpp index c347e5f431..2069dd9dc3 100644 --- a/src/libs/cplusplus/CppDocument.cpp +++ b/src/libs/cplusplus/CppDocument.cpp @@ -89,9 +89,8 @@ protected: bool preVisit(Symbol *s) { if (s->asBlock()) { - if (s->line() < line || (s->line() == line && s->column() <= column)) { + if (s->line() < line || (s->line() == line && s->column() <= column)) return true; - } // skip blocks } if (s->line() < line || (s->line() == line && s->column() <= column)) { symbol = s; @@ -594,13 +593,12 @@ void Document::check(CheckMode mode) if (! _translationUnit->ast()) return; // nothing to do. - if (TranslationUnitAST *ast = _translationUnit->ast()->asTranslationUnit()) { + if (TranslationUnitAST *ast = _translationUnit->ast()->asTranslationUnit()) semantic(ast, _globalNamespace); - } else if (ExpressionAST *ast = _translationUnit->ast()->asExpression()) { + else if (ExpressionAST *ast = _translationUnit->ast()->asExpression()) semantic(ast, _globalNamespace); - } else if (DeclarationAST *ast = translationUnit()->ast()->asDeclaration()) { + else if (DeclarationAST *ast = translationUnit()->ast()->asDeclaration()) semantic(ast, _globalNamespace); - } } void Document::keepSourceAndAST() diff --git a/src/libs/cplusplus/CppRewriter.cpp b/src/libs/cplusplus/CppRewriter.cpp index f465c8ac10..2dee6ddc94 100644 --- a/src/libs/cplusplus/CppRewriter.cpp +++ b/src/libs/cplusplus/CppRewriter.cpp @@ -406,9 +406,8 @@ FullySpecifiedType UseMinimalNames::apply(const Name *name, Rewrite *rewrite) co const QList<LookupItem> results = context.lookup(name, scope); foreach (const LookupItem &r, results) { - if (Symbol *d = r.declaration()) { + if (Symbol *d = r.declaration()) return control->namedType(LookupContext::minimalName(d, _target, control)); - } return r.type(); } @@ -605,9 +604,8 @@ CPLUSPLUS_EXPORT QString simplifySTLType(const QString &typeIn) QRegExp mapRE2(QString::fromLatin1("map<const %1, ?%2, ?std::less<const %3>, ?%4\\s*>") .arg(keyEsc, valueEsc, keyEsc, allocEsc)); mapRE2.setMinimal(true); - if (mapRE2.indexIn(type) != -1) { + if (mapRE2.indexIn(type) != -1) type.replace(mapRE2.cap(0), QString::fromLatin1("map<const %1, %2>").arg(key, value)); - } } } } diff --git a/src/libs/cplusplus/Dumpers.cpp b/src/libs/cplusplus/Dumpers.cpp index 19774fcf37..5fbdd1ba93 100644 --- a/src/libs/cplusplus/Dumpers.cpp +++ b/src/libs/cplusplus/Dumpers.cpp @@ -83,18 +83,14 @@ QString CPlusPlus::toString(const Symbol *s, QString id) QString CPlusPlus::toString(LookupItem it, QString id) { QString result = QString::fromLatin1("%1:").arg(id); - if (it.declaration()) { + if (it.declaration()) result.append(QString::fromLatin1("\n%1").arg(indent(toString(it.declaration(), QLatin1String("Decl"))))); - } - if (it.type().isValid()) { + if (it.type().isValid()) result.append(QString::fromLatin1("\n%1").arg(indent(toString(it.type())))); - } - if (it.scope()) { + if (it.scope()) result.append(QString::fromLatin1("\n%1").arg(indent(toString(it.scope(), QLatin1String("Scope"))))); - } - if (it.binding()) { + if (it.binding()) result.append(QString::fromLatin1("\n%1").arg(indent(toString(it.binding(), QLatin1String("Binding"))))); - } return result; } @@ -106,9 +102,8 @@ QString CPlusPlus::toString(const ClassOrNamespace *binding, QString id) QString result = QString::fromLatin1("%0: %1 symbols").arg( id, QString::number(binding->symbols().length())); - if (binding->templateId()) { + if (binding->templateId()) result.append(QString::fromLatin1("\n%1").arg(indent(toString(binding->templateId(), QLatin1String("Template"))))); - } return result; } diff --git a/src/libs/cplusplus/ExpressionUnderCursor.cpp b/src/libs/cplusplus/ExpressionUnderCursor.cpp index 0c8af020ba..2923af09a3 100644 --- a/src/libs/cplusplus/ExpressionUnderCursor.cpp +++ b/src/libs/cplusplus/ExpressionUnderCursor.cpp @@ -98,11 +98,10 @@ int ExpressionUnderCursor::startOfExpression_helper(BackwardsScanner &tk, int in return index - 1; } else if (tk[index - 1].is(T_IDENTIFIER)) { if (tk[index - 2].is(T_TILDE)) { - if (tk[index - 3].is(T_COLON_COLON)) { + if (tk[index - 3].is(T_COLON_COLON)) return startOfExpression(tk, index - 3); - } else if (tk[index - 3].is(T_DOT) || tk[index - 3].is(T_ARROW)) { + else if (tk[index - 3].is(T_DOT) || tk[index - 3].is(T_ARROW)) return startOfExpression(tk, index - 3); - } return index - 2; } else if (tk[index - 2].is(T_COLON_COLON)) { return startOfExpression(tk, index - 1); diff --git a/src/libs/cplusplus/Icons.cpp b/src/libs/cplusplus/Icons.cpp index 653db7f59e..ef3f4f3109 100644 --- a/src/libs/cplusplus/Icons.cpp +++ b/src/libs/cplusplus/Icons.cpp @@ -88,13 +88,12 @@ Icons::IconType Icons::iconTypeForSymbol(const Symbol *symbol) function = symbol->type()->asFunctionType(); if (function->isSlot()) { - if (function->isPublic()) { + if (function->isPublic()) return SlotPublicIconType; - } else if (function->isProtected()) { + else if (function->isProtected()) return SlotProtectedIconType; - } else if (function->isPrivate()) { + else if (function->isPrivate()) return SlotPrivateIconType; - } } else if (function->isSignal()) { return SignalIconType; } else if (symbol->isPublic()) { @@ -107,13 +106,12 @@ Icons::IconType Icons::iconTypeForSymbol(const Symbol *symbol) } else if (symbol->enclosingScope() && symbol->enclosingScope()->isEnum()) { return EnumeratorIconType; } else if (symbol->isDeclaration() || symbol->isArgument()) { - if (symbol->isPublic()) { + if (symbol->isPublic()) return VarPublicIconType; - } else if (symbol->isProtected()) { + else if (symbol->isProtected()) return VarProtectedIconType; - } else if (symbol->isPrivate()) { + else if (symbol->isPrivate()) return VarPrivateIconType; - } } else if (symbol->isEnum()) { return EnumIconType; } else if (symbol->isClass() || symbol->isForwardClassDeclaration()) { diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp index 482c1c1a76..95399bc067 100644 --- a/src/libs/cplusplus/LookupContext.cpp +++ b/src/libs/cplusplus/LookupContext.cpp @@ -643,13 +643,11 @@ ClassOrNamespace *ClassOrNamespace::lookupType_helper(const Name *name, if (const QualifiedNameId *q = name->asQualifiedNameId()) { QSet<ClassOrNamespace *> innerProcessed; - if (! q->base()) { + if (! q->base()) return globalNamespace()->lookupType_helper(q->name(), &innerProcessed, true, origin); - } - if (ClassOrNamespace *binding = lookupType_helper(q->base(), processed, true, origin)) { + if (ClassOrNamespace *binding = lookupType_helper(q->base(), processed, true, origin)) return binding->lookupType_helper(q->name(), &innerProcessed, false, origin); - } return 0; @@ -966,9 +964,8 @@ bool ClassOrNamespace::NestedClassInstantiator::containsTemplateType(Declaration NamedType *memberNamedType = findMemberNamedType(memberType); if (memberNamedType) { const Name *name = memberNamedType->name(); - if (_subst.contains(name)) { + if (_subst.contains(name)) return true; - } } return false; } @@ -981,15 +978,12 @@ bool ClassOrNamespace::NestedClassInstantiator::containsTemplateType(Function * NamedType *ClassOrNamespace::NestedClassInstantiator::findMemberNamedType(Type *memberType) const { - if (NamedType *namedType = memberType->asNamedType()) { + if (NamedType *namedType = memberType->asNamedType()) return namedType; - } - else if (PointerType *pointerType = memberType->asPointerType()) { + else if (PointerType *pointerType = memberType->asPointerType()) return findMemberNamedType(pointerType->elementType().type()); - } - else if (ReferenceType *referenceType = memberType->asReferenceType()) { + else if (ReferenceType *referenceType = memberType->asReferenceType()) return findMemberNamedType(referenceType->elementType().type()); - } return 0; } diff --git a/src/libs/cplusplus/OverviewModel.cpp b/src/libs/cplusplus/OverviewModel.cpp index df537c3854..05017b4d06 100644 --- a/src/libs/cplusplus/OverviewModel.cpp +++ b/src/libs/cplusplus/OverviewModel.cpp @@ -123,9 +123,8 @@ int OverviewModel::rowCount(const QModelIndex &parent) const parentSymbol = templateParentSymbol; if (Scope *parentScope = parentSymbol->asScope()) { - if (!parentScope->isFunction() && !parentScope->isObjCMethod()) { + if (!parentScope->isFunction() && !parentScope->isObjCMethod()) return parentScope->memberCount(); - } } return 0; } diff --git a/src/libs/cplusplus/ResolveExpression.cpp b/src/libs/cplusplus/ResolveExpression.cpp index c44a974e9f..08ea8229c9 100644 --- a/src/libs/cplusplus/ResolveExpression.cpp +++ b/src/libs/cplusplus/ResolveExpression.cpp @@ -357,9 +357,8 @@ void ResolveExpression::thisObject() bool ResolveExpression::visit(CompoundExpressionAST *ast) { CompoundStatementAST *cStmt = ast->statement; - if (cStmt && cStmt->statement_list) { + if (cStmt && cStmt->statement_list) accept(cStmt->statement_list->lastValue()); - } return false; } diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp index 34fe56e53b..551cd6e37e 100644 --- a/src/libs/cplusplus/pp-engine.cpp +++ b/src/libs/cplusplus/pp-engine.cpp @@ -368,9 +368,8 @@ protected: env, client) != 0); ++(*_lex); - if ((*_lex)->is(T_RPAREN)) { + if ((*_lex)->is(T_RPAREN)) ++(*_lex); - } } } } else if ((*_lex)->is(T_IDENTIFIER)) { @@ -1539,9 +1538,8 @@ void Preprocessor::handleDefineDirective(PPToken *tk) } } } else if (macroReference) { - if (tk->is(T_LPAREN)) { + if (tk->is(T_LPAREN)) m_client->notifyMacroReference(previousOffset, previousLine, *macroReference); - } macroReference = 0; } diff --git a/src/libs/extensionsystem/optionsparser.cpp b/src/libs/extensionsystem/optionsparser.cpp index 529f1ff94f..8aa26f3ec5 100644 --- a/src/libs/extensionsystem/optionsparser.cpp +++ b/src/libs/extensionsystem/optionsparser.cpp @@ -174,9 +174,8 @@ bool OptionsParser::checkForPluginOption() if (!spec) return false; spec->addArgument(m_currentArg); - if (requiresParameter && nextToken(RequiredToken)) { + if (requiresParameter && nextToken(RequiredToken)) spec->addArgument(m_currentArg); - } return true; } diff --git a/src/libs/extensionsystem/pluginmanager.cpp b/src/libs/extensionsystem/pluginmanager.cpp index 7b229211e4..76a67eb935 100644 --- a/src/libs/extensionsystem/pluginmanager.cpp +++ b/src/libs/extensionsystem/pluginmanager.cpp @@ -335,9 +335,8 @@ bool PluginManager::hasError() { foreach (PluginSpec *spec, plugins()) { // only show errors on startup if plugin is enabled. - if (spec->hasError() && spec->isEnabled() && !spec->isDisabledIndirectly()) { + if (spec->hasError() && spec->isEnabled() && !spec->isDisabledIndirectly()) return true; - } } return false; } @@ -505,11 +504,10 @@ QString PluginManager::serializedArguments() foreach (const QString &argument, m_instance->d->arguments) { rc += separator; const QFileInfo fi(argument); - if (fi.exists() && fi.isRelative()) { + if (fi.exists() && fi.isRelative()) rc += fi.absoluteFilePath(); - } else { + else rc += argument; - } } } return rc; @@ -857,9 +855,8 @@ void PluginManagerPrivate::writeSettings() */ void PluginManagerPrivate::readSettings() { - if (globalSettings) { + if (globalSettings) defaultDisabledPlugins = globalSettings->value(QLatin1String(C_IGNORED_PLUGINS)).toStringList(); - } if (settings) { disabledPlugins = settings->value(QLatin1String(C_IGNORED_PLUGINS)).toStringList(); forceEnabledPlugins = settings->value(QLatin1String(C_FORCEENABLED_PLUGINS)).toStringList(); @@ -996,9 +993,8 @@ void PluginManagerPrivate::shutdown() shutdownEventLoop->exec(); } deleteAll(); - if (!allObjects.isEmpty()) { + if (!allObjects.isEmpty()) qDebug() << "There are" << allObjects.size() << "objects left in the plugin manager pool: " << allObjects; - } } /*! @@ -1270,11 +1266,10 @@ void PluginManagerPrivate::profilingReport(const char *what, const PluginSpec *s const int absoluteElapsedMS = m_profileTimer->elapsed(); const int elapsedMS = absoluteElapsedMS - m_profileElapsedMS; m_profileElapsedMS = absoluteElapsedMS; - if (spec) { + if (spec) qDebug("%-22s %-22s %8dms (%8dms)", what, qPrintable(spec->name()), absoluteElapsedMS, elapsedMS); - } else { + else qDebug("%-45s %8dms (%8dms)", what, absoluteElapsedMS, elapsedMS); - } } } diff --git a/src/libs/extensionsystem/pluginspec.cpp b/src/libs/extensionsystem/pluginspec.cpp index d32b7c8bbf..3eb3c9389c 100644 --- a/src/libs/extensionsystem/pluginspec.cpp +++ b/src/libs/extensionsystem/pluginspec.cpp @@ -667,11 +667,10 @@ void PluginSpecPrivate::readArgumentDescriptions(QXmlStreamReader &reader) switch (reader.tokenType()) { case QXmlStreamReader::StartElement: element = reader.name().toString(); - if (element == QLatin1String(ARGUMENT)) { + if (element == QLatin1String(ARGUMENT)) readArgumentDescription(reader); - } else { + else reader.raiseError(msgInvalidElement(name)); - } break; case QXmlStreamReader::Comment: case QXmlStreamReader::Characters: @@ -720,11 +719,10 @@ void PluginSpecPrivate::readDependencies(QXmlStreamReader &reader) switch (reader.tokenType()) { case QXmlStreamReader::StartElement: element = reader.name().toString(); - if (element == QLatin1String(DEPENDENCY)) { + if (element == QLatin1String(DEPENDENCY)) readDependencyEntry(reader); - } else { + else reader.raiseError(msgInvalidElement(name)); - } break; case QXmlStreamReader::Comment: case QXmlStreamReader::Characters: @@ -1019,9 +1017,8 @@ bool PluginSpecPrivate::delayedInitialize() { if (hasError) return false; - if (state != PluginSpec::Running) { + if (state != PluginSpec::Running) return false; - } if (!plugin) { errorString = QCoreApplication::translate("PluginSpec", "Internal error: have no plugin instance to perform delayedInitialize"); hasError = true; diff --git a/src/libs/glsl/glslsemantic.cpp b/src/libs/glsl/glslsemantic.cpp index 5bb9861168..894cd35a91 100644 --- a/src/libs/glsl/glslsemantic.cpp +++ b/src/libs/glsl/glslsemantic.cpp @@ -184,11 +184,10 @@ bool Semantic::visit(StructTypeAST::Field *ast) bool Semantic::visit(IdentifierExpressionAST *ast) { if (ast->name) { - if (Symbol *s = _scope->lookup(*ast->name)) { + if (Symbol *s = _scope->lookup(*ast->name)) _expr.type = s->type(); - } else { + else _engine->error(ast->lineno, QString::fromLatin1("`%1' was not declared in this scope").arg(*ast->name)); - } } return false; } @@ -291,17 +290,15 @@ bool Semantic::visit(MemberAccessExpressionAST *ast) ExprResult expr = expression(ast->expr); if (expr.type && ast->field) { if (const VectorType *vecTy = expr.type->asVectorType()) { - if (Symbol *s = vecTy->find(*ast->field)) { + if (Symbol *s = vecTy->find(*ast->field)) _expr.type = s->type(); - } else { + else _engine->error(ast->lineno, QString::fromLatin1("`%1' has no member named `%2'").arg(vecTy->name()).arg(*ast->field)); - } } else if (const Struct *structTy = expr.type->asStructType()) { - if (Symbol *s = structTy->find(*ast->field)) { + if (Symbol *s = structTy->find(*ast->field)) _expr.type = s->type(); - } else { + else _engine->error(ast->lineno, QString::fromLatin1("`%1' has no member named `%2'").arg(structTy->name()).arg(*ast->field)); - } } else { _engine->error(ast->lineno, QString::fromLatin1("Requested for member `%1', in a non class or vec instance").arg(*ast->field)); } diff --git a/src/libs/qmldebug/declarativetoolsclient.cpp b/src/libs/qmldebug/declarativetoolsclient.cpp index 91b409a01a..b45f42f20f 100644 --- a/src/libs/qmldebug/declarativetoolsclient.cpp +++ b/src/libs/qmldebug/declarativetoolsclient.cpp @@ -173,13 +173,12 @@ void DeclarativeToolsClient::messageReceived(const QByteArray &message) log(LogReceive, type, QString::number(toolId)); - if (toolId == Constants::ZoomMode) { + if (toolId == Constants::ZoomMode) emit zoomToolActivated(); - } else if (toolId == Constants::SelectionToolMode) { + else if (toolId == Constants::SelectionToolMode) emit selectToolActivated(); - } else if (toolId == Constants::MarqueeSelectionToolMode) { + else if (toolId == Constants::MarqueeSelectionToolMode) emit selectMarqueeToolActivated(); - } break; } case InspectorProtocol::AnimationSpeedChanged: { diff --git a/src/libs/qmldebug/qmldebugclient.cpp b/src/libs/qmldebug/qmldebugclient.cpp index 86d6efcbe8..91934360b1 100644 --- a/src/libs/qmldebug/qmldebugclient.cpp +++ b/src/libs/qmldebug/qmldebugclient.cpp @@ -203,11 +203,10 @@ void QmlDebugConnectionPrivate::readyRead() QHash<QString, QmlDebugClient *>::Iterator iter = plugins.find(name); - if (iter == plugins.end()) { + if (iter == plugins.end()) qWarning() << "QML Debug Client: Message received for missing plugin" << name; - } else { + else (*iter)->messageReceived(message); - } } } } diff --git a/src/libs/qmldebug/qmlprofilertraceclient.cpp b/src/libs/qmldebug/qmlprofilertraceclient.cpp index 3e137c2772..506abf0779 100644 --- a/src/libs/qmldebug/qmlprofilertraceclient.cpp +++ b/src/libs/qmldebug/qmlprofilertraceclient.cpp @@ -118,9 +118,8 @@ void QmlProfilerTraceClient::setRecording(bool v) d->recording = v; - if (status() == Enabled) { + if (status() == Enabled) sendRecordingStatus(); - } emit recordingChanged(v); } @@ -225,9 +224,8 @@ void QmlProfilerTraceClient::messageReceived(const QByteArray &data) if (!stream.atEnd()) stream >> column; - if (d->rangeCount[range] > 0) { + if (d->rangeCount[range] > 0) d->rangeLocations[range].push(QmlEventLocation(fileName, line, column)); - } } else { if (d->rangeCount[range] > 0) { --d->rangeCount[range]; diff --git a/src/libs/qmldebug/qv8profilerclient.cpp b/src/libs/qmldebug/qv8profilerclient.cpp index f8bb734412..4e9af90cb4 100644 --- a/src/libs/qmldebug/qv8profilerclient.cpp +++ b/src/libs/qmldebug/qv8profilerclient.cpp @@ -57,11 +57,10 @@ void QV8ProfilerClientPrivate::sendRecordingStatus() QByteArray option(""); QByteArray title(""); - if (recording) { + if (recording) option = "start"; - } else { + else option = "stop"; - } stream << cmd << option << title; q->sendMessage(ba); } @@ -108,9 +107,8 @@ void QV8ProfilerClient::setRecording(bool v) d->recording = v; - if (status() == Enabled) { + if (status() == Enabled) sendRecordingStatus(); - } emit recordingChanged(v); } diff --git a/src/libs/qmleditorwidgets/contextpanetextwidget.cpp b/src/libs/qmleditorwidgets/contextpanetextwidget.cpp index ffd700ceeb..74427d7a55 100644 --- a/src/libs/qmleditorwidgets/contextpanetextwidget.cpp +++ b/src/libs/qmleditorwidgets/contextpanetextwidget.cpp @@ -169,17 +169,15 @@ void ContextPaneTextWidget::setProperties(QmlJS::PropertyReader *propertyReader) ui->strikeoutButton->setChecked(false); } - if (propertyReader->hasProperty(QLatin1String("color"))) { + if (propertyReader->hasProperty(QLatin1String("color"))) ui->colorButton->setColor(propertyReader->readProperty(QLatin1String("color")).toString()); - } else { + else ui->colorButton->setColor(QLatin1String("black")); - } - if (propertyReader->hasProperty(QLatin1String("styleColor"))) { + if (propertyReader->hasProperty(QLatin1String("styleColor"))) ui->textColorButton->setColor(propertyReader->readProperty(QLatin1String("styleColor")).toString()); - } else { + else ui->textColorButton->setColor(QLatin1String("black")); - } if (propertyReader->hasProperty(QLatin1String("font.family"))) { QString familyName = propertyReader->readProperty(QLatin1String("font.family")).toString(); @@ -310,11 +308,10 @@ void ContextPaneTextWidget::onFontSizeChanged(int) void ContextPaneTextWidget::onFontFormatChanged() { int size = ui->fontSizeSpinBox->value(); - if (ui->fontSizeSpinBox->isPointSize()) { + if (ui->fontSizeSpinBox->isPointSize()) emit removeAndChangeProperty(QLatin1String("font.pixelSize"), QLatin1String("font.pointSize"), size, true); - } else { + else emit removeAndChangeProperty(QLatin1String("font.pointSize"), QLatin1String("font.pixelSize"), size, true); - } } diff --git a/src/libs/qmleditorwidgets/contextpanewidgetrectangle.cpp b/src/libs/qmleditorwidgets/contextpanewidgetrectangle.cpp index ee9c4fbac5..8afbdaedfc 100644 --- a/src/libs/qmleditorwidgets/contextpanewidgetrectangle.cpp +++ b/src/libs/qmleditorwidgets/contextpanewidgetrectangle.cpp @@ -231,9 +231,8 @@ void ContextPaneWidgetRectangle::onBorderNoneClicked() void ContextPaneWidgetRectangle::onBorderSolidClicked() { - if (ui->borderSolid->isChecked()) { + if (ui->borderSolid->isChecked()) emit propertyChanged(QLatin1String("border.color"), QLatin1String("\"black\"")); - } } void ContextPaneWidgetRectangle::onGradientLineDoubleClicked(const QPoint &p) diff --git a/src/libs/qmljs/qmljscheck.cpp b/src/libs/qmljs/qmljscheck.cpp index b5eeb9fa70..06a1eef1f6 100644 --- a/src/libs/qmljs/qmljscheck.cpp +++ b/src/libs/qmljs/qmljscheck.cpp @@ -82,9 +82,8 @@ public: if (StringLiteral *stringLiteral = cast<StringLiteral *>(_ast)) { const QString valueName = stringLiteral->value.toString(); - if (!enumValue->keys().contains(valueName)) { + if (!enumValue->keys().contains(valueName)) setMessage(ErrInvalidEnumValue); - } } else if (! _rhsValue->asStringValue() && ! _rhsValue->asNumberValue() && ! _rhsValue->asUnknownValue()) { setMessage(ErrEnumValueMustBeStringOrNumber); @@ -131,9 +130,8 @@ public: fileName.prepend(QDir::separator()); fileName.prepend(_doc->path()); } - if (!QFileInfo(fileName).exists()) { + if (!QFileInfo(fileName).exists()) setMessage(WarnFileOrDirectoryDoesNotExist); - } } } } @@ -421,9 +419,8 @@ protected: bool visit(VariableStatement *ast) { - if (_seenNonDeclarationStatement) { + if (_seenNonDeclarationStatement) addMessage(HintDeclarationsShouldBeAtStartOfFunction, ast->declarationKindToken); - } return true; } @@ -433,13 +430,12 @@ protected: return true; const QString &name = ast->name.toString(); - if (_formalParameterNames.contains(name)) { + if (_formalParameterNames.contains(name)) addMessage(WarnAlreadyFormalParameter, ast->identifierToken, name); - } else if (_declaredFunctions.contains(name)) { + else if (_declaredFunctions.contains(name)) addMessage(WarnAlreadyFunction, ast->identifierToken, name); - } else if (_declaredVariables.contains(name)) { + else if (_declaredVariables.contains(name)) addMessage(WarnDuplicateDeclaration, ast->identifierToken, name); - } if (_possiblyUndeclaredUses.contains(name)) { foreach (const SourceLocation &loc, _possiblyUndeclaredUses.value(name)) { @@ -454,9 +450,8 @@ protected: bool visit(FunctionDeclaration *ast) { - if (_seenNonDeclarationStatement) { + if (_seenNonDeclarationStatement) addMessage(HintDeclarationsShouldBeAtStartOfFunction, ast->functionToken); - } return visit(static_cast<FunctionExpression *>(ast)); } @@ -467,13 +462,12 @@ protected: return false; const QString &name = ast->name.toString(); - if (_formalParameterNames.contains(name)) { + if (_formalParameterNames.contains(name)) addMessage(WarnAlreadyFormalParameter, ast->identifierToken, name); - } else if (_declaredVariables.contains(name)) { + else if (_declaredVariables.contains(name)) addMessage(WarnAlreadyVar, ast->identifierToken, name); - } else if (_declaredFunctions.contains(name)) { + else if (_declaredFunctions.contains(name)) addMessage(WarnDuplicateDeclaration, ast->identifierToken, name); - } if (FunctionDeclaration *decl = cast<FunctionDeclaration *>(ast)) { if (_possiblyUndeclaredUses.contains(name)) { @@ -642,9 +636,8 @@ void Check::checkProperty(UiQualifiedId *qualifiedId) { const QString id = toString(qualifiedId); if (id.at(0).isLower()) { - if (m_propertyStack.top().contains(id)) { + if (m_propertyStack.top().contains(id)) addMessage(ErrPropertiesCanOnlyHaveOneBinding, fullLocationForQualifiedId(qualifiedId)); - } m_propertyStack.top().insert(id); } } @@ -1155,9 +1148,8 @@ bool Check::visit(ExpressionStatement *ast) default: break; } } - if (!ok) { + if (!ok) ok = _inStatementBinding; - } if (!ok) { addMessage(WarnConfusingExpressionStatement, @@ -1242,9 +1234,8 @@ void Check::checkNewExpression(ExpressionNode *ast) const QString name = functionName(ast, &location); if (name.isEmpty()) return; - if (!name.at(0).isUpper()) { + if (!name.at(0).isUpper()) addMessage(WarnNewWithLowercaseFunction, location); - } } void Check::checkBindingRhs(Statement *statement) @@ -1261,9 +1252,8 @@ void Check::checkBindingRhs(Statement *statement) void Check::checkExtraParentheses(ExpressionNode *expression) { - if (NestedExpression *nested = cast<NestedExpression *>(expression)) { + if (NestedExpression *nested = cast<NestedExpression *>(expression)) addMessage(HintExtraParentheses, nested->lparenToken); - } } void Check::addMessages(const QList<Message> &messages) @@ -1311,9 +1301,8 @@ void Check::scanCommentsForAnnotations() const QString &comment = _doc->source().mid(commentLoc.begin(), commentLoc.length); // enable all checks annotation - if (comment.contains(QLatin1String("@enable-all-checks"))) { + if (comment.contains(QLatin1String("@enable-all-checks"))) _enabledMessages = Message::allMessageTypes().toSet(); - } // find all disable annotations int lastOffset = -1; diff --git a/src/libs/qmljs/qmljscodeformatter.cpp b/src/libs/qmljs/qmljscodeformatter.cpp index ade21c8787..40adb9a662 100644 --- a/src/libs/qmljs/qmljscodeformatter.cpp +++ b/src/libs/qmljs/qmljscodeformatter.cpp @@ -833,11 +833,10 @@ int CodeFormatter::column(int index) const const QChar tab = QLatin1Char('\t'); for (int i = 0; i < index; i++) { - if (m_currentLine[i] == tab) { + if (m_currentLine[i] == tab) col = ((col / m_tabSize) + 1) * m_tabSize; - } else { + else col++; - } } return col; } @@ -1318,9 +1317,8 @@ void QtStyleCodeFormatter::adjustIndent(const QList<Token> &tokens, int startLex break; case Colon: - if (topState.type == ternary_op) { + if (topState.type == ternary_op) *indentDepth -= 2; - } break; case Question: diff --git a/src/libs/qmljs/qmljscompletioncontextfinder.cpp b/src/libs/qmljs/qmljscompletioncontextfinder.cpp index dde5a34a2c..c130bf1bfd 100644 --- a/src/libs/qmljs/qmljscompletioncontextfinder.cpp +++ b/src/libs/qmljs/qmljscompletioncontextfinder.cpp @@ -238,9 +238,8 @@ void CompletionContextFinder::checkImport() break; } } else if (tokenString == QLatin1String("import")) { - if (state == Unknown || (state & ExpectImport)) { + if (state == Unknown || (state & ExpectImport)) m_inImport = true; - } } else { if (state == Unknown || (state & ExpectAnyTarget) || (state & ExpectTargetIdentifier)) { diff --git a/src/libs/qmljs/qmljsdelta.cpp b/src/libs/qmljs/qmljsdelta.cpp index 3b5f03a1c8..f04825f6fb 100644 --- a/src/libs/qmljs/qmljsdelta.cpp +++ b/src/libs/qmljs/qmljsdelta.cpp @@ -61,9 +61,8 @@ private: bool BuildParentHash::preVisit(Node* ast) { - if (ast->uiObjectMemberCast()) { + if (ast->uiObjectMemberCast()) stack.append(ast->uiObjectMemberCast()); - } return true; } @@ -71,9 +70,8 @@ void BuildParentHash::postVisit(Node* ast) { if (ast->uiObjectMemberCast()) { stack.removeLast(); - if (!stack.isEmpty()) { + if (!stack.isEmpty()) parent.insert(ast->uiObjectMemberCast(), stack.last()); - } } } @@ -291,9 +289,8 @@ static QString _propertyName(UiQualifiedId *id) static QString _methodName(UiSourceElement *source) { if (source) { - if (FunctionDeclaration *declaration = cast<FunctionDeclaration*>(source->sourceElement)) { + if (FunctionDeclaration *declaration = cast<FunctionDeclaration*>(source->sourceElement)) return declaration->name.toString(); - } } return QString(); } @@ -415,9 +412,8 @@ void Delta::update(UiObjectMember* oldObject, const QmlJS::Document::Ptr& oldDoc const QString scriptCode = _scriptCode(script, newDoc); UiScriptBinding *previousScript = cast<UiScriptBinding *>(oldMember); if (!previousScript || _scriptCode(previousScript, oldDoc) != scriptCode) { - if (debugReferences.count()==0) { + if (debugReferences.count()==0) notifyUnsyncronizableElementChange(newObject); - } foreach (DebugId ref, debugReferences) { if (ref != -1) updateScriptBinding(ref, newObject, script, property, scriptCode); @@ -429,9 +425,8 @@ void Delta::update(UiObjectMember* oldObject, const QmlJS::Document::Ptr& oldDoc UiSourceElement *previousSource = cast<UiSourceElement*>(oldMember); if (!previousSource || _methodCode(previousSource, oldDoc) != methodCode) { - if (debugReferences.count()==0) { + if (debugReferences.count()==0) notifyUnsyncronizableElementChange(newObject); - } foreach (DebugId ref, debugReferences) { if (ref != -1) updateMethodBody(ref, newObject, script, methodName, methodCode); diff --git a/src/libs/qmljs/qmljsdocument.cpp b/src/libs/qmljs/qmljsdocument.cpp index bfc00b8640..a8698aaf1f 100644 --- a/src/libs/qmljs/qmljsdocument.cpp +++ b/src/libs/qmljs/qmljsdocument.cpp @@ -378,9 +378,8 @@ Document::MutablePtr Snapshot::documentFromSource( { Document::MutablePtr newDoc = Document::create(fileName, language); - if (Document::Ptr thisDocument = document(fileName)) { + if (Document::Ptr thisDocument = document(fileName)) newDoc->_editorRevision = thisDocument->_editorRevision; - } newDoc->setSource(code); return newDoc; diff --git a/src/libs/qmljs/qmljsevaluate.cpp b/src/libs/qmljs/qmljsevaluate.cpp index ff3f40e662..b3ae26b649 100644 --- a/src/libs/qmljs/qmljsevaluate.cpp +++ b/src/libs/qmljs/qmljsevaluate.cpp @@ -318,9 +318,8 @@ bool Evaluate::visit(AST::FieldMemberExpression *ast) return false; if (const Value *base = _valueOwner->convertToObject(value(ast->base))) { - if (const ObjectValue *obj = base->asObjectValue()) { + if (const ObjectValue *obj = base->asObjectValue()) _result = obj->lookupMember(ast->name.toString(), _context); - } } return false; @@ -328,26 +327,23 @@ bool Evaluate::visit(AST::FieldMemberExpression *ast) bool Evaluate::visit(AST::NewMemberExpression *ast) { - if (const FunctionValue *ctor = value_cast<FunctionValue>(value(ast->base))) { + if (const FunctionValue *ctor = value_cast<FunctionValue>(value(ast->base))) _result = ctor->returnValue(); - } return false; } bool Evaluate::visit(AST::NewExpression *ast) { - if (const FunctionValue *ctor = value_cast<FunctionValue>(value(ast->expression))) { + if (const FunctionValue *ctor = value_cast<FunctionValue>(value(ast->expression))) _result = ctor->returnValue(); - } return false; } bool Evaluate::visit(AST::CallExpression *ast) { if (const Value *base = value(ast->base)) { - if (const FunctionValue *obj = base->asFunctionValue()) { + if (const FunctionValue *obj = base->asFunctionValue()) _result = obj->returnValue(); - } } return false; } diff --git a/src/libs/qmljs/qmljsicons.cpp b/src/libs/qmljs/qmljsicons.cpp index 258fbcb064..67c3e55aa6 100644 --- a/src/libs/qmljs/qmljsicons.cpp +++ b/src/libs/qmljs/qmljsicons.cpp @@ -119,12 +119,10 @@ QIcon Icons::icon(const QString &packageName, const QString typeName) const QIcon Icons::icon(Node *node) const { - if (dynamic_cast<AST::UiObjectDefinition*>(node)) { + if (dynamic_cast<AST::UiObjectDefinition*>(node)) return objectDefinitionIcon(); - } - if (dynamic_cast<AST::UiScriptBinding*>(node)) { + if (dynamic_cast<AST::UiScriptBinding*>(node)) return scriptBindingIcon(); - } return QIcon(); } diff --git a/src/libs/qmljs/qmljsindenter.cpp b/src/libs/qmljs/qmljsindenter.cpp index 103e70fc26..5f5c7e076d 100644 --- a/src/libs/qmljs/qmljsindenter.cpp +++ b/src/libs/qmljs/qmljsindenter.cpp @@ -147,11 +147,10 @@ int QmlJSIndenter::columnForIndex(const QString &t, int index) const index = t.length(); for (int i = 0; i < index; i++) { - if (t.at(i) == QLatin1Char('\t')) { + if (t.at(i) == QLatin1Char('\t')) col = ((col / ppHardwareTabSize) + 1) * ppHardwareTabSize; - } else { + else col++; - } } return col; } @@ -288,11 +287,10 @@ int QmlJSIndenter::indentForContinuationLine() delimiters. */ if (braceDepth == -1) { - if (j < yyLine->length() - 1) { + if (j < yyLine->length() - 1) hook = j; - } else { + else return 0; // shouldn't happen - } } break; case '=': @@ -587,17 +585,15 @@ int QmlJSIndenter::indentForBottomLine(QTextBlock begin, QTextBlock end, QChar t smartly, unless the user has already played around with it, in which case it's better to leave her stuff alone. */ - if (isOnlyWhiteSpace(bottomLine)) { + if (isOnlyWhiteSpace(bottomLine)) indent = indentWhenBottomLineStartsInMultiLineComment(); - } else { + else indent = indentOfLine(bottomLine); - } } else { - if (isUnfinishedLine()) { + if (isUnfinishedLine()) indent = indentForContinuationLine(); - } else { + else indent = indentForStandaloneLine(); - } if ((okay(typedIn, QLatin1Char('}')) && firstCh == QLatin1Char('}')) || (okay(typedIn, QLatin1Char(']')) && firstCh == QLatin1Char(']'))) { diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index 8851995b98..50b9f128fd 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -357,9 +357,8 @@ const Value *CppComponentValue::valueForCppName(const QString &typeName) const // might be an enum const CppComponentValue *base = this; const QStringList components = typeName.split(QLatin1String("::")); - if (components.size() == 2) { + if (components.size() == 2) base = valueOwner()->cppQmlTypes().objectByCppName(components.first()); - } if (base) { if (const QmlEnumValue *value = base->getEnumValue(components.last())) return value; @@ -413,9 +412,8 @@ QString CppComponentValue::propertyType(const QString &propertyName) const foreach (const CppComponentValue *it, prototypes()) { FakeMetaObject::ConstPtr iter = it->_metaObject; int propIdx = iter->propertyIndex(propertyName); - if (propIdx != -1) { + if (propIdx != -1) return iter->property(propIdx).typeName(); - } } return QString(); } @@ -425,9 +423,8 @@ bool CppComponentValue::isListProperty(const QString &propertyName) const foreach (const CppComponentValue *it, prototypes()) { FakeMetaObject::ConstPtr iter = it->_metaObject; int propIdx = iter->propertyIndex(propertyName); - if (propIdx != -1) { + if (propIdx != -1) return iter->property(propIdx).isList(); - } } return false; } @@ -510,9 +507,8 @@ bool CppComponentValue::isWritable(const QString &propertyName) const foreach (const CppComponentValue *it, prototypes()) { FakeMetaObject::ConstPtr iter = it->_metaObject; int propIdx = iter->propertyIndex(propertyName); - if (propIdx != -1) { + if (propIdx != -1) return iter->property(propIdx).isWritable(); - } } return false; } @@ -522,9 +518,8 @@ bool CppComponentValue::isPointer(const QString &propertyName) const foreach (const CppComponentValue *it, prototypes()) { FakeMetaObject::ConstPtr iter = it->_metaObject; int propIdx = iter->propertyIndex(propertyName); - if (propIdx != -1) { + if (propIdx != -1) return iter->property(propIdx).isPointer(); - } } return false; } @@ -542,9 +537,8 @@ bool CppComponentValue::hasProperty(const QString &propertyName) const foreach (const CppComponentValue *it, prototypes()) { FakeMetaObject::ConstPtr iter = it->_metaObject; int propIdx = iter->propertyIndex(propertyName); - if (propIdx != -1) { + if (propIdx != -1) return true; - } } return false; } @@ -956,9 +950,8 @@ const ObjectValue *ObjectValue::prototype(const Context *context) const { const ObjectValue *prototypeObject = value_cast<ObjectValue>(_prototype); if (! prototypeObject) { - if (const Reference *prototypeReference = value_cast<Reference>(_prototype)) { + if (const Reference *prototypeReference = value_cast<Reference>(_prototype)) prototypeObject = value_cast<ObjectValue>(context->lookupReference(prototypeReference)); - } } return prototypeObject; } @@ -1110,9 +1103,8 @@ const ObjectValue *PrototypeIterator::next() const ObjectValue *PrototypeIterator::peekNext() { - if (hasNext()) { + if (hasNext()) return m_next; - } return 0; } @@ -1299,11 +1291,10 @@ void CppQmlTypesLoader::parseQmlTypeDescriptions(const QByteArray &xml, warningMessage->clear(); TypeDescriptionReader reader(QString::fromUtf8(xml)); if (!reader(newObjects, newModuleApis)) { - if (reader.errorMessage().isEmpty()) { + if (reader.errorMessage().isEmpty()) *errorMessage = QLatin1String("unknown error"); - } else { + else *errorMessage = reader.errorMessage(); - } } *warningMessage = reader.warningMessage(); } @@ -2106,18 +2097,16 @@ ImportInfo ImportInfo::pathImport(const QString &docPath, const QString &path, info._name = path; QFileInfo importFileInfo(path); - if (!importFileInfo.isAbsolute()) { + if (!importFileInfo.isAbsolute()) importFileInfo = QFileInfo(docPath + QDir::separator() + path); - } info._path = importFileInfo.absoluteFilePath(); - if (importFileInfo.isFile()) { + if (importFileInfo.isFile()) info._type = FileImport; - } else if (importFileInfo.isDir()) { + else if (importFileInfo.isDir()) info._type = DirectoryImport; - } else { + else info._type = UnknownFileImport; - } info._version = version; info._as = as; @@ -2230,11 +2219,10 @@ void TypeScope::processMembers(MemberProcessor *processor) const if (info.type() == ImportInfo::FileImport) continue; - if (!info.as().isEmpty()) { + if (!info.as().isEmpty()) processor->processProperty(info.as(), import); - } else { + else import->processMembers(processor); - } } } diff --git a/src/libs/qmljs/qmljslineinfo.cpp b/src/libs/qmljs/qmljslineinfo.cpp index 54e67eeb2a..d2f4cbd5d9 100644 --- a/src/libs/qmljs/qmljslineinfo.cpp +++ b/src/libs/qmljs/qmljslineinfo.cpp @@ -205,11 +205,10 @@ QString LineInfo::trimmedCodeLine(const QString &t) while (i >= 2) { const Token &prev = yyLinizerState.tokens.at(i-1); const Token &prevPrev = yyLinizerState.tokens.at(i-2); - if (prev.kind == Token::Dot && prevPrev.kind == Token::Identifier) { + if (prev.kind == Token::Dot && prevPrev.kind == Token::Identifier) i -= 2; - } else { + else break; - } } // it could also be 'a = \n Foo \n {', but that sounds unlikely diff --git a/src/libs/qmljs/qmljslink.cpp b/src/libs/qmljs/qmljslink.cpp index 4cd0af17c9..6f13457b04 100644 --- a/src/libs/qmljs/qmljslink.cpp +++ b/src/libs/qmljs/qmljslink.cpp @@ -460,11 +460,10 @@ bool LinkPrivate::importLibrary(Document::Ptr doc, // all but no-uri module apis become available for import QList<ModuleApiInfo> noUriModuleApis; foreach (const ModuleApiInfo &moduleApi, libraryInfo.moduleApis()) { - if (moduleApi.uri.isEmpty()) { + if (moduleApi.uri.isEmpty()) noUriModuleApis += moduleApi; - } else { + else importableModuleApis[moduleApi.uri] += moduleApi; - } } // if a module api has no uri, it shares the same name @@ -501,9 +500,8 @@ void LinkPrivate::loadQmldirComponents(ObjectValue *import, ComponentVersion ver const LibraryInfo &libraryInfo, const QString &libraryPath) { // if the version isn't valid, import the latest - if (!version.isValid()) { + if (!version.isValid()) version = ComponentVersion(ComponentVersion::MaxVersion, ComponentVersion::MaxVersion); - } QSet<QString> importedTypes; @@ -535,9 +533,8 @@ void LinkPrivate::loadImplicitDirectoryImports(Imports *imports, Document::Ptr d if (directoryImport.object) importCache.insert(ImportCacheKey(implcitDirectoryImportInfo), directoryImport); } - if (directoryImport.object) { + if (directoryImport.object) imports->append(directoryImport); - } } void LinkPrivate::loadImplicitDefaultImports(Imports *imports) diff --git a/src/libs/qmljs/qmljspropertyreader.cpp b/src/libs/qmljs/qmljspropertyreader.cpp index 2aa4bc298d..3fb5293008 100644 --- a/src/libs/qmljs/qmljspropertyreader.cpp +++ b/src/libs/qmljs/qmljspropertyreader.cpp @@ -143,9 +143,8 @@ static bool isEnum(AST::Statement *ast) if (!ast) return false; - if (ExpressionStatement *exprStmt = cast<ExpressionStatement*>(ast)) { + if (ExpressionStatement *exprStmt = cast<ExpressionStatement*>(ast)) return isEnum(exprStmt->expression); - } return false; } diff --git a/src/libs/qmljs/qmljsreformatter.cpp b/src/libs/qmljs/qmljsreformatter.cpp index bc7b78ab61..eb30eca766 100644 --- a/src/libs/qmljs/qmljsreformatter.cpp +++ b/src/libs/qmljs/qmljsreformatter.cpp @@ -166,11 +166,10 @@ protected: if (precededByEmptyLine(fixedLoc)) newLine(); out(toString(fixedLoc)); // don't use the sourceloc overload here - if (followedByNewLine(fixedLoc)) { + if (followedByNewLine(fixedLoc)) newLine(); - } else { + else out(" "); - } } void out(const QString &str, const SourceLocation &lastLoc = SourceLocation()) @@ -260,9 +259,8 @@ 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) { result += 3 + (line.size() - maxLineLength); @@ -446,22 +444,20 @@ protected: virtual bool preVisit(Node *ast) { SourceLocation firstLoc; - if (ExpressionNode *expr = ast->expressionCast()) { + if (ExpressionNode *expr = ast->expressionCast()) firstLoc = expr->firstSourceLocation(); - } else if (Statement *stmt = ast->statementCast()) { + else if (Statement *stmt = ast->statementCast()) firstLoc = stmt->firstSourceLocation(); - } else if (UiObjectMember *mem = ast->uiObjectMemberCast()) { + else if (UiObjectMember *mem = ast->uiObjectMemberCast()) firstLoc = mem->firstSourceLocation(); - } else if (UiImport *import = cast<UiImport *>(ast)) { + else if (UiImport *import = cast<UiImport *>(ast)) firstLoc = import->firstSourceLocation(); - } if (firstLoc.isValid() && int(firstLoc.offset) != _lastNewlineOffset) { _lastNewlineOffset = firstLoc.offset; - if (precededByEmptyLine(firstLoc) && !_result.endsWith(QLatin1String("\n\n"))) { + if (precededByEmptyLine(firstLoc) && !_result.endsWith(QLatin1String("\n\n"))) newLine(); - } } return true; @@ -470,15 +466,14 @@ protected: virtual void postVisit(Node *ast) { SourceLocation lastLoc; - if (ExpressionNode *expr = ast->expressionCast()) { + if (ExpressionNode *expr = ast->expressionCast()) lastLoc = expr->lastSourceLocation(); - } else if (Statement *stmt = ast->statementCast()) { + else if (Statement *stmt = ast->statementCast()) lastLoc = stmt->lastSourceLocation(); - } else if (UiObjectMember *mem = ast->uiObjectMemberCast()) { + else if (UiObjectMember *mem = ast->uiObjectMemberCast()) lastLoc = mem->lastSourceLocation(); - } else if (UiImport *import = cast<UiImport *>(ast)) { + else if (UiImport *import = cast<UiImport *>(ast)) lastLoc = import->lastSourceLocation(); - } if (lastLoc.isValid()) { const QList<SourceLocation> &comments = _doc->engine()->comments(); @@ -510,11 +505,10 @@ protected: virtual bool visit(UiImport *ast) { out("import ", ast->importToken); - if (!ast->fileName.isNull()) { + if (!ast->fileName.isNull()) out(QString::fromLatin1("\"%1\"").arg(ast->fileName.toString())); - } else { + else accept(ast->importUri); - } if (ast->versionToken.isValid()) { out(" "); out(ast->versionToken); diff --git a/src/libs/qmljs/qmljsrewriter.cpp b/src/libs/qmljs/qmljsrewriter.cpp index 013786057a..7822c7721b 100644 --- a/src/libs/qmljs/qmljsrewriter.cpp +++ b/src/libs/qmljs/qmljsrewriter.cpp @@ -288,9 +288,8 @@ void Rewriter::changeBinding(UiObjectInitializer *ast, // for grouped properties: else if (!prefix.isEmpty()) { if (UiObjectDefinition *def = cast<UiObjectDefinition *>(member)) { - if (toString(def->qualifiedTypeNameId) == prefix) { + if (toString(def->qualifiedTypeNameId) == prefix) changeBinding(def->initializer, suffix, newValue, binding); - } } } } @@ -353,11 +352,10 @@ bool Rewriter::isMatchingPropertyMember(const QString &propertyName, bool Rewriter::nextMemberOnSameLine(UiObjectMemberList *members) { - if (members && members->next && members->next->member) { + if (members && members->next && members->next->member) return members->next->member->firstSourceLocation().startLine == members->member->lastSourceLocation().startLine; - } else { + else return false; - } } void Rewriter::insertIntoArray(UiArrayBinding *ast, const QString &newValue) @@ -388,15 +386,13 @@ 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()) { if (UiObjectDefinition *def = cast<UiObjectDefinition *>(member)) { - if (toString(def->qualifiedTypeNameId) == prefix) { + if (toString(def->qualifiedTypeNameId) == prefix) removeGroupedProperty(def, propertyName); - } } } } @@ -417,9 +413,8 @@ void Rewriter::removeGroupedProperty(UiObjectDefinition *ast, ++memberCount; UiObjectMember *member = it->member; - if (!wanted && isMatchingPropertyMember(propName, member)) { + if (!wanted && isMatchingPropertyMember(propName, member)) wanted = member; - } } if (!wanted) @@ -517,9 +512,8 @@ void Rewriter::includeEmptyGroupedProperty(UiObjectDefinition *groupedProperty, // grouped property UiObjectMemberList *memberIter = groupedProperty->initializer->members; while (memberIter) { - if (memberIter->member != memberToBeRemoved) { + if (memberIter->member != memberToBeRemoved) return; - } memberIter = memberIter->next; } start = groupedProperty->firstSourceLocation().begin(); @@ -670,9 +664,8 @@ void Rewriter::removeObjectMember(UiObjectMember *member, UiObjectMember *parent if (UiArrayBinding *parentArray = cast<UiArrayBinding *>(parent)) { extendToLeadingOrTrailingComma(parentArray, member, start, end); } else { - if (UiObjectDefinition *parentObjectDefinition = cast<UiObjectDefinition *>(parent)) { + if (UiObjectDefinition *parentObjectDefinition = cast<UiObjectDefinition *>(parent)) includeEmptyGroupedProperty(parentObjectDefinition, member, start, end); - } includeSurroundingWhitespace(m_originalText, start, end); } diff --git a/src/libs/qmljs/qmljsscopeastpath.cpp b/src/libs/qmljs/qmljsscopeastpath.cpp index e3bd17074a..9d7701e9f0 100644 --- a/src/libs/qmljs/qmljsscopeastpath.cpp +++ b/src/libs/qmljs/qmljsscopeastpath.cpp @@ -55,13 +55,12 @@ void ScopeAstPath::accept(Node *node) bool ScopeAstPath::preVisit(Node *node) { - if (Statement *stmt = node->statementCast()) { + if (Statement *stmt = node->statementCast()) return containsOffset(stmt->firstSourceLocation(), stmt->lastSourceLocation()); - } else if (ExpressionNode *exp = node->expressionCast()) { + else if (ExpressionNode *exp = node->expressionCast()) return containsOffset(exp->firstSourceLocation(), exp->lastSourceLocation()); - } else if (UiObjectMember *ui = node->uiObjectMemberCast()) { + else if (UiObjectMember *ui = node->uiObjectMemberCast()) return containsOffset(ui->firstSourceLocation(), ui->lastSourceLocation()); - } return true; } diff --git a/src/libs/qmljs/qmljsscopebuilder.cpp b/src/libs/qmljs/qmljsscopebuilder.cpp index 65dfc783ef..1f8095709e 100644 --- a/src/libs/qmljs/qmljsscopebuilder.cpp +++ b/src/libs/qmljs/qmljsscopebuilder.cpp @@ -81,14 +81,12 @@ 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)) { - if (const ObjectValue *scope = qmlObject->signalScope(name)) { + if (const ObjectValue *scope = qmlObject->signalScope(name)) _scopeChain->appendJsScope(scope); - } } } } @@ -170,11 +168,10 @@ void ScopeBuilder::setQmlScopeObject(Node *node) } const ObjectValue *scopeObject = _scopeChain->document()->bind()->findQmlObject(node); - if (scopeObject) { + if (scopeObject) qmlScopeObjects += scopeObject; - } else { + else return; // Probably syntax errors, where we're working with a "recovered" AST. - } // check if the object has a Qt.ListElement or Qt.Connections ancestor // ### allow only signal bindings for Connections @@ -208,11 +205,10 @@ void ScopeBuilder::setQmlScopeObject(Node *node) Evaluate evaluator(_scopeChain); const Value *targetValue = evaluator(scriptBinding->statement); - if (const ObjectValue *target = value_cast<ObjectValue>(targetValue)) { + if (const ObjectValue *target = value_cast<ObjectValue>(targetValue)) qmlScopeObjects.prepend(target); - } else { + else qmlScopeObjects.clear(); - } } } } diff --git a/src/libs/qmljs/qmljstypedescriptionreader.cpp b/src/libs/qmljs/qmljstypedescriptionreader.cpp index e4dd6a5a62..63ffcc2661 100644 --- a/src/libs/qmljs/qmljstypedescriptionreader.cpp +++ b/src/libs/qmljs/qmljstypedescriptionreader.cpp @@ -157,11 +157,10 @@ void TypeDescriptionReader::readModule(UiObjectDefinition *ast) continue; } - if (typeName == QLatin1String("Component")) { + if (typeName == QLatin1String("Component")) readComponent(component); - } else if (typeName == QLatin1String("ModuleApi")) { + else if (typeName == QLatin1String("ModuleApi")) readModuleApi(component); - } } } @@ -191,15 +190,14 @@ void TypeDescriptionReader::readComponent(UiObjectDefinition *ast) UiScriptBinding *script = dynamic_cast<UiScriptBinding *>(member); if (component) { QString name = toString(component->qualifiedTypeNameId); - if (name == QLatin1String("Property")) { + if (name == QLatin1String("Property")) readProperty(component, fmo); - } else if (name == QLatin1String("Method") || name == QLatin1String("Signal")) { + else if (name == QLatin1String("Method") || name == QLatin1String("Signal")) readSignalOrMethod(component, name == QLatin1String("Method"), fmo); - } else if (name == QLatin1String("Enum")) { + else if (name == QLatin1String("Enum")) readEnum(component, fmo); - } else { + else addWarning(component->firstSourceLocation(), tr("Expected only Property, Method, Signal and Enum object definitions")); - } } else if (script) { QString name = toString(script->qualifiedId); if (name == QLatin1String("name")) { @@ -283,22 +281,20 @@ void TypeDescriptionReader::readSignalOrMethod(UiObjectDefinition *ast, bool isM UiScriptBinding *script = dynamic_cast<UiScriptBinding *>(member); if (component) { QString name = toString(component->qualifiedTypeNameId); - if (name == QLatin1String("Parameter")) { + if (name == QLatin1String("Parameter")) readParameter(component, &fmm); - } else { + else addWarning(component->firstSourceLocation(), tr("Expected only Parameter object definitions")); - } } else if (script) { QString name = toString(script->qualifiedId); - if (name == QLatin1String("name")) { + if (name == QLatin1String("name")) fmm.setMethodName(readStringBinding(script)); - } else if (name == QLatin1String("type")) { + else if (name == QLatin1String("type")) fmm.setReturnType(readStringBinding(script)); - } else if (name == QLatin1String("revision")) { + else if (name == QLatin1String("revision")) fmm.setRevision(readIntBinding(script)); - } else { + else addWarning(script->firstSourceLocation(), tr("Expected only name and type script bindings")); - } } else { addWarning(member->firstSourceLocation(), tr("Expected only script bindings and object definitions")); @@ -331,21 +327,20 @@ void TypeDescriptionReader::readProperty(UiObjectDefinition *ast, FakeMetaObject } QString id = toString(script->qualifiedId); - if (id == QLatin1String("name")) { + if (id == QLatin1String("name")) name = readStringBinding(script); - } else if (id == QLatin1String("type")) { + else if (id == QLatin1String("type")) type = readStringBinding(script); - } else if (id == QLatin1String("isPointer")) { + else if (id == QLatin1String("isPointer")) isPointer = readBoolBinding(script); - } else if (id == QLatin1String("isReadonly")) { + else if (id == QLatin1String("isReadonly")) isReadonly = readBoolBinding(script); - } else if (id == QLatin1String("isList")) { + else if (id == QLatin1String("isList")) isList = readBoolBinding(script); - } else if (id == QLatin1String("revision")) { + else if (id == QLatin1String("revision")) revision = readIntBinding(script); - } else { + else addWarning(script->firstSourceLocation(), tr("Expected only type, name, revision, isPointer, isReadonly and isList script bindings")); - } } if (name.isEmpty() || type.isEmpty()) { @@ -369,13 +364,12 @@ void TypeDescriptionReader::readEnum(UiObjectDefinition *ast, FakeMetaObject::Pt } QString name = toString(script->qualifiedId); - if (name == QLatin1String("name")) { + if (name == QLatin1String("name")) fme.setName(readStringBinding(script)); - } else if (name == QLatin1String("values")) { + else if (name == QLatin1String("values")) readEnumValues(script, &fme); - } else { + else addWarning(script->firstSourceLocation(), tr("Expected only name and values script bindings")); - } } fmo->addEnum(fme); diff --git a/src/libs/qtcomponents/styleitem/qstyleitem.cpp b/src/libs/qtcomponents/styleitem/qstyleitem.cpp index c549f795ef..cccd38440d 100644 --- a/src/libs/qtcomponents/styleitem/qstyleitem.cpp +++ b/src/libs/qtcomponents/styleitem/qstyleitem.cpp @@ -132,16 +132,14 @@ void QStyleItem::initStyleOption() break; case Splitter: { - if (!m_styleoption) { + if (!m_styleoption) m_styleoption = new QStyleOption; - } } break; case Item: { - if (!m_styleoption) { + if (!m_styleoption) m_styleoption = new QStyleOptionViewItemV4(); - } QStyleOptionViewItemV4 *opt = qstyleoption_cast<QStyleOptionViewItemV4*>(m_styleoption); opt->features = QStyleOptionViewItemV4::HasDisplay; opt->text = text(); @@ -446,11 +444,10 @@ void QStyleItem::initStyleOption() m_styleoption->fontMetrics = widget()->fontMetrics(); if (!m_styleoption->palette.resolve()) m_styleoption->palette = widget()->palette(); - if (m_hint.contains("mac.mini")) { + if (m_hint.contains("mac.mini")) widget()->setAttribute(Qt::WA_MacMiniSize); - } else if (m_hint.contains("mac.small")) { + else if (m_hint.contains("mac.small")) widget()->setAttribute(Qt::WA_MacSmallSize); - } } } @@ -1018,9 +1015,8 @@ void QStyleItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWid qApp->style()->drawComplexControl(QStyle::CC_ScrollBar, qstyleoption_cast<QStyleOptionComplex*>(m_styleoption), painter, widget()); break; case Menu: { - if (QMenu *menu = qobject_cast<QMenu*>(widget())) { + if (QMenu *menu = qobject_cast<QMenu*>(widget())) m_styleoption->palette = menu->palette(); - } QStyleHintReturnMask val; qApp->style()->styleHint(QStyle::SH_Menu_Mask, m_styleoption, widget(), &val); painter->save(); diff --git a/src/libs/qtcreatorcdbext/containers.cpp b/src/libs/qtcreatorcdbext/containers.cpp index 850419d3a7..e248019076 100644 --- a/src/libs/qtcreatorcdbext/containers.cpp +++ b/src/libs/qtcreatorcdbext/containers.cpp @@ -360,11 +360,10 @@ AbstractSymbolGroupNodePtrVector block -= blockArraySize; const ULONG64 blockOffset = offset % dequeSize; const ULONG64 address = blockArray[block] + innerTypeSize * blockOffset; - if (SymbolGroupNode *n = sg->addSymbol(module, SymbolGroupValue::pointedToSymbolName(address, innerType), std::string(), &errorMessage)) { + if (SymbolGroupNode *n = sg->addSymbol(module, SymbolGroupValue::pointedToSymbolName(address, innerType), std::string(), &errorMessage)) rc.push_back(ReferenceSymbolGroupNode::createArrayNode(i, n)); - } else { + else return AbstractSymbolGroupNodePtrVector(); - } } return rc; } @@ -842,11 +841,10 @@ SymbolGroupValueVector qHashNodes(const SymbolGroupValue &v, nodeList.reserve(count); const SymbolGroupValueVector::const_iterator dcend = dummyNodeList.end(); for (SymbolGroupValueVector::const_iterator it = dummyNodeList.begin(); it != dcend; ++it) { - if (const SymbolGroupValue n = (*it).typeCast(nodeType.c_str())) { + if (const SymbolGroupValue n = (*it).typeCast(nodeType.c_str())) nodeList.push_back(n); - } else { + } else return SymbolGroupValueVector(); - } } return nodeList; } @@ -865,11 +863,10 @@ static inline AbstractSymbolGroupNodePtrVector return rc; rc.reserve(count); for (int i = 0; i < count; i++) { - if (const SymbolGroupValue key = nodes.at(i)["key"]) { + if (const SymbolGroupValue key = nodes.at(i)["key"]) rc.push_back(ReferenceSymbolGroupNode::createArrayNode(i, key.node())); - } else { + else return AbstractSymbolGroupNodePtrVector(); - } } return rc; } diff --git a/src/libs/qtcreatorcdbext/extensioncontext.cpp b/src/libs/qtcreatorcdbext/extensioncontext.cpp index 87aca30800..4e5bb333d8 100644 --- a/src/libs/qtcreatorcdbext/extensioncontext.cpp +++ b/src/libs/qtcreatorcdbext/extensioncontext.cpp @@ -88,11 +88,10 @@ void ExtensionContext::hookCallbacks(CIDebugClient *client) void ExtensionContext::startRecordingOutput() { - if (m_creatorOutputCallback) { + if (m_creatorOutputCallback) m_creatorOutputCallback->startRecording(); - } else { + else report('X', 0, 0, "Error", "ExtensionContext::startRecordingOutput() called with no output hooked.\n"); - } } std::wstring ExtensionContext::stopRecordingOutput() @@ -189,18 +188,16 @@ void ExtensionContext::notifyIdleCommand(CIDebugClient *client) formatGdbmiHash(str, stopReasons, false); const std::string threadInfo = gdbmiThreadList(exc.systemObjects(), exc.symbols(), exc.control(), exc.advanced(), &errorMessage); - if (threadInfo.empty()) { + if (threadInfo.empty()) str << ",threaderror=" << gdbmiStringFormat(errorMessage); - } else { + else str << ",threads=" << threadInfo; - } const std::string stackInfo = gdbmiStack(exc.control(), exc.symbols(), maxStackFrames, false, &errorMessage); - if (stackInfo.empty()) { + if (stackInfo.empty()) str << ",stackerror=" << gdbmiStringFormat(errorMessage); - } else { + else str << ",stack=" << stackInfo; - } str << '}'; reportLong('E', 0, "session_idle", str.str()); } diff --git a/src/libs/qtcreatorcdbext/gdbmihelpers.cpp b/src/libs/qtcreatorcdbext/gdbmihelpers.cpp index 9793fbd6ce..d3194059d5 100644 --- a/src/libs/qtcreatorcdbext/gdbmihelpers.cpp +++ b/src/libs/qtcreatorcdbext/gdbmihelpers.cpp @@ -107,11 +107,10 @@ void getFrame(CIDebugSymbols *debugSymbols, WCHAR wBuf[MAX_PATH]; f->address = s.InstructionOffset; HRESULT hr = debugSymbols->GetNameByOffsetWide(f->address, wBuf, MAX_PATH, 0, 0); - if (SUCCEEDED(hr)) { + if (SUCCEEDED(hr)) f->function = wBuf; - } else { + else f->function.clear(); - } ULONG64 ul64Displacement = 0; hr = debugSymbols->GetLineByOffsetWide(f->address, &(f->line), wBuf, MAX_PATH, 0, &ul64Displacement); if (SUCCEEDED(hr)) { diff --git a/src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp b/src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp index 8b6cfd1098..87a98980dd 100644 --- a/src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp +++ b/src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp @@ -277,11 +277,10 @@ extern "C" HRESULT CALLBACK pid(CIDebugClient *client, PCSTR args) commandTokens<StringList>(args, &token); dprintf("Qt Creator CDB extension version 2.7 (Qt 5 support) %d bit built %s.\n", sizeof(void *) * 8, __DATE__); - if (const ULONG pid = currentProcessId(client)) { + if (const ULONG pid = currentProcessId(client)) ExtensionContext::instance().report('R', token, 0, "pid", "%u", pid); - } else { + else ExtensionContext::instance().report('N', token, 0, "pid", "0"); - } return S_OK; } @@ -564,11 +563,10 @@ extern "C" HRESULT CALLBACK locals(CIDebugClient *client, PCSTR args) int token; const std::string output = commmandLocals(exc, args, &token, &errorMessage); SymbolGroupValue::verbose = 0; - if (output.empty()) { + if (output.empty()) ExtensionContext::instance().report('N', token, 0, "locals", errorMessage.c_str()); - } else { + else ExtensionContext::instance().reportLong('R', token, "locals", output); - } return S_OK; } @@ -619,11 +617,10 @@ extern "C" HRESULT CALLBACK watches(CIDebugClient *client, PCSTR args) int token = 0; const std::string output = commmandWatches(exc, args, &token, &errorMessage); SymbolGroupValue::verbose = 0; - if (output.empty()) { + if (output.empty()) ExtensionContext::instance().report('N', token, 0, "locals", errorMessage.c_str()); - } else { + else ExtensionContext::instance().reportLong('R', token, "locals", output); - } return S_OK; } @@ -670,11 +667,10 @@ extern "C" HRESULT CALLBACK dumplocal(CIDebugClient *client, PCSTR argsIn) std::string errorMessage; int token = 0; const std::string value = dumplocalHelper(exc,argsIn, &token, &errorMessage); - if (value.empty()) { + if (value.empty()) ExtensionContext::instance().report('N', token, 0, "dumplocal", errorMessage.c_str()); - } else { + else ExtensionContext::instance().reportLong('R', token, "dumplocal", value); - } return S_OK; } @@ -699,11 +695,10 @@ extern "C" HRESULT CALLBACK typecast(CIDebugClient *client, PCSTR args) } else { errorMessage = singleLineUsage(commandDescriptions[CmdTypecast]); } - if (symGroup != 0 && symGroup->typeCast(iname, desiredType, &errorMessage)) { + if (symGroup != 0 && symGroup->typeCast(iname, desiredType, &errorMessage)) ExtensionContext::instance().report('R', token, 0, "typecast", "OK"); - } else { + else ExtensionContext::instance().report('N', token, 0, "typecast", errorMessage.c_str()); - } return S_OK; } @@ -729,11 +724,10 @@ extern "C" HRESULT CALLBACK addsymbol(CIDebugClient *client, PCSTR args) } else { errorMessage = singleLineUsage(commandDescriptions[CmdAddsymbol]); } - if (symGroup != 0 && symGroup->addSymbol(std::string(), name, iname, &errorMessage)) { + if (symGroup != 0 && symGroup->addSymbol(std::string(), name, iname, &errorMessage)) ExtensionContext::instance().report('R', token, 0, "addsymbol", "OK"); - } else { + else ExtensionContext::instance().report('N', token, 0, "addsymbol", errorMessage.c_str()); - } return S_OK; } @@ -763,11 +757,10 @@ extern "C" HRESULT CALLBACK addwatch(CIDebugClient *client, PCSTR argsIn) success = watchesSymGroup->addWatch(exc.symbols(), iname, watchExpression, &errorMessage); } while (false); - if (success) { + if (success) ExtensionContext::instance().report('R', token, 0, "addwatch", "Ok"); - } else { + else ExtensionContext::instance().report('N', token, 0, "addwatch", errorMessage.c_str()); - } return S_OK; } @@ -824,11 +817,10 @@ extern "C" HRESULT CALLBACK assign(CIDebugClient *client, PCSTR argsIn) &errorMessage); } while (false); - if (success) { + if (success) ExtensionContext::instance().report('R', token, 0, "assign", "Ok"); - } else { + else ExtensionContext::instance().report('N', token, 0, "assign", errorMessage.c_str()); - } return S_OK; } @@ -848,11 +840,10 @@ extern "C" HRESULT CALLBACK threads(CIDebugClient *client, PCSTR argsIn) exc.control(), exc.advanced(), &errorMessage); - if (gdbmi.empty()) { + if (gdbmi.empty()) ExtensionContext::instance().report('N', token, 0, "threads", errorMessage.c_str()); - } else { + else ExtensionContext::instance().reportLong('R', token, "threads", gdbmi); - } return S_OK; } @@ -868,11 +859,10 @@ extern "C" HRESULT CALLBACK registers(CIDebugClient *Client, PCSTR argsIn) const StringList tokens = commandTokens<StringList>(argsIn, &token); const bool humanReadable = !tokens.empty() && tokens.front() == "-h"; const std::string regs = gdbmiRegisters(exc.registers(), exc.control(), humanReadable, IncludePseudoRegisters, &errorMessage); - if (regs.empty()) { + if (regs.empty()) ExtensionContext::instance().report('N', token, 0, "registers", errorMessage.c_str()); - } else { + else ExtensionContext::instance().reportLong('R', token, "registers", regs); - } return S_OK; } @@ -888,11 +878,10 @@ extern "C" HRESULT CALLBACK modules(CIDebugClient *Client, PCSTR argsIn) const StringList tokens = commandTokens<StringList>(argsIn, &token); const bool humanReadable = !tokens.empty() && tokens.front() == "-h"; const std::string modules = gdbmiModules(exc.symbols(), humanReadable, &errorMessage); - if (modules.empty()) { + if (modules.empty()) ExtensionContext::instance().report('N', token, 0, "modules", errorMessage.c_str()); - } else { + else ExtensionContext::instance().reportLong('R', token, "modules", modules); - } return S_OK; } @@ -969,11 +958,10 @@ extern "C" HRESULT CALLBACK expression(CIDebugClient *Client, PCSTR argsIn) break; } while (false); - if (errorMessage.empty()) { + if (errorMessage.empty()) ExtensionContext::instance().reportLong('R', token, "expression", toString(value)); - } else { + else ExtensionContext::instance().report('N', token, 0, "expression", errorMessage.c_str()); - } return S_OK; } @@ -1000,11 +988,10 @@ extern "C" HRESULT CALLBACK stack(CIDebugClient *Client, PCSTR argsIn) const std::string stack = gdbmiStack(exc.control(), exc.symbols(), maxFrames, humanReadable, &errorMessage); - if (stack.empty()) { + if (stack.empty()) ExtensionContext::instance().report('N', token, 0, "stack", errorMessage.c_str()); - } else { + else ExtensionContext::instance().reportLong('R', token, "stack", stack); - } return S_OK; } @@ -1041,11 +1028,10 @@ extern "C" HRESULT CALLBACK widgetat(CIDebugClient *client, PCSTR argsIn) x, y, &errorMessage); } while (false); - if (widgetAddress.empty()) { + if (widgetAddress.empty()) ExtensionContext::instance().report('N', token, 0, "widgetat", errorMessage.c_str()); - } else { + else ExtensionContext::instance().reportLong('R', token, "widgetat", widgetAddress); - } return S_OK; } @@ -1070,11 +1056,10 @@ extern "C" HRESULT CALLBACK breakpoints(CIDebugClient *client, PCSTR argsIn) } const std::string bp = gdbmiBreakpoints(exc.control(), exc.symbols(), exc.dataSpaces(), humanReadable, verbose, &errorMessage); - if (bp.empty()) { + if (bp.empty()) ExtensionContext::instance().report('N', token, 0, "breakpoints", errorMessage.c_str()); - } else { + else ExtensionContext::instance().reportLong('R', token, "breakpoints", bp); - } return S_OK; } diff --git a/src/libs/qtcreatorcdbext/stringutils.cpp b/src/libs/qtcreatorcdbext/stringutils.cpp index a3d094b4c8..12fc0889d4 100644 --- a/src/libs/qtcreatorcdbext/stringutils.cpp +++ b/src/libs/qtcreatorcdbext/stringutils.cpp @@ -268,11 +268,10 @@ std::string dumpMemory(const unsigned char *p, size_t size, case '\n': str << "\\n"; default: - if (u >= 32 && u < 128) { + if (u >= 32 && u < 128) str << (char(u)); - } else { + else str << '\\' << std::setw(3) << unsigned(u); - } } } if (wantQuotes) diff --git a/src/libs/qtcreatorcdbext/symbolgroup.cpp b/src/libs/qtcreatorcdbext/symbolgroup.cpp index c10145552a..8f68ee6dad 100644 --- a/src/libs/qtcreatorcdbext/symbolgroup.cpp +++ b/src/libs/qtcreatorcdbext/symbolgroup.cpp @@ -239,11 +239,10 @@ std::string SymbolGroup::debug(const std::string &iname, if (iname.empty()) { accept(*visitor); } else { - if (AbstractSymbolGroupNode *const node = find(iname)) { + if (AbstractSymbolGroupNode *const node = find(iname)) node->accept(*visitor, SymbolGroupNodeVisitor::parentIname(iname), 0, 0); - } else { + else str << msgNotFound(iname); - } } return str.str(); } diff --git a/src/libs/qtcreatorcdbext/symbolgroupnode.cpp b/src/libs/qtcreatorcdbext/symbolgroupnode.cpp index d926d19e29..b3c3599542 100644 --- a/src/libs/qtcreatorcdbext/symbolgroupnode.cpp +++ b/src/libs/qtcreatorcdbext/symbolgroupnode.cpp @@ -251,11 +251,10 @@ void BaseSymbolGroupNode::addChild(AbstractSymbolGroupNode *c) std::ostream &operator<<(std::ostream &str, const DEBUG_SYMBOL_PARAMETERS ¶meters) { str << "parent="; - if (parameters.ParentSymbol == DEBUG_ANY_ID) { + if (parameters.ParentSymbol == DEBUG_ANY_ID) str << "DEBUG_ANY_ID"; - } else { + else str << parameters.ParentSymbol ; - } if (parameters.Flags != 0 && parameters.Flags != 1) str << " flags=" << parameters.Flags; // Detailed flags: @@ -669,17 +668,15 @@ bool SymbolGroupNode::notifyIndexesMoved(ULONG index, bool inserted, ULONG offse if (m_index == DEBUG_ANY_ID || m_index < index) return false; - if (inserted) { + if (inserted) m_index += offset; - } else { + else m_index -= offset; - } if (m_parameters.ParentSymbol != DEBUG_ANY_ID && m_parameters.ParentSymbol >= index) { - if (inserted) { + if (inserted) m_parameters.ParentSymbol += offset; - } else { + else m_parameters.ParentSymbol -= offset; - } } return true; } @@ -732,9 +729,8 @@ static inline void fixNames(bool isTopLevel, StringVector *names, StringVector * * 3) For toplevels: Fix shadowed variables in the order the debugger expects them: \code int x; // Occurrence (1), should be reported as name="x <shadowed 1>"/iname="x#1" - if (true) { + if (true) int x = 5; (2) // Occurrence (2), should be reported as name="x"/iname="x" - } \endcode */ StringVector::iterator nameIt = names->begin(); const StringVector::iterator namesEnd = names->end(); @@ -1103,11 +1099,10 @@ int SymbolGroupNode::dumpNode(std::ostream &str, // Emulate gdb's behaviour of returning the referenced address // for pointers. str << std::hex << std::showbase; - if (referencedAddr) { + if (referencedAddr) str << ",addr=\"" << referencedAddr << "\",origaddr=\"" << addr << '"'; - } else { + else str << ",addr=\"" << addr << '"'; - } str << std::noshowbase << std::dec; } const ULONG s = size(); @@ -1141,11 +1136,10 @@ int SymbolGroupNode::dumpNode(std::ostream &str, if (m_dumperContainerSize > 0) { childCountGuess = m_dumperContainerSize; // See Obscured handling } else { - if (children().empty()) { + if (children().empty()) childCountGuess = m_parameters.SubElements; // Guess - } else { + else childCountGuess = unsigned(children().size()); - } } } // No children..suppose we are editable and enabled. @@ -1646,11 +1640,10 @@ SymbolGroupNodeVisitor::VisitResult if (!realNode->isExpanded() || realNode->testFlags(SymbolGroupNode::Uninitialized|SymbolGroupNode::ExpandedByDumper)) visitChildren = false; // Comma between same level children given obscured children - if (depth == m_lastDepth) { + if (depth == m_lastDepth) m_os << ','; - } else { + else m_lastDepth = depth; - } if (m_parameters.humanReadable()) { m_os << '\n'; indentStream(m_os, depth * 2); diff --git a/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp b/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp index ae0cdf7b24..335b5631b1 100644 --- a/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp +++ b/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp @@ -701,11 +701,10 @@ const QtInfo &QtInfo::get(const SymbolGroupValueContext &ctx) } rc.libInfix = qualifiedSymbol.substr(libPos + 4, exclPos - libPos - 4); // 'Qt5Cored!qstrdup' or 'QtCored4!qstrdup'. - if (isdigit(qualifiedSymbol.at(2))) { + if (isdigit(qualifiedSymbol.at(2))) rc.version = qualifiedSymbol.at(2) - '0'; - } else { + else rc.version = qualifiedSymbol.at(exclPos - 1) - '0'; - } // Any namespace? 'QtCored4!nsp::qstrdup' const std::string::size_type nameSpaceStart = exclPos + 1; const std::string::size_type colonPos = qualifiedSymbol.find(':', nameSpaceStart); @@ -1585,11 +1584,10 @@ static inline bool dumpQString(const SymbolGroupValue &v, std::wostream &str, } else { str << L"\"\""; } - if (memoryHandle) { + if (memoryHandle) *memoryHandle = new MemoryHandle(memory, size); - } else { + else delete [] memory; - } return true; } @@ -1691,11 +1689,10 @@ static inline bool dumpQByteArray(const SymbolGroupValue &v, std::wostream &str, } else { str << L"<empty>"; } - if (memoryHandle) { + if (memoryHandle) *memoryHandle = new MemoryHandle(reinterpret_cast<unsigned char *>(memory), size); - } else { + else delete [] memory; - } return true; } @@ -2012,13 +2009,12 @@ static inline bool dumpQFlags(const SymbolGroupValue &v, std::wostream &str) static bool dumpJulianDate(int julianDay, std::wostream &str) { - if (julianDay < 0) { + if (julianDay < 0) return false; - } else if (!julianDay) { + else if (!julianDay) str << L"<null>"; - } else { + else formatJulianDate(str, julianDay); - } return true; } @@ -2292,11 +2288,10 @@ static bool dumpStd_W_String(const SymbolGroupValue &v, int type, std::wostream str << (type == KT_StdString ? quotedWStringFromCharData(memory, memSize) : quotedWStringFromWCharData(memory, memSize)); - if (memoryHandle) { + if (memoryHandle) *memoryHandle = new MemoryHandle(memory, memSize); - } else { + else delete [] memory; - } return true; } @@ -2403,9 +2398,8 @@ static bool dumpQVariant(const SymbolGroupValue &v, std::wostream &str, void **s break; case 10: // String str << L"(QString) "; - if (const SymbolGroupValue sv = dataV.typeCast(qtInfo.prependQtCoreModule("QString *").c_str())) { + if (const SymbolGroupValue sv = dataV.typeCast(qtInfo.prependQtCoreModule("QString *").c_str())) dumpQString(sv, str); - } break; case 11: //StringList: Dump container size str << L"(QStringList) "; diff --git a/src/libs/ssh/sshconnection.cpp b/src/libs/ssh/sshconnection.cpp index 5b7db878d6..617764def2 100644 --- a/src/libs/ssh/sshconnection.cpp +++ b/src/libs/ssh/sshconnection.cpp @@ -472,9 +472,8 @@ void SshConnectionPrivate::handleKeyExchangeInitPacket() // If the server sends a guessed packet, the guess must be wrong, // because the algorithms we support require us to initiate the // key exchange. - if (m_keyExchange->sendDhInitPacket(m_incomingPacket)) { + if (m_keyExchange->sendDhInitPacket(m_incomingPacket)) m_ignoreNextPacket = true; - } m_keyExchangeState = DhInitSent; } diff --git a/src/libs/ssh/sshkeycreationdialog.cpp b/src/libs/ssh/sshkeycreationdialog.cpp index f46ce7f588..37607aa65e 100644 --- a/src/libs/ssh/sshkeycreationdialog.cpp +++ b/src/libs/ssh/sshkeycreationdialog.cpp @@ -81,11 +81,10 @@ void SshKeyCreationDialog::generateKeys() m_ui->comboBox->currentText().toUShort()); QApplication::restoreOverrideCursor(); - if (success) { + if (success) saveKeys(); - } else { + else QMessageBox::critical(this, tr("Key Generation Failed"), m_keyGenerator->error()); - } } void SshKeyCreationDialog::handleBrowseButtonClicked() diff --git a/src/libs/utils/buildablehelperlibrary.cpp b/src/libs/utils/buildablehelperlibrary.cpp index 8d8e708ac3..f61b38ed97 100644 --- a/src/libs/utils/buildablehelperlibrary.cpp +++ b/src/libs/utils/buildablehelperlibrary.cpp @@ -56,9 +56,8 @@ Utils::FileName BuildableHelperLibrary::findSystemQt(const Utils::Environment &e foreach (const QString &possibleCommand, possibleQMakeCommands()) { const QFileInfo qmake(prefix + possibleCommand); if (qmake.exists()) { - if (!qtVersionForQMake(qmake.absoluteFilePath()).isNull()) { + if (!qtVersionForQMake(qmake.absoluteFilePath()).isNull()) return Utils::FileName(qmake); - } } } } @@ -158,9 +157,8 @@ bool BuildableHelperLibrary::copyFiles(const QString &sourcePath, return false; } } - if (!destInfo.dir().exists()) { + if (!destInfo.dir().exists()) QDir().mkpath(destInfo.dir().absolutePath()); - } if (!QFile::copy(source, dest)) { *errorMessage = QCoreApplication::translate("ProjectExplorer::DebuggingHelperLibrary", "The file %1 could not be copied to %2.").arg(source, dest); diff --git a/src/libs/utils/crumblepath.cpp b/src/libs/utils/crumblepath.cpp index 5ae6ced83e..a96635cd06 100644 --- a/src/libs/utils/crumblepath.cpp +++ b/src/libs/utils/crumblepath.cpp @@ -124,27 +124,24 @@ void CrumblePathButton::paintEvent(QPaintEvent *) } if (m_isEnd) { - if (m_isPressed || m_isSelected) { + if (m_isPressed || m_isSelected) Utils::StyleHelper::drawCornerImage(m_segmentSelectedEnd, &p, geom, 2, 0, 2, 0); - } else if (m_isHovering) { + else if (m_isHovering) Utils::StyleHelper::drawCornerImage(m_segmentHoverEnd, &p, geom, 2, 0, 2, 0); - } else { + else Utils::StyleHelper::drawCornerImage(m_segmentEnd, &p, geom, 2, 0, 2, 0); - } } else { - if (m_isPressed || m_isSelected) { + if (m_isPressed || m_isSelected) Utils::StyleHelper::drawCornerImage(m_segmentSelected, &p, geom, 2, 0, 12, 0); - } else if (m_isHovering) { + else if (m_isHovering) Utils::StyleHelper::drawCornerImage(m_segmentHover, &p, geom, 2, 0, 12, 0); - } else { + else Utils::StyleHelper::drawCornerImage(m_segment, &p, geom, 2, 0, 12, 0); - } } - if (isEnabled()) { + if (isEnabled()) p.setPen(StyleHelper::panelTextColor()); - } else { + else p.setPen(StyleHelper::panelTextColor().darker()); - } QFontMetrics fm(p.font()); QString textToDraw = fm.elidedText(text(), Qt::ElideRight, geom.width() - m_textPos.x()); diff --git a/src/libs/utils/environmentmodel.cpp b/src/libs/utils/environmentmodel.cpp index e34d4bd49d..8d23b0f8f3 100644 --- a/src/libs/utils/environmentmodel.cpp +++ b/src/libs/utils/environmentmodel.cpp @@ -48,9 +48,8 @@ public: // Add removed variables again and mark them as "<UNSET>" so // that the user can actually see those removals: foreach (const Utils::EnvironmentItem &item, m_items) { - if (item.unset) { + if (item.unset) m_resultEnvironment.set(item.name, EnvironmentModel::tr("<UNSET>")); - } } } diff --git a/src/libs/utils/fancylineedit.cpp b/src/libs/utils/fancylineedit.cpp index bad7c070f5..078995819f 100644 --- a/src/libs/utils/fancylineedit.cpp +++ b/src/libs/utils/fancylineedit.cpp @@ -58,18 +58,16 @@ static void execMenuAtWidget(QMenu *menu, QWidget *widget) QSize sh = menu->sizeHint(); QRect rect = widget->rect(); if (widget->isRightToLeft()) { - if (widget->mapToGlobal(QPoint(0, rect.bottom())).y() + sh.height() <= screen.height()) { + if (widget->mapToGlobal(QPoint(0, rect.bottom())).y() + sh.height() <= screen.height()) p = widget->mapToGlobal(rect.bottomRight()); - } else { + else p = widget->mapToGlobal(rect.topRight() - QPoint(0, sh.height())); - } p.rx() -= sh.width(); } else { - if (widget->mapToGlobal(QPoint(0, rect.bottom())).y() + sh.height() <= screen.height()) { + if (widget->mapToGlobal(QPoint(0, rect.bottom())).y() + sh.height() <= screen.height()) p = widget->mapToGlobal(rect.bottomLeft()); - } else { + else p = widget->mapToGlobal(rect.topLeft() - QPoint(0, sh.height())); - } } p.rx() = qMax(screen.left(), qMin(p.x(), screen.right() - sh.width())); p.ry() += 1; diff --git a/src/libs/utils/fancymainwindow.cpp b/src/libs/utils/fancymainwindow.cpp index 29ed7f4068..fabd97a81b 100644 --- a/src/libs/utils/fancymainwindow.cpp +++ b/src/libs/utils/fancymainwindow.cpp @@ -105,11 +105,10 @@ QDockWidget *FancyMainWindow::addDockForWidget(QWidget *widget) dockWidget->setWidget(widget); // Set an object name to be used in settings, derive from widget name const QString objectName = widget->objectName(); - if (objectName.isEmpty()) { + if (objectName.isEmpty()) dockWidget->setObjectName(QLatin1String("dockWidget") + QString::number(dockWidgets().size() + 1)); - } else { + else dockWidget->setObjectName(objectName + QLatin1String("DockWidget")); - } connect(dockWidget->toggleViewAction(), SIGNAL(triggered()), this, SLOT(onDockActionTriggered()), Qt::QueuedConnection); connect(dockWidget, SIGNAL(visibilityChanged(bool)), diff --git a/src/libs/utils/filenamevalidatinglineedit.cpp b/src/libs/utils/filenamevalidatinglineedit.cpp index bf0c598d0a..5a261ee7bd 100644 --- a/src/libs/utils/filenamevalidatinglineedit.cpp +++ b/src/libs/utils/filenamevalidatinglineedit.cpp @@ -114,11 +114,10 @@ bool FileNameValidatingLineEdit::validateFileName(const QString &name, if (name.contains(QLatin1Char(*c))) { if (errorMessage) { const QChar qc = QLatin1Char(*c); - if (qc.isSpace()) { + if (qc.isSpace()) *errorMessage = tr("Name contains white space."); - } else { + else *errorMessage = tr("Invalid character '%1'.").arg(qc); - } } return false; } @@ -171,17 +170,15 @@ bool FileNameValidatingLineEdit::validateFileNameExtension(const QString &fileNa if (!requiredExtensions.isEmpty()) { foreach (const QString &requiredExtension, requiredExtensions) { QString extension = QLatin1String(".") + requiredExtension; - if (fileName.endsWith(extension, Qt::CaseSensitive) && extension.count() < fileName.count()) { + if (fileName.endsWith(extension, Qt::CaseSensitive) && extension.count() < fileName.count()) return true; - } } if (errorMessage) { - if (requiredExtensions.count() == 1) { + if (requiredExtensions.count() == 1) *errorMessage = tr("File extension %1 is required:").arg(requiredExtensions.first()); - } else { + else *errorMessage = tr("File extensions %1 are required:").arg(requiredExtensions.join(QLatin1String(", "))); - } } return false; diff --git a/src/libs/utils/filesearch.cpp b/src/libs/utils/filesearch.cpp index dc5692666f..d830d35ac5 100644 --- a/src/libs/utils/filesearch.cpp +++ b/src/libs/utils/filesearch.cpp @@ -499,9 +499,8 @@ bool SubDirFileIterator::hasNext() const const bool processed = m_processedValues.pop(); if (dir.exists()) { QStringList subDirs; - if (!processed) { + if (!processed) subDirs = dir.entryList(QDir::Dirs|QDir::Hidden|QDir::NoDotAndDotDot); - } if (subDirs.isEmpty()) { QStringList fileEntries = dir.entryList(m_filters, QDir::Files|QDir::Hidden); diff --git a/src/libs/utils/filesystemwatcher.cpp b/src/libs/utils/filesystemwatcher.cpp index 2531816c0c..4cab6f9556 100644 --- a/src/libs/utils/filesystemwatcher.cpp +++ b/src/libs/utils/filesystemwatcher.cpp @@ -284,9 +284,8 @@ void FileSystemWatcher::removeFiles(const QStringList &files) const int count = --(d->m_staticData->m_fileCount[file]); Q_ASSERT(count >= 0); - if (!count) { + if (!count) toRemove << file; - } } if (!toRemove.isEmpty()) @@ -362,9 +361,8 @@ void FileSystemWatcher::removeDirectories(const QStringList &directories) const int count = --d->m_staticData->m_directoryCount[directory]; Q_ASSERT(count >= 0); - if (!count) { + if (!count) toRemove << directory; - } } if (!toRemove.isEmpty()) d->m_staticData->m_watcher->removePaths(toRemove); diff --git a/src/libs/utils/flowlayout.cpp b/src/libs/utils/flowlayout.cpp index 6ecad5d01b..77ec4212b6 100644 --- a/src/libs/utils/flowlayout.cpp +++ b/src/libs/utils/flowlayout.cpp @@ -61,20 +61,18 @@ void FlowLayout::addItem(QLayoutItem *item) int FlowLayout::horizontalSpacing() const { - if (m_hSpace >= 0) { + if (m_hSpace >= 0) return m_hSpace; - } else { + else return smartSpacing(QStyle::PM_LayoutHorizontalSpacing); - } } int FlowLayout::verticalSpacing() const { - if (m_vSpace >= 0) { + if (m_vSpace >= 0) return m_vSpace; - } else { + else return smartSpacing(QStyle::PM_LayoutVerticalSpacing); - } } int FlowLayout::count() const diff --git a/src/libs/utils/json.cpp b/src/libs/utils/json.cpp index 964ce3e045..94525bd0d8 100644 --- a/src/libs/utils/json.cpp +++ b/src/libs/utils/json.cpp @@ -730,9 +730,8 @@ JsonSchema *JsonSchemaManager::parseSchema(const QString &schemaFileName) const if (reader.fetch(schemaFileName, QIODevice::Text)) { const QString &contents = QString::fromUtf8(reader.data()); JsonValue *json = JsonValue::create(contents); - if (json && json->kind() == JsonValue::Object) { + if (json && json->kind() == JsonValue::Object) return new JsonSchema(json->toObject(), this); - } } return 0; diff --git a/src/libs/utils/parameteraction.cpp b/src/libs/utils/parameteraction.cpp index 1992a1986b..ca77fb81b9 100644 --- a/src/libs/utils/parameteraction.cpp +++ b/src/libs/utils/parameteraction.cpp @@ -93,11 +93,10 @@ void ParameterAction::setEnablingMode(EnablingMode m) void ParameterAction::setParameter(const QString &p) { const bool enabled = !p.isEmpty(); - if (enabled) { + if (enabled) setText(m_parameterText.arg(p)); - } else { + else setText(m_emptyText); - } if (m_enablingMode == EnabledWithParameter) setEnabled(enabled); } diff --git a/src/libs/utils/pathlisteditor.cpp b/src/libs/utils/pathlisteditor.cpp index 2eb6758159..c9030d8ea1 100644 --- a/src/libs/utils/pathlisteditor.cpp +++ b/src/libs/utils/pathlisteditor.cpp @@ -174,11 +174,10 @@ QAction *PathListEditor::insertAction(int index /* -1 */, const QString &text, Q beforeAction = actions.at(index); } QAction *rc = createAction(this, text, receiver, slotFunc); - if (beforeAction) { + if (beforeAction) d->buttonMenu->insertAction(beforeAction, rc); - } else { + else d->buttonMenu->addAction(rc); - } return rc; } diff --git a/src/libs/utils/reloadpromptutils.cpp b/src/libs/utils/reloadpromptutils.cpp index eb2cc9120b..0dc91dd43a 100644 --- a/src/libs/utils/reloadpromptutils.cpp +++ b/src/libs/utils/reloadpromptutils.cpp @@ -97,12 +97,11 @@ QTCREATOR_UTILS_EXPORT Utils::FileDeletedPromptAnswer box.setDefaultButton(saveas); box.exec(); QAbstractButton *clickedbutton = box.clickedButton(); - if (clickedbutton == close) { + if (clickedbutton == close) return FileDeletedClose; - } else if (clickedbutton == saveas) { + else if (clickedbutton == saveas) return FileDeletedSaveAs; - } else if (clickedbutton == save) { + else if (clickedbutton == save) return FileDeletedSave; - } return FileDeletedClose; } diff --git a/src/libs/utils/synchronousprocess.cpp b/src/libs/utils/synchronousprocess.cpp index fe18db3706..c265ee3964 100644 --- a/src/libs/utils/synchronousprocess.cpp +++ b/src/libs/utils/synchronousprocess.cpp @@ -256,11 +256,10 @@ SynchronousProcess::~SynchronousProcess() void SynchronousProcess::setTimeout(int timeoutMS) { - if (timeoutMS >= 0) { + if (timeoutMS >= 0) d->m_maxHangTimerCount = qMax(2, timeoutMS / 1000); - } else { + else d->m_maxHangTimerCount = INT_MAX; - } } int SynchronousProcess::timeout() const diff --git a/src/libs/utils/textfileformat.cpp b/src/libs/utils/textfileformat.cpp index 3216d0d0ac..c57f672796 100644 --- a/src/libs/utils/textfileformat.cpp +++ b/src/libs/utils/textfileformat.cpp @@ -103,13 +103,12 @@ TextFileFormat TextFileFormat::detect(const QByteArray &data) } // end code taken from qtextstream const int newLinePos = data.indexOf('\n'); - if (newLinePos == -1) { + if (newLinePos == -1) result.lineTerminationMode = NativeLineTerminator; - } else if (newLinePos == 0) { + else if (newLinePos == 0) result.lineTerminationMode = LFLineTerminator; - } else { + else result.lineTerminationMode = data.at(newLinePos - 1) == '\r' ? CRLFLineTerminator : LFLineTerminator; - } return result; } @@ -286,11 +285,10 @@ bool TextFileFormat::writeFile(const QString &fileName, QString plainText, QStri // let QFile do the work, else manually add. QIODevice::OpenMode fileMode = QIODevice::NotOpen; if (lineTerminationMode == CRLFLineTerminator) { - if (NativeLineTerminator == CRLFLineTerminator) { + if (NativeLineTerminator == CRLFLineTerminator) fileMode |= QIODevice::Text; - } else { + else plainText.replace(QLatin1Char('\n'), QLatin1String("\r\n")); - } } Utils::FileSaver saver(fileName, fileMode); diff --git a/src/libs/utils/wizard.cpp b/src/libs/utils/wizard.cpp index 5fa79b31ef..c005af5318 100644 --- a/src/libs/utils/wizard.cpp +++ b/src/libs/utils/wizard.cpp @@ -553,9 +553,8 @@ QList<WizardProgressItem *> WizardProgressPrivate::singlePathBetween(WizardProgr if (itItem.value().count() != 1) return QList<WizardProgressItem *>(); it = itItem.value().constBegin().key(); - if (it == item) { + if (it == item) return path; - } itItem = visitedItemsToParents.constFind(it); } return QList<WizardProgressItem *>(); diff --git a/src/libs/zeroconf/avahiLib.cpp b/src/libs/zeroconf/avahiLib.cpp index 43635b72f2..17aeec306e 100644 --- a/src/libs/zeroconf/avahiLib.cpp +++ b/src/libs/zeroconf/avahiLib.cpp @@ -506,9 +506,8 @@ extern "C" void cAvahiBrowseReply( } ServiceBrowserPrivate *browser = reinterpret_cast<ServiceBrowserPrivate *>(context); - if (browser == 0) { + if (browser == 0) qDebug() << "Error context is null in cAvahiBrowseReply"; - } switch (event) { case AVAHI_BROWSER_FAILURE: browser->browseReply(kDNSServiceFlagsMoreComing, 0, protocol, kDNSServiceErr_Unknown, diff --git a/src/libs/zeroconf/servicebrowser.cpp b/src/libs/zeroconf/servicebrowser.cpp index 575c1792fd..f7f1ee48ab 100644 --- a/src/libs/zeroconf/servicebrowser.cpp +++ b/src/libs/zeroconf/servicebrowser.cpp @@ -113,9 +113,8 @@ int fromFullNameC(const char * const fullName, QString &service, QString ®typ fullNameDecoded[decodedI++] = c; } } else if (c == '.') { - if (iPos < 4) { + if (iPos < 4) oldPos[iPos++] = decodedI; - } fullNameDecoded[decodedI++] = c; } else { fullNameDecoded[decodedI++] = c; @@ -387,11 +386,10 @@ QDebug operator<<(QDebug dbg, const Service &service) } QDebug operator<<(QDebug dbg, const Service::ConstPtr &service){ - if (service.data() == 0){ + if (service.data() == 0) dbg << "Service{*NULL*}"; - } else { + else dbg << *service.data(); - } return dbg; } @@ -718,9 +716,8 @@ extern "C" void DNSSD_API cAddrReply(DNSServiceRef sdRef, << interfaceIndex << ", " << ((int)errorCode) << ", " << hostname << ", " << QHostAddress(address).toString() << ", " << ttl << ", " << ((size_t)context); ServiceGatherer *ctxGatherer = reinterpret_cast<ServiceGatherer *>(context); - if (ctxGatherer){ + if (ctxGatherer) ctxGatherer->addrReply(flags, errorCode, hostname, address, ttl); - } } /// callback for service browsing @@ -856,9 +853,8 @@ void ServiceGatherer::restartResolve(ZK_IP_Protocol protocol) changed = true; } } - if (changed) { + if (changed) currentService->m_host->setAddresses(addrNow); - } } DNSServiceErrorType err = lib()->resolve( serviceBrowser->mainRef(), @@ -889,9 +885,8 @@ void ServiceGatherer::restartResolve(ZK_IP_Protocol protocol) changed = true; } } - if (changed) { + if (changed) currentService->m_host->setAddresses(addrNow); - } } } DNSServiceErrorType err = lib()->resolve( @@ -1085,9 +1080,8 @@ void ServiceGatherer::serviceResolveReply(DNSServiceFlags fl else currentService->m_host->setAddresses(QList<QHostAddress>()); currentService->m_host->setHostName(hostName); - if (serviceBrowser->autoResolveAddresses){ + if (serviceBrowser->autoResolveAddresses) restartHostResolution(); - } } if (currentServiceCanBePublished()) serviceBrowser->pendingGathererAdd(gatherer()); @@ -1144,9 +1138,8 @@ void ServiceGatherer::txtRecordReply(DNSServiceFlags flags, currentService->m_txtRecord.remove(QString::fromUtf8(keyBuf)); // check value??? } } - if ((flags & kDNSServiceFlagsAdd) != 0) { + if ((flags & kDNSServiceFlagsAdd) != 0) status |= TxtConnectionSuccess; - } if (currentService->m_txtRecord.count() != 0 && currentServiceCanBePublished()) serviceBrowser->pendingGathererAdd(gatherer()); } @@ -1373,12 +1366,10 @@ ServiceBrowserPrivate::~ServiceBrowserPrivate() { if (DEBUG_ZEROCONF) qDebug() << "destroying ServiceBrowserPrivate " << serviceType; - if (browsing){ + if (browsing) stopBrowsing(); - } - if (mainConnection){ + if (mainConnection) mainConnection->removeBrowser(this); - } } void ServiceBrowserPrivate::insertGatherer(const QString &fullName) @@ -1498,9 +1489,8 @@ void ServiceBrowserPrivate::browseReply(DNSServiceFlags flag if (pos == knownServices.end() || *pos != fullName) knownServices.insert(pos, fullName); } else { - if (gatherers.contains(fullName)){ + if (gatherers.contains(fullName)) gatherers[fullName]->maybeRemove(); - } knownServices.removeOne(fullName); } maybeUpdateLists(); // avoid? diff --git a/src/plugins/analyzerbase/analyzersettings.cpp b/src/plugins/analyzerbase/analyzersettings.cpp index c33077eeef..fa9dc5b73e 100644 --- a/src/plugins/analyzerbase/analyzersettings.cpp +++ b/src/plugins/analyzerbase/analyzersettings.cpp @@ -209,11 +209,10 @@ void AnalyzerRunConfigurationAspect::setUsingGlobalSettings(bool value) if (value == m_useGlobalSettings) return; m_useGlobalSettings = value; - if (m_useGlobalSettings) { + if (m_useGlobalSettings) m_subConfigs = AnalyzerGlobalSettings::instance()->subConfigs(); - } else { + else m_subConfigs = m_customConfigurations; - } } void AnalyzerRunConfigurationAspect::resetCustomToGlobalSettings() diff --git a/src/plugins/android/androidmanager.cpp b/src/plugins/android/androidmanager.cpp index 46f8681841..36e8b7beee 100644 --- a/src/plugins/android/androidmanager.cpp +++ b/src/plugins/android/androidmanager.cpp @@ -606,11 +606,10 @@ QStringList AndroidManager::availableQtLibs(ProjectExplorer::Target *target) int it = 0; while (it < mapLibs[key].dependencies.size()) { const QString &dependName = mapLibs[key].dependencies[it]; - if (!mapLibs.keys().contains(dependName) && dependName.startsWith(QLatin1String("lib")) && dependName.endsWith(QLatin1String(".so"))) { + if (!mapLibs.keys().contains(dependName) && dependName.startsWith(QLatin1String("lib")) && dependName.endsWith(QLatin1String(".so"))) mapLibs[key].dependencies.removeAt(it); - } else { + else ++it; - } } if (!mapLibs[key].dependencies.size()) mapLibs[key].level = 0; diff --git a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp index 245ecfb44b..c100b8ada2 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp +++ b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp @@ -315,11 +315,10 @@ void AutotoolsProject::buildFileNodeTree(const QDir &directory, // Add file node const QString filePath = directory.absoluteFilePath(file); - if (nodeHash.contains(filePath)) { + if (nodeHash.contains(filePath)) nodeHash.remove(filePath); - } else { + else fileNodes.append(new FileNode(filePath, ResourceType, false)); - } } if (!fileNodes.isEmpty()) diff --git a/src/plugins/bineditor/bineditor.cpp b/src/plugins/bineditor/bineditor.cpp index 14f77b205d..4e9a831377 100644 --- a/src/plugins/bineditor/bineditor.cpp +++ b/src/plugins/bineditor/bineditor.cpp @@ -73,9 +73,8 @@ static QByteArray calculateHexPattern(const QByteArray &pattern) int i = 0; while (i < pattern.size()) { ushort s = pattern.mid(i, 2).toUShort(&ok, 16); - if (!ok) { + if (!ok) return QByteArray(); - } result.append(s); i += 2; } @@ -1061,11 +1060,10 @@ bool BinEditor::event(QEvent *e) case QEvent::ToolTip: { const QHelpEvent *helpEvent = static_cast<const QHelpEvent *>(e); const QString tt = toolTip(helpEvent); - if (tt.isEmpty()) { + if (tt.isEmpty()) QToolTip::hideText(); - } else { + else QToolTip::showText(helpEvent->globalPos(), tt, this); - } e->accept(); return true; } @@ -1437,9 +1435,8 @@ void BinEditor::changeData(int position, uchar character, bool highNibble) changeDataAt(position, (char) character); bool emitModificationChanged = (m_undoStack.size() == m_unmodifiedState); m_undoStack.push(cmd); - if (emitModificationChanged) { + if (emitModificationChanged) emit modificationChanged(m_undoStack.size() != m_unmodifiedState); - } if (m_undoStack.size() == 1) emit undoAvailable(true); diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp index 3197fbc4d1..820586ebaf 100644 --- a/src/plugins/bookmarks/bookmarkmanager.cpp +++ b/src/plugins/bookmarks/bookmarkmanager.cpp @@ -803,11 +803,10 @@ void BookmarkManager::operateTooltip(TextEditor::ITextEditor *textEditor, const if (!mark) return; - if (mark->note().isEmpty()) { + if (mark->note().isEmpty()) TextEditor::ToolTip::instance()->hide(); - } else { + else TextEditor::ToolTip::instance()->show(pos, TextEditor::TextContent(mark->note()), textEditor->widget()); - } } /* Loads the bookmarks from the session settings. */ diff --git a/src/plugins/classview/classviewutils.cpp b/src/plugins/classview/classviewutils.cpp index 6ccd6807a9..06afcf5dc6 100644 --- a/src/plugins/classview/classviewutils.cpp +++ b/src/plugins/classview/classviewutils.cpp @@ -82,9 +82,8 @@ QSet<SymbolLocation> Utils::roleToLocations(const QList<QVariant> &locationsVar) { QSet<SymbolLocation> locations; foreach (const QVariant &loc, locationsVar) { - if (loc.canConvert<SymbolLocation>()) { + if (loc.canConvert<SymbolLocation>()) locations.insert(loc.value<SymbolLocation>()); - } } return locations; diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp index b29e49334d..6f8cf4541c 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp @@ -260,9 +260,8 @@ ProjectExplorer::BuildConfiguration::BuildType CMakeBuildConfiguration::buildTyp while (!cmakeCache.atEnd()) { QByteArray line = cmakeCache.readLine(); if (line.startsWith("CMAKE_BUILD_TYPE")) { - if (int pos = line.indexOf('=')) { + if (int pos = line.indexOf('=')) cmakeBuildType = QString::fromLocal8Bit(line.mid(pos + 1).trimmed()); - } break; } } diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index eda0b03100..94f8b827b4 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -284,9 +284,8 @@ bool CMakeProject::parseCMakeLists() while (!cmakeCache.atEnd()) { QByteArray line = cmakeCache.readLine(); if (line.startsWith("QT_UIC_EXECUTABLE")) { - if (int pos = line.indexOf('=')) { + if (int pos = line.indexOf('=')) m_uicCommand = QString::fromLocal8Bit(line.mid(pos + 1).trimmed()); - } break; } } @@ -977,11 +976,10 @@ bool CMakeCbpParser::parseCbpFile(const QString &fileName) while (!atEnd()) { readNext(); - if (name() == QLatin1String("CodeBlocks_project_file")) { + if (name() == QLatin1String("CodeBlocks_project_file")) parseCodeBlocks_project_file(); - } else if (isStartElement()) { + else if (isStartElement()) parseUnknownElement(); - } } fi.close(); m_includeFiles.sort(); @@ -995,13 +993,12 @@ void CMakeCbpParser::parseCodeBlocks_project_file() { while (!atEnd()) { readNext(); - if (isEndElement()) { + if (isEndElement()) return; - } else if (name() == QLatin1String("Project")) { + else if (name() == QLatin1String("Project")) parseProject(); - } else if (isStartElement()) { + else if (isStartElement()) parseUnknownElement(); - } } } @@ -1009,17 +1006,16 @@ void CMakeCbpParser::parseProject() { while (!atEnd()) { readNext(); - if (isEndElement()) { + if (isEndElement()) return; - } else if (name() == QLatin1String("Option")) { + else if (name() == QLatin1String("Option")) parseOption(); - } else if (name() == QLatin1String("Unit")) { + else if (name() == QLatin1String("Unit")) parseUnit(); - } else if (name() == QLatin1String("Build")) { + else if (name() == QLatin1String("Build")) parseBuild(); - } else if (isStartElement()) { + else if (isStartElement()) parseUnknownElement(); - } } } @@ -1027,13 +1023,12 @@ void CMakeCbpParser::parseBuild() { while (!atEnd()) { readNext(); - if (isEndElement()) { + if (isEndElement()) return; - } else if (name() == QLatin1String("Target")) { + else if (name() == QLatin1String("Target")) parseBuildTarget(); - } else if (isStartElement()) { + else if (isStartElement()) parseUnknownElement(); - } } } @@ -1047,9 +1042,8 @@ void CMakeCbpParser::parseBuildTarget() while (!atEnd()) { readNext(); if (isEndElement()) { - if (m_buildTargetType || m_buildTarget.title == QLatin1String("all") || m_buildTarget.title == QLatin1String("install")) { + if (m_buildTargetType || m_buildTarget.title == QLatin1String("all") || m_buildTarget.title == QLatin1String("install")) m_buildTargets.append(m_buildTarget); - } return; } else if (name() == QLatin1String("Compiler")) { parseCompiler(); @@ -1079,13 +1073,12 @@ void CMakeCbpParser::parseBuildTargetOption() } while (!atEnd()) { readNext(); - if (isEndElement()) { + if (isEndElement()) return; - } else if (name() == QLatin1String("MakeCommand")) { + else if (name() == QLatin1String("MakeCommand")) parseMakeCommand(); - } else if (isStartElement()) { + else if (isStartElement()) parseUnknownElement(); - } } } @@ -1104,11 +1097,10 @@ void CMakeCbpParser::parseOption() while (!atEnd()) { readNext(); - if (isEndElement()) { + if (isEndElement()) return; - } else if (isStartElement()) { + else if (isStartElement()) parseUnknownElement(); - } } } @@ -1116,15 +1108,14 @@ void CMakeCbpParser::parseMakeCommand() { while (!atEnd()) { readNext(); - if (isEndElement()) { + if (isEndElement()) return; - } else if (name() == QLatin1String("Build")) { + else if (name() == QLatin1String("Build")) parseBuildTargetBuild(); - } else if (name() == QLatin1String("Clean")) { + else if (name() == QLatin1String("Clean")) parseBuildTargetClean(); - } else if (isStartElement()) { + else if (isStartElement()) parseUnknownElement(); - } } } @@ -1134,11 +1125,10 @@ void CMakeCbpParser::parseBuildTargetBuild() m_buildTarget.makeCommand = attributes().value(QLatin1String("command")).toString(); while (!atEnd()) { readNext(); - if (isEndElement()) { + if (isEndElement()) return; - } else if (isStartElement()) { + else if (isStartElement()) parseUnknownElement(); - } } } @@ -1148,11 +1138,10 @@ void CMakeCbpParser::parseBuildTargetClean() m_buildTarget.makeCleanCommand = attributes().value(QLatin1String("command")).toString(); while (!atEnd()) { readNext(); - if (isEndElement()) { + if (isEndElement()) return; - } else if (isStartElement()) { + else if (isStartElement()) parseUnknownElement(); - } } } @@ -1160,13 +1149,12 @@ void CMakeCbpParser::parseCompiler() { while (!atEnd()) { readNext(); - if (isEndElement()) { + if (isEndElement()) return; - } else if (name() == QLatin1String("Add")) { + else if (name() == QLatin1String("Add")) parseAdd(); - } else if (isStartElement()) { + else if (isStartElement()) parseUnknownElement(); - } } } @@ -1177,9 +1165,8 @@ void CMakeCbpParser::parseAdd() const QString includeDirectory = addAttributes.value(QLatin1String("directory")).toString(); // allow adding multiple times because order happens - if (!includeDirectory.isEmpty()) { + if (!includeDirectory.isEmpty()) m_includeFiles.append(includeDirectory); - } QString compilerOption = addAttributes.value(QLatin1String("option")).toString(); // defining multiple times a macro to the same value makes no sense @@ -1188,9 +1175,8 @@ void CMakeCbpParser::parseAdd() int macroNameIndex = compilerOption.indexOf(QLatin1String("-D")) + 2; if (macroNameIndex != 1) { int assignIndex = compilerOption.indexOf(QLatin1Char('='), macroNameIndex); - if (assignIndex != -1) { + if (assignIndex != -1) compilerOption[assignIndex] = ' '; - } m_defines.append("#define "); m_defines.append(compilerOption.mid(macroNameIndex).toLatin1()); m_defines.append('\n'); @@ -1199,11 +1185,10 @@ void CMakeCbpParser::parseAdd() while (!atEnd()) { readNext(); - if (isEndElement()) { + if (isEndElement()) return; - } else if (isStartElement()) { + else if (isStartElement()) parseUnknownElement(); - } } } diff --git a/src/plugins/cmakeprojectmanager/cmakevalidator.cpp b/src/plugins/cmakeprojectmanager/cmakevalidator.cpp index 39c05d0bb5..61f8c7fcbf 100644 --- a/src/plugins/cmakeprojectmanager/cmakevalidator.cpp +++ b/src/plugins/cmakeprojectmanager/cmakevalidator.cpp @@ -180,17 +180,15 @@ static void extractKeywords(const QByteArray &input, QStringList *destination) keyword += chr; } else { if (!keyword.isEmpty()) { - if (keyword.size() > 1) { + if (keyword.size() > 1) *destination << keyword; - } keyword.clear(); } } } } - if (keyword.size() > 1) { + if (keyword.size() > 1) *destination << keyword; - } } void CMakeValidator::parseFunctionOutput(const QByteArray &output) diff --git a/src/plugins/coreplugin/actionmanager/command.cpp b/src/plugins/coreplugin/actionmanager/command.cpp index 07a2f0d67a..7f5b117b39 100644 --- a/src/plugins/coreplugin/actionmanager/command.cpp +++ b/src/plugins/coreplugin/actionmanager/command.cpp @@ -462,11 +462,10 @@ void Action::removeOverrideAction(QAction *action) QMutableMapIterator<int, QPointer<QAction> > it(m_contextActionMap); while (it.hasNext()) { it.next(); - if (it.value() == 0) { + if (it.value() == 0) it.remove(); - } else if (it.value() == action) { + else if (it.value() == action) it.remove(); - } } setCurrentContext(m_context); } diff --git a/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp b/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp index bf5d8db822..c318c450a1 100644 --- a/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp +++ b/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp @@ -181,9 +181,8 @@ QModelIndex ExternalToolModel::index(int row, int column, const QModelIndex &par QString category = categoryForIndex(parent, &found); if (found) { QList<ExternalTool *> items = m_tools.value(category); - if (row < items.count()) { + if (row < items.count()) return createIndex(row, 0, items.at(row)); - } } } else if (column == 0 && row < m_tools.keys().count()) { return createIndex(row, 0); @@ -210,14 +209,12 @@ int ExternalToolModel::rowCount(const QModelIndex &parent) const { if (!parent.isValid()) return m_tools.keys().count(); - if (toolForIndex(parent)) { + if (toolForIndex(parent)) return 0; - } bool found; QString category = categoryForIndex(parent, &found); - if (found) { + if (found) return m_tools.value(category).count(); - } return 0; } diff --git a/src/plugins/coreplugin/dialogs/newdialog.cpp b/src/plugins/coreplugin/dialogs/newdialog.cpp index 8549416ce4..67f90b4f2d 100644 --- a/src/plugins/coreplugin/dialogs/newdialog.cpp +++ b/src/plugins/coreplugin/dialogs/newdialog.cpp @@ -262,9 +262,8 @@ void NewDialog::setWizards(QList<IWizard*> wizards) parentItem->appendRow(projectKindItem); parentItem->appendRow(filesClassesKindItem); - if (m_dummyIcon.isNull()) { + if (m_dummyIcon.isNull()) m_dummyIcon = QIcon(QLatin1String(Core::Constants::ICON_NEWFILE)); - } QStringList availablePlatforms = IWizard::allAvailablePlatforms(); @@ -312,9 +311,8 @@ Core::IWizard *NewDialog::showDialog() if (!lastCategory.isEmpty()) foreach (QStandardItem* item, m_categoryItems) { - if (item->data(Qt::UserRole) == lastCategory) { + if (item->data(Qt::UserRole) == lastCategory) idx = m_twoLevelProxyModel->mapToSource(m_model->indexFromItem(item)); - } } if (!idx.isValid()) idx = m_twoLevelProxyModel->index(0,0, m_twoLevelProxyModel->index(0,0)); @@ -390,11 +388,10 @@ void NewDialog::addItem(QStandardItem *topLEvelCategoryItem, IWizard *wizard) QIcon wizardIcon; // spacing hack. Add proper icons instead - if (wizard->icon().isNull()) { + if (wizard->icon().isNull()) wizardIcon = m_dummyIcon; - } else { + else wizardIcon = wizard->icon(); - } wizardItem->setIcon(wizardIcon); wizardItem->setData(QVariant::fromValue(WizardContainer(wizard, 0)), Qt::UserRole); wizardItem->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable); diff --git a/src/plugins/coreplugin/dialogs/promptoverwritedialog.cpp b/src/plugins/coreplugin/dialogs/promptoverwritedialog.cpp index e1ff3f52ed..f594647d73 100644 --- a/src/plugins/coreplugin/dialogs/promptoverwritedialog.cpp +++ b/src/plugins/coreplugin/dialogs/promptoverwritedialog.cpp @@ -127,11 +127,10 @@ void PromptOverwriteDialog::setFileEnabled(const QString &f, bool e) { if (QStandardItem *item = itemForFile(f)) { Qt::ItemFlags flags = item->flags(); - if (e) { + if (e) flags |= Qt::ItemIsEnabled; - } else { + else flags &= ~Qt::ItemIsEnabled; - } item->setFlags(flags); } } diff --git a/src/plugins/coreplugin/documentmanager.cpp b/src/plugins/coreplugin/documentmanager.cpp index 292b31fb6e..59bd39936a 100644 --- a/src/plugins/coreplugin/documentmanager.cpp +++ b/src/plugins/coreplugin/documentmanager.cpp @@ -244,10 +244,9 @@ static void addFileInfo(const QString &fileName, IDocument *document, bool isLin state.modified = fi.lastModified(); state.permissions = fi.permissions(); // Add watcher if we don't have that already - if (!d->m_states.contains(fileName)) { + if (!d->m_states.contains(fileName)) d->m_states.insert(fileName, FileState()); - } QFileSystemWatcher *watcher = 0; if (isLink) watcher = d->linkWatcher(); @@ -860,9 +859,8 @@ void DocumentManager::changedFile(const QString &fileName) if (d->m_states.contains(fileName)) d->m_changedFiles.insert(fileName); - if (wasempty && !d->m_changedFiles.isEmpty()) { + if (wasempty && !d->m_changedFiles.isEmpty()) QTimer::singleShot(200, this, SLOT(checkForReload())); - } } void DocumentManager::mainWindowActivated() @@ -963,11 +961,10 @@ void DocumentManager::checkForReload() // find out the type IDocument::ChangeType fileChange = changeTypes.value(fileName); - if (fileChange == IDocument::TypeRemoved) { + if (fileChange == IDocument::TypeRemoved) type = IDocument::TypeRemoved; - } else if (fileChange == IDocument::TypeContents && type == IDocument::TypePermissions) { + else if (fileChange == IDocument::TypeContents && type == IDocument::TypePermissions) type = IDocument::TypeContents; - } } if (!changed) // probably because the change was blocked with (un)blockFileChange diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 9b07cd92d8..64ede70b75 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -506,11 +506,10 @@ void EditorManager::handleContextChange(Core::IContext *context) if (debugEditorManager) qDebug() << Q_FUNC_INFO; IEditor *editor = context ? qobject_cast<IEditor*>(context) : 0; - if (editor) { + if (editor) setCurrentEditor(editor); - } else { + else updateActions(); - } } void EditorManager::setCurrentEditor(IEditor *editor, bool ignoreNavigationHistory) @@ -645,9 +644,8 @@ void EditorManager::closeView(Core::Internal::EditorView *view) */ if (!d->m_editorModel->isDuplicate(e)) { QList<IEditor *> duplicates = d->m_editorModel->duplicatesFor(e); - if (!duplicates.isEmpty()) { + if (!duplicates.isEmpty()) d->m_editorModel->makeOriginal(duplicates.first()); - } } } @@ -665,11 +663,10 @@ void EditorManager::closeView(Core::Internal::EditorView *view) SplitterOrView *newCurrent = splitter->findFirstView(); if (newCurrent) { - if (IEditor *e = newCurrent->editor()) { + if (IEditor *e = newCurrent->editor()) activateEditor(newCurrent->view(), e); - } else { + else setCurrentView(newCurrent); - } } } @@ -680,9 +677,8 @@ QList<IEditor*> QSet<IEditor *> found; foreach (IDocument *document, documents) { foreach (IEditor *editor, editors) { - if (editor->document() == document && !found.contains(editor)) { + if (editor->document() == document && !found.contains(editor)) found << editor; - } } } return found.toList(); @@ -1045,9 +1041,8 @@ Core::IEditor *EditorManager::placeEditor(Core::Internal::EditorView *view, Core view->addEditor(editor); view->setCurrentEditor(editor); if (!sourceView->editor()) { - if (IEditor *replacement = pickUnusedEditor()) { + if (IEditor *replacement = pickUnusedEditor()) sourceView->view()->addEditor(replacement); - } } return editor; } else if (duplicateSupported) { @@ -1085,9 +1080,8 @@ Core::IEditor *EditorManager::activateEditor(Core::Internal::EditorView *view, C if (!(flags & NoActivate)) { setCurrentEditor(editor, (flags & IgnoreNavigationHistory)); - if (flags & ModeSwitch) { + if (flags & ModeSwitch) switchToPreferedMode(); - } if (isVisible()) editor->widget()->setFocus(); } @@ -1456,11 +1450,10 @@ IEditor *EditorManager::openEditorWithContents(const Id &editorId, QSet<QString> docnames; foreach (IEditor *editor, m_instance->openedEditors()) { QString name = editor->document()->fileName(); - if (name.isEmpty()) { + if (name.isEmpty()) name = editor->displayName(); - } else { + else name = QFileInfo(name).completeBaseName(); - } docnames << name; } @@ -1547,9 +1540,8 @@ bool EditorManager::saveDocument(IDocument *documentParam) success = DocumentManager::saveDocument(document); } - if (success) { + if (success) addDocumentToRecentFiles(document); - } return success; } @@ -1629,9 +1621,8 @@ bool EditorManager::saveDocumentAs(IDocument *documentParam) if (absoluteFilePath != document->fileName()) { // close existing editors for the new file name const QList<IEditor *> existList = editorsForFileName(absoluteFilePath); - if (!existList.isEmpty()) { + if (!existList.isEmpty()) closeEditors(existList, false); - } } const bool success = DocumentManager::saveDocument(document, absoluteFilePath); @@ -1720,9 +1711,8 @@ void EditorManager::updateWindowTitle() { QString windowTitle = tr("Qt Creator"); const QString dashSep = QLatin1String(" - "); - if (!d->m_titleAddition.isEmpty()) { + if (!d->m_titleAddition.isEmpty()) windowTitle.prepend(d->m_titleAddition + dashSep); - } IEditor *curEditor = currentEditor(); if (curEditor) { QString editorName = curEditor->displayName(); @@ -1896,9 +1886,8 @@ QList<IEditor*> EditorManager::visibleEditors() const } while (view && view != firstView); } } else { - if (d->m_splitter->editor()) { + if (d->m_splitter->editor()) editors.append(d->m_splitter->editor()); - } } return editors; } @@ -2029,11 +2018,10 @@ bool EditorManager::restoreState(const QByteArray &state) if (!fi.exists()) continue; QFileInfo rfi(autoSaveName(fileName)); - if (rfi.exists() && fi.lastModified() < rfi.lastModified()) { + if (rfi.exists() && fi.lastModified() < rfi.lastModified()) openEditor(fileName, Id(QString::fromUtf8(id))); - } else { + else d->m_editorModel->addRestoredEditor(fileName, displayName, Id(QString::fromUtf8(id))); - } } } diff --git a/src/plugins/coreplugin/editormanager/editorview.cpp b/src/plugins/coreplugin/editormanager/editorview.cpp index b5cdba267d..e23a863560 100644 --- a/src/plugins/coreplugin/editormanager/editorview.cpp +++ b/src/plugins/coreplugin/editormanager/editorview.cpp @@ -320,9 +320,8 @@ QRect EditorView::editorArea() const void EditorView::addCurrentPositionToNavigationHistory(IEditor *editor, const QByteArray &saveState) { - if (editor && editor != currentEditor()) { + if (editor && editor != currentEditor()) return; // we only save editor sate for the current editor, when the user interacts - } if (!editor) editor = currentEditor(); @@ -334,11 +333,10 @@ void EditorView::addCurrentPositionToNavigationHistory(IEditor *editor, const QB return; QByteArray state; - if (saveState.isNull()) { + if (saveState.isNull()) state = editor->saveState(); - } else { + else state = saveState; - } EditLocation location; location.document = document; @@ -606,9 +604,8 @@ SplitterOrView *SplitterOrView::findNextView(SplitterOrView *view) SplitterOrView *SplitterOrView::findNextView_helper(SplitterOrView *view, bool *found) { - if (*found && m_view) { + if (*found && m_view) return this; - } if (this == view) { *found = true; @@ -721,9 +718,8 @@ void SplitterOrView::unsplitAll_helper() ICore::editorManager()->emptyView(m_view); if (m_splitter) { for (int i = 0; i < m_splitter->count(); ++i) { - if (SplitterOrView *splitterOrView = qobject_cast<SplitterOrView*>(m_splitter->widget(i))) { + if (SplitterOrView *splitterOrView = qobject_cast<SplitterOrView*>(m_splitter->widget(i))) splitterOrView->unsplitAll_helper(); - } } } } diff --git a/src/plugins/coreplugin/editormanager/openeditorsmodel.cpp b/src/plugins/coreplugin/editormanager/openeditorsmodel.cpp index 90a0319a9e..1ba7c7a5d2 100644 --- a/src/plugins/coreplugin/editormanager/openeditorsmodel.cpp +++ b/src/plugins/coreplugin/editormanager/openeditorsmodel.cpp @@ -235,9 +235,8 @@ QList<OpenEditorsModel::Entry> OpenEditorsModel::restoredEditors() const { QList<Entry> result; for (int i = d->m_editors.count()-1; i >= 0; --i) { - if (!d->m_editors.at(i).editor) { + if (!d->m_editors.at(i).editor) result.append(d->m_editors.at(i)); - } } return result; } diff --git a/src/plugins/coreplugin/editormanager/openeditorsview.cpp b/src/plugins/coreplugin/editormanager/openeditorsview.cpp index 373c712bef..527f43c6fa 100644 --- a/src/plugins/coreplugin/editormanager/openeditorsview.cpp +++ b/src/plugins/coreplugin/editormanager/openeditorsview.cpp @@ -178,11 +178,10 @@ bool OpenEditorsWidget::eventFilter(QObject *obj, QEvent *event) void OpenEditorsWidget::handlePressed(const QModelIndex &index) { - if (index.column() == 0) { + if (index.column() == 0) activateEditor(index); - } else if (index.column() == 1) { + else if (index.column() == 1) m_delegate->pressedIndex = index; - } } void OpenEditorsWidget::handleClicked(const QModelIndex &index) diff --git a/src/plugins/coreplugin/editormanager/openeditorswindow.cpp b/src/plugins/coreplugin/editormanager/openeditorswindow.cpp index c583f974e4..b920107009 100644 --- a/src/plugins/coreplugin/editormanager/openeditorswindow.cpp +++ b/src/plugins/coreplugin/editormanager/openeditorswindow.cpp @@ -88,9 +88,8 @@ void OpenEditorsWindow::selectAndHide() void OpenEditorsWindow::setVisible(bool visible) { QWidget::setVisible(visible); - if (visible) { + if (visible) setFocus(); - } } bool OpenEditorsWindow::isCentering() diff --git a/src/plugins/coreplugin/editortoolbar.cpp b/src/plugins/coreplugin/editortoolbar.cpp index af2e5aa681..aa9132cb3d 100644 --- a/src/plugins/coreplugin/editortoolbar.cpp +++ b/src/plugins/coreplugin/editortoolbar.cpp @@ -337,9 +337,8 @@ void EditorToolBar::listContextMenu(QPoint pos) menu.addSeparator(); EditorManager::instance()->addNativeDirActions(&menu, index); QAction *result = menu.exec(d->m_editorList->mapToGlobal(pos)); - if (result == copyPath) { + if (result == copyPath) QApplication::clipboard()->setText(QDir::toNativeSeparators(fileName)); - } } void EditorToolBar::makeEditorWritable() diff --git a/src/plugins/coreplugin/externaltool.cpp b/src/plugins/coreplugin/externaltool.cpp index 58aa7b3ea4..2e522d60c2 100644 --- a/src/plugins/coreplugin/externaltool.cpp +++ b/src/plugins/coreplugin/externaltool.cpp @@ -441,9 +441,8 @@ ExternalTool * ExternalTool::createFromFile(const QString &fileName, QString *er if (!reader.fetch(absFileName, errorMessage)) return 0; ExternalTool *tool = ExternalTool::createFromXml(reader.data(), errorMessage, locale); - if (!tool) { + if (!tool) return 0; - } tool->m_fileName = absFileName; return tool; } @@ -624,9 +623,8 @@ void ExternalToolRunner::run() void ExternalToolRunner::started() { - if (!m_resolvedInput.isEmpty()) { + if (!m_resolvedInput.isEmpty()) m_process->write(m_resolvedInput.toLocal8Bit()); - } m_process->closeWriteChannel(); } @@ -637,9 +635,8 @@ void ExternalToolRunner::finished(int exitCode, QProcess::ExitStatus status) || m_tool->errorHandling() == ExternalTool::ReplaceSelection) { emit ExternalToolManager::instance()->replaceSelectionRequested(m_processOutput); } - if (m_tool->modifiesCurrentDocument()) { + if (m_tool->modifiesCurrentDocument()) DocumentManager::unexpectFileChange(m_expectedFileName); - } } ICore::messageManager()->printToOutputPane( tr("'%1' finished").arg(m_resolvedExecutable), false); @@ -661,11 +658,10 @@ void ExternalToolRunner::readStandardOutput() return; QByteArray data = m_process->readAllStandardOutput(); QString output = m_outputCodec->toUnicode(data.constData(), data.length(), &m_outputCodecState); - if (m_tool->outputHandling() == ExternalTool::ShowInPane) { + if (m_tool->outputHandling() == ExternalTool::ShowInPane) ICore::messageManager()->printToOutputPane(output, true); - } else if (m_tool->outputHandling() == ExternalTool::ReplaceSelection) { + else if (m_tool->outputHandling() == ExternalTool::ReplaceSelection) m_processOutput.append(output); - } } void ExternalToolRunner::readStandardError() @@ -674,11 +670,10 @@ void ExternalToolRunner::readStandardError() return; QByteArray data = m_process->readAllStandardError(); QString output = m_outputCodec->toUnicode(data.constData(), data.length(), &m_errorCodecState); - if (m_tool->errorHandling() == ExternalTool::ShowInPane) { + if (m_tool->errorHandling() == ExternalTool::ShowInPane) ICore::messageManager()->printToOutputPane(output, true); - } else if (m_tool->errorHandling() == ExternalTool::ReplaceSelection) { + else if (m_tool->errorHandling() == ExternalTool::ReplaceSelection) m_processOutput.append(output); - } } // #pragma mark -- ExternalToolManager @@ -777,9 +772,8 @@ void ExternalToolManager::menuActivated() ExternalTool *tool = m_tools.value(action->data().toString()); QTC_ASSERT(tool, return); ExternalToolRunner *runner = new ExternalToolRunner(tool); - if (runner->hasError()) { + if (runner->hasError()) ICore::messageManager()->printToOutputPane(runner->errorString(), true); - } } QMap<QString, QList<Internal::ExternalTool *> > ExternalToolManager::toolsByCategory() const @@ -839,11 +833,10 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<Internal: if (containerName.isEmpty()) { // no displayCategory, so put into external tools menu directly container = mexternaltools; } else { - if (m_containers.contains(containerName)) { + if (m_containers.contains(containerName)) container = m_containers.take(containerName); // remove to avoid deletion below - } else { + else container = ActionManager::createMenu(Id(QLatin1String("Tools.External.Category.") + containerName)); - } newContainers.insert(containerName, container); mexternaltools->addMenu(container, Constants::G_DEFAULT_ONE); container->menu()->setTitle(containerName); diff --git a/src/plugins/coreplugin/fancyactionbar.cpp b/src/plugins/coreplugin/fancyactionbar.cpp index 55d27244e7..e7cb2e912b 100644 --- a/src/plugins/coreplugin/fancyactionbar.cpp +++ b/src/plugins/coreplugin/fancyactionbar.cpp @@ -109,11 +109,10 @@ static QVector<QString> splitInTwoLines(const QString &text, const QFontMetrics nextSplitPos - text.length() - 1); if (nextSplitPos != -1) { int splitCandidate = nextSplitPos + rx.matchedLength(); - if (fontMetrics.width(text.mid(splitCandidate)) <= availableWidth) { + if (fontMetrics.width(text.mid(splitCandidate)) <= availableWidth) splitPos = splitCandidate; - } else { + else break; - } } } while (nextSplitPos > 0 && fontMetrics.width(text.left(nextSplitPos)) > availableWidth); // check if we could split at white space at all diff --git a/src/plugins/coreplugin/fileiconprovider.cpp b/src/plugins/coreplugin/fileiconprovider.cpp index e77b32c63a..51ddeac9b8 100644 --- a/src/plugins/coreplugin/fileiconprovider.cpp +++ b/src/plugins/coreplugin/fileiconprovider.cpp @@ -180,11 +180,10 @@ void FileIconProvider::registerIconOverlayForSuffix(const QIcon &icon, const QPixmap fileIconPixmap = overlayIcon(QStyle::SP_FileIcon, icon, QSize(16, 16)); // replace old icon, if it exists const CacheIterator it = findBySuffix(suffix, d->m_cache.begin(), d->m_cache.end()); - if (it == d->m_cache.end()) { + if (it == d->m_cache.end()) d->m_cache.append(StringIconPair(suffix, fileIconPixmap)); - } else { + else (*it).second = fileIconPixmap; - } } /*! diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index 23ef61f565..e4beec376e 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -430,11 +430,10 @@ static bool isDesktopFileManagerDrop(const QMimeData *d, QStringList *files = 0) const QString fileName = it->toLocalFile(); if (!fileName.isEmpty()) { hasFiles = true; - if (files) { + if (files) files->push_back(fileName); - } else { + else break; // No result list, sufficient for checking - } } } return hasFiles; @@ -442,11 +441,10 @@ static bool isDesktopFileManagerDrop(const QMimeData *d, QStringList *files = 0) void MainWindow::dragEnterEvent(QDragEnterEvent *event) { - if (isDesktopFileManagerDrop(event->mimeData()) && m_filesToOpenDelayed.isEmpty()) { + if (isDesktopFileManagerDrop(event->mimeData()) && m_filesToOpenDelayed.isEmpty()) event->accept(); - } else { + else event->ignore(); - } } void MainWindow::dropEvent(QDropEvent *event) @@ -992,11 +990,10 @@ void MainWindow::openFileWith() const Id editorId = editorManager()->getOpenWithEditorId(fileName, &isExternal); if (!editorId.isValid()) continue; - if (isExternal) { + if (isExternal) EditorManager::openExternalEditor(fileName, editorId); - } else { + else EditorManager::openEditor(fileName, editorId, Core::EditorManager::ModeSwitch); - } } } @@ -1178,9 +1175,8 @@ void MainWindow::readSettings() QColor(Utils::StyleHelper::DEFAULT_BASE_COLOR)).value<QColor>()); } - if (!restoreGeometry(m_settings->value(QLatin1String(windowGeometryKey)).toByteArray())) { + if (!restoreGeometry(m_settings->value(QLatin1String(windowGeometryKey)).toByteArray())) resize(1008, 700); // size without window decoration - } restoreState(m_settings->value(QLatin1String(windowStateKey)).toByteArray()); m_settings->endGroup(); diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp index 330f6576d3..b06e63eac5 100644 --- a/src/plugins/coreplugin/manhattanstyle.cpp +++ b/src/plugins/coreplugin/manhattanstyle.cpp @@ -865,9 +865,8 @@ void ManhattanStyle::drawComplexControl(ComplexControl control, const QStyleOpti State bflags = toolbutton->state; if (bflags & State_AutoRaise) { - if (!(bflags & State_MouseOver)) { + if (!(bflags & State_MouseOver)) bflags &= ~State_Raised; - } } State mflags = bflags; diff --git a/src/plugins/coreplugin/mimedatabase.cpp b/src/plugins/coreplugin/mimedatabase.cpp index 95ddaf091d..c5d8c64dae 100644 --- a/src/plugins/coreplugin/mimedatabase.cpp +++ b/src/plugins/coreplugin/mimedatabase.cpp @@ -1073,11 +1073,10 @@ bool BaseMimeTypeParser::parse(QIODevice *dev, const QString &fileName, QString switch (ps) { case ParseMimeType: { // start parsing a type const QString type = atts.value(QLatin1String(mimeTypeAttributeC)).toString(); - if (type.isEmpty()) { + if (type.isEmpty()) reader.raiseError(QString::fromLatin1("Missing 'type'-attribute")); - } else { + else data.type = type; - } } break; case ParseGlobPattern: @@ -1094,11 +1093,10 @@ bool BaseMimeTypeParser::parse(QIODevice *dev, const QString &fileName, QString // comments have locale attributes. We want the default, English one QString locale = atts.value(QLatin1String(localeAttributeC)).toString(); const QString comment = QCoreApplication::translate("MimeType", reader.readElementText().toLatin1()); - if (locale.isEmpty()) { + if (locale.isEmpty()) data.comment = comment; - } else { + else data.localeComments.insert(locale, comment); - } } break; case ParseAlias: { @@ -1467,11 +1465,10 @@ MimeType MimeDatabasePrivate::findByFile(const QFileInfo &f) const qDebug() << '>' << Q_FUNC_INFO << f.absoluteFilePath(); const MimeType rc = findByFile(f, &priority); if (debugMimeDB) { - if (rc) { + if (rc) qDebug() << "<MimeDatabase::findByFile: match prio=" << priority << rc.type(); - } else { + else qDebug() << "<MimeDatabase::findByFile: no match"; - } } return rc; } @@ -1536,11 +1533,10 @@ MimeType MimeDatabasePrivate::findByData(const QByteArray &data) const qDebug() << '>' << Q_FUNC_INFO << data.left(20).toHex(); const MimeType rc = findByData(data, &priority); if (debugMimeDB) { - if (rc) { + if (rc) qDebug() << "<MimeDatabase::findByData: match prio=" << priority << rc.type(); - } else { + else qDebug() << "<MimeDatabase::findByData: no match"; - } } return rc; } diff --git a/src/plugins/coreplugin/navigationwidget.cpp b/src/plugins/coreplugin/navigationwidget.cpp index a127d7d4ef..5c6fcb86b8 100644 --- a/src/plugins/coreplugin/navigationwidget.cpp +++ b/src/plugins/coreplugin/navigationwidget.cpp @@ -420,9 +420,8 @@ void NavigationWidget::setSuppressed(bool b) int NavigationWidget::factoryIndex(const Id &id) { for (int row = 0; row < d->m_factoryModel->rowCount(); ++row) { - if (d->m_factoryModel->data(d->m_factoryModel->index(row, 0), FactoryIdRole).value<Core::Id>() == id) { + if (d->m_factoryModel->data(d->m_factoryModel->index(row, 0), FactoryIdRole).value<Core::Id>() == id) return row; - } } return -1; } diff --git a/src/plugins/coreplugin/outputpanemanager.cpp b/src/plugins/coreplugin/outputpanemanager.cpp index 07b36544bd..868a35cc0f 100644 --- a/src/plugins/coreplugin/outputpanemanager.cpp +++ b/src/plugins/coreplugin/outputpanemanager.cpp @@ -317,11 +317,10 @@ void OutputPaneManager::shortcutTriggered() // then just give it focus. int current = currentIndex(); if (OutputPanePlaceHolder::isCurrentVisible() && current == idx) { - if (!outputPane->hasFocus() && outputPane->canFocus()) { + if (!outputPane->hasFocus() && outputPane->canFocus()) outputPane->setFocus(); - } else { + else slotHide(); - } } else { // Else do the same as clicking on the button does. buttonTriggered(idx); diff --git a/src/plugins/coreplugin/outputwindow.cpp b/src/plugins/coreplugin/outputwindow.cpp index f9dc33858f..bbbb9e118f 100644 --- a/src/plugins/coreplugin/outputwindow.cpp +++ b/src/plugins/coreplugin/outputwindow.cpp @@ -174,9 +174,8 @@ void OutputWindow::setFormatter(OutputFormatter *formatter) void OutputWindow::showEvent(QShowEvent *e) { QPlainTextEdit::showEvent(e); - if (m_scrollToBottom) { + if (m_scrollToBottom) verticalScrollBar()->setValue(verticalScrollBar()->maximum()); - } m_scrollToBottom = false; } diff --git a/src/plugins/coreplugin/progressmanager/futureprogress.cpp b/src/plugins/coreplugin/progressmanager/futureprogress.cpp index df7780ff91..056549f211 100644 --- a/src/plugins/coreplugin/progressmanager/futureprogress.cpp +++ b/src/plugins/coreplugin/progressmanager/futureprogress.cpp @@ -247,11 +247,10 @@ void FutureProgress::setFinished() d->m_progress->setFinished(true); - if (d->m_watcher.future().isCanceled()) { + if (d->m_watcher.future().isCanceled()) d->m_progress->setError(true); - } else { + else d->m_progress->setError(false); - } emit finished(); d->tryToFadeAway(); } @@ -363,15 +362,13 @@ QString FutureProgress::type() const void FutureProgress::setKeepOnFinish(KeepOnFinishType keepType) { - if (d->m_keep == keepType) { + if (d->m_keep == keepType) return; - } d->m_keep = keepType; //if it is not finished tryToFadeAway is called by setFinished at the end - if (d->m_watcher.isFinished()) { + if (d->m_watcher.isFinished()) d->tryToFadeAway(); - } } bool FutureProgress::keepOnFinish() const diff --git a/src/plugins/coreplugin/progressmanager/progressmanager.cpp b/src/plugins/coreplugin/progressmanager/progressmanager.cpp index 5ba52283fd..42cd0a35ac 100644 --- a/src/plugins/coreplugin/progressmanager/progressmanager.cpp +++ b/src/plugins/coreplugin/progressmanager/progressmanager.cpp @@ -272,9 +272,8 @@ void ProgressManagerPrivate::cancelTasks(const QString &type) delete task.key(); task = m_runningTasks.erase(task); } - if (found) { + if (found) emit allTasksFinished(type); - } } void ProgressManagerPrivate::cancelAllRunningTasks() @@ -330,9 +329,8 @@ void ProgressManagerPrivate::taskFinished() m_runningTasks.remove(task); delete task; - if (!m_runningTasks.key(type, 0)) { + if (!m_runningTasks.key(type, 0)) emit allTasksFinished(type); - } } void ProgressManagerPrivate::disconnectApplicationTask() diff --git a/src/plugins/coreplugin/progressmanager/progressview.cpp b/src/plugins/coreplugin/progressmanager/progressview.cpp index b5c3cd9444..2cd6678d66 100644 --- a/src/plugins/coreplugin/progressmanager/progressview.cpp +++ b/src/plugins/coreplugin/progressmanager/progressview.cpp @@ -69,11 +69,10 @@ FutureProgress *ProgressView::addTask(const QFuture<void> &future, m_layout->insertWidget(0, progress); m_taskList.append(progress); progress->setType(type); - if (flags.testFlag(ProgressManager::KeepOnFinish)) { + if (flags.testFlag(ProgressManager::KeepOnFinish)) progress->setKeepOnFinish(FutureProgress::KeepOnFinishTillUserInteraction); - } else { + else progress->setKeepOnFinish(FutureProgress::HideOnFinish); - } connect(progress, SIGNAL(removeMe()), this, SLOT(slotRemoveTask())); return progress; } diff --git a/src/plugins/coreplugin/rightpane.cpp b/src/plugins/coreplugin/rightpane.cpp index 7e618f47d7..e3fbc753db 100644 --- a/src/plugins/coreplugin/rightpane.cpp +++ b/src/plugins/coreplugin/rightpane.cpp @@ -176,11 +176,10 @@ void RightPaneWidget::saveSettings(QSettings *settings) void RightPaneWidget::readSettings(QSettings *settings) { - if (settings->contains(QLatin1String("RightPane/Visible"))) { + if (settings->contains(QLatin1String("RightPane/Visible"))) setShown(settings->value(QLatin1String("RightPane/Visible")).toBool()); - } else { + else setShown(false); - } if (settings->contains(QLatin1String("RightPane/Width"))) { m_width = settings->value(QLatin1String("RightPane/Width")).toInt(); @@ -190,9 +189,8 @@ void RightPaneWidget::readSettings(QSettings *settings) m_width = 500; //pixel } // Apply - if (RightPanePlaceHolder::m_current) { + if (RightPanePlaceHolder::m_current) RightPanePlaceHolder::m_current->applyStoredSize(m_width); - } } void RightPaneWidget::setShown(bool b) diff --git a/src/plugins/coreplugin/settingsdatabase.cpp b/src/plugins/coreplugin/settingsdatabase.cpp index 7c23101ef6..dcdaef9215 100644 --- a/src/plugins/coreplugin/settingsdatabase.cpp +++ b/src/plugins/coreplugin/settingsdatabase.cpp @@ -244,9 +244,8 @@ QStringList SettingsDatabase::childKeys() const QMapIterator<QString, QVariant> i(d->m_settings); while (i.hasNext()) { const QString &key = i.next().key(); - if (key.startsWith(g) && key.indexOf(QLatin1Char('/'), g.length() + 1) == -1) { + if (key.startsWith(g) && key.indexOf(QLatin1Char('/'), g.length() + 1) == -1) children.append(key.mid(g.length() + 1)); - } } return children; diff --git a/src/plugins/coreplugin/styleanimator.cpp b/src/plugins/coreplugin/styleanimator.cpp index 5db0e0d8e6..e237cf99ab 100644 --- a/src/plugins/coreplugin/styleanimator.cpp +++ b/src/plugins/coreplugin/styleanimator.cpp @@ -128,9 +128,8 @@ void StyleAnimator::timerEvent(QTimerEvent *) delete a; } } - if (animations.size() == 0 && animationTimer.isActive()) { + if (animations.size() == 0 && animationTimer.isActive()) animationTimer.stop(); - } } void StyleAnimator::stopAnimation(const QWidget *w) @@ -148,7 +147,6 @@ void StyleAnimator::startAnimation(Animation *t) { stopAnimation(t->widget()); animations.append(t); - if (animations.size() > 0 && !animationTimer.isActive()) { + if (animations.size() > 0 && !animationTimer.isActive()) animationTimer.start(35, this); - } } diff --git a/src/plugins/coreplugin/toolsettings.cpp b/src/plugins/coreplugin/toolsettings.cpp index 06c41302c6..a00ea33f78 100644 --- a/src/plugins/coreplugin/toolsettings.cpp +++ b/src/plugins/coreplugin/toolsettings.cpp @@ -67,9 +67,8 @@ QWidget *ToolSettings::createPage(QWidget *parent) { m_widget = new ExternalToolConfig(parent); m_widget->setTools(ExternalToolManager::instance()->toolsByCategory()); - if (m_searchKeywords.isEmpty()) { + if (m_searchKeywords.isEmpty()) m_searchKeywords = m_widget->searchKeywords(); - } return m_widget; } @@ -151,9 +150,8 @@ void ToolSettings::apply() ExternalTool *toolToAdd = 0; if (ExternalTool *originalTool = originalTools.take(tool->id())) { // check if it has different category and is custom tool - if (tool->displayCategory() != it.key() && !tool->preset()) { + if (tool->displayCategory() != it.key() && !tool->preset()) tool->setDisplayCategory(it.key()); - } // check if the tool has changed if ((*originalTool) == (*tool)) { toolToAdd = originalTool; diff --git a/src/plugins/coreplugin/variablechooser.cpp b/src/plugins/coreplugin/variablechooser.cpp index bfe806fcd0..5a9bbab6d9 100644 --- a/src/plugins/coreplugin/variablechooser.cpp +++ b/src/plugins/coreplugin/variablechooser.cpp @@ -111,13 +111,12 @@ void VariableChooser::updateCurrentEditor(QWidget *old, QWidget *widget) QVariant variablesSupportProperty = widget->property(Constants::VARIABLE_SUPPORT_PROPERTY); bool supportsVariables = (variablesSupportProperty.isValid() ? variablesSupportProperty.toBool() : false); - if (QLineEdit *lineEdit = qobject_cast<QLineEdit *>(widget)) { + if (QLineEdit *lineEdit = qobject_cast<QLineEdit *>(widget)) m_lineEdit = (supportsVariables ? lineEdit : 0); - } else if (QTextEdit *textEdit = qobject_cast<QTextEdit *>(widget)) { + else if (QTextEdit *textEdit = qobject_cast<QTextEdit *>(widget)) m_textEdit = (supportsVariables ? textEdit : 0); - } else if (QPlainTextEdit *plainTextEdit = qobject_cast<QPlainTextEdit *>(widget)) { + else if (QPlainTextEdit *plainTextEdit = qobject_cast<QPlainTextEdit *>(widget)) m_plainTextEdit = (supportsVariables ? plainTextEdit : 0); - } if (!(m_lineEdit || m_textEdit || m_plainTextEdit)) hide(); if (m_lineEdit != previousLineEdit) { diff --git a/src/plugins/coreplugin/variablemanager.cpp b/src/plugins/coreplugin/variablemanager.cpp index 0de12e34d9..278de09fa6 100644 --- a/src/plugins/coreplugin/variablemanager.cpp +++ b/src/plugins/coreplugin/variablemanager.cpp @@ -97,9 +97,8 @@ bool VariableManager::remove(const QByteArray &variable) QString VariableManager::value(const QByteArray &variable, bool *found) { emit variableUpdateRequested(variable); - if (found) { + if (found) *found = d->m_map.contains(variable); - } return d->m_map.value(variable); } diff --git a/src/plugins/coreplugin/vcsmanager.cpp b/src/plugins/coreplugin/vcsmanager.cpp index 0077183746..87e4d3e66f 100644 --- a/src/plugins/coreplugin/vcsmanager.cpp +++ b/src/plugins/coreplugin/vcsmanager.cpp @@ -148,11 +148,10 @@ public: while (tmpDir.count() >= topLevel.count() && tmpDir.count() > 0) { m_cachedMatches.insert(tmpDir, newInfo); const int slashPos = tmpDir.lastIndexOf(slash); - if (slashPos >= 0) { + if (slashPos >= 0) tmpDir.truncate(slashPos); - } else { + else tmpDir.clear(); - } } } diff --git a/src/plugins/cpaster/fileshareprotocol.cpp b/src/plugins/cpaster/fileshareprotocol.cpp index 602ef3f121..f6503b112a 100644 --- a/src/plugins/cpaster/fileshareprotocol.cpp +++ b/src/plugins/cpaster/fileshareprotocol.cpp @@ -116,13 +116,12 @@ static bool parse(const QString &fileName, } // Parse elements elementCount++; - if (user && elementName == QLatin1String(userElementC)) { + if (user && elementName == QLatin1String(userElementC)) *user = reader.readElementText(); - } else if (description && elementName == QLatin1String(descriptionElementC)) { + else if (description && elementName == QLatin1String(descriptionElementC)) *description = reader.readElementText(); - } else if (text && elementName == QLatin1String(textElementC)) { + else if (text && elementName == QLatin1String(textElementC)) *text = reader.readElementText(); - } } } if (reader.hasError()) { @@ -151,11 +150,10 @@ void FileShareProtocol::fetch(const QString &id) fi = QFileInfo(m_settings->path + QLatin1Char('/') + id); QString errorMessage; QString text; - if (parse(fi.absoluteFilePath(), &errorMessage, 0, 0, &text)) { + if (parse(fi.absoluteFilePath(), &errorMessage, 0, 0, &text)) emit fetchDone(id, text, false); - } else { + else emit fetchDone(id, errorMessage, true); - } } void FileShareProtocol::list() diff --git a/src/plugins/cpaster/kdepasteprotocol.cpp b/src/plugins/cpaster/kdepasteprotocol.cpp index 82b03495f2..a57a3758eb 100644 --- a/src/plugins/cpaster/kdepasteprotocol.cpp +++ b/src/plugins/cpaster/kdepasteprotocol.cpp @@ -146,11 +146,10 @@ void KdePasteProtocol::pasteFinished() // Parse id from '<result><id>143204</id><hash></hash></result>' // No useful error reports have been observed. const QString id = parseElement(m_pasteReply, QLatin1String("id")); - if (id.isEmpty()) { + if (id.isEmpty()) qWarning("%s protocol error: Could not send entry.", qPrintable(protocolName())); - } else { + else emit pasteDone(QLatin1String(hostUrlC) + id); - } } m_pasteReply->deleteLater(); diff --git a/src/plugins/cpaster/pastebindotcaprotocol.cpp b/src/plugins/cpaster/pastebindotcaprotocol.cpp index b4ae5920ef..e7ddd3df1a 100644 --- a/src/plugins/cpaster/pastebindotcaprotocol.cpp +++ b/src/plugins/cpaster/pastebindotcaprotocol.cpp @@ -218,11 +218,10 @@ static inline QStringList parseLists(QIODevice *io) void PasteBinDotCaProtocol::listFinished() { const bool error = m_listReply->error(); - if (error) { + if (error) qWarning("pastebin.ca list failed: %s", qPrintable(m_listReply->errorString())); - } else { + else emit listDone(name(), parseLists(m_listReply)); - } m_listReply->deleteLater(); m_listReply = 0; } diff --git a/src/plugins/cpaster/pastebindotcomprotocol.cpp b/src/plugins/cpaster/pastebindotcomprotocol.cpp index 1d5d77b937..f38af7f4fb 100644 --- a/src/plugins/cpaster/pastebindotcomprotocol.cpp +++ b/src/plugins/cpaster/pastebindotcomprotocol.cpp @@ -130,11 +130,10 @@ void PasteBinDotComProtocol::paste(const QString &text, void PasteBinDotComProtocol::pasteFinished() { - if (m_pasteReply->error()) { + if (m_pasteReply->error()) qWarning("Pastebin.com protocol error: %s", qPrintable(m_pasteReply->errorString())); - } else { + else emit pasteDone(QString::fromLatin1(m_pasteReply->readAll())); - } m_pasteReply->deleteLater(); m_pasteReply = 0; diff --git a/src/plugins/cpaster/pasteview.cpp b/src/plugins/cpaster/pasteview.cpp index 160d35de87..4e7a95a1d0 100644 --- a/src/plugins/cpaster/pasteview.cpp +++ b/src/plugins/cpaster/pasteview.cpp @@ -207,11 +207,10 @@ void PasteView::setProtocol(const QString &protocol) { const int index = m_ui.protocolBox->findText(protocol); m_ui.protocolBox->setCurrentIndex(index); - if (index == m_ui.protocolBox->currentIndex()) { + if (index == m_ui.protocolBox->currentIndex()) protocolChanged(index); // Force enabling - } else { + else m_ui.protocolBox->setCurrentIndex(index); - } } } //namespace CodePaster diff --git a/src/plugins/cpaster/urlopenprotocol.cpp b/src/plugins/cpaster/urlopenprotocol.cpp index 6c75ae3d73..d86bcf0197 100644 --- a/src/plugins/cpaster/urlopenprotocol.cpp +++ b/src/plugins/cpaster/urlopenprotocol.cpp @@ -63,11 +63,10 @@ void UrlOpenProtocol::fetchFinished() const QString title = m_fetchReply->url().toString(); QString content; const bool error = m_fetchReply->error(); - if (error) { + if (error) content = m_fetchReply->errorString(); - } else { + else content = QString::fromUtf8(m_fetchReply->readAll()); - } m_fetchReply->deleteLater(); m_fetchReply = 0; emit fetchDone(title, content, error); diff --git a/src/plugins/cppeditor/cppcompleteswitch.cpp b/src/plugins/cppeditor/cppcompleteswitch.cpp index 687538c457..2174467e14 100644 --- a/src/plugins/cppeditor/cppcompleteswitch.cpp +++ b/src/plugins/cppeditor/cppcompleteswitch.cpp @@ -192,9 +192,8 @@ void CompleteSwitchCaseStatement::match(const CppQuickFixInterface &interface, Q QStringList values; Overview prettyPrint; for (unsigned i = 0; i < e->memberCount(); ++i) { - if (Declaration *decl = e->memberAt(i)->asDeclaration()) { + if (Declaration *decl = e->memberAt(i)->asDeclaration()) values << prettyPrint.prettyName(LookupContext::fullyQualifiedName(decl)); - } } // Get the used values Block *block = switchStatement->symbol; diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index 8d46a085fd..dce4273133 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -819,9 +819,8 @@ static QList<int> lazyFindReferences(Scope *scope, QString code, Document::Ptr d TypeOfExpression typeOfExpression; snapshot.insert(doc); typeOfExpression.init(doc, snapshot); - if (Symbol *canonicalSymbol = CanonicalSymbol::canonicalSymbol(scope, code, typeOfExpression)) { + if (Symbol *canonicalSymbol = CanonicalSymbol::canonicalSymbol(scope, code, typeOfExpression)) return CppModelManagerInterface::instance()->references(canonicalSymbol, typeOfExpression.context()); - } return QList<int>(); } @@ -1462,9 +1461,8 @@ CPPEditorWidget::Link CPPEditorWidget::findLinkAt(const QTextCursor &cursor, else { if (ch == QLatin1Char('(') && ! expression.isEmpty()) { tc.setPosition(pos); - if (TextEditor::TextBlockUserData::findNextClosingParenthesis(&tc, true)) { + if (TextEditor::TextBlockUserData::findNextClosingParenthesis(&tc, true)) expression.append(tc.selectedText()); - } } break; diff --git a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp index b55f6a3c7a..1ceb5e233c 100644 --- a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp +++ b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp @@ -147,12 +147,10 @@ static DeclaratorIdAST *getDeclaratorId(DeclaratorAST *declarator) { if (!declarator || !declarator->core_declarator) return 0; - if (DeclaratorIdAST *id = declarator->core_declarator->asDeclaratorId()) { + if (DeclaratorIdAST *id = declarator->core_declarator->asDeclaratorId()) return id; - } - if (NestedDeclaratorAST *nested = declarator->core_declarator->asNestedDeclarator()) { + if (NestedDeclaratorAST *nested = declarator->core_declarator->asNestedDeclarator()) return getDeclaratorId(nested->declarator); - } return 0; } @@ -174,9 +172,8 @@ static QSharedPointer<FunctionDeclDefLink> findLinkHelper(QSharedPointer<Functio } else if (link->sourceDeclaration->asSimpleDeclaration()) { target = finder.findMatchingDefinition(link->sourceFunctionDeclarator->symbol, snapshot, true); } - if (!target) { + if (!target) return noResult; - } // parse the target file to get the linked decl/def const QString targetFileName = QString::fromUtf8( @@ -420,9 +417,8 @@ static bool hasCommentedName( return false; ParameterDeclarationAST *param = list->value; - if (param->symbol && param->symbol->name()) { + if (param->symbol && param->symbol->name()) return false; - } // maybe in a comment but in the right spot? int nameStart = 0; @@ -441,9 +437,8 @@ static bool hasCommentedName( QString text = source.mid(nameStart, nameEnd - nameStart); - if (commentArgNameRegexp()->isEmpty()) { + if (commentArgNameRegexp()->isEmpty()) *commentArgNameRegexp() = QRegExp(QLatin1String("/\\*\\s*(\\w*)\\s*\\*/")); - } return commentArgNameRegexp()->indexIn(text) != -1; } @@ -538,9 +533,8 @@ static QString ensureCorrectParameterSpacing(const QString &text, bool isFirstPa ++firstNonSpace; return text.mid(firstNonSpace); } else { // ensure one leading space - if (text.isEmpty() || !text.at(0).isSpace()) { + if (text.isEmpty() || !text.at(0).isSpace()) return QLatin1Char(' ') + text; - } } return text; } @@ -966,11 +960,10 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ SimpleSpecifierAST *specifier = constSpecifier ? constSpecifier : volatileSpecifier; QTC_ASSERT(specifier, return changes); - if (!newFunction->isConst() && !newFunction->isVolatile()) { + if (!newFunction->isConst() && !newFunction->isVolatile()) changes.remove(targetFile->endOf(specifier->specifier_token - 1), targetFile->endOf(specifier)); - } else { + else changes.replace(targetFile->range(specifier), cvString); - } } } } diff --git a/src/plugins/cppeditor/cppinsertqtpropertymembers.cpp b/src/plugins/cppeditor/cppinsertqtpropertymembers.cpp index b6e824027c..985790a88f 100644 --- a/src/plugins/cppeditor/cppinsertqtpropertymembers.cpp +++ b/src/plugins/cppeditor/cppinsertqtpropertymembers.cpp @@ -103,13 +103,12 @@ void InsertQtPropertyMembers::match(const CppQuickFixInterface &interface, FullySpecifiedType type = member->type(); if (member->asFunction() || (type.isValid() && type->asFunctionType())) { const QString name = overview.prettyName(member->name()); - if (name == getterName) { + if (name == getterName) generateFlags &= ~GenerateGetter; - } else if (name == setterName) { + else if (name == setterName) generateFlags &= ~GenerateSetter; - } else if (name == signalName) { + else if (name == signalName) generateFlags &= ~GenerateSignal; - } } else if (member->asDeclaration()) { const QString name = overview.prettyName(member->name()); if (name == storageName) diff --git a/src/plugins/cppeditor/cppoutline.cpp b/src/plugins/cppeditor/cppoutline.cpp index db2b2e2d41..f136dab5ce 100644 --- a/src/plugins/cppeditor/cppoutline.cpp +++ b/src/plugins/cppeditor/cppoutline.cpp @@ -82,9 +82,8 @@ bool CppOutlineFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const { // ignore artifical "<Select Symbol>" entry - if (!sourceParent.isValid() && sourceRow == 0) { + if (!sourceParent.isValid() && sourceRow == 0) return false; - } // ignore generated symbols, e.g. by macro expansion (Q_OBJECT) const QModelIndex sourceIndex = m_sourceModel->index(sourceRow, 0, sourceParent); CPlusPlus::Symbol *symbol = m_sourceModel->symbolFromIndex(sourceIndex); diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index 7b48288286..b53457aaa9 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -520,9 +520,8 @@ private: if (a) b; becomes - if (a) { + if (a) b; - } Activates on: the if */ @@ -765,9 +764,8 @@ private: } with - if (something) { - if (something_else) { - } + if (something) + if (something_else) } and diff --git a/src/plugins/cpptools/cppchecksymbols.cpp b/src/plugins/cpptools/cppchecksymbols.cpp index 5ccd79f909..3e9d6bdcc1 100644 --- a/src/plugins/cpptools/cppchecksymbols.cpp +++ b/src/plugins/cpptools/cppchecksymbols.cpp @@ -665,11 +665,10 @@ bool CheckSymbols::visit(NewExpressionAST *ast) int arguments = 0; if (ast->new_initializer) { ExpressionListAST *list = 0; - if (ExpressionListParenAST *exprListParen = ast->new_initializer->asExpressionListParen()) { + if (ExpressionListParenAST *exprListParen = ast->new_initializer->asExpressionListParen()) list = exprListParen->expression_list; - } else if (BracedInitializerAST *braceInit = ast->new_initializer->asBracedInitializer()) { + else if (BracedInitializerAST *braceInit = ast->new_initializer->asBracedInitializer()) list = braceInit->expression_list; - } for (ExpressionListAST *it = list; it; it = it->next) ++arguments; } diff --git a/src/plugins/cpptools/cppcodeformatter.cpp b/src/plugins/cpptools/cppcodeformatter.cpp index 3e4eb5b8f2..df07e1f738 100644 --- a/src/plugins/cpptools/cppcodeformatter.cpp +++ b/src/plugins/cpptools/cppcodeformatter.cpp @@ -989,11 +989,10 @@ int CodeFormatter::column(int index) const const QChar tab = QLatin1Char('\t'); for (int i = 0; i < index; i++) { - if (m_currentLine[i] == tab) { + if (m_currentLine[i] == tab) col = ((col / m_tabSize) + 1) * m_tabSize; - } else { + else col++; - } } return col; } @@ -1328,9 +1327,8 @@ void QtStyleCodeFormatter::onEnter(int newState, int *indentDepth, int *savedInd *indentDepth += m_tabSettings.m_indentSize; } - if (followedByData) { + if (followedByData) *paddingDepth = nextTokenPosition-*indentDepth; - } break; } @@ -1483,11 +1481,10 @@ void QtStyleCodeFormatter::adjustIndent(const QList<CPlusPlus::Token> &tokens, i } else if ((topState.type == expression && previousState.type == declaration_start) || topState.type == member_init || topState.type == member_init_open) { // the declaration_start indent is the base - if (topState.type == member_init) { + if (topState.type == member_init) *indentDepth = state(2).savedIndentDepth; - } else { + else *indentDepth = previousState.savedIndentDepth; - } if (m_styleSettings.indentFunctionBraces) *indentDepth += m_tabSettings.m_indentSize; *paddingDepth = 0; diff --git a/src/plugins/cpptools/cppcodestylepreferences.cpp b/src/plugins/cpptools/cppcodestylepreferences.cpp index 2cb5da15c9..d617fb2439 100644 --- a/src/plugins/cpptools/cppcodestylepreferences.cpp +++ b/src/plugins/cpptools/cppcodestylepreferences.cpp @@ -71,9 +71,8 @@ void CppCodeStylePreferences::setCodeStyleSettings(const CppCodeStyleSettings &d v.setValue(data); emit valueChanged(v); emit codeStyleSettingsChanged(m_data); - if (!currentDelegate()) { + if (!currentDelegate()) emit currentValueChanged(v); - } } CppCodeStyleSettings CppCodeStylePreferences::currentCodeStyleSettings() const diff --git a/src/plugins/cpptools/cppcompletionassist.cpp b/src/plugins/cpptools/cppcompletionassist.cpp index 2bd533637c..7f7225dad8 100644 --- a/src/plugins/cpptools/cppcompletionassist.cpp +++ b/src/plugins/cpptools/cppcompletionassist.cpp @@ -264,9 +264,8 @@ void CppAssistProposalItem::applyContextualContent(TextEditor::BaseTextEditor *e #if 0 } else if (function->templateParameterCount() != 0 && typedChar != QLatin1Char('(')) { // If there are no arguments, then we need the template specification - if (function->argumentCount() == 0) { + if (function->argumentCount() == 0) extraChars += QLatin1Char('<'); - } #endif } else if (!isDereferenced(editor, basePosition) && ! function->isAmbiguous()) { // When the user typed the opening parenthesis, he'll likely also type the closing one, @@ -579,9 +578,8 @@ protected: virtual void visit(const Identifier *name) { _item = newCompletionItem(name); - if (!_symbol->isScope() || _symbol->isFunction()) { + if (!_symbol->isScope() || _symbol->isFunction()) _item->setDetail(overview.prettyType(_symbol->type(), name)); - } } virtual void visit(const TemplateNameId *name) @@ -1580,11 +1578,10 @@ void CppCompletionAssistProcessor::completeClass(CPlusPlus::ClassOrNamespace *b, continue; } - if (member->isPublic()) { + if (member->isPublic()) addCompletionItem(member, PublicClassMemberOrder); - } else { + else addCompletionItem(member); - } } } } @@ -1818,9 +1815,8 @@ bool CppCompletionAssistProcessor::completeConstructorOrFunction(const QList<CPl Symbol *overload = r.declaration(); FullySpecifiedType overloadTy = overload->type().simplified(); - if (Function *funTy = overloadTy->asFunctionType()) { + if (Function *funTy = overloadTy->asFunctionType()) functions.append(funTy); - } } } } diff --git a/src/plugins/cpptools/cppcurrentdocumentfilter.cpp b/src/plugins/cpptools/cppcurrentdocumentfilter.cpp index 867ab9e8e5..bfcce051ec 100644 --- a/src/plugins/cpptools/cppcurrentdocumentfilter.cpp +++ b/src/plugins/cpptools/cppcurrentdocumentfilter.cpp @@ -120,18 +120,16 @@ void CppCurrentDocumentFilter::refresh(QFutureInterface<void> &future) void CppCurrentDocumentFilter::onDocumentUpdated(Document::Ptr doc) { - if (m_currentFileName == doc->fileName()) { + if (m_currentFileName == doc->fileName()) m_itemsOfCurrentDoc.clear(); - } } void CppCurrentDocumentFilter::onCurrentEditorChanged(Core::IEditor * currentEditor) { - if (currentEditor) { + if (currentEditor) m_currentFileName = currentEditor->document()->fileName(); - } else { + else m_currentFileName.clear(); - } m_itemsOfCurrentDoc.clear(); } diff --git a/src/plugins/cpptools/cppdoxygen.cpp b/src/plugins/cpptools/cppdoxygen.cpp index 8e0feddb74..5787f258b0 100644 --- a/src/plugins/cpptools/cppdoxygen.cpp +++ b/src/plugins/cpptools/cppdoxygen.cpp @@ -266,66 +266,51 @@ const char *CppTools::doxygenTagSpell(int index) { return doxy_token_spell[index]; } static inline int classify1(const QChar *s) { - if (s[0].unicode() == 'a') { + if (s[0].unicode() == 'a') return T_DOXY_A; - } - else if (s[0].unicode() == 'b') { + else if (s[0].unicode() == 'b') return T_DOXY_B; - } - else if (s[0].unicode() == 'c') { + else if (s[0].unicode() == 'c') return T_DOXY_C; - } - else if (s[0].unicode() == 'e') { + else if (s[0].unicode() == 'e') return T_DOXY_E; - } - else if (s[0].unicode() == 'i') { + else if (s[0].unicode() == 'i') return T_DOXY_I; - } - else if (s[0].unicode() == 'l') { + else if (s[0].unicode() == 'l') return T_DOXY_L; - } - else if (s[0].unicode() == 'n') { + else if (s[0].unicode() == 'n') return T_DOXY_N; - } - else if (s[0].unicode() == 'o') { + else if (s[0].unicode() == 'o') return T_DOXY_O; - } - else if (s[0].unicode() == 'p') { + else if (s[0].unicode() == 'p') return T_DOXY_P; - } return T_DOXY_IDENTIFIER; } static inline int classify2(const QChar *s) { if (s[0].unicode() == 'e') { - if (s[1].unicode() == 'm') { + if (s[1].unicode() == 'm') return T_DOXY_EM; - } } else if (s[0].unicode() == 'f') { - if (s[1].unicode() == 'n') { + if (s[1].unicode() == 'n') return T_DOXY_FN; - } } else if (s[0].unicode() == 'i') { - if (s[1].unicode() == 'f') { + if (s[1].unicode() == 'f') return T_DOXY_IF; - } } else if (s[0].unicode() == 'l') { - if (s[1].unicode() == 'i') { + if (s[1].unicode() == 'i') return T_DOXY_LI; - } } else if (s[0].unicode() == 's') { - if (s[1].unicode() == 'a') { + if (s[1].unicode() == 'a') return T_DOXY_SA; - } } else if (s[0].unicode() == 't') { - if (s[1].unicode() == 't') { + if (s[1].unicode() == 't') return T_DOXY_TT; - } } return T_DOXY_IDENTIFIER; } @@ -333,103 +318,86 @@ static inline int classify2(const QChar *s) { static inline int classify3(const QChar *s) { if (s[0].unicode() == 'a') { if (s[1].unicode() == 'r') { - if (s[2].unicode() == 'g') { + if (s[2].unicode() == 'g') return T_DOXY_ARG; - } } } else if (s[0].unicode() == 'b') { if (s[1].unicode() == 'u') { - if (s[2].unicode() == 'g') { + if (s[2].unicode() == 'g') return T_DOXY_BUG; - } } } else if (s[0].unicode() == 'd') { if (s[1].unicode() == 'e') { - if (s[2].unicode() == 'f') { + if (s[2].unicode() == 'f') return T_DOXY_DEF; - } } else if (s[1].unicode() == 'o') { - if (s[2].unicode() == 't') { + if (s[2].unicode() == 't') return T_DOXY_DOT; - } } } else if (s[0].unicode() == 'g') { if (s[1].unicode() == 'u') { - if (s[2].unicode() == 'i') { + if (s[2].unicode() == 'i') return T_DOXY_GUI; - } } } else if (s[0].unicode() == 'p') { if (s[1].unicode() == 'a') { - if (s[2].unicode() == 'r') { + if (s[2].unicode() == 'r') return T_DOXY_PAR; - } } else if (s[1].unicode() == 'r') { - if (s[2].unicode() == 'e') { + if (s[2].unicode() == 'e') return T_DOXY_PRE; - } } } else if (s[0].unicode() == 'r') { if (s[1].unicode() == 'a') { - if (s[2].unicode() == 'w') { + if (s[2].unicode() == 'w') return T_DOXY_RAW; - } } else if (s[1].unicode() == 'e') { - if (s[2].unicode() == 'f') { + if (s[2].unicode() == 'f') return T_DOXY_REF; - } } else if (s[1].unicode() == 'o') { - if (s[2].unicode() == 'w') { + if (s[2].unicode() == 'w') return T_DOXY_ROW; - } } } else if (s[0].unicode() == 's') { if (s[1].unicode() == 'e') { - if (s[2].unicode() == 'e') { + if (s[2].unicode() == 'e') return T_DOXY_SEE; - } } else if (s[1].unicode() == 'q') { - if (s[2].unicode() == 'l') { + if (s[2].unicode() == 'l') return T_DOXY_SQL; - } } else if (s[1].unicode() == 'u') { - if (s[2].unicode() == 'b') { + if (s[2].unicode() == 'b') return T_DOXY_SUB; - } - else if (s[2].unicode() == 'p') { + else if (s[2].unicode() == 'p') return T_DOXY_SUP; - } } else if (s[1].unicode() == 'v') { - if (s[2].unicode() == 'g') { + if (s[2].unicode() == 'g') return T_DOXY_SVG; - } } } else if (s[0].unicode() == 'v') { if (s[1].unicode() == 'a') { - if (s[2].unicode() == 'r') { + if (s[2].unicode() == 'r') return T_DOXY_VAR; - } } } else if (s[0].unicode() == 'x') { if (s[1].unicode() == 'm') { - if (s[2].unicode() == 'l') { + if (s[2].unicode() == 'l') return T_DOXY_XML; - } } } return T_DOXY_IDENTIFIER; @@ -439,168 +407,146 @@ static inline int classify4(const QChar *s) { if (s[0].unicode() == 'b') { if (s[1].unicode() == 'o') { if (s[2].unicode() == 'l') { - if (s[3].unicode() == 'd') { + if (s[3].unicode() == 'd') return T_DOXY_BOLD; - } } } } else if (s[0].unicode() == 'c') { if (s[1].unicode() == 'o') { if (s[2].unicode() == 'd') { - if (s[3].unicode() == 'e') { + if (s[3].unicode() == 'e') return T_DOXY_CODE; - } } else if (s[2].unicode() == 'n') { - if (s[3].unicode() == 'd') { + if (s[3].unicode() == 'd') return T_DOXY_COND; - } } } } else if (s[0].unicode() == 'd') { if (s[1].unicode() == 'a') { if (s[2].unicode() == 't') { - if (s[3].unicode() == 'e') { + if (s[3].unicode() == 'e') return T_DOXY_DATE; - } } } else if (s[1].unicode() == 'o') { if (s[2].unicode() == 't') { - if (s[3].unicode() == 's') { + if (s[3].unicode() == 's') return T_DOXY_DOTS; - } } } } else if (s[0].unicode() == 'e') { if (s[1].unicode() == 'l') { if (s[2].unicode() == 's') { - if (s[3].unicode() == 'e') { + if (s[3].unicode() == 'e') return T_DOXY_ELSE; - } } } else if (s[1].unicode() == 'n') { if (s[2].unicode() == 'u') { - if (s[3].unicode() == 'm') { + if (s[3].unicode() == 'm') return T_DOXY_ENUM; - } } } } else if (s[0].unicode() == 'f') { if (s[1].unicode() == 'i') { if (s[2].unicode() == 'l') { - if (s[3].unicode() == 'e') { + if (s[3].unicode() == 'e') return T_DOXY_FILE; - } } } } else if (s[0].unicode() == 'l') { if (s[1].unicode() == 'i') { if (s[2].unicode() == 'n') { - if (s[3].unicode() == 'e') { + if (s[3].unicode() == 'e') return T_DOXY_LINE; - } - else if (s[3].unicode() == 'k') { + else if (s[3].unicode() == 'k') return T_DOXY_LINK; - } } else if (s[2].unicode() == 's') { - if (s[3].unicode() == 't') { + if (s[3].unicode() == 't') return T_DOXY_LIST; - } } } } else if (s[0].unicode() == 'm') { if (s[1].unicode() == 'e') { if (s[2].unicode() == 't') { - if (s[3].unicode() == 'a') { + if (s[3].unicode() == 'a') return T_DOXY_META; - } } } } else if (s[0].unicode() == 'n') { if (s[1].unicode() == 'a') { if (s[2].unicode() == 'm') { - if (s[3].unicode() == 'e') { + if (s[3].unicode() == 'e') return T_DOXY_NAME; - } } } else if (s[1].unicode() == 'o') { if (s[2].unicode() == 't') { - if (s[3].unicode() == 'e') { + if (s[3].unicode() == 'e') return T_DOXY_NOTE; - } } } } else if (s[0].unicode() == 'o') { if (s[1].unicode() == 'm') { if (s[2].unicode() == 'i') { - if (s[3].unicode() == 't') { + if (s[3].unicode() == 't') return T_DOXY_OMIT; - } } } else if (s[1].unicode() == 'n') { if (s[2].unicode() == 'l') { - if (s[3].unicode() == 'y') { + if (s[3].unicode() == 'y') return T_DOXY_ONLY; - } } } } else if (s[0].unicode() == 'p') { if (s[1].unicode() == 'a') { if (s[2].unicode() == 'g') { - if (s[3].unicode() == 'e') { + if (s[3].unicode() == 'e') return T_DOXY_PAGE; - } } else if (s[2].unicode() == 'r') { - if (s[3].unicode() == 't') { + if (s[3].unicode() == 't') return T_DOXY_PART; - } } } else if (s[1].unicode() == 'o') { if (s[2].unicode() == 's') { - if (s[3].unicode() == 't') { + if (s[3].unicode() == 't') return T_DOXY_POST; - } } } } else if (s[0].unicode() == 's') { if (s[1].unicode() == 'k') { if (s[2].unicode() == 'i') { - if (s[3].unicode() == 'p') { + if (s[3].unicode() == 'p') return T_DOXY_SKIP; - } } } } else if (s[0].unicode() == 't') { if (s[1].unicode() == 'e') { if (s[2].unicode() == 's') { - if (s[3].unicode() == 't') { + if (s[3].unicode() == 't') return T_DOXY_TEST; - } } } else if (s[1].unicode() == 'o') { if (s[2].unicode() == 'd') { - if (s[3].unicode() == 'o') { + if (s[3].unicode() == 'o') return T_DOXY_TODO; - } } } } @@ -612,9 +558,8 @@ static inline int classify5(const QChar *s) { if (s[1].unicode() == 'r') { if (s[2].unicode() == 'i') { if (s[3].unicode() == 'e') { - if (s[4].unicode() == 'f') { + if (s[4].unicode() == 'f') return T_DOXY_BRIEF; - } } } } @@ -623,9 +568,8 @@ static inline int classify5(const QChar *s) { if (s[1].unicode() == 'l') { if (s[2].unicode() == 'a') { if (s[3].unicode() == 's') { - if (s[4].unicode() == 's') { + if (s[4].unicode() == 's') return T_DOXY_CLASS; - } } } } @@ -634,9 +578,8 @@ static inline int classify5(const QChar *s) { if (s[1].unicode() == 'n') { if (s[2].unicode() == 'd') { if (s[3].unicode() == 'i') { - if (s[4].unicode() == 'f') { + if (s[4].unicode() == 'f') return T_DOXY_ENDIF; - } } } } @@ -645,9 +588,8 @@ static inline int classify5(const QChar *s) { if (s[1].unicode() == 'r') { if (s[2].unicode() == 'o') { if (s[3].unicode() == 'u') { - if (s[4].unicode() == 'p') { + if (s[4].unicode() == 'p') return T_DOXY_GROUP; - } } } } @@ -656,27 +598,24 @@ static inline int classify5(const QChar *s) { if (s[1].unicode() == 'f') { if (s[2].unicode() == 'n') { if (s[3].unicode() == 'o') { - if (s[4].unicode() == 't') { + if (s[4].unicode() == 't') return T_DOXY_IFNOT; - } } } } else if (s[1].unicode() == 'm') { if (s[2].unicode() == 'a') { if (s[3].unicode() == 'g') { - if (s[4].unicode() == 'e') { + if (s[4].unicode() == 'e') return T_DOXY_IMAGE; - } } } } else if (s[1].unicode() == 'n') { if (s[2].unicode() == 'd') { if (s[3].unicode() == 'e') { - if (s[4].unicode() == 'x') { + if (s[4].unicode() == 'x') return T_DOXY_INDEX; - } } } } @@ -685,9 +624,8 @@ static inline int classify5(const QChar *s) { if (s[1].unicode() == 'a') { if (s[2].unicode() == 'c') { if (s[3].unicode() == 'r') { - if (s[4].unicode() == 'o') { + if (s[4].unicode() == 'o') return T_DOXY_MACRO; - } } } } @@ -696,9 +634,8 @@ static inline int classify5(const QChar *s) { if (s[1].unicode() == 'a') { if (s[2].unicode() == 'r') { if (s[3].unicode() == 'a') { - if (s[4].unicode() == 'm') { + if (s[4].unicode() == 'm') return T_DOXY_PARAM; - } } } } @@ -707,9 +644,8 @@ static inline int classify5(const QChar *s) { if (s[1].unicode() == 'e') { if (s[2].unicode() == 'i') { if (s[3].unicode() == 'm') { - if (s[4].unicode() == 'p') { + if (s[4].unicode() == 'p') return T_DOXY_REIMP; - } } } } @@ -718,18 +654,16 @@ static inline int classify5(const QChar *s) { if (s[1].unicode() == 'h') { if (s[2].unicode() == 'o') { if (s[3].unicode() == 'r') { - if (s[4].unicode() == 't') { + if (s[4].unicode() == 't') return T_DOXY_SHORT; - } } } } else if (s[1].unicode() == 'i') { if (s[2].unicode() == 'n') { if (s[3].unicode() == 'c') { - if (s[4].unicode() == 'e') { + if (s[4].unicode() == 'e') return T_DOXY_SINCE; - } } } } @@ -738,27 +672,24 @@ static inline int classify5(const QChar *s) { if (s[1].unicode() == 'a') { if (s[2].unicode() == 'b') { if (s[3].unicode() == 'l') { - if (s[4].unicode() == 'e') { + if (s[4].unicode() == 'e') return T_DOXY_TABLE; - } } } } else if (s[1].unicode() == 'h') { if (s[2].unicode() == 'r') { if (s[3].unicode() == 'o') { - if (s[4].unicode() == 'w') { + if (s[4].unicode() == 'w') return T_DOXY_THROW; - } } } } else if (s[1].unicode() == 'i') { if (s[2].unicode() == 't') { if (s[3].unicode() == 'l') { - if (s[4].unicode() == 'e') { + if (s[4].unicode() == 'e') return T_DOXY_TITLE; - } } } } @@ -767,16 +698,14 @@ static inline int classify5(const QChar *s) { if (s[1].unicode() == 'n') { if (s[2].unicode() == 'i') { if (s[3].unicode() == 'o') { - if (s[4].unicode() == 'n') { + if (s[4].unicode() == 'n') return T_DOXY_UNION; - } } } else if (s[2].unicode() == 't') { if (s[3].unicode() == 'i') { - if (s[4].unicode() == 'l') { + if (s[4].unicode() == 'l') return T_DOXY_UNTIL; - } } } } @@ -785,9 +714,8 @@ static inline int classify5(const QChar *s) { if (s[1].unicode() == 'a') { if (s[2].unicode() == 'l') { if (s[3].unicode() == 'u') { - if (s[4].unicode() == 'e') { + if (s[4].unicode() == 'e') return T_DOXY_VALUE; - } } } } @@ -801,9 +729,8 @@ static inline int classify6(const QChar *s) { if (s[2].unicode() == 'c') { if (s[3].unicode() == 'h') { if (s[4].unicode() == 'o') { - if (s[5].unicode() == 'r') { + if (s[5].unicode() == 'r') return T_DOXY_ANCHOR; - } } } } @@ -812,9 +739,8 @@ static inline int classify6(const QChar *s) { if (s[2].unicode() == 't') { if (s[3].unicode() == 'h') { if (s[4].unicode() == 'o') { - if (s[5].unicode() == 'r') { + if (s[5].unicode() == 'r') return T_DOXY_AUTHOR; - } } } } @@ -825,9 +751,8 @@ static inline int classify6(const QChar *s) { if (s[2].unicode() == 'm') { if (s[3].unicode() == 'p') { if (s[4].unicode() == 'a') { - if (s[5].unicode() == 't') { + if (s[5].unicode() == 't') return T_DOXY_COMPAT; - } } } } @@ -838,9 +763,8 @@ static inline int classify6(const QChar *s) { if (s[2].unicode() == 's') { if (s[3].unicode() == 'e') { if (s[4].unicode() == 'i') { - if (s[5].unicode() == 'f') { + if (s[5].unicode() == 'f') return T_DOXY_ELSEIF; - } } } } @@ -849,16 +773,14 @@ static inline int classify6(const QChar *s) { if (s[2].unicode() == 'd') { if (s[3].unicode() == 'd') { if (s[4].unicode() == 'o') { - if (s[5].unicode() == 't') { + if (s[5].unicode() == 't') return T_DOXY_ENDDOT; - } } } else if (s[3].unicode() == 'r') { if (s[4].unicode() == 'a') { - if (s[5].unicode() == 'w') { + if (s[5].unicode() == 'w') return T_DOXY_ENDRAW; - } } } } @@ -867,9 +789,8 @@ static inline int classify6(const QChar *s) { if (s[2].unicode() == 'p') { if (s[3].unicode() == 'i') { if (s[4].unicode() == 'r') { - if (s[5].unicode() == 'e') { + if (s[5].unicode() == 'e') return T_DOXY_EXPIRE; - } } } } @@ -880,9 +801,8 @@ static inline int classify6(const QChar *s) { if (s[2].unicode() == 'a') { if (s[3].unicode() == 'd') { if (s[4].unicode() == 'e') { - if (s[5].unicode() == 'r') { + if (s[5].unicode() == 'r') return T_DOXY_HEADER; - } } } } @@ -893,9 +813,8 @@ static inline int classify6(const QChar *s) { if (s[2].unicode() == 'd') { if (s[3].unicode() == 'u') { if (s[4].unicode() == 'l') { - if (s[5].unicode() == 'e') { + if (s[5].unicode() == 'e') return T_DOXY_MODULE; - } } } } @@ -906,9 +825,8 @@ static inline int classify6(const QChar *s) { if (s[2].unicode() == 'e') { if (s[3].unicode() == 'n') { if (s[4].unicode() == 'g') { - if (s[5].unicode() == 'l') { + if (s[5].unicode() == 'l') return T_DOXY_OPENGL; - } } } } @@ -919,16 +837,14 @@ static inline int classify6(const QChar *s) { if (s[2].unicode() == 't') { if (s[3].unicode() == 'u') { if (s[4].unicode() == 'r') { - if (s[5].unicode() == 'n') { + if (s[5].unicode() == 'n') return T_DOXY_RETURN; - } } } else if (s[3].unicode() == 'v') { if (s[4].unicode() == 'a') { - if (s[5].unicode() == 'l') { + if (s[5].unicode() == 'l') return T_DOXY_RETVAL; - } } } } @@ -939,9 +855,8 @@ static inline int classify6(const QChar *s) { if (s[2].unicode() == 'i') { if (s[3].unicode() == 'p') { if (s[4].unicode() == 't') { - if (s[5].unicode() == 'o') { + if (s[5].unicode() == 'o') return T_DOXY_SKIPTO; - } } } } @@ -950,9 +865,8 @@ static inline int classify6(const QChar *s) { if (s[2].unicode() == 'r') { if (s[3].unicode() == 'u') { if (s[4].unicode() == 'c') { - if (s[5].unicode() == 't') { + if (s[5].unicode() == 't') return T_DOXY_STRUCT; - } } } } @@ -963,9 +877,8 @@ static inline int classify6(const QChar *s) { if (s[2].unicode() == 'r') { if (s[3].unicode() == 'g') { if (s[4].unicode() == 'e') { - if (s[5].unicode() == 't') { + if (s[5].unicode() == 't') return T_DOXY_TARGET; - } } } } @@ -974,9 +887,8 @@ static inline int classify6(const QChar *s) { if (s[2].unicode() == 'r') { if (s[3].unicode() == 'o') { if (s[4].unicode() == 'w') { - if (s[5].unicode() == 's') { + if (s[5].unicode() == 's') return T_DOXY_THROWS; - } } } } @@ -987,9 +899,8 @@ static inline int classify6(const QChar *s) { if (s[2].unicode() == 'b') { if (s[3].unicode() == 'k') { if (s[4].unicode() == 'i') { - if (s[5].unicode() == 't') { + if (s[5].unicode() == 't') return T_DOXY_WEBKIT; - } } } } @@ -1005,9 +916,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 'c') { if (s[4].unicode() == 'o') { if (s[5].unicode() == 'd') { - if (s[6].unicode() == 'e') { + if (s[6].unicode() == 'e') return T_DOXY_BADCODE; - } } } } @@ -1020,9 +930,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 't') { if (s[4].unicode() == 'i') { if (s[5].unicode() == 'o') { - if (s[6].unicode() == 'n') { + if (s[6].unicode() == 'n') return T_DOXY_CAPTION; - } } } } @@ -1033,9 +942,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 'p') { if (s[4].unicode() == 't') { if (s[5].unicode() == 'e') { - if (s[6].unicode() == 'r') { + if (s[6].unicode() == 'r') return T_DOXY_CHAPTER; - } } } } @@ -1046,9 +954,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 'y') { if (s[4].unicode() == 'd') { if (s[5].unicode() == 'o') { - if (s[6].unicode() == 'c') { + if (s[6].unicode() == 'c') return T_DOXY_COPYDOC; - } } } } @@ -1057,9 +964,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 'e') { if (s[4].unicode() == 'l') { if (s[5].unicode() == 'i') { - if (s[6].unicode() == 'b') { + if (s[6].unicode() == 'b') return T_DOXY_CORELIB; - } } } } @@ -1072,9 +978,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 'f') { if (s[4].unicode() == 'i') { if (s[5].unicode() == 'l') { - if (s[6].unicode() == 'e') { + if (s[6].unicode() == 'e') return T_DOXY_DOTFILE; - } } } } @@ -1087,46 +992,40 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 'c') { if (s[4].unicode() == 'o') { if (s[5].unicode() == 'd') { - if (s[6].unicode() == 'e') { + if (s[6].unicode() == 'e') return T_DOXY_ENDCODE; - } } else if (s[5].unicode() == 'n') { - if (s[6].unicode() == 'd') { + if (s[6].unicode() == 'd') return T_DOXY_ENDCOND; - } } } } else if (s[3].unicode() == 'l') { if (s[4].unicode() == 'i') { if (s[5].unicode() == 'n') { - if (s[6].unicode() == 'k') { + if (s[6].unicode() == 'k') return T_DOXY_ENDLINK; - } } else if (s[5].unicode() == 's') { - if (s[6].unicode() == 't') { + if (s[6].unicode() == 't') return T_DOXY_ENDLIST; - } } } } else if (s[3].unicode() == 'o') { if (s[4].unicode() == 'm') { if (s[5].unicode() == 'i') { - if (s[6].unicode() == 't') { + if (s[6].unicode() == 't') return T_DOXY_ENDOMIT; - } } } } else if (s[3].unicode() == 'p') { if (s[4].unicode() == 'a') { if (s[5].unicode() == 'r') { - if (s[6].unicode() == 't') { + if (s[6].unicode() == 't') return T_DOXY_ENDPART; - } } } } @@ -1137,9 +1036,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 'm') { if (s[4].unicode() == 'p') { if (s[5].unicode() == 'l') { - if (s[6].unicode() == 'e') { + if (s[6].unicode() == 'e') return T_DOXY_EXAMPLE; - } } } } @@ -1152,9 +1050,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 'l') { if (s[4].unicode() == 'u') { if (s[5].unicode() == 'd') { - if (s[6].unicode() == 'e') { + if (s[6].unicode() == 'e') return T_DOXY_INCLUDE; - } } } } @@ -1163,9 +1060,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 'r') { if (s[4].unicode() == 'o') { if (s[5].unicode() == 'u') { - if (s[6].unicode() == 'p') { + if (s[6].unicode() == 'p') return T_DOXY_INGROUP; - } } } } @@ -1178,9 +1074,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 'w') { if (s[4].unicode() == 'o') { if (s[5].unicode() == 'r') { - if (s[6].unicode() == 'd') { + if (s[6].unicode() == 'd') return T_DOXY_KEYWORD; - } } } } @@ -1193,9 +1088,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 'o') { if (s[4].unicode() == 'n') { if (s[5].unicode() == 'l') { - if (s[6].unicode() == 'y') { + if (s[6].unicode() == 'y') return T_DOXY_MANONLY; - } } } } @@ -1208,9 +1102,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 'w') { if (s[4].unicode() == 'o') { if (s[5].unicode() == 'r') { - if (s[6].unicode() == 'k') { + if (s[6].unicode() == 'k') return T_DOXY_NETWORK; - } } } } @@ -1219,9 +1112,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 'c') { if (s[4].unicode() == 'o') { if (s[5].unicode() == 'd') { - if (s[6].unicode() == 'e') { + if (s[6].unicode() == 'e') return T_DOXY_NEWCODE; - } } } } @@ -1234,9 +1126,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 'c') { if (s[4].unicode() == 'o') { if (s[5].unicode() == 'd') { - if (s[6].unicode() == 'e') { + if (s[6].unicode() == 'e') return T_DOXY_OLDCODE; - } } } } @@ -1249,9 +1140,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 'k') { if (s[4].unicode() == 'a') { if (s[5].unicode() == 'g') { - if (s[6].unicode() == 'e') { + if (s[6].unicode() == 'e') return T_DOXY_PACKAGE; - } } } } @@ -1262,9 +1152,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 'n') { if (s[4].unicode() == 't') { if (s[5].unicode() == 't') { - if (s[6].unicode() == 'o') { + if (s[6].unicode() == 'o') return T_DOXY_PRINTTO; - } } } } @@ -1277,9 +1166,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 'a') { if (s[4].unicode() == 't') { if (s[5].unicode() == 'e') { - if (s[6].unicode() == 's') { + if (s[6].unicode() == 's') return T_DOXY_RELATES; - } } } } @@ -1288,9 +1176,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 'a') { if (s[4].unicode() == 'r') { if (s[5].unicode() == 'k') { - if (s[6].unicode() == 's') { + if (s[6].unicode() == 's') return T_DOXY_REMARKS; - } } } } @@ -1299,9 +1186,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 'u') { if (s[4].unicode() == 'r') { if (s[5].unicode() == 'n') { - if (s[6].unicode() == 's') { + if (s[6].unicode() == 's') return T_DOXY_RETURNS; - } } } } @@ -1314,9 +1200,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 't') { if (s[4].unicode() == 'i') { if (s[5].unicode() == 'o') { - if (s[6].unicode() == 'n') { + if (s[6].unicode() == 'n') return T_DOXY_SECTION; - } } } } @@ -1325,9 +1210,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 'v') { if (s[4].unicode() == 'i') { if (s[5].unicode() == 'c') { - if (s[6].unicode() == 'e') { + if (s[6].unicode() == 'e') return T_DOXY_SERVICE; - } } } } @@ -1338,9 +1222,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 'e') { if (s[4].unicode() == 'b') { if (s[5].unicode() == 'a') { - if (s[6].unicode() == 'r') { + if (s[6].unicode() == 'r') return T_DOXY_SIDEBAR; - } } } } @@ -1351,9 +1234,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 'p') { if (s[4].unicode() == 'p') { if (s[5].unicode() == 'e') { - if (s[6].unicode() == 't') { + if (s[6].unicode() == 't') return T_DOXY_SNIPPET; - } } } } @@ -1366,9 +1248,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 'e') { if (s[4].unicode() == 'd') { if (s[5].unicode() == 'e') { - if (s[6].unicode() == 'f') { + if (s[6].unicode() == 'f') return T_DOXY_TYPEDEF; - } } } } @@ -1381,9 +1262,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 'o') { if (s[4].unicode() == 'o') { if (s[5].unicode() == 'l') { - if (s[6].unicode() == 's') { + if (s[6].unicode() == 's') return T_DOXY_UITOOLS; - } } } } @@ -1394,9 +1274,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 'c') { if (s[4].unicode() == 'o') { if (s[5].unicode() == 'd') { - if (s[6].unicode() == 'e') { + if (s[6].unicode() == 'e') return T_DOXY_UNICODE; - } } } } @@ -1409,9 +1288,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 's') { if (s[4].unicode() == 'i') { if (s[5].unicode() == 'o') { - if (s[6].unicode() == 'n') { + if (s[6].unicode() == 'n') return T_DOXY_VERSION; - } } } } @@ -1424,9 +1302,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 'n') { if (s[4].unicode() == 'i') { if (s[5].unicode() == 'n') { - if (s[6].unicode() == 'g') { + if (s[6].unicode() == 'g') return T_DOXY_WARNING; - } } } } @@ -1439,9 +1316,8 @@ static inline int classify7(const QChar *s) { if (s[3].unicode() == 'o') { if (s[4].unicode() == 'n') { if (s[5].unicode() == 'l') { - if (s[6].unicode() == 'y') { + if (s[6].unicode() == 'y') return T_DOXY_XMLONLY; - } } } } @@ -1459,9 +1335,8 @@ static inline int classify8(const QChar *s) { if (s[4].unicode() == 'r') { if (s[5].unicode() == 'a') { if (s[6].unicode() == 'c') { - if (s[7].unicode() == 't') { + if (s[7].unicode() == 't') return T_DOXY_ABSTRACT; - } } } } @@ -1474,9 +1349,8 @@ static inline int classify8(const QChar *s) { if (s[4].unicode() == 'n') { if (s[5].unicode() == 'd') { if (s[6].unicode() == 'e') { - if (s[7].unicode() == 'x') { + if (s[7].unicode() == 'x') return T_DOXY_ADDINDEX; - } } } } @@ -1491,9 +1365,8 @@ static inline int classify8(const QChar *s) { if (s[4].unicode() == 'n') { if (s[5].unicode() == 'a') { if (s[6].unicode() == 'm') { - if (s[7].unicode() == 'e') { + if (s[7].unicode() == 'e') return T_DOXY_BASENAME; - } } } } @@ -1508,9 +1381,8 @@ static inline int classify8(const QChar *s) { if (s[4].unicode() == 'l') { if (s[5].unicode() == 'i') { if (s[6].unicode() == 'n') { - if (s[7].unicode() == 'e') { + if (s[7].unicode() == 'e') return T_DOXY_CODELINE; - } } } } @@ -1525,9 +1397,8 @@ static inline int classify8(const QChar *s) { if (s[4].unicode() == 'r') { if (s[5].unicode() == 'o') { if (s[6].unicode() == 'u') { - if (s[7].unicode() == 'p') { + if (s[7].unicode() == 'p') return T_DOXY_DEFGROUP; - } } } } @@ -1542,9 +1413,8 @@ static inline int classify8(const QChar *s) { if (s[4].unicode() == 'a') { if (s[5].unicode() == 'b') { if (s[6].unicode() == 'l') { - if (s[7].unicode() == 'e') { + if (s[7].unicode() == 'e') return T_DOXY_ENDTABLE; - } } } } @@ -1559,9 +1429,8 @@ static inline int classify8(const QChar *s) { if (s[4].unicode() == 'n') { if (s[5].unicode() == 'o') { if (s[6].unicode() == 't') { - if (s[7].unicode() == 'e') { + if (s[7].unicode() == 'e') return T_DOXY_FOOTNOTE; - } } } } @@ -1576,9 +1445,8 @@ static inline int classify8(const QChar *s) { if (s[4].unicode() == 'o') { if (s[5].unicode() == 'n') { if (s[6].unicode() == 'l') { - if (s[7].unicode() == 'y') { + if (s[7].unicode() == 'y') return T_DOXY_HTMLONLY; - } } } } @@ -1593,9 +1461,8 @@ static inline int classify8(const QChar *s) { if (s[4].unicode() == 'd') { if (s[5].unicode() == 'u') { if (s[6].unicode() == 'l') { - if (s[7].unicode() == 'e') { + if (s[7].unicode() == 'e') return T_DOXY_INMODULE; - } } } } @@ -1606,9 +1473,8 @@ static inline int classify8(const QChar *s) { if (s[4].unicode() == 'r') { if (s[5].unicode() == 'n') { if (s[6].unicode() == 'a') { - if (s[7].unicode() == 'l') { + if (s[7].unicode() == 'l') return T_DOXY_INTERNAL; - } } } } @@ -1623,9 +1489,8 @@ static inline int classify8(const QChar *s) { if (s[4].unicode() == 'l') { if (s[5].unicode() == 'e') { if (s[6].unicode() == 's') { - if (s[7].unicode() == 'e') { + if (s[7].unicode() == 'e') return T_DOXY_LEGALESE; - } } } } @@ -1640,9 +1505,8 @@ static inline int classify8(const QChar *s) { if (s[4].unicode() == 'p') { if (s[5].unicode() == 'a') { if (s[6].unicode() == 'g') { - if (s[7].unicode() == 'e') { + if (s[7].unicode() == 'e') return T_DOXY_MAINPAGE; - } } } } @@ -1657,9 +1521,8 @@ static inline int classify8(const QChar *s) { if (s[4].unicode() == 'p') { if (s[5].unicode() == 'a') { if (s[6].unicode() == 'g') { - if (s[7].unicode() == 'e') { + if (s[7].unicode() == 'e') return T_DOXY_NEXTPAGE; - } } } } @@ -1674,9 +1537,8 @@ static inline int classify8(const QChar *s) { if (s[4].unicode() == 'l') { if (s[5].unicode() == 'e') { if (s[6].unicode() == 't') { - if (s[7].unicode() == 'e') { + if (s[7].unicode() == 'e') return T_DOXY_OBSOLETE; - } } } } @@ -1689,9 +1551,8 @@ static inline int classify8(const QChar *s) { if (s[4].unicode() == 'l') { if (s[5].unicode() == 'o') { if (s[6].unicode() == 'a') { - if (s[7].unicode() == 'd') { + if (s[7].unicode() == 'd') return T_DOXY_OVERLOAD; - } } } } @@ -1706,9 +1567,8 @@ static inline int classify8(const QChar *s) { if (s[4].unicode() == 'e') { if (s[5].unicode() == 'r') { if (s[6].unicode() == 't') { - if (s[7].unicode() == 'y') { + if (s[7].unicode() == 'y') return T_DOXY_PROPERTY; - } } } } @@ -1723,9 +1583,8 @@ static inline int classify8(const QChar *s) { if (s[4].unicode() == 't') { if (s[5].unicode() == 'l') { if (s[6].unicode() == 'i') { - if (s[7].unicode() == 'b') { + if (s[7].unicode() == 'b') return T_DOXY_QTESTLIB; - } } } } @@ -1740,18 +1599,14 @@ static inline int classify8(const QChar *s) { if (s[4].unicode() == 'i') { if (s[5].unicode() == 'o') { if (s[6].unicode() == 'n') { - if (s[7].unicode() == '1') { + if (s[7].unicode() == '1') return T_DOXY_SECTION1; - } - else if (s[7].unicode() == '2') { + else if (s[7].unicode() == '2') return T_DOXY_SECTION2; - } - else if (s[7].unicode() == '3') { + else if (s[7].unicode() == '3') return T_DOXY_SECTION3; - } - else if (s[7].unicode() == '4') { + else if (s[7].unicode() == '4') return T_DOXY_SECTION4; - } } } } @@ -1764,9 +1619,8 @@ static inline int classify8(const QChar *s) { if (s[4].unicode() == 'l') { if (s[5].unicode() == 'i') { if (s[6].unicode() == 'n') { - if (s[7].unicode() == 'e') { + if (s[7].unicode() == 'e') return T_DOXY_SKIPLINE; - } } } } @@ -1779,9 +1633,8 @@ static inline int classify8(const QChar *s) { if (s[4].unicode() == 'i') { if (s[5].unicode() == 't') { if (s[6].unicode() == 'l') { - if (s[7].unicode() == 'e') { + if (s[7].unicode() == 'e') return T_DOXY_SUBTITLE; - } } } } @@ -1796,9 +1649,8 @@ static inline int classify8(const QChar *s) { if (s[4].unicode() == 'a') { if (s[5].unicode() == 'b') { if (s[6].unicode() == 'l') { - if (s[7].unicode() == 'e') { + if (s[7].unicode() == 'e') return T_DOXY_VARIABLE; - } } } } @@ -1811,9 +1663,8 @@ static inline int classify8(const QChar *s) { if (s[4].unicode() == 'a') { if (s[5].unicode() == 't') { if (s[6].unicode() == 'i') { - if (s[7].unicode() == 'm') { + if (s[7].unicode() == 'm') return T_DOXY_VERBATIM; - } } } } @@ -1828,9 +1679,8 @@ static inline int classify8(const QChar *s) { if (s[4].unicode() == 'i') { if (s[5].unicode() == 't') { if (s[6].unicode() == 'e') { - if (s[7].unicode() == 'm') { + if (s[7].unicode() == 'm') return T_DOXY_XREFITEM; - } } } } @@ -1850,9 +1700,8 @@ static inline int classify9(const QChar *s) { if (s[5].unicode() == 't') { if (s[6].unicode() == 'i') { if (s[7].unicode() == 'o') { - if (s[8].unicode() == 'n') { + if (s[8].unicode() == 'n') return T_DOXY_ATTENTION; - } } } } @@ -1869,9 +1718,8 @@ static inline int classify9(const QChar *s) { if (s[5].unicode() == 'r') { if (s[6].unicode() == 'a') { if (s[7].unicode() == 'p') { - if (s[8].unicode() == 'h') { + if (s[8].unicode() == 'h') return T_DOXY_CALLGRAPH; - } } } } @@ -1888,9 +1736,8 @@ static inline int classify9(const QChar *s) { if (s[5].unicode() == 't') { if (s[6].unicode() == 'i') { if (s[7].unicode() == 'o') { - if (s[8].unicode() == 'n') { + if (s[8].unicode() == 'n') return T_DOXY_EXCEPTION; - } } } } @@ -1907,9 +1754,8 @@ static inline int classify9(const QChar *s) { if (s[5].unicode() == 'p') { if (s[6].unicode() == 'a') { if (s[7].unicode() == 'g') { - if (s[8].unicode() == 'e') { + if (s[8].unicode() == 'e') return T_DOXY_INDEXPAGE; - } } } } @@ -1922,9 +1768,8 @@ static inline int classify9(const QChar *s) { if (s[5].unicode() == 'f') { if (s[6].unicode() == 'a') { if (s[7].unicode() == 'c') { - if (s[8].unicode() == 'e') { + if (s[8].unicode() == 'e') return T_DOXY_INTERFACE; - } } } } @@ -1937,9 +1782,8 @@ static inline int classify9(const QChar *s) { if (s[5].unicode() == 'i') { if (s[6].unicode() == 'a') { if (s[7].unicode() == 'n') { - if (s[8].unicode() == 't') { + if (s[8].unicode() == 't') return T_DOXY_INVARIANT; - } } } } @@ -1956,9 +1800,8 @@ static inline int classify9(const QChar *s) { if (s[5].unicode() == 'o') { if (s[6].unicode() == 'n') { if (s[7].unicode() == 'l') { - if (s[8].unicode() == 'y') { + if (s[8].unicode() == 'y') return T_DOXY_LATEXONLY; - } } } } @@ -1975,9 +1818,8 @@ static inline int classify9(const QChar *s) { if (s[5].unicode() == 'l') { if (s[6].unicode() == 'a') { if (s[7].unicode() == 's') { - if (s[8].unicode() == 's') { + if (s[8].unicode() == 's') return T_DOXY_MAINCLASS; - } } } } @@ -1994,9 +1836,8 @@ static inline int classify9(const QChar *s) { if (s[5].unicode() == 'p') { if (s[6].unicode() == 'a') { if (s[7].unicode() == 'c') { - if (s[8].unicode() == 'e') { + if (s[8].unicode() == 'e') return T_DOXY_NAMESPACE; - } } } } @@ -2013,9 +1854,8 @@ static inline int classify9(const QChar *s) { if (s[5].unicode() == 'a') { if (s[6].unicode() == 'l') { if (s[7].unicode() == 'u') { - if (s[8].unicode() == 'e') { + if (s[8].unicode() == 'e') return T_DOXY_OMITVALUE; - } } } } @@ -2032,9 +1872,8 @@ static inline int classify9(const QChar *s) { if (s[5].unicode() == 'r') { if (s[6].unicode() == 'a') { if (s[7].unicode() == 'p') { - if (s[8].unicode() == 'h') { + if (s[8].unicode() == 'h') return T_DOXY_PARAGRAPH; - } } } } @@ -2049,9 +1888,8 @@ static inline int classify9(const QChar *s) { if (s[5].unicode() == 'l') { if (s[6].unicode() == 'i') { if (s[7].unicode() == 'n') { - if (s[8].unicode() == 'e') { + if (s[8].unicode() == 'e') return T_DOXY_PRINTLINE; - } } } } @@ -2068,9 +1906,8 @@ static inline int classify9(const QChar *s) { if (s[5].unicode() == 't') { if (s[6].unicode() == 'i') { if (s[7].unicode() == 'o') { - if (s[8].unicode() == 'n') { + if (s[8].unicode() == 'n') return T_DOXY_QUOTATION; - } } } } @@ -2079,9 +1916,8 @@ static inline int classify9(const QChar *s) { if (s[5].unicode() == 'f') { if (s[6].unicode() == 'i') { if (s[7].unicode() == 'l') { - if (s[8].unicode() == 'e') { + if (s[8].unicode() == 'e') return T_DOXY_QUOTEFILE; - } } } } @@ -2098,9 +1934,8 @@ static inline int classify9(const QChar *s) { if (s[5].unicode() == 'r') { if (s[6].unicode() == 'a') { if (s[7].unicode() == 'n') { - if (s[8].unicode() == 't') { + if (s[8].unicode() == 't') return T_DOXY_REENTRANT; - } } } } @@ -2117,9 +1952,8 @@ static inline int classify9(const QChar *s) { if (s[5].unicode() == 'n') { if (s[6].unicode() == 't') { if (s[7].unicode() == 'i') { - if (s[8].unicode() == 'l') { + if (s[8].unicode() == 'l') return T_DOXY_SKIPUNTIL; - } } } } @@ -2134,9 +1968,8 @@ static inline int classify9(const QChar *s) { if (s[5].unicode() == 'p') { if (s[6].unicode() == 'a') { if (s[7].unicode() == 'g') { - if (s[8].unicode() == 'e') { + if (s[8].unicode() == 'e') return T_DOXY_STARTPAGE; - } } } } @@ -2153,9 +1986,8 @@ static inline int classify9(const QChar *s) { if (s[5].unicode() == 'l') { if (s[6].unicode() == 'i') { if (s[7].unicode() == 'n') { - if (s[8].unicode() == 'e') { + if (s[8].unicode() == 'e') return T_DOXY_UNDERLINE; - } } } } @@ -2172,9 +2004,8 @@ static inline int classify9(const QChar *s) { if (s[5].unicode() == 'r') { if (s[6].unicode() == 'o') { if (s[7].unicode() == 'u') { - if (s[8].unicode() == 'p') { + if (s[8].unicode() == 'p') return T_DOXY_WEAKGROUP; - } } } } @@ -2196,9 +2027,8 @@ static inline int classify10(const QChar *s) { if (s[6].unicode() == 'r') { if (s[7].unicode() == 'o') { if (s[8].unicode() == 'u') { - if (s[9].unicode() == 'p') { + if (s[9].unicode() == 'p') return T_DOXY_ADDTOGROUP; - } } } } @@ -2217,9 +2047,8 @@ static inline int classify10(const QChar *s) { if (s[6].unicode() == 'a') { if (s[7].unicode() == 't') { if (s[8].unicode() == 'e') { - if (s[9].unicode() == 'd') { + if (s[9].unicode() == 'd') return T_DOXY_DEPRECATED; - } } } } @@ -2238,9 +2067,8 @@ static inline int classify10(const QChar *s) { if (s[6].unicode() == 'p') { if (s[7].unicode() == 't') { if (s[8].unicode() == 'e') { - if (s[9].unicode() == 'r') { + if (s[9].unicode() == 'r') return T_DOXY_ENDCHAPTER; - } } } } @@ -2253,9 +2081,8 @@ static inline int classify10(const QChar *s) { if (s[6].unicode() == 'o') { if (s[7].unicode() == 'n') { if (s[8].unicode() == 'l') { - if (s[9].unicode() == 'y') { + if (s[9].unicode() == 'y') return T_DOXY_ENDMANONLY; - } } } } @@ -2268,9 +2095,8 @@ static inline int classify10(const QChar *s) { if (s[6].unicode() == 'e') { if (s[7].unicode() == 'b') { if (s[8].unicode() == 'a') { - if (s[9].unicode() == 'r') { + if (s[9].unicode() == 'r') return T_DOXY_ENDSIDEBAR; - } } } } @@ -2283,9 +2109,8 @@ static inline int classify10(const QChar *s) { if (s[6].unicode() == 'o') { if (s[7].unicode() == 'n') { if (s[8].unicode() == 'l') { - if (s[9].unicode() == 'y') { + if (s[9].unicode() == 'y') return T_DOXY_ENDXMLONLY; - } } } } @@ -2302,9 +2127,8 @@ static inline int classify10(const QChar *s) { if (s[6].unicode() == 'i') { if (s[7].unicode() == 'o') { if (s[8].unicode() == 'n') { - if (s[9].unicode() == 's') { + if (s[9].unicode() == 's') return T_DOXY_EXCEPTIONS; - } } } } @@ -2323,9 +2147,8 @@ static inline int classify10(const QChar *s) { if (s[6].unicode() == 'f') { if (s[7].unicode() == 'i') { if (s[8].unicode() == 'l') { - if (s[9].unicode() == 'e') { + if (s[9].unicode() == 'e') return T_DOXY_HEADERFILE; - } } } } @@ -2344,9 +2167,8 @@ static inline int classify10(const QChar *s) { if (s[6].unicode() == 'n') { if (s[7].unicode() == 't') { if (s[8].unicode() == 'i') { - if (s[9].unicode() == 'l') { + if (s[9].unicode() == 'l') return T_DOXY_PRINTUNTIL; - } } } } @@ -2365,9 +2187,8 @@ static inline int classify10(const QChar *s) { if (s[6].unicode() == 'p') { if (s[7].unicode() == 'o') { if (s[8].unicode() == 'r') { - if (s[9].unicode() == 't') { + if (s[9].unicode() == 't') return T_DOXY_QT3SUPPORT; - } } } } @@ -2386,9 +2207,8 @@ static inline int classify10(const QChar *s) { if (s[6].unicode() == 't') { if (s[7].unicode() == 'i') { if (s[8].unicode() == 'o') { - if (s[9].unicode() == 'n') { + if (s[9].unicode() == 'n') return T_DOXY_SUBSECTION; - } } } } @@ -2407,9 +2227,8 @@ static inline int classify10(const QChar *s) { if (s[6].unicode() == 's') { if (s[7].unicode() == 'a') { if (s[8].unicode() == 'f') { - if (s[9].unicode() == 'e') { + if (s[9].unicode() == 'e') return T_DOXY_THREADSAFE; - } } } } @@ -2433,9 +2252,8 @@ static inline int classify11(const QChar *s) { if (s[7].unicode() == 'l') { if (s[8].unicode() == 'u') { if (s[9].unicode() == 'd') { - if (s[10].unicode() == 'e') { + if (s[10].unicode() == 'e') return T_DOXY_DONTINCLUDE; - } } } } @@ -2456,9 +2274,8 @@ static inline int classify11(const QChar *s) { if (s[7].unicode() == 'r') { if (s[8].unicode() == 'a') { if (s[9].unicode() == 'c') { - if (s[10].unicode() == 't') { + if (s[10].unicode() == 't') return T_DOXY_ENDABSTRACT; - } } } } @@ -2473,9 +2290,8 @@ static inline int classify11(const QChar *s) { if (s[7].unicode() == 'n') { if (s[8].unicode() == 'o') { if (s[9].unicode() == 't') { - if (s[10].unicode() == 'e') { + if (s[10].unicode() == 'e') return T_DOXY_ENDFOOTNOTE; - } } } } @@ -2490,9 +2306,8 @@ static inline int classify11(const QChar *s) { if (s[7].unicode() == 'o') { if (s[8].unicode() == 'n') { if (s[9].unicode() == 'l') { - if (s[10].unicode() == 'y') { + if (s[10].unicode() == 'y') return T_DOXY_ENDHTMLONLY; - } } } } @@ -2507,9 +2322,8 @@ static inline int classify11(const QChar *s) { if (s[7].unicode() == 'l') { if (s[8].unicode() == 'e') { if (s[9].unicode() == 's') { - if (s[10].unicode() == 'e') { + if (s[10].unicode() == 'e') return T_DOXY_ENDLEGALESE; - } } } } @@ -2524,18 +2338,14 @@ static inline int classify11(const QChar *s) { if (s[7].unicode() == 'i') { if (s[8].unicode() == 'o') { if (s[9].unicode() == 'n') { - if (s[10].unicode() == '1') { + if (s[10].unicode() == '1') return T_DOXY_ENDSECTION1; - } - else if (s[10].unicode() == '2') { + else if (s[10].unicode() == '2') return T_DOXY_ENDSECTION2; - } - else if (s[10].unicode() == '3') { + else if (s[10].unicode() == '3') return T_DOXY_ENDSECTION3; - } - else if (s[10].unicode() == '4') { + else if (s[10].unicode() == '4') return T_DOXY_ENDSECTION4; - } } } } @@ -2550,9 +2360,8 @@ static inline int classify11(const QChar *s) { if (s[7].unicode() == 'a') { if (s[8].unicode() == 't') { if (s[9].unicode() == 'i') { - if (s[10].unicode() == 'm') { + if (s[10].unicode() == 'm') return T_DOXY_ENDVERBATIM; - } } } } @@ -2573,9 +2382,8 @@ static inline int classify11(const QChar *s) { if (s[7].unicode() == 'r') { if (s[8].unicode() == 'i') { if (s[9].unicode() == 't') { - if (s[10].unicode() == 'y') { + if (s[10].unicode() == 'y') return T_DOXY_GRANULARITY; - } } } } @@ -2596,9 +2404,8 @@ static inline int classify11(const QChar *s) { if (s[7].unicode() == 'l') { if (s[8].unicode() == 'u') { if (s[9].unicode() == 'd') { - if (s[10].unicode() == 'e') { + if (s[10].unicode() == 'e') return T_DOXY_HTMLINCLUDE; - } } } } @@ -2619,9 +2426,8 @@ static inline int classify11(const QChar *s) { if (s[7].unicode() == 'm') { if (s[8].unicode() == 'a') { if (s[9].unicode() == 'g') { - if (s[10].unicode() == 'e') { + if (s[10].unicode() == 'e') return T_DOXY_INLINEIMAGE; - } } } } @@ -2642,9 +2448,8 @@ static inline int classify11(const QChar *s) { if (s[7].unicode() == 'n') { if (s[8].unicode() == 'a') { if (s[9].unicode() == 'r') { - if (s[10].unicode() == 'y') { + if (s[10].unicode() == 'y') return T_DOXY_PRELIMINARY; - } } } } @@ -2665,9 +2470,8 @@ static inline int classify11(const QChar *s) { if (s[7].unicode() == 'a') { if (s[8].unicode() == 'l') { if (s[9].unicode() == 's') { - if (s[10].unicode() == 'o') { + if (s[10].unicode() == 'o') return T_DOXY_RELATESALSO; - } } } } @@ -2688,9 +2492,8 @@ static inline int classify11(const QChar *s) { if (s[7].unicode() == 'l') { if (s[8].unicode() == 'u') { if (s[9].unicode() == 'd') { - if (s[10].unicode() == 'e') { + if (s[10].unicode() == 'e') return T_DOXY_VERBINCLUDE; - } } } } @@ -2716,9 +2519,8 @@ static inline int classify12(const QChar *s) { if (s[8].unicode() == 'p') { if (s[9].unicode() == 'a') { if (s[10].unicode() == 'g') { - if (s[11].unicode() == 'e') { + if (s[11].unicode() == 'e') return T_DOXY_CONTENTSPAGE; - } } } } @@ -2741,9 +2543,8 @@ static inline int classify12(const QChar *s) { if (s[8].unicode() == 'o') { if (s[9].unicode() == 'n') { if (s[10].unicode() == 'l') { - if (s[11].unicode() == 'y') { + if (s[11].unicode() == 'y') return T_DOXY_ENDLATEXONLY; - } } } } @@ -2760,9 +2561,8 @@ static inline int classify12(const QChar *s) { if (s[8].unicode() == 't') { if (s[9].unicode() == 'i') { if (s[10].unicode() == 'o') { - if (s[11].unicode() == 'n') { + if (s[11].unicode() == 'n') return T_DOXY_ENDQUOTATION; - } } } } @@ -2783,9 +2583,8 @@ static inline int classify12(const QChar *s) { if (s[8].unicode() == 'p') { if (s[9].unicode() == 'a') { if (s[10].unicode() == 'g') { - if (s[11].unicode() == 'e') { + if (s[11].unicode() == 'e') return T_DOXY_EXTERNALPAGE; - } } } } @@ -2808,9 +2607,8 @@ static inline int classify12(const QChar *s) { if (s[8].unicode() == 'l') { if (s[9].unicode() == 'i') { if (s[10].unicode() == 's') { - if (s[11].unicode() == 't') { + if (s[11].unicode() == 't') return T_DOXY_GENERATELIST; - } } } } @@ -2833,9 +2631,8 @@ static inline int classify12(const QChar *s) { if (s[8].unicode() == 'f') { if (s[9].unicode() == 'i') { if (s[10].unicode() == 'l') { - if (s[11].unicode() == 'e') { + if (s[11].unicode() == 'e') return T_DOXY_INHEADERFILE; - } } } } @@ -2858,9 +2655,8 @@ static inline int classify12(const QChar *s) { if (s[8].unicode() == 'r') { if (s[9].unicode() == 'a') { if (s[10].unicode() == 'n') { - if (s[11].unicode() == 't') { + if (s[11].unicode() == 't') return T_DOXY_NONREENTRANT; - } } } } @@ -2883,9 +2679,8 @@ static inline int classify12(const QChar *s) { if (s[8].unicode() == 'p') { if (s[9].unicode() == 'a') { if (s[10].unicode() == 'g') { - if (s[11].unicode() == 'e') { + if (s[11].unicode() == 'e') return T_DOXY_PREVIOUSPAGE; - } } } } @@ -2913,9 +2708,8 @@ static inline int classify13(const QChar *s) { if (s[9].unicode() == 'r') { if (s[10].unicode() == 'o') { if (s[11].unicode() == 'u') { - if (s[12].unicode() == 'p') { + if (s[12].unicode() == 'p') return T_DOXY_INPUBLICGROUP; - } } } } @@ -2940,9 +2734,8 @@ static inline int classify13(const QChar *s) { if (s[9].unicode() == 'p') { if (s[10].unicode() == 'i') { if (s[11].unicode() == 'n') { - if (s[12].unicode() == 'g') { + if (s[12].unicode() == 'g') return T_DOXY_NOSUBGROUPING; - } } } } @@ -2967,9 +2760,8 @@ static inline int classify13(const QChar *s) { if (s[9].unicode() == 'f') { if (s[10].unicode() == 'i') { if (s[11].unicode() == 'l') { - if (s[12].unicode() == 'e') { + if (s[12].unicode() == 'e') return T_DOXY_QUOTEFROMFILE; - } } } } @@ -2982,9 +2774,8 @@ static inline int classify13(const QChar *s) { if (s[9].unicode() == 't') { if (s[10].unicode() == 'i') { if (s[11].unicode() == 'o') { - if (s[12].unicode() == 'n') { + if (s[12].unicode() == 'n') return T_DOXY_QUOTEFUNCTION; - } } } } @@ -3009,9 +2800,8 @@ static inline int classify13(const QChar *s) { if (s[9].unicode() == 't') { if (s[10].unicode() == 'i') { if (s[11].unicode() == 'o') { - if (s[12].unicode() == 'n') { + if (s[12].unicode() == 'n') return T_DOXY_SUBSUBSECTION; - } } } } @@ -3042,9 +2832,8 @@ static inline int classify15(const QChar *s) { if (s[11].unicode() == 'i') { if (s[12].unicode() == 'z') { if (s[13].unicode() == 'e') { - if (s[14].unicode() == 'r') { + if (s[14].unicode() == 'r') return T_DOXY_HIDEINITIALIZER; - } } } } @@ -3073,9 +2862,8 @@ static inline int classify15(const QChar *s) { if (s[11].unicode() == 'i') { if (s[12].unicode() == 'z') { if (s[13].unicode() == 'e') { - if (s[14].unicode() == 'r') { + if (s[14].unicode() == 'r') return T_DOXY_SHOWINITIALIZER; - } } } } @@ -3104,9 +2892,8 @@ static inline int classify15(const QChar *s) { if (s[11].unicode() == 'e') { if (s[12].unicode() == 'n') { if (s[13].unicode() == 't') { - if (s[14].unicode() == 's') { + if (s[14].unicode() == 's') return T_DOXY_TABLEOFCONTENTS; - } } } } diff --git a/src/plugins/cpptools/cppfindreferences.cpp b/src/plugins/cpptools/cppfindreferences.cpp index c782f1a5ed..e2774460f1 100644 --- a/src/plugins/cpptools/cppfindreferences.cpp +++ b/src/plugins/cpptools/cppfindreferences.cpp @@ -450,9 +450,8 @@ bool CppFindReferences::findSymbol(CppFindReferencesParameters *parameters, const Snapshot &snapshot) { QString symbolFile = QLatin1String(parameters->symbol->fileName()); - if (!snapshot.contains(symbolFile)) { + if (!snapshot.contains(symbolFile)) return false; - } Document::Ptr newSymbolDocument = snapshot.document(symbolFile); // document is not parsed and has no bindings yet, do it diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index 0d75816c7f..7e89b9f98a 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -270,9 +270,8 @@ void CppPreprocessor::addFrameworkPath(const QString &frameworkPath) if (!framework.isDir()) continue; const QFileInfo privateFrameworks(framework.absoluteFilePath(), QLatin1String("Frameworks")); - if (privateFrameworks.exists() && privateFrameworks.isDir()) { + if (privateFrameworks.exists() && privateFrameworks.isDir()) addFrameworkPath(privateFrameworks.absoluteFilePath()); - } } } @@ -645,9 +644,8 @@ CppModelManager *CppModelManager::instance() if (m_modelManagerInstance) return m_modelManagerInstance; QMutexLocker locker(&m_modelManagerMutex); - if (!m_modelManagerInstance) { + if (!m_modelManagerInstance) m_modelManagerInstance = new CppModelManager; - } return m_modelManagerInstance; } @@ -1202,9 +1200,8 @@ void CppModelManager::onAboutToRemoveProject(ProjectExplorer::Project *project) void CppModelManager::onAboutToUnloadSession() { - if (Core::ProgressManager *pm = Core::ICore::progressManager()) { + if (Core::ProgressManager *pm = Core::ICore::progressManager()) pm->cancelTasks(QLatin1String(CppTools::Constants::TASK_INDEX)); - } do { QMutexLocker locker(&mutex); m_projects.clear(); @@ -1232,9 +1229,8 @@ void CppModelManager::GC() processed.insert(fn); - if (Document::Ptr doc = currentSnapshot.document(fn)) { + if (Document::Ptr doc = currentSnapshot.document(fn)) todo += doc->includedFiles(); - } } QStringList removedFiles; diff --git a/src/plugins/cpptools/cpptoolseditorsupport.cpp b/src/plugins/cpptools/cpptoolseditorsupport.cpp index e88518ad2d..0a4d1d7f97 100644 --- a/src/plugins/cpptools/cpptoolseditorsupport.cpp +++ b/src/plugins/cpptools/cpptoolseditorsupport.cpp @@ -108,9 +108,8 @@ void CppEditorSupport::updateDocument() { _revision = editorRevision(); - if (qobject_cast<TextEditor::BaseTextEditorWidget*>(_textEditor->widget()) != 0) { + if (qobject_cast<TextEditor::BaseTextEditorWidget*>(_textEditor->widget()) != 0) _modelManager->stopEditorSelectionsUpdate(); - } _updateDocumentTimer->start(_updateDocumentInterval); } diff --git a/src/plugins/cpptools/searchsymbols.cpp b/src/plugins/cpptools/searchsymbols.cpp index 75976b42a6..bc9012ef68 100644 --- a/src/plugins/cpptools/searchsymbols.cpp +++ b/src/plugins/cpptools/searchsymbols.cpp @@ -278,13 +278,12 @@ QString SearchSymbols::symbolName(const Symbol *symbol) const } else if (symbol->isEnum()) { type = QLatin1String("enum"); } else if (const Class *c = symbol->asClass()) { - if (c->isUnion()) { + if (c->isUnion()) type = QLatin1String("union"); - } else if (c->isStruct()) { + else if (c->isStruct()) type = QLatin1String("struct"); - } else { + else type = QLatin1String("class"); - } } else { type = QLatin1String("symbol"); } diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp index 1185aa2ce0..91097dcec9 100644 --- a/src/plugins/cvs/cvsplugin.cpp +++ b/src/plugins/cvs/cvsplugin.cpp @@ -681,11 +681,10 @@ void CvsPlugin::revertAll() const CvsResponse revertResponse = runCvs(state.topLevel(), args, m_settings.timeOutMS(), SshPasswordPrompt|ShowStdOutInLogWindow); - if (revertResponse.result == CvsResponse::Ok) { + if (revertResponse.result == CvsResponse::Ok) cvsVersionControl()->emitRepositoryChanged(state.topLevel()); - } else { + else QMessageBox::warning(0, title, tr("Revert failed: %1").arg(revertResponse.message), QMessageBox::Ok); - } } void CvsPlugin::revertCurrentFile() @@ -719,9 +718,8 @@ void CvsPlugin::revertCurrentFile() const CvsResponse revertResponse = runCvs(state.currentFileTopLevel(), args, m_settings.timeOutMS(), SshPasswordPrompt|ShowStdOutInLogWindow); - if (revertResponse.result == CvsResponse::Ok) { + if (revertResponse.result == CvsResponse::Ok) cvsVersionControl()->emitFilesChanged(QStringList(state.currentFile())); - } } void CvsPlugin::diffProject() @@ -776,11 +774,10 @@ void CvsPlugin::startCommit(const QString &workingDir, const QStringList &files) StateList statusOutput = parseStatusOutput(QString(), response.stdOut); if (!files.isEmpty()) { for (StateList::iterator it = statusOutput.begin(); it != statusOutput.end() ; ) { - if (files.contains(it->second)) { + if (files.contains(it->second)) ++it; - } else { + else it = statusOutput.erase(it); - } } } if (statusOutput.empty()) { diff --git a/src/plugins/cvs/cvsutils.cpp b/src/plugins/cvs/cvsutils.cpp index 4f660fa0b6..6384fa87c3 100644 --- a/src/plugins/cvs/cvsutils.cpp +++ b/src/plugins/cvs/cvsutils.cpp @@ -130,11 +130,10 @@ QList<CvsLogEntry> parseLogEntries(const QString &o, // Purge out files with no matching commits if (!filterCommitId.isEmpty()) { for (QList<CvsLogEntry>::iterator it = rc.begin(); it != rc.end(); ) { - if (it->revisions.empty()) { + if (it->revisions.empty()) it = rc.erase(it); - } else { + else ++it; - } } } return rc; @@ -152,11 +151,10 @@ QString fixDiffOutput(QString d) if (endOfLinePos == -1) break; const int nextLinePos = endOfLinePos + 1; - if (d.at(pos) == questionMark) { + if (d.at(pos) == questionMark) d.remove(pos, nextLinePos - pos); - } else { + else pos = nextLinePos; - } } return d; } diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp index f66e8031f1..8e781f766b 100644 --- a/src/plugins/debugger/breakhandler.cpp +++ b/src/plugins/debugger/breakhandler.cpp @@ -398,11 +398,10 @@ void BreakHandler::loadBreakpoints() v = map.value(_("message")); if (v.isValid()) data.message = v.toString(); - if (data.isValid()) { + if (data.isValid()) appendBreakpoint(data); - } else { + else qWarning("Not restoring invalid breakpoint: %s", qPrintable(data.toString())); - } } //qDebug() << "LOADED BREAKPOINTS" << this << list.size(); } diff --git a/src/plugins/debugger/breakwindow.cpp b/src/plugins/debugger/breakwindow.cpp index 7b4ad4cff3..2127e3e0a5 100644 --- a/src/plugins/debugger/breakwindow.cpp +++ b/src/plugins/debugger/breakwindow.cpp @@ -494,11 +494,10 @@ void BreakpointDialog::setParts(unsigned mask, const BreakpointParameters &data) } if (mask & ExpressionPart) { - if (!data.expression.isEmpty()) { + if (!data.expression.isEmpty()) m_lineEditExpression->setText(data.expression); - } else { + else m_lineEditExpression->clear(); - } } if (mask & ConditionPart) diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index f24a4d4846..983e832a91 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -957,11 +957,10 @@ void CdbEngine::processFinished() m_process.exitStatus(), m_process.exitCode()); const bool crashed = m_process.exitStatus() == QProcess::CrashExit; - if (crashed) { + if (crashed) showMessage(tr("CDB crashed"), LogError); // not in your life. - } else { + else showMessage(tr("CDB exited (%1)").arg(m_process.exitCode()), LogMisc); - } if (m_notifyEngineShutdownOnTermination) { if (crashed) { @@ -1155,11 +1154,10 @@ void CdbEngine::interruptInferior() qDebug() << "CdbEngine::interruptInferior()" << stateName(state()); bool ok = false; - if (!canInterruptInferior()) { + if (!canInterruptInferior()) showMessage(tr("Interrupting is not possible in remote sessions."), LogError); - } else { + else ok = doInterruptInferior(NoSpecialStop); - } // Restore running state if stop failed. if (!ok) { STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorStopOk") @@ -1456,11 +1454,10 @@ void CdbEngine::activateFrame(int index) if (showAssembler) { // Assembly code: Clean out model and force instruction mode. watchHandler()->removeAllData(); QAction *assemblerAction = theAssemblerAction(); - if (assemblerAction->isChecked()) { + if (assemblerAction->isChecked()) gotoLocation(frame); - } else { + else assemblerAction->trigger(); // Seems to trigger update - } } else { gotoLocation(frame); updateLocals(true); @@ -1751,11 +1748,10 @@ void CdbEngine::fetchMemory(MemoryAgent *agent, QObject *editor, quint64 addr, q if (debug) qDebug("CdbEngine::fetchMemory %llu bytes from 0x%llx", length, addr); const MemoryViewCookie cookie(agent, editor, addr, length); - if (m_accessible) { + if (m_accessible) postFetchMemory(cookie); - } else { + else doInterruptInferiorCustomSpecialStop(qVariantFromValue(cookie)); - } } void CdbEngine::postFetchMemory(const MemoryViewCookie &cookie) @@ -1920,9 +1916,8 @@ void CdbEngine::handleLocals(const CdbExtensionCommandPtr &reply) GdbMi root; root.fromString(reply->reply); QTC_ASSERT(root.isList(), return); - if (debugLocals) { + if (debugLocals) qDebug() << root.toString(true, 4); - } // Courtesy of GDB engine foreach (const GdbMi &child, root.children()) { WatchData dummy; @@ -2093,13 +2088,12 @@ unsigned CdbEngine::examineStopReason(const GdbMi &stopReason, } } QString tid = QString::number(threadId); - if (id && breakHandler()->type(id) == WatchpointAtAddress) { + if (id && breakHandler()->type(id) == WatchpointAtAddress) *message = msgWatchpointByAddressTriggered(id, number, breakHandler()->address(id), tid); - } else if (id && breakHandler()->type(id) == WatchpointAtExpression) { + else if (id && breakHandler()->type(id) == WatchpointAtExpression) *message = msgWatchpointByExpressionTriggered(id, number, breakHandler()->expression(id), tid); - } else { + else *message = msgBreakpointTriggered(id, number, tid); - } rc |= StopReportStatusMessage|StopNotifyStop; return rc; } @@ -2337,11 +2331,10 @@ void CdbEngine::handleExtensionMessage(char t, int token, const QByteArray &what QDebug nospace = qDebug().nospace(); nospace << "handleExtensionMessage " << t << ' ' << token << ' ' << what << ' ' << stateName(state()); - if (t == 'N' || debug > 1) { + if (t == 'N' || debug > 1) nospace << ' ' << message; - } else { + else nospace << ' ' << message.size() << " bytes"; - } } // Is there a reply expected, some command queued? @@ -2912,11 +2905,10 @@ void CdbEngine::handleStackTrace(const CdbExtensionCommandPtr &command) void CdbEngine::handleExpression(const CdbExtensionCommandPtr &command) { int value = 0; - if (command->success) { + if (command->success) value = command->reply.toInt(); - } else { + else showMessage(QString::fromLocal8Bit(command->errorMessage), LogError); - } // Is this a conditional breakpoint? if (command->cookie.isValid() && command->cookie.canConvert<ConditionalBreakPointCookie>()) { const ConditionalBreakPointCookie cookie = qvariant_cast<ConditionalBreakPointCookie>(command->cookie); @@ -2927,11 +2919,10 @@ void CdbEngine::handleExpression(const CdbExtensionCommandPtr &command) arg(cookie.id.toString()); showMessage(message, LogMisc); // Stop if evaluation is true, else continue - if (value) { + if (value) processStop(cookie.stopReason, true); - } else { + else postCommand("g", 0); - } } } @@ -3087,11 +3078,10 @@ void CdbEngine::handleBreakPoints(const GdbMi &value) } } // not pending reported } // foreach - if (m_pendingBreakpointMap.empty()) { + if (m_pendingBreakpointMap.empty()) str << QLatin1String("All breakpoints have been resolved.\n"); - } else { + else str << QString::fromLatin1("%1 breakpoint(s) pending...\n").arg(m_pendingBreakpointMap.size()); - } showMessage(message, LogMisc); } diff --git a/src/plugins/debugger/cdb/cdbparsehelpers.cpp b/src/plugins/debugger/cdb/cdbparsehelpers.cpp index 0173eb52e2..4e53737094 100644 --- a/src/plugins/debugger/cdb/cdbparsehelpers.cpp +++ b/src/plugins/debugger/cdb/cdbparsehelpers.cpp @@ -385,11 +385,10 @@ QString debugByteArray(const QByteArray &a) str << "\\r"; break; default: - if (uc >=32 && uc < 128) { + if (uc >=32 && uc < 128) str << a.at(i); - } else { + else str << '<' << unsigned(uc) << '>'; - } break; } } @@ -614,9 +613,8 @@ DisassemblerLines parseCdbDisassembler(const QList<QByteArray> &a) } // Determine address of function from the first assembler line after a // function header line. - if (!functionAddress && disassemblyLine.address) { + if (!functionAddress && disassemblyLine.address) functionAddress = disassemblyLine.address - functionOffset; - } if (functionAddress && disassemblyLine.address) disassemblyLine.offset = disassemblyLine.address - functionAddress; disassemblyLine.function = currentFunction; diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index 287b20c10b..8718615178 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -537,11 +537,10 @@ void DebuggerEngine::showMessage(const QString &msg, int channel, int timeout) c consoleManager->printToConsolePane(QmlJS::ConsoleItem::UndefinedType, msg); debuggerCore()->showMessage(msg, channel, timeout); - if (d->m_runControl) { + if (d->m_runControl) d->m_runControl->showMessage(msg, channel); - } else { + else qWarning("Warning: %s (no active run control)", qPrintable(msg)); - } } void DebuggerEngine::startDebugger(DebuggerRunControl *runControl) @@ -986,9 +985,8 @@ void DebuggerEngine::notifyInferiorStopOk() showMessage(_("NOTE: ... FORWARDING TO 'STOP OK'. ")); setState(InferiorStopOk); } - if (state() == InferiorStopOk || state() == InferiorStopFailed) { + if (state() == InferiorStopOk || state() == InferiorStopFailed) d->queueShutdownInferior(); - } showMessage(_("NOTE: ... IGNORING STOP MESSAGE")); return; } diff --git a/src/plugins/debugger/debuggerkitconfigwidget.cpp b/src/plugins/debugger/debuggerkitconfigwidget.cpp index 762c5e50f8..968fc5fb78 100644 --- a/src/plugins/debugger/debuggerkitconfigwidget.cpp +++ b/src/plugins/debugger/debuggerkitconfigwidget.cpp @@ -140,11 +140,10 @@ DebuggerKitConfigDialog::DebuggerKitConfigDialog(QWidget *parent) formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow); m_comboBox->addItem(DebuggerKitInformation::debuggerEngineName(GdbEngineType), QVariant(int(GdbEngineType))); - if (ProjectExplorer::Abi::hostAbi().os() == ProjectExplorer::Abi::WindowsOS) { + if (ProjectExplorer::Abi::hostAbi().os() == ProjectExplorer::Abi::WindowsOS) m_comboBox->addItem(DebuggerKitInformation::debuggerEngineName(CdbEngineType), QVariant(int(CdbEngineType))); - } else { + else m_comboBox->addItem(DebuggerKitInformation::debuggerEngineName(LldbEngineType), QVariant(int(LldbEngineType))); - } connect(m_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(refreshLabel())); QLabel *engineTypeLabel = new QLabel(tr("&Engine:")); engineTypeLabel->setBuddy(m_comboBox); diff --git a/src/plugins/debugger/debuggerkitinformation.cpp b/src/plugins/debugger/debuggerkitinformation.cpp index 7210757aa9..9c78eb000f 100644 --- a/src/plugins/debugger/debuggerkitinformation.cpp +++ b/src/plugins/debugger/debuggerkitinformation.cpp @@ -217,11 +217,10 @@ static unsigned debuggerConfigurationErrors(const ProjectExplorer::Kit *k) return NoDebugger; const QFileInfo fi = item.binary.toFileInfo(); - if (!fi.exists() || fi.isDir()) { + if (!fi.exists() || fi.isDir()) result |= DebuggerNotFound; - } else if (!fi.isExecutable()) { + else if (!fi.isExecutable()) result |= DebuggerNotExecutable; - } if (!fi.exists() || fi.isDir()) // We need an absolute path to be able to locate Python on Windows. diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 7e186a6f0e..c3b7021bf9 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -1192,9 +1192,8 @@ public slots: // Go to source only if we have the file. if (currentEngine()->stackHandler()->currentIndex() >= 0) { const StackFrame frame = currentEngine()->stackHandler()->currentFrame(); - if (operateByInstructionTriggered || frame.isUsable()) { + if (operateByInstructionTriggered || frame.isUsable()) currentEngine()->gotoLocation(Location(frame, true)); - } } } diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp index 7602190944..aa4b185948 100644 --- a/src/plugins/debugger/debuggerrunner.cpp +++ b/src/plugins/debugger/debuggerrunner.cpp @@ -604,9 +604,8 @@ DebuggerRunControl *DebuggerRunControlFactory::doCreate DebuggerStartParameters sp = sp0; if (!debuggerCore()->boolSetting(AutoEnrichParameters)) { const QString sysroot = sp.sysRoot; - if (sp.debugInfoLocation.isEmpty()) { + if (sp.debugInfoLocation.isEmpty()) sp.debugInfoLocation = sysroot + QLatin1String("/usr/lib/debug"); - } if (sp.debugSourceLocation.isEmpty()) { QString base = sysroot + QLatin1String("/usr/src/debug/"); sp.debugSourceLocation.append(base + QLatin1String("qt5base/src/corelib")); diff --git a/src/plugins/debugger/debuggertooltipmanager.cpp b/src/plugins/debugger/debuggertooltipmanager.cpp index 8fd0310154..8b6637f879 100644 --- a/src/plugins/debugger/debuggertooltipmanager.cpp +++ b/src/plugins/debugger/debuggertooltipmanager.cpp @@ -280,11 +280,10 @@ void StandardItemTreeModelBuilder::addItem(const QString &s) void StandardItemTreeModelBuilder::pushRow() { - if (m_rowParents.isEmpty()) { + if (m_rowParents.isEmpty()) m_model->appendRow(m_row); - } else { + else m_rowParents.top()->appendRow(m_row); - } m_rowParents.push(m_row.front()); m_row.clear(); } @@ -379,11 +378,10 @@ void XmlWriterTreeModelVisitor::run() void XmlWriterTreeModelVisitor::handleItem(const QModelIndex &m) { const QString value = m.data(Qt::DisplayRole).toString(); - if (value.isEmpty()) { + if (value.isEmpty()) m_writer.writeEmptyElement(m_modelItemElement); - } else { + else m_writer.writeTextElement(m_modelItemElement, value); - } } // TreeModelVisitor for debugging/copying models @@ -1030,11 +1028,10 @@ void DebuggerToolTipWidget::restoreTreeModel(QXmlStreamReader &r, QStandardItemM case QXmlStreamReader::EndElement: { const QStringRef element = r.name(); // Row closing: pop off parent. - if (element == QLatin1String(modelRowElementC)) { + if (element == QLatin1String(modelRowElementC)) builder.endRow(); - } else if (element == QLatin1String(modelElementC)) { + else if (element == QLatin1String(modelElementC)) withinModel = false; - } } break; // EndElement default: @@ -1145,11 +1142,10 @@ void DebuggerToolTipManager::registerToolTip(DebuggerToolTipWidget *toolTipWidge void DebuggerToolTipManager::purgeClosedToolTips() { for (DebuggerToolTipWidgetList::iterator it = m_tooltips.begin(); it != m_tooltips.end() ; ) { - if (it->isNull()) { + if (it->isNull()) it = m_tooltips.erase(it); - } else { + else ++it; - } } } @@ -1272,11 +1268,10 @@ void DebuggerToolTipManager::slotUpdateVisibleToolTips() // Reposition and show all tooltips of that file. const QString fileName = toolTipEditor.fileName(); foreach (const QPointer<DebuggerToolTipWidget> &tw, m_tooltips) { - if (tw->fileName() == fileName) { + if (tw->fileName() == fileName) tw->positionShow(toolTipEditor); - } else { + else tw->hide(); - } } } diff --git a/src/plugins/debugger/gdb/classicgdbengine.cpp b/src/plugins/debugger/gdb/classicgdbengine.cpp index 5020296d18..2c603829ce 100644 --- a/src/plugins/debugger/gdb/classicgdbengine.cpp +++ b/src/plugins/debugger/gdb/classicgdbengine.cpp @@ -552,11 +552,10 @@ void DumperHelper::evaluationParameters(const WatchData &data, // in rare cases we need more or less: switch (td.type) { case QAbstractItemType: - if (data.dumperFlags.isEmpty()) { + if (data.dumperFlags.isEmpty()) qWarning("Internal error: empty dumper state '%s'.", data.iname.constData()); - } else { + else inner = data.dumperFlags.mid(1); - } break; case QObjectSlotType: case QObjectSignalType: { @@ -1068,11 +1067,10 @@ void GdbEngine::handleDebuggingHelperValue3Classic(const GdbResponse &response) data1.type = data.type.left(data.type.size() - 4); data1.iname = data.iname + '.' + QByteArray::number(i); const QByteArray &addressSpec = list.at(i); - if (addressSpec.startsWith("0x")) { + if (addressSpec.startsWith("0x")) data.setHexAddress(addressSpec); - } else { + else data.dumperFlags = addressSpec; // Item model dumpers pull tricks - } data1.exp = "((" + gdbQuoteTypes(data1.type) + "*)" + addressSpec + ')'; data1.setHasChildren(false); data1.setValueNeeded(); diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 27da9164d1..156e2fa5cd 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -768,19 +768,18 @@ void GdbEngine::handleResponse(const QByteArray &buff) break; QByteArray resultClass = QByteArray::fromRawData(from, inner - from); - if (resultClass == "done") { + if (resultClass == "done") response.resultClass = GdbResultDone; - } else if (resultClass == "running") { + else if (resultClass == "running") response.resultClass = GdbResultRunning; - } else if (resultClass == "connected") { + else if (resultClass == "connected") response.resultClass = GdbResultConnected; - } else if (resultClass == "error") { + else if (resultClass == "error") response.resultClass = GdbResultError; - } else if (resultClass == "exit") { + else if (resultClass == "exit") response.resultClass = GdbResultExit; - } else { + else response.resultClass = GdbResultUnknown; - } from = inner; if (from != to) { @@ -958,9 +957,8 @@ void GdbEngine::postCommandHelper(const GdbCommand &cmd) showMessage(_("QUEUING COMMAND " + cmd.command)); m_commandsToRunOnTemporaryBreak.append(cmd); if (state() == InferiorStopRequested) { - if (cmd.flags & LosesChild) { + if (cmd.flags & LosesChild) notifyInferiorIll(); - } showMessage(_("CHILD ALREADY BEING INTERRUPTED. STILL HOPING.")); // Calling shutdown() here breaks all situations where two // NeedsStop commands are issued in quick succession. @@ -2177,11 +2175,10 @@ void GdbEngine::executeStep() setTokenBarrier(); notifyInferiorRunRequested(); showStatusMessage(tr("Step requested..."), 5000); - if (isReverseDebugging()) { + if (isReverseDebugging()) postCommand("reverse-step", RunRequest, CB(handleExecuteStep)); - } else { + else postCommand("-exec-step", RunRequest, CB(handleExecuteStep)); - } } void GdbEngine::handleExecuteStep(const GdbResponse &response) diff --git a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp index 5c64c11dae..5042a847cd 100644 --- a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp +++ b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp @@ -314,11 +314,10 @@ void GdbRemoteServerEngine::handleTargetQnx(const GdbResponse &response) showMessage(msgAttachedToStoppedInferior(), StatusBar); const qint64 pid = isMasterEngine() ? startParameters().attachPID : masterEngine()->startParameters().attachPID; - if (pid > -1) { + if (pid > -1) postCommand("attach " + QByteArray::number(pid), CB(handleAttach)); - } else { + else handleInferiorPrepared(); - } } else { // 16^error,msg="hd:5555: Connection timed out." QString msg = msgConnectRemoteServerFailed( diff --git a/src/plugins/debugger/gdb/termgdbadapter.cpp b/src/plugins/debugger/gdb/termgdbadapter.cpp index 4d71e42ab8..6711575e9d 100644 --- a/src/plugins/debugger/gdb/termgdbadapter.cpp +++ b/src/plugins/debugger/gdb/termgdbadapter.cpp @@ -61,11 +61,10 @@ GdbTermEngine::GdbTermEngine(const DebuggerStartParameters &startParameters) { #ifdef Q_OS_WIN // Windows up to xp needs a workaround for attaching to freshly started processes. see proc_stub_win - if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA) { + if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA) m_stubProc.setMode(Utils::ConsoleProcess::Suspend); - } else { + else m_stubProc.setMode(Utils::ConsoleProcess::Debug); - } #else m_stubProc.setMode(Utils::ConsoleProcess::Debug); m_stubProc.setSettings(Core::ICore::settings()); diff --git a/src/plugins/debugger/lldb/guest/lldbengineguest.cpp b/src/plugins/debugger/lldb/guest/lldbengineguest.cpp index 51f5abf04c..ffe664d450 100644 --- a/src/plugins/debugger/lldb/guest/lldbengineguest.cpp +++ b/src/plugins/debugger/lldb/guest/lldbengineguest.cpp @@ -493,9 +493,8 @@ void LldbEngineGuest::selectThread(qint64 token) qDebug() << "\t\tsymbol: " << sym.IsValid() << sym.GetName() << sym.GetMangledName(); qDebug() << "\t\tfunction:" << func.IsValid(); qDebug() << "\t\ttu: " << tu.IsValid(); - if (tu.IsValid()) { + if (tu.IsValid()) - } qDebug() << "\t\tmodule: " << module.IsValid() << module.GetFileSpec().IsValid() << module.GetFileSpec().GetFilename(); qDebug() << "\t\tblock: " << block.IsValid() << block.GetInlinedName(); @@ -676,9 +675,8 @@ void LldbEngineGuest::lldbEvent(lldb::SBEvent *ev) case 1: switch (m_process->GetState()) { case lldb::eStateRunning: // 5 - if (!m_running) { + if (!m_running) m_running = true; - } notifyInferiorPid(m_process->GetProcessID()); switch (state()) { case EngineRunRequested: @@ -696,9 +694,8 @@ void LldbEngineGuest::lldbEvent(lldb::SBEvent *ev) } break; case lldb::eStateExited: // 9 - if (m_running) { + if (m_running) m_running = false; - } switch (state()) { case InferiorShutdownRequested: notifyInferiorShutdownOk(); @@ -716,9 +713,8 @@ void LldbEngineGuest::lldbEvent(lldb::SBEvent *ev) } break; case lldb::eStateStopped: // 4 - if (m_running) { + if (m_running) m_running = false; - } switch (state()) { case InferiorShutdownRequested: notifyInferiorShutdownOk(); @@ -735,9 +731,8 @@ void LldbEngineGuest::lldbEvent(lldb::SBEvent *ev) } break; case lldb::eStateCrashed: // 7 - if (m_running) { + if (m_running) m_running = false; - } switch (state()) { case InferiorShutdownRequested: notifyInferiorShutdownOk(); diff --git a/src/plugins/debugger/lldb/lldbenginehost.cpp b/src/plugins/debugger/lldb/lldbenginehost.cpp index 3786cce6dc..10b8840fae 100644 --- a/src/plugins/debugger/lldb/lldbenginehost.cpp +++ b/src/plugins/debugger/lldb/lldbenginehost.cpp @@ -97,9 +97,8 @@ qint64 SshIODevice::readData (char * data, qint64 maxSize) return 0; qint64 size = maxSize; while (size > 0) { - if (!buckets.size()) { + if (!buckets.size()) return maxSize - size; - } QByteArray &bucket = buckets.head(); if ((size + buckethead) >= bucket.size()) { int d = bucket.size() - buckethead; diff --git a/src/plugins/debugger/qml/baseqmldebuggerclient.cpp b/src/plugins/debugger/qml/baseqmldebuggerclient.cpp index 8729cbc7d8..faf98faced 100644 --- a/src/plugins/debugger/qml/baseqmldebuggerclient.cpp +++ b/src/plugins/debugger/qml/baseqmldebuggerclient.cpp @@ -65,11 +65,10 @@ void BaseQmlDebuggerClient::statusChanged(QmlDebug::ClientStatus status) void BaseQmlDebuggerClient::sendMessage(const QByteArray &msg) { - if (status() == QmlDebug::Enabled) { + if (status() == QmlDebug::Enabled) QmlDebugClient::sendMessage(msg); - } else { + else d->sendBuffer.append(msg); - } } void BaseQmlDebuggerClient::flushSendBuffer() diff --git a/src/plugins/debugger/qml/qmladapter.cpp b/src/plugins/debugger/qml/qmladapter.cpp index d9ab65691f..f6db5fec81 100644 --- a/src/plugins/debugger/qml/qmladapter.cpp +++ b/src/plugins/debugger/qml/qmladapter.cpp @@ -95,9 +95,8 @@ void QmlAdapter::closeConnection() if (m_connectionTimer.isActive()) { m_connectionTimer.stop(); } else { - if (m_conn) { + if (m_conn) m_conn->close(); - } } } diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp index 01d993c91c..0759f4d554 100644 --- a/src/plugins/debugger/qml/qmlengine.cpp +++ b/src/plugins/debugger/qml/qmlengine.cpp @@ -386,9 +386,8 @@ void QmlEngine::connectionEstablished() { attemptBreakpointSynchronization(); - if (!watchHandler()->watcherNames().isEmpty()) { + if (!watchHandler()->watcherNames().isEmpty()) synchronizeWatchers(); - } connect(watchersModel(),SIGNAL(layoutChanged()),this,SLOT(synchronizeWatchers())); if (state() == EngineRunRequested) @@ -532,9 +531,8 @@ void QmlEngine::filterApplicationMessage(const QString &output, int /*channel*/) void QmlEngine::showMessage(const QString &msg, int channel, int timeout) const { - if (channel == AppOutput || channel == AppError) { + if (channel == AppOutput || channel == AppError) const_cast<QmlEngine*>(this)->filterApplicationMessage(msg, channel); - } DebuggerEngine::showMessage(msg, channel, timeout); } @@ -560,9 +558,8 @@ void QmlEngine::gotoLocation(const Location &location) if (!editor) { editor = Core::EditorManager::openEditorWithContents(QmlJSEditor::Constants::C_QMLJSEDITOR_ID, &titlePattern); - if (editor) { + if (editor) editor->setProperty(Constants::OPENED_BY_DEBUGGER, true); - } updateEditor(editor, m_sourceDocuments.value(fileName)); } @@ -648,9 +645,8 @@ void QmlEngine::shutdownInferior() if (m_adapter.activeDebuggerClient()) m_adapter.activeDebuggerClient()->endSession(); - if (isSlaveEngine()) { + if (isSlaveEngine()) resetLocation(); - } stopApplicationLauncher(); closeConnection(); @@ -692,9 +688,8 @@ void QmlEngine::setupEngine() void QmlEngine::continueInferior() { QTC_ASSERT(state() == InferiorStopOk, qDebug() << state()); - if (m_adapter.activeDebuggerClient()) { + if (m_adapter.activeDebuggerClient()) m_adapter.activeDebuggerClient()->continueInferior(); - } resetLocation(); notifyInferiorRunRequested(); notifyInferiorRunOk(); @@ -702,44 +697,39 @@ void QmlEngine::continueInferior() void QmlEngine::interruptInferior() { - if (m_adapter.activeDebuggerClient()) { + if (m_adapter.activeDebuggerClient()) m_adapter.activeDebuggerClient()->interruptInferior(); - } notifyInferiorStopOk(); } void QmlEngine::executeStep() { - if (m_adapter.activeDebuggerClient()) { + if (m_adapter.activeDebuggerClient()) m_adapter.activeDebuggerClient()->executeStep(); - } notifyInferiorRunRequested(); notifyInferiorRunOk(); } void QmlEngine::executeStepI() { - if (m_adapter.activeDebuggerClient()) { + if (m_adapter.activeDebuggerClient()) m_adapter.activeDebuggerClient()->executeStepI(); - } notifyInferiorRunRequested(); notifyInferiorRunOk(); } void QmlEngine::executeStepOut() { - if (m_adapter.activeDebuggerClient()) { + if (m_adapter.activeDebuggerClient()) m_adapter.activeDebuggerClient()->executeStepOut(); - } notifyInferiorRunRequested(); notifyInferiorRunOk(); } void QmlEngine::executeNext() { - if (m_adapter.activeDebuggerClient()) { + if (m_adapter.activeDebuggerClient()) m_adapter.activeDebuggerClient()->executeNext(); - } notifyInferiorRunRequested(); notifyInferiorRunOk(); } @@ -783,9 +773,8 @@ void QmlEngine::activateFrame(int index) if (state() != InferiorStopOk && state() != InferiorUnrunnable) return; - if (m_adapter.activeDebuggerClient()) { + if (m_adapter.activeDebuggerClient()) m_adapter.activeDebuggerClient()->activateFrame(index); - } gotoLocation(stackHandler()->frames().value(index)); } @@ -854,9 +843,8 @@ void QmlEngine::removeBreakpoint(BreakpointModelId id) } } - if (handler->state(id) == BreakpointRemoveProceeding) { + if (handler->state(id) == BreakpointRemoveProceeding) handler->notifyBreakpointRemoveOk(id); - } } void QmlEngine::changeBreakpoint(BreakpointModelId id) @@ -874,9 +862,8 @@ void QmlEngine::changeBreakpoint(BreakpointModelId id) } } - if (handler->state(id) == BreakpointChangeProceeding) { + if (handler->state(id) == BreakpointChangeProceeding) handler->notifyBreakpointChangeOk(id); - } } void QmlEngine::attemptBreakpointSynchronization() @@ -941,9 +928,8 @@ bool QmlEngine::acceptsBreakpoint(BreakpointModelId id) const //For now, the event breakpoint can be set after the activeDebuggerClient is known //This is because the older client does not support BreakpointOnQmlSignalHandler bool acceptBreakpoint = false; - if (m_adapter.activeDebuggerClient()) { + if (m_adapter.activeDebuggerClient()) acceptBreakpoint = m_adapter.activeDebuggerClient()->acceptsBreakpoint(id); - } return acceptBreakpoint; } @@ -962,9 +948,8 @@ void QmlEngine::reloadModules() void QmlEngine::reloadSourceFiles() { - if (m_adapter.activeDebuggerClient()) { + if (m_adapter.activeDebuggerClient()) m_adapter.activeDebuggerClient()->getSourceFiles(); - } } void QmlEngine::requestModuleSymbols(const QString &moduleName) @@ -1014,9 +999,8 @@ void QmlEngine::updateWatchData(const WatchData &data, m_inspectorAdapter.agent()->updateWatchData(data); } else { if (!data.name.isEmpty() && m_adapter.activeDebuggerClient()) { - if (data.isValueNeeded()) { + if (data.isValueNeeded()) m_adapter.activeDebuggerClient()->updateWatchData(data); - } if (data.isChildrenNeeded() && watchHandler()->isExpandedIName(data.iname)) { m_adapter.activeDebuggerClient()->expandObject(data.iname, data.id); @@ -1208,9 +1192,8 @@ void QmlEngine::appendDebugOutput(QtMsgType type, const QString &message, void QmlEngine::executeDebuggerCommand(const QString &command, DebuggerLanguages languages) { - if ((languages & QmlLanguage) && m_adapter.activeDebuggerClient()) { + if ((languages & QmlLanguage) && m_adapter.activeDebuggerClient()) m_adapter.activeDebuggerClient()->executeDebuggerCommand(command); - } } bool QmlEngine::evaluateScript(const QString &expression) diff --git a/src/plugins/debugger/qml/qmlv8debuggerclient.cpp b/src/plugins/debugger/qml/qmlv8debuggerclient.cpp index 588ad937fe..7c9aa634d7 100644 --- a/src/plugins/debugger/qml/qmlv8debuggerclient.cpp +++ b/src/plugins/debugger/qml/qmlv8debuggerclient.cpp @@ -1207,14 +1207,12 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data) //do nothing, wait for next break } else if (debugCommand == _(BACKTRACE)) { - if (success) { + if (success) updateStack(resp.value(_(BODY)), resp.value(_(REFS))); - } } else if (debugCommand == _(LOOKUP)) { - if (success) { + if (success) expandLocalsAndWatchers(resp.value(_(BODY)), resp.value(_(REFS))); - } } else if (debugCommand == _(EVALUATE)) { int seq = resp.value(_("request_seq")).toInt(); @@ -1228,9 +1226,8 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data) } } else if (debugCommand == _(LISTBREAKPOINTS)) { - if (success) { + if (success) updateBreakpoints(resp.value(_(BODY))); - } } else if (debugCommand == _(SETBREAKPOINT)) { // { "seq" : <number>, @@ -1296,14 +1293,12 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data) } else if (debugCommand == _(FRAME)) { - if (success) { + if (success) setCurrentFrameDetails(resp.value(_(BODY)), resp.value(_(REFS))); - } } else if (debugCommand == _(SCOPE)) { - if (success) { + if (success) updateScope(resp.value(_(BODY)), resp.value(_(REFS))); - } } else if (debugCommand == _(SCOPES)) { } else if (debugCommand == _(SOURCE)) { @@ -1478,9 +1473,8 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data) d->backtrace(); } - if (d->engine->state() == InferiorStopOk) { + if (d->engine->state() == InferiorStopOk) d->backtrace(); - } } else if (eventType == _("afterCompile")) { //Currently break point relocation is disabled. diff --git a/src/plugins/debugger/qml/qscriptdebuggerclient.cpp b/src/plugins/debugger/qml/qscriptdebuggerclient.cpp index 4a595475fa..9b7400fe5c 100644 --- a/src/plugins/debugger/qml/qscriptdebuggerclient.cpp +++ b/src/plugins/debugger/qml/qscriptdebuggerclient.cpp @@ -299,11 +299,10 @@ void QScriptDebuggerClient::synchronizeBreakpoints() str << cmd << " ("; bool first = true; foreach (const JSAgentBreakpointData &bp, d->breakpoints) { - if (first) { + if (first) first = false; - } else { + else str << ", "; - } str << '[' << bp.functionName << ", " << bp.fileUrl << ", " << bp.lineNumber << ']'; } str << ')'; diff --git a/src/plugins/debugger/script/scriptengine.cpp b/src/plugins/debugger/script/scriptengine.cpp index d7d804314f..b8a8a8ff82 100644 --- a/src/plugins/debugger/script/scriptengine.cpp +++ b/src/plugins/debugger/script/scriptengine.cpp @@ -784,11 +784,10 @@ void ScriptEngine::updateSubItem(const WatchData &data0) data1.name = it.name(); data.id = m_watchIdCounter++; m_watchIdToScriptValue.insert(data.id, it.value()); - if (watchHandler()->isExpandedIName(data1.iname)) { + if (watchHandler()->isExpandedIName(data1.iname)) data1.setChildrenNeeded(); - } else { + else data1.setChildrenUnneeded(); - } children.push_back(data1); } data.setHasChildren(!children.isEmpty()); diff --git a/src/plugins/debugger/shared/hostutils.cpp b/src/plugins/debugger/shared/hostutils.cpp index aa38d72611..93fbbbfcc6 100644 --- a/src/plugins/debugger/shared/hostutils.cpp +++ b/src/plugins/debugger/shared/hostutils.cpp @@ -194,9 +194,8 @@ void formatWindowsException(unsigned long code, quint64 address, break; } str << ", flags=0x" << flags; - if (flags == EXCEPTION_NONCONTINUABLE) { + if (flags == EXCEPTION_NONCONTINUABLE) str << " (execution cannot be continued)"; - } str.setIntegerBase(10); } diff --git a/src/plugins/debugger/watchdelegatewidgets.cpp b/src/plugins/debugger/watchdelegatewidgets.cpp index 487a6e0dfa..eb2ac5b452 100644 --- a/src/plugins/debugger/watchdelegatewidgets.cpp +++ b/src/plugins/debugger/watchdelegatewidgets.cpp @@ -134,11 +134,10 @@ QValidator::State IntegerValidator::validateEntry(const QString &s, int base, bo if (bigInt) return QValidator::Acceptable; bool ok; - if (signedV) { + if (signedV) s.toLongLong(&ok, base); - } else { + else s.toULongLong(&ok, base); - } return ok ? QValidator::Acceptable : QValidator::Intermediate; } diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index f405639020..5a274066a0 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -1157,11 +1157,10 @@ bool WatchModel::setData(const QModelIndex &idx, const QVariant &value, int role case LocalsIndividualFormatRole: { const int format = value.toInt(); - if (format == -1) { + if (format == -1) theIndividualFormats.remove(data.iname); - } else { + else theIndividualFormats[data.iname] = format; - } engine()->updateWatchData(data); break; } @@ -1277,17 +1276,15 @@ static bool watchDataLessThan(const QByteArray &iname1, int sortId1, return sortId1 < sortId2; // Get positions of last part of iname 'local.this.i1" -> "i1" int cmpPos1 = iname1.lastIndexOf('.'); - if (cmpPos1 == -1) { + if (cmpPos1 == -1) cmpPos1 = 0; - } else { + else cmpPos1++; - } int cmpPos2 = iname2.lastIndexOf('.'); - if (cmpPos2 == -1) { + if (cmpPos2 == -1) cmpPos2 = 0; - } else { + else cmpPos2++; - } // Are we looking at an array with numerical inames 'local.this.i1.0" -> // Go by sort id. if (cmpPos1 < iname1.size() && cmpPos2 < iname2.size() @@ -1612,11 +1609,10 @@ void WatchHandler::watchExpression(const QString &exp, const QString &name) // (address) if it can be found. Default to watchExpression(). void WatchHandler::watchVariable(const QString &exp) { - if (const WatchData *localVariable = findCppLocalVariable(exp)) { + if (const WatchData *localVariable = findCppLocalVariable(exp)) watchExpression(QLatin1String(localVariable->exp), exp); - } else { + else watchExpression(exp); - } } static void swapEndian(char *d, int nchar) @@ -1657,11 +1653,10 @@ void WatchHandler::showSeparateWidget(QWidget *w) m_separateWindow = new SeparateViewWidget(debuggerCore()->mainWindow()); int index = indexOf(m_separateWindow, w); - if (index != -1) { + if (index != -1) m_separateWindow->setTabText(index, w->windowTitle()); - } else { + else index = m_separateWindow->addTab(w, w->windowTitle()); - } m_separateWindow->setCurrentIndex(index); m_separateWindow->show(); m_separateWindow->raise(); diff --git a/src/plugins/debugger/watchutils.cpp b/src/plugins/debugger/watchutils.cpp index f8e14bd16a..c46dd182a1 100644 --- a/src/plugins/debugger/watchutils.cpp +++ b/src/plugins/debugger/watchutils.cpp @@ -407,11 +407,10 @@ static void blockRecursion(const CPlusPlus::Overview &overview, // the already seen occurrences in a hash. const QString name = overview.prettyName(symbol->name()); SeenHash::iterator it = seenHash->find(name); - if (it == seenHash->end()) { + if (it == seenHash->end()) it = seenHash->insert(name, 0); - } else { + else ++(it.value()); - } // Is the declaration on or past the current line, that is, // the variable not initialized. if (symbol->line() >= line) diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp index afac16e2f6..7464044a2a 100644 --- a/src/plugins/debugger/watchwindow.cpp +++ b/src/plugins/debugger/watchwindow.cpp @@ -444,11 +444,10 @@ static void addStackLayoutMemoryView(DebuggerEngine *engine, bool separateView, const RegisterMapConstIt regcEnd = regMap.constEnd(); for (RegisterMapConstIt it = regMap.constBegin(); it != regcEnd; ++it) { const quint64 value = it.key(); - if (value < start && start - value < 512) { + if (value < start && start - value < 512) start = value; - } else if (value > end && value - end < 512) { + else if (value > end && value - end < 512) end = value + 1; - } } // Indicate all variables. const QColor background = parent->palette().color(QPalette::Normal, QPalette::Base); diff --git a/src/plugins/designer/cpp/formclasswizardpage.cpp b/src/plugins/designer/cpp/formclasswizardpage.cpp index 76ba84018a..f3400efc75 100644 --- a/src/plugins/designer/cpp/formclasswizardpage.cpp +++ b/src/plugins/designer/cpp/formclasswizardpage.cpp @@ -132,9 +132,8 @@ bool FormClassWizardPage::validatePage() { QString errorMessage; const bool rc = m_ui->newClassWidget->isValid(&errorMessage); - if (!rc) { + if (!rc) QMessageBox::warning(this, tr("%1 - Error").arg(title()), errorMessage); - } return rc; } diff --git a/src/plugins/designer/qtcreatorintegration.cpp b/src/plugins/designer/qtcreatorintegration.cpp index 74c55c464b..cd00c742f2 100644 --- a/src/plugins/designer/qtcreatorintegration.cpp +++ b/src/plugins/designer/qtcreatorintegration.cpp @@ -484,9 +484,8 @@ void QtCreatorIntegration::slotNavigateToSlot(const QString &objectName, const Q const QStringList ¶meterNames) { QString errorMessage; - if (!navigateToSlot(objectName, signalSignature, parameterNames, &errorMessage) && !errorMessage.isEmpty()) { + if (!navigateToSlot(objectName, signalSignature, parameterNames, &errorMessage) && !errorMessage.isEmpty()) QMessageBox::warning(m_few->designerEditor()->topLevel(), tr("Error finding/adding a slot."), errorMessage); - } } // Build name of the class as generated by uic, insert Ui namespace diff --git a/src/plugins/designer/qtdesignerformclasscodegenerator.cpp b/src/plugins/designer/qtdesignerformclasscodegenerator.cpp index f7e84e140e..c78f838097 100644 --- a/src/plugins/designer/qtdesignerformclasscodegenerator.cpp +++ b/src/plugins/designer/qtdesignerformclasscodegenerator.cpp @@ -201,9 +201,8 @@ bool QtDesignerFormClassCodeGenerator::generateCpp(const FormClassWizardParamete // Class declaration headerStr << '\n' << namespaceIndent << "class " << unqualifiedClassName << " : public " << formBaseClass; - if (generationParameters.embedding == Internal::InheritedUiClass) { + if (generationParameters.embedding == Internal::InheritedUiClass) headerStr << ", private " << uiClassName; - } headerStr << "\n{\n" << namespaceIndent << indent << "Q_OBJECT\n\n" << namespaceIndent << "public:\n" << namespaceIndent << indent << "explicit " << unqualifiedClassName << "(QWidget *parent = 0);\n"; diff --git a/src/plugins/fakevim/fakevimactions.cpp b/src/plugins/fakevim/fakevimactions.cpp index f0025f4b4e..a558823cb9 100644 --- a/src/plugins/fakevim/fakevimactions.cpp +++ b/src/plugins/fakevim/fakevimactions.cpp @@ -70,9 +70,8 @@ void FakeVimSettings::insertItem(int code, SavedAction *item, m_nameToCode[longName] = code; m_codeToName[code] = longName; } - if (!shortName.isEmpty()) { + if (!shortName.isEmpty()) m_nameToCode[shortName] = code; - } } void FakeVimSettings::readSettings(QSettings *settings) diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 28f6c5b227..081220cc77 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -2081,11 +2081,10 @@ void FakeVimHandler::Private::setupWidget() { m_mode = CommandMode; resetCommandMode(); - if (m_textedit) { + if (m_textedit) m_textedit->setLineWrapMode(QTextEdit::NoWrap); - } else if (m_plaintextedit) { + else if (m_plaintextedit) m_plaintextedit->setLineWrapMode(QPlainTextEdit::NoWrap); - } m_wasReadOnly = EDITOR(isReadOnly()); updateEditor(); @@ -2617,9 +2616,8 @@ void FakeVimHandler::Private::fixSelection() // Exclusive motion ending at the beginning of line and // starting at or before first non-blank on a line becomes linewise. - if (anchor() < block().position() && isFirstNonBlankOnLine(anchor())) { + if (anchor() < block().position() && isFirstNonBlankOnLine(anchor())) m_movetype = MoveLineWise; - } } } @@ -2666,9 +2664,8 @@ void FakeVimHandler::Private::fixSelection() setAnchorAndPosition(anc, position()); } - if (m_anchorPastEnd) { + if (m_anchorPastEnd) setAnchorAndPosition(anchor() + 1, position()); - } } void FakeVimHandler::Private::finishMovement(const QString &dotCommandMovement, int count) @@ -2882,13 +2879,12 @@ void FakeVimHandler::Private::updateMiniBuffer() msg = g.currentCommand; messageLevel = MessageShowCmd; } else if (m_mode == CommandMode && isVisualMode()) { - if (isVisualCharMode()) { + if (isVisualCharMode()) msg = _("VISUAL"); - } else if (isVisualLineMode()) { + else if (isVisualLineMode()) msg = _("VISUAL LINE"); - } else if (isVisualBlockMode()) { + else if (isVisualBlockMode()) msg = _("VISUAL BLOCK"); - } } else if (m_mode == InsertMode) { msg = _("INSERT"); } else if (m_mode == ReplaceMode) { @@ -2911,11 +2907,10 @@ void FakeVimHandler::Private::updateMiniBuffer() const QString pos = QString::fromLatin1("%1,%2") .arg(l + 1).arg(physicalCursorColumn() + 1); // FIXME: physical "-" logical - if (linesInDoc != 0) { + if (linesInDoc != 0) status = FakeVimHandler::tr("%1%2%").arg(pos, -10).arg(l * 100 / linesInDoc, 4); - } else { + else status = FakeVimHandler::tr("%1All").arg(pos, -10); - } emit q->statusDataChanged(status); } @@ -3019,17 +3014,16 @@ bool FakeVimHandler::Private::handleCommandSubSubMode(const Input &input) } } else if (m_subsubmode == OpenSquareSubSubMode || CloseSquareSubSubMode) { int pos = position(); - if ((input.is('{') && m_subsubmode == OpenSquareSubSubMode)) { + if ((input.is('{') && m_subsubmode == OpenSquareSubSubMode)) searchBalanced(false, QLatin1Char('{'), QLatin1Char('}')); - } else if ((input.is('}') && m_subsubmode == CloseSquareSubSubMode)) { + else if ((input.is('}') && m_subsubmode == CloseSquareSubSubMode)) searchBalanced(true, QLatin1Char('}'), QLatin1Char('{')); - } else if ((input.is('(') && m_subsubmode == OpenSquareSubSubMode)) { + else if ((input.is('(') && m_subsubmode == OpenSquareSubSubMode)) searchBalanced(false, QLatin1Char('('), QLatin1Char(')')); - } else if ((input.is(')') && m_subsubmode == CloseSquareSubSubMode)) { + else if ((input.is(')') && m_subsubmode == CloseSquareSubSubMode)) searchBalanced(true, QLatin1Char(')'), QLatin1Char('(')); - } else if (input.is('z')) { + else if (input.is('z')) emit q->foldGoTo(m_subsubmode == OpenSquareSubSubMode ? -count() : count(), true); - } handled = pos != position(); if (handled) { finishMovement(QString::fromLatin1("%1%2%3") @@ -3414,9 +3408,8 @@ EventResult FakeVimHandler::Private::handleCommandMode(const Input &input) // if a key which produces text was pressed, don't mark it as unhandled // - otherwise the text would be inserted while being in command mode - if (input.text().isEmpty()) { + if (input.text().isEmpty()) handled = EventUnhandled; - } } updateMiniBuffer(); @@ -3854,11 +3847,10 @@ bool FakeVimHandler::Private::handleChangeDeleteSubModes(const Input &input) const int anc = firstPositionInLine(line); const int pos = lastPositionInLine(line + count() - 1); setAnchorAndPosition(anc, pos); - if (m_submode == ChangeSubMode) { + if (m_submode == ChangeSubMode) setDotCommand(_("%1cc"), count()); - } else { + else setDotCommand(_("%1dd"), count()); - } finishMovement(); m_submode = NoSubMode; handled = true; @@ -4406,11 +4398,10 @@ EventResult FakeVimHandler::Private::handleSearchSubSubMode(const Input &input) enterCommandMode(g.returnToMode); resetCommandMode(); } else if (input.isBackspace()) { - if (g.searchBuffer.isEmpty()) { + if (g.searchBuffer.isEmpty()) resetCommandMode(); - } else { + else g.searchBuffer.deleteChar(); - } } else if (input.isReturn()) { const QString &needle = g.searchBuffer.contents(); if (!needle.isEmpty()) @@ -7008,11 +6999,10 @@ bool FakeVimHandler::Private::selectBlockTextObject(bool inner, if (p2 == -1) return false; - if (inner) { + if (inner) p1 += sleft.size(); - } else { + else p2 -= sright.size() - 2; - } if (isVisualMode()) --p2; @@ -7075,9 +7065,8 @@ bool FakeVimHandler::Private::changeNumberTextObject(int count) } // preserve leading zeroes - if ((octal || hex) && repl.size() < num.size()) { + if ((octal || hex) && repl.size() < num.size()) prefix.append(QString::fromLatin1("0").repeated(num.size() - repl.size())); - } repl.prepend(prefix); pos += block.position(); @@ -7318,9 +7307,8 @@ bool FakeVimHandler::eventFilter(QObject *ob, QEvent *ev) } if (active && ev->type() == QEvent::MouseButtonPress) { QMouseEvent *mev = static_cast<QMouseEvent *>(ev); - if (mev->button() == Qt::LeftButton) { + if (mev->button() == Qt::LeftButton) d->m_visualMode = NoVisualMode; - } } return QObject::eventFilter(ob, ev); } @@ -7370,9 +7358,8 @@ bool FakeVimHandler::eventFilter(QObject *ob, QEvent *ev) return true; } - if (active && ev->type() == QEvent::FocusIn && ob == d->editor()) { + if (active && ev->type() == QEvent::FocusIn && ob == d->editor()) d->focus(); - } return QObject::eventFilter(ob, ev); } diff --git a/src/plugins/find/basetextfind.cpp b/src/plugins/find/basetextfind.cpp index 4f7ff89f35..5bcdb2835f 100644 --- a/src/plugins/find/basetextfind.cpp +++ b/src/plugins/find/basetextfind.cpp @@ -142,9 +142,8 @@ void BaseTextFind::clearResults() QString BaseTextFind::currentFindString() const { QTextCursor cursor = textCursor(); - if (cursor.hasSelection() && cursor.block() != cursor.document()->findBlock(cursor.anchor())) { + if (cursor.hasSelection() && cursor.block() != cursor.document()->findBlock(cursor.anchor())) return QString(); // multi block selection - } if (cursor.hasSelection()) return cursor.selectedText(); @@ -330,9 +329,8 @@ bool BaseTextFind::find(const QString &txt, Find::FindFlags findFlags, *wrapped = true; } } - if (!found.isNull()) { + if (!found.isNull()) setTextCursor(found); - } return true; } diff --git a/src/plugins/find/currentdocumentfind.cpp b/src/plugins/find/currentdocumentfind.cpp index f89601c926..e7d623b49a 100644 --- a/src/plugins/find/currentdocumentfind.cpp +++ b/src/plugins/find/currentdocumentfind.cpp @@ -230,9 +230,8 @@ bool CurrentDocumentFind::setFocusToCurrentFindSupport() bool CurrentDocumentFind::eventFilter(QObject *obj, QEvent *event) { if (m_currentWidget && obj == m_currentWidget) { - if (event->type() == QEvent::Hide || event->type() == QEvent::Show) { + if (event->type() == QEvent::Hide || event->type() == QEvent::Show) emit changed(); - } } return QObject::eventFilter(obj, event); } diff --git a/src/plugins/find/findtoolbar.cpp b/src/plugins/find/findtoolbar.cpp index 543e92a732..f738df227c 100644 --- a/src/plugins/find/findtoolbar.cpp +++ b/src/plugins/find/findtoolbar.cpp @@ -328,9 +328,8 @@ bool FindToolBar::eventFilter(QObject *obj, QEvent *event) } } else if (obj == this && event->type() == QEvent::Hide) { invokeClearResults(); - if (m_currentDocumentFind->isEnabled()) { + if (m_currentDocumentFind->isEnabled()) m_currentDocumentFind->clearFindScope(); - } } return Utils::StyledBar::eventFilter(obj, event); } @@ -338,9 +337,8 @@ bool FindToolBar::eventFilter(QObject *obj, QEvent *event) void FindToolBar::adaptToCandidate() { updateFindAction(); - if (findToolBarPlaceHolder() == Core::FindToolBarPlaceHolder::getCurrent()) { + if (findToolBarPlaceHolder() == Core::FindToolBarPlaceHolder::getCurrent()) m_currentDocumentFind->acceptCandidate(); - } } void FindToolBar::updateFindAction() @@ -399,16 +397,14 @@ void FindToolBar::invokeFindEnter() void FindToolBar::invokeReplaceEnter() { - if (m_currentDocumentFind->isEnabled() && m_currentDocumentFind->supportsReplace()) { + if (m_currentDocumentFind->isEnabled() && m_currentDocumentFind->supportsReplace()) invokeReplaceNext(); - } } void FindToolBar::invokeClearResults() { - if (m_currentDocumentFind->isEnabled()) { + if (m_currentDocumentFind->isEnabled()) m_currentDocumentFind->clearResults(); - } } @@ -512,9 +508,8 @@ void FindToolBar::invokeReplaceAll() { m_plugin->updateFindCompletion(getFindText()); m_plugin->updateReplaceCompletion(getReplaceText()); - if (m_currentDocumentFind->isEnabled() && m_currentDocumentFind->supportsReplace()) { + if (m_currentDocumentFind->isEnabled() && m_currentDocumentFind->supportsReplace()) m_currentDocumentFind->replaceAll(getFindText(), getReplaceText(), effectiveFindFlags()); - } } void FindToolBar::invokeResetIncrementalSearch() @@ -548,9 +543,8 @@ void FindToolBar::findFlagsChanged() updateIcons(); updateFlagMenus(); invokeClearResults(); - if (isVisible()) { + if (isVisible()) m_currentDocumentFind->highlightAll(getFindText(), effectiveFindFlags()); - } } void FindToolBar::updateIcons() diff --git a/src/plugins/find/findtoolwindow.cpp b/src/plugins/find/findtoolwindow.cpp index 35ec2f0caf..6f2a1c7c14 100644 --- a/src/plugins/find/findtoolwindow.cpp +++ b/src/plugins/find/findtoolwindow.cpp @@ -165,9 +165,8 @@ void FindToolWindow::setCurrentFilter(IFindFilter *filter) if (!filter) filter = m_currentFilter; int index = m_filters.indexOf(filter); - if (index >= 0) { + if (index >= 0) setCurrentFilter(index); - } updateFindFlags(); m_ui.searchTerm->setFocus(); m_ui.searchTerm->selectAll(); @@ -185,9 +184,8 @@ void FindToolWindow::setCurrentFilter(int index) m_currentFilter = m_filters.at(i); connect(m_currentFilter, SIGNAL(enabledChanged(bool)), this, SLOT(updateButtonStates())); updateButtonStates(); - if (m_configWidget) { + if (m_configWidget) m_ui.configWidget->layout()->addWidget(m_configWidget); - } } else { if (configWidget) configWidget->setParent(0); @@ -258,9 +256,8 @@ void FindToolWindow::readSettings() for (int i = 0; i < m_filters.size(); ++i) { IFindFilter *filter = m_filters.at(i); filter->readSettings(settings); - if (filter->id() == currentFilter) { + if (filter->id() == currentFilter) setCurrentFilter(i); - } } settings->endGroup(); } diff --git a/src/plugins/find/ifindfilter.cpp b/src/plugins/find/ifindfilter.cpp index feda930078..8487f74f9f 100644 --- a/src/plugins/find/ifindfilter.cpp +++ b/src/plugins/find/ifindfilter.cpp @@ -253,9 +253,8 @@ QPixmap Find::IFindFilter::pixmapForFindFlags(Find::FindFlags flags) painter.drawPixmap(x - 6, 0, regexpIcon); x += 6; } - if (preservecase) { + if (preservecase) painter.drawPixmap(x - 6, 0, preservecaseIcon); - } return pixmap; } diff --git a/src/plugins/find/searchresulttreeitemdelegate.cpp b/src/plugins/find/searchresulttreeitemdelegate.cpp index 5110e3d24f..7f9ce1e0a2 100644 --- a/src/plugins/find/searchresulttreeitemdelegate.cpp +++ b/src/plugins/find/searchresulttreeitemdelegate.cpp @@ -78,9 +78,8 @@ void SearchResultTreeItemDelegate::paint(QPainter *painter, const QStyleOptionVi // icon QIcon icon = index.model()->data(index, ItemDataRoles::ResultIconRole).value<QIcon>(); - if (!icon.isNull()) { + if (!icon.isNull()) pixmapRect = QRect(0, 0, iconSize, iconSize); - } // text textRect = opt.rect.adjusted(0, 0, checkRect.width() + pixmapRect.width(), 0); diff --git a/src/plugins/find/searchresulttreeitems.cpp b/src/plugins/find/searchresulttreeitems.cpp index ed16b0321d..0f6d8f9f77 100644 --- a/src/plugins/find/searchresulttreeitems.cpp +++ b/src/plugins/find/searchresulttreeitems.cpp @@ -107,11 +107,10 @@ int SearchResultTreeItem::insertionIndex(const QString &text, SearchResultTreeIt QList<SearchResultTreeItem *>::const_iterator insertionPosition = qLowerBound(m_children.begin(), m_children.end(), text, lessThanByText); if (existingItem) { - if (insertionPosition != m_children.end() && (*insertionPosition)->item.text == text) { + if (insertionPosition != m_children.end() && (*insertionPosition)->item.text == text) (*existingItem) = (*insertionPosition); - } else { + else *existingItem = 0; - } } return insertionPosition - m_children.begin(); } diff --git a/src/plugins/find/searchresulttreemodel.cpp b/src/plugins/find/searchresulttreemodel.cpp index b2f75305e8..3e6e318320 100644 --- a/src/plugins/find/searchresulttreemodel.cpp +++ b/src/plugins/find/searchresulttreemodel.cpp @@ -79,9 +79,8 @@ Qt::ItemFlags SearchResultTreeModel::flags(const QModelIndex &idx) const if (idx.isValid()) { if (const SearchResultTreeItem *item = treeItemAtIndex(idx)) { - if (item->isUserCheckable()) { + if (item->isUserCheckable()) flags |= Qt::ItemIsUserCheckable; - } } } @@ -202,13 +201,12 @@ bool SearchResultTreeModel::setCheckState(const QModelIndex &idx, Qt::CheckState SearchResultTreeItem *child = parent->childAt(i); if (!child->isUserCheckable()) continue; - if (child->checkState() == Qt::Checked) { + if (child->checkState() == Qt::Checked) hasChecked = true; - } else if (child->checkState() == Qt::Unchecked) { + else if (child->checkState() == Qt::Unchecked) hasUnchecked = true; - } else if (child->checkState() == Qt::PartiallyChecked) { + else if (child->checkState() == Qt::PartiallyChecked) hasChecked = hasUnchecked = true; - } } if (hasChecked && hasUnchecked) parent->setCheckState(Qt::PartiallyChecked); diff --git a/src/plugins/genericprojectmanager/genericprojectplugin.cpp b/src/plugins/genericprojectmanager/genericprojectplugin.cpp index c9240f88fa..9b0779712a 100644 --- a/src/plugins/genericprojectmanager/genericprojectplugin.cpp +++ b/src/plugins/genericprojectmanager/genericprojectplugin.cpp @@ -119,9 +119,8 @@ void GenericProjectPlugin::editFiles() GenericProject *genericProject = static_cast<GenericProject *>(m_contextMenuProject); SelectableFilesDialog sfd(QFileInfo(genericProject->document()->fileName()).path(), genericProject->files(), Core::ICore::mainWindow()); - if (sfd.exec() == QDialog::Accepted) { + if (sfd.exec() == QDialog::Accepted) genericProject->setFiles(sfd.selectedFiles()); - } } } // namespace Internal diff --git a/src/plugins/git/clonewizardpage.cpp b/src/plugins/git/clonewizardpage.cpp index bb90cc8a64..5f37438e7b 100644 --- a/src/plugins/git/clonewizardpage.cpp +++ b/src/plugins/git/clonewizardpage.cpp @@ -115,9 +115,8 @@ QString CloneWizardPage::directoryFromRepository(const QString &urlIn) const if (url.endsWith(d->mainLinePostfix)) { url.truncate(url.size() - d->mainLinePostfix.size()); } else { - if (url.endsWith(d->gitPostFix)) { + if (url.endsWith(d->gitPostFix)) url.truncate(url.size() - d->gitPostFix.size()); - } } // Check for equal parts, something like "qt/qt" -> "qt" const int slashPos = url.indexOf(slash); diff --git a/src/plugins/git/gerrit/gerritmodel.cpp b/src/plugins/git/gerrit/gerritmodel.cpp index 9af51c1367..10e251925b 100644 --- a/src/plugins/git/gerrit/gerritmodel.cpp +++ b/src/plugins/git/gerrit/gerritmodel.cpp @@ -354,11 +354,10 @@ void QueryContext::errorTermination(const QString &msg) void QueryContext::processError(QProcess::ProcessError e) { const QString msg = tr("Error running %1: %2").arg(m_binary, m_process.errorString()); - if (e == QProcess::FailedToStart) { + if (e == QProcess::FailedToStart) errorTermination(msg); - } else { + else VcsBase::VcsBaseOutputWindow::instance()->appendError(msg); - } } void QueryContext::processFinished(int exitCode, QProcess::ExitStatus es) @@ -413,11 +412,10 @@ void QueryContext::timeout() box.exec(); if (m_process.state() != QProcess::Running) return; - if (box.clickedButton() == terminateButton) { + if (box.clickedButton() == terminateButton) Utils::SynchronousProcess::stopProcess(m_process); - } else { + else m_timer.start(); - } } GerritModel::GerritModel(const QSharedPointer<GerritParameters> &p, QObject *parent) diff --git a/src/plugins/git/gerrit/gerritplugin.cpp b/src/plugins/git/gerrit/gerritplugin.cpp index cc7671003d..1cb9930d99 100644 --- a/src/plugins/git/gerrit/gerritplugin.cpp +++ b/src/plugins/git/gerrit/gerritplugin.cpp @@ -243,21 +243,19 @@ void FetchContext::processReadyReadStandardError() { // Note: fetch displays progress on stderr. const QString errorOutput = QString::fromLocal8Bit(m_process.readAllStandardError()); - if (m_state == FetchState || m_state == CheckoutState) { + if (m_state == FetchState || m_state == CheckoutState) VcsBase::VcsBaseOutputWindow::instance()->append(errorOutput); - } else { + else VcsBase::VcsBaseOutputWindow::instance()->appendError(errorOutput); - } } void FetchContext::processReadyReadStandardOutput() { const QByteArray output = m_process.readAllStandardOutput(); - if (m_state == WritePatchFileState) { + if (m_state == WritePatchFileState) m_patchFile->write(output); - } else { + else VcsBase::VcsBaseOutputWindow::instance()->append(QString::fromLocal8Bit(output)); - } } void FetchContext::handleError(const QString &e) @@ -272,11 +270,10 @@ void FetchContext::handleError(const QString &e) void FetchContext::processError(QProcess::ProcessError e) { const QString msg = tr("Error running %1: %2").arg(m_git, m_process.errorString()); - if (e == QProcess::FailedToStart) { + if (e == QProcess::FailedToStart) handleError(msg); - } else { + else VcsBase::VcsBaseOutputWindow::instance()->appendError(msg); - } } void FetchContext::startWritePatchFile() diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 0fdbcc5f98..77597f43a5 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -801,11 +801,10 @@ bool GitClient::synchronousCheckoutBranch(const QString &workingDirectory, const QString stdErr = commandOutputFromLocal8Bit(errorText); //: Meaning of the arguments: %1: Branch, %2: Repository, %3: Error message const QString msg = tr("Cannot checkout \"%1\" of \"%2\": %3").arg(branch, workingDirectory, stdErr); - if (errorMessage) { + if (errorMessage) *errorMessage = msg; - } else { + else outputWindow()->appendError(msg); - } return false; } return true; @@ -859,11 +858,10 @@ bool GitClient::synchronousLog(const QString &workingDirectory, const QStringLis const QString errorMessage = tr("Cannot obtain log of \"%1\": %2"). arg(QDir::toNativeSeparators(workingDirectory), commandOutputFromLocal8Bit(errorText)); - if (errorMessageIn) { + if (errorMessageIn) *errorMessageIn = errorMessage; - } else { + else outputWindow()->appendError(errorMessage); - } } return rc; } @@ -954,11 +952,10 @@ bool GitClient::synchronousReset(const QString &workingDirectory, tr("Cannot reset \"%1\": %2").arg(QDir::toNativeSeparators(workingDirectory), stdErr) : tr("Cannot reset %n file(s) in \"%1\": %2", 0, files.size()). arg(QDir::toNativeSeparators(workingDirectory), stdErr); - if (errorMessage) { + if (errorMessage) *errorMessage = msg; - } else { + else outputWindow()->appendError(msg); - } return false; } return true; @@ -1010,11 +1007,10 @@ bool GitClient::synchronousCheckoutFiles(const QString &workingDirectory, //: %4: Error message const QString msg = tr("Cannot checkout \"%1\" of %2 in \"%3\": %4"). arg(revision, fileArg, workingDirectory, commandOutputFromLocal8Bit(errorText)); - if (errorMessage) { + if (errorMessage) *errorMessage = msg; - } else { + else outputWindow()->appendError(msg); - } return false; } return true; @@ -1316,11 +1312,10 @@ bool GitClient::executeSynchronousStash(const QString &workingDirectory, const QString msg = tr("Cannot stash in \"%1\": %2"). arg(QDir::toNativeSeparators(workingDirectory), commandOutputFromLocal8Bit(errorText)); - if (errorMessage) { + if (errorMessage) *errorMessage = msg; - } else { + else outputWindow()->append(msg); - } return false; } return true; @@ -1348,11 +1343,10 @@ bool GitClient::stashNameFromMessage(const QString &workingDirectory, } //: Look-up of a stash via its descriptive message failed. const QString msg = tr("Cannot resolve stash message \"%1\" in \"%2\".").arg(message, workingDirectory); - if (errorMessage) { + if (errorMessage) *errorMessage = msg; - } else { + else outputWindow()->append(msg); - } return false; } @@ -2263,11 +2257,10 @@ bool GitClient::synchronousStashRemove(const QString &workingDirectory, QString *errorMessage /* = 0 */) { QStringList arguments(QLatin1String("stash")); - if (stash.isEmpty()) { + if (stash.isEmpty()) arguments << QLatin1String("clear"); - } else { + else arguments << QLatin1String("drop") << stash; - } QByteArray outputText; QByteArray errorText; const bool rc = fullySynchronousGit(workingDirectory, arguments, &outputText, &errorText); @@ -2319,11 +2312,10 @@ bool GitClient::synchronousStashList(const QString &workingDirectory, const QString msg = tr("Cannot retrieve stash list of \"%1\": %2"). arg(QDir::toNativeSeparators(workingDirectory), commandOutputFromLocal8Bit(errorText)); - if (errorMessage) { + if (errorMessage) *errorMessage = msg; - } else { + else outputWindow()->append(msg); - } return false; } Stash stash; diff --git a/src/plugins/git/gitorious/gitorious.cpp b/src/plugins/git/gitorious/gitorious.cpp index a89ca8b657..56c0ebe6e4 100644 --- a/src/plugins/git/gitorious/gitorious.cpp +++ b/src/plugins/git/gitorious/gitorious.cpp @@ -207,11 +207,10 @@ GitoriousProjectReader::ProjectList GitoriousProjectReader::read(const QByteArra while (!reader.atEnd()) { reader.readNext(); if (reader.isStartElement()) { - if (reader.name() == QLatin1String("projects")) { + if (reader.name() == QLatin1String("projects")) readProjects(reader); - } else { + else readUnknownElement(reader); - } } } @@ -259,17 +258,16 @@ QSharedPointer<GitoriousProject> GitoriousProjectReader::readProject(QXmlStreamR if (reader.isStartElement()) { const QStringRef name = reader.name(); - if (name == QLatin1String("description")) { + if (name == QLatin1String("description")) project->description = reader.readElementText(); - } else if (name == QLatin1String("title")) { + else if (name == QLatin1String("title")) project->name = reader.readElementText(); - } else if (name == QLatin1String("slug") && project->name.isEmpty()) { + else if (name == QLatin1String("slug") && project->name.isEmpty()) project->name = reader.readElementText(); - } else if (name == QLatin1String("repositories")) { + else if (name == QLatin1String("repositories")) project->repositories = readRepositories(reader); - } else { + else readUnknownElement(reader); - } } } return project; @@ -287,24 +285,22 @@ QList<GitoriousRepository> GitoriousProjectReader::readRepositories(QXmlStreamRe if (reader.isEndElement()) { const QStringRef name = reader.name(); - if (name == m_mainLinesElement || name == m_clonesElement) { + if (name == m_mainLinesElement || name == m_clonesElement) defaultType = -1; - } else { + else break; - } } if (reader.isStartElement()) { const QStringRef name = reader.name(); - if (reader.name() == QLatin1String("repository")) { + if (reader.name() == QLatin1String("repository")) repositories.push_back(readRepository(reader, defaultType)); - } else if (name == m_mainLinesElement) { + else if (name == m_mainLinesElement) defaultType = GitoriousRepository::MainLineRepository; - } else if (name == m_clonesElement) { + else if (name == m_clonesElement) defaultType = GitoriousRepository::CloneRepository; - } else { + else readUnknownElement(reader); - } } } return repositories; @@ -324,23 +320,22 @@ GitoriousRepository GitoriousProjectReader::readRepository(QXmlStreamReader &rea if (reader.isStartElement()) { const QStringRef name = reader.name(); - if (name == QLatin1String("name")) { + if (name == QLatin1String("name")) repository.name = reader.readElementText(); - } else if (name == QLatin1String("owner")) { + else if (name == QLatin1String("owner")) repository.owner = reader.readElementText(); - } else if (name == QLatin1String("id")) { + else if (name == QLatin1String("id")) repository.id = reader.readElementText().toInt(); - } else if (name == QLatin1String("description")) { + else if (name == QLatin1String("description")) repository.description = reader.readElementText(); - } else if (name == QLatin1String("push_url")) { + else if (name == QLatin1String("push_url")) repository.pushUrl = reader.readElementText(); - } else if (name == QLatin1String("clone_url")) { + else if (name == QLatin1String("clone_url")) repository.cloneUrl = reader.readElementText(); - } else if (name == QLatin1String("namespace")) { + else if (name == QLatin1String("namespace")) repository.type = repositoryType(reader.readElementText()); - } else { + else readUnknownElement(reader); - } } } return repository; @@ -588,11 +583,10 @@ void Gitorious::restoreSettings(const QString &group, const QSettings *s) const QStringList hosts = s->value(group + QLatin1Char('/') + QLatin1String(settingsKeyC), QStringList()).toStringList(); foreach (const QString &h, hosts) { const int sepPos = h.indexOf(separator); - if (sepPos == -1) { + if (sepPos == -1) addHost(GitoriousHost(h)); - } else { + else addHost(GitoriousHost(h.mid(0, sepPos), h.mid(sepPos + 1))); - } } } diff --git a/src/plugins/git/gitorious/gitorioushostwidget.cpp b/src/plugins/git/gitorious/gitorioushostwidget.cpp index 2042afc449..92000ac139 100644 --- a/src/plugins/git/gitorious/gitorioushostwidget.cpp +++ b/src/plugins/git/gitorious/gitorioushostwidget.cpp @@ -64,9 +64,8 @@ static QList<QStandardItem *> hostEntry(const QString &host, // Empty for dummy, else "..." or count QStandardItem *projectCountItem = 0; QString countItemText; - if (!isDummyEntry) { + if (!isDummyEntry) countItemText = projectCount ? QString::number(projectCount) : QString(QLatin1String("...")); - } projectCountItem = new QStandardItem(countItemText); projectCountItem->setFlags(nonEditableFlags); QStandardItem *descriptionItem = new QStandardItem(description); diff --git a/src/plugins/git/gitorious/gitoriousprojectwidget.cpp b/src/plugins/git/gitorious/gitoriousprojectwidget.cpp index 844beaa22a..08af912f70 100644 --- a/src/plugins/git/gitorious/gitoriousprojectwidget.cpp +++ b/src/plugins/git/gitorious/gitoriousprojectwidget.cpp @@ -212,11 +212,10 @@ void GitoriousProjectWidget::setDescription(const QString &description, descLine.truncate(newLinePos); if (descLine.size() > MaxDescriptionLineLength) { const int dotPos = descLine.lastIndexOf(QLatin1Char('.'), MaxDescriptionLineLength); - if (dotPos != -1) { + if (dotPos != -1) descLine.truncate(dotPos); - } else { + else descLine.truncate(MaxDescriptionLineLength); - } descLine += QLatin1String("..."); } items->at(descriptionColumn)->setText(descLine); @@ -230,11 +229,10 @@ void GitoriousProjectWidget::setDescription(const QString &description, // Do not fall for "(http://XX)", strip special characters static QRegExp urlRegExp(QLatin1String("(http://[\\w\\.-]+/[a-zA-Z0-9/\\-&]*)")); QTC_CHECK(urlRegExp.isValid()); - if (urlRegExp.indexIn(description) != -1) { + if (urlRegExp.indexIn(description) != -1) *url= urlRegExp.cap(1); - } else { + else url->clear(); - } } } diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 850553992c..1027ddfb39 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -1034,11 +1034,10 @@ void GitPlugin::applyPatch(const QString &workingDirectory, QString file) VcsBase::VcsBaseOutputWindow *outwin = VcsBase::VcsBaseOutputWindow::instance(); QString errorMessage; if (m_gitClient->synchronousApplyPatch(workingDirectory, file, &errorMessage)) { - if (errorMessage.isEmpty()) { + if (errorMessage.isEmpty()) outwin->append(tr("Patch %1 successfully applied to %2").arg(file, workingDirectory)); - } else { + else outwin->append(errorMessage); - } } else { outwin->appendError(errorMessage); } diff --git a/src/plugins/git/gitsubmiteditorwidget.cpp b/src/plugins/git/gitsubmiteditorwidget.cpp index 8c79265e3e..f34062c7ec 100644 --- a/src/plugins/git/gitsubmiteditorwidget.cpp +++ b/src/plugins/git/gitsubmiteditorwidget.cpp @@ -181,11 +181,10 @@ QString GitSubmitEditorWidget::cleanupDescription(const QString &input) const for (int pos = 0; pos < message.size(); ) { const int newLinePos = message.indexOf(newLine, pos); const int startOfNextLine = newLinePos == -1 ? message.size() : newLinePos + 1; - if (message.at(pos) == hash) { + if (message.at(pos) == hash) message.remove(pos, startOfNextLine - pos); - } else { + else pos = startOfNextLine; - } } return message; diff --git a/src/plugins/git/stashdialog.cpp b/src/plugins/git/stashdialog.cpp index 69c582e870..c12d491b60 100644 --- a/src/plugins/git/stashdialog.cpp +++ b/src/plugins/git/stashdialog.cpp @@ -198,11 +198,10 @@ void StashDialog::deleteAll() if (!ask(title, tr("Do you want to delete all stashes?"))) return; QString errorMessage; - if (gitClient()->synchronousStashRemove(m_repository, QString(), &errorMessage)) { + if (gitClient()->synchronousStashRemove(m_repository, QString(), &errorMessage)) refresh(m_repository, true); - } else { + else warning(title, errorMessage); - } } void StashDialog::deleteSelection() diff --git a/src/plugins/glsleditor/glslhoverhandler.cpp b/src/plugins/glsleditor/glslhoverhandler.cpp index 0aea1ff6b8..3207343a00 100644 --- a/src/plugins/glsleditor/glslhoverhandler.cpp +++ b/src/plugins/glsleditor/glslhoverhandler.cpp @@ -61,9 +61,8 @@ bool GLSLHoverHandler::acceptEditor(IEditor *editor) void GLSLHoverHandler::identifyMatch(TextEditor::ITextEditor *editor, int pos) { if (GLSLTextEditorWidget *glslEditor = qobject_cast<GLSLTextEditorWidget *>(editor->widget())) { - if (! glslEditor->extraSelectionTooltip(pos).isEmpty()) { + if (! glslEditor->extraSelectionTooltip(pos).isEmpty()) setToolTip(glslEditor->extraSelectionTooltip(pos)); - } } } diff --git a/src/plugins/help/generalsettingspage.cpp b/src/plugins/help/generalsettingspage.cpp index fb645ec7c3..5f8a42bd80 100644 --- a/src/plugins/help/generalsettingspage.cpp +++ b/src/plugins/help/generalsettingspage.cpp @@ -337,9 +337,8 @@ int GeneralSettingsPage::closestPointSizeIndex(int desiredPointSize) const if (closestAbsError == 0) break; } else { // past optimum - if (absError > closestAbsError) { + if (absError > closestAbsError) break; - } } } return closestIndex; diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index 3575d92492..91a1644e5e 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -1172,11 +1172,10 @@ void HelpPlugin::handleHelpRequest(const QUrl &url) || address.startsWith(HelpViewer::NsTrolltech)) { // local help not installed, resort to external web help QString urlPrefix = QLatin1String("http://doc.qt.digia.com/"); - if (url.authority() == QLatin1String("com.nokia.qtcreator")) { + if (url.authority() == QLatin1String("com.nokia.qtcreator")) urlPrefix.append(QString::fromLatin1("qtcreator")); - } else { + else urlPrefix.append(QLatin1String("latest")); - } address = urlPrefix + address.mid(address.lastIndexOf(QLatin1Char('/'))); } } diff --git a/src/plugins/help/openpagesmanager.cpp b/src/plugins/help/openpagesmanager.cpp index bad52f1690..72e0ecaeb5 100644 --- a/src/plugins/help/openpagesmanager.cpp +++ b/src/plugins/help/openpagesmanager.cpp @@ -259,11 +259,10 @@ void OpenPagesManager::closePagesExcept(const QModelIndex &index) int i = 0; HelpViewer *viewer = m_model->pageAt(index.row()); while (m_model->rowCount() > 1) { - if (m_model->pageAt(i) != viewer) { + if (m_model->pageAt(i) != viewer) removePage(i); - } else { + else i++; - } } } } diff --git a/src/plugins/help/remotehelpfilter.cpp b/src/plugins/help/remotehelpfilter.cpp index 464c59791b..aa6cad21e2 100644 --- a/src/plugins/help/remotehelpfilter.cpp +++ b/src/plugins/help/remotehelpfilter.cpp @@ -124,9 +124,8 @@ QList<Locator::FilterEntry> RemoteHelpFilter::matchesFor(QFutureInterface<Locato void RemoteHelpFilter::accept(Locator::FilterEntry selection) const { const QString &url = selection.displayName; - if (!url.isEmpty()) { + if (!url.isEmpty()) emit linkActivated(url); - } } void RemoteHelpFilter::refresh(QFutureInterface<void> &future) diff --git a/src/plugins/help/searchwidget.cpp b/src/plugins/help/searchwidget.cpp index 2bc80ba80a..e8d1c2667c 100644 --- a/src/plugins/help/searchwidget.cpp +++ b/src/plugins/help/searchwidget.cpp @@ -259,11 +259,10 @@ void SearchWidget::contextMenuEvent(QContextMenuEvent *contextMenuEvent) } QAction *usedAction = menu.exec(mapToGlobal(contextMenuEvent->pos())); - if (usedAction == openLink) { + if (usedAction == openLink) browser->selectAll(); - } else if (usedAction == openLinkInNewTab) { + else if (usedAction == openLinkInNewTab) OpenPagesManager::instance().createPageFromSearch(link); - } else if (usedAction == copyAnchorAction) { + else if (usedAction == copyAnchorAction) QApplication::clipboard()->setText(link.toString()); - } } diff --git a/src/plugins/locator/commandlocator.cpp b/src/plugins/locator/commandlocator.cpp index d842d5dd1b..639a9995a4 100644 --- a/src/plugins/locator/commandlocator.cpp +++ b/src/plugins/locator/commandlocator.cpp @@ -99,9 +99,8 @@ QList<Locator::FilterEntry> CommandLocator::matchesFor(QFutureInterface<Locator: if (action->isEnabled()) { QString text = action->text(); text.remove(ampersand); - if (text.contains(entry, Qt::CaseInsensitive)) { + if (text.contains(entry, Qt::CaseInsensitive)) filters.append(FilterEntry(this, text, QVariant(i))); - } } } } diff --git a/src/plugins/locator/directoryfilter.cpp b/src/plugins/locator/directoryfilter.cpp index cf11b7406e..13db0e9dc8 100644 --- a/src/plugins/locator/directoryfilter.cpp +++ b/src/plugins/locator/directoryfilter.cpp @@ -138,9 +138,8 @@ bool DirectoryFilter::openConfigDialog(QWidget *parent, bool &needsRefresh) void DirectoryFilter::addDirectory() { QString dir = QFileDialog::getExistingDirectory(m_dialog, tr("Select Directory")); - if (!dir.isEmpty()) { + if (!dir.isEmpty()) m_ui.directoryList->addItem(dir); - } } void DirectoryFilter::editDirectory() @@ -150,9 +149,8 @@ void DirectoryFilter::editDirectory() QListWidgetItem *currentItem = m_ui.directoryList->selectedItems().at(0); QString dir = QFileDialog::getExistingDirectory(m_dialog, tr("Select Directory"), currentItem->text()); - if (!dir.isEmpty()) { + if (!dir.isEmpty()) currentItem->setText(dir); - } } void DirectoryFilter::removeDirectory() diff --git a/src/plugins/locator/locatorwidget.cpp b/src/plugins/locator/locatorwidget.cpp index 83d0192a12..4a14b5d18c 100644 --- a/src/plugins/locator/locatorwidget.cpp +++ b/src/plugins/locator/locatorwidget.cpp @@ -176,11 +176,10 @@ QVariant LocatorModel::data(const QModelIndex &index, int role) const return QVariant(); if (role == Qt::DisplayRole) { - if (index.column() == 0) { + if (index.column() == 0) return mEntries.at(index.row()).displayName; - } else if (index.column() == 1) { + else if (index.column() == 1) return mEntries.at(index.row()).extraInfo; - } } else if (role == Qt::ToolTipRole) { if (mEntries.at(index.row()).extraInfo.isEmpty()) return QVariant(mEntries.at(index.row()).displayName); @@ -540,9 +539,8 @@ void LocatorWidget::updateEntries() const QList<FilterEntry> entries = m_entriesWatcher->future().results(); m_locatorModel->setEntries(entries); - if (m_locatorModel->rowCount() > 0) { + if (m_locatorModel->rowCount() > 0) m_completionList->setCurrentIndex(m_locatorModel->index(0, 0)); - } #if 0 m_completionList->updatePreferredSize(); #endif diff --git a/src/plugins/madde/maemoglobal.cpp b/src/plugins/madde/maemoglobal.cpp index eeac3d7f37..da91e141da 100644 --- a/src/plugins/madde/maemoglobal.cpp +++ b/src/plugins/madde/maemoglobal.cpp @@ -276,9 +276,8 @@ bool MaemoGlobal::callMaddeShellScript(QProcess &proc, QStringList MaemoGlobal::targetArgs(const QString &qmakePath, bool useTarget) { QStringList args; - if (useTarget) { + if (useTarget) args << QLatin1String("-t") << targetName(qmakePath); - } return args; } diff --git a/src/plugins/madde/maemopublishedprojectmodel.cpp b/src/plugins/madde/maemopublishedprojectmodel.cpp index c58ef19171..c8f43d5543 100644 --- a/src/plugins/madde/maemopublishedprojectmodel.cpp +++ b/src/plugins/madde/maemopublishedprojectmodel.cpp @@ -116,11 +116,10 @@ bool MaemoPublishedProjectModel::setData(const QModelIndex &index, if (index.column() != IncludeColumn) return QFileSystemModel::setData(index, value, role); if (role == Qt::CheckStateRole) { - if (value == Qt::Checked) { + if (value == Qt::Checked) m_filesToExclude.remove(filePath(index)); - } else { + else m_filesToExclude.insert(filePath(index)); - } if (isDir(index)) emit layoutChanged(); return true; diff --git a/src/plugins/madde/maemoqemuruntimeparser.cpp b/src/plugins/madde/maemoqemuruntimeparser.cpp index af7d916b32..1341daf718 100644 --- a/src/plugins/madde/maemoqemuruntimeparser.cpp +++ b/src/plugins/madde/maemoqemuruntimeparser.cpp @@ -379,11 +379,10 @@ void MaemoQemuRuntimeParserV2::handleVariableTag(MaemoQemuRuntime &runtime) if (varName.isEmpty()) return; - if (isGlBackend) { + if (isGlBackend) runtime.m_openGlBackendVarName = varName; - } else { + else runtime.m_normalVars << MaemoQemuRuntime::Variable(varName, varValue); - } } QList<MaemoQemuRuntimeParserV2::Port> MaemoQemuRuntimeParserV2::handleTcpPortListTag() diff --git a/src/plugins/mercurial/mercurialclient.cpp b/src/plugins/mercurial/mercurialclient.cpp index 152966f691..6f947277e2 100644 --- a/src/plugins/mercurial/mercurialclient.cpp +++ b/src/plugins/mercurial/mercurialclient.cpp @@ -94,18 +94,16 @@ bool MercurialClient::synchronousClone(const QString &workingDir, if (workingDirectory.exists()) { // Let's make first init QStringList arguments(QLatin1String("init")); - if (!vcsFullySynchronousExec(workingDirectory.path(), arguments, &output)) { + if (!vcsFullySynchronousExec(workingDirectory.path(), arguments, &output)) return false; - } // Then pull remote repository arguments.clear(); arguments << QLatin1String("pull") << dstLocation; const Utils::SynchronousProcessResponse resp1 = vcsSynchronousExec(workingDirectory.path(), arguments, flags); - if (resp1.result != Utils::SynchronousProcessResponse::Finished) { + if (resp1.result != Utils::SynchronousProcessResponse::Finished) return false; - } // By now, there is no hgrc file -> create it Utils::FileSaver saver(workingDirectory.path() + QLatin1String("/.hg/hgrc")); diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp index 3335130d7d..d821a52e6b 100644 --- a/src/plugins/perforce/perforceplugin.cpp +++ b/src/plugins/perforce/perforceplugin.cpp @@ -584,11 +584,10 @@ void PerforcePlugin::printOpenedFileList() const int delimiterPos = line.indexOf(delimiter); if (delimiterPos > 0) mapped = fileNameFromPerforceName(line.left(delimiterPos), true, &errorMessage); - if (mapped.isEmpty()) { + if (mapped.isEmpty()) outWin->appendSilently(line); - } else { + else outWin->appendSilently(mapped + QLatin1Char(' ') + line.mid(delimiterPos)); - } } outWin->popup(Core::IOutputPane::ModeSwitch | Core::IOutputPane::WithFocus); } @@ -722,11 +721,10 @@ void PerforcePlugin::annotate(const QString &workingDir, const QString source = VcsBase::VcsBaseEditorWidget::getSource(workingDir, files); QStringList args; args << QLatin1String("annotate") << QLatin1String("-cqi"); - if (changeList.isEmpty()) { + if (changeList.isEmpty()) args << fileName; - } else { + else args << (fileName + QLatin1Char('@') + changeList); - } const PerforceResponse result = runP4Cmd(workingDir, args, CommandToWindow|StdErrToWindow|ErrorToWindow, QStringList(), QByteArray(), codec); @@ -833,11 +831,10 @@ bool PerforcePlugin::managesDirectory(const QString &directory, QString *topLeve { const bool rc = managesDirectoryFstat(directory); if (topLevel) { - if (rc) { + if (rc) *topLevel = m_settings.topLevelSymLinkTarget(); - } else { + else topLevel->clear(); - } } return rc; } @@ -1260,11 +1257,10 @@ void PerforcePlugin::p4Diff(const PerforceDiffParameters &p) if (!p.diffArguments.isEmpty()) // -duw.. args << (QLatin1String("-d") + p.diffArguments.join(QString())); QStringList extraArgs; - if (p.files.size() > 1) { + if (p.files.size() > 1) extraArgs = p.files; - } else { + else args.append(p.files); - } const unsigned flags = CommandToWindow|StdErrToWindow|ErrorToWindow|OverrideDiffEnvironment; const PerforceResponse result = runP4Cmd(p.workingDir, args, flags, extraArgs, QByteArray(), codec); diff --git a/src/plugins/projectexplorer/baseprojectwizarddialog.cpp b/src/plugins/projectexplorer/baseprojectwizarddialog.cpp index 356a26635c..953e1bdc4a 100644 --- a/src/plugins/projectexplorer/baseprojectwizarddialog.cpp +++ b/src/plugins/projectexplorer/baseprojectwizarddialog.cpp @@ -158,9 +158,8 @@ void BaseProjectWizardDialog::slotAccepted() void BaseProjectWizardDialog::nextClicked() { - if (currentId() == d->introPageId) { + if (currentId() == d->introPageId) emit projectParametersChanged(d->introPage->projectName(), d->introPage->path()); - } } Utils::ProjectIntroPage *BaseProjectWizardDialog::introPage() const diff --git a/src/plugins/projectexplorer/buildconfigurationmodel.cpp b/src/plugins/projectexplorer/buildconfigurationmodel.cpp index 1214b94ea3..f2dd566311 100644 --- a/src/plugins/projectexplorer/buildconfigurationmodel.cpp +++ b/src/plugins/projectexplorer/buildconfigurationmodel.cpp @@ -127,9 +127,8 @@ QVariant BuildConfigurationModel::data(const QModelIndex &index, int role) const { if (role == Qt::DisplayRole) { const int row = index.row(); - if (row < m_buildConfigurations.size()) { + if (row < m_buildConfigurations.size()) return m_buildConfigurations.at(row)->displayName(); - } } return QVariant(); @@ -163,9 +162,8 @@ void BuildConfigurationModel::addedBuildConfiguration(ProjectExplorer::BuildConf BuildConfigurationComparer compare; int i = 0; for (; i < m_buildConfigurations.size(); ++i) { - if (compare(bc, m_buildConfigurations.at(i))) { + if (compare(bc, m_buildConfigurations.at(i))) break; - } } beginInsertRows(QModelIndex(), i, i); diff --git a/src/plugins/projectexplorer/buildmanager.cpp b/src/plugins/projectexplorer/buildmanager.cpp index 79af396f4f..265b5f0ce0 100644 --- a/src/plugins/projectexplorer/buildmanager.cpp +++ b/src/plugins/projectexplorer/buildmanager.cpp @@ -235,11 +235,10 @@ void BuildManager::updateTaskCount() { Core::ProgressManager *progressManager = Core::ICore::progressManager(); const int errors = getErrorTaskCount(); - if (errors > 0) { + if (errors > 0) progressManager->setApplicationLabel(QString::number(errors)); - } else { + else progressManager->setApplicationLabel(QString()); - } emit tasksChanged(); } diff --git a/src/plugins/projectexplorer/customwizard/customwizard.cpp b/src/plugins/projectexplorer/customwizard/customwizard.cpp index 0b94c7a848..40dc8238e0 100644 --- a/src/plugins/projectexplorer/customwizard/customwizard.cpp +++ b/src/plugins/projectexplorer/customwizard/customwizard.cpp @@ -465,11 +465,10 @@ QList<CustomWizard*> CustomWizard::createWizards() << baseFileParameters.category() << " / " <<baseFileParameters.displayCategory() << '\n' << " (" << baseFileParameters.description() << ")\n" << parameters->toString(); - if (CustomWizard *w = createWizard(parameters, baseFileParameters)) { + if (CustomWizard *w = createWizard(parameters, baseFileParameters)) rc.push_back(w); - } else { + else qWarning("Custom wizard factory function failed for %s", qPrintable(baseFileParameters.id())); - } break; case Internal::CustomWizardParameters::ParseDisabled: if (CustomWizardPrivate::verbose) @@ -586,9 +585,8 @@ bool CustomProjectWizard::postGenerateOpen(const Core::GeneratedFiles &l, QStrin // Post-Generate: Open the project and the editors as desired foreach (const Core::GeneratedFile &file, l) { if (file.attributes() & Core::GeneratedFile::OpenProjectAttribute) { - if (!ProjectExplorer::ProjectExplorerPlugin::instance()->openProject(file.path(), errorMessage)) { + if (!ProjectExplorer::ProjectExplorerPlugin::instance()->openProject(file.path(), errorMessage)) return false; - } } } return BaseFileWizard::postGenerateOpenEditors(l, errorMessage); diff --git a/src/plugins/projectexplorer/customwizard/customwizardpage.cpp b/src/plugins/projectexplorer/customwizard/customwizardpage.cpp index c954eab7c7..bdb01ae0e4 100644 --- a/src/plugins/projectexplorer/customwizard/customwizardpage.cpp +++ b/src/plugins/projectexplorer/customwizard/customwizardpage.cpp @@ -239,11 +239,10 @@ void CustomWizardFieldPage::addField(const CustomWizardField &field)\ } else { fieldWidget = registerLineEdit(fieldName, field); } - if (spansRow) { + if (spansRow) m_formLayout->addRow(fieldWidget); - } else { + else addRow(field.description, fieldWidget); - } } // Return the list of values and display texts for combo @@ -345,11 +344,10 @@ QWidget *CustomWizardFieldPage::registerLineEdit(const QString &fieldName, const QString validationRegExp = field.controlAttributes.value(QLatin1String("validator")); if (!validationRegExp.isEmpty()) { QRegExp re(validationRegExp); - if (re.isValid()) { + if (re.isValid()) lineEdit->setValidator(new QRegExpValidator(re, lineEdit)); - } else { + else qWarning("Invalid custom wizard field validator regular expression %s.", qPrintable(validationRegExp)); - } } registerField(fieldName, lineEdit, "text", SIGNAL(textEdited(QString))); diff --git a/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp b/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp index 377375b230..bd6d56e816 100644 --- a/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp +++ b/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp @@ -657,11 +657,10 @@ CustomWizardParameters::ParseResult file.binary = booleanAttributeValue(reader, fileBinaryAttributeC, false); if (file.target.isEmpty()) file.target = file.source; - if (file.source.isEmpty()) { + if (file.source.isEmpty()) qWarning("Skipping empty file name in custom project."); - } else { + else files.push_back(file); - } } break; case ParseWithinScript: diff --git a/src/plugins/projectexplorer/dependenciespanel.cpp b/src/plugins/projectexplorer/dependenciespanel.cpp index 5f85e0bf37..fc6585d7db 100644 --- a/src/plugins/projectexplorer/dependenciespanel.cpp +++ b/src/plugins/projectexplorer/dependenciespanel.cpp @@ -214,9 +214,8 @@ void DependenciesView::updateSizeHint() int heightOffset = size().height() - viewport()->height(); int heightPerRow = sizeHintForRow(0); - if (heightPerRow == -1) { + if (heightPerRow == -1) heightPerRow = 30; - } int rows = qMin(qMax(model()->rowCount(), 2), 10); int height = rows * heightPerRow + heightOffset; if (m_sizeHint.height() != height) { diff --git a/src/plugins/projectexplorer/deployconfigurationmodel.cpp b/src/plugins/projectexplorer/deployconfigurationmodel.cpp index 3833e4497b..25d2e8c257 100644 --- a/src/plugins/projectexplorer/deployconfigurationmodel.cpp +++ b/src/plugins/projectexplorer/deployconfigurationmodel.cpp @@ -126,9 +126,8 @@ QVariant DeployConfigurationModel::data(const QModelIndex &index, int role) cons { if (role == Qt::DisplayRole) { const int row = index.row(); - if (row < m_deployConfigurations.size()) { + if (row < m_deployConfigurations.size()) return m_deployConfigurations.at(row)->displayName(); - } } return QVariant(); @@ -162,9 +161,8 @@ void DeployConfigurationModel::addedDeployConfiguration(ProjectExplorer::DeployC DeployConfigurationComparer compare; int i = 0; for (; i < m_deployConfigurations.size(); ++i) { - if (compare(dc, m_deployConfigurations.at(i))) { + if (compare(dc, m_deployConfigurations.at(i))) break; - } } beginInsertRows(QModelIndex(), i, i); diff --git a/src/plugins/projectexplorer/doubletabwidget.cpp b/src/plugins/projectexplorer/doubletabwidget.cpp index bc62cba715..1fffafa36e 100644 --- a/src/plugins/projectexplorer/doubletabwidget.cpp +++ b/src/plugins/projectexplorer/doubletabwidget.cpp @@ -201,11 +201,10 @@ void DoubleTabWidget::removeTab(int index) --m_currentIndex; if (m_currentIndex < 0 && m_tabs.size() > 0) m_currentIndex = 0; - if (m_currentIndex < 0) { + if (m_currentIndex < 0) emit currentIndexChanged(-1, -1); - } else { + else emit currentIndexChanged(m_currentIndex, m_tabs.at(m_currentIndex).currentSubTab); - } } update(); } @@ -233,18 +232,16 @@ QPair<DoubleTabWidget::HitArea, int> DoubleTabWidget::convertPosToTab(QPoint pos for (i = 0; i <= m_lastVisibleIndex; ++i) { int otherX = x + 2 * MARGIN + fm.width(m_tabs.at( m_currentTabIndices.at(i)).displayName()); - if (eventX > x && eventX < otherX) { + if (eventX > x && eventX < otherX) break; - } x = otherX; } if (i <= m_lastVisibleIndex) { return qMakePair(HITTAB, i); } else if (m_lastVisibleIndex < m_tabs.size() - 1) { // handle overflow menu - if (eventX > x && eventX < x + OVERFLOW_DROPDOWN_WIDTH) { + if (eventX > x && eventX < x + OVERFLOW_DROPDOWN_WIDTH) return qMakePair(HITOVERFLOW, -1); - } } } else if (pos.y() < Utils::StyleHelper::navigationWidgetHeight() + OTHER_HEIGHT) { int diff = (OTHER_HEIGHT - SELECTION_IMAGE_HEIGHT) / 2; @@ -264,14 +261,12 @@ QPair<DoubleTabWidget::HitArea, int> DoubleTabWidget::convertPosToTab(QPoint pos int i; for (i = 0; i < subTabs.size(); ++i) { int otherX = x + 2 * SELECTION_IMAGE_WIDTH + fm.width(subTabs.at(i)); - if (eventX > x && eventX < otherX) { + if (eventX > x && eventX < otherX) break; - } x = otherX + 2 * MARGIN; } - if (i < subTabs.size()) { + if (i < subTabs.size()) return qMakePair(HITSUBTAB, i); - } } return qMakePair(HITNOTHING, -1); } diff --git a/src/plugins/projectexplorer/editorconfiguration.cpp b/src/plugins/projectexplorer/editorconfiguration.cpp index 027e21cb35..ef38edd7a9 100644 --- a/src/plugins/projectexplorer/editorconfiguration.cpp +++ b/src/plugins/projectexplorer/editorconfiguration.cpp @@ -223,9 +223,8 @@ void EditorConfiguration::fromMap(const QVariantMap &map) Core::Id languageId(settingsIdMap.value(QLatin1String("language")).toByteArray()); QVariantMap value = settingsIdMap.value(QLatin1String("value")).toMap(); ICodeStylePreferences *preferences = d->m_languageCodeStylePreferences.value(languageId); - if (preferences) { + if (preferences) preferences->fromMap(QString(), value); - } } d->m_defaultCodeStyle->fromMap(kPrefix, map); diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index 43e158f1b5..2f34c1a10d 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -138,9 +138,8 @@ static QByteArray gccPredefinedMacros(const FileName &gcc, const QStringList &ar const QByteArray blocksDefine("#define __BLOCKS__ 1"); const QByteArray blocksUndefine("#undef __BLOCKS__"); const int idx = predefinedMacros.indexOf(blocksDefine); - if (idx != -1) { + if (idx != -1) predefinedMacros.replace(idx, blocksDefine.length(), blocksUndefine); - } // Define __strong and __weak (used for Apple's GC extension of C) to be empty predefinedMacros.append("#define __strong\n"); diff --git a/src/plugins/projectexplorer/miniprojecttargetselector.cpp b/src/plugins/projectexplorer/miniprojecttargetselector.cpp index b5dd05e8ed..41aef002c3 100644 --- a/src/plugins/projectexplorer/miniprojecttargetselector.cpp +++ b/src/plugins/projectexplorer/miniprojecttargetselector.cpp @@ -270,9 +270,8 @@ void ProjectListWidget::addProject(Project *project) item->setText(displayName); insertItem(pos, item); - if (project == ProjectExplorerPlugin::instance()->startupProject()) { + if (project == ProjectExplorerPlugin::instance()->startupProject()) setCurrentItem(item); - } QFontMetrics fn(font()); int width = fn.width(displayName) + padding(); @@ -517,9 +516,8 @@ QListWidgetItem *GenericListWidget::itemForProjectConfiguration(ProjectConfigura { for (int i = 0; i < count(); ++i) { QListWidgetItem *lwi = item(i); - if (lwi->data(Qt::UserRole).value<ProjectConfiguration *>() == pc) { + if (lwi->data(Qt::UserRole).value<ProjectConfiguration *>() == pc) return lwi; - } } return 0; } @@ -1401,11 +1399,10 @@ void MiniProjectTargetSelector::updateActionAndSummary() } } m_projectAction->setProperty("heading", projectName); - if (project && project->needsConfiguration()) { + if (project && project->needsConfiguration()) m_projectAction->setProperty("subtitle", tr("Unconfigured")); - } else { + else m_projectAction->setProperty("subtitle", buildConfig); - } m_projectAction->setIcon(targetIcon); QStringList lines; lines << tr("<b>Project:</b> %1").arg(projectName); diff --git a/src/plugins/projectexplorer/msvctoolchain.cpp b/src/plugins/projectexplorer/msvctoolchain.cpp index 21f3d3c7ee..7456e688ae 100644 --- a/src/plugins/projectexplorer/msvctoolchain.cpp +++ b/src/plugins/projectexplorer/msvctoolchain.cpp @@ -241,9 +241,8 @@ QByteArray MsvcToolChain::msvcPredefinedMacros(const QStringList cxxflags, QList<QByteArray> split = line.split('='); const QByteArray key = split.at(0).mid(1); QByteArray value = split.at(1); - if (!value.isEmpty()) { + if (!value.isEmpty()) value.chop(1); //remove '\n' - } predefinedMacros += "#define "; predefinedMacros += key; predefinedMacros += ' '; diff --git a/src/plugins/projectexplorer/nodesvisitor.cpp b/src/plugins/projectexplorer/nodesvisitor.cpp index 77d5ab5a24..f8e5fe003c 100644 --- a/src/plugins/projectexplorer/nodesvisitor.cpp +++ b/src/plugins/projectexplorer/nodesvisitor.cpp @@ -92,13 +92,11 @@ void FindNodesForFileVisitor::visitProjectNode(ProjectNode *node) void FindNodesForFileVisitor::visitFolderNode(FolderNode *node) { - if (node->path() == m_path) { + if (node->path() == m_path) m_nodes << node; - } foreach (FileNode *fileNode, node->fileNodes()) { - if (fileNode->path() == m_path) { + if (fileNode->path() == m_path) m_nodes << fileNode; - } } } diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp index 261955c03b..96ff649d3e 100644 --- a/src/plugins/projectexplorer/project.cpp +++ b/src/plugins/projectexplorer/project.cpp @@ -180,13 +180,12 @@ bool Project::removeTarget(Target *target) return false; if (target == activeTarget()) { - if (d->m_targets.size() == 1) { + if (d->m_targets.size() == 1) setActiveTarget(0); - } else if (d->m_targets.first() == target) { + else if (d->m_targets.first() == target) setActiveTarget(d->m_targets.at(1)); - } else { + else setActiveTarget(d->m_targets.at(0)); - } } emit aboutToRemoveTarget(target); diff --git a/src/plugins/projectexplorer/projectconfiguration.cpp b/src/plugins/projectexplorer/projectconfiguration.cpp index b6a6bfa716..b608a6f864 100644 --- a/src/plugins/projectexplorer/projectconfiguration.cpp +++ b/src/plugins/projectexplorer/projectconfiguration.cpp @@ -68,11 +68,10 @@ void ProjectConfiguration::setDisplayName(const QString &name) { if (displayName() == name) return; - if (name == m_defaultDisplayName) { + if (name == m_defaultDisplayName) m_displayName.clear(); - } else { + else m_displayName = name; - } emit displayNameChanged(); } diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index b6c1f8900e..7bc8750485 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -1154,35 +1154,30 @@ void ProjectExplorerPlugin::updateVariable(const QByteArray &variable) Core::VariableManager::instance()->remove(variable); } } else if (variable == Constants::VAR_CURRENTPROJECT_NAME) { - if (currentProject()) { + if (currentProject()) Core::VariableManager::instance()->insert(variable, currentProject()->displayName()); - } else { + else Core::VariableManager::instance()->remove(variable); - } } else if (variable == Constants::VAR_CURRENTKIT_NAME) { - if (currentProject() && currentProject()->activeTarget() && currentProject()->activeTarget()->kit()) { + if (currentProject() && currentProject()->activeTarget() && currentProject()->activeTarget()->kit()) Core::VariableManager::instance()->insert(variable, currentProject()->activeTarget()->kit()->displayName()); - } else { + else Core::VariableManager::instance()->remove(variable); - } } else if (variable == Constants::VAR_CURRENTKIT_FILESYSTEMNAME) { - if (currentProject() && currentProject()->activeTarget() && currentProject()->activeTarget()->kit()) { + if (currentProject() && currentProject()->activeTarget() && currentProject()->activeTarget()->kit()) Core::VariableManager::instance()->insert(variable, currentProject()->activeTarget()->kit()->fileSystemFriendlyName()); - } else { + else Core::VariableManager::instance()->remove(variable); - } } else if (variable == Constants::VAR_CURRENTKIT_ID) { - if (currentProject() && currentProject()->activeTarget() && currentProject()->activeTarget()->kit()) { + if (currentProject() && currentProject()->activeTarget() && currentProject()->activeTarget()->kit()) Core::VariableManager::instance()->insert(variable, currentProject()->activeTarget()->kit()->id().toString()); - } else { + else Core::VariableManager::instance()->remove(variable); - } } else if (variable == Constants::VAR_CURRENTBUILD_NAME) { - if (currentProject() && currentProject()->activeTarget() && currentProject()->activeTarget()->activeBuildConfiguration()) { + if (currentProject() && currentProject()->activeTarget() && currentProject()->activeTarget()->activeBuildConfiguration()) Core::VariableManager::instance()->insert(variable, currentProject()->activeTarget()->activeBuildConfiguration()->displayName()); - } else { + else Core::VariableManager::instance()->remove(variable); - } } else if (variable == Constants::VAR_CURRENTBUILD_TYPE) { if (currentProject() && currentProject()->activeTarget() && currentProject()->activeTarget()->activeBuildConfiguration()) { BuildConfiguration::BuildType type = currentProject()->activeTarget()->activeBuildConfiguration()->buildType(); @@ -1644,9 +1639,8 @@ void ProjectExplorerPlugin::showContextMenu(QWidget *view, const QPoint &globalP updateContextMenuActions(); d->m_projectTreeCollapseAllAction->disconnect(SIGNAL(triggered())); connect(d->m_projectTreeCollapseAllAction, SIGNAL(triggered()), view, SLOT(collapseAll())); - if (contextMenu && contextMenu->actions().count() > 0) { + if (contextMenu && contextMenu->actions().count() > 0) contextMenu->popup(globalPos); - } } BuildManager *ProjectExplorerPlugin::buildManager() const @@ -2682,11 +2676,10 @@ QString pathOrDirectoryFor(Node *node, bool dir) } } else { QFileInfo fi(path); - if (dir) { + if (dir) location = fi.isDir() ? fi.absoluteFilePath() : fi.absolutePath(); - } else { + else location = fi.absoluteFilePath(); - } } return location; } diff --git a/src/plugins/projectexplorer/projectfilewizardextension.cpp b/src/plugins/projectexplorer/projectfilewizardextension.cpp index 519d53554f..b357261de0 100644 --- a/src/plugins/projectexplorer/projectfilewizardextension.cpp +++ b/src/plugins/projectexplorer/projectfilewizardextension.cpp @@ -313,11 +313,10 @@ void ProjectFileWizardExtension::firstExtensionPageShown( m_context->page->setNoneLabel(tr("<None>")); } - if (bestProjectIndex == -1) { + if (bestProjectIndex == -1) m_context->page->setCurrentProjectIndex(0); - } else { + else m_context->page->setCurrentProjectIndex(bestProjectIndex + 1); - } // Store all version controls for later use: if (m_context->versionControls.isEmpty()) { @@ -377,11 +376,10 @@ void ProjectFileWizardExtension::initializeVersionControlChoices() QList<QWizardPage *> ProjectFileWizardExtension::extensionPages(const Core::IWizard *wizard) { - if (!m_context) { + if (!m_context) m_context = new ProjectWizardContext; - } else { + else m_context->clear(); - } // Init context with page and projects m_context->page = new ProjectWizardPage; m_context->wizard = wizard; diff --git a/src/plugins/projectexplorer/projectmodels.cpp b/src/plugins/projectexplorer/projectmodels.cpp index 122c2e5317..9e08a27505 100644 --- a/src/plugins/projectexplorer/projectmodels.cpp +++ b/src/plugins/projectexplorer/projectmodels.cpp @@ -75,9 +75,8 @@ bool sortNodes(Node *n1, Node *n2) return true; // project file is before everything else } } else { - if (file2 && file2->fileType() == ProjectFileType) { + if (file2 && file2->fileType() == ProjectFileType) return false; - } } // projects @@ -151,11 +150,10 @@ bool sortNodes(Node *n1, Node *n2) return result < 0; // sort by filename } else { result = caseFriendlyCompare(filePath1, filePath2); - if (result != 0) { + if (result != 0) return result < 0; // sort by filepath - } else { + else return n1 < n2; // sort by pointer value - } } } return false; diff --git a/src/plugins/projectexplorer/projecttreewidget.cpp b/src/plugins/projectexplorer/projecttreewidget.cpp index 1f89dc2d10..50622c0add 100644 --- a/src/plugins/projectexplorer/projecttreewidget.cpp +++ b/src/plugins/projectexplorer/projecttreewidget.cpp @@ -226,9 +226,8 @@ void ProjectTreeWidget::foldersAboutToBeRemoved(FolderNode *, const QList<Folder void ProjectTreeWidget::filesAboutToBeRemoved(FolderNode *, const QList<FileNode*> &list) { if (FileNode *fileNode = qobject_cast<FileNode *>(m_explorer->currentNode())) { - if (list.contains(fileNode)) { + if (list.contains(fileNode)) m_explorer->setCurrentNode(fileNode->projectNode()); - } } } @@ -285,9 +284,8 @@ void ProjectTreeWidget::setCurrentItem(Node *node, Project *project) qDebug() << "ProjectTreeWidget::setCurrentItem(" << (project ? project->displayName() : QLatin1String("0")) << ", " << (node ? node->path() : QLatin1String("0")) << ")"; - if (!project) { + if (!project) return; - } const QModelIndex mainIndex = m_model->indexForNode(node); diff --git a/src/plugins/projectexplorer/projectwelcomepage.cpp b/src/plugins/projectexplorer/projectwelcomepage.cpp index a899b6e820..21ee9ff64f 100644 --- a/src/plugins/projectexplorer/projectwelcomepage.cpp +++ b/src/plugins/projectexplorer/projectwelcomepage.cpp @@ -132,9 +132,8 @@ void SessionModel::cloneSession(const QString &session) m_manager->cloneSession(session, newSession); endResetModel(); - if (newSessionInputDialog.isSwitchToRequested()) { + if (newSessionInputDialog.isSwitchToRequested()) m_manager->loadSession(newSession); - } } } @@ -159,9 +158,8 @@ void SessionModel::renameSession(const QString &session) m_manager->renameSession(session, newSession); endResetModel(); - if (newSessionInputDialog.isSwitchToRequested()) { + if (newSessionInputDialog.isSwitchToRequested()) m_manager->loadSession(newSession); - } } } diff --git a/src/plugins/projectexplorer/runconfigurationmodel.cpp b/src/plugins/projectexplorer/runconfigurationmodel.cpp index 9ce267d312..453e1ee8e0 100644 --- a/src/plugins/projectexplorer/runconfigurationmodel.cpp +++ b/src/plugins/projectexplorer/runconfigurationmodel.cpp @@ -126,9 +126,8 @@ QVariant RunConfigurationModel::data(const QModelIndex &index, int role) const { if (role == Qt::DisplayRole) { const int row = index.row(); - if (row < m_runConfigurations.size()) { + if (row < m_runConfigurations.size()) return m_runConfigurations.at(row)->displayName(); - } } return QVariant(); @@ -162,9 +161,8 @@ void RunConfigurationModel::addedRunConfiguration(ProjectExplorer::RunConfigurat RunConfigurationComparer compare; int i = 0; for (; i < m_runConfigurations.size(); ++i) { - if (compare(rc, m_runConfigurations.at(i))) { + if (compare(rc, m_runConfigurations.at(i))) break; - } } beginInsertRows(QModelIndex(), i, i); diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp index afc48940eb..a81a3f1edb 100644 --- a/src/plugins/projectexplorer/session.cpp +++ b/src/plugins/projectexplorer/session.cpp @@ -221,11 +221,10 @@ void SessionManager::removeDependency(Project *project, Project *depProject) QStringList proDeps = m_depMap.value(proName); proDeps.removeAll(depName); - if (proDeps.isEmpty()) { + if (proDeps.isEmpty()) m_depMap.remove(proName); - } else { + else m_depMap[proName] = proDeps; - } emit dependencyChanged(project, depProject); } @@ -448,11 +447,10 @@ QList<Project *> SessionManager::projectOrder(Project *project) const QList<Project *> result; QStringList pros; - if (project) { + if (project) pros = dependencies(project->document()->fileName()); - } else { + else pros = dependenciesOrder(); - } foreach (const QString &proFile, pros) { foreach (Project *pro, projects()) { diff --git a/src/plugins/projectexplorer/sessiondialog.cpp b/src/plugins/projectexplorer/sessiondialog.cpp index 68a97b63d6..4775d679af 100644 --- a/src/plugins/projectexplorer/sessiondialog.cpp +++ b/src/plugins/projectexplorer/sessiondialog.cpp @@ -219,9 +219,8 @@ void SessionDialog::createNew() m_ui.sessionList->addItems(sessions); m_ui.sessionList->setCurrentRow(sessions.indexOf(newSession)); markItems(); - if (newSessionInputDialog.isSwitchToRequested()) { + if (newSessionInputDialog.isSwitchToRequested()) switchToSession(); - } } } diff --git a/src/plugins/projectexplorer/settingsaccessor.cpp b/src/plugins/projectexplorer/settingsaccessor.cpp index 4036cc15e8..90d3df39a5 100644 --- a/src/plugins/projectexplorer/settingsaccessor.cpp +++ b/src/plugins/projectexplorer/settingsaccessor.cpp @@ -2615,9 +2615,8 @@ void Version11Handler::parseQtversionFile() const QStringList &list = line.split(QLatin1Char(' ')); if (list.count() <= 1) continue; - if (list.at(0) == QLatin1String("sysroot")) { + if (list.at(0) == QLatin1String("sysroot")) sysRoot = maddeRoot(qmake) + QLatin1String("/sysroots/") + list.at(1); - } } } } diff --git a/src/plugins/projectexplorer/targetselector.cpp b/src/plugins/projectexplorer/targetselector.cpp index cd58c4ca0b..9219eebdbb 100644 --- a/src/plugins/projectexplorer/targetselector.cpp +++ b/src/plugins/projectexplorer/targetselector.cpp @@ -259,9 +259,8 @@ void TargetSelector::getControlAt(int x, int y, int *buttonIndex, int *targetInd int tx = NAVBUTTON_WIDTH + 3; int index; for (index = m_startIndex; index < m_targets.size(); ++index) { - if (x <= tx) { + if (x <= tx) break; - } tx += targetWidth() + 1; } --index; @@ -405,11 +404,10 @@ void TargetSelector::paintEvent(QPaintEvent *event) bool buildSelected = target.currentSubIndex == 0; if (index == m_currentTargetIndex) { p.setPen(QColor(255, 255, 255)); - if (buildSelected) { + if (buildSelected) image = m_buildselected; - } else { + else image = m_runselected; - } } else { p.setPen(Qt::black); } diff --git a/src/plugins/projectexplorer/taskmodel.cpp b/src/plugins/projectexplorer/taskmodel.cpp index b4b3a8be78..ca5240f3f5 100644 --- a/src/plugins/projectexplorer/taskmodel.cpp +++ b/src/plugins/projectexplorer/taskmodel.cpp @@ -252,25 +252,24 @@ QVariant TaskModel::data(const QModelIndex &index, int role) const if (!index.isValid() || index.row() >= m_tasks.count() || index.column() != 0) return QVariant(); - if (role == TaskModel::File) { + if (role == TaskModel::File) return m_tasks.at(index.row()).file.toString(); - } else if (role == TaskModel::Line) { + else if (role == TaskModel::Line) return m_tasks.at(index.row()).line; - } else if (role == TaskModel::MovedLine) { + else if (role == TaskModel::MovedLine) return m_tasks.at(index.row()).movedLine; - } else if (role == TaskModel::Description) { + else if (role == TaskModel::Description) return m_tasks.at(index.row()).description; - } else if (role == TaskModel::FileNotFound) { + else if (role == TaskModel::FileNotFound) return m_fileNotFound.value(m_tasks.at(index.row()).file.toString()); - } else if (role == TaskModel::Type) { + else if (role == TaskModel::Type) return (int)m_tasks.at(index.row()).type; - } else if (role == TaskModel::Category) { + else if (role == TaskModel::Category) return m_tasks.at(index.row()).category.uniqueIdentifier(); - } else if (role == TaskModel::Icon) { + else if (role == TaskModel::Icon) return taskTypeIcon(m_tasks.at(index.row()).type); - } else if (role == TaskModel::Task_t) { + else if (role == TaskModel::Task_t) return QVariant::fromValue(task(index)); - } return QVariant(); } diff --git a/src/plugins/projectexplorer/taskwindow.cpp b/src/plugins/projectexplorer/taskwindow.cpp index 465c76ef74..f6fdc64297 100644 --- a/src/plugins/projectexplorer/taskwindow.cpp +++ b/src/plugins/projectexplorer/taskwindow.cpp @@ -384,11 +384,10 @@ void TaskWindow::setCategoryVisibility(const Core::Id &categoryId, bool visible) QList<Core::Id> categories = d->m_filter->filteredCategories(); - if (visible) { + if (visible) categories.removeOne(categoryId); - } else { + else categories.append(categoryId); - } d->m_filter->setFilteredCategories(categories); @@ -612,9 +611,8 @@ void TaskWindow::setFocus() { if (d->m_filter->rowCount()) { d->m_listview->setFocus(); - if (d->m_listview->currentIndex() == QModelIndex()) { + if (d->m_listview->currentIndex() == QModelIndex()) d->m_listview->setCurrentIndex(d->m_filter->index(0,0, QModelIndex())); - } } } diff --git a/src/plugins/qmldesigner/components/componentcore/modelnodecontextmenu_helper.cpp b/src/plugins/qmldesigner/components/componentcore/modelnodecontextmenu_helper.cpp index cdaaf86900..337a177f52 100644 --- a/src/plugins/qmldesigner/components/componentcore/modelnodecontextmenu_helper.cpp +++ b/src/plugins/qmldesigner/components/componentcore/modelnodecontextmenu_helper.cpp @@ -90,9 +90,8 @@ static inline void applyProperties(ModelNode &node, const QHash<QString, QVarian node.property(propertyIterator.key()).dynamicTypeName() == QLatin1String("alias") && node.property(propertyIterator.key()).isBindingProperty()) { AbstractProperty targetProperty = node.bindingProperty(propertyIterator.key()).resolveToProperty(); - if (targetProperty.isValid()) { + if (targetProperty.isValid()) targetProperty.parentModelNode().setAuxiliaryData(targetProperty.name() + QLatin1String("@NodeInstance"), propertyIterator.value()); - } } else { node.setAuxiliaryData(propertyIterator.key() + QLatin1String("@NodeInstance"), propertyIterator.value()); } diff --git a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp index 45fad74cab..e710bed2d4 100644 --- a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp +++ b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp @@ -366,11 +366,10 @@ static inline void reparentTo(const ModelNode &node, const QmlItemNode &parent) if (parent.isValid() && node.isValid()) { NodeAbstractProperty parentProperty; - if (parent.hasDefaultProperty()) { + if (parent.hasDefaultProperty()) parentProperty = parent.nodeAbstractProperty(parent.defaultProperty()); - } else { + else parentProperty = parent.nodeAbstractProperty(QLatin1String("data")); - } parentProperty.reparentHere(node); } diff --git a/src/plugins/qmldesigner/components/formeditor/abstractformeditortool.cpp b/src/plugins/qmldesigner/components/formeditor/abstractformeditortool.cpp index 11a31d3bec..5db2e7aa51 100644 --- a/src/plugins/qmldesigner/components/formeditor/abstractformeditortool.cpp +++ b/src/plugins/qmldesigner/components/formeditor/abstractformeditortool.cpp @@ -193,9 +193,8 @@ static inline bool checkIfNodeIsAView(const ModelNode &node) void AbstractFormEditorTool::mousePressEvent(const QList<QGraphicsItem*> & /*itemList*/, QGraphicsSceneMouseEvent *event) { - if (event->button() == Qt::RightButton) { + if (event->button() == Qt::RightButton) event->accept(); - } } void AbstractFormEditorTool::mouseReleaseEvent(const QList<QGraphicsItem*> & /*itemList*/, QGraphicsSceneMouseEvent *event) diff --git a/src/plugins/qmldesigner/components/formeditor/dragtool.cpp b/src/plugins/qmldesigner/components/formeditor/dragtool.cpp index 67d8250658..fa99c12168 100644 --- a/src/plugins/qmldesigner/components/formeditor/dragtool.cpp +++ b/src/plugins/qmldesigner/components/formeditor/dragtool.cpp @@ -213,11 +213,10 @@ FormEditorItem* DragTool::calculateContainer(const QPointF &point, FormEditorIte const QString newImportVersion = QString("%1.%2").arg(QString::number(itemLibraryEntry.majorVersion()), QString::number(itemLibraryEntry.minorVersion())); Import newImport = Import::createLibraryImport(newImportUrl, newImportVersion); - if (itemLibraryEntry.majorVersion() == -1 && itemLibraryEntry.minorVersion() == -1) { + if (itemLibraryEntry.majorVersion() == -1 && itemLibraryEntry.minorVersion() == -1) newImport = Import::createFileImport(newImportUrl, QString()); - } else { + else newImport = Import::createLibraryImport(newImportUrl, newImportVersion); - } } return importToBeAddedList; } diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp index 9ff4c2e59f..3019d07f41 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp @@ -70,11 +70,10 @@ FormEditorGraphicsView::FormEditorGraphicsView(QWidget *parent) : void FormEditorGraphicsView::wheelEvent(QWheelEvent *event) { - if (event->modifiers().testFlag(Qt::ControlModifier)) { + if (event->modifiers().testFlag(Qt::ControlModifier)) event->ignore(); - } else { + else QGraphicsView::wheelEvent(event); - } } diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorscene.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorscene.cpp index e0b9453bc2..1cda0c1c09 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorscene.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorscene.cpp @@ -264,9 +264,8 @@ QList<QGraphicsItem *> FormEditorScene::removeLayerItems(const QList<QGraphicsIt void FormEditorScene::mousePressEvent(QGraphicsSceneMouseEvent *event) { - if (editorView() && editorView()->model()) { + if (editorView() && editorView()->model()) currentTool()->mousePressEvent(removeLayerItems(items(event->scenePos())), event); - } } static QTime staticTimer() @@ -311,16 +310,14 @@ void FormEditorScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) void FormEditorScene::keyPressEvent(QKeyEvent *keyEvent) { - if (editorView() && editorView()->model()) { + if (editorView() && editorView()->model()) currentTool()->keyPressEvent(keyEvent); - } } void FormEditorScene::keyReleaseEvent(QKeyEvent *keyEvent) { - if (editorView() && editorView()->model()) { + if (editorView() && editorView()->model()) currentTool()->keyReleaseEvent(keyEvent); - } } FormEditorView *FormEditorScene::editorView() const @@ -401,9 +398,8 @@ void FormEditorScene::clearFormEditorItems() QList<QGraphicsItem*> itemList(items()); foreach (QGraphicsItem *item, itemList) { - if (qgraphicsitem_cast<FormEditorItem* >(item)) { + if (qgraphicsitem_cast<FormEditorItem* >(item)) item->setParentItem(0); - } } foreach (QGraphicsItem *item, itemList) { diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp index 8d6b1f3cba..c15437fe5f 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp @@ -468,9 +468,8 @@ void FormEditorView::instancesRenderImageChanged(const QVector<ModelNode> &nodeL { foreach (const ModelNode &node, nodeList) { QmlItemNode qmlItemNode(node); - if (qmlItemNode.isValid() && scene()->hasItemForQmlItemNode(qmlItemNode)) { + if (qmlItemNode.isValid() && scene()->hasItemForQmlItemNode(qmlItemNode)) scene()->itemForQmlItemNode(qmlItemNode)->update(); - } } } @@ -591,9 +590,8 @@ void FormEditorView::actualStateChanged(const ModelNode &node) Utils::CrumblePath *FormEditorView::crumblePath() const { - if (widget() && widget()->toolBox()) { + if (widget() && widget()->toolBox()) return widget()->toolBox()->crumblePath(); - } return 0; } diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp index 1d4947bddd..498c2bcbe6 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp @@ -171,22 +171,20 @@ void FormEditorWidget::changeRootItemWidth(const QString &widthText) { bool canConvert; int width = widthText.toInt(&canConvert); - if (canConvert) { + if (canConvert) m_formEditorView->rootModelNode().setAuxiliaryData("width", width); - } else { + else m_formEditorView->rootModelNode().setAuxiliaryData("width", QVariant()); - } } void FormEditorWidget::changeRootItemHeight(const QString &heighText) { bool canConvert; int height = heighText.toInt(&canConvert); - if (canConvert) { + if (canConvert) m_formEditorView->rootModelNode().setAuxiliaryData("height", height); - } else { + else m_formEditorView->rootModelNode().setAuxiliaryData("height", QVariant()); - } } void FormEditorWidget::resetNodeInstanceView() @@ -198,11 +196,10 @@ void FormEditorWidget::resetNodeInstanceView() void FormEditorWidget::wheelEvent(QWheelEvent *event) { if (event->modifiers().testFlag(Qt::ControlModifier)) { - if (event->delta() > 0) { + if (event->delta() > 0) zoomAction()->zoomOut(); - } else { + else zoomAction()->zoomIn(); - } event->accept(); } else { @@ -214,16 +211,14 @@ void FormEditorWidget::wheelEvent(QWheelEvent *event) void FormEditorWidget::updateActions() { if (m_formEditorView->model() && m_formEditorView->rootModelNode().isValid()) { - if (m_formEditorView->rootModelNode().hasAuxiliaryData("width") && m_formEditorView->rootModelNode().auxiliaryData("width").isValid()) { + if (m_formEditorView->rootModelNode().hasAuxiliaryData("width") && m_formEditorView->rootModelNode().auxiliaryData("width").isValid()) m_rootWidthAction->setLineEditText(m_formEditorView->rootModelNode().auxiliaryData("width").toString()); - } else { + else m_rootWidthAction->clearLineEditText(); - } - if (m_formEditorView->rootModelNode().hasAuxiliaryData("height") && m_formEditorView->rootModelNode().auxiliaryData("height").isValid()) { + if (m_formEditorView->rootModelNode().hasAuxiliaryData("height") && m_formEditorView->rootModelNode().auxiliaryData("height").isValid()) m_rootHeightAction->setLineEditText(m_formEditorView->rootModelNode().auxiliaryData("height").toString()); - } else { + else m_rootHeightAction->clearLineEditText(); - } } else { m_rootWidthAction->clearLineEditText(); m_rootHeightAction->clearLineEditText(); diff --git a/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp b/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp index aec70f8d40..1efe0be812 100644 --- a/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp +++ b/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp @@ -300,29 +300,23 @@ void MoveManipulator::update(const QPointF& updatePoint, Snapping useSnapping, S if (stateToBeManipulated == UseActualState) { QmlAnchors anchors(item->qmlItemNode().anchors()); - if (anchors.instanceHasAnchor(AnchorLine::Top)) { + if (anchors.instanceHasAnchor(AnchorLine::Top)) anchors.setMargin(AnchorLine::Top, m_beginTopMarginHash.value(item) + offsetVector.y()); - } - if (anchors.instanceHasAnchor(AnchorLine::Left)) { + if (anchors.instanceHasAnchor(AnchorLine::Left)) anchors.setMargin(AnchorLine::Left, m_beginLeftMarginHash.value(item) + offsetVector.x()); - } - if (anchors.instanceHasAnchor(AnchorLine::Bottom)) { + if (anchors.instanceHasAnchor(AnchorLine::Bottom)) anchors.setMargin(AnchorLine::Bottom, m_beginBottomMarginHash.value(item) - offsetVector.y()); - } - if (anchors.instanceHasAnchor(AnchorLine::Right)) { + if (anchors.instanceHasAnchor(AnchorLine::Right)) anchors.setMargin(AnchorLine::Right, m_beginRightMarginHash.value(item) - offsetVector.x()); - } - if (anchors.instanceHasAnchor(AnchorLine::HorizontalCenter)) { + if (anchors.instanceHasAnchor(AnchorLine::HorizontalCenter)) anchors.setMargin(AnchorLine::HorizontalCenter, m_beginHorizontalCenterHash.value(item) + offsetVector.x()); - } - if (anchors.instanceHasAnchor(AnchorLine::VerticalCenter)) { + if (anchors.instanceHasAnchor(AnchorLine::VerticalCenter)) anchors.setMargin(AnchorLine::VerticalCenter, m_beginVerticalCenterHash.value(item) + offsetVector.y()); - } setPosition(item->qmlItemNode(), positionInContainerSpace); } else { @@ -376,11 +370,10 @@ void MoveManipulator::reparentTo(FormEditorItem *newParent) QmlItemNode parent(newParent->qmlItemNode()); if (parent.isValid()) { - if (parent.hasDefaultProperty()) { + if (parent.hasDefaultProperty()) parentProperty = parent.nodeAbstractProperty(parent.defaultProperty()); - } else { + else parentProperty = parent.nodeAbstractProperty("data"); - } foreach (FormEditorItem* item, m_itemList) { if (!item || !item->qmlItemNode().isValid()) @@ -415,29 +408,23 @@ void MoveManipulator::moveBy(double deltaX, double deltaY) QmlAnchors anchors(item->qmlItemNode().anchors()); - if (anchors.instanceHasAnchor(AnchorLine::Top)) { + if (anchors.instanceHasAnchor(AnchorLine::Top)) anchors.setMargin(AnchorLine::Top, anchors.instanceMargin(AnchorLine::Top) + deltaY); - } - if (anchors.instanceHasAnchor(AnchorLine::Left)) { + if (anchors.instanceHasAnchor(AnchorLine::Left)) anchors.setMargin(AnchorLine::Left, anchors.instanceMargin(AnchorLine::Left) + deltaX); - } - if (anchors.instanceHasAnchor(AnchorLine::Bottom)) { + if (anchors.instanceHasAnchor(AnchorLine::Bottom)) anchors.setMargin(AnchorLine::Bottom, anchors.instanceMargin(AnchorLine::Bottom) - deltaY); - } - if (anchors.instanceHasAnchor(AnchorLine::Right)) { + if (anchors.instanceHasAnchor(AnchorLine::Right)) anchors.setMargin(AnchorLine::Right, anchors.instanceMargin(AnchorLine::Right) - deltaX); - } - if (anchors.instanceHasAnchor(AnchorLine::HorizontalCenter)) { + if (anchors.instanceHasAnchor(AnchorLine::HorizontalCenter)) anchors.setMargin(AnchorLine::HorizontalCenter, anchors.instanceMargin(AnchorLine::HorizontalCenter) + deltaX); - } - if (anchors.instanceHasAnchor(AnchorLine::VerticalCenter)) { + if (anchors.instanceHasAnchor(AnchorLine::VerticalCenter)) anchors.setMargin(AnchorLine::VerticalCenter, anchors.instanceMargin(AnchorLine::VerticalCenter) + deltaY); - } setPosition(item->qmlItemNode(), QPointF(item->qmlItemNode().instanceValue("x").toDouble() + deltaX, item->qmlItemNode().instanceValue("y").toDouble() + deltaY)); diff --git a/src/plugins/qmldesigner/components/formeditor/resizemanipulator.cpp b/src/plugins/qmldesigner/components/formeditor/resizemanipulator.cpp index 83dbda2b2d..de10287172 100644 --- a/src/plugins/qmldesigner/components/formeditor/resizemanipulator.cpp +++ b/src/plugins/qmldesigner/components/formeditor/resizemanipulator.cpp @@ -135,13 +135,11 @@ void ResizeManipulator::update(const QPointF& updatePoint, Snapping useSnapping) } boundingRect.setBottomRight(updatePointInLocalSpace); - if (anchors.instanceHasAnchor(AnchorLine::HorizontalCenter)) { + if (anchors.instanceHasAnchor(AnchorLine::HorizontalCenter)) boundingRect.setLeft(boundingRect.left() - (updatePointInLocalSpace.x() - m_beginBoundingRect.right())); - } - if (anchors.instanceHasAnchor(AnchorLine::VerticalCenter)) { + if (anchors.instanceHasAnchor(AnchorLine::VerticalCenter)) boundingRect.setTop(boundingRect.top() - (updatePointInLocalSpace.y() - m_beginBoundingRect.bottom())); - } if (boundingRect.width() < minimumWidth) boundingRect.setWidth(minimumWidth); @@ -174,13 +172,11 @@ void ResizeManipulator::update(const QPointF& updatePoint, Snapping useSnapping) } boundingRect.setTopLeft(updatePointInLocalSpace); - if (anchors.instanceHasAnchor(AnchorLine::HorizontalCenter)) { + if (anchors.instanceHasAnchor(AnchorLine::HorizontalCenter)) boundingRect.setRight(boundingRect.right() - (updatePointInLocalSpace.x() - m_beginBoundingRect.left())); - } - if (anchors.instanceHasAnchor(AnchorLine::VerticalCenter)) { + if (anchors.instanceHasAnchor(AnchorLine::VerticalCenter)) boundingRect.setBottom(boundingRect.bottom() - (updatePointInLocalSpace.y() - m_beginBoundingRect.top())); - } if (boundingRect.width() < minimumWidth) @@ -216,13 +212,11 @@ void ResizeManipulator::update(const QPointF& updatePoint, Snapping useSnapping) } boundingRect.setTopRight(updatePointInLocalSpace); - if (anchors.instanceHasAnchor(AnchorLine::HorizontalCenter)) { + if (anchors.instanceHasAnchor(AnchorLine::HorizontalCenter)) boundingRect.setLeft(boundingRect.left() - (updatePointInLocalSpace.x() - m_beginBoundingRect.right())); - } - if (anchors.instanceHasAnchor(AnchorLine::VerticalCenter)) { + if (anchors.instanceHasAnchor(AnchorLine::VerticalCenter)) boundingRect.setBottom(boundingRect.bottom() - (updatePointInLocalSpace.y() - m_beginBoundingRect.top())); - } if (boundingRect.height() < minimumHeight) boundingRect.setTop(boundingRect.top() - minimumHeight + boundingRect.height()); @@ -256,13 +250,11 @@ void ResizeManipulator::update(const QPointF& updatePoint, Snapping useSnapping) boundingRect.setBottomLeft(updatePointInLocalSpace); - if (anchors.instanceHasAnchor(AnchorLine::HorizontalCenter)) { + if (anchors.instanceHasAnchor(AnchorLine::HorizontalCenter)) boundingRect.setRight(boundingRect.right() - (updatePointInLocalSpace.x() - m_beginBoundingRect.left())); - } - if (anchors.instanceHasAnchor(AnchorLine::VerticalCenter)) { + if (anchors.instanceHasAnchor(AnchorLine::VerticalCenter)) boundingRect.setTop(boundingRect.top() - (updatePointInLocalSpace.y() - m_beginBoundingRect.bottom())); - } if (boundingRect.height() < minimumHeight) boundingRect.setHeight(minimumHeight); @@ -292,9 +284,8 @@ void ResizeManipulator::update(const QPointF& updatePoint, Snapping useSnapping) boundingRect.setBottom(updatePointInLocalSpace.y()); - if (anchors.instanceHasAnchor(AnchorLine::VerticalCenter)) { + if (anchors.instanceHasAnchor(AnchorLine::VerticalCenter)) boundingRect.setTop(boundingRect.top() - (updatePointInLocalSpace.y() - m_beginBoundingRect.bottom())); - } if (boundingRect.height() < minimumHeight) boundingRect.setHeight(minimumHeight); @@ -316,9 +307,8 @@ void ResizeManipulator::update(const QPointF& updatePoint, Snapping useSnapping) boundingRect.setTop(updatePointInLocalSpace.y()); - if (anchors.instanceHasAnchor(AnchorLine::VerticalCenter)) { + if (anchors.instanceHasAnchor(AnchorLine::VerticalCenter)) boundingRect.setBottom(boundingRect.bottom() - (updatePointInLocalSpace.y() - m_beginBoundingRect.top())); - } if (boundingRect.height() < minimumHeight) boundingRect.setTop(boundingRect.top() - minimumHeight + boundingRect.height()); @@ -341,9 +331,8 @@ void ResizeManipulator::update(const QPointF& updatePoint, Snapping useSnapping) boundingRect.setRight(updatePointInLocalSpace.x()); - if (anchors.instanceHasAnchor(AnchorLine::HorizontalCenter)) { + if (anchors.instanceHasAnchor(AnchorLine::HorizontalCenter)) boundingRect.setLeft(boundingRect.left() - (updatePointInLocalSpace.x() - m_beginBoundingRect.right())); - } if (boundingRect.width() < minimumWidth) boundingRect.setWidth(minimumWidth); @@ -366,9 +355,8 @@ void ResizeManipulator::update(const QPointF& updatePoint, Snapping useSnapping) boundingRect.setLeft(updatePointInLocalSpace.x()); - if (anchors.instanceHasAnchor(AnchorLine::HorizontalCenter)) { + if (anchors.instanceHasAnchor(AnchorLine::HorizontalCenter)) boundingRect.setRight(boundingRect.right() - (updatePointInLocalSpace.x() - m_beginBoundingRect.left())); - } if (boundingRect.width() < minimumWidth) boundingRect.setLeft(boundingRect.left() - minimumWidth + boundingRect.width()); @@ -410,13 +398,11 @@ void ResizeManipulator::moveBy(double deltaX, double deltaY) qmlItemNode.setVariantProperty("width", round(qmlItemNode.instanceValue("width").toDouble() - deltaX, 4)); - if (anchors.instanceHasAnchor(AnchorLine::Left)) { + if (anchors.instanceHasAnchor(AnchorLine::Left)) anchors.setMargin(AnchorLine::Left, anchors.instanceMargin(AnchorLine::Left) + deltaX); - } - if (anchors.instanceHasAnchor(AnchorLine::HorizontalCenter)) { + if (anchors.instanceHasAnchor(AnchorLine::HorizontalCenter)) qmlItemNode.setVariantProperty("width", round(qmlItemNode.instanceValue("width").toDouble() - (deltaX * 2), 4)); - } } if (m_resizeController.isRightHandle(resizeHandle()) @@ -424,13 +410,11 @@ void ResizeManipulator::moveBy(double deltaX, double deltaY) || m_resizeController.isBottomRightHandle(resizeHandle())) { qmlItemNode.setVariantProperty("width", round(qmlItemNode.instanceValue("width").toDouble() + deltaX, 4)); - if (anchors.instanceHasAnchor(AnchorLine::Right)) { + if (anchors.instanceHasAnchor(AnchorLine::Right)) anchors.setMargin(AnchorLine::Right, round(anchors.instanceMargin(AnchorLine::Right) - deltaX, 4)); - } - if (anchors.instanceHasAnchor(AnchorLine::HorizontalCenter)) { + if (anchors.instanceHasAnchor(AnchorLine::HorizontalCenter)) qmlItemNode.setVariantProperty("width", round(qmlItemNode.instanceValue("width").toDouble() + (deltaX * 2), 4)); - } } @@ -440,13 +424,11 @@ void ResizeManipulator::moveBy(double deltaX, double deltaY) qmlItemNode.setVariantProperty("y", round(qmlItemNode.instanceValue("y").toDouble() + deltaY, 4)); qmlItemNode.setVariantProperty("height", round(qmlItemNode.instanceValue("height").toDouble() - deltaY, 4)); - if (anchors.instanceHasAnchor(AnchorLine::Top)) { + if (anchors.instanceHasAnchor(AnchorLine::Top)) anchors.setMargin(AnchorLine::Top, anchors.instanceMargin(AnchorLine::Top) + deltaY); - } - if (anchors.instanceHasAnchor(AnchorLine::VerticalCenter)) { + if (anchors.instanceHasAnchor(AnchorLine::VerticalCenter)) qmlItemNode.setVariantProperty("height", round(qmlItemNode.instanceValue("height").toDouble() - (deltaY * 2), 4)); - } } if (m_resizeController.isBottomHandle(resizeHandle()) @@ -454,13 +436,11 @@ void ResizeManipulator::moveBy(double deltaX, double deltaY) || m_resizeController.isBottomRightHandle(resizeHandle())) { qmlItemNode.setVariantProperty("height", round(qmlItemNode.instanceValue("height").toDouble() + deltaY, 4)); - if (anchors.instanceHasAnchor(AnchorLine::Bottom)) { + if (anchors.instanceHasAnchor(AnchorLine::Bottom)) anchors.setMargin(AnchorLine::Bottom, anchors.instanceMargin(AnchorLine::Bottom) - deltaY); - } - if (anchors.instanceHasAnchor(AnchorLine::VerticalCenter)) { + if (anchors.instanceHasAnchor(AnchorLine::VerticalCenter)) qmlItemNode.setVariantProperty("height", round(qmlItemNode.instanceValue("height").toDouble() + (deltaY * 2), 4)); - } } } diff --git a/src/plugins/qmldesigner/components/formeditor/selectiontool.cpp b/src/plugins/qmldesigner/components/formeditor/selectiontool.cpp index d440b2bd2b..6f6a063d86 100644 --- a/src/plugins/qmldesigner/components/formeditor/selectiontool.cpp +++ b/src/plugins/qmldesigner/components/formeditor/selectiontool.cpp @@ -165,9 +165,8 @@ 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()) { QPointF mouseMovementVector = m_rubberbandSelectionManipulator.beginPoint() - event->scenePos(); diff --git a/src/plugins/qmldesigner/components/formeditor/snapper.cpp b/src/plugins/qmldesigner/components/formeditor/snapper.cpp index 30fdd7a5ce..d0a11ce33e 100644 --- a/src/plugins/qmldesigner/components/formeditor/snapper.cpp +++ b/src/plugins/qmldesigner/components/formeditor/snapper.cpp @@ -390,14 +390,12 @@ double Snapper::snappedOffsetForLines(const SnapLineMap &snappingLineMap, double offset = value - snapLine; double distance = qAbs(offset); - if (distance < snappingDistance()) { + if (distance < snappingDistance()) minimumSnappingLineMap.insert(distance, offset); - } } - if (!minimumSnappingLineMap.isEmpty()) { + if (!minimumSnappingLineMap.isEmpty()) return minimumSnappingLineMap.begin().value(); - } return std::numeric_limits<double>::max(); } @@ -437,9 +435,8 @@ double Snapper::snappedOffsetForOffsetLines(const SnapLineMap &snappingOffsetMap } } - if (!minimumSnappingLineMap.isEmpty()) { + if (!minimumSnappingLineMap.isEmpty()) return minimumSnappingLineMap.begin().value(); - } return std::numeric_limits<double>::max(); } diff --git a/src/plugins/qmldesigner/components/formeditor/zoomaction.cpp b/src/plugins/qmldesigner/components/formeditor/zoomaction.cpp index b3714ad7b1..203d6698f7 100644 --- a/src/plugins/qmldesigner/components/formeditor/zoomaction.cpp +++ b/src/plugins/qmldesigner/components/formeditor/zoomaction.cpp @@ -64,13 +64,12 @@ void ZoomAction::zoomOut() void ZoomAction::setZoomLevel(double zoomLevel) { - if (zoomLevel < .1) { + if (zoomLevel < .1) m_zoomLevel = 0.1; - } else if (zoomLevel > 16.0) { + else if (zoomLevel > 16.0) m_zoomLevel = 16.0; - } else { + else m_zoomLevel = zoomLevel; - } emit zoomLevelChanged(m_zoomLevel); } diff --git a/src/plugins/qmldesigner/components/integration/componentview.cpp b/src/plugins/qmldesigner/components/integration/componentview.cpp index 465e048af5..3c5ed3f8e0 100644 --- a/src/plugins/qmldesigner/components/integration/componentview.cpp +++ b/src/plugins/qmldesigner/components/integration/componentview.cpp @@ -154,11 +154,10 @@ void ComponentView::searchForComponentAndAddToList(const ModelNode &node) QString description; ModelNode parentNode = node.parentProperty().parentModelNode(); if (parentNode.isValid()) { - if (parentNode.id().isEmpty()) { + if (parentNode.id().isEmpty()) description = parentNode.simplifiedTypeName() + QLatin1Char(' '); - } else { + else description = parentNode.id() + QLatin1Char(' '); - } } description += node.parentProperty().name(); QStandardItem *item = new QStandardItem(description); @@ -183,9 +182,8 @@ void ComponentView::searchForComponentAndRemoveFromList(const ModelNode &node) foreach (const ModelNode &childNode, nodeList) { - if (childNode.nodeSourceType() == ModelNode::NodeWithComponentSource) { + if (childNode.nodeSourceType() == ModelNode::NodeWithComponentSource) removeSingleNodeFromList(childNode); - } } } diff --git a/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp b/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp index b298dfb5ba..02a877fa15 100644 --- a/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp @@ -137,12 +137,10 @@ void DesignDocumentController::detachNodeInstanceView() void DesignDocumentController::attachNodeInstanceView() { - if (m_nodeInstanceView) { + if (m_nodeInstanceView) model()->attachView(m_nodeInstanceView.data()); - } - if (m_formEditorView) { + if (m_formEditorView) m_formEditorView->resetView(); - } } void DesignDocumentController::changeToMasterModel() @@ -306,9 +304,8 @@ QString DesignDocumentController::simplfiedDisplayName() const { if (!m_componentNode.isRootNode()) { if (m_componentNode.id().isEmpty()) { - if (m_formEditorView->rootModelNode().id().isEmpty()) { + if (m_formEditorView->rootModelNode().id().isEmpty()) return m_formEditorView->rootModelNode().simplifiedTypeName(); - } return m_formEditorView->rootModelNode().id(); } return m_componentNode.id(); @@ -327,11 +324,10 @@ void DesignDocumentController::setFileName(const QString &fileName) { m_fileName = fileName; - if (QFileInfo(fileName).exists()) { + if (QFileInfo(fileName).exists()) m_searchPath = QUrl::fromLocalFile(fileName); - } else { + else m_searchPath = QUrl(fileName); - } if (m_model) m_model->setFileUrl(m_searchPath); @@ -413,9 +409,8 @@ void DesignDocumentController::changeToSubComponent(const ModelNode &componentNo QWeakPointer<Model> oldModel = m_model; Q_ASSERT(oldModel.data()); - if (m_model == m_subComponentModel) { + if (m_model == m_subComponentModel) changeToMasterModel(); - } QString componentText = m_rewriterView->extractText(QList<ModelNode>() << componentNode).value(componentNode); @@ -752,9 +747,8 @@ void DesignDocumentController::paste() targetNode = view.selectedModelNodes().first(); //In case we copy and paste a selection we paste in the parent item - if ((view.selectedModelNodes().count() == selectedNodes.count()) && targetNode.isValid() && targetNode.parentProperty().isValid()) { + if ((view.selectedModelNodes().count() == selectedNodes.count()) && targetNode.isValid() && targetNode.parentProperty().isValid()) targetNode = targetNode.parentProperty().parentModelNode(); - } if (!targetNode.isValid()) targetNode = view.rootModelNode(); @@ -810,9 +804,8 @@ void DesignDocumentController::paste() QString defaultProperty(targetNode.metaInfo().defaultPropertyName()); scatterItem(pastedNode, targetNode); - if (targetNode.nodeListProperty(defaultProperty).isValid()) { + if (targetNode.nodeListProperty(defaultProperty).isValid()) targetNode.nodeListProperty(defaultProperty).reparentHere(pastedNode); - } transaction.commit(); NodeMetaInfo::clearCache(); diff --git a/src/plugins/qmldesigner/components/logger/logger.cpp b/src/plugins/qmldesigner/components/logger/logger.cpp index 30464bf2f6..8a6a575c4a 100644 --- a/src/plugins/qmldesigner/components/logger/logger.cpp +++ b/src/plugins/qmldesigner/components/logger/logger.cpp @@ -140,9 +140,8 @@ QLogger::~QLogger() QLogger* QLogger::instance() { - if (!m_instance) { + if (!m_instance) m_instance = new QLogger(); - } return m_instance; } diff --git a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp index 9b37f8508f..f4cbd3a7ce 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp @@ -208,11 +208,10 @@ NavigatorTreeModel::ItemRow NavigatorTreeModel::createItemRow(const ModelNode &n idItem->setDropEnabled(dropEnabled); idItem->setEditable(true); idItem->setData(hash, NavigatorRole); - if (node.metaInfo().isValid()) { + if (node.metaInfo().isValid()) idItem->setToolTip(node.type()); - } else { + else idItem->setToolTip(msgUnknownItem(node.type())); - } # ifdef _LOCK_ITEMS_ QStandardItem *lockItem = new QStandardItem; lockItem->setDragEnabled(true); @@ -227,9 +226,8 @@ NavigatorTreeModel::ItemRow NavigatorTreeModel::createItemRow(const ModelNode &n visibilityItem->setCheckable(true); visibilityItem->setEditable(false); visibilityItem->setData(hash, NavigatorRole); - if (node.isRootNode()) { + if (node.isRootNode()) visibilityItem->setCheckable(false); - } QMap<QString, QStandardItem *> propertyItems; foreach (const QString &propertyName, visibleProperties(node)) { @@ -256,11 +254,10 @@ void NavigatorTreeModel::updateItemRow(const ModelNode &node, ItemRow items) items.idItem->setText(node.id()); items.visibilityItem->setCheckState(node.auxiliaryData("invisible").toBool() ? Qt::Unchecked : Qt::Checked); - if (node.metaInfo().isValid()) { + if (node.metaInfo().isValid()) items.idItem->setToolTip(node.type()); - } else { + else items.idItem->setToolTip(msgUnknownItem(node.type())); - } blockItemChangedSignal(blockSignal); } @@ -496,9 +493,8 @@ void NavigatorTreeModel::removeSubTree(const ModelNode &node) QList<QStandardItem*> rowList; ItemRow itemRow = itemRowForNode(node); - if (itemRow.idItem->parent()) { + if (itemRow.idItem->parent()) rowList = itemRow.idItem->parent()->takeRow(itemRow.idItem->row()); - } foreach (const ModelNode &childNode, modelNodeChildren(node)) { removeSubTree(childNode); @@ -531,9 +527,8 @@ void NavigatorTreeModel::moveNodesInteractive(NodeAbstractProperty parentPropert if (parentProperty.isNodeProperty()) { ModelNode propertyNode = parentProperty.toNodeProperty().modelNode(); // Destruction of ancestors is not allowed - if (propertyNode.isAncestorOf(node)) { + if (propertyNode.isAncestorOf(node)) continue; - } if (propertyNode.isValid()) { QApplication::setOverrideCursor(Qt::ArrowCursor); if (QMessageBox::warning(0, tr("Warning"), tr("Reparenting the component %1 here will cause the component %2 to be deleted. Do you want to proceed?").arg(node.id(), propertyNode.id()), QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Cancel) { @@ -569,9 +564,8 @@ void NavigatorTreeModel::moveNodesInteractive(NodeAbstractProperty parentPropert if (index < targetIndex) { // item is first removed from oldIndex, then inserted at new index --targetIndex; } - if (index != targetIndex) { + if (index != targetIndex) parentProperty.toNodeListProperty().slide(index, targetIndex); - } } } } diff --git a/src/plugins/qmldesigner/components/propertyeditor/basicwidgets.cpp b/src/plugins/qmldesigner/components/propertyeditor/basicwidgets.cpp index 676c8aea0b..76b8117b3a 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/basicwidgets.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/basicwidgets.cpp @@ -618,11 +618,10 @@ private: _url = url; QString path; - if (_url.scheme() == QLatin1String("qrc")) { + if (_url.scheme() == QLatin1String("qrc")) path = QLatin1Char(':') + _url.path(); - } else { + else path = _url.toLocalFile(); - } QFile file(path); if (file.open(QIODevice::ReadOnly)) { @@ -683,11 +682,10 @@ private: _url = url; QString path; - if (_url.scheme() == QLatin1String("qrc")) { + if (_url.scheme() == QLatin1String("qrc")) path = QLatin1Char(':') + _url.path(); - } else { + else path = _url.toLocalFile(); - } QFile file(path); if (file.open(QIODevice::ReadOnly)) { @@ -755,11 +753,10 @@ private: _url = url; QString path; - if (_url.scheme() == QLatin1String("qrc")) { + if (_url.scheme() == QLatin1String("qrc")) path = QLatin1Char(':') + _url.path(); - } else { + else path = _url.toLocalFile(); - } QFile file(path); if (file.open(QIODevice::ReadOnly)) { diff --git a/src/plugins/qmldesigner/components/propertyeditor/behaviordialog.cpp b/src/plugins/qmldesigner/components/propertyeditor/behaviordialog.cpp index 3cf6bdb4fc..5cc2a91b57 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/behaviordialog.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/behaviordialog.cpp @@ -63,9 +63,8 @@ void BehaviorWidget::setComplexNode(PropertyEditorNodeWrapper* complexNode) m_propertyName = complexNode->propertyName(); m_modelNode = complexNode->parentModelNode(); - if (!modelNode().isValid()) { + if (!modelNode().isValid()) m_BehaviorDialog->hide(); - } m_BehaviorDialog->setup(modelNode(), propertyName()); } diff --git a/src/plugins/qmldesigner/components/propertyeditor/declarativewidgetview.cpp b/src/plugins/qmldesigner/components/propertyeditor/declarativewidgetview.cpp index 20446215a4..3d28d90697 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/declarativewidgetview.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/declarativewidgetview.cpp @@ -47,11 +47,10 @@ void DeclarativeWidgetView::execute() if (!m_source.isEmpty()) { m_component = new QDeclarativeComponent(&m_engine, m_source, this); - if (!m_component->isLoading()) { + if (!m_component->isLoading()) continueExecute(); - } else { + else connect(m_component.data(), SIGNAL(statusChanged(QDeclarativeComponent::Status)), this, SLOT(continueExecute())); - } } } @@ -132,17 +131,15 @@ void DeclarativeWidgetView::setRootWidget(QWidget *widget) window()->setAttribute(Qt::WA_OpaquePaintEvent, false); window()->setAttribute(Qt::WA_NoSystemBackground, false); widget->setParent(this); - if (isVisible()) { + if (isVisible()) widget->setVisible(true); - } resize(widget->size()); m_root.reset(widget); if (m_root) { QSize initialSize = m_root->size(); - if (initialSize != size()) { + if (initialSize != size()) resize(initialSize); - } } } diff --git a/src/plugins/qmldesigner/components/propertyeditor/filewidget.cpp b/src/plugins/qmldesigner/components/propertyeditor/filewidget.cpp index b2e80e06bd..6637559c8f 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/filewidget.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/filewidget.cpp @@ -98,9 +98,8 @@ void FileWidget::comboBoxChanged() void FileWidget::buttonPressed() { QString modelPath; - if (m_itemNode.isValid()) { + if (m_itemNode.isValid()) modelPath = QFileInfo(m_itemNode.modelNode().model()->fileUrl().toLocalFile()).absoluteDir().absolutePath(); - } m_lastModelPath = modelPath; @@ -122,9 +121,8 @@ void FileWidget::buttonPressed() //The last fallback is to try the path of the document if (!QFileInfo(path).exists()) { - if (m_itemNode.isValid()) { + if (m_itemNode.isValid()) path = modelPath; - } } } diff --git a/src/plugins/qmldesigner/components/propertyeditor/genericpropertieswidget.cpp b/src/plugins/qmldesigner/components/propertyeditor/genericpropertieswidget.cpp index 83cd8264ee..b63a7e0743 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/genericpropertieswidget.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/genericpropertieswidget.cpp @@ -129,9 +129,8 @@ QtProperty* GenericPropertiesWidget::addVariantProperty(const PropertyMetaInfo& } } - if (!item->isModified()) { + if (!item->isModified()) item->setValue(instance.property(propertyMetaInfo.name())); //TODO fix this - } return item; } else { @@ -167,9 +166,8 @@ QtProperty* GenericPropertiesWidget::addEnumProperty(const PropertyMetaInfo& pro if (!item->isModified()) { int selectionIndex = elementNames.indexOf(instance.property(propertyMetaInfo.name()).toString()); // TODO Fix this - if (selectionIndex != -1) { + if (selectionIndex != -1) enumManager->setValue(item, selectionIndex); - } } return item; @@ -200,17 +198,15 @@ QtProperty* GenericPropertiesWidget::addProperties(const NodeMetaInfo& nodeMetaI QtProperty* property = 0; - if (propMetaInfo.isEnumType()) { + if (propMetaInfo.isEnumType()) property = addEnumProperty(propMetaInfo, propertiesWithValues, instance); - } else if (propMetaInfo.isFlagType()) { + else if (propMetaInfo.isFlagType()) property = addFlagProperty(propMetaInfo, propertiesWithValues, instance); - } else { + else property = addVariantProperty(propMetaInfo, propertiesWithValues, instance); - } - if (property) { + if (property) groupItem->addSubProperty(property); - } } return groupItem; @@ -218,9 +214,8 @@ QtProperty* GenericPropertiesWidget::addProperties(const NodeMetaInfo& nodeMetaI void GenericPropertiesWidget::buildPropertyEditorItems() { - if (!selectedNode.isValid()) { + if (!selectedNode.isValid()) return; - } // qDebug() << "buildPropertyEditorItems for node" << selectedNode.name() << "..."; @@ -294,16 +289,14 @@ void GenericPropertiesWidget::nodeCreated(const ModelNode&) void GenericPropertiesWidget::nodeAboutToBeRemoved(const ModelNode &removedNode) { - if (selectedNode.isValid() && removedNode.isValid() && selectedNode == removedNode) { + if (selectedNode.isValid() && removedNode.isValid() && selectedNode == removedNode) select(selectedNode.parentNode()); - } } void GenericPropertiesWidget::propertyAdded(const NodeState& state, const NodeProperty&) { - if (selectedNode.isValid() && state.isValid() && selectedNode == state.modelNode()) { + if (selectedNode.isValid() && state.isValid() && selectedNode == state.modelNode()) select(state.modelNode()); - } } void GenericPropertiesWidget::propertyAboutToBeRemoved(const NodeState& /* state */, const NodeProperty&) diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp index 3a78b1aa40..19b686f435 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp @@ -136,9 +136,8 @@ QmlJS::SimpleReaderNode::Ptr templateConfiguration() const QString fileName = propertyTemplatesPath() + QLatin1String("TemplateTypes.qml"); s_templateConfiguration = reader.readFile(fileName); - if (!s_templateConfiguration) { + if (!s_templateConfiguration) qWarning() << PropertyEditor::tr("template defitions:") << reader.errors(); - } } return s_templateConfiguration; @@ -207,12 +206,11 @@ void createPropertyEditorValue(const QmlObjectNode &fxObjectNode, const QString valueObject->setName(name); valueObject->setModelNode(fxObjectNode); - if (fxObjectNode.propertyAffectedByCurrentState(name) && !(fxObjectNode.modelNode().property(name).isBindingProperty())) { + if (fxObjectNode.propertyAffectedByCurrentState(name) && !(fxObjectNode.modelNode().property(name).isBindingProperty())) valueObject->setValue(fxObjectNode.modelValue(name)); - } else { + else valueObject->setValue(value); - } if (propertyName != QLatin1String("id") && fxObjectNode.currentState().isBaseState() && @@ -239,9 +237,8 @@ void PropertyEditor::NodeType::setValue(const QmlObjectNode & fxObjectNode, cons void PropertyEditor::NodeType::setup(const QmlObjectNode &fxObjectNode, const QString &stateName, const QUrl &qmlSpecificsFile, PropertyEditor *propertyEditor) { - if (!fxObjectNode.isValid()) { + if (!fxObjectNode.isValid()) return; - } QDeclarativeContext *ctxt = m_view->rootContext(); @@ -469,9 +466,8 @@ void PropertyEditor::changeValue(const QString &propertyName) underscoreName.replace(QLatin1Char('.'), QLatin1Char('_')); PropertyEditorValue *value = qobject_cast<PropertyEditorValue*>(variantToQObject(m_currentType->m_backendValuesPropertyMap.value(underscoreName))); - if (value ==0) { + if (value ==0) return; - } QmlObjectNode fxObjectNode(m_selectedNode); @@ -670,9 +666,8 @@ void PropertyEditor::delayedResetView() void PropertyEditor::timerEvent(QTimerEvent *timerEvent) { - if (m_timerId == timerEvent->timerId()) { + if (m_timerId == timerEvent->timerId()) resetView(); - } } QString templateGeneration(NodeMetaInfo type, NodeMetaInfo superType, const QmlObjectNode &objectNode) @@ -801,9 +796,8 @@ void PropertyEditor::resetView() ctxt->setContextProperty("finishedNotify", QVariant(true)); } else { QmlObjectNode fxObjectNode; - if (m_selectedNode.isValid()) { + if (m_selectedNode.isValid()) fxObjectNode = QmlObjectNode(m_selectedNode); - } QDeclarativeContext *ctxt = type->m_view->rootContext(); ctxt->setContextProperty("finishedNotify", QVariant(false)); @@ -975,9 +969,8 @@ void PropertyEditor::nodeIdChanged(const ModelNode& node, const QString& newId, if (node == m_selectedNode) { - if (m_currentType) { + if (m_currentType) setValue(node, "id", newId); - } } } diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp index 0ebf418cd5..102e5ddda4 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp @@ -55,9 +55,8 @@ QVariant PropertyEditorValue::value() const { QVariant returnValue = m_value; if (modelNode().isValid() && modelNode().metaInfo().isValid() && modelNode().metaInfo().hasProperty(name())) - if (modelNode().metaInfo().propertyTypeName(name()) == QLatin1String("QUrl")) { + if (modelNode().metaInfo().propertyTypeName(name()) == QLatin1String("QUrl")) returnValue = returnValue.toUrl().toString(); - } return returnValue; } @@ -67,9 +66,8 @@ static bool cleverDoubleCompare(QVariant value1, QVariant value2) int a = value1.toDouble() * 100; int b = value2.toDouble() * 100; - if (qFuzzyCompare((qreal(a) / 100), (qreal(b) / 100))) { + if (qFuzzyCompare((qreal(a) / 100), (qreal(b) / 100))) return true; - } } return false; } @@ -85,12 +83,10 @@ static bool cleverColorCompare(QVariant value1, QVariant value2) return false; return (c1.alpha() == c2.alpha()); } - if ((value1.type() == QVariant::String) && (value2.type() == QVariant::Color)) { + if ((value1.type() == QVariant::String) && (value2.type() == QVariant::Color)) return cleverColorCompare(QVariant(QColor(value1.toString())), value2); - } - if ((value1.type() == QVariant::Color) && (value2.type() == QVariant::String)) { + if ((value1.type() == QVariant::Color) && (value2.type() == QVariant::String)) return cleverColorCompare(value1, QVariant(QColor(value2.toString()))); - } return false; } @@ -119,9 +115,8 @@ static void fixUrl(const QmlDesigner::ModelNode &modelNode, const QString &name, if (modelNode.isValid() && modelNode.metaInfo().isValid() && (modelNode.metaInfo().propertyTypeName(name) == "QUrl" || modelNode.metaInfo().propertyTypeName(name) == "url")) { - if (!value->isValid()) { + if (!value->isValid()) *value = QString(QLatin1String("")); - } } } @@ -130,9 +125,8 @@ void PropertyEditorValue::setValueWithEmit(const QVariant &value) if (m_value != value || isBound()) { QVariant newValue = value; if (modelNode().isValid() && modelNode().metaInfo().isValid() && modelNode().metaInfo().hasProperty(name())) - if (modelNode().metaInfo().propertyTypeName(name()) == QLatin1String("QUrl")) { + if (modelNode().metaInfo().propertyTypeName(name()) == QLatin1String("QUrl")) newValue = QUrl(newValue.toString()); - } if (cleverDoubleCompare(newValue, m_value)) return; @@ -333,9 +327,8 @@ void PropertyEditorNodeWrapper::add(const QString &type) propertyType.chop(1); m_modelNode = m_editorValue->modelNode().view()->createModelNode(propertyType, 4, 7); m_editorValue->modelNode().nodeAbstractProperty(m_editorValue->name()).reparentHere(m_modelNode); - if (!m_modelNode.isValid()) { + if (!m_modelNode.isValid()) qWarning("PropertyEditorNodeWrapper::add failed"); - } } else { qWarning("PropertyEditorNodeWrapper::add failed - node invalid"); } @@ -407,9 +400,8 @@ void PropertyEditorNodeWrapper::setup() void PropertyEditorNodeWrapper::update() { if (m_editorValue && m_editorValue->modelNode().isValid()) { - if (m_editorValue->modelNode().hasProperty(m_editorValue->name()) && m_editorValue->modelNode().property(m_editorValue->name()).isNodeProperty()) { + if (m_editorValue->modelNode().hasProperty(m_editorValue->name()) && m_editorValue->modelNode().property(m_editorValue->name()).isNodeProperty()) m_modelNode = m_editorValue->modelNode().nodeProperty(m_editorValue->name()).modelNode(); - } setup(); emit existsChanged(); emit typeChanged(); diff --git a/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.cpp b/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.cpp index 6114ac0087..aa86d96a27 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.cpp @@ -363,9 +363,8 @@ void QmlAnchorBindingProxy::setBottomAnchor(bool anchor) removeBottomAnchor(); } else { calcBottomMargin(); - if (topAnchored()) { + if (topAnchored()) backupPropertyAndRemove(modelNode(), "height"); - } } emit bottomAnchorChanged(); @@ -388,9 +387,8 @@ void QmlAnchorBindingProxy::setLeftAnchor(bool anchor) } else { calcLeftMargin(); backupPropertyAndRemove(modelNode(), "x"); - if (rightAnchored()) { + if (rightAnchored()) backupPropertyAndRemove(modelNode(), "width"); - } } emit leftAnchorChanged(); @@ -412,9 +410,8 @@ void QmlAnchorBindingProxy::setRightAnchor(bool anchor) removeRightAnchor(); } else { calcRightMargin(); - if (leftAnchored()) { + if (leftAnchored()) backupPropertyAndRemove(modelNode(), "width"); - } } emit rightAnchorChanged(); if (hasAnchors() != anchor) @@ -529,9 +526,8 @@ void QmlAnchorBindingProxy::setTopAnchor(bool anchor) } else { calcTopMargin(); backupPropertyAndRemove(modelNode(), "y"); - if (bottomAnchored()) { + if (bottomAnchored()) backupPropertyAndRemove(modelNode(), "height"); - } } emit topAnchorChanged(); if (hasAnchors() != anchor) diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp index e887d921c0..00b45fc874 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp @@ -106,22 +106,20 @@ QVariant StatesEditorModel::data(const QModelIndex &index, int role) const if (index.row() == 0) { return QString(tr("base state", "Implicit default state")); } else { - if (stateNode.hasVariantProperty("name")) { + if (stateNode.hasVariantProperty("name")) return stateNode.variantProperty("name").value(); - } else { + else return QVariant(); - } } } case StateImageSourceRole: { static int randomNumber = 0; randomNumber++; - if (index.row() == 0) { + if (index.row() == 0) return QString("image://qmldesigner_stateseditor/baseState-%1").arg(randomNumber); - } else { + else return QString("image://qmldesigner_stateseditor/%1-%2").arg(index.internalId()).arg(randomNumber); - } } case NodeId : return index.internalId(); } diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp index ef62ad7ee8..02d6290457 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp @@ -79,11 +79,10 @@ void StatesEditorView::removeState(int nodeId) setCurrentState(baseState()); } else if (parentProperty.isValid()){ int index = parentProperty.indexOf(stateNode); - if (index == 0) { + if (index == 0) setCurrentState(parentProperty.at(1)); - } else { + else setCurrentState(parentProperty.at(index - 1)); - } } @@ -112,11 +111,10 @@ void StatesEditorView::synchonizeCurrentStateFromWidget() void StatesEditorView::createNewState() { - if (currentState().isBaseState()) { + if (currentState().isBaseState()) addState(); - } else { + else duplicateCurrentState(); - } } void StatesEditorView::addState() @@ -154,11 +152,10 @@ void StatesEditorView::resetModel() m_statesEditorModel->reset(); if (m_statesEditorWidget) { - if (currentState().isBaseState()) { + if (currentState().isBaseState()) m_statesEditorWidget->setCurrentStateInternalId(currentState().modelNode().internalId()); - } else { + else m_statesEditorWidget->setCurrentStateInternalId(0); - } } } @@ -258,9 +255,8 @@ void StatesEditorView::nodeAboutToBeRemoved(const ModelNode &removedNode) { if (removedNode.hasParentProperty()) { const NodeAbstractProperty propertyParent = removedNode.parentProperty(); - if (propertyParent.parentModelNode().isRootNode() && propertyParent.name() == "states") { + if (propertyParent.parentModelNode().isRootNode() && propertyParent.name() == "states") m_lastIndex = propertyParent.indexOf(removedNode); - } } if (currentState().isValid() && removedNode == currentState()) setCurrentState(baseState()); @@ -310,11 +306,10 @@ void StatesEditorView::actualStateChanged(const ModelNode &node) { QmlModelState newQmlModelState(node); - if (newQmlModelState.isBaseState()) { + if (newQmlModelState.isBaseState()) m_statesEditorWidget->setCurrentStateInternalId(0); - } else { + else m_statesEditorWidget->setCurrentStateInternalId(newQmlModelState.modelNode().internalId()); - } QmlModelView::actualStateChanged(node); } diff --git a/src/plugins/qmldesigner/designercore/exceptions/invalididexception.cpp b/src/plugins/qmldesigner/designercore/exceptions/invalididexception.cpp index 7e109c1ef9..4ca877485c 100644 --- a/src/plugins/qmldesigner/designercore/exceptions/invalididexception.cpp +++ b/src/plugins/qmldesigner/designercore/exceptions/invalididexception.cpp @@ -40,11 +40,10 @@ InvalidIdException::InvalidIdException(int line, InvalidArgumentException(line, function, file, "id"), m_id(id) { - if (reason == InvalidCharacters) { + if (reason == InvalidCharacters) m_description = QCoreApplication::translate("InvalidIdException", "Only alphanumeric characters and underscore allowed.\nIds must begin with a lowercase letter."); - } else { + else m_description = QCoreApplication::translate("InvalidIdException", "Ids have to be unique."); - } } InvalidIdException::InvalidIdException(int line, diff --git a/src/plugins/qmldesigner/designercore/filemanager/changeimportsvisitor.cpp b/src/plugins/qmldesigner/designercore/filemanager/changeimportsvisitor.cpp index 97482cfdc2..bee3a6113b 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/changeimportsvisitor.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/changeimportsvisitor.cpp @@ -51,11 +51,10 @@ bool ChangeImportsVisitor::add(QmlJS::AST::UiProgram *ast, const Import &import) if (ast->imports && ast->imports->import) { int insertionPoint = 0; - if (ast->members && ast->members->member) { + if (ast->members && ast->members->member) insertionPoint = ast->members->member->firstSourceLocation().begin(); - } else { + else insertionPoint = m_source.length(); - } while (insertionPoint > 0) { --insertionPoint; const QChar c = m_source.at(insertionPoint); @@ -93,11 +92,10 @@ bool ChangeImportsVisitor::remove(QmlJS::AST::UiProgram *ast, const Import &impo bool ChangeImportsVisitor::equals(QmlJS::AST::UiImport *ast, const Import &import) { - if (import.isLibraryImport()) { + if (import.isLibraryImport()) return toString(ast->importUri) == import.url(); - } else if (import.isFileImport()) { + else if (import.isFileImport()) return ast->fileName == import.file(); - } else { + else return false; - } } diff --git a/src/plugins/qmldesigner/designercore/filemanager/changepropertyvisitor.cpp b/src/plugins/qmldesigner/designercore/filemanager/changepropertyvisitor.cpp index 11f30be6cf..33edd9ebb0 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/changepropertyvisitor.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/changepropertyvisitor.cpp @@ -120,9 +120,8 @@ void ChangePropertyVisitor::replaceInMembers(UiObjectInitializer *initializer, // for grouped properties: else if (!prefix.isEmpty()) { if (UiObjectDefinition *def = cast<UiObjectDefinition *>(member)) { - if (toString(def->qualifiedTypeNameId) == prefix) { + if (toString(def->qualifiedTypeNameId) == prefix) replaceInMembers(def->initializer, suffix); - } } } } @@ -172,27 +171,25 @@ void ChangePropertyVisitor::replaceMemberValue(UiObjectMember *propertyMember, b bool ChangePropertyVisitor::isMatchingPropertyMember(const QString &propName, UiObjectMember *member) { - if (UiObjectBinding *objectBinding = AST::cast<UiObjectBinding *>(member)) { + if (UiObjectBinding *objectBinding = AST::cast<UiObjectBinding *>(member)) return propName == toString(objectBinding->qualifiedId); - } else if (UiScriptBinding *scriptBinding = AST::cast<UiScriptBinding *>(member)) { + else if (UiScriptBinding *scriptBinding = AST::cast<UiScriptBinding *>(member)) return propName == toString(scriptBinding->qualifiedId); - } else if (UiArrayBinding *arrayBinding = AST::cast<UiArrayBinding *>(member)) { + else if (UiArrayBinding *arrayBinding = AST::cast<UiArrayBinding *>(member)) return propName == toString(arrayBinding->qualifiedId); - } else if (UiPublicMember *publicMember = AST::cast<UiPublicMember *>(member)) { + else if (UiPublicMember *publicMember = AST::cast<UiPublicMember *>(member)) return propName == publicMember->name; - } else { + else return false; - } } // FIXME: duplicate code in the QmlJS::Rewriter class, remove this bool ChangePropertyVisitor::nextMemberOnSameLine(UiObjectMemberList *members) { - if (members && members->next && members->next->member) { + if (members && members->next && members->next->member) return members->next->member->firstSourceLocation().startLine == members->member->lastSourceLocation().startLine; - } else { + else return false; - } } // FIXME: duplicate code in the QmlJS::Rewriter class, remove this diff --git a/src/plugins/qmldesigner/designercore/filemanager/firstdefinitionfinder.cpp b/src/plugins/qmldesigner/designercore/filemanager/firstdefinitionfinder.cpp index bbbb19cd9b..b15105cb2b 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/firstdefinitionfinder.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/firstdefinitionfinder.cpp @@ -78,9 +78,8 @@ void FirstDefinitionFinder::extractFirstObjectDefinition(UiObjectInitializer* as return; for (UiObjectMemberList *iter = ast->members; iter; iter = iter->next) { - if (UiObjectDefinition *def = cast<UiObjectDefinition*>(iter->member)) { + if (UiObjectDefinition *def = cast<UiObjectDefinition*>(iter->member)) m_firstObjectDefinition = def; - } } } diff --git a/src/plugins/qmldesigner/designercore/filemanager/moveobjectbeforeobjectvisitor.cpp b/src/plugins/qmldesigner/designercore/filemanager/moveobjectbeforeobjectvisitor.cpp index 74e01eccf4..97b09c7a58 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/moveobjectbeforeobjectvisitor.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/moveobjectbeforeobjectvisitor.cpp @@ -69,9 +69,8 @@ bool MoveObjectBeforeObjectVisitor::operator ()(QmlJS::AST::UiProgram *ast) QMLRewriter::operator ()(ast); - if (foundEverything()) { + if (foundEverything()) doMove(); - } return didRewriting(); } @@ -140,12 +139,10 @@ void MoveObjectBeforeObjectVisitor::doMove() int start = moveInfo.objectStart; int end = moveInfo.objectEnd; if (!inDefaultProperty) { - if (arrayMember->commaToken.isValid()) { + if (arrayMember->commaToken.isValid()) start = arrayMember->commaToken.begin(); - } - else { + else end = otherArrayMember->commaToken.end(); - } } includeSurroundingWhitespace(start, end); diff --git a/src/plugins/qmldesigner/designercore/filemanager/moveobjectvisitor.cpp b/src/plugins/qmldesigner/designercore/filemanager/moveobjectvisitor.cpp index c22754e837..0840dad9ed 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/moveobjectvisitor.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/moveobjectvisitor.cpp @@ -63,9 +63,8 @@ protected: if (didRewriting()) return false; - if (ast->qualifiedTypeNameId->identifierToken.offset == targetParentObjectLocation) { + if (ast->qualifiedTypeNameId->identifierToken.offset == targetParentObjectLocation) insertInto(ast->initializer); - } return !didRewriting(); } @@ -75,9 +74,8 @@ protected: if (didRewriting()) return false; - if (ast->firstSourceLocation().offset == targetParentObjectLocation) { + if (ast->firstSourceLocation().offset == targetParentObjectLocation) insertInto(ast->initializer); - } return !didRewriting(); } @@ -122,11 +120,10 @@ private: moveInfo.prefixToInsert = QLatin1String("\n") + targetPropertyName + (targetIsArrayBinding ? QLatin1String(": [") : QLatin1String(": ")); moveInfo.suffixToInsert = targetIsArrayBinding ? QLatin1String("\n]") : QLatin1String(""); - if (insertAfter && insertAfter->member) { + if (insertAfter && insertAfter->member) moveInfo.destination = insertAfter->member->lastSourceLocation().end(); - } else { + else moveInfo.destination = ast->lbraceToken.end(); - } move(moveInfo); diff --git a/src/plugins/qmldesigner/designercore/filemanager/removepropertyvisitor.cpp b/src/plugins/qmldesigner/designercore/filemanager/removepropertyvisitor.cpp index 02dc37c457..e4d4b117cd 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/removepropertyvisitor.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/removepropertyvisitor.cpp @@ -84,15 +84,13 @@ 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()) { if (UiObjectDefinition *def = cast<UiObjectDefinition *>(member)) { - if (toString(def->qualifiedTypeNameId) == prefix) { + if (toString(def->qualifiedTypeNameId) == prefix) removeGroupedProperty(def); - } } } } @@ -113,9 +111,8 @@ void RemovePropertyVisitor::removeGroupedProperty(UiObjectDefinition *ast) ++memberCount; UiObjectMember *member = it->member; - if (!wanted && memberNameMatchesPropertyName(propName, member)) { + if (!wanted && memberNameMatchesPropertyName(propName, member)) wanted = member; - } } if (!wanted) diff --git a/src/plugins/qmldesigner/designercore/filemanager/removeuiobjectmembervisitor.cpp b/src/plugins/qmldesigner/designercore/filemanager/removeuiobjectmembervisitor.cpp index 94af385cc4..8ed70d1351 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/removeuiobjectmembervisitor.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/removeuiobjectmembervisitor.cpp @@ -75,11 +75,10 @@ bool RemoveUIObjectMemberVisitor::visitObjectMember(QmlJS::AST::UiObjectMember * int start = objectLocation; int end = ast->lastSourceLocation().end(); - if (UiArrayBinding *parentArray = containingArray()) { + if (UiArrayBinding *parentArray = containingArray()) extendToLeadingOrTrailingComma(parentArray, ast, start, end); - } else { + else includeSurroundingWhitespace(start, end); - } includeLeadingEmptyLine(start); replace(start, end - start, QLatin1String("")); @@ -99,9 +98,8 @@ bool RemoveUIObjectMemberVisitor::visitObjectMember(QmlJS::AST::UiObjectMember * UiArrayBinding *RemoveUIObjectMemberVisitor::containingArray() const { if (parents.size() > 2) { - if (cast<UiArrayMemberList*>(parents[parents.size() - 2])) { + if (cast<UiArrayMemberList*>(parents[parents.size() - 2])) return cast<UiArrayBinding*>(parents[parents.size() - 3]); - } } return 0; diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp index 075171a65f..db22913da5 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp @@ -111,20 +111,18 @@ NodeInstance &NodeInstance::operator=(const NodeInstance &other) ModelNode NodeInstance::modelNode() const { - if (d) { + if (d) return d->modelNode; - } else { + else return ModelNode(); - } } qint32 NodeInstance::instanceId() const { - if (d) { + if (d) return d->modelNode.internalId(); - } else { + else return -1; - } } bool NodeInstance::isValid() const @@ -140,108 +138,96 @@ void NodeInstance::makeInvalid() QRectF NodeInstance::boundingRect() const { - if (isValid()) { + if (isValid()) return d->boundingRect; - } else { + else return QRectF(); - } } bool NodeInstance::hasContent() const { - if (isValid()) { + if (isValid()) return d->hasContent; - } else { + else return false; - } } bool NodeInstance::isAnchoredBySibling() const { - if (isValid()) { + if (isValid()) return d->isAnchoredBySibling; - } else { + else return false; - } } bool NodeInstance::isAnchoredByChildren() const { - if (isValid()) { + if (isValid()) return d->isAnchoredByChildren; - } else { + else return false; - } } bool NodeInstance::isMovable() const { - if (isValid()) { + if (isValid()) return d->isMovable; - } else { + else return false; - } } bool NodeInstance::isResizable() const { - if (isValid()) { + if (isValid()) return d->isResizable; - } else { + else return false; - } } QTransform NodeInstance::transform() const { - if (isValid()) { + if (isValid()) return d->transform; - } else { + else return QTransform(); - } } QTransform NodeInstance::sceneTransform() const { - if (isValid()) { + if (isValid()) return d->sceneTransform; - } else { + else return QTransform(); - } } bool NodeInstance::isInPositioner() const { - if (isValid()) { + if (isValid()) return d->isInPositioner; - } else { + else return false; - } } QPointF NodeInstance::position() const { - if (isValid()) { + if (isValid()) return d->position; - } else { + else return QPointF(); - } } QSizeF NodeInstance::size() const { - if (isValid()) { + if (isValid()) return d->size; - } else { + else return QSizeF(); - } } int NodeInstance::penWidth() const { - if (isValid()) { + if (isValid()) return d->penWidth; - } else { + else return 1; - } } void NodeInstance::paint(QPainter *painter) @@ -276,11 +262,10 @@ QString NodeInstance::instanceType(const QString &name) const qint32 NodeInstance::parentId() const { - if (isValid()) { + if (isValid()) return d->parentInstanceId; - } else { + else return false; - } } bool NodeInstance::hasAnchor(const QString &name) const diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp index e2a912dc48..3b5e372919 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp @@ -138,9 +138,8 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV } QByteArray envImportPath = qgetenv("QTCREATOR_QMLPUPPET_PATH"); - if (!envImportPath.isEmpty()) { + if (!envImportPath.isEmpty()) applicationPath = envImportPath; - } QProcessEnvironment enviroment = QProcessEnvironment::systemEnvironment(); @@ -363,9 +362,8 @@ void NodeInstanceServerProxy::readFirstDataStream() QDataStream in(m_firstSocket.data()); in.setVersion(QDataStream::Qt_4_8); - if (m_firstBlockSize == 0) { + if (m_firstBlockSize == 0) in >> m_firstBlockSize; - } if (m_firstSocket->bytesAvailable() < m_firstBlockSize) break; @@ -401,9 +399,8 @@ void NodeInstanceServerProxy::readSecondDataStream() QDataStream in(m_secondSocket.data()); in.setVersion(QDataStream::Qt_4_8); - if (m_secondBlockSize == 0) { + if (m_secondBlockSize == 0) in >> m_secondBlockSize; - } if (m_secondSocket->bytesAvailable() < m_secondBlockSize) break; @@ -439,9 +436,8 @@ void NodeInstanceServerProxy::readThirdDataStream() QDataStream in(m_thirdSocket.data()); in.setVersion(QDataStream::Qt_4_8); - if (m_thirdBlockSize == 0) { + if (m_thirdBlockSize == 0) in >> m_thirdBlockSize; - } if (m_thirdSocket->bytesAvailable() < m_thirdBlockSize) break; diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp index e03b15db34..d98a5cd09e 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp @@ -191,11 +191,10 @@ void NodeInstanceView::handleChrash() { int elaspsedTimeSinceLastCrash = m_lastCrashTime.restart(); - if (elaspsedTimeSinceLastCrash > 2000) { + if (elaspsedTimeSinceLastCrash > 2000) restartProcess(); - } else { + else emit qmlPuppetCrashed(); - } } @@ -250,17 +249,15 @@ void NodeInstanceView::resetHorizontalAnchors(const ModelNode &modelNode) QList<BindingProperty> bindingList; QList<VariantProperty> valueList; - if (modelNode.hasBindingProperty("x")) { + if (modelNode.hasBindingProperty("x")) bindingList.append(modelNode.bindingProperty("x")); - } else if (modelNode.hasVariantProperty("x")) { + else if (modelNode.hasVariantProperty("x")) valueList.append(modelNode.variantProperty("x")); - } - if (modelNode.hasBindingProperty("width")) { + if (modelNode.hasBindingProperty("width")) bindingList.append(modelNode.bindingProperty("width")); - } else if (modelNode.hasVariantProperty("width")) { + else if (modelNode.hasVariantProperty("width")) valueList.append(modelNode.variantProperty("width")); - } if (!valueList.isEmpty()) nodeInstanceServer()->changePropertyValues(createChangeValueCommand(valueList)); @@ -275,17 +272,15 @@ void NodeInstanceView::resetVerticalAnchors(const ModelNode &modelNode) QList<BindingProperty> bindingList; QList<VariantProperty> valueList; - if (modelNode.hasBindingProperty("yx")) { + if (modelNode.hasBindingProperty("yx")) bindingList.append(modelNode.bindingProperty("yx")); - } else if (modelNode.hasVariantProperty("y")) { + else if (modelNode.hasVariantProperty("y")) valueList.append(modelNode.variantProperty("y")); - } - if (modelNode.hasBindingProperty("height")) { + if (modelNode.hasBindingProperty("height")) bindingList.append(modelNode.bindingProperty("height")); - } else if (modelNode.hasVariantProperty("height")) { + else if (modelNode.hasVariantProperty("height")) valueList.append(modelNode.variantProperty("height")); - } if (!valueList.isEmpty()) nodeInstanceServer()->changePropertyValues(createChangeValueCommand(valueList)); @@ -301,11 +296,10 @@ void NodeInstanceView::propertiesAboutToBeRemoved(const QList<AbstractProperty>& QList<AbstractProperty> nonNodePropertyList; foreach (const AbstractProperty &property, propertyList) { - if (property.isNodeAbstractProperty()) { + if (property.isNodeAbstractProperty()) nodeList.append(property.toNodeAbstractProperty().allSubNodes()); - } else { + else nonNodePropertyList.append(property); - } } nodeInstanceServer()->removeInstances(createRemoveInstancesCommand(nodeList)); @@ -551,11 +545,10 @@ void NodeInstanceView::actualStateChanged(const ModelNode &node) { NodeInstance newStateInstance = instanceForNode(node); - if (newStateInstance.isValid() && node.metaInfo().isSubclassOf("QtQuick.State", 1, 0)) { + if (newStateInstance.isValid() && node.metaInfo().isSubclassOf("QtQuick.State", 1, 0)) nodeInstanceView()->activateState(newStateInstance); - } else { + else nodeInstanceView()->activateBaseState(); - } } @@ -698,9 +691,8 @@ NodeInstance NodeInstanceView::loadNode(const ModelNode &node) insertInstanceRelationships(instance); - if (node.isRootNode()) { + if (node.isRootNode()) m_rootNodeInstance = instance; - } return instance; } @@ -996,9 +988,8 @@ RemoveInstancesCommand NodeInstanceView::createRemoveInstancesCommand(const QLis if (node.isValid() && hasInstanceForNode(node)) { NodeInstance instance = instanceForNode(node); - if (instance.instanceId() >= 0) { + if (instance.instanceId() >= 0) idList.append(instance.instanceId()); - } } } @@ -1166,9 +1157,8 @@ void NodeInstanceView::componentCompleted(const ComponentCompletedCommand &comma QVector<ModelNode> nodeVector; foreach (const qint32 &instanceId, command.instances()) { - if (hasModelNodeForInternalId(instanceId)) { + if (hasModelNodeForInternalId(instanceId)) nodeVector.append(modelNodeForInternalId(instanceId)); - } } if (!nodeVector.isEmpty()) @@ -1208,9 +1198,8 @@ void NodeInstanceView::token(const TokenCommand &command) QVector<ModelNode> nodeVector; foreach (const qint32 &instanceId, command.instances()) { - if (hasModelNodeForInternalId(instanceId)) { + if (hasModelNodeForInternalId(instanceId)) nodeVector.append(modelNodeForInternalId(instanceId)); - } } diff --git a/src/plugins/qmldesigner/designercore/metainfo/metainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/metainfo.cpp index de9b693074..d21aa33e85 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/metainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/metainfo.cpp @@ -205,9 +205,8 @@ MetaInfo MetaInfo::global() */ void MetaInfo::clearGlobal() { - if (s_global.m_p->m_isInitialized) { + if (s_global.m_p->m_isInitialized) s_global.m_p->clear(); - } } void MetaInfo::setPluginPaths(const QStringList &paths) diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp index 567a659898..0eb345f03b 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp @@ -151,11 +151,10 @@ public: TypeId typeId; QString typeName = typeId(value); if (typeName == QLatin1String("number")) { - if (value->asRealValue()) { + if (value->asRealValue()) typeName = "real"; - } else { + else typeName = "int"; - } } m_properties.append(qMakePair(name, typeName)); } @@ -206,11 +205,10 @@ QStringList prototypes(const ObjectValue *ov, const ContextPtr &context, bool ve list << qmlValue->moduleName() + QLatin1Char('.') + qmlValue->className(); } } else { - if (versions) { + if (versions) list << ov->className() + " -1.-1"; - } else { + else list << ov->className(); - } } ov = ov->prototype(context); } @@ -268,11 +266,10 @@ QList<PropertyInfo> getQmlTypes(const CppComponentValue *ov, const ContextPtr &c const CppComponentValue * qmlObjectValue = value_cast<CppComponentValue>(prototype); - if (qmlObjectValue) { + if (qmlObjectValue) list << getQmlTypes(qmlObjectValue, context); - } else { + else list << getObjectTypes(prototype, context); - } } return list; @@ -284,11 +281,10 @@ QList<PropertyInfo> getTypes(const ObjectValue *ov, const ContextPtr &context, b const CppComponentValue * qmlObjectValue = value_cast<CppComponentValue>(ov); - if (qmlObjectValue) { + if (qmlObjectValue) list << getQmlTypes(qmlObjectValue, context, local); - } else { + else list << getObjectTypes(ov, context, local); - } return list; } @@ -314,11 +310,10 @@ QList<PropertyInfo> getObjectTypes(const ObjectValue *ov, const ContextPtr &cont const CppComponentValue * qmlObjectValue = value_cast<CppComponentValue>(prototype); - if (qmlObjectValue) { + if (qmlObjectValue) list << getQmlTypes(qmlObjectValue, context); - } else { + else list << getObjectTypes(prototype, context); - } } return list; @@ -449,11 +444,10 @@ NodeMetaInfoPrivate::Pointer NodeMetaInfoPrivate::create(Model *model, const QSt { if (m_nodeMetaInfoCache.contains(stringIdentifier(type, maj, min))) { const Pointer &info = m_nodeMetaInfoCache.value(stringIdentifier(type, maj, min)); - if (info->model() == model) { + if (info->model() == model) return info; - } else { + else m_nodeMetaInfoCache.clear(); - } } Pointer newData(new NodeMetaInfoPrivate(model, type, maj, min)); @@ -553,17 +547,15 @@ const QmlJS::ObjectValue *NodeMetaInfoPrivate::getObjectValue() const QmlJS::ContextPtr NodeMetaInfoPrivate::context() const { - if (m_model && m_model->rewriterView() && m_model->rewriterView()->scopeChain()) { + if (m_model && m_model->rewriterView() && m_model->rewriterView()->scopeChain()) return m_model->rewriterView()->scopeChain()->context(); - } return QmlJS::ContextPtr(0); } const QmlJS::Document *NodeMetaInfoPrivate::document() const { - if (m_model && m_model->rewriterView()) { + if (m_model && m_model->rewriterView()) return m_model->rewriterView()->document(); - } return 0; } @@ -593,9 +585,8 @@ bool NodeMetaInfoPrivate::isPropertyWritable(const QString &propertyName) const const QString rawPropertyName = parts.last(); const QString objectType = propertyType(objectName); - if (isValueType(objectType)) { + if (isValueType(objectType)) return true; - } QSharedPointer<NodeMetaInfoPrivate> objectInfo(create(m_model, objectType)); if (objectInfo->isValid()) @@ -625,9 +616,8 @@ bool NodeMetaInfoPrivate::isPropertyList(const QString &propertyName) const const QString rawPropertyName = parts.last(); const QString objectType = propertyType(objectName); - if (isValueType(objectType)) { + if (isValueType(objectType)) return false; - } QSharedPointer<NodeMetaInfoPrivate> objectInfo(create(m_model, objectType)); if (objectInfo->isValid()) @@ -653,9 +643,8 @@ bool NodeMetaInfoPrivate::isPropertyPointer(const QString &propertyName) const const QString rawPropertyName = parts.last(); const QString objectType = propertyType(objectName); - if (isValueType(objectType)) { + if (isValueType(objectType)) return false; - } QSharedPointer<NodeMetaInfoPrivate> objectInfo(create(m_model, objectType)); if (objectInfo->isValid()) @@ -681,9 +670,8 @@ bool NodeMetaInfoPrivate::isPropertyEnum(const QString &propertyName) const const QString rawPropertyName = parts.last(); const QString objectType = propertyType(objectName); - if (isValueType(objectType)) { + if (isValueType(objectType)) return false; - } QSharedPointer<NodeMetaInfoPrivate> objectInfo(create(m_model, objectType)); if (objectInfo->isValid()) @@ -709,9 +697,8 @@ QString NodeMetaInfoPrivate::propertyEnumScope(const QString &propertyName) cons const QString rawPropertyName = parts.last(); const QString objectType = propertyType(objectName); - if (isValueType(objectType)) { + if (isValueType(objectType)) return QString(); - } QSharedPointer<NodeMetaInfoPrivate> objectInfo(create(m_model, objectType)); if (objectInfo->isValid()) @@ -918,13 +905,12 @@ void NodeMetaInfoPrivate::setupPrototypes() description.majorVersion = qmlValue->componentVersion().majorVersion(); LanguageUtils::FakeMetaObject::Export qtquickExport = qmlValue->metaObject()->exportInPackage("QtQuick"); LanguageUtils::FakeMetaObject::Export cppExport = qmlValue->metaObject()->exportInPackage("<cpp>"); - if (qtquickExport.isValid()) { + if (qtquickExport.isValid()) description.className = qtquickExport.package + '.' + qtquickExport.type; - } else if (qmlValue->moduleName().isEmpty() && cppExport.isValid()) { + else if (qmlValue->moduleName().isEmpty() && cppExport.isValid()) description.className = cppExport.package + '.' + cppExport.type; - } else if (!qmlValue->moduleName().isEmpty()) { + else if (!qmlValue->moduleName().isEmpty()) description.className = qmlValue->moduleName() + '.' + description.className; - } m_prototypes.append(description); } else { if (context()->lookupType(document(), QStringList() << ov->className())) @@ -1051,9 +1037,8 @@ QVariant NodeMetaInfo::propertyCastedValue(const QString &propertyName, const QV { QVariant variant = value; - if (propertyIsEnumType(propertyName)) { + if (propertyIsEnumType(propertyName)) return variant; - } const QString typeName = propertyTypeName(propertyName); diff --git a/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp b/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp index e06085675e..81e881b2ee 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp @@ -100,9 +100,8 @@ static inline bool checkIfDerivedFromItem(const QString &fileName) document->parseQml(); - if (!document->isParsedCorrectly()) { + if (!document->isParsedCorrectly()) return false; - } snapshot.insert(document); @@ -221,9 +220,8 @@ void SubComponentManager::parseDirectories() foreach (const Import &import, m_imports) { if (import.isFileImport()) { QFileInfo dirInfo = QFileInfo(m_filePath.resolved(import.file()).toLocalFile()); - if (dirInfo.exists() && dirInfo.isDir()) { + if (dirInfo.exists() && dirInfo.isDir()) parseDirectory(dirInfo.canonicalFilePath()); - } } else { QString url = import.url(); foreach (const QString &path, importPaths()) { @@ -263,9 +261,8 @@ void SubComponentManager::parseDirectory(const QString &canonicalDirPath, bool a } } } - if (!metaFiles.isEmpty()) { + if (!metaFiles.isEmpty()) return; - } } if (debug) @@ -338,9 +335,8 @@ void SubComponentManager::parseFile(const QString &canonicalFilePath, bool addTo qDebug() << Q_FUNC_INFO << canonicalFilePath; QFile file(canonicalFilePath); - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return; - } QString dir = QFileInfo(canonicalFilePath).path(); foreach (const QString &qualifier, m_dirToQualifier.values(dir)) { @@ -361,9 +357,8 @@ QList<QFileInfo> SubComponentManager::watchedFiles(const QString &canonicalDirPa foreach (const QString &monitoredFile, m_watcher.files()) { QFileInfo fileInfo(monitoredFile); - if (fileInfo.dir().absolutePath() == canonicalDirPath) { + if (fileInfo.dir().absolutePath() == canonicalDirPath) files.append(fileInfo); - } } return files; } @@ -469,9 +464,8 @@ void SubComponentManager::update(const QUrl &filePath, const QList<Import> &impo m_watcher.removePath(oldDir.filePath()); } - if (!newDir.filePath().isEmpty()) { + if (!newDir.filePath().isEmpty()) m_dirToQualifier.insertMulti(newDir.canonicalFilePath(), QString()); - } } // diff --git a/src/plugins/qmldesigner/designercore/model/abstractview.cpp b/src/plugins/qmldesigner/designercore/model/abstractview.cpp index c25fcd85c1..16a7abd0af 100644 --- a/src/plugins/qmldesigner/designercore/model/abstractview.cpp +++ b/src/plugins/qmldesigner/designercore/model/abstractview.cpp @@ -338,20 +338,18 @@ QmlModelView *AbstractView::toQmlModelView() NodeInstanceView *AbstractView::nodeInstanceView() const { - if (model()) { + if (model()) return model()->d->nodeInstanceView(); - } else { + else return 0; - } } RewriterView *AbstractView::rewriterView() const { - if (model()) { + if (model()) return model()->d->rewriterView(); - } else { + else return 0; - } } void AbstractView::resetView() diff --git a/src/plugins/qmldesigner/designercore/model/anchorline.cpp b/src/plugins/qmldesigner/designercore/model/anchorline.cpp index a69b83f2df..4724982147 100644 --- a/src/plugins/qmldesigner/designercore/model/anchorline.cpp +++ b/src/plugins/qmldesigner/designercore/model/anchorline.cpp @@ -84,9 +84,8 @@ AnchorLine &AnchorLine::operator =(const AnchorLine &other) ModelNode AnchorLine::modelNode() const { - if (m_internalNode.isNull() || m_internalNodeState.isNull() || m_model.isNull()) { + if (m_internalNode.isNull() || m_internalNodeState.isNull() || m_model.isNull()) return ModelNode(); - } return ModelNode(m_internalNode, m_model.data()); } diff --git a/src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp b/src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp index 09d2fbcd48..c6baa0c713 100644 --- a/src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp +++ b/src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp @@ -62,11 +62,10 @@ void BaseTextEditModifier::indent(int offset, int length) int BaseTextEditModifier::indentDepth() const { - if (TextEditor::BaseTextEditorWidget *bte = qobject_cast<TextEditor::BaseTextEditorWidget*>(plainTextEdit())) { + if (TextEditor::BaseTextEditorWidget *bte = qobject_cast<TextEditor::BaseTextEditorWidget*>(plainTextEdit())) return bte->tabSettings().m_indentSize; - } else { + else return 0; - } } bool BaseTextEditModifier::renameId(const QString &oldId, const QString &newId) diff --git a/src/plugins/qmldesigner/designercore/model/bindingproperty.cpp b/src/plugins/qmldesigner/designercore/model/bindingproperty.cpp index 2e5801a870..d43a70ffe4 100644 --- a/src/plugins/qmldesigner/designercore/model/bindingproperty.cpp +++ b/src/plugins/qmldesigner/designercore/model/bindingproperty.cpp @@ -212,9 +212,8 @@ void BindingProperty::setDynamicTypeNameAndExpression(const QString &typeName, c if (expression.isEmpty()) throw InvalidArgumentException(__LINE__, __FUNCTION__, __FILE__, name()); - if (typeName.isEmpty()) { + if (typeName.isEmpty()) throw InvalidArgumentException(__LINE__, __FUNCTION__, __FILE__, name()); - } if (internalNode()->hasProperty(name())) { //check if oldValue != value Internal::InternalProperty::Pointer internalProperty = internalNode()->property(name()); diff --git a/src/plugins/qmldesigner/designercore/model/internalnodeproperty.cpp b/src/plugins/qmldesigner/designercore/model/internalnodeproperty.cpp index ae47c56746..a7e8df211d 100644 --- a/src/plugins/qmldesigner/designercore/model/internalnodeproperty.cpp +++ b/src/plugins/qmldesigner/designercore/model/internalnodeproperty.cpp @@ -114,9 +114,8 @@ QList<InternalNodePointer> InternalNodeProperty::allDirectSubNodes() const { QList<InternalNode::Pointer> nodeList; - if (node()) { + if (node()) nodeList.append(node()); - } return nodeList; } diff --git a/src/plugins/qmldesigner/designercore/model/model.cpp b/src/plugins/qmldesigner/designercore/model/model.cpp index e993bc4b2b..41958022ab 100644 --- a/src/plugins/qmldesigner/designercore/model/model.cpp +++ b/src/plugins/qmldesigner/designercore/model/model.cpp @@ -158,9 +158,8 @@ void ModelPrivate::notifyImportsChanged(const QList<Import> &addedImports, const QString description; try { - if (rewriterView()) { + if (rewriterView()) rewriterView()->importsChanged(addedImports, removedImports); - } } catch (RewritingException &e) { description = e.description(); resetModel = true; @@ -174,9 +173,8 @@ void ModelPrivate::notifyImportsChanged(const QList<Import> &addedImports, const foreach (const QWeakPointer<AbstractView> &view, m_viewList) view->importsChanged(addedImports, removedImports); - if (resetModel) { + if (resetModel) resetModelByRewriter(description); - } } QUrl ModelPrivate::fileUrl() const @@ -359,9 +357,8 @@ void ModelPrivate::notifyAuxiliaryDataChanged(const InternalNodePointer &interna nodeInstanceView()->auxiliaryDataChanged(node, name, data); } - if (resetModel) { + if (resetModel) resetModelByRewriter(description); - } } void ModelPrivate::notifyNodeSourceChanged(const InternalNodePointer &internalNode, const QString &newNodeSource) @@ -391,9 +388,8 @@ void ModelPrivate::notifyNodeSourceChanged(const InternalNodePointer &internalNo nodeInstanceView()->nodeSourceChanged(node, newNodeSource); } - if (resetModel) { + if (resetModel) resetModelByRewriter(description); - } } void ModelPrivate::notifyRootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion) @@ -418,9 +414,8 @@ void ModelPrivate::notifyRootNodeTypeChanged(const QString &type, int majorVersi } - if (resetModel) { + if (resetModel) resetModelByRewriter(description); - } } void ModelPrivate::notifyInstancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyPairList) @@ -461,13 +456,11 @@ void ModelPrivate::notifyInstancesCompleted(const QVector<ModelNode> &nodeVector view->instancesCompleted(toModelNodeVector(internalVector, view.data())); } - if (nodeInstanceView()) { + if (nodeInstanceView()) nodeInstanceView()->instancesCompleted(toModelNodeVector(internalVector, nodeInstanceView())); - } - if (resetModel) { + if (resetModel) resetModelByRewriter(description); - } } QMultiHash<ModelNode, InformationName> convertModelNodeInformationHash(const QMultiHash<ModelNode, InformationName> &informationChangeHash, AbstractView *view) @@ -501,13 +494,11 @@ void ModelPrivate::notifyInstancesInformationsChange(const QMultiHash<ModelNode, view->instanceInformationsChange(convertModelNodeInformationHash(informationChangeHash, view.data())); } - if (nodeInstanceView()) { + if (nodeInstanceView()) nodeInstanceView()->instanceInformationsChange(convertModelNodeInformationHash(informationChangeHash, nodeInstanceView())); - } - if (resetModel) { + if (resetModel) resetModelByRewriter(description); - } } void ModelPrivate::notifyInstancesRenderImageChanged(const QVector<ModelNode> &nodeVector) @@ -530,13 +521,11 @@ void ModelPrivate::notifyInstancesRenderImageChanged(const QVector<ModelNode> &n view->instancesRenderImageChanged(toModelNodeVector(internalVector, view.data())); } - if (nodeInstanceView()) { + if (nodeInstanceView()) nodeInstanceView()->instancesRenderImageChanged(toModelNodeVector(internalVector, nodeInstanceView())); - } - if (resetModel) { + if (resetModel) resetModelByRewriter(description); - } } void ModelPrivate::notifyInstancesPreviewImageChanged(const QVector<ModelNode> &nodeVector) @@ -559,13 +548,11 @@ void ModelPrivate::notifyInstancesPreviewImageChanged(const QVector<ModelNode> & view->instancesPreviewImageChanged(toModelNodeVector(internalVector, view.data())); } - if (nodeInstanceView()) { + if (nodeInstanceView()) nodeInstanceView()->instancesPreviewImageChanged(toModelNodeVector(internalVector, nodeInstanceView())); - } - if (resetModel) { + if (resetModel) resetModelByRewriter(description); - } } void ModelPrivate::notifyInstancesChildrenChanged(const QVector<ModelNode> &nodeVector) @@ -588,13 +575,11 @@ void ModelPrivate::notifyInstancesChildrenChanged(const QVector<ModelNode> &node view->instancesChildrenChanged(toModelNodeVector(internalVector, view.data())); } - if (nodeInstanceView()) { + if (nodeInstanceView()) nodeInstanceView()->instancesChildrenChanged(toModelNodeVector(internalVector, nodeInstanceView())); - } - if (resetModel) { + if (resetModel) resetModelByRewriter(description); - } } void ModelPrivate::notifyActualStateChanged(const ModelNode &node) @@ -617,13 +602,11 @@ void ModelPrivate::notifyActualStateChanged(const ModelNode &node) view->actualStateChanged(ModelNode(node.internalNode(), model(), view.data())); } - if (nodeInstanceView()) { + if (nodeInstanceView()) nodeInstanceView()->actualStateChanged(ModelNode(node.internalNode(), model(), nodeInstanceView())); - } - if (resetModel) { + if (resetModel) resetModelByRewriter(description); - } } void ModelPrivate::notifyRewriterBeginTransaction() @@ -644,13 +627,11 @@ void ModelPrivate::notifyRewriterBeginTransaction() view->rewriterBeginTransaction(); } - if (nodeInstanceView()) { + if (nodeInstanceView()) nodeInstanceView()->rewriterBeginTransaction(); - } - if (resetModel) { + if (resetModel) resetModelByRewriter(description); - } } void ModelPrivate::notifyRewriterEndTransaction() @@ -671,13 +652,11 @@ void ModelPrivate::notifyRewriterEndTransaction() view->rewriterEndTransaction(); } - if (nodeInstanceView()) { + if (nodeInstanceView()) nodeInstanceView()->rewriterEndTransaction(); - } - if (resetModel) { + if (resetModel) resetModelByRewriter(description); - } } void ModelPrivate::notifyInstanceToken(const QString &token, int number, const QVector<ModelNode> &nodeVector) @@ -701,13 +680,11 @@ void ModelPrivate::notifyInstanceToken(const QString &token, int number, const Q view->instancesToken(token, number, toModelNodeVector(internalVector, view.data())); } - if (nodeInstanceView()) { + if (nodeInstanceView()) nodeInstanceView()->instancesToken(token, number, toModelNodeVector(internalVector, nodeInstanceView())); - } - if (resetModel) { + if (resetModel) resetModelByRewriter(description); - } } void ModelPrivate::notifyCustomNotification(const AbstractView *senderView, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data) @@ -730,13 +707,11 @@ void ModelPrivate::notifyCustomNotification(const AbstractView *senderView, cons view->customNotification(senderView, identifier, toModelNodeList(internalList, view.data()), data); } - if (nodeInstanceView()) { + if (nodeInstanceView()) nodeInstanceView()->customNotification(senderView, identifier, toModelNodeList(internalList, nodeInstanceView()), data); - } - if (resetModel) { + if (resetModel) resetModelByRewriter(description); - } } @@ -781,9 +756,8 @@ void ModelPrivate::notifyPropertiesRemoved(const QList<PropertyPair> &propertyPa view->propertiesRemoved(propertyList); } - if (resetModel) { + if (resetModel) resetModelByRewriter(description); - } } void ModelPrivate::notifyPropertiesAboutToBeRemoved(const QList<InternalProperty::Pointer> &internalPropertyList) @@ -833,9 +807,8 @@ void ModelPrivate::notifyPropertiesAboutToBeRemoved(const QList<InternalProperty nodeInstanceView()->propertiesAboutToBeRemoved(propertyList); } - if (resetModel) { + if (resetModel) resetModelByRewriter(description); - } } void ModelPrivate::setAuxiliaryData(const InternalNode::Pointer& node, const QString &name, const QVariant &data) @@ -846,9 +819,8 @@ void ModelPrivate::setAuxiliaryData(const InternalNode::Pointer& node, const QSt void ModelPrivate::resetModelByRewriter(const QString &description) { - if (rewriterView()) { + if (rewriterView()) rewriterView()->resetToLastCorrectQml(); - } throw RewritingException(__LINE__, __FUNCTION__, __FILE__, description, rewriterView()->textModifierContent()); } @@ -899,9 +871,8 @@ void ModelPrivate::notifyNodeCreated(const InternalNode::Pointer &newInternalNod view->nodeCreated(createdNode); } - if (resetModel) { + if (resetModel) resetModelByRewriter(description); - } } void ModelPrivate::notifyNodeAboutToBeRemoved(const InternalNode::Pointer &nodePointer) @@ -930,9 +901,8 @@ void ModelPrivate::notifyNodeAboutToBeRemoved(const InternalNode::Pointer &nodeP nodeInstanceView()->nodeAboutToBeRemoved(node); } - if (resetModel) { + if (resetModel) resetModelByRewriter(description); - } } void ModelPrivate::notifyNodeRemoved(const InternalNodePointer &nodePointer, const InternalNodePointer &parentNodePointer, const QString &parentPropertyName, AbstractView::PropertyChangeFlags propertyChange) @@ -965,9 +935,8 @@ void ModelPrivate::notifyNodeRemoved(const InternalNodePointer &nodePointer, con } - if (resetModel) { + if (resetModel) resetModelByRewriter(description); - } } void ModelPrivate::notifyNodeIdChanged(const InternalNode::Pointer& nodePointer, const QString& newId, const QString& oldId) @@ -996,9 +965,8 @@ void ModelPrivate::notifyNodeIdChanged(const InternalNode::Pointer& nodePointer, nodeInstanceView()->nodeIdChanged(node, newId, oldId); } - if (resetModel) { + if (resetModel) resetModelByRewriter(description); - } } void ModelPrivate::notifyBindingPropertiesChanged(const QList<InternalBindingPropertyPointer> &internalBropertyList, AbstractView::PropertyChangeFlags propertyChange) @@ -1037,9 +1005,8 @@ void ModelPrivate::notifyBindingPropertiesChanged(const QList<InternalBindingPro nodeInstanceView()->bindingPropertiesChanged(propertyList, propertyChange); } - if (resetModel) { + if (resetModel) resetModelByRewriter(description); - } } void ModelPrivate::notifyScriptFunctionsChanged(const InternalNodePointer &internalNodePointer, const QStringList &scriptFunctionList) @@ -1070,9 +1037,8 @@ void ModelPrivate::notifyScriptFunctionsChanged(const InternalNodePointer &inter } - if (resetModel) { + if (resetModel) resetModelByRewriter(description); - } } @@ -1127,9 +1093,8 @@ void ModelPrivate::notifyVariantPropertiesChanged(const InternalNodePointer &int nodeInstanceView()->variantPropertiesChanged(propertyList, propertyChange); } - if (resetModel) { + if (resetModel) resetModelByRewriter(description); - } } void ModelPrivate::notifyNodeAboutToBeReparent(const InternalNodePointer &internalNodePointer, const InternalNodeAbstractPropertyPointer &newPropertyParent, const InternalNodePointer &oldParent, const QString &oldPropertyName, AbstractView::PropertyChangeFlags propertyChange) @@ -1184,9 +1149,8 @@ void ModelPrivate::notifyNodeAboutToBeReparent(const InternalNodePointer &intern nodeInstanceView()->nodeAboutToBeReparented(node, newProperty, oldProperty, propertyChange); } - if (resetModel) { + if (resetModel) resetModelByRewriter(description); - } } @@ -1242,9 +1206,8 @@ void ModelPrivate::notifyNodeReparent(const InternalNode::Pointer &internalNodeP nodeInstanceView()->nodeReparented(node, newProperty, oldProperty, propertyChange); } - if (resetModel) { + if (resetModel) resetModelByRewriter(description); - } } void ModelPrivate::notifyNodeOrderChanged(const InternalNodeListPropertyPointer &internalListPropertyPointer, @@ -1276,9 +1239,8 @@ void ModelPrivate::notifyNodeOrderChanged(const InternalNodeListPropertyPointer ModelNode(internalNodePointer, model(), nodeInstanceView()), oldIndex); - if (resetModel) { + if (resetModel) resetModelByRewriter(description); - } } void ModelPrivate::setSelectedNodes(const QList<InternalNode::Pointer> &selectedNodeList) diff --git a/src/plugins/qmldesigner/designercore/model/modelmerger.cpp b/src/plugins/qmldesigner/designercore/model/modelmerger.cpp index 3bb9546ff3..d723a8ee67 100644 --- a/src/plugins/qmldesigner/designercore/model/modelmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/modelmerger.cpp @@ -77,9 +77,8 @@ static void syncBindingProperties(ModelNode &outputNode, const ModelNode &inputN static void syncId(ModelNode &outputNode, const ModelNode &inputNode, const QHash<QString, QString> &idRenamingHash) { - if (!inputNode.id().isEmpty()) { + if (!inputNode.id().isEmpty()) outputNode.setId(idRenamingHash.value(inputNode.id())); - } } static void splitIdInBaseNameAndNumber(const QString &id, QString *baseId, int *number) @@ -164,9 +163,8 @@ ModelNode ModelMerger::insertModel(const ModelNode &modelNode) QList<Import> newImports; foreach (const Import &import, modelNode.model()->imports()) { - if (!view()->model()->hasImport(import, true, true)) { + if (!view()->model()->hasImport(import, true, true)) newImports.append(import); - } } view()->model()->changeImports(newImports, QList<Import>()); diff --git a/src/plugins/qmldesigner/designercore/model/modelnode.cpp b/src/plugins/qmldesigner/designercore/model/modelnode.cpp index beebf98baf..833d558a1f 100644 --- a/src/plugins/qmldesigner/designercore/model/modelnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/modelnode.cpp @@ -147,9 +147,8 @@ QString ModelNode::generateNewId() const */ QString ModelNode::id() const { - if (!isValid()) { + if (!isValid()) throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__); - } return m_internalNode->id(); } @@ -353,9 +352,8 @@ void ModelNode::setParentProperty(NodeAbstractProperty parent) throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__); } - if (!parent.parentModelNode().isValid()) { + if (!parent.parentModelNode().isValid()) throw InvalidArgumentException(__LINE__, __FUNCTION__, __FILE__, "newParentNode"); - } if (*this == parent.parentModelNode()) { Q_ASSERT_X(*this != parent.parentModelNode(), Q_FUNC_INFO, "cannot set parent to itself"); @@ -631,9 +629,8 @@ void ModelNode::destroy() throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__); } - if (isRootNode()) { + if (isRootNode()) throw InvalidArgumentException(__LINE__, __FUNCTION__, __FILE__, "rootNode"); - } removeModelNodeFromSelection(*this); model()->d->removeNode(internalNode()); @@ -881,9 +878,8 @@ QTextStream& operator<<(QTextStream &stream, const ModelNode &modelNode) void ModelNode::selectNode() { - if (!isValid()) { + if (!isValid()) throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__); - } QList<ModelNode> selectedNodeList; selectedNodeList.append(*this); @@ -893,9 +889,8 @@ void ModelNode::selectNode() void ModelNode::deselectNode() { - if (!isValid()) { + if (!isValid()) throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__); - } QList<ModelNode> selectedNodeList(view()->selectedModelNodes()); selectedNodeList.removeAll(*this); @@ -915,9 +910,8 @@ QVariant ModelNode::toVariant() const QVariant ModelNode::auxiliaryData(const QString &name) const { - if (!isValid()) { + if (!isValid()) throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__); - } return internalNode()->auxiliaryData(name); } @@ -930,18 +924,16 @@ void ModelNode::setAuxiliaryData(const QString &name, const QVariant &data) cons bool ModelNode::hasAuxiliaryData(const QString &name) const { - if (!isValid()) { + if (!isValid()) throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__); - } return internalNode()->hasAuxiliaryData(name); } QHash<QString, QVariant> ModelNode::auxiliaryData() const { - if (!isValid()) { + if (!isValid()) throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__); - } return internalNode()->auxiliaryData(); } @@ -981,18 +973,16 @@ void ModelNode::setNodeSource(const QString &newNodeSource) QString ModelNode::nodeSource() const { - if (!isValid()) { + if (!isValid()) throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__); - } return internalNode()->nodeSource(); } QString ModelNode::convertTypeToImportAlias() const { - if (!isValid()) { + if (!isValid()) throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__); - } if (model()->rewriterView()) return model()->rewriterView()->convertTypeToImportAlias(type()); @@ -1002,9 +992,8 @@ QString ModelNode::convertTypeToImportAlias() const ModelNode::NodeSourceType ModelNode::nodeSourceType() const { - if (!isValid()) { + if (!isValid()) throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__); - } return static_cast<ModelNode::NodeSourceType>(internalNode()->nodeSourceType()); diff --git a/src/plugins/qmldesigner/designercore/model/modelrewriter.cpp b/src/plugins/qmldesigner/designercore/model/modelrewriter.cpp index a9c8104d35..f02903e7fe 100644 --- a/src/plugins/qmldesigner/designercore/model/modelrewriter.cpp +++ b/src/plugins/qmldesigner/designercore/model/modelrewriter.cpp @@ -387,21 +387,17 @@ ModificationGroupToken ModelRewriter::beginModificationGroup() void ModelRewriter::endModificationGroup(const ModificationGroupToken& token) { - if (m_activeModificationGroups.isEmpty()) { + if (m_activeModificationGroups.isEmpty()) throw ModificationGroupException(__LINE__, Q_FUNC_INFO, __FILE__); - } - if (m_activeModificationGroups.last() != token) { + if (m_activeModificationGroups.last() != token) throw ModificationGroupException(__LINE__, Q_FUNC_INFO, __FILE__); - } - if (!m_activeModificationGroups.removeAll(token)) { + if (!m_activeModificationGroups.removeAll(token)) throw ModificationGroupException(__LINE__, Q_FUNC_INFO, __FILE__); - } - if (!modificationGroupActive()) { + if (!modificationGroupActive()) m_modelToTextMerger.applyChanges(*m_textModifier); - } } bool ModelRewriter::lastRewriteFailed() const @@ -438,9 +434,8 @@ bool ModelRewriter::paste(QMimeData *transferData, const InternalNode::Pointer & Paster paster(transferData, intoNode); if (paster.doPaste(m_modelToTextMerger)) { - if (!modificationGroupActive()) { + if (!modificationGroupActive()) m_modelToTextMerger.applyChanges(*m_textModifier); - } return true; } else { m_modelToTextMerger.clear(); diff --git a/src/plugins/qmldesigner/designercore/model/modeltotextmerger.cpp b/src/plugins/qmldesigner/designercore/model/modeltotextmerger.cpp index be2c5626d3..7c58bd1c01 100644 --- a/src/plugins/qmldesigner/designercore/model/modeltotextmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/modeltotextmerger.cpp @@ -66,13 +66,12 @@ void ModelToTextMerger::nodeRemoved(const ModelNode &removedNode, const NodeAbst if (!isInHierarchy(parentProperty)) return; - if (parentProperty.isDefaultProperty()) { + if (parentProperty.isDefaultProperty()) schedule(new RemoveNodeRewriteAction(removedNode)); - } else if (AbstractView::EmptyPropertiesRemoved == propertyChange) { + else if (AbstractView::EmptyPropertiesRemoved == propertyChange) schedule(new RemovePropertyRewriteAction(parentProperty)); - } else if (parentProperty.isNodeListProperty()) { + else if (parentProperty.isNodeListProperty()) schedule(new RemoveNodeRewriteAction(removedNode)); - } } void ModelToTextMerger::propertiesRemoved(const QList<AbstractProperty>& propertyList) @@ -157,11 +156,10 @@ void ModelToTextMerger::nodeReparented(const ModelNode &node, const NodeAbstract if (oldPropertyParent.isNodeProperty()) { // ignore, the subsequent remove property will take care of all } else if (oldPropertyParent.isNodeListProperty()) { - if (!oldPropertyParent.isDefaultProperty() && oldPropertyParent.toNodeListProperty().toModelNodeList().size() == 0) { + if (!oldPropertyParent.isDefaultProperty() && oldPropertyParent.toNodeListProperty().toModelNodeList().size() == 0) schedule(new RemovePropertyRewriteAction(oldPropertyParent)); - } else { + else schedule(new RemoveNodeRewriteAction(node)); - } } else { schedule(new RemoveNodeRewriteAction(node)); } @@ -253,9 +251,8 @@ void ModelToTextMerger::applyChanges() for (int i = 0; i < m_rewriteActions.size(); ++i) { RewriteAction* action = m_rewriteActions.at(i); - if (DebugRewriteActions) { + if (DebugRewriteActions) qDebug() << "Next rewrite action:" << qPrintable(action->info()); - } ModelNodePositionStorage *positionStore = m_rewriterView->positionStorage(); bool success = action->execute(refactoring, *positionStore); diff --git a/src/plugins/qmldesigner/designercore/model/nodelistproperty.cpp b/src/plugins/qmldesigner/designercore/model/nodelistproperty.cpp index 6ff5d6f502..604a421b30 100644 --- a/src/plugins/qmldesigner/designercore/model/nodelistproperty.cpp +++ b/src/plugins/qmldesigner/designercore/model/nodelistproperty.cpp @@ -76,9 +76,8 @@ const QList<ModelNode> NodeListProperty::toModelNodeList() const if (internalNode()->hasProperty(name())) { Internal::InternalProperty::Pointer internalProperty = internalNode()->property(name()); - if (internalProperty->isNodeListProperty()) { + if (internalProperty->isNodeListProperty()) return internalNodesToModelNodes(internalProperty->toNodeListProperty()->nodeList(), model(), view()); - } } return QList<ModelNode>(); diff --git a/src/plugins/qmldesigner/designercore/model/paster.cpp b/src/plugins/qmldesigner/designercore/model/paster.cpp index 4ac580e8ab..d7df3cce70 100644 --- a/src/plugins/qmldesigner/designercore/model/paster.cpp +++ b/src/plugins/qmldesigner/designercore/model/paster.cpp @@ -69,9 +69,8 @@ public: Node::accept(sourceAST->imports, this); - if (sourceAST->members && sourceAST->members->member) { + if (sourceAST->members && sourceAST->members->member) visitRootMember(sourceAST->members->member); - } return m_locations.isEmpty(); } @@ -136,18 +135,16 @@ protected: switchStateName(prevStateName); return false; } else if (ast->qualifiedTypeNameId && ast->qualifiedTypeNameId->name && ast->qualifiedTypeNameId->name->asString() == "PropertyChanges") { - if (m_locations.remove(toLocation(start, end))) { + if (m_locations.remove(toLocation(start, end))) m_paster->addNodeState(m_stateName, textAt(start, end)); - } return false; } else { return true; } } else { - if (m_locations.remove(toLocation(start, end))) { + if (m_locations.remove(toLocation(start, end))) m_paster->addNode(textAt(start, end)); - } return false; } @@ -171,9 +168,8 @@ protected: bool visit(UiScriptBinding *ast) { if (m_inStates && ast->qualifiedId && ast->qualifiedId->name && ast->qualifiedId->name->asString() == "name") { if (ExpressionStatement *stmt = AST::cast<ExpressionStatement *>(ast->statement)) { - if (StringLiteral * str = AST::cast<StringLiteral *>(stmt->expression)) { + if (StringLiteral * str = AST::cast<StringLiteral *>(stmt->expression)) m_stateName = str->value->asString(); - } } } diff --git a/src/plugins/qmldesigner/designercore/model/plaintexteditmodifier.cpp b/src/plugins/qmldesigner/designercore/model/plaintexteditmodifier.cpp index 6a08fec99e..53e1d91f67 100644 --- a/src/plugins/qmldesigner/designercore/model/plaintexteditmodifier.cpp +++ b/src/plugins/qmldesigner/designercore/model/plaintexteditmodifier.cpp @@ -154,11 +154,10 @@ void PlainTextEditModifier::commitGroup() void PlainTextEditModifier::textEditChanged() { - if (!m_ongoingTextChange && m_changeSignalsEnabled) { + if (!m_ongoingTextChange && m_changeSignalsEnabled) emit textChanged(); - } else { + else m_pendingChangeSignal = true; - } } void PlainTextEditModifier::runRewriting(ChangeSet *changeSet) diff --git a/src/plugins/qmldesigner/designercore/model/qmlanchors.cpp b/src/plugins/qmldesigner/designercore/model/qmlanchors.cpp index 4409d087d3..1b4f21fc3b 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlanchors.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlanchors.cpp @@ -69,25 +69,24 @@ bool AnchorLine::isVerticalAnchorLine(Type anchorline) static AnchorLine::Type propertyNameToLineType(const QString & string) { - if (string == QLatin1String("left")) { + if (string == QLatin1String("left")) return AnchorLine::Left; - } else if (string == QLatin1String("top")) { + else if (string == QLatin1String("top")) return AnchorLine::Top; - } else if (string == QLatin1String("right")) { + else if (string == QLatin1String("right")) return AnchorLine::Right; - } else if (string == QLatin1String("bottom")) { + else if (string == QLatin1String("bottom")) return AnchorLine::Bottom; - } else if (string == QLatin1String("horizontalCenter")) { + else if (string == QLatin1String("horizontalCenter")) return AnchorLine::HorizontalCenter; - } else if (string == QLatin1String("verticalCenter")) { + else if (string == QLatin1String("verticalCenter")) return AnchorLine::VerticalCenter; - } else if (string == QLatin1String("baseline")) { + else if (string == QLatin1String("baseline")) return AnchorLine::VerticalCenter; - } else if (string == QLatin1String("centerIn")) { + else if (string == QLatin1String("centerIn")) return AnchorLine::Center; - } else if (string == QLatin1String("fill")) { + else if (string == QLatin1String("fill")) return AnchorLine::Fill; - } return AnchorLine::Invalid; } diff --git a/src/plugins/qmldesigner/designercore/model/qmlchangeset.cpp b/src/plugins/qmldesigner/designercore/model/qmlchangeset.cpp index dd69cc85a4..dbe0c57958 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlchangeset.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlchangeset.cpp @@ -37,11 +37,10 @@ namespace QmlDesigner { ModelNode QmlModelStateOperation::target() const { - if (modelNode().property("target").isBindingProperty()) { + if (modelNode().property("target").isBindingProperty()) return modelNode().bindingProperty("target").resolveToModelNode(); - } else { + else return ModelNode(); //exception? - } } void QmlModelStateOperation::setTarget(const ModelNode &target) diff --git a/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp b/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp index 676bc1c162..16a5ca6dfd 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp @@ -124,9 +124,8 @@ QmlItemNode QmlModelView::createQmlItemNodeFromImage(const QString &imageName, c } } - if (!model()->imports().contains(newImport)) { + if (!model()->imports().contains(newImport)) model()->changeImports(QList<Import>() << newImport, QList<Import>()); - } QList<QPair<QString, QVariant> > propertyPairList; propertyPairList.append(qMakePair(QString("x"), QVariant( round(position.x(), 4)))); @@ -204,9 +203,8 @@ QmlItemNode QmlModelView::createQmlItemNode(const ItemLibraryEntry &itemLibraryE } } - if (!model()->hasImport(newImport, true, true)) { + if (!model()->hasImport(newImport, true, true)) model()->changeImports(QList<Import>() << newImport, QList<Import>()); - } } } @@ -245,9 +243,8 @@ QmlItemNode QmlModelView::createQmlItemNode(const ItemLibraryEntry &itemLibraryE } } - if (parentNode.hasDefaultProperty()) { + if (parentNode.hasDefaultProperty()) parentNode.nodeAbstractProperty(parentNode.defaultProperty()).reparentHere(newNode); - } if (!newNode.isValid()) return newNode; @@ -478,11 +475,10 @@ ModelNode QmlModelView::createQmlState(const QmlDesigner::PropertyListType &prop QTC_CHECK(rootModelNode().majorQtQuickVersion() < 3); - if (rootModelNode().majorQtQuickVersion() > 1) { + if (rootModelNode().majorQtQuickVersion() > 1) return createModelNode("QtQuick.State", 2, 0, propertyList); - } else { + else return createModelNode("QtQuick.State", 1, 0, propertyList); - } } diff --git a/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp index 2c09b2a3ae..3d8ca413f3 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp @@ -464,9 +464,8 @@ QString QmlObjectNode::defaultProperty() const void QmlObjectNode::setParent(QmlObjectNode newParent) { - if (newParent.hasDefaultProperty()) { + if (newParent.hasDefaultProperty()) newParent.modelNode().nodeAbstractProperty(newParent.defaultProperty()).reparentHere(modelNode()); - } } QmlItemNode QmlObjectNode::toQmlItemNode() const diff --git a/src/plugins/qmldesigner/designercore/model/qmlstate.cpp b/src/plugins/qmldesigner/designercore/model/qmlstate.cpp index 946e1f8a0e..b6d3cfe272 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlstate.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlstate.cpp @@ -173,16 +173,14 @@ void QmlModelState::addChangeSetIfNotExists(const ModelNode &node) if (!isValid()) throw new InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__); - if (hasPropertyChanges(node)) { + if (hasPropertyChanges(node)) return; //changeSet already there - } ModelNode newChangeSet; - if (qmlModelView()->rootModelNode().majorQtQuickVersion() > 1) { + if (qmlModelView()->rootModelNode().majorQtQuickVersion() > 1) newChangeSet = modelNode().view()->createModelNode("QtQuick.PropertyChanges", 2, 0); - } else { + else newChangeSet = modelNode().view()->createModelNode("QtQuick.PropertyChanges", 1, 0); - } modelNode().nodeListProperty("changes").reparentHere(newChangeSet); diff --git a/src/plugins/qmldesigner/designercore/model/rewriteactioncompressor.cpp b/src/plugins/qmldesigner/designercore/model/rewriteactioncompressor.cpp index e44612bbb9..236cf9ea98 100644 --- a/src/plugins/qmldesigner/designercore/model/rewriteactioncompressor.cpp +++ b/src/plugins/qmldesigner/designercore/model/rewriteactioncompressor.cpp @@ -306,13 +306,11 @@ void RewriteActionCompressor::compressAddEditActions(QList<RewriteAction *> &act dirtyActions.insert(action); } } else if (ChangeIdRewriteAction *changeIdAction = action->asChangeIdRewriteAction()) { - if (nodeOrParentInSet(changeIdAction->node(), addedNodes)) { + if (nodeOrParentInSet(changeIdAction->node(), addedNodes)) actionsToRemove.append(action); - } } else if (ChangeTypeRewriteAction *changeTypeAction = action->asChangeTypeRewriteAction()) { - if (nodeOrParentInSet(changeTypeAction->node(), addedNodes)) { + if (nodeOrParentInSet(changeTypeAction->node(), addedNodes)) actionsToRemove.append(action); - } } } @@ -337,9 +335,8 @@ void RewriteActionCompressor::compressAddEditActions(QList<RewriteAction *> &act } const int idx = actions.indexOf(action); - if (newAction && idx >= 0) { + if (newAction && idx >= 0) actions[idx] = newAction; - } } } @@ -355,11 +352,10 @@ void RewriteActionCompressor::compressAddReparentActions(QList<RewriteAction *> if (action->asAddPropertyRewriteAction() || action->asChangePropertyRewriteAction()) { ModelNode containedNode; - if (AddPropertyRewriteAction *addAction = action->asAddPropertyRewriteAction()) { + if (AddPropertyRewriteAction *addAction = action->asAddPropertyRewriteAction()) containedNode = addAction->containedModelNode(); - } else if (ChangePropertyRewriteAction *changeAction = action->asChangePropertyRewriteAction()) { + else if (ChangePropertyRewriteAction *changeAction = action->asChangePropertyRewriteAction()) containedNode = changeAction->containedModelNode(); - } if (!containedNode.isValid()) continue; diff --git a/src/plugins/qmldesigner/designercore/model/rewriterview.cpp b/src/plugins/qmldesigner/designercore/model/rewriterview.cpp index f0ca3edec0..e726d1074f 100644 --- a/src/plugins/qmldesigner/designercore/model/rewriterview.cpp +++ b/src/plugins/qmldesigner/designercore/model/rewriterview.cpp @@ -155,9 +155,8 @@ void RewriterView::modelAttached(Model *model) ModelAmender differenceHandler(m_textToModelMerger.data()); const QString qmlSource = m_textModifier->text(); - if (m_textToModelMerger->load(qmlSource, differenceHandler)) { + if (m_textToModelMerger->load(qmlSource, differenceHandler)) lastCorrectQmlSource = qmlSource; - } } void RewriterView::modelAboutToBeDetached(Model * /*model*/) @@ -497,9 +496,8 @@ void RewriterView::applyChanges() try { modelToTextMerger()->applyChanges(); - if (!errors().isEmpty()) { + if (!errors().isEmpty()) enterErrorState(errors().first().description()); - } } catch (Exception &e) { const QString content = textModifierContent(); qDebug() << "RewriterException:" << m_rewritingErrorMessage; @@ -690,9 +688,8 @@ QString RewriterView::pathForImport(const Import &import) QmlJS::ImportInfo importInfo; foreach (QmlJS::Import qmljsImport, imports->all()) { - if (qmljsImport.info.name() == importStr) { + if (qmljsImport.info.name() == importStr) importInfo = qmljsImport.info; - } } const QString importPath = importInfo.path(); return importPath; @@ -719,9 +716,8 @@ void RewriterView::qmlTextChanged() switch (m_differenceHandling) { case Validate: { ModelValidator differenceHandler(m_textToModelMerger.data()); - if (m_textToModelMerger->load(newQmlText.toUtf8(), differenceHandler)) { + if (m_textToModelMerger->load(newQmlText.toUtf8(), differenceHandler)) lastCorrectQmlSource = newQmlText; - } break; } @@ -729,9 +725,8 @@ void RewriterView::qmlTextChanged() default: { emitCustomNotification(StartRewriterAmend); ModelAmender differenceHandler(m_textToModelMerger.data()); - if (m_textToModelMerger->load(newQmlText, differenceHandler)) { + if (m_textToModelMerger->load(newQmlText, differenceHandler)) lastCorrectQmlSource = newQmlText; - } emitCustomNotification(EndRewriterAmend); break; } diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp index be6d9aa196..8810264750 100644 --- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp @@ -264,9 +264,8 @@ static bool isPropertyChangesType(const QString &type) static bool propertyIsComponentType(const QmlDesigner::NodeAbstractProperty &property, const QString &type, QmlDesigner::Model *model) { - if (model->metaInfo(type, -1, -1).isSubclassOf(QLatin1String("QtQuick.Component"), -1, -1) && !isComponentType(type)) { + if (model->metaInfo(type, -1, -1).isSubclassOf(QLatin1String("QtQuick.Component"), -1, -1) && !isComponentType(type)) return false; //If the type is already a subclass of Component keep it - } return property.parentModelNode().isValid() && isComponentType(property.parentModelNode().metaInfo().propertyTypeName(property.name())); @@ -281,16 +280,14 @@ static inline QString extractComponentFromQml(const QString &source) if (source.contains("Component")) { //explicit component QmlDesigner::FirstDefinitionFinder firstDefinitionFinder(source); int offset = firstDefinitionFinder(0); - if (offset < 0) { + if (offset < 0) return QString(); //No object definition found - } QmlDesigner::ObjectLengthCalculator objectLengthCalculator; unsigned length; - if (objectLengthCalculator(source, offset, length)) { + if (objectLengthCalculator(source, offset, length)) result = source.mid(offset, length); - } else { + else result = source; - } } else { result = source; //implicit component } @@ -527,11 +524,10 @@ public: } } - if (property->asColorValue()) { + if (property->asColorValue()) return PropertyParser::read(QVariant::Color, cleanedValue); - } else if (property->asUrlValue()) { + else if (property->asUrlValue()) return PropertyParser::read(QVariant::Url, cleanedValue); - } QVariant value(cleanedValue); if (property->asBooleanValue()) { @@ -557,9 +553,8 @@ public: const ObjectValue *containingObject = 0; QString name; - if (!lookupProperty(propertyPrefix, propertyId, 0, &containingObject, &name)) { + if (!lookupProperty(propertyPrefix, propertyId, 0, &containingObject, &name)) return QVariant(); - } if (containingObject) containingObject->lookupMember(name, m_context, &containingObject); @@ -631,16 +626,14 @@ static inline bool smartVeryFuzzyCompare(QVariant value1, QVariant value2) if (!ok1 || !ok2) return false; - if (qFuzzyCompare(a, b)) { + if (qFuzzyCompare(a, b)) return true; - } int ai = qRound(a * 1000); int bi = qRound(b * 1000); - if (qFuzzyCompare((qreal(ai) / 1000), (qreal(bi) / 1000))) { + if (qFuzzyCompare((qreal(ai) / 1000), (qreal(bi) / 1000))) return true; - } } return false; } @@ -951,11 +944,10 @@ void TextToModelMerger::syncNode(ModelNode &modelNode, QString name; if (context->lookupProperty(QString(), binding->qualifiedId, &propertyType, &containingObject, &name) || isPropertyChangesType(typeName)) { AbstractProperty modelProperty = modelNode.property(astPropertyName); - if (context->isArrayProperty(propertyType, containingObject, name)) { + if (context->isArrayProperty(propertyType, containingObject, name)) syncArrayProperty(modelProperty, QList<QmlJS::AST::UiObjectMember*>() << member, context, differenceHandler); - } else { + else syncNodeProperty(modelProperty, binding, context, differenceHandler); - } modelPropertyNames.remove(astPropertyName); } else { qWarning() << "Skipping invalid node property" << astPropertyName @@ -1428,11 +1420,10 @@ void ModelAmender::bindingExpressionsDiffer(BindingProperty &modelProperty, const QString &javascript, const QString &astType) { - if (astType.isEmpty()) { + if (astType.isEmpty()) modelProperty.setExpression(javascript); - } else { + else modelProperty.setDynamicTypeNameAndExpression(astType, javascript); - } } void ModelAmender::shouldBeBindingProperty(AbstractProperty &modelProperty, @@ -1441,11 +1432,10 @@ void ModelAmender::shouldBeBindingProperty(AbstractProperty &modelProperty, { ModelNode theNode = modelProperty.parentModelNode(); BindingProperty newModelProperty = theNode.bindingProperty(modelProperty.name()); - if (astType.isEmpty()) { + if (astType.isEmpty()) newModelProperty.setExpression(javascript); - } else { + else newModelProperty.setDynamicTypeNameAndExpression(astType, javascript); - } } void ModelAmender::shouldBeNodeListProperty(AbstractProperty &modelProperty, @@ -1633,9 +1623,8 @@ void TextToModelMerger::setupComponent(const ModelNode &node) QString result = extractComponentFromQml(componentText); - if (result.isEmpty()) { + if (result.isEmpty()) return; //No object definition found - } if (node.nodeSource() != result) ModelNode(node).setNodeSource(result); diff --git a/src/plugins/qmldesigner/designercore/model/variantproperty.cpp b/src/plugins/qmldesigner/designercore/model/variantproperty.cpp index 9e26a094d9..21415fcb2e 100644 --- a/src/plugins/qmldesigner/designercore/model/variantproperty.cpp +++ b/src/plugins/qmldesigner/designercore/model/variantproperty.cpp @@ -102,9 +102,8 @@ void VariantProperty::setDynamicTypeNameAndValue(const QString &type, const QVar throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__); - if (type.isEmpty()) { + if (type.isEmpty()) throw InvalidArgumentException(__LINE__, __FUNCTION__, __FILE__, name()); - } if (internalNode()->hasProperty(name())) { //check if oldValue != value Internal::InternalProperty::Pointer internalProperty = internalNode()->property(name()); diff --git a/src/plugins/qmldesigner/designmodewidget.cpp b/src/plugins/qmldesigner/designmodewidget.cpp index 74d0c4c025..25eb26fe1f 100644 --- a/src/plugins/qmldesigner/designmodewidget.cpp +++ b/src/plugins/qmldesigner/designmodewidget.cpp @@ -344,9 +344,8 @@ void DesignModeWidget::closeEditors(QList<Core::IEditor*> editors) { foreach (Core::IEditor* editor, editors) { if (QPlainTextEdit *textEdit = qobject_cast<QPlainTextEdit*>(editor->widget())) { - if (m_currentTextEdit.data() == textEdit) { + if (m_currentTextEdit.data() == textEdit) setCurrentDocument(0); - } if (m_documentHash.contains(textEdit)) { if (debug) qDebug() << Q_FUNC_INFO << editor->document()->fileName(); @@ -546,11 +545,10 @@ void DesignModeWidget::updateErrorStatus(const QList<RewriterView::Error> &error if (debug) qDebug() << Q_FUNC_INFO << errors.count(); - if (m_isDisabled && errors.isEmpty()) { + if (m_isDisabled && errors.isEmpty()) enable(); - } else if (!errors.isEmpty()) { + else if (!errors.isEmpty()) disable(errors); - } } void DesignModeWidget::setAutoSynchronization(bool sync) @@ -578,9 +576,8 @@ void DesignModeWidget::setAutoSynchronization(bool sync) // set selection to text cursor const int cursorPos = m_currentTextEdit->textCursor().position(); ModelNode node = nodeForPosition(cursorPos); - if (rewriter && node.isValid()) { + if (rewriter && node.isValid()) rewriter->setSelectedModelNodes(QList<ModelNode>() << node); - } enable(); } else { disable(errors); diff --git a/src/plugins/qmljseditor/jsfilewizard.cpp b/src/plugins/qmljseditor/jsfilewizard.cpp index 9a4f81a22c..68195d96cf 100644 --- a/src/plugins/qmljseditor/jsfilewizard.cpp +++ b/src/plugins/qmljseditor/jsfilewizard.cpp @@ -121,9 +121,8 @@ QString JsFileWizard::fileContents(const QString &, bool statelessLibrary) const QString contents; QTextStream str(&contents); - if (statelessLibrary) { + if (statelessLibrary) str << QLatin1String(".pragma library\n\n"); - } str << QLatin1String("function func() {\n") << QLatin1String("\n") << QLatin1String("}\n"); diff --git a/src/plugins/qmljseditor/qmljscompletionassist.cpp b/src/plugins/qmljseditor/qmljscompletionassist.cpp index cfdf401d48..26c82cf78f 100644 --- a/src/plugins/qmljseditor/qmljscompletionassist.cpp +++ b/src/plugins/qmljseditor/qmljscompletionassist.cpp @@ -138,9 +138,8 @@ public: if (const FunctionValue *func = value->asFunctionValue()) { // constructors usually also have other interesting members, // don't consider them pure functions and complete the '()' - if (!func->lookupMember(QLatin1String("prototype"), 0, 0, false)) { + if (!func->lookupMember(QLatin1String("prototype"), 0, 0, false)) data = QVariant::fromValue(CompleteFunctionCall(func->namedArgumentCount() || func->isVariadic())); - } } addCompletion(completions, name, icon, order, data); } diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index c7ee1025c7..dfdb9da7d3 100644 --- a/src/plugins/qmljseditor/qmljseditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -406,9 +406,8 @@ protected: virtual bool visit(AST::UiScriptBinding *ast) { - if (AST::Block *block = AST::cast<AST::Block *>(ast->statement)) { + if (AST::Block *block = AST::cast<AST::Block *>(ast->statement)) _ranges.append(createRange(ast, block)); - } return true; } @@ -663,13 +662,12 @@ static void appendExtraSelectionsForMessages( sel.cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, d.location.length); } - if (d.severity == StaticAnalysis::Warning || d.severity == StaticAnalysis::MaybeWarning) { + if (d.severity == StaticAnalysis::Warning || d.severity == StaticAnalysis::MaybeWarning) sel.format.setUnderlineColor(Qt::darkYellow); - } else if (d.severity == StaticAnalysis::Error || d.severity == StaticAnalysis::MaybeError) { + else if (d.severity == StaticAnalysis::Error || d.severity == StaticAnalysis::MaybeError) sel.format.setUnderlineColor(Qt::red); - } else if (d.severity == StaticAnalysis::Hint) { + else if (d.severity == StaticAnalysis::Hint) sel.format.setUnderlineColor(Qt::darkGreen); - } sel.format.setUnderlineStyle(QTextCharFormat::WaveUnderline); sel.format.setToolTip(d.message); @@ -896,9 +894,8 @@ protected: UiQualifiedId *id = qualifiedTypeNameId(member); if (id) { const QStringRef &name = id->name; - if (!name.isEmpty() && name.at(0).isUpper()) { + if (!name.isEmpty() && name.at(0).isUpper()) return true; - } } return false; @@ -1286,9 +1283,8 @@ void QmlJSTextEditorWidget::wheelEvent(QWheelEvent *event) BaseTextEditorWidget::wheelEvent(event); - if (visible) { + if (visible) m_contextPane->apply(editor(), semanticInfo().document, 0, m_semanticInfo.declaringMemberNoProperties(m_oldCursorPosition), false, true); - } } void QmlJSTextEditorWidget::resizeEvent(QResizeEvent *event) @@ -1424,9 +1420,8 @@ QModelIndex QmlJSTextEditorWidget::indexForPosition(unsigned cursorPosition, con bool QmlJSTextEditorWidget::hideContextPane() { bool b = (m_contextPane) && m_contextPane->widget()->isVisible(); - if (b) { + if (b) m_contextPane->apply(editor(), semanticInfo().document, 0, 0, false); - } return b; } diff --git a/src/plugins/qmljseditor/qmljsfindreferences.cpp b/src/plugins/qmljseditor/qmljsfindreferences.cpp index d31b1af533..e805736580 100644 --- a/src/plugins/qmljseditor/qmljsfindreferences.cpp +++ b/src/plugins/qmljseditor/qmljsfindreferences.cpp @@ -250,9 +250,8 @@ private: if (idEnv && idEnv->lookupMember(_name, _scopeChain.context())) return idEnv == _scope; const ObjectValue *root = chain->document()->bind()->rootObjectValue(); - if (root && root->lookupMember(_name, _scopeChain.context())) { + if (root && root->lookupMember(_name, _scopeChain.context())) return check(root); - } foreach (const QmlComponentChain *parent, chain->instantiatingComponents()) { if (contains(parent)) @@ -506,13 +505,12 @@ protected: virtual bool preVisit(Node *node) { - if (Statement *stmt = node->statementCast()) { + if (Statement *stmt = node->statementCast()) return containsOffset(stmt->firstSourceLocation(), stmt->lastSourceLocation()); - } else if (ExpressionNode *exp = node->expressionCast()) { + else if (ExpressionNode *exp = node->expressionCast()) return containsOffset(exp->firstSourceLocation(), exp->lastSourceLocation()); - } else if (UiObjectMember *ui = node->uiObjectMemberCast()) { + else if (UiObjectMember *ui = node->uiObjectMemberCast()) return containsOffset(ui->firstSourceLocation(), ui->lastSourceLocation()); - } return true; } diff --git a/src/plugins/qmljseditor/qmljshighlighter.cpp b/src/plugins/qmljseditor/qmljshighlighter.cpp index 836f2447c4..19281c358d 100644 --- a/src/plugins/qmljseditor/qmljshighlighter.cpp +++ b/src/plugins/qmljseditor/qmljshighlighter.cpp @@ -203,23 +203,22 @@ bool Highlighter::maybeQmlKeyword(const QStringRef &text) const return false; const QChar ch = text.at(0); - if (ch == QLatin1Char('p') && text == QLatin1String("property")) { + if (ch == QLatin1Char('p') && text == QLatin1String("property")) return true; - } else if (ch == QLatin1Char('a') && text == QLatin1String("alias")) { + else if (ch == QLatin1Char('a') && text == QLatin1String("alias")) return true; - } else if (ch == QLatin1Char('s') && text == QLatin1String("signal")) { + else if (ch == QLatin1Char('s') && text == QLatin1String("signal")) return true; - } else if (ch == QLatin1Char('p') && text == QLatin1String("property")) { + else if (ch == QLatin1Char('p') && text == QLatin1String("property")) return true; - } else if (ch == QLatin1Char('r') && text == QLatin1String("readonly")) { + else if (ch == QLatin1Char('r') && text == QLatin1String("readonly")) return true; - } else if (ch == QLatin1Char('i') && text == QLatin1String("import")) { + else if (ch == QLatin1Char('i') && text == QLatin1String("import")) return true; - } else if (ch == QLatin1Char('o') && text == QLatin1String("on")) { + else if (ch == QLatin1Char('o') && text == QLatin1String("on")) return true; - } else { + else return false; - } } bool Highlighter::maybeQmlBuiltinType(const QStringRef &text) const @@ -229,47 +228,46 @@ bool Highlighter::maybeQmlBuiltinType(const QStringRef &text) const const QChar ch = text.at(0); - if (ch == QLatin1Char('a') && text == QLatin1String("action")) { + if (ch == QLatin1Char('a') && text == QLatin1String("action")) return true; - } else if (ch == QLatin1Char('b') && text == QLatin1String("bool")) { + else if (ch == QLatin1Char('b') && text == QLatin1String("bool")) return true; - } else if (ch == QLatin1Char('c') && text == QLatin1String("color")) { + else if (ch == QLatin1Char('c') && text == QLatin1String("color")) return true; - } else if (ch == QLatin1Char('d') && text == QLatin1String("date")) { + else if (ch == QLatin1Char('d') && text == QLatin1String("date")) return true; - } else if (ch == QLatin1Char('d') && text == QLatin1String("double")) { + else if (ch == QLatin1Char('d') && text == QLatin1String("double")) return true; - } else if (ch == QLatin1Char('e') && text == QLatin1String("enumeration")) { + else if (ch == QLatin1Char('e') && text == QLatin1String("enumeration")) return true; - } else if (ch == QLatin1Char('f') && text == QLatin1String("font")) { + else if (ch == QLatin1Char('f') && text == QLatin1String("font")) return true; - } else if (ch == QLatin1Char('i') && text == QLatin1String("int")) { + else if (ch == QLatin1Char('i') && text == QLatin1String("int")) return true; - } else if (ch == QLatin1Char('l') && text == QLatin1String("list")) { + else if (ch == QLatin1Char('l') && text == QLatin1String("list")) return true; - } else if (ch == QLatin1Char('p') && text == QLatin1String("point")) { + else if (ch == QLatin1Char('p') && text == QLatin1String("point")) return true; - } else if (ch == QLatin1Char('r') && text == QLatin1String("real")) { + else if (ch == QLatin1Char('r') && text == QLatin1String("real")) return true; - } else if (ch == QLatin1Char('r') && text == QLatin1String("rect")) { + else if (ch == QLatin1Char('r') && text == QLatin1String("rect")) return true; - } else if (ch == QLatin1Char('s') && text == QLatin1String("size")) { + else if (ch == QLatin1Char('s') && text == QLatin1String("size")) return true; - } else if (ch == QLatin1Char('s') && text == QLatin1String("string")) { + else if (ch == QLatin1Char('s') && text == QLatin1String("string")) return true; - } else if (ch == QLatin1Char('t') && text == QLatin1String("time")) { + else if (ch == QLatin1Char('t') && text == QLatin1String("time")) return true; - } else if (ch == QLatin1Char('u') && text == QLatin1String("url")) { + else if (ch == QLatin1Char('u') && text == QLatin1String("url")) return true; - } else if (ch == QLatin1Char('v') && text == QLatin1String("variant")) { + else if (ch == QLatin1Char('v') && text == QLatin1String("variant")) return true; - } else if (ch == QLatin1Char('v') && text == QLatin1String("var")) { + else if (ch == QLatin1Char('v') && text == QLatin1String("var")) return true; - } else if (ch == QLatin1Char('v') && text == QLatin1String("vector3d")) { + else if (ch == QLatin1Char('v') && text == QLatin1String("vector3d")) return true; - } else { + else return false; - } } int Highlighter::onBlockStart() diff --git a/src/plugins/qmljseditor/qmljsoutline.cpp b/src/plugins/qmljseditor/qmljsoutline.cpp index 8b2eb096f5..5a0694cb2f 100644 --- a/src/plugins/qmljseditor/qmljsoutline.cpp +++ b/src/plugins/qmljseditor/qmljsoutline.cpp @@ -64,9 +64,8 @@ bool QmlJSOutlineFilterModel::filterAcceptsRow(int sourceRow, if (m_filterBindings) { QModelIndex sourceIndex = sourceModel()->index(sourceRow, 0, sourceParent); QVariant itemType = sourceIndex.data(QmlOutlineModel::ItemTypeRole); - if (itemType == QmlOutlineModel::NonElementBindingType) { + if (itemType == QmlOutlineModel::NonElementBindingType) return false; - } } return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent); } diff --git a/src/plugins/qmljseditor/qmljssemantichighlighter.cpp b/src/plugins/qmljseditor/qmljssemantichighlighter.cpp index 044968d84d..15d6cfecee 100644 --- a/src/plugins/qmljseditor/qmljssemantichighlighter.cpp +++ b/src/plugins/qmljseditor/qmljssemantichighlighter.cpp @@ -270,11 +270,10 @@ protected: bool visit(UiObjectDefinition *ast) { - if (m_scopeChain.document()->bind()->isGroupedPropertyBinding(ast)) { + if (m_scopeChain.document()->bind()->isGroupedPropertyBinding(ast)) processBindingName(ast->qualifiedTypeNameId); - } else { + else processTypeId(ast->qualifiedTypeNameId); - } scopedAccept(ast, ast->initializer); return false; } @@ -342,9 +341,8 @@ protected: return false; const QString &value = ast->value.toString(); - if (m_stateNames.contains(value)) { + if (m_stateNames.contains(value)) addUse(ast->literalToken, SemanticHighlighter::LocalStateNameType); - } return false; } diff --git a/src/plugins/qmljseditor/qmloutlinemodel.cpp b/src/plugins/qmljseditor/qmloutlinemodel.cpp index 20f915e4a5..b762fbf817 100644 --- a/src/plugins/qmljseditor/qmloutlinemodel.cpp +++ b/src/plugins/qmljseditor/qmloutlinemodel.cpp @@ -76,9 +76,8 @@ QVariant QmlOutlineItem::data(int role) const return prettyPrint(value, scopeChain.context()); } - if (role == Qt::DecorationRole) { + if (role == Qt::DecorationRole) return m_outlineModel->icon(index()); - } return QStandardItem::data(role); } @@ -104,15 +103,13 @@ QString QmlOutlineItem::prettyPrint(const Value *value, const ContextPtr &contex if (const ObjectValue *objectValue = value->asObjectValue()) { const QString className = objectValue->className(); - if (!className.isEmpty()) { + if (!className.isEmpty()) return className; - } } const QString typeId = context->valueOwner()->typeId(value); - if (typeId == QLatin1String("undefined")) { + if (typeId == QLatin1String("undefined")) return QString(); - } return typeId; } @@ -145,9 +142,8 @@ private: { if (AST::UiObjectMember *objMember = node->uiObjectMemberCast()) { stack.removeLast(); - if (!stack.isEmpty()) { + if (!stack.isEmpty()) parent.insert(objMember, stack.last()); - } } } }; @@ -462,9 +458,8 @@ QModelIndex QmlOutlineModel::enterObjectDefinition(AST::UiObjectDefinition *objD data.insert(ItemTypeRole, ElementType); data.insert(AnnotationRole, getAnnotation(objDef->initializer)); idNode = objDef->qualifiedTypeNameId; - if (!m_typeToIcon.contains(typeName)) { + if (!m_typeToIcon.contains(typeName)) m_typeToIcon.insert(typeName, getIcon(objDef->qualifiedTypeNameId)); - } icon = m_typeToIcon.value(typeName); } else { // it's a grouped propery like 'anchors' @@ -492,9 +487,8 @@ QModelIndex QmlOutlineModel::enterObjectBinding(AST::UiObjectBinding *objBinding QmlOutlineItem *bindingItem = enterNode(bindingData, objBinding, objBinding->qualifiedId, m_icons->scriptBindingIcon()); const QString typeName = asString(objBinding->qualifiedTypeNameId); - if (!m_typeToIcon.contains(typeName)) { + if (!m_typeToIcon.contains(typeName)) m_typeToIcon.insert(typeName, getIcon(objBinding->qualifiedTypeNameId)); - } QMap<int, QVariant> objectData; objectData.insert(Qt::DisplayRole, typeName); @@ -608,13 +602,12 @@ QModelIndex QmlOutlineModel::enterTestCaseProperties(AST::PropertyNameAndValueLi objectData.insert(Qt::DisplayRole, propertyName->id.toString()); objectData.insert(ItemTypeRole, ElementBindingType); QmlOutlineItem *item; - if (propertyNameAndValueList->value->kind == AST::Node::Kind_FunctionExpression) { + if (propertyNameAndValueList->value->kind == AST::Node::Kind_FunctionExpression) item = enterNode(objectData, propertyNameAndValueList, 0, m_icons->functionDeclarationIcon()); - } else if (propertyNameAndValueList->value->kind == AST::Node::Kind_ObjectLiteral) { + else if (propertyNameAndValueList->value->kind == AST::Node::Kind_ObjectLiteral) item = enterNode(objectData, propertyNameAndValueList, 0, m_icons->objectDefinitionIcon()); - } else { + else item = enterNode(objectData, propertyNameAndValueList, 0, m_icons->scriptBindingIcon()); - } return item->index(); } else { @@ -645,13 +638,12 @@ AST::SourceLocation QmlOutlineModel::sourceLocation(const QModelIndex &index) co QTC_ASSERT(index.isValid() && (index.model() == this), return location); AST::Node *node = nodeForIndex(index); if (node) { - if (AST::UiObjectMember *member = node->uiObjectMemberCast()) { + if (AST::UiObjectMember *member = node->uiObjectMemberCast()) location = getLocation(member); - } else if (AST::ExpressionNode *expression = node->expressionCast()) { + else if (AST::ExpressionNode *expression = node->expressionCast()) location = getLocation(expression); - } else if (AST::PropertyNameAndValueList *propertyNameAndValueList = AST::cast<AST::PropertyNameAndValueList *>(node)) { + else if (AST::PropertyNameAndValueList *propertyNameAndValueList = AST::cast<AST::PropertyNameAndValueList *>(node)) location = getLocation(propertyNameAndValueList); - } } return location; } @@ -830,11 +822,10 @@ void QmlOutlineModel::moveObjectMember(AST::UiObjectMember *toMove, } Rewriter::BindingType bindingType = Rewriter::ScriptBinding; - if (insertionOrderSpecified) { + if (insertionOrderSpecified) *addedRange = rewriter.addBinding(objDefinition->initializer, propertyName, propertyValue, bindingType, listInsertAfter); - } else { + else *addedRange = rewriter.addBinding(objDefinition->initializer, propertyName, propertyValue, bindingType); - } } else { QString strToMove; { @@ -843,11 +834,10 @@ void QmlOutlineModel::moveObjectMember(AST::UiObjectMember *toMove, strToMove = documentText.mid(offset, length); } - if (insertionOrderSpecified) { + if (insertionOrderSpecified) *addedRange = rewriter.addObject(objDefinition->initializer, strToMove, listInsertAfter); - } else { + else *addedRange = rewriter.addObject(objDefinition->initializer, strToMove); - } } } else if (AST::UiArrayBinding *arrayBinding = AST::cast<AST::UiArrayBinding*>(newParent)) { AST::UiArrayMemberList *listInsertAfter = 0; @@ -865,11 +855,10 @@ void QmlOutlineModel::moveObjectMember(AST::UiObjectMember *toMove, strToMove = documentText.mid(offset, length); } - if (insertionOrderSpecified) { + if (insertionOrderSpecified) *addedRange = rewriter.addObject(arrayBinding, strToMove, listInsertAfter); - } else { + else *addedRange = rewriter.addObject(arrayBinding, strToMove); - } } else if (AST::cast<AST::UiObjectBinding*>(newParent)) { qDebug() << "TODO: Reparent to UiObjectBinding"; return; diff --git a/src/plugins/qmljseditor/quicktoolbar.cpp b/src/plugins/qmljseditor/quicktoolbar.cpp index dfcff6417c..1196cb95e8 100644 --- a/src/plugins/qmljseditor/quicktoolbar.cpp +++ b/src/plugins/qmljseditor/quicktoolbar.cpp @@ -73,11 +73,10 @@ static inline const ObjectValue * getPropertyChangesTarget(Node *node, const Sco && ! scriptBinding->qualifiedId->next) { Evaluate evaluator(&scopeChain); const Value *targetValue = evaluator(scriptBinding->statement); - if (const ObjectValue *targetObject = value_cast<ObjectValue>(targetValue)) { + if (const ObjectValue *targetObject = value_cast<ObjectValue>(targetValue)) return targetObject; - } else { + else return 0; - } } } } @@ -267,12 +266,11 @@ bool QuickToolBar::isAvailable(TextEditor::BaseTextEditor *, Document::Ptr docum UiObjectDefinition *objectDefinition = cast<UiObjectDefinition*>(node); UiObjectBinding *objectBinding = cast<UiObjectBinding*>(node); - if (objectDefinition) { + if (objectDefinition) name = objectDefinition->qualifiedTypeNameId->name.toString(); - } else if (objectBinding) { + else if (objectBinding) name = objectBinding->qualifiedTypeNameId->name.toString(); - } QStringList prototypes; prototypes.append(name); @@ -320,11 +318,10 @@ void QuickToolBar::setProperty(const QString &propertyName, const QVariant &valu bindingType = Rewriter::ObjectBinding; PropertyReader propertyReader(m_doc, initializer); - if (propertyReader.hasProperty(propertyName)) { + if (propertyReader.hasProperty(propertyName)) rewriter.changeBinding(initializer, propertyName, stringValue, bindingType); - } else { + else rewriter.addBinding(initializer, propertyName, stringValue, bindingType); - } int column; diff --git a/src/plugins/qmljstools/qmlconsoleview.cpp b/src/plugins/qmljstools/qmlconsoleview.cpp index 9640828463..eed906c651 100644 --- a/src/plugins/qmljstools/qmlconsoleview.cpp +++ b/src/plugins/qmljstools/qmlconsoleview.cpp @@ -262,9 +262,8 @@ bool QmlConsoleView::canShowItemInTextEditor(const QModelIndex &index) QString filePath = model()->data(index, QmlConsoleItemModel::FileRole).toString(); if (!filePath.isEmpty()) { QFileInfo fi(filePath); - if (fi.exists() && fi.isFile() && fi.isReadable()) { + if (fi.exists() && fi.isFile() && fi.isReadable()) return true; - } } return false; } diff --git a/src/plugins/qmljstools/qmljslocatordata.cpp b/src/plugins/qmljstools/qmljslocatordata.cpp index d5bd9f10d9..2ec23fcad7 100644 --- a/src/plugins/qmljstools/qmljslocatordata.cpp +++ b/src/plugins/qmljstools/qmljslocatordata.cpp @@ -70,11 +70,10 @@ public: QList<LocatorData::Entry> run(const Document::Ptr &doc) { m_doc = doc; - if (!doc->componentName().isEmpty()) { + if (!doc->componentName().isEmpty()) m_documentContext = doc->componentName(); - } else { + else m_documentContext = QFileInfo(doc->fileName()).fileName(); - } accept(doc->ast(), m_documentContext); return m_entries; } diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp index eba6edb429..9cfb1073ea 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.cpp +++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp @@ -213,9 +213,8 @@ ModelManagerInterface::WorkingCopy ModelManager::workingCopy() const if (TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor*>(editor)) { if (textEditor->context().contains(ProjectExplorer::Constants::LANG_QMLJS)) { - if (TextEditor::BaseTextEditorWidget *ed = qobject_cast<TextEditor::BaseTextEditorWidget *>(textEditor->widget())) { + if (TextEditor::BaseTextEditorWidget *ed = qobject_cast<TextEditor::BaseTextEditorWidget *>(textEditor->widget())) workingCopy.insert(key, ed->toPlainText(), ed->document()->revision()); - } } } } @@ -244,9 +243,8 @@ void ModelManager::updateSourceFiles(const QStringList &files, QFuture<void> ModelManager::refreshSourceFiles(const QStringList &sourceFiles, bool emitDocumentOnDiskChanged) { - if (sourceFiles.isEmpty()) { + if (sourceFiles.isEmpty()) return QFuture<void>(); - } QFuture<void> result = QtConcurrent::run(&ModelManager::parse, workingCopy(), sourceFiles, diff --git a/src/plugins/qmljstools/qmljssemanticinfo.cpp b/src/plugins/qmljstools/qmljssemanticinfo.cpp index bfec2213a1..d1abb05ea1 100644 --- a/src/plugins/qmljstools/qmljssemanticinfo.cpp +++ b/src/plugins/qmljstools/qmljssemanticinfo.cpp @@ -89,13 +89,12 @@ protected: virtual bool preVisit(AST::Node *node) { - if (Statement *stmt = node->statementCast()) { + if (Statement *stmt = node->statementCast()) return handleLocationAst(stmt); - } else if (ExpressionNode *exp = node->expressionCast()) { + else if (ExpressionNode *exp = node->expressionCast()) return handleLocationAst(exp); - } else if (UiObjectMember *ui = node->uiObjectMemberCast()) { + else if (UiObjectMember *ui = node->uiObjectMemberCast()) return handleLocationAst(ui); - } return true; } @@ -182,11 +181,10 @@ QList<AST::Node *> SemanticInfo::rangePath(int cursorPosition) const QList<AST::Node *> path; foreach (const Range &range, ranges) { - if (range.begin.isNull() || range.end.isNull()) { + if (range.begin.isNull() || range.end.isNull()) continue; - } else if (cursorPosition >= range.begin.position() && cursorPosition <= range.end.position()) { + else if (cursorPosition >= range.begin.position() && cursorPosition <= range.end.position()) path += range.ast; - } } return path; diff --git a/src/plugins/qmljstools/qmljstoolsplugin.cpp b/src/plugins/qmljstools/qmljstoolsplugin.cpp index 9d6e916239..41b4ad0445 100644 --- a/src/plugins/qmljstools/qmljstoolsplugin.cpp +++ b/src/plugins/qmljstools/qmljstoolsplugin.cpp @@ -132,16 +132,14 @@ ExtensionSystem::IPlugin::ShutdownFlag QmlJSToolsPlugin::aboutToShutdown() void QmlJSToolsPlugin::onTaskStarted(const QString &type) { - if (type == QLatin1String(QmlJSTools::Constants::TASK_INDEX)) { + if (type == QLatin1String(QmlJSTools::Constants::TASK_INDEX)) m_resetCodeModelAction->setEnabled(false); - } } void QmlJSToolsPlugin::onAllTasksFinished(const QString &type) { - if (type == QLatin1String(QmlJSTools::Constants::TASK_INDEX)) { + if (type == QLatin1String(QmlJSTools::Constants::TASK_INDEX)) m_resetCodeModelAction->setEnabled(true); - } } Q_EXPORT_PLUGIN(QmlJSToolsPlugin) diff --git a/src/plugins/qmlprofiler/canvas/qdeclarativecanvas.cpp b/src/plugins/qmlprofiler/canvas/qdeclarativecanvas.cpp index b8585e6769..377496212a 100644 --- a/src/plugins/qmlprofiler/canvas/qdeclarativecanvas.cpp +++ b/src/plugins/qmlprofiler/canvas/qdeclarativecanvas.cpp @@ -127,9 +127,8 @@ void Canvas::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget painter->setWorldTransform(scale * old); painter->drawPixmap(0, 0, m_context->pixmap()); painter->setWorldTransform(old); - if (clip()) { + if (clip()) painter->restore(); - } } } else { painter->drawPixmap(0, 0, m_context->pixmap()); diff --git a/src/plugins/qmlprofiler/canvas/qdeclarativecanvastimer.cpp b/src/plugins/qmlprofiler/canvas/qdeclarativecanvastimer.cpp index 6c7d05ba59..37370c9e9b 100644 --- a/src/plugins/qmlprofiler/canvas/qdeclarativecanvastimer.cpp +++ b/src/plugins/qmlprofiler/canvas/qdeclarativecanvastimer.cpp @@ -46,9 +46,8 @@ void CanvasTimer::handleTimeout() { Q_ASSERT(m_value.isFunction()); m_value.call(); - if (isSingleShot()) { + if (isSingleShot()) removeTimer(this); - } } void CanvasTimer::createTimer(QObject *parent, const QScriptValue &val, long timeout, bool singleshot) diff --git a/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d.cpp b/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d.cpp index c80c5ea1c5..77bd5d9a75 100644 --- a/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d.cpp +++ b/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d.cpp @@ -99,9 +99,8 @@ QColor colorFromString(const QString &name) if (name.startsWith(QLatin1String("rgba("))) { ++itr; ++itr; ++itr; ++itr; ++itr; compo = parseNumbersList(itr); - if (compo.size() != 4) { + if (compo.size() != 4) return QColor(); - } //alpha seems to be always between 0-1 compo[3] *= 255; return QColor((int)compo[0], (int)compo[1], @@ -109,26 +108,23 @@ QColor colorFromString(const QString &name) } else if (name.startsWith(QLatin1String("rgb("))) { ++itr; ++itr; ++itr; ++itr; compo = parseNumbersList(itr); - if (compo.size() != 3) { + if (compo.size() != 3) return QColor(); - } return QColor((int)qClamp(compo[0], qreal(0), qreal(255)), (int)qClamp(compo[1], qreal(0), qreal(255)), (int)qClamp(compo[2], qreal(0), qreal(255))); } else if (name.startsWith(QLatin1String("hsla("))) { ++itr; ++itr; ++itr; ++itr; ++itr; compo = parseNumbersList(itr); - if (compo.size() != 4) { + if (compo.size() != 4) return QColor(); - } return QColor::fromHslF(compo[0], compo[1], compo[2], compo[3]); } else if (name.startsWith(QLatin1String("hsl("))) { ++itr; ++itr; ++itr; ++itr; ++itr; compo = parseNumbersList(itr); - if (compo.size() != 3) { + if (compo.size() != 3) return QColor(); - } return QColor::fromHslF(compo[0], compo[1], compo[2]); } else { @@ -141,31 +137,30 @@ QColor colorFromString(const QString &name) static QPainter::CompositionMode compositeOperatorFromString(const QString &compositeOperator) { - if (compositeOperator == QLatin1String("source-over")) { + if (compositeOperator == QLatin1String("source-over")) return QPainter::CompositionMode_SourceOver; - } else if (compositeOperator == QLatin1String("source-out")) { + else if (compositeOperator == QLatin1String("source-out")) return QPainter::CompositionMode_SourceOut; - } else if (compositeOperator == QLatin1String("source-in")) { + else if (compositeOperator == QLatin1String("source-in")) return QPainter::CompositionMode_SourceIn; - } else if (compositeOperator == QLatin1String("source-atop")) { + else if (compositeOperator == QLatin1String("source-atop")) return QPainter::CompositionMode_SourceAtop; - } else if (compositeOperator == QLatin1String("destination-atop")) { + else if (compositeOperator == QLatin1String("destination-atop")) return QPainter::CompositionMode_DestinationAtop; - } else if (compositeOperator == QLatin1String("destination-in")) { + else if (compositeOperator == QLatin1String("destination-in")) return QPainter::CompositionMode_DestinationIn; - } else if (compositeOperator == QLatin1String("destination-out")) { + else if (compositeOperator == QLatin1String("destination-out")) return QPainter::CompositionMode_DestinationOut; - } else if (compositeOperator == QLatin1String("destination-over")) { + else if (compositeOperator == QLatin1String("destination-over")) return QPainter::CompositionMode_DestinationOver; - } else if (compositeOperator == QLatin1String("darker")) { + else if (compositeOperator == QLatin1String("darker")) return QPainter::CompositionMode_SourceOver; - } else if (compositeOperator == QLatin1String("lighter")) { + else if (compositeOperator == QLatin1String("lighter")) return QPainter::CompositionMode_SourceOver; - } else if (compositeOperator == QLatin1String("copy")) { + else if (compositeOperator == QLatin1String("copy")) return QPainter::CompositionMode_Source; - } else if (compositeOperator == QLatin1String("xor")) { + else if (compositeOperator == QLatin1String("xor")) return QPainter::CompositionMode_Xor; - } return QPainter::CompositionMode_SourceOver; } @@ -833,11 +828,10 @@ void Context2D::arc(qreal xc, qreal yc, qreal radius, double width = radius*2; double height = radius*2; - if (!anticlockwise && (ea < sa)) { + if (!anticlockwise && (ea < sa)) span += 360; - } else if (anticlockwise && (sa < ea)) { + else if (anticlockwise && (sa < ea)) span -= 360; - } //### this is also due to switched coordinate system // we would end up with a 0 span instead of 360 diff --git a/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp b/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp index 4317ac150f..1d351fbbe5 100644 --- a/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp +++ b/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp @@ -76,9 +76,8 @@ void LocalQmlProfilerRunner::stop() if (QmlProfilerPlugin::debugOutput) qWarning("QmlProfiler: Stopping application ..."); - if (m_launcher.isRunning()) { + if (m_launcher.isRunning()) m_launcher.stop(); - } } quint16 LocalQmlProfilerRunner::debugPort() const diff --git a/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp b/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp index a37443d76f..74d01da3e6 100644 --- a/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp @@ -326,11 +326,10 @@ void QmlProfilerClientManager::retryMessageBoxFinished(int result) // fall through } default: { - if (d->connection) { + if (d->connection) QmlProfilerTool::logStatus(QLatin1String("QML Profiler: Failed to connect! ") + d->connection->errorString()); - } else { + else QmlProfilerTool::logStatus(QLatin1String("QML Profiler: Failed to connect!")); - } emit connectionFailed(); break; @@ -399,9 +398,8 @@ void QmlProfilerClientManager::profilerStateChanged() QTC_ASSERT(d->profilerState, return); switch (d->profilerState->currentState()) { case QmlProfilerStateManager::AppStopRequested : - if (d->profilerState->serverRecording()) { + if (d->profilerState->serverRecording()) stopClientsRecording(); - } else d->profilerState->setCurrentState(QmlProfilerStateManager::AppReadyToStop); break; diff --git a/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp b/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp index 44c92c4c29..782becd8e2 100644 --- a/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp @@ -312,9 +312,8 @@ void QmlProfilerDataModel::addRangedEvent(int type, int bindingType, qint64 star details = data.join(QLatin1String(" ")).replace(QLatin1Char('\n'),QLatin1Char(' ')).simplified(); QRegExp rewrite(QLatin1String("\\(function \\$(\\w+)\\(\\) \\{ (return |)(.+) \\}\\)")); bool match = rewrite.exactMatch(details); - if (match) { + if (match) details = rewrite.cap(1) + QLatin1String(": ") + rewrite.cap(3); - } if (details.startsWith(QLatin1String("file://"))) details = details.mid(details.lastIndexOf(QLatin1Char('/')) + 1); } @@ -510,11 +509,10 @@ QmlEventType QmlProfilerDataModel::qmlEventTypeAsEnum(const QString &typeString) } else { bool isNumber = false; int type = typeString.toUInt(&isNumber); - if (isNumber) { + if (isNumber) return (QmlEventType)type; - } else { + else return MaximumQmlEventType; - } } } @@ -843,9 +841,8 @@ void QmlProfilerDataModel::QmlProfilerDataModelPrivate::prepareForDisplay() typeCounts[typeNumber] = new QmlRangeEventTypeCount; typeCounts[typeNumber]->nestingCount = 0; } - if (eventStartData.nestingLevel > typeCounts[typeNumber]->nestingCount) { + if (eventStartData.nestingLevel > typeCounts[typeNumber]->nestingCount) typeCounts[typeNumber]->nestingCount = eventStartData.nestingLevel; - } if (!typeCounts[typeNumber]->eventIds.contains(eventStartData.statsInfo->eventId)) typeCounts[typeNumber]->eventIds << eventStartData.statsInfo->eventId; } @@ -1133,9 +1130,8 @@ void QmlProfilerDataModel::QmlProfilerDataModelPrivate::redoTree(qint64 fromTime int level = startInstanceList[index].level; QmlRangeEventData *parentEvent = listedRootEvent; - if (level > Constants::QML_MIN_LEVEL && lastParent.contains(level-1)) { + if (level > Constants::QML_MIN_LEVEL && lastParent.contains(level-1)) parentEvent = lastParent[level-1]; - } if (!eventDescription->parentHash.contains(parentEvent->eventHashStr)) { QmlRangeEventRelative *newParentEvent = new QmlRangeEventRelative(parentEvent); @@ -1165,9 +1161,8 @@ void QmlProfilerDataModel::QmlProfilerDataModelPrivate::redoTree(qint64 fromTime lastParent[level] = eventDescription; - if (level == Constants::QML_MIN_LEVEL) { + if (level == Constants::QML_MIN_LEVEL) totalTime += duration; - } } // fake rootEvent statistics @@ -1564,9 +1559,8 @@ void QmlProfilerDataModel::load() currentEvent->location.line = readData.toInt(); break; } - if (elementName == QLatin1String("column")) { + if (elementName == QLatin1String("column")) currentEvent->location.column = readData.toInt(); - } if (elementName == QLatin1String("details")) { currentEvent->details = readData; break; diff --git a/src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.cpp b/src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.cpp index f4d96c141d..22c6eb72c1 100644 --- a/src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.cpp @@ -77,9 +77,8 @@ protected: virtual bool preVisit(QmlJS::AST::Node *node) { - if (QmlJS::AST::cast<QmlJS::AST::UiQualifiedId *>(node)) { + if (QmlJS::AST::cast<QmlJS::AST::UiQualifiedId *>(node)) return false; - } return containsLocation(node->firstSourceLocation(), node->lastSourceLocation()); } diff --git a/src/plugins/qmlprofiler/qmlprofilerengine.cpp b/src/plugins/qmlprofiler/qmlprofilerengine.cpp index bfb8c83256..550c9cc114 100644 --- a/src/plugins/qmlprofiler/qmlprofilerengine.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerengine.cpp @@ -341,16 +341,14 @@ void QmlProfilerEngine::processIsRunning(quint16 port) void QmlProfilerEngine::registerProfilerStateManager( QmlProfilerStateManager *profilerState ) { // disconnect old - if (d->m_profilerState) { + if (d->m_profilerState) disconnect(d->m_profilerState, SIGNAL(stateChanged()), this, SLOT(profilerStateChanged())); - } d->m_profilerState = profilerState; // connect - if (d->m_profilerState) { + if (d->m_profilerState) connect(d->m_profilerState, SIGNAL(stateChanged()), this, SLOT(profilerStateChanged())); - } } void QmlProfilerEngine::profilerStateChanged() diff --git a/src/plugins/qmlprofiler/qmlprofilereventview.cpp b/src/plugins/qmlprofiler/qmlprofilereventview.cpp index 82635fa294..e994a2e32f 100644 --- a/src/plugins/qmlprofiler/qmlprofilereventview.cpp +++ b/src/plugins/qmlprofiler/qmlprofilereventview.cpp @@ -171,9 +171,8 @@ void QmlProfilerEventsWidget::profilerDataModelStateChanged() { if (d->m_profilerDataModel) { QmlProfilerDataModel::State newState = d->m_profilerDataModel->currentState(); - if (newState == QmlProfilerDataModel::Empty) { + if (newState == QmlProfilerDataModel::Empty) clear(); - } } } @@ -601,9 +600,8 @@ void QmlProfilerEventsMainView::QmlProfilerEventsMainViewPrivate::buildModelFrom continue; QList<QStandardItem *> newRow; - if (m_fieldShown[Name]) { + if (m_fieldShown[Name]) newRow << new EventsViewItem(binding->displayName); - } if (m_fieldShown[Type]) { QString typeString = QmlProfilerEventsMainView::nameForType(binding->eventType); @@ -695,9 +693,8 @@ void QmlProfilerEventsMainView::QmlProfilerEventsMainViewPrivate::buildV8ModelFr QV8EventData *v8event = list.at(index); QList<QStandardItem *> newRow; - if (m_fieldShown[Name]) { + if (m_fieldShown[Name]) newRow << new EventsViewItem(v8event->displayName); - } if (m_fieldShown[Percent]) { newRow << new EventsViewItem(QString::number(v8event->totalPercent,'f',2)+QLatin1String(" %")); @@ -813,9 +810,8 @@ void QmlProfilerEventsMainView::jumpToItem(const QModelIndex &index) emit eventSelected(infoItem->data(EventIdRole).toInt()); // show in timelinerenderer - if (d->m_viewType == EventsView) { + if (d->m_viewType == EventsView) emit showEventInTimeline(infoItem->data(EventIdRole).toInt()); - } d->m_preventSelectBounce = false; } diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index 1d31a0041b..5dd82bd9cb 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -250,9 +250,8 @@ IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp } // FIXME: Check that there's something sensible in sp.connParams - if (isTcpConnection) { + if (isTcpConnection) d->m_profilerConnections->setTcpConnection(sp.connParams.host, sp.connParams.port); - } d->m_runConfiguration = runConfiguration; @@ -404,9 +403,8 @@ void QmlProfilerTool::populateFileFinder(QString projectDirectory, QString activ sourceFiles << project->files(Project::ExcludeGeneratedFiles); if (!projects.isEmpty()) { - if (projectDirectory.isEmpty()) { + if (projectDirectory.isEmpty()) projectDirectory = projects.first()->projectDirectory(); - } if (activeSysroot.isEmpty()) { if (Target *target = projects.first()->activeTarget()) @@ -711,9 +709,8 @@ void QmlProfilerTool::clientRecordingChanged() { // if application is running, display server record changes // if application is stopped, display client record changes - if (d->m_profilerState->currentState() != QmlProfilerStateManager::AppRunning) { + if (d->m_profilerState->currentState() != QmlProfilerStateManager::AppRunning) setRecording(d->m_profilerState->clientRecording()); - } } void QmlProfilerTool::serverRecordingChanged() diff --git a/src/plugins/qmlprofiler/qv8profilerdatamodel.cpp b/src/plugins/qmlprofiler/qv8profilerdatamodel.cpp index 7b614eb230..b8f783700e 100644 --- a/src/plugins/qmlprofiler/qv8profilerdatamodel.cpp +++ b/src/plugins/qmlprofiler/qv8profilerdatamodel.cpp @@ -193,9 +193,8 @@ void QV8ProfilerDataModel::addV8Event(int depth, parentEvent = &d->v8RootEvent; d->v8MeasuredTime += totalTime; } - if (depth > 0 && d->v8parents.contains(depth-1)) { + if (depth > 0 && d->v8parents.contains(depth-1)) parentEvent = d->v8parents.value(depth-1); - } if (parentEvent != 0) { if (!eventData->parentHash.contains(parentEvent->eventHashStr)) { @@ -385,9 +384,8 @@ void QV8ProfilerDataModel::load(QXmlStreamReader &stream) childrenTimes[eventIndex] = attributes.value(QLatin1String("childrenTimes")).toString(); } - if (attributes.hasAttribute(QLatin1String("parentTimes"))) { + if (attributes.hasAttribute(QLatin1String("parentTimes"))) parentTimes[eventIndex] = attributes.value(QLatin1String("parentTimes")).toString(); - } } stream.readNext(); @@ -451,12 +449,10 @@ void QV8ProfilerDataModel::load(QXmlStreamReader &stream) if (v8eventBuffer.value(childIndex)) { QV8EventSub *newChild = new QV8EventSub(v8eventBuffer[childIndex]); QV8EventSub *newParent = new QV8EventSub(v8eventBuffer[parentIndex]); - if (childrenTimesStrings.count() > ndx) { + if (childrenTimesStrings.count() > ndx) newChild->totalTime = childrenTimesStrings[ndx].toDouble(); - } - if (parentTimesStrings.count() > ndx) { + if (parentTimesStrings.count() > ndx) newParent->totalTime = parentTimesStrings[ndx].toDouble(); - } v8eventBuffer[parentIndex]->childrenHash.insert( newChild->reference->displayName, newChild); diff --git a/src/plugins/qmlprojectmanager/fileformat/filefilteritems.cpp b/src/plugins/qmlprojectmanager/fileformat/filefilteritems.cpp index 57ef21ea34..489443dd11 100644 --- a/src/plugins/qmlprojectmanager/fileformat/filefilteritems.cpp +++ b/src/plugins/qmlprojectmanager/fileformat/filefilteritems.cpp @@ -129,11 +129,10 @@ bool FileFilterBaseItem::recursive() const } else if (m_recurse == DoNotRecurse) { recursive = false; } else { // RecurseDefault - if (m_explicitFiles.isEmpty()) { + if (m_explicitFiles.isEmpty()) recursive = true; - } else { + else recursive = false; - } } return recursive; } @@ -142,11 +141,10 @@ void FileFilterBaseItem::setRecursive(bool recurse) { bool oldRecursive = recursive(); - if (recurse) { + if (recurse) m_recurse = Recurse; - } else { + else m_recurse = DoNotRecurse; - } if (recurse != oldRecursive) updateFileList(); @@ -204,11 +202,10 @@ QString FileFilterBaseItem::absolutePath(const QString &path) const QString FileFilterBaseItem::absoluteDir() const { QString absoluteDir; - if (QFileInfo(m_rootDir).isAbsolute()) { + if (QFileInfo(m_rootDir).isAbsolute()) absoluteDir = m_rootDir; - } else if (!m_defaultDir.isEmpty()) { + else if (!m_defaultDir.isEmpty()) absoluteDir = m_defaultDir + QLatin1Char('/') + m_rootDir; - } return QDir::cleanPath(absoluteDir); } @@ -264,15 +261,13 @@ void FileFilterBaseItem::updateFileListNow() bool FileFilterBaseItem::fileMatches(const QString &fileName) const { foreach (const QString &suffix, m_fileSuffixes) { - if (fileName.endsWith(suffix, Qt::CaseInsensitive)) { + if (fileName.endsWith(suffix, Qt::CaseInsensitive)) return true; - } } foreach (QRegExp filter, m_regExpList) { - if (filter.exactMatch(fileName)) { + if (filter.exactMatch(fileName)) return true; - } } return false; diff --git a/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.cpp b/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.cpp index bb9f1006fd..2dbdd7d372 100644 --- a/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.cpp +++ b/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.cpp @@ -56,9 +56,8 @@ QList<QmlFileFilterItem*> QmlProjectItemPrivate::qmlFileFilters() const for (int i = 0; i < content.size(); ++i) { QmlProjectContentItem *contentElement = content.at(i); QmlFileFilterItem *qmlFileFilter = qobject_cast<QmlFileFilterItem*>(contentElement); - if (qmlFileFilter) { + if (qmlFileFilter) qmlFilters << qmlFileFilter; - } } return qmlFilters; } diff --git a/src/plugins/qmlprojectmanager/qmlproject.cpp b/src/plugins/qmlprojectmanager/qmlproject.cpp index cf7d4a7539..35621a80a5 100644 --- a/src/plugins/qmlprojectmanager/qmlproject.cpp +++ b/src/plugins/qmlprojectmanager/qmlproject.cpp @@ -201,11 +201,10 @@ QStringList QmlProject::convertToAbsoluteFiles(const QStringList &paths) const QStringList QmlProject::files() const { QStringList files; - if (m_projectItem) { + if (m_projectItem) files = m_projectItem.data()->files(); - } else { + else files = m_files; - } return files; } diff --git a/src/plugins/qmlprojectmanager/qmlprojectmanager.cpp b/src/plugins/qmlprojectmanager/qmlprojectmanager.cpp index ad6a6e1034..e73fbb0a75 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectmanager.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectmanager.cpp @@ -78,9 +78,8 @@ void Manager::unregisterProject(QmlProject *project) void Manager::notifyChanged(const QString &fileName) { foreach (QmlProject *project, m_projects) { - if (fileName == project->filesFileName()) { + if (fileName == project->filesFileName()) project->refresh(QmlProject::Files); - } } } diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationwidget.cpp b/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationwidget.cpp index 51411f531e..7b70a301e9 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationwidget.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationwidget.cpp @@ -168,11 +168,10 @@ void QmlProjectRunConfigurationWidget::updateFileComboBox() currentIndex = item->index(); } - if (currentIndex.isValid()) { + if (currentIndex.isValid()) m_fileListCombo->setCurrentIndex(currentIndex.row()); - } else { + else m_fileListCombo->setCurrentIndex(0); - } } void QmlProjectRunConfigurationWidget::setMainScript(int index) diff --git a/src/plugins/qmlprojectmanager/qmlprojectruncontrol.cpp b/src/plugins/qmlprojectmanager/qmlprojectruncontrol.cpp index 667000e68a..7a913d417b 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectruncontrol.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectruncontrol.cpp @@ -59,11 +59,10 @@ QmlProjectRunControl::QmlProjectRunControl(QmlProjectRunConfiguration *runConfig m_applicationLauncher.setEnvironment(runConfiguration->environment()); m_applicationLauncher.setWorkingDirectory(runConfiguration->workingDirectory()); - if (mode == NormalRunMode) { + if (mode == NormalRunMode) m_executable = runConfiguration->viewerPath(); - } else { + else m_executable = runConfiguration->observerPath(); - } m_commandLineArguments = runConfiguration->viewerArguments(); m_mainQmlFile = runConfiguration->mainScript(); @@ -217,9 +216,8 @@ RunControl *QmlProjectRunControlFactory::createDebugRunControl(QmlProjectRunConf // Makes sure that all bindings go through the JavaScript engine, so that // breakpoints are actually hit! const QString optimizerKey = QLatin1String("QML_DISABLE_OPTIMIZER"); - if (!params.environment.hasKey(optimizerKey)) { + if (!params.environment.hasKey(optimizerKey)) params.environment.set(optimizerKey, QLatin1String("1")); - } if (params.executable.isEmpty()) { QmlProjectPlugin::showQmlObserverToolWarning(); diff --git a/src/plugins/qnx/blackberryapplicationrunner.cpp b/src/plugins/qnx/blackberryapplicationrunner.cpp index 7ea100e6ab..03fec2c970 100644 --- a/src/plugins/qnx/blackberryapplicationrunner.cpp +++ b/src/plugins/qnx/blackberryapplicationrunner.cpp @@ -232,11 +232,10 @@ void BlackBerryApplicationRunner::readStandardOutput() QString line = QString::fromLocal8Bit(process->readLine()); emit output(line, Utils::StdOutFormat); - if (line.startsWith(QLatin1String("result::"))) { + if (line.startsWith(QLatin1String("result::"))) m_pid = parsePid(line); - } else if (line.startsWith(QLatin1String("Info: Launching"))) { + else if (line.startsWith(QLatin1String("Info: Launching"))) m_appId = parseAppId(line); - } } } @@ -255,11 +254,10 @@ void BlackBerryApplicationRunner::killTailProcess() QSsh::SshRemoteProcessRunner *slayProcess = new QSsh::SshRemoteProcessRunner(this); connect(slayProcess, SIGNAL(processClosed(int)), this, SIGNAL(finished())); - if (m_slog2infoFound) { + if (m_slog2infoFound) slayProcess->run("slay slog2info", m_sshParams); - } else { + else slayProcess->run("slay tail", m_sshParams); - } // Not supported by OpenSSH server //m_tailProcess->sendSignalToProcess(Utils::SshRemoteProcess::KillSignal); diff --git a/src/plugins/qnx/blackberrydeviceconfigurationwizard.cpp b/src/plugins/qnx/blackberrydeviceconfigurationwizard.cpp index d7b80d7eb5..1c76d234e1 100644 --- a/src/plugins/qnx/blackberrydeviceconfigurationwizard.cpp +++ b/src/plugins/qnx/blackberrydeviceconfigurationwizard.cpp @@ -86,9 +86,8 @@ ProjectExplorer::IDevice::Ptr BlackBerryDeviceConfigurationWizard::device() void BlackBerryDeviceConfigurationWizard::accept() { if (m_sshKeyPage->isGenerated()) { - if (saveKeys()) { + if (saveKeys()) QWizard::accept(); - } } else { QWizard::accept(); } @@ -131,9 +130,8 @@ bool BlackBerryDeviceConfigurationWizard::saveKeys() pubKeyContent.append(atHost.toLocal8Bit()); pubSaver.write(pubKeyContent); - if (!pubSaver.finalize(this)) { + if (!pubSaver.finalize(this)) return false; - } return true; } diff --git a/src/plugins/qnx/blackberryrunconfiguration.cpp b/src/plugins/qnx/blackberryrunconfiguration.cpp index b6339d0b17..beed80832f 100644 --- a/src/plugins/qnx/blackberryrunconfiguration.cpp +++ b/src/plugins/qnx/blackberryrunconfiguration.cpp @@ -103,9 +103,8 @@ QString BlackBerryRunConfiguration::barPackage() const QList<BarPackageDeployInformation> packages = dc->deploymentInfo()->enabledPackages(); foreach (const BarPackageDeployInformation package, packages) { - if (package.proFilePath == proFilePath()) { + if (package.proFilePath == proFilePath()) return package.packagePath; - } } return QString(); } diff --git a/src/plugins/qnx/blackberryruncontrolfactory.cpp b/src/plugins/qnx/blackberryruncontrolfactory.cpp index 21bd416775..81cf867ed5 100644 --- a/src/plugins/qnx/blackberryruncontrolfactory.cpp +++ b/src/plugins/qnx/blackberryruncontrolfactory.cpp @@ -158,9 +158,8 @@ Debugger::DebuggerStartParameters BlackBerryRunControlFactory::startParameters( if (const ProjectExplorer::Project *project = runConfig->target()->project()) { params.projectSourceDirectory = project->projectDirectory(); - if (const ProjectExplorer::BuildConfiguration *buildConfig = runConfig->target()->activeBuildConfiguration()) { + if (const ProjectExplorer::BuildConfiguration *buildConfig = runConfig->target()->activeBuildConfiguration()) params.projectBuildDirectory = buildConfig->buildDirectory(); - } params.projectSourceFiles = project->files(ProjectExplorer::Project::ExcludeGeneratedFiles); } diff --git a/src/plugins/qnx/qnxdeviceconfigurationfactory.cpp b/src/plugins/qnx/qnxdeviceconfigurationfactory.cpp index 5cacb700c3..22c700001b 100644 --- a/src/plugins/qnx/qnxdeviceconfigurationfactory.cpp +++ b/src/plugins/qnx/qnxdeviceconfigurationfactory.cpp @@ -67,9 +67,8 @@ ProjectExplorer::IDevice::Ptr QnxDeviceConfigurationFactory::create(Core::Id id) { Q_UNUSED(id); QnxDeviceConfigurationWizard wizard; - if (wizard.exec() != QDialog::Accepted) { + if (wizard.exec() != QDialog::Accepted) return ProjectExplorer::IDevice::Ptr(); - } return wizard.device(); } diff --git a/src/plugins/qnx/qnxdeviceconfigurationwizard.cpp b/src/plugins/qnx/qnxdeviceconfigurationwizard.cpp index 725bdac76a..714f42f543 100644 --- a/src/plugins/qnx/qnxdeviceconfigurationwizard.cpp +++ b/src/plugins/qnx/qnxdeviceconfigurationwizard.cpp @@ -67,11 +67,10 @@ IDevice::Ptr QnxDeviceConfigurationWizard::device() sshParams.port = 22; sshParams.timeout = 10; sshParams.authenticationType = m_setupPage->authenticationType(); - if (sshParams.authenticationType == QSsh::SshConnectionParameters::AuthenticationByPassword) { + if (sshParams.authenticationType == QSsh::SshConnectionParameters::AuthenticationByPassword) sshParams.password = m_setupPage->password(); - } else { + else sshParams.privateKeyFile = m_setupPage->privateKeyFilePath(); - } QnxDeviceConfiguration::Ptr device = QnxDeviceConfiguration::create(m_setupPage->configurationName(), Core::Id(Constants::QNX_QNX_OS_TYPE), IDevice::Hardware); diff --git a/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetpluginwizardpage.cpp b/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetpluginwizardpage.cpp index 8716dacb0e..d62e966cc8 100644 --- a/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetpluginwizardpage.cpp +++ b/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetpluginwizardpage.cpp @@ -123,11 +123,10 @@ void CustomWidgetPluginWizardPage::slotCheckCompleteness() // A collection is complete only with class name bool completeNow = false; if (!pluginName().isEmpty()) { - if (m_classCount > 1) { + if (m_classCount > 1) completeNow = !collectionClassName().isEmpty(); - } else { + else completeNow = true; - } } if (completeNow != m_complete) { m_complete = completeNow; diff --git a/src/plugins/qt4projectmanager/qmakestep.cpp b/src/plugins/qt4projectmanager/qmakestep.cpp index ee5e7e9890..946bf20f2a 100644 --- a/src/plugins/qt4projectmanager/qmakestep.cpp +++ b/src/plugins/qt4projectmanager/qmakestep.cpp @@ -206,9 +206,8 @@ QStringList QMakeStep::deducedArguments() // TODO: For Qt5, we can pass both arguments as there can be Qt Quick 1/2 projects. // Currently there is no support for debugging multiple engines. arguments << QLatin1String(Constants::QMAKEVAR_QUICK1_DEBUG); - if (version->qtVersion().majorVersion >= 5) { + if (version->qtVersion().majorVersion >= 5) arguments << QLatin1String(Constants::QMAKEVAR_QUICK2_DEBUG); - } } else { const QString qmlDebuggingHelperLibrary = version->qmlDebuggingHelperLibrary(true); if (!qmlDebuggingHelperLibrary.isEmpty()) { @@ -490,11 +489,10 @@ bool QMakeStep::fromMap(const QVariantMap &map) if (map.value(QLatin1String(QMAKE_QMLDEBUGLIBAUTO_KEY), false).toBool()) { m_linkQmlDebuggingLibrary = DebugLink; } else { - if (map.value(QLatin1String(QMAKE_QMLDEBUGLIB_KEY), false).toBool()) { + if (map.value(QLatin1String(QMAKE_QMLDEBUGLIB_KEY), false).toBool()) m_linkQmlDebuggingLibrary = DoLink; - } else { + else m_linkQmlDebuggingLibrary = DoNotLink; - } } return BuildStep::fromMap(map); diff --git a/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp b/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp index b8bf24988d..95432821c3 100644 --- a/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp @@ -597,9 +597,8 @@ Utils::Environment Qt4RunConfiguration::baseEnvironment() const && target()->activeBuildConfiguration()) { env = target()->activeBuildConfiguration()->environment(); } - if (m_isUsingDyldImageSuffix) { + if (m_isUsingDyldImageSuffix) env.set(QLatin1String("DYLD_IMAGE_SUFFIX"), QLatin1String("_debug")); - } // The user could be linking to a library found via a -L/some/dir switch // to find those libraries while actually running we explicitly prepend those diff --git a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp index fce098dda5..bc9387335b 100644 --- a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp @@ -503,11 +503,10 @@ FileName Qt4BuildConfiguration::extractSpecFromArguments(QString *args, // if it is the former we need to get the canonical form // for the other one we don't need to do anything if (parsedSpec.toFileInfo().isRelative()) { - if (QFileInfo(directory + QLatin1Char('/') + parsedSpec.toString()).exists()) { + if (QFileInfo(directory + QLatin1Char('/') + parsedSpec.toString()).exists()) parsedSpec = FileName::fromUserInput(directory + QLatin1Char('/') + parsedSpec.toString()); - } else { + else parsedSpec = FileName::fromUserInput(baseMkspecDir.toString() + QLatin1Char('/') + parsedSpec.toString()); - } } QFileInfo f2 = parsedSpec.toFileInfo(); @@ -521,9 +520,8 @@ FileName Qt4BuildConfiguration::extractSpecFromArguments(QString *args, } else { FileName sourceMkSpecPath = FileName::fromString(version->sourcePath().toString() + QLatin1String("/mkspecs")); - if (parsedSpec.isChildOf(sourceMkSpecPath)) { + if (parsedSpec.isChildOf(sourceMkSpecPath)) parsedSpec = parsedSpec.relativeChildPath(sourceMkSpecPath); - } } return parsedSpec; } diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp index 30196e5565..016002a8c8 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.cpp +++ b/src/plugins/qt4projectmanager/qt4nodes.cpp @@ -856,11 +856,10 @@ QList<ProjectNode::ProjectAction> Qt4PriFileNode::supportedActions(Node *node) c // work on a subset of the file types according to project type. actions << AddNewFile; - if (m_recursiveEnumerateFiles.contains(Utils::FileName::fromString(node->path()))) { + if (m_recursiveEnumerateFiles.contains(Utils::FileName::fromString(node->path()))) actions << EraseFile; - } else { + else actions << RemoveFile; - } bool addExistingFiles = true; if (node->nodeType() == ProjectExplorer::VirtualFolderNodeType) { @@ -1530,9 +1529,8 @@ void Qt4ProFileNode::emitProFileUpdatedRecursive() emit qt4Watcher->proFileUpdated(this, m_validParse, m_parseInProgress); foreach (ProjectNode *subNode, subProjectNodes()) { - if (Qt4ProFileNode *node = qobject_cast<Qt4ProFileNode *>(subNode)) { + if (Qt4ProFileNode *node = qobject_cast<Qt4ProFileNode *>(subNode)) node->emitProFileUpdatedRecursive(); - } } } @@ -1540,9 +1538,8 @@ void Qt4ProFileNode::setParseInProgressRecursive(bool b) { setParseInProgress(b); foreach (ProjectNode *subNode, subProjectNodes()) { - if (Qt4ProFileNode *node = qobject_cast<Qt4ProFileNode *>(subNode)) { + if (Qt4ProFileNode *node = qobject_cast<Qt4ProFileNode *>(subNode)) node->setParseInProgressRecursive(b); - } } } @@ -1560,9 +1557,8 @@ void Qt4ProFileNode::setValidParseRecursive(bool b) { setValidParse(b); foreach (ProjectNode *subNode, subProjectNodes()) { - if (Qt4ProFileNode *node = qobject_cast<Qt4ProFileNode *>(subNode)) { + if (Qt4ProFileNode *node = qobject_cast<Qt4ProFileNode *>(subNode)) node->setValidParseRecursive(b); - } } } @@ -2041,9 +2037,8 @@ QStringList Qt4ProFileNode::libDirectories(QtSupport::ProFileReader *reader) con { QStringList result; foreach (const QString &str, reader->values(QLatin1String("LIBS"))) { - if (str.startsWith(QLatin1String("-L"))) { + if (str.startsWith(QLatin1String("-L"))) result.append(str.mid(2)); - } } return result; } @@ -2077,11 +2072,10 @@ QStringList Qt4ProFileNode::subDirsPaths(QtSupport::ProFileReader *reader, QStri realDir = info.filePath(); QString realFile; - if (info.isDir()) { + if (info.isDir()) realFile = QString::fromLatin1("%1/%2.pro").arg(realDir, info.fileName()); - } else { + else realFile = realDir; - } if (QFile::exists(realFile)) { realFile = QDir::cleanPath(realFile); diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp index 9dbcfa469b..1ed9b7055c 100644 --- a/src/plugins/qt4projectmanager/qt4project.cpp +++ b/src/plugins/qt4projectmanager/qt4project.cpp @@ -607,9 +607,8 @@ void Qt4Project::updateCppCodeModel() QList<HeaderPath> headers; if (tc) headers = tc->systemHeaderPaths(cxxflags, SysRootKitInformation::sysRoot(k)); - if (qtVersion) { + if (qtVersion) headers.append(qtVersion->systemHeaderPathes(k)); - } foreach (const HeaderPath &headerPath, headers) { if (headerPath.kind() == HeaderPath::FrameworkHeaderPath) @@ -1313,9 +1312,8 @@ void CentralizedFolderWatcher::unwatchFolders(const QList<QString> &folders, Qt4 if (!folder.endsWith(slash)) folder.append(slash); m_map.remove(folder, node); - if (!m_map.contains(folder)) { + if (!m_map.contains(folder)) m_watcher.removePath(folder); - } // Figure out which recursive directories we can remove // this might not scale. I'm pretty sure it doesn't diff --git a/src/plugins/qt4projectmanager/unconfiguredprojectpanel.cpp b/src/plugins/qt4projectmanager/unconfiguredprojectpanel.cpp index 9e8c0dc938..bc75ca310a 100644 --- a/src/plugins/qt4projectmanager/unconfiguredprojectpanel.cpp +++ b/src/plugins/qt4projectmanager/unconfiguredprojectpanel.cpp @@ -194,9 +194,8 @@ void TargetSetupPageWrapper::keyPressEvent(QKeyEvent *event) void TargetSetupPageWrapper::keyReleaseEvent(QKeyEvent *event) { - if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) { + if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) event->accept(); - } } void TargetSetupPageWrapper::cancel() diff --git a/src/plugins/qt4projectmanager/wizards/libraryparameters.cpp b/src/plugins/qt4projectmanager/wizards/libraryparameters.cpp index 8c874418b0..b329c712e1 100644 --- a/src/plugins/qt4projectmanager/wizards/libraryparameters.cpp +++ b/src/plugins/qt4projectmanager/wizards/libraryparameters.cpp @@ -111,15 +111,13 @@ void LibraryParameters::generateCode(QtProjectParameters:: Type t, // Is this a QObject (plugin) const bool inheritsQObject = t == QtProjectParameters::Qt4Plugin; - if (inheritsQObject) { + if (inheritsQObject) headerStr << namespaceIndent << indent << "Q_OBJECT\n"; - } headerStr << namespaceIndent << "public:\n"; - if (inheritsQObject) { + if (inheritsQObject) headerStr << namespaceIndent << indent << unqualifiedClassName << "(QObject *parent = 0);\n"; - } else { + else headerStr << namespaceIndent << indent << unqualifiedClassName << "();\n"; - } headerStr << namespaceIndent << "};\n\n"; Utils::writeClosingNameSpaces(namespaceList, indent, headerStr); headerStr << "#endif // "<< guard << '\n'; diff --git a/src/plugins/qt4projectmanager/wizards/librarywizarddialog.cpp b/src/plugins/qt4projectmanager/wizards/librarywizarddialog.cpp index fd735285ff..8da2f2fa4e 100644 --- a/src/plugins/qt4projectmanager/wizards/librarywizarddialog.cpp +++ b/src/plugins/qt4projectmanager/wizards/librarywizarddialog.cpp @@ -168,12 +168,10 @@ LibraryWizardDialog::LibraryWizardDialog(const QString &templateName, Utils::WizardProgressItem *introItem = wizardProgress()->item(startId()); Utils::WizardProgressItem *targetItem = 0; Utils::WizardProgressItem *mobileItem = 0; - if (m_targetPageId != -1) { + if (m_targetPageId != -1) targetItem = wizardProgress()->item(m_targetPageId); - } - if (m_mobilePageId != -1) { + if (m_mobilePageId != -1) mobileItem = wizardProgress()->item(m_mobilePageId); - } Utils::WizardProgressItem *modulesItem = wizardProgress()->item(m_modulesPageId); Utils::WizardProgressItem *filesItem = wizardProgress()->item(m_filesPageId); filesItem->setTitle(tr("Details")); @@ -357,9 +355,8 @@ LibraryParameters LibraryWizardDialog::libraryParameters() const rc.sourceFileName = m_filesPage->sourceFileName(); rc.headerFileName = m_filesPage->headerFileName(); if (!rc.baseClassName.isEmpty()) - if (const PluginBaseClasses *plb = findPluginBaseClass(rc.baseClassName)) { + if (const PluginBaseClasses *plb = findPluginBaseClass(rc.baseClassName)) rc.baseClassModule = QLatin1String(plb->module); - } return rc; } diff --git a/src/plugins/qt4projectmanager/wizards/qtquickappwizard.cpp b/src/plugins/qt4projectmanager/wizards/qtquickappwizard.cpp index 7cae954319..c681240d73 100644 --- a/src/plugins/qt4projectmanager/wizards/qtquickappwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/qtquickappwizard.cpp @@ -93,9 +93,8 @@ QtQuickAppWizardDialog::QtQuickAppWizardDialog(QWidget *parent, bool QtQuickAppWizardDialog::validateCurrentPage() { - if (currentPage() == m_componentOptionsPage) { + if (currentPage() == m_componentOptionsPage) setIgnoreGenericOptionsPage(false); - } return AbstractMobileAppWizardDialog::validateCurrentPage(); } diff --git a/src/plugins/qt4projectmanager/wizards/testwizard.cpp b/src/plugins/qt4projectmanager/wizards/testwizard.cpp index 8f7e87cb0d..af308d7f66 100644 --- a/src/plugins/qt4projectmanager/wizards/testwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/testwizard.cpp @@ -120,9 +120,8 @@ static QString generateTestCode(const TestWizardParameters &testParams, } // Test slot with data or dummy writeVoidMemberBody(str, testParams.className, testParams.testSlot, false); - if (testParams.useDataSet) { + if (testParams.useDataSet) str << indent << "QFETCH(" << testDataTypeC << ", data);\n"; - } switch (testParams.type) { case TestWizardParameters::Test: str << indent << "QVERIFY2(true, \"Failure\");\n"; diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index bbfa50c076..f7b9ef44a8 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -268,12 +268,10 @@ Core::FeatureSet BaseQtVersion::availableFeatures() const features |= Core::FeatureSet(QtSupport::Constants::FEATURE_QT_QUICK); features |= Core::FeatureSet(QtSupport::Constants::FEATURE_QT_QUICK_1); } - if (qtVersion() >= QtSupport::QtVersionNumber(4, 7, 1)) { + if (qtVersion() >= QtSupport::QtVersionNumber(4, 7, 1)) features |= Core::FeatureSet(QtSupport::Constants::FEATURE_QT_QUICK_1_1); - } - if (qtVersion() >= QtSupport::QtVersionNumber(5, 0, 0)) { + if (qtVersion() >= QtSupport::QtVersionNumber(5, 0, 0)) features |= Core::FeatureSet(QtSupport::Constants::FEATURE_QT_QUICK_2); - } return features; } diff --git a/src/plugins/qtsupport/debugginghelperbuildtask.cpp b/src/plugins/qtsupport/debugginghelperbuildtask.cpp index 0e4f5c6a18..088aef9ccb 100644 --- a/src/plugins/qtsupport/debugginghelperbuildtask.cpp +++ b/src/plugins/qtsupport/debugginghelperbuildtask.cpp @@ -224,9 +224,8 @@ bool DebuggingHelperBuildTask::buildDebuggingHelper(QFutureInterface<void> &futu } log(output, error); - if (!success) { + if (!success) return false; - } } future.setProgressValue(4); @@ -247,9 +246,8 @@ bool DebuggingHelperBuildTask::buildDebuggingHelper(QFutureInterface<void> &futu success = false; } log(output, error); - if (!success) { + if (!success) return false; - } } future.setProgressValue(5); return true; diff --git a/src/plugins/qtsupport/qmldebugginglibrary.cpp b/src/plugins/qtsupport/qmldebugginglibrary.cpp index 3d3bc3cc34..11f6369066 100644 --- a/src/plugins/qtsupport/qmldebugginglibrary.cpp +++ b/src/plugins/qtsupport/qmldebugginglibrary.cpp @@ -100,11 +100,10 @@ QString QmlDebuggingLibrary::copy(const QString &qtInstallData, QString *errorMe // Try to find a writeable directory. foreach (const QString &directory, directories) { - if (!mkpath(directory, errorMessage)) { + if (!mkpath(directory, errorMessage)) continue; - } else { + else errorMessage->clear(); - } if (copyFiles(sourcePath(), sourceFileNames(), directory, errorMessage)) @@ -124,9 +123,8 @@ QStringList QmlDebuggingLibrary::recursiveFileList(const QDir &dir, const QStrin QStringList files; QString _prefix = prefix; - if (!_prefix.isEmpty() && !_prefix.endsWith(QLatin1Char('/'))) { + if (!_prefix.isEmpty() && !_prefix.endsWith(QLatin1Char('/'))) _prefix = _prefix + QLatin1Char('/'); - } foreach (const QString &fileName, dir.entryList(QDir::Files)) { files << _prefix + fileName; } diff --git a/src/plugins/qtsupport/qmldumptool.cpp b/src/plugins/qtsupport/qmldumptool.cpp index 488ed409d2..f7af7993e3 100644 --- a/src/plugins/qtsupport/qmldumptool.cpp +++ b/src/plugins/qtsupport/qmldumptool.cpp @@ -121,9 +121,8 @@ private slots: } } - if (m_failed) { + if (m_failed) qWarning("%s", qPrintable(errorMessage)); - } // update qmldump path for all the project QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance(); @@ -295,9 +294,8 @@ QString QmlDumpTool::copy(const QString &qtInstallData, QString *errorMessage) // Try to find a writeable directory. foreach (const QString &directory, directories) { - if (copyFiles(sourcePath(), sourceFileNames(), directory, errorMessage)) { + if (copyFiles(sourcePath(), sourceFileNames(), directory, errorMessage)) return directory; - } } *errorMessage = QCoreApplication::translate("ProjectExplorer::QmlDumpTool", "qmldump could not be built in any of the directories:\n- %1\n\nReason: %2") diff --git a/src/plugins/qtsupport/qtoptionspage.cpp b/src/plugins/qtsupport/qtoptionspage.cpp index 43c3f1b93b..8199bae5e7 100644 --- a/src/plugins/qtsupport/qtoptionspage.cpp +++ b/src/plugins/qtsupport/qtoptionspage.cpp @@ -800,11 +800,10 @@ void QtOptionsPageWidget::updateDebuggingHelperUi() gdbHelperText = QDir::toNativeSeparators(version->gdbDebuggingHelperLibrary()); gdbHelperTextFlags = Qt::TextSelectableByMouse; } else { - if (canBuildGdbHelper) { + if (canBuildGdbHelper) gdbHelperText = tr("<i>Not yet built.</i>"); - } else { + else gdbHelperText = tr("<i>Not needed.</i>"); - } } m_debuggingHelperUi->gdbHelperStatus->setText(gdbHelperText); m_debuggingHelperUi->gdbHelperStatus->setTextInteractionFlags(gdbHelperTextFlags); @@ -996,9 +995,8 @@ QTreeWidgetItem *QtOptionsPageWidget::treeItemForIndex(int index) const QTreeWidgetItem *toplevelItem = m_ui->qtdirList->topLevelItem(i); for (int j = 0; j < toplevelItem->childCount(); ++j) { QTreeWidgetItem *item = toplevelItem->child(j); - if (item->data(0, VersionIdRole).toInt() == uniqueId) { + if (item->data(0, VersionIdRole).toInt() == uniqueId) return item; - } } } return 0; diff --git a/src/plugins/remotelinux/remotelinuxpackageinstaller.cpp b/src/plugins/remotelinux/remotelinuxpackageinstaller.cpp index e321c12c4d..425a5fb256 100644 --- a/src/plugins/remotelinux/remotelinuxpackageinstaller.cpp +++ b/src/plugins/remotelinux/remotelinuxpackageinstaller.cpp @@ -104,13 +104,12 @@ void AbstractRemoteLinuxPackageInstaller::handleInstallationFinished(int exitSta if (!d->isRunning) return; - if (exitStatus != SshRemoteProcess::NormalExit || d->installer->processExitCode() != 0) { + if (exitStatus != SshRemoteProcess::NormalExit || d->installer->processExitCode() != 0) emit finished(tr("Installing package failed.")); - } else if (!errorString().isEmpty()) { + else if (!errorString().isEmpty()) emit finished(errorString()); - } else { + else emit finished(); - } setFinished(); } diff --git a/src/plugins/resourceeditor/qrceditor/qrceditor.cpp b/src/plugins/resourceeditor/qrceditor/qrceditor.cpp index 0044c4d198..484877fff8 100644 --- a/src/plugins/resourceeditor/qrceditor/qrceditor.cpp +++ b/src/plugins/resourceeditor/qrceditor/qrceditor.cpp @@ -287,9 +287,8 @@ void QrcEditor::resolveLocationIssues(QStringList &files) } // All paths fine -> no interaction needed - if (i == count) { + if (i == count) return; - } // Interact with user from now on ResolveLocationContext context; @@ -298,9 +297,8 @@ void QrcEditor::resolveLocationIssues(QStringList &files) // Path fine -> skip file QString const &file = *it; QString const relativePath = dir.relativeFilePath(file); - if (!relativePath.startsWith(dotdotSlash)) { + if (!relativePath.startsWith(dotdotSlash)) continue; - } // Path troublesome and aborted -> remove file bool ok = false; if (!abort) { diff --git a/src/plugins/resourceeditor/qrceditor/resourcefile.cpp b/src/plugins/resourceeditor/qrceditor/resourcefile.cpp index e28c7fafb5..d0183c6224 100644 --- a/src/plugins/resourceeditor/qrceditor/resourcefile.cpp +++ b/src/plugins/resourceeditor/qrceditor/resourcefile.cpp @@ -650,11 +650,10 @@ int ResourceModel::rowCount(const QModelIndex &parent) const Q_ASSERT(prefix); bool const isFileNode = (prefix != node); - if (isFileNode) { + if (isFileNode) return 0; - } else { + else return prefix->file_list.count(); - } } else { return m_resource_file.prefixCount(); } @@ -948,15 +947,13 @@ void ResourceModel::addFiles(int prefixIndex, const QStringList &fileNames, int firstFile = -1; lastFile = -1; - if (!prefix_model_idx.isValid()) { + if (!prefix_model_idx.isValid()) return; - } QStringList unique_list = existingFilesSubtracted(prefixIndex, fileNames); - if (unique_list.isEmpty()) { + if (unique_list.isEmpty()) return; - } const int cnt = m_resource_file.fileCount(prefixIndex); beginInsertRows(prefix_model_idx, cnt, cnt + unique_list.count() - 1); // ### FIXME diff --git a/src/plugins/resourceeditor/qrceditor/resourceview.cpp b/src/plugins/resourceeditor/qrceditor/resourceview.cpp index 1a51648c35..ca0ed51f7f 100644 --- a/src/plugins/resourceeditor/qrceditor/resourceview.cpp +++ b/src/plugins/resourceeditor/qrceditor/resourceview.cpp @@ -314,9 +314,8 @@ void ResourceView::addFiles(int prefixIndex, const QStringList &fileNames, int c // Expand prefix node const QModelIndex prefixModelIndex = m_qrcModel->index(prefixIndex, 0, QModelIndex()); - if (prefixModelIndex.isValid()) { + if (prefixModelIndex.isValid()) this->setExpanded(prefixModelIndex, true); - } } void ResourceView::removeFiles(int prefixIndex, int firstFileIndex, int lastFileIndex) diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index 90fa24b334..c636964973 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -681,11 +681,10 @@ void SubversionPlugin::revertAll() const SubversionResponse revertResponse = runSvn(state.topLevel(), args, m_settings.timeOutMS(), SshPasswordPrompt|ShowStdOutInLogWindow); - if (revertResponse.error) { + if (revertResponse.error) QMessageBox::warning(0, title, tr("Revert failed: %1").arg(revertResponse.message), QMessageBox::Ok); - } else { + else subVersionControl()->emitRepositoryChanged(state.topLevel()); - } } void SubversionPlugin::revertCurrentFile() @@ -718,9 +717,8 @@ void SubversionPlugin::revertCurrentFile() runSvn(state.currentFileTopLevel(), args, m_settings.timeOutMS(), SshPasswordPrompt|ShowStdOutInLogWindow); - if (!revertResponse.error) { + if (!revertResponse.error) subVersionControl()->emitFilesChanged(QStringList(state.currentFile())); - } } void SubversionPlugin::diffProject() diff --git a/src/plugins/texteditor/basefilefind.cpp b/src/plugins/texteditor/basefilefind.cpp index bc64ea484d..1364d0a549 100644 --- a/src/plugins/texteditor/basefilefind.cpp +++ b/src/plugins/texteditor/basefilefind.cpp @@ -104,9 +104,8 @@ QStringList BaseFileFind::fileNameFilters() const const QStringList parts = m_filterCombo->currentText().split(QLatin1Char(',')); foreach (const QString &part, parts) { const QString filter = part.trimmed(); - if (!filter.isEmpty()) { + if (!filter.isEmpty()) filters << filter; - } } } return filters; @@ -280,11 +279,10 @@ void BaseFileFind::updateComboEntries(QComboBox *combo, bool onTop) { int index = combo->findText(combo->currentText()); if (index < 0) { - if (onTop) { + if (onTop) combo->insertItem(0, combo->currentText()); - } else { + else combo->addItem(combo->currentText()); - } combo->setCurrentIndex(combo->findText(combo->currentText())); } } diff --git a/src/plugins/texteditor/basetextdocumentlayout.cpp b/src/plugins/texteditor/basetextdocumentlayout.cpp index 53826856cb..a976e0c7c5 100644 --- a/src/plugins/texteditor/basetextdocumentlayout.cpp +++ b/src/plugins/texteditor/basetextdocumentlayout.cpp @@ -395,9 +395,8 @@ bool TextBlockUserData::findPreviousBlockOpenParenthesis(QTextCursor *cursor, bo if (block == cursor->block()) { if (position - block.position() <= paren.pos + (paren.type == Parenthesis::Closed ? 1 : 0)) continue; - if (checkStartPosition && paren.type == Parenthesis::Opened && paren.pos== cursor->position()) { + if (checkStartPosition && paren.type == Parenthesis::Opened && paren.pos== cursor->position()) return true; - } } if (paren.type == Parenthesis::Closed) { ++ignore; diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index a423fc3dfb..ac8f76eb93 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -301,9 +301,8 @@ void BaseTextEditorWidget::print(QPrinter *printer) printer->setFullPage(true); QPrintDialog *dlg = new QPrintDialog(printer, this); dlg->setWindowTitle(tr("Print Document")); - if (dlg->exec() == QDialog::Accepted) { + if (dlg->exec() == QDialog::Accepted) d->print(printer); - } printer->setFullPage(oldFullPage); delete dlg; } @@ -1411,12 +1410,10 @@ 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) { op = QTextCursor::Right; mode = QTextCursor::KeepAnchor; @@ -1524,13 +1521,12 @@ bool BaseTextEditorWidget::cursorMoveKeyEvent(QKeyEvent *e) bool visualNavigation = cursor.visualNavigation(); cursor.setVisualNavigation(true); - if (camelCaseNavigationEnabled() && op == QTextCursor::WordRight) { + if (camelCaseNavigationEnabled() && op == QTextCursor::WordRight) camelCaseRight(cursor, mode); - } else if (camelCaseNavigationEnabled() && op == QTextCursor::WordLeft) { + else if (camelCaseNavigationEnabled() && op == QTextCursor::WordLeft) camelCaseLeft(cursor, mode); - } else if (!cursor.movePosition(op, mode) && mode == QTextCursor::MoveAnchor) { + else if (!cursor.movePosition(op, mode) && mode == QTextCursor::MoveAnchor) cursor.clearSelection(); - } cursor.setVisualNavigation(visualNavigation); setTextCursor(cursor); @@ -1968,11 +1964,10 @@ void BaseTextEditorWidget::insertCodeSnippet(const QTextCursor &cursor_arg, cons int cursorPosition = cursor.position(); cursor.insertText(textToInsert); - if (textToInsert.isEmpty()) { + if (textToInsert.isEmpty()) positions.insert(cursorPosition, 0); - } else { + else positions.insert(cursorPosition, textToInsert.length()); - } ++pos; } @@ -2813,11 +2808,10 @@ QString BaseTextEditorWidgetPrivate::copyBlockSelection() if (endOffset < 0) --endPos; selection += text.mid(startPos, endPos - startPos); - if (endOffset < 0) { + if (endOffset < 0) selection += QString(ts.m_tabSize + endOffset, QLatin1Char(' ')); - } else if (endOffset > 0) { + else if (endOffset > 0) selection += QString(endOffset, QLatin1Char(' ')); - } } if (block == lastBlock) break; @@ -3144,9 +3138,8 @@ void BaseTextEditorWidget::paintEvent(QPaintEvent *e) QRectF rr = line.naturalTextRect(); rr.moveTop(rr.top() + r.top()); rr.setLeft(r.left() + x); - if (line.lineNumber() == eline.lineNumber()) { + if (line.lineNumber() == eline.lineNumber()) rr.setRight(r.left() + ex); - } painter.fillRect(rr, d->m_searchScopeFormat.background()); QColor lineCol = d->m_searchScopeFormat.foreground().color(); @@ -3298,9 +3291,8 @@ void BaseTextEditorWidget::paintEvent(QPaintEvent *e) QRectF rr = line.naturalTextRect(); rr.moveTop(rr.top() + r.top()); rr.setLeft(r.left() + x); - if (line.lineNumber() == eline.lineNumber()) { + if (line.lineNumber() == eline.lineNumber()) rr.setRight(r.left() + ex); - } painter.fillRect(rr, palette().highlight()); if ((d->m_blockSelection.anchor == BaseTextBlockSelection::TopLeft && block == d->m_blockSelection.firstBlock.block()) @@ -3976,11 +3968,10 @@ void BaseTextEditorWidget::slotModificationChanged(bool m) if (oldLastSaveRevision != documentLayout->lastSaveRevision) { QTextBlock block = doc->begin(); while (block.isValid()) { - if (block.revision() < 0 || block.revision() != oldLastSaveRevision) { + if (block.revision() < 0 || block.revision() != oldLastSaveRevision) block.setRevision(-documentLayout->lastSaveRevision - 1); - } else { + else block.setRevision(documentLayout->lastSaveRevision); - } block = block.next(); } } @@ -4069,9 +4060,8 @@ void BaseTextEditorWidget::updateHighlights() // when we uncheck "highlight matching parentheses" // we need clear current selection before viewport update // otherwise we get sticky highlighted parentheses - if (!d->m_displaySettings.m_highlightMatchingParentheses) { + if (!d->m_displaySettings.m_highlightMatchingParentheses) setExtraSelections(ParenthesesMatchingSelection, QList<QTextEdit::ExtraSelection>()); - } // use 0-timer, not direct call, to give the syntax highlighter a chance // to update the parentheses information @@ -4201,9 +4191,8 @@ void BaseTextEditorWidget::mouseMoveEvent(QMouseEvent *e) // get visual column int column = tabSettings().columnAt(cursor.block().text(), cursor.positionInBlock()); - if (cursor.positionInBlock() == cursor.block().length()-1) { + if (cursor.positionInBlock() == cursor.block().length()-1) column += (e->pos().x() - cursorRect().center().x())/QFontMetricsF(font()).width(QLatin1Char(' ')); - } d->m_blockSelection.moveAnchor(cursor.blockNumber(), column); setTextCursor(d->m_blockSelection.selection(tabSettings())); viewport()->update(); @@ -5433,11 +5422,10 @@ void BaseTextEditorWidget::setIfdefedOutBlocks(const QList<BaseTextEditorWidget: bool set = false; if (rangeNumber < blocks.size()) { const BlockRange &range = blocks.at(rangeNumber); - if (block.position() >= range.first && ((block.position() + block.length() - 1) <= range.last || !range.last)) { + if (block.position() >= range.first && ((block.position() + block.length() - 1) <= range.last || !range.last)) set = BaseTextDocumentLayout::setIfdefedOut(block); - } else { + else cleared = BaseTextDocumentLayout::clearIfdefedOut(block); - } if (block.contains(range.last)) ++rangeNumber; } else { @@ -5864,9 +5852,8 @@ void BaseTextEditorWidget::copy() void BaseTextEditorWidget::paste() { - if (d->m_inBlockSelectionMode) { + if (d->m_inBlockSelectionMode) d->removeBlockSelection(); - } QPlainTextEdit::paste(); } diff --git a/src/plugins/texteditor/basetextmark.cpp b/src/plugins/texteditor/basetextmark.cpp index cdbff2d87f..ac71710ea8 100644 --- a/src/plugins/texteditor/basetextmark.cpp +++ b/src/plugins/texteditor/basetextmark.cpp @@ -61,9 +61,8 @@ void BaseTextMarkRegistry::add(BaseTextMark *mark) foreach (Core::IEditor *editor, em->editorsForFileName(mark->fileName())) { if (ITextEditor *textEditor = qobject_cast<ITextEditor *>(editor)) { ITextMarkable *markableInterface = textEditor->markableInterface(); - if (markableInterface->addMark(mark)) { + if (markableInterface->addMark(mark)) break; - } } } } diff --git a/src/plugins/texteditor/codeassist/basicproposalitemlistmodel.cpp b/src/plugins/texteditor/codeassist/basicproposalitemlistmodel.cpp index 3954ad48eb..68bbfbe2d6 100644 --- a/src/plugins/texteditor/codeassist/basicproposalitemlistmodel.cpp +++ b/src/plugins/texteditor/codeassist/basicproposalitemlistmodel.cpp @@ -232,11 +232,10 @@ void BasicProposalItemListModel::filter(const QString &prefix) keyRegExp += QLatin1Char(')'); } else { if (!first) { - if (c.isUpper()) { + if (c.isUpper()) keyRegExp += uppercaseWordContinuation; - } else { + else keyRegExp += lowercaseWordContinuation; - } } keyRegExp += QRegExp::escape(c); } diff --git a/src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp b/src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp index cc5a8a2b84..5bdbee06b0 100644 --- a/src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp +++ b/src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp @@ -192,14 +192,12 @@ bool FunctionHintProposalWidget::eventFilter(QObject *obj, QEvent *e) { switch (e->type()) { case QEvent::ShortcutOverride: - if (static_cast<QKeyEvent*>(e)->key() == Qt::Key_Escape) { + if (static_cast<QKeyEvent*>(e)->key() == Qt::Key_Escape) d->m_escapePressed = true; - } break; case QEvent::KeyPress: - if (static_cast<QKeyEvent*>(e)->key() == Qt::Key_Escape) { + if (static_cast<QKeyEvent*>(e)->key() == Qt::Key_Escape) d->m_escapePressed = true; - } if (d->m_model->size() > 1) { QKeyEvent *ke = static_cast<QKeyEvent*>(e); if (ke->key() == Qt::Key_Up) { @@ -221,9 +219,8 @@ bool FunctionHintProposalWidget::eventFilter(QObject *obj, QEvent *e) break; case QEvent::WindowDeactivate: case QEvent::FocusOut: - if (obj != d->m_underlyingWidget) { + if (obj != d->m_underlyingWidget) break; - } abort(); break; case QEvent::MouseButtonPress: @@ -234,11 +231,10 @@ bool FunctionHintProposalWidget::eventFilter(QObject *obj, QEvent *e) if (!d->m_popupFrame->isAncestorOf(widget)) { abort(); } else if (e->type() == QEvent::Wheel) { - if (static_cast<QWheelEvent*>(e)->delta() > 0) { + if (static_cast<QWheelEvent*>(e)->delta() > 0) previousPage(); - } else { + else nextPage(); - } return true; } } diff --git a/src/plugins/texteditor/codeassist/genericproposalwidget.cpp b/src/plugins/texteditor/codeassist/genericproposalwidget.cpp index 07c52597b6..2a58eb93bd 100644 --- a/src/plugins/texteditor/codeassist/genericproposalwidget.cpp +++ b/src/plugins/texteditor/codeassist/genericproposalwidget.cpp @@ -136,13 +136,12 @@ QVariant ModelAdapter::data(const QModelIndex &index, int role) const if (index.row() >= m_completionModel->size()) return QVariant(); - if (role == Qt::DisplayRole) { + if (role == Qt::DisplayRole) return m_completionModel->text(index.row()); - } else if (role == Qt::DecorationRole) { + else if (role == Qt::DecorationRole) return m_completionModel->icon(index.row()); - } else if (role == Qt::WhatsThisRole) { + else if (role == Qt::WhatsThisRole) return m_completionModel->detail(index.row()); - } return QVariant(); } diff --git a/src/plugins/texteditor/codeassist/keywordscompletionassist.cpp b/src/plugins/texteditor/codeassist/keywordscompletionassist.cpp index 3fda0de0f2..096efdb3a4 100644 --- a/src/plugins/texteditor/codeassist/keywordscompletionassist.cpp +++ b/src/plugins/texteditor/codeassist/keywordscompletionassist.cpp @@ -232,9 +232,8 @@ int KeywordsCompletionAssistProcessor::findStartOfName(int pos) pos = m_interface->position(); QChar chr = m_interface->characterAt(pos-1); - if (chr == QLatin1Char('(')) { + if (chr == QLatin1Char('(')) --pos; - } // Skip to the start of a name do { chr = m_interface->characterAt(--pos); diff --git a/src/plugins/texteditor/fontsettingspage.cpp b/src/plugins/texteditor/fontsettingspage.cpp index 9d17286cf5..69a02ba73d 100644 --- a/src/plugins/texteditor/fontsettingspage.cpp +++ b/src/plugins/texteditor/fontsettingspage.cpp @@ -248,18 +248,16 @@ QColor FormatDescription::foreground() const { if (m_id == C_LINE_NUMBER) { const QColor bg = QApplication::palette().background().color(); - if (bg.value() < 128) { + if (bg.value() < 128) return QApplication::palette().foreground().color(); - } else { + else return QApplication::palette().dark().color(); - } } else if (m_id == C_CURRENT_LINE_NUMBER) { const QColor bg = QApplication::palette().background().color(); - if (bg.value() < 128) { + if (bg.value() < 128) return QApplication::palette().foreground().color(); - } else { + else return m_format.foreground(); - } } else if (m_id == C_OCCURRENCES_UNUSED) { return Qt::darkYellow; } else if (m_id == C_PARENTHESES) { diff --git a/src/plugins/texteditor/generichighlighter/highlightdefinitionhandler.cpp b/src/plugins/texteditor/generichighlighter/highlightdefinitionhandler.cpp index 55278dab8a..153bcda00c 100644 --- a/src/plugins/texteditor/generichighlighter/highlightdefinitionhandler.cpp +++ b/src/plugins/texteditor/generichighlighter/highlightdefinitionhandler.cpp @@ -135,55 +135,54 @@ bool HighlightDefinitionHandler::startElement(const QString &, const QString &qName, const QXmlAttributes &atts) { - if (qName == kList) { + if (qName == kList) listElementStarted(atts); - } else if (qName == kItem) { + else if (qName == kItem) itemElementStarted(); - } else if (qName == kContext) { + else if (qName == kContext) contextElementStarted(atts); - } else if (qName == kItemData) { + else if (qName == kItemData) itemDataElementStarted(atts); - } else if (qName == kComment) { + else if (qName == kComment) commentElementStarted(atts); - } else if (qName == kKeywords) { + else if (qName == kKeywords) keywordsElementStarted(atts); - } else if (qName == kFolding) { + else if (qName == kFolding) foldingElementStarted(atts); - } else if (qName == kDetectChar) { + else if (qName == kDetectChar) detectCharStarted(atts); - } else if (qName == kDetect2Chars) { + else if (qName == kDetect2Chars) detect2CharsStarted(atts); - } else if (qName == kAnyChar) { + else if (qName == kAnyChar) anyCharStarted(atts); - } else if (qName == kStringDetect) { + else if (qName == kStringDetect) stringDetectedStarted(atts); - } else if (qName == kRegExpr) { + else if (qName == kRegExpr) regExprStarted(atts); - } else if (qName == kKeyword) { + else if (qName == kKeyword) keywordStarted(atts); - } else if (qName == kInt) { + else if (qName == kInt) intStarted(atts); - } else if (qName == kFloat) { + else if (qName == kFloat) floatStarted(atts); - } else if (qName == kHlCOct) { + else if (qName == kHlCOct) hlCOctStarted(atts); - } else if (qName == kHlCHex) { + else if (qName == kHlCHex) hlCHexStarted(atts); - } else if (qName == kHlCStringChar) { + else if (qName == kHlCStringChar) hlCStringCharStarted(atts); - } else if (qName == kHlCChar) { + else if (qName == kHlCChar) hlCCharStarted(atts); - } else if (qName == kRangeDetect) { + else if (qName == kRangeDetect) rangeDetectStarted(atts); - } else if (qName == kLineContinue) { + else if (qName == kLineContinue) lineContinue(atts); - } else if (qName == kIncludeRules) { + else if (qName == kIncludeRules) includeRulesStarted(atts); - } else if (qName == kDetectSpaces) { + else if (qName == kDetectSpaces) detectSpacesStarted(atts); - } else if (qName == kDetectIdentifier) { + else if (qName == kDetectIdentifier) detectIdentifier(atts); - } return true; } diff --git a/src/plugins/texteditor/icodestylepreferences.cpp b/src/plugins/texteditor/icodestylepreferences.cpp index 850bb587d9..07ea52542e 100644 --- a/src/plugins/texteditor/icodestylepreferences.cpp +++ b/src/plugins/texteditor/icodestylepreferences.cpp @@ -114,9 +114,8 @@ void ICodeStylePreferences::setTabSettings(const TabSettings &settings) d->m_tabSettings = settings; emit tabSettingsChanged(d->m_tabSettings); - if (!currentDelegate()) { + if (!currentDelegate()) emit currentTabSettingsChanged(d->m_tabSettings); - } } TabSettings ICodeStylePreferences::tabSettings() const diff --git a/src/plugins/texteditor/outlinefactory.cpp b/src/plugins/texteditor/outlinefactory.cpp index a1e30b89da..17e958615a 100644 --- a/src/plugins/texteditor/outlinefactory.cpp +++ b/src/plugins/texteditor/outlinefactory.cpp @@ -106,9 +106,8 @@ void OutlineWidgetStack::restoreSettings(int position) const bool toggleSync = settings->value(outLineKey(position), true).toBool(); toggleSyncButton()->setChecked(toggleSync); - if (IOutlineWidget *outlineWidget = qobject_cast<IOutlineWidget*>(currentWidget())) { + if (IOutlineWidget *outlineWidget = qobject_cast<IOutlineWidget*>(currentWidget())) outlineWidget->restoreSettings(position); - } } void OutlineWidgetStack::saveSettings(int position) @@ -118,9 +117,8 @@ void OutlineWidgetStack::saveSettings(int position) QSettings *settings = Core::ICore::settings(); settings->setValue(outLineKey(position), toggleSyncButton()->isEnabled()); - if (IOutlineWidget *outlineWidget = qobject_cast<IOutlineWidget*>(currentWidget())) { + if (IOutlineWidget *outlineWidget = qobject_cast<IOutlineWidget*>(currentWidget())) outlineWidget->saveSettings(position); - } } bool OutlineWidgetStack::isCursorSynchronized() const diff --git a/src/plugins/texteditor/refactoroverlay.cpp b/src/plugins/texteditor/refactoroverlay.cpp index 59e54b5797..e00e4bf92f 100644 --- a/src/plugins/texteditor/refactoroverlay.cpp +++ b/src/plugins/texteditor/refactoroverlay.cpp @@ -53,9 +53,8 @@ void RefactorOverlay::paint(QPainter *painter, const QRect &clip) paintMarker(m_markers.at(i), painter, clip); } - if (BaseTextDocumentLayout *documentLayout = qobject_cast<BaseTextDocumentLayout*>(m_editor->document()->documentLayout())) { + if (BaseTextDocumentLayout *documentLayout = qobject_cast<BaseTextDocumentLayout*>(m_editor->document()->documentLayout())) documentLayout->setRequiredWidth(m_maxWidth); - } } diff --git a/src/plugins/texteditor/tabsettings.cpp b/src/plugins/texteditor/tabsettings.cpp index 95636a6290..8a449af71e 100644 --- a/src/plugins/texteditor/tabsettings.cpp +++ b/src/plugins/texteditor/tabsettings.cpp @@ -243,11 +243,10 @@ bool TabSettings::guessSpacesForTabs(const QTextBlock &_block) const if (!block.isValid() || block.length() == 0) continue; const QChar firstChar = doc->characterAt(block.position()); - if (firstChar == QLatin1Char(' ')) { + if (firstChar == QLatin1Char(' ')) return true; - } else if (firstChar == QLatin1Char('\t')) { + else if (firstChar == QLatin1Char('\t')) return false; - } } if (done) break; diff --git a/src/plugins/texteditor/texteditoractionhandler.cpp b/src/plugins/texteditor/texteditoractionhandler.cpp index 639ee5cc72..ed0db9c64b 100644 --- a/src/plugins/texteditor/texteditoractionhandler.cpp +++ b/src/plugins/texteditor/texteditoractionhandler.cpp @@ -512,9 +512,8 @@ void TextEditorActionHandler::updateActions(UpdateMode um) m_unfoldAllAction->setEnabled((m_optionalActions & UnCollapseAll)); m_visualizeWhitespaceAction->setChecked(m_currentEditor->displaySettings().m_visualizeWhitespace); - if (m_textWrappingAction) { + if (m_textWrappingAction) m_textWrappingAction->setChecked(m_currentEditor->displaySettings().m_textWrapping); - } updateRedoAction(); updateUndoAction(); @@ -538,9 +537,8 @@ void TextEditorActionHandler::updateCopyAction() const bool hasCopyableText = m_currentEditor && m_currentEditor->textCursor().hasSelection(); if (m_cutAction) m_cutAction->setEnabled(hasCopyableText && updateMode() == WriteMode); - if (m_copyAction) { + if (m_copyAction) m_copyAction->setEnabled(hasCopyableText); - } } void TextEditorActionHandler::gotoAction() diff --git a/src/plugins/texteditor/texteditoroverlay.cpp b/src/plugins/texteditor/texteditoroverlay.cpp index c52ee29ee6..c4dc6fc6be 100644 --- a/src/plugins/texteditor/texteditoroverlay.cpp +++ b/src/plugins/texteditor/texteditoroverlay.cpp @@ -91,9 +91,8 @@ void TextEditorOverlay::addOverlaySelection(int begin, int end, selection.m_cursor_begin = QTextCursor(document->docHandle(), begin); selection.m_cursor_end = QTextCursor(document->docHandle(), end); - if (overlaySelectionFlags & ExpandBegin) { + if (overlaySelectionFlags & ExpandBegin) selection.m_cursor_begin.setKeepPositionOnInsert(true); - } if (overlaySelectionFlags & LockSize) selection.m_fixedLength = (end - begin); diff --git a/src/plugins/texteditor/tooltip/tooltip.cpp b/src/plugins/texteditor/tooltip/tooltip.cpp index d4f2521860..0fd7690f38 100644 --- a/src/plugins/texteditor/tooltip/tooltip.cpp +++ b/src/plugins/texteditor/tooltip/tooltip.cpp @@ -242,9 +242,8 @@ bool ToolTip::eventFilter(QObject *o, QEvent *event) } #endif case QEvent::Leave: - if (o == m_tip) { + if (o == m_tip) hideTipWithDelay(); - } break; case QEvent::Enter: // User moved cursor into tip and wants to interact. @@ -266,9 +265,8 @@ bool ToolTip::eventFilter(QObject *o, QEvent *event) case QEvent::Wheel: if (m_tip) { if (m_tip->isInteractive()) { // Do not close on interaction with the tooltip - if (o != m_tip && !m_tip->isAncestorOf(static_cast<QWidget *>(o))) { + if (o != m_tip && !m_tip->isAncestorOf(static_cast<QWidget *>(o))) hideTipImmediately(); - } } else { hideTipImmediately(); } diff --git a/src/plugins/updateinfo/updateinfoplugin.cpp b/src/plugins/updateinfo/updateinfoplugin.cpp index d6d13cc4cf..45dbfa7e7a 100644 --- a/src/plugins/updateinfo/updateinfoplugin.cpp +++ b/src/plugins/updateinfo/updateinfoplugin.cpp @@ -98,9 +98,8 @@ UpdateInfoPlugin::~UpdateInfoPlugin() void UpdateInfoPlugin::startCheckTimer(uint milliseconds) { - if (d->currentTimerId != 0) { + if (d->currentTimerId != 0) stopCurrentCheckTimer(); - } d->currentTimerId = startTimer(milliseconds); } @@ -150,9 +149,8 @@ bool UpdateInfoPlugin::initialize(const QStringList & /* arguments */, QString * QDomDocument UpdateInfoPlugin::checkForUpdates() { - if (QThread::currentThread() == QCoreApplication::instance()->thread()) { + if (QThread::currentThread() == QCoreApplication::instance()->thread()) qWarning() << Q_FUNC_INFO << " Was not designed to run in main/gui thread -> it is using updaterProcess.waitForFinished()"; - } //starting QProcess updaterProcess; @@ -203,9 +201,8 @@ void UpdateInfoPlugin::reactOnUpdaterOutput() void UpdateInfoPlugin::startUpdaterUiApplication() { QProcess::startDetached(d->updaterProgram, QStringList() << d->updaterRunUiArgument); - if (!d->updateInfoProgress.isNull()) { + if (!d->updateInfoProgress.isNull()) d->updateInfoProgress->setKeepOnFinish(Core::FutureProgress::HideOnFinish); //this is fading out the last updateinfo - } startCheckTimer(OneMinute); } diff --git a/src/plugins/valgrind/callgrind/callgrindcallmodel.cpp b/src/plugins/valgrind/callgrind/callgrindcallmodel.cpp index 6e299bc931..eececba9dc 100644 --- a/src/plugins/valgrind/callgrind/callgrindcallmodel.cpp +++ b/src/plugins/valgrind/callgrind/callgrindcallmodel.cpp @@ -188,9 +188,8 @@ QVariant CallModel::data(const QModelIndex &index, int role) const return parentCost; } - if (role == FunctionCallRole) { + if (role == FunctionCallRole) return QVariant::fromValue(call); - } if (role == RelativeTotalCostRole) { const quint64 totalCost = d->m_data->totalCost(d->m_event); diff --git a/src/plugins/valgrind/callgrind/callgrinddatamodel.cpp b/src/plugins/valgrind/callgrind/callgrinddatamodel.cpp index b9a0979ee8..3193ec2e90 100644 --- a/src/plugins/valgrind/callgrind/callgrinddatamodel.cpp +++ b/src/plugins/valgrind/callgrind/callgrinddatamodel.cpp @@ -312,9 +312,8 @@ QVariant DataModel::data(const QModelIndex &index, int role) const return ret; } - if (role == FunctionRole) { + if (role == FunctionRole) return QVariant::fromValue(func); - } if (role == ParentCostRole) { const quint64 totalCost = d->m_data->totalCost(d->m_event); @@ -326,18 +325,15 @@ QVariant DataModel::data(const QModelIndex &index, int role) const const quint64 totalCost = d->m_data->totalCost(d->m_event); if (index.column() == SelfCostColumn) return double(func->selfCost(d->m_event)) / totalCost; - if (index.column() == InclusiveCostColumn) { + if (index.column() == InclusiveCostColumn) return double(func->inclusiveCost(d->m_event)) / totalCost; - } } - if (role == LineNumberRole) { + if (role == LineNumberRole) return func->lineNumber(); - } - if (role == FileNameRole) { + if (role == FileNameRole) return func->file(); - } if (role == Qt::TextAlignmentRole) { if (index.column() == CalledColumn) diff --git a/src/plugins/valgrind/callgrind/callgrindfunction.cpp b/src/plugins/valgrind/callgrind/callgrindfunction.cpp index e91610d71a..50fd33bbba 100644 --- a/src/plugins/valgrind/callgrind/callgrindfunction.cpp +++ b/src/plugins/valgrind/callgrind/callgrindfunction.cpp @@ -201,9 +201,8 @@ QString Function::location() const if (!f.isEmpty()) { QFileInfo info(f); - if (info.exists()) { + if (info.exists()) f = info.canonicalFilePath(); - } } QString o = object(); @@ -287,11 +286,10 @@ void Function::addCostItem(const CostItem *item) d->m_costItems.append(item); // accumulate costs - if (item->call()) { + if (item->call()) d->accumulateCost(d->m_inclusiveCost, item->costs()); - } else { + else d->accumulateCost(d->m_selfCost, item->costs()); - } } void Function::finalize() diff --git a/src/plugins/valgrind/callgrind/callgrindparsedata.cpp b/src/plugins/valgrind/callgrind/callgrindparsedata.cpp index c8db1fe1f7..1cae230073 100644 --- a/src/plugins/valgrind/callgrind/callgrindparsedata.cpp +++ b/src/plugins/valgrind/callgrind/callgrindparsedata.cpp @@ -137,9 +137,8 @@ void ParseData::Private::addCompressedString(NameLookupTable &lookup, const QStr void ParseData::Private::cycleDetection() { - if (m_cycleCacheValid) { + if (m_cycleCacheValid) return; - } cleanupFunctionCycles(); Internal::CycleDetection algorithm(m_q); m_cycleCache = algorithm.run(m_functions); diff --git a/src/plugins/valgrind/callgrind/callgrindparser.cpp b/src/plugins/valgrind/callgrind/callgrindparser.cpp index 219068490e..1a4f76c783 100644 --- a/src/plugins/valgrind/callgrind/callgrindparser.cpp +++ b/src/plugins/valgrind/callgrind/callgrindparser.cpp @@ -537,9 +537,8 @@ void Parser::Private::parseCostItem(const char *begin, const char *end) skipSpace(¤t, end); } - if (call) { + if (call) call->setCosts(costItem->costs()); - } currentFunction->addCostItem(costItem); } diff --git a/src/plugins/valgrind/callgrind/callgrindproxymodel.cpp b/src/plugins/valgrind/callgrind/callgrindproxymodel.cpp index 79ce7d7fd6..51fa38ae68 100644 --- a/src/plugins/valgrind/callgrind/callgrindproxymodel.cpp +++ b/src/plugins/valgrind/callgrind/callgrindproxymodel.cpp @@ -116,9 +116,8 @@ bool DataProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_ return false; // if the filter regexp is a non-empty string, ignore our filters - if (!filterRegExp().isEmpty()) { + if (!filterRegExp().isEmpty()) return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent); - } // check max rows if (m_maxRows > 0 && source_row > m_maxRows) @@ -141,9 +140,8 @@ bool DataProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_ break; } } - if (!isValid) { + if (!isValid) return false; - } } // check minimum inclusive costs diff --git a/src/plugins/valgrind/callgrindvisualisation.cpp b/src/plugins/valgrind/callgrindvisualisation.cpp index ffdbaf3579..9f4d69b51d 100644 --- a/src/plugins/valgrind/callgrindvisualisation.cpp +++ b/src/plugins/valgrind/callgrindvisualisation.cpp @@ -256,9 +256,8 @@ void Visualisation::Private::handleMousePressEvent(QMouseEvent *event, if (itemAtPos) { const Function *func = q->functionForItem(itemAtPos); - if (doubleClicked) { + if (doubleClicked) q->functionActivated(func); - } else { q->scene()->clearSelection(); itemAtPos->setSelected(true); diff --git a/src/plugins/valgrind/memcheckerrorview.cpp b/src/plugins/valgrind/memcheckerrorview.cpp index 212afe30bc..c9664474c4 100644 --- a/src/plugins/valgrind/memcheckerrorview.cpp +++ b/src/plugins/valgrind/memcheckerrorview.cpp @@ -414,9 +414,8 @@ void MemcheckErrorDelegate::copy() const QString relativeTo = relativeToPath(); foreach (const Stack &stack, error.stacks()) { - if (!stack.auxWhat().isEmpty()) { + if (!stack.auxWhat().isEmpty()) stream << stack.auxWhat(); - } int i = 1; foreach (const Frame &frame, stack.frames()) { stream << " " << i++ << ": " << makeFrameName(frame, relativeTo) << "\n"; diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp index 0e034948d1..2dac9b91cb 100644 --- a/src/plugins/valgrind/memchecktool.cpp +++ b/src/plugins/valgrind/memchecktool.cpp @@ -231,9 +231,8 @@ void MemcheckTool::maybeActiveRunConfigurationChanged() ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance(); if (ProjectExplorer::Project *project = pe->startupProject()) { if (ProjectExplorer::Target *target = project->activeTarget()) { - if (ProjectExplorer::RunConfiguration *rc = target->activeRunConfiguration()) { + if (ProjectExplorer::RunConfiguration *rc = target->activeRunConfiguration()) settings = rc->extraAspect<AnalyzerRunConfigurationAspect>(); - } } } diff --git a/src/plugins/valgrind/valgrindengine.cpp b/src/plugins/valgrind/valgrindengine.cpp index 77e5fd2e60..0a12c66fde 100644 --- a/src/plugins/valgrind/valgrindengine.cpp +++ b/src/plugins/valgrind/valgrindengine.cpp @@ -171,11 +171,10 @@ void ValgrindEngine::receiveProcessError(const QString &error, QProcess::Process { if (e == QProcess::FailedToStart) { const QString &valgrind = m_settings->subConfig<ValgrindBaseSettings>()->valgrindExecutable(); - if (!valgrind.isEmpty()) { + if (!valgrind.isEmpty()) emit outputReceived(tr("** Error: \"%1\" could not be started: %2 **\n").arg(valgrind).arg(error), Utils::ErrorMessageFormat); - } else { + else emit outputReceived(tr("** Error: no valgrind executable set **\n"), Utils::ErrorMessageFormat); - } } else if (m_isStopping && e == QProcess::Crashed) { // process gets killed on stop emit outputReceived(tr("** Process Terminated **\n"), Utils::ErrorMessageFormat); } else { diff --git a/src/plugins/valgrind/xmlprotocol/error.cpp b/src/plugins/valgrind/xmlprotocol/error.cpp index 892b43dd0e..880facc8ef 100644 --- a/src/plugins/valgrind/xmlprotocol/error.cpp +++ b/src/plugins/valgrind/xmlprotocol/error.cpp @@ -224,29 +224,23 @@ QString Error::toXml() const } foreach (const Stack &stack, d->stacks) { - if (!stack.auxWhat().isEmpty()) { + if (!stack.auxWhat().isEmpty()) stream << " <auxwhat>" << stack.auxWhat() << "</auxwhat>\n"; - } stream << " <stack>\n"; foreach (const Frame &frame, stack.frames()) { stream << " <frame>\n"; stream << " <ip>0x" << QString::number(frame.instructionPointer(), 16) << "</ip>\n"; - if (!frame.object().isEmpty()) { + if (!frame.object().isEmpty()) stream << " <obj>" << frame.object() << "</obj>\n"; - } - if (!frame.functionName().isEmpty()) { + if (!frame.functionName().isEmpty()) stream << " <fn>" << frame.functionName() << "</fn>\n"; - } - if (!frame.directory().isEmpty()) { + if (!frame.directory().isEmpty()) stream << " <dir>" << frame.directory() << "</dir>\n"; - } - if (!frame.file().isEmpty()) { + if (!frame.file().isEmpty()) stream << " <file>" << frame.file() << "</file>\n"; - } - if (frame.line() != -1) { + if (frame.line() != -1) stream << " <line>" << frame.line() << "</line>"; - } stream << " </frame>\n"; } diff --git a/src/plugins/valgrind/xmlprotocol/parser.cpp b/src/plugins/valgrind/xmlprotocol/parser.cpp index 1ae3f004ce..f5bb533be6 100644 --- a/src/plugins/valgrind/xmlprotocol/parser.cpp +++ b/src/plugins/valgrind/xmlprotocol/parser.cpp @@ -221,9 +221,8 @@ QXmlStreamReader::TokenType Parser::Private::blockingReadNext() QIODevice *dev = reader.device(); QAbstractSocket *sock = qobject_cast<QAbstractSocket *>(dev); - if (!sock || sock->state() != QAbstractSocket::ConnectedState) { + if (!sock || sock->state() != QAbstractSocket::ConnectedState) throw ParserException(dev->errorString()); - } } } else if (reader.hasError()) { throw ParserException(reader.errorString()); //TODO add line, column? diff --git a/src/plugins/valgrind/xmlprotocol/suppression.cpp b/src/plugins/valgrind/xmlprotocol/suppression.cpp index 8bc770609f..5c3fa01a71 100644 --- a/src/plugins/valgrind/xmlprotocol/suppression.cpp +++ b/src/plugins/valgrind/xmlprotocol/suppression.cpp @@ -105,11 +105,10 @@ void SuppressionFrame::setObject(const QString &obj) QString SuppressionFrame::toString() const { - if (!d->fun.isEmpty()) { + if (!d->fun.isEmpty()) return QLatin1String("fun:") + d->fun; - } else { + else return QLatin1String("obj:") + d->obj; - } } class Suppression::Private : public QSharedData diff --git a/src/plugins/vcsbase/checkoutjobs.cpp b/src/plugins/vcsbase/checkoutjobs.cpp index 778487e924..82ce3a9905 100644 --- a/src/plugins/vcsbase/checkoutjobs.cpp +++ b/src/plugins/vcsbase/checkoutjobs.cpp @@ -162,11 +162,10 @@ void ProcessCheckoutJob::slotFinished (int exitCode, QProcess::ExitStatus exitSt switch (exitStatus) { case QProcess::NormalExit: emit output(tr("The process terminated with exit code %1.").arg(exitCode)); - if (exitCode == 0) { + if (exitCode == 0) slotNext(); - } else { + else emit failed(tr("The process returned exit code %1.").arg(exitCode)); - } break; case QProcess::CrashExit: emit failed(tr("The process terminated in an abnormal way.")); diff --git a/src/plugins/vcsbase/commonvcssettings.cpp b/src/plugins/vcsbase/commonvcssettings.cpp index 1eda0667ba..482cd4ed4d 100644 --- a/src/plugins/vcsbase/commonvcssettings.cpp +++ b/src/plugins/vcsbase/commonvcssettings.cpp @@ -79,11 +79,10 @@ void CommonVcsSettings::toSettings(QSettings *s) const s->setValue(QLatin1String(lineWrapWidthKeyC), lineWrapWidth); s->setValue(QLatin1String(patchCommandKeyC), patchCommand); // Do not store the default setting to avoid clobbering the environment. - if (sshPasswordPrompt != sshPasswordPromptDefault()) { + if (sshPasswordPrompt != sshPasswordPromptDefault()) s->setValue(QLatin1String(sshPasswordPromptKeyC), sshPasswordPrompt); - } else { + else s->remove(QLatin1String(sshPasswordPromptKeyC)); - } s->endGroup(); } diff --git a/src/plugins/vcsbase/submiteditorwidget.cpp b/src/plugins/vcsbase/submiteditorwidget.cpp index 0286402fae..e5b8ac7d1b 100644 --- a/src/plugins/vcsbase/submiteditorwidget.cpp +++ b/src/plugins/vcsbase/submiteditorwidget.cpp @@ -612,11 +612,10 @@ void SubmitEditorWidget::editorCustomContextMenuRequested(const QPoint &pos) // Extend foreach (const SubmitEditorWidgetPrivate::AdditionalContextMenuAction &a, d->descriptionEditContextMenuActions) { if (a.second) { - if (a.first >= 0) { + if (a.first >= 0) menu->insertAction(menu->actions().at(a.first), a.second); - } else { + else menu->addAction(a.second); - } } } menu->exec(d->m_ui.description->mapToGlobal(pos)); diff --git a/src/plugins/vcsbase/submitfieldwidget.cpp b/src/plugins/vcsbase/submitfieldwidget.cpp index 3bd9f004c9..170c2f5578 100644 --- a/src/plugins/vcsbase/submitfieldwidget.cpp +++ b/src/plugins/vcsbase/submitfieldwidget.cpp @@ -344,11 +344,10 @@ void SubmitFieldWidget::slotComboIndexChanged(int comboIndex) return; // Accept new index or reset combo to previous value? int &previousIndex = d->fieldEntries[pos].comboIndex; - if (comboIndexChange(pos, comboIndex)) { + if (comboIndexChange(pos, comboIndex)) previousIndex = comboIndex; - } else { + else setComboBlocked(d->fieldEntries.at(pos).combo, previousIndex); - } if (debug) qDebug() << '<' << Q_FUNC_INFO << pos; } diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp index 0a3e6b1f03..f9a0fff0c5 100644 --- a/src/plugins/vcsbase/vcsbaseeditor.cpp +++ b/src/plugins/vcsbase/vcsbaseeditor.cpp @@ -772,11 +772,10 @@ QTextCodec *VcsBaseEditorWidget::codec() const void VcsBaseEditorWidget::setCodec(QTextCodec *c) { - if (c) { + if (c) baseTextDocument()->setCodec(c); - } else { + else qWarning("%s: Attempt to set 0 codec.", Q_FUNC_INFO); - } } EditorContentType VcsBaseEditorWidget::contentType() const @@ -1113,9 +1112,8 @@ DiffChunk VcsBaseEditorWidget::diffChunk(QTextCursor cursor) const int chunkStart = 0; for ( ; block.isValid() ; block = block.previous()) { - if (checkChunkLine(block.text(), &chunkStart)) { + if (checkChunkLine(block.text(), &chunkStart)) break; - } } if (!chunkStart || !block.isValid()) return rc; @@ -1142,11 +1140,10 @@ DiffChunk VcsBaseEditorWidget::diffChunk(QTextCursor cursor) const void VcsBaseEditorWidget::setPlainTextData(const QByteArray &data) { - if (data.size() > Core::EditorManager::maxTextFileSize()) { + if (data.size() > Core::EditorManager::maxTextFileSize()) setPlainText(msgTextTooLarge(data.size())); - } else { + else setPlainText(codec()->toUnicode(data)); - } } void VcsBaseEditorWidget::setFontSettings(const TextEditor::FontSettings &fs) @@ -1455,11 +1452,10 @@ void VcsBaseEditorWidget::slotApplyDiffChunk() return; if (applyDiffChunk(chunkAction.chunk, chunkAction.revert)) { - if (chunkAction.revert) { + if (chunkAction.revert) emit diffChunkReverted(chunkAction.chunk); - } else { + else emit diffChunkApplied(chunkAction.chunk); - } } } diff --git a/src/plugins/vcsbase/vcsbaseplugin.cpp b/src/plugins/vcsbase/vcsbaseplugin.cpp index 5ba83ac0e4..21907765e8 100644 --- a/src/plugins/vcsbase/vcsbaseplugin.cpp +++ b/src/plugins/vcsbase/vcsbaseplugin.cpp @@ -282,9 +282,8 @@ void StateListener::slotStateChanged() &state.currentProjectTopLevel); if (projectControl) { // If we have both, let the file's one take preference - if (fileControl && projectControl != fileControl) { + if (fileControl && projectControl != fileControl) state.clearProject(); - } } else { state.clearProject(); // No control found } diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp index 69c3101f5a..c78c3de010 100644 --- a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp +++ b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp @@ -807,11 +807,10 @@ void VcsBaseSubmitEditor::filterUntrackedFilesOfProject(const QString &repositor const QDir repoDir(repositoryDirectory); for (QStringList::iterator it = untrackedFiles->begin(); it != untrackedFiles->end(); ) { const QString path = QDir::toNativeSeparators(repoDir.absoluteFilePath(*it)); - if (nativeProjectFiles.contains(path)) { + if (nativeProjectFiles.contains(path)) ++it; - } else { + else it = untrackedFiles->erase(it); - } } } diff --git a/src/plugins/welcome/welcomeplugin.cpp b/src/plugins/welcome/welcomeplugin.cpp index 604422b7db..a4fcf2c28e 100644 --- a/src/plugins/welcome/welcomeplugin.cpp +++ b/src/plugins/welcome/welcomeplugin.cpp @@ -308,11 +308,10 @@ void WelcomeMode::welcomePluginAdded(QObject *obj) if (pluginHash.contains(plugin->id())) { Utils::IWelcomePage* pluginOther = pluginHash.value(plugin->id()); - if (pluginOther->priority() > plugin->priority()) { + if (pluginOther->priority() > plugin->priority()) m_pluginList.removeAll(pluginOther); - } else { + else return; - } } int insertPos = 0; diff --git a/src/shared/help/bookmarkmanager.cpp b/src/shared/help/bookmarkmanager.cpp index acf52ce978..ab39f39aae 100644 --- a/src/shared/help/bookmarkmanager.cpp +++ b/src/shared/help/bookmarkmanager.cpp @@ -397,12 +397,10 @@ 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) { bookmarkManager->removeBookmarkItem(treeView, filterBookmarkModel->mapToSource(index)); @@ -674,11 +672,10 @@ QModelIndex BookmarkManager::addNewFolder(const QModelIndex& index) item->setData(QLatin1String("Folder"), Qt::UserRole + 10); item->setIcon(QApplication::style()->standardIcon(QStyle::SP_DirClosedIcon)); - if (index.isValid()) { + if (index.isValid()) treeModel->itemFromIndex(index)->appendRow(item); - } else { + else treeModel->appendRow(item); - } return treeModel->indexFromItem(item); } @@ -785,9 +782,8 @@ void BookmarkManager::setupBookmarkModels() } } parents.last()->appendRow(item); - if (type == QLatin1String("Folder")) { + if (type == QLatin1String("Folder")) parents << item; lastDepths << depth; - } } if (type != QLatin1String("Folder")) { diff --git a/src/shared/proparser/qmakebuiltins.cpp b/src/shared/proparser/qmakebuiltins.cpp index 1fe55265ca..2914ea786a 100644 --- a/src/shared/proparser/qmakebuiltins.cpp +++ b/src/shared/proparser/qmakebuiltins.cpp @@ -685,11 +685,10 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand( } break; case E_EVAL: - if (args.count() != 1) { + if (args.count() != 1) evalError(fL1S("eval(variable) requires one argument.")); - } else { + else ret += values(map(args.at(0))); - } break; case E_LIST: { QString tmp; @@ -1152,9 +1151,8 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( for (int i = configs.size() - 1; i >= 0; i--) { for (int mut = 0; mut < mutuals.count(); mut++) { - if (configs[i] == mutuals[mut].trimmed()) { + if (configs[i] == mutuals[mut].trimmed()) return returnBool(configs[i] == args[0]); - } } } return ReturnFalse; @@ -1413,9 +1411,8 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( } const QString &file = resolvePath(m_option->expandEnvVars(args.at(0).toQString(m_tmp1))); - if (IoUtils::exists(file)) { + if (IoUtils::exists(file)) return ReturnTrue; - } int slsh = file.lastIndexOf(QLatin1Char('/')); QString fn = file.mid(slsh+1); if (fn.contains(QLatin1Char('*')) || fn.contains(QLatin1Char('?'))) { diff --git a/src/shared/proparser/qmakeglobals.cpp b/src/shared/proparser/qmakeglobals.cpp index 1d5bd98fa6..3ec509a88e 100644 --- a/src/shared/proparser/qmakeglobals.cpp +++ b/src/shared/proparser/qmakeglobals.cpp @@ -152,29 +152,28 @@ QMakeGlobals::ArgumentReturn QMakeGlobals::addCommandLineArguments( break; default: if (arg.startsWith(QLatin1Char('-'))) { - if (arg == QLatin1String("-after")) { + if (arg == QLatin1String("-after")) state.after = true; - } else if (arg == QLatin1String("-config")) { + else if (arg == QLatin1String("-config")) argState = ArgConfig; - } else if (arg == QLatin1String("-nocache")) { + else if (arg == QLatin1String("-nocache")) do_cache = false; - } else if (arg == QLatin1String("-cache")) { + else if (arg == QLatin1String("-cache")) argState = ArgCache; - } else if (arg == QLatin1String("-platform") || arg == QLatin1String("-spec")) { + else if (arg == QLatin1String("-platform") || arg == QLatin1String("-spec")) argState = ArgSpec; - } else if (arg == QLatin1String("-xplatform") || arg == QLatin1String("-xspec")) { + else if (arg == QLatin1String("-xplatform") || arg == QLatin1String("-xspec")) argState = ArgXSpec; - } else if (arg == QLatin1String("-template") || arg == QLatin1String("-t")) { + else if (arg == QLatin1String("-template") || arg == QLatin1String("-t")) argState = ArgTmpl; - } else if (arg == QLatin1String("-template_prefix") || arg == QLatin1String("-tp")) { + else if (arg == QLatin1String("-template_prefix") || arg == QLatin1String("-tp")) argState = ArgTmplPfx; - } else if (arg == QLatin1String("-win32")) { + else if (arg == QLatin1String("-win32")) dir_sep = QLatin1Char('\\'); - } else if (arg == QLatin1String("-unix")) { + else if (arg == QLatin1String("-unix")) dir_sep = QLatin1Char('/'); - } else { + else return ArgumentUnknown; - } } else if (arg.contains(QLatin1Char('='))) { if (state.after) state.postcmds << arg; diff --git a/src/shared/proparser/qmakeparser.cpp b/src/shared/proparser/qmakeparser.cpp index 847039682a..eed6ebc39b 100644 --- a/src/shared/proparser/qmakeparser.cpp +++ b/src/shared/proparser/qmakeparser.cpp @@ -1145,11 +1145,10 @@ void QMakeParser::finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int arg uint nlen = uce[1]; if (uce[nlen + 2] == TokFuncTerminator) { m_tmp.setRawData((QChar *)uce + 2, nlen); - if (m_tmp == statics.strhost_build) { + if (m_tmp == statics.strhost_build) m_proFile->setHostBuild(true); - } else { + else parseError(fL1S("Unknown option() %1.").arg(m_tmp)); - } return; } } diff --git a/src/tools/cplusplus-update-frontend/cplusplus-update-frontend.cpp b/src/tools/cplusplus-update-frontend/cplusplus-update-frontend.cpp index 02369818fb..9a2331102a 100644 --- a/src/tools/cplusplus-update-frontend/cplusplus-update-frontend.cpp +++ b/src/tools/cplusplus-update-frontend/cplusplus-update-frontend.cpp @@ -276,9 +276,8 @@ protected: if (NamedType *namedTy = ptrTy->elementType()->asNamedType()) { QByteArray typeName = namedTy->name()->identifier()->chars(); - if (typeName.endsWith("AST") && memberName != "next") { + if (typeName.endsWith("AST") && memberName != "next") *out << " accept(" << memberName.constData() << ", visitor);" << endl; - } } } } @@ -286,9 +285,8 @@ protected: for (unsigned i = 0; i < klass->baseClassCount(); ++i) { const QByteArray baseClassName = klass->baseClassAt(i)->identifier()->chars(); - if (ClassSpecifierAST *baseClassSpec = classMap.value(baseClassName, 0)) { + if (ClassSpecifierAST *baseClassSpec = classMap.value(baseClassName, 0)) visitMembers(baseClassSpec->symbol); - } } } @@ -550,9 +548,8 @@ protected: for (unsigned i = 0; i < klass->baseClassCount(); ++i) { const QByteArray baseClassName = klass->baseClassAt(i)->identifier()->chars(); - if (ClassSpecifierAST *baseClassSpec = classMap.value(baseClassName, 0)) { + if (ClassSpecifierAST *baseClassSpec = classMap.value(baseClassName, 0)) visitMembers(baseClassSpec->symbol); - } } } @@ -693,9 +690,8 @@ protected: for (unsigned i = 0; i < klass->baseClassCount(); ++i) { const QByteArray baseClassName = klass->baseClassAt(i)->identifier()->chars(); - if (ClassSpecifierAST *baseClassSpec = classMap.value(baseClassName, 0)) { + if (ClassSpecifierAST *baseClassSpec = classMap.value(baseClassName, 0)) visitMembers(baseClassSpec->symbol); - } } } @@ -826,9 +822,8 @@ protected: for (unsigned i = 0; i < klass->baseClassCount(); ++i) { const QByteArray baseClassName = klass->baseClassAt(i)->identifier()->chars(); - if (ClassSpecifierAST *baseClassSpec = classMap.value(baseClassName, 0)) { + if (ClassSpecifierAST *baseClassSpec = classMap.value(baseClassName, 0)) visitMembers(baseClassSpec->symbol); - } } } @@ -1198,11 +1193,10 @@ void generateAST_cpp(const Snapshot &snapshot, const QDir &cplusplusDir) QTextStream os(&method); const QStringList fields = collectFieldNames(info.classAST, true); - if (info.firstToken) { + if (info.firstToken) generateFirstToken(os, className, fields); - } else if (info.lastToken) { + else if (info.lastToken) generateLastToken(os, className, fields); - } changes.replace(info.start, info.end, method); } diff --git a/src/tools/examplesscanner/helpextractor.cpp b/src/tools/examplesscanner/helpextractor.cpp index 3ce1b8d884..16ee318a33 100644 --- a/src/tools/examplesscanner/helpextractor.cpp +++ b/src/tools/examplesscanner/helpextractor.cpp @@ -242,11 +242,10 @@ QString HelpExtractor::loadDescription(const QString &name) int errorLine, errorColumn; QDomDocument exampleDoc; - if (ba.isEmpty()) { + if (ba.isEmpty()) qDebug() << "No documentation found for" << name << "Is the documentation built?"; - } else if (!exampleDoc.setContent(ba, false, &errorMsg, &errorLine, &errorColumn)) { + else if (!exampleDoc.setContent(ba, false, &errorMsg, &errorLine, &errorColumn)) qDebug() << "Error loading documentation for " << name << ": " << errorMsg << errorLine << errorColumn; - } QDomNodeList paragraphs = exampleDoc.elementsByTagName("p"); if (paragraphs.length() < 1) @@ -255,9 +254,8 @@ QString HelpExtractor::loadDescription(const QString &name) QString description = QLatin1String(""); for (int p = 0; p < int(paragraphs.length()); ++p) { description = extractTextFromParagraph(paragraphs.item(p)); - if (isSummaryOf(description, name)) { + if (isSummaryOf(description, name)) break; - } } return description; } diff --git a/src/tools/qmlprofilertool/qmlprofilerapplication.cpp b/src/tools/qmlprofilertool/qmlprofilerapplication.cpp index faa5233ef1..d264873e3e 100644 --- a/src/tools/qmlprofilertool/qmlprofilerapplication.cpp +++ b/src/tools/qmlprofilertool/qmlprofilerapplication.cpp @@ -123,15 +123,13 @@ bool QmlProfilerApplication::parseArguments() for (int argPos = 1; argPos < arguments().size(); ++argPos) { const QString arg = arguments().at(argPos); if (arg == QLatin1String("-attach") || arg == QLatin1String("-a")) { - if (argPos + 1 == arguments().size()) { + if (argPos + 1 == arguments().size()) return false; - } m_hostName = arguments().at(++argPos); m_runMode = AttachMode; } else if (arg == QLatin1String("-port") || arg == QLatin1String("-p")) { - if (argPos + 1 == arguments().size()) { + if (argPos + 1 == arguments().size()) return false; - } const QString portStr = arguments().at(++argPos); bool isNumber; m_port = portStr.toUShort(&isNumber); @@ -359,11 +357,10 @@ void QmlProfilerApplication::traceFinished() void QmlProfilerApplication::recordingChanged() { - if (m_qmlProfilerClient.isRecording()) { + if (m_qmlProfilerClient.isRecording()) print(QLatin1String("Recording is on.")); - } else { + else print(QLatin1String("Recording is off.")); - } } void QmlProfilerApplication::print(const QString &line) diff --git a/src/tools/qtcreatorwidgets/customwidgets.cpp b/src/tools/qtcreatorwidgets/customwidgets.cpp index c81cdf0622..1166517c46 100644 --- a/src/tools/qtcreatorwidgets/customwidgets.cpp +++ b/src/tools/qtcreatorwidgets/customwidgets.cpp @@ -303,11 +303,10 @@ DetailsWidgetContainerExtension::DetailsWidgetContainerExtension(Utils::DetailsW void DetailsWidgetContainerExtension::addWidget(QWidget *widget) { - if (m_detailsWidget->widget()) { + if (m_detailsWidget->widget()) qWarning("Cannot add 2nd child to DetailsWidget"); - } else { + else m_detailsWidget->setWidget(widget); - } } int DetailsWidgetContainerExtension::count() const diff --git a/src/tools/qtpromaker/main.cpp b/src/tools/qtpromaker/main.cpp index cac5a2b279..42c2db2259 100644 --- a/src/tools/qtpromaker/main.cpp +++ b/src/tools/qtpromaker/main.cpp @@ -399,9 +399,8 @@ int main(int argc, char *argv[]) paths.append("."); } - if (outputFileName.isEmpty()) { + if (outputFileName.isEmpty()) outputFileName = QDir(paths.at(0)).dirName() + '.' + proExtension; - } if (targetDepth == -1) targetDepth = 1000000; // "infinity" diff --git a/src/tools/sdktool/addqtoperation.cpp b/src/tools/sdktool/addqtoperation.cpp index c2443c741a..e5b0c74abe 100644 --- a/src/tools/sdktool/addqtoperation.cpp +++ b/src/tools/sdktool/addqtoperation.cpp @@ -131,21 +131,17 @@ bool AddQtOperation::setArguments(const QStringList &args) m_extra << pair; } - if (m_id.isEmpty()) { + if (m_id.isEmpty()) std::cerr << "Error no id was passed." << std::endl << std::endl; - } - if (m_displayName.isEmpty()) { + if (m_displayName.isEmpty()) std::cerr << "Error no display name was passed." << std::endl << std::endl; - } - if (m_qmake.isEmpty()) { + if (m_qmake.isEmpty()) std::cerr << "Error no qmake was passed." << std::endl << std::endl; - } - if (m_type.isEmpty()) { + if (m_type.isEmpty()) std::cerr << "Error no type was passed." << std::endl << std::endl; - } return !m_id.isEmpty() && !m_displayName.isEmpty() && !m_qmake.isEmpty() && !m_type.isEmpty(); } |