Fix coding style for else statements

Change-Id: I1309db70e98d678e150388c76ce665e988fdf081
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
Orgad Shaneh
2013-07-17 00:01:45 +03:00
committed by Orgad Shaneh
parent c67f7f6349
commit ad9e7ccab6
101 changed files with 331 additions and 470 deletions

View File

@@ -57,9 +57,9 @@ function build() {
if (nrButtons == 0)
return;
if (self.checkedButton)
if (self.checkedButton) {
self.checkedButton.checked = true;
else if (self.exclusive) {
} else if (self.exclusive) {
self.checkedButton = visibleButtons[0];
self.checkedButton.checked = true;
}

View File

@@ -3770,9 +3770,7 @@ void *qDumpObjectData440(
d.put(",namespace=\"" NS "\",");
d.put("dumperversion=\"1.3\",");
d.disarm();
}
else if (protocolVersion == 2 || protocolVersion == 3) {
} else if (protocolVersion == 2 || protocolVersion == 3) {
QDumper d;
d.protocolVersion = protocolVersion;
@@ -3796,9 +3794,7 @@ void *qDumpObjectData440(
<< d.outerType << d.iname << d.exp << d.iname;
#endif
handleProtocolVersion2and3(d);
}
else {
} else {
#if USE_QT_CORE
# ifndef QT_BOOTSTRAPPED
qDebug() << "Unsupported protocol version" << protocolVersion;

View File

@@ -257,9 +257,7 @@ void LiveSelectionTool::mouseReleaseEvent(QMouseEvent *event)
{
if (m_singleSelectionManipulator.isActive()) {
m_singleSelectionManipulator.end(event->pos());
}
else if (m_rubberbandSelectionManipulator.isActive()) {
} else if (m_rubberbandSelectionManipulator.isActive()) {
QPointF mouseMovementVector = m_rubberbandSelectionManipulator.beginPoint() - event->pos();
if (mouseMovementVector.toPoint().manhattanLength() < Constants::DragStartDistance) {
m_singleSelectionManipulator.begin(event->pos());

View File

@@ -84,8 +84,7 @@ QNetworkProxy ProxySettings::httpProxy ()
proxy.setUser (settings.value ("http_proxy/username", "").toString ());
proxy.setPassword (settings.value ("http_proxy/password", "").toString ());
//QNetworkProxy::setApplicationProxy (proxy);
}
else {
} else {
proxy.setType (QNetworkProxy::NoProxy);
}
return proxy;

View File

@@ -464,7 +464,8 @@ void NodeInstanceClientProxy::dispatchCommand(const QVariant &command)
else if (command.userType() == synchronizeCommandType) {
SynchronizeCommand synchronizeCommand = command.value<SynchronizeCommand>();
m_synchronizeId = synchronizeCommand.synchronizeId();
} else
} else {
Q_ASSERT(false);
}
}
} // namespace QmlDesigner

View File

@@ -38,9 +38,9 @@ AnimatedToolButton {
hoverIconFromFile: "images/submenu.png";
function setIcon() {
if (backendValue == null)
if (backendValue == null) {
extendedFunctionButton.iconFromFile = "images/placeholder.png"
else if (backendValue.isBound ) {
} else if (backendValue.isBound ) {
if (backendValue.isTranslated) { //translations are a special case
extendedFunctionButton.iconFromFile = "images/placeholder.png"
} else {

View File

@@ -400,12 +400,11 @@ int main(int argc, char **argv)
QNetworkProxy proxy(QNetworkProxy::HttpProxy, proxyUrl.host(),
proxyUrl.port(), proxyUrl.userName(), proxyUrl.password());
QNetworkProxy::setApplicationProxy(proxy);
}
# if defined(Q_OS_MAC) // unix and mac
else {
} else {
QNetworkProxyFactory::setUseSystemConfiguration(true);
}
# endif
}
#else // windows
QNetworkProxyFactory::setUseSystemConfiguration(true);
#endif

View File

@@ -129,9 +129,9 @@ public:
virtual void visit(NamedType *type)
{
FullySpecifiedType ty = rewrite->env->apply(type->name(), rewrite);
if (! ty->isUndefinedType())
if (! ty->isUndefinedType()) {
temps.append(ty);
else {
} else {
const Name *name = rewrite->rewriteName(type->name());
temps.append(control()->namedType(name));
}

View File

@@ -264,7 +264,7 @@ private:
if (! name)
return name;
else if (const Identifier *nameId = name->asNameId()) {
if (const Identifier *nameId = name->asNameId()) {
const Identifier *id = control()->identifier(nameId->chars(), nameId->size());
return id;

View File

@@ -263,19 +263,20 @@ int ExpressionUnderCursor::startOfFunctionCall(const QTextCursor &cursor) const
forever {
const Token &tk = scanner[index - 1];
if (tk.is(T_EOF_SYMBOL))
if (tk.is(T_EOF_SYMBOL)) {
break;
else if (tk.is(T_LPAREN))
} else if (tk.is(T_LPAREN)) {
return scanner.startPosition() + tk.begin();
else if (tk.is(T_RPAREN)) {
} else if (tk.is(T_RPAREN)) {
int matchingBrace = scanner.startOfMatchingBrace(index);
if (matchingBrace == index) // If no matching brace found
return -1;
index = matchingBrace;
} else
} else {
--index;
}
}
return -1;

View File

@@ -57,7 +57,7 @@ static void addNames(const Name *name, QList<const Name *> *names, bool addAllNa
{
if (! name)
return;
else if (const QualifiedNameId *q = name->asQualifiedNameId()) {
if (const QualifiedNameId *q = name->asQualifiedNameId()) {
addNames(q->base(), names);
addNames(q->name(), names, addAllNames);
} else if (addAllNames || name->isNameId() || name->isTemplateNameId() || name->isAnonymousNameId()) {
@@ -98,7 +98,7 @@ static inline bool compareName(const Name *name, const Name *other)
if (name == other)
return true;
else if (name && other) {
if (name && other) {
const Identifier *id = name->identifier();
const Identifier *otherId = other->identifier();
@@ -599,10 +599,9 @@ QList<LookupItem> ClassOrNamespace::lookup_helper(const Name *name, bool searchI
if (name) {
if (const QualifiedNameId *q = name->asQualifiedNameId()) {
if (! q->base()) // e.g. ::std::string
if (! q->base()) { // e.g. ::std::string
result = globalNamespace()->find(q->name());
else if (ClassOrNamespace *binding = lookupType(q->base())) {
} else if (ClassOrNamespace *binding = lookupType(q->base())) {
result = binding->find(q->name());
QList<const Name *> fullName;
@@ -864,7 +863,7 @@ ClassOrNamespace *ClassOrNamespace::lookupType_helper(const Name *name,
if (ClassOrNamespace *e = nestedType(name, origin))
return e;
else if (_templateId) {
if (_templateId) {
if (_usings.size() == 1) {
ClassOrNamespace *delegate = _usings.first();
@@ -1265,8 +1264,7 @@ bool ClassOrNamespace::NestedClassInstantiator::isInstantiateNestedClassNeeded(c
if (Declaration *declaration = memberAsSymbol->asDeclaration()) {
if (containsTemplateType(declaration))
return true;
}
else if (Function *function = memberAsSymbol->asFunction()) {
} else if (Function *function = memberAsSymbol->asFunction()) {
if (containsTemplateType(function))
return true;
}
@@ -1447,7 +1445,7 @@ void CreateBindings::process(Document::Ptr doc)
if (! doc)
return;
else if (Namespace *globalNamespace = doc->globalNamespace()) {
if (Namespace *globalNamespace = doc->globalNamespace()) {
if (! _processed.contains(globalNamespace)) {
_processed.insert(globalNamespace);

View File

@@ -244,7 +244,7 @@ QString MatchingText::insertParagraphSeparator(const QTextCursor &tc) const
if (current.is(T_EOF_SYMBOL))
break;
else if (current.is(T_CLASS) || current.is(T_STRUCT) || current.is(T_UNION) || current.is(T_ENUM)) {
if (current.is(T_CLASS) || current.is(T_STRUCT) || current.is(T_UNION) || current.is(T_ENUM)) {
// found a class key.
QString str = QLatin1String("};");

View File

@@ -170,8 +170,7 @@ bool Environment::isBuiltinMacro(const ByteArrayRef &s)
}
}
}
}
else if (s[2] == 'F') {
} else if (s[2] == 'F') {
if (s[3] == 'I') {
if (s[4] == 'L') {
if (s[5] == 'E') {
@@ -183,8 +182,7 @@ bool Environment::isBuiltinMacro(const ByteArrayRef &s)
}
}
}
}
else if (s[2] == 'L') {
} else if (s[2] == 'L') {
if (s[3] == 'I') {
if (s[4] == 'N') {
if (s[5] == 'E') {
@@ -196,8 +194,7 @@ bool Environment::isBuiltinMacro(const ByteArrayRef &s)
}
}
}
}
else if (s[2] == 'T') {
} else if (s[2] == 'T') {
if (s[3] == 'I') {
if (s[4] == 'M') {
if (s[5] == 'E') {

View File

@@ -576,16 +576,14 @@ bool ResolveExpression::visit(SimpleNameAST *ast)
if (n == 0) {
item.setType(newType);
item.setScope(typeItems[n].scope());
}
else {
} else {
LookupItem newItem(item);
newItem.setType(newType);
newItem.setScope(typeItems[n].scope());
newCandidates.push_back(newItem);
}
}
}
else {
} else {
item.setType(item.declaration()->type());
item.setScope(item.declaration()->enclosingScope());
}

View File

@@ -1862,12 +1862,11 @@ void Preprocessor::handleElseDirective(PPToken *tk, const PPToken &poundToken)
else if (m_client && !wasSkipping && startSkipping)
startSkippingBlocks(poundToken);
}
}
#ifndef NO_DEBUG
else {
} else {
std::cerr << "*** WARNING #else without #if" << std::endl;
}
#endif // NO_DEBUG
}
}
void Preprocessor::handleEndIfDirective(PPToken *tk, const PPToken &poundToken)
@@ -1930,12 +1929,11 @@ void Preprocessor::handleIfDefDirective(bool checkUndefined, PPToken *tk)
startSkippingBlocks(*tk);
lex(tk); // consume the identifier
}
#ifndef NO_DEBUG
else {
} else {
std::cerr << "*** WARNING #ifdef without identifier" << std::endl;
}
#endif // NO_DEBUG
}
}
void Preprocessor::handleUndefDirective(PPToken *tk)
@@ -1948,12 +1946,11 @@ void Preprocessor::handleUndefDirective(PPToken *tk)
if (m_client && macro)
m_client->macroAdded(*macro);
lex(tk); // consume macro name
}
#ifndef NO_DEBUG
else {
} else {
std::cerr << "*** WARNING #undef without identifier" << std::endl;
}
#endif // NO_DEBUG
}
}
PPToken Preprocessor::generateToken(enum Kind kind,

View File

@@ -259,13 +259,13 @@ const char *pp_skip_argument::operator () (const char *__first, const char *__la
lines = 0;
while (__first != __last) {
if (!depth && (*__first == ')' || *__first == ','))
if (!depth && (*__first == ')' || *__first == ',')) {
break;
else if (*__first == '(')
} else if (*__first == '(') {
++depth, ++__first;
else if (*__first == ')')
} else if (*__first == ')') {
--depth, ++__first;
else if (*__first == '\"') {
} else if (*__first == '\"') {
__first = skip_string_literal (__first, __last);
lines += skip_string_literal.lines;
} else if (*__first == '\'') {
@@ -283,8 +283,9 @@ const char *pp_skip_argument::operator () (const char *__first, const char *__la
} else if (*__first == '\n') {
++__first;
++lines;
} else
} else {
++__first;
}
}
return __first;

View File

@@ -1183,9 +1183,9 @@ void PluginManagerPrivate::readPluginPaths()
PluginCollection *collection = 0;
// find correct plugin collection or create a new one
if (pluginCategories.contains(spec->category()))
if (pluginCategories.contains(spec->category())) {
collection = pluginCategories.value(spec->category());
else {
} else {
collection = new PluginCollection(spec->category());
pluginCategories.insert(spec->category(), collection);
}

View File

@@ -109,9 +109,9 @@ QList<Symbol *> Namespace::members() const
void Namespace::add(Symbol *symbol)
{
Symbol *&sym = _members[symbol->name()];
if (! sym)
if (! sym) {
sym = symbol;
else if (Function *fun = symbol->asFunction()) {
} else if (Function *fun = symbol->asFunction()) {
if (OverloadSet *o = sym->asOverloadSet()) {
o->addFunction(fun);
} else if (Function *firstFunction = sym->asFunction()) {
@@ -121,8 +121,7 @@ void Namespace::add(Symbol *symbol)
o->addFunction(firstFunction);
o->addFunction(fun);
sym = o;
}
else {
} else {
// ### warning? return false?
}
} else {

View File

@@ -298,9 +298,9 @@ bool MatrixType::isLessThan(const Type *other) const
Q_ASSERT(other != 0);
const MatrixType *mat = other->asMatrixType();
Q_ASSERT(mat != 0);
if (_columns < mat->columns())
if (_columns < mat->columns()) {
return true;
else if (_columns == mat->columns()) {
} else if (_columns == mat->columns()) {
if (_rows < mat->rows())
return true;
else if (_rows == mat->rows() && _elementType < mat->elementType())

View File

@@ -228,9 +228,9 @@ void EasingContextPane::setGraphDisplayMode(GraphDisplayMode newMode)
void EasingContextPane::startAnimation()
{
if (m_simulation->running())
if (m_simulation->running()) {
m_simulation->stop();
else {
} else {
m_simulation->animate(ui->durationSpinBox->value(), m_easingGraph->easingCurve());
ui->playButton->setIcon(QIcon(QLatin1String(":/stopicon.png")));
}

View File

@@ -905,7 +905,7 @@ bool Lexer::scanRegExp(RegExpBodyPrefix prefix)
while (! _char.isNull() && ! isLineTerminator()) {
if (_char == QLatin1Char(']'))
break;
else if (_char == QLatin1Char('\\')) {
if (_char == QLatin1Char('\\')) {
// regular expression backslash sequence
_tokenText += _char;
scanChar();

View File

@@ -154,9 +154,9 @@ ObjectValue *Bind::bindObject(UiQualifiedId *qualifiedTypeNameId, UiObjectInitia
parentObjectValue = switchObjectValue(objectValue);
if (parentObjectValue)
if (parentObjectValue) {
objectValue->setMember(QLatin1String("parent"), parentObjectValue);
else if (!_rootObjectValue) {
} else if (!_rootObjectValue) {
_rootObjectValue = objectValue;
_rootObjectValue->setClassName(_doc->componentName());
}

View File

@@ -255,14 +255,13 @@ protected:
qreal result = badnessFromSplits;
foreach (const QString &line, lines) {
// really long lines should be avoided at all cost
if (line.size() > strongMaxLineLength)
if (line.size() > strongMaxLineLength) {
result += 50 + (line.size() - strongMaxLineLength);
// having long lines is bad
else if (line.size() > maxLineLength) {
} else if (line.size() > maxLineLength) {
result += 3 + (line.size() - maxLineLength);
}
// and even ok-sized lines should have a cost
else {
} else {
result += 1;
}

View File

@@ -282,9 +282,8 @@ void Rewriter::changeBinding(UiObjectInitializer *ast,
}
break;
}
// for grouped properties:
else if (!prefix.isEmpty()) {
} else if (!prefix.isEmpty()) {
if (UiObjectDefinition *def = cast<UiObjectDefinition *>(member)) {
if (toString(def->qualifiedTypeNameId) == prefix)
changeBinding(def->initializer, suffix, newValue, binding);
@@ -384,10 +383,10 @@ void Rewriter::removeBindingByName(UiObjectInitializer *ast, const QString &prop
UiObjectMember *member = it->member;
// run full name match (for ungrouped properties):
if (isMatchingPropertyMember(propertyName, member))
if (isMatchingPropertyMember(propertyName, member)) {
removeMember(member);
// check for grouped properties:
else if (!prefix.isEmpty()) {
} else if (!prefix.isEmpty()) {
if (UiObjectDefinition *def = cast<UiObjectDefinition *>(member)) {
if (toString(def->qualifiedTypeNameId) == prefix)
removeGroupedProperty(def, propertyName);

View File

@@ -80,10 +80,10 @@ void ScopeBuilder::push(AST::Node *node)
break;
}
// signals defined in QML
if (const ASTSignal *astsig = value_cast<ASTSignal>(value))
if (const ASTSignal *astsig = value_cast<ASTSignal>(value)) {
_scopeChain->appendJsScope(astsig->bodyScope());
// signals defined in C++
else if (const CppComponentValue *qmlObject = value_cast<CppComponentValue>(owner)) {
} else if (const CppComponentValue *qmlObject = value_cast<CppComponentValue>(owner)) {
if (const ObjectValue *scope = qmlObject->signalScope(name))
_scopeChain->appendJsScope(scope);
}

View File

@@ -860,9 +860,8 @@ QRect QStyleItem::subControlRect(const QString &subcontrolString)
subcontrol = QStyle::SC_SpinBoxDown;
else if (subcontrolString == QLatin1String("up"))
subcontrol = QStyle::SC_SpinBoxUp;
else if (subcontrolString == QLatin1String("edit")){
else if (subcontrolString == QLatin1String("edit"))
subcontrol = QStyle::SC_SpinBoxEditField;
}
return qApp->style()->subControlRect(control,
qstyleoption_cast<QStyleOptionComplex*>(m_styleoption),
subcontrol, widget());

View File

@@ -66,9 +66,9 @@ QtcLibrary {
}
property var botanDefines: {
var result = [];
if (useSystemBotan)
if (useSystemBotan) {
result.push("USE_SYSTEM_BOTAN")
else {
} else {
result.push("BOTAN_DLL=")
if (qbs.toolchain === "msvc")
result.push("BOTAN_BUILD_COMPILER_IS_MSVC", "BOTAN_TARGET_OS_HAS_GMTIME_S")

View File

@@ -124,9 +124,9 @@ void FancyMainWindow::updateDockWidget(QDockWidget *dockWidget)
: QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable;
if (dockWidget->property("managed_dockwidget").isNull()) { // for the debugger tool bar
QWidget *titleBarWidget = dockWidget->titleBarWidget();
if (d->m_locked && !titleBarWidget && !dockWidget->isFloating())
if (d->m_locked && !titleBarWidget && !dockWidget->isFloating()) {
titleBarWidget = new QWidget(dockWidget);
else if ((!d->m_locked || dockWidget->isFloating()) && titleBarWidget) {
} else if ((!d->m_locked || dockWidget->isFloating()) && titleBarWidget) {
delete titleBarWidget;
titleBarWidget = 0;
}

View File

@@ -162,9 +162,9 @@ bool ToolTip::tipChanged(const QPoint &pos, const TipContent &content, QWidget *
void ToolTip::setTipRect(QWidget *w, const QRect &rect)
{
if (!m_rect.isNull() && !w)
if (!m_rect.isNull() && !w) {
qWarning("ToolTip::show: Cannot pass null widget if rect is set");
else{
} else {
m_widget = w;
m_rect = rect;
}

View File

@@ -75,15 +75,15 @@ QString UnixUtils::substituteFileBrowserParameters(const QString &pre, const QSt
if (c == QLatin1Char('%') && i < pre.size()-1) {
c = pre.at(++i);
QString s;
if (c == QLatin1Char('d'))
if (c == QLatin1Char('d')) {
s = QLatin1Char('"') + QFileInfo(file).path() + QLatin1Char('"');
else if (c == QLatin1Char('f'))
} else if (c == QLatin1Char('f')) {
s = QLatin1Char('"') + file + QLatin1Char('"');
else if (c == QLatin1Char('n'))
} else if (c == QLatin1Char('n')) {
s = QLatin1Char('"') + QFileInfo(file).fileName() + QLatin1Char('"');
else if (c == QLatin1Char('%'))
} else if (c == QLatin1Char('%')) {
s = c;
else {
} else {
s = QLatin1Char('%');
s += c;
}

View File

@@ -94,8 +94,7 @@ void CMakeHighlighter::highlightBlock(const QString &text)
setFormat(i, 1, m_formats[CMakeStringFormat]);
}
inStringMode = !inStringMode;
}
else if (c == '\\') {
} else if (c == '\\') {
setFormat(i, 1, emptyFormat);
buf += c;
i++;

View File

@@ -172,9 +172,9 @@ MainWindow::MainWindow() :
if (Utils::HostOsInfo::isAnyUnixHost() && !Utils::HostOsInfo::isMacHost()) {
if (baseName == QLatin1String("windows")) {
// Sometimes we get the standard windows 95 style as a fallback
if (QStyleFactory::keys().contains(QLatin1String("Fusion")))
if (QStyleFactory::keys().contains(QLatin1String("Fusion"))) {
baseName = QLatin1String("fusion"); // Qt5
else { // Qt4
} else { // Qt4
// e.g. if we are running on a KDE4 desktop
QByteArray desktopEnvironment = qgetenv("DESKTOP_SESSION");
if (desktopEnvironment == "kde")

View File

@@ -274,18 +274,16 @@ void ManhattanStyle::polish(QWidget *widget)
if (qobject_cast<QToolButton*>(widget)) {
widget->setAttribute(Qt::WA_Hover);
widget->setMaximumHeight(Utils::StyleHelper::navigationWidgetHeight() - 2);
}
else if (qobject_cast<QLineEdit*>(widget)) {
} else if (qobject_cast<QLineEdit*>(widget)) {
widget->setAttribute(Qt::WA_Hover);
widget->setMaximumHeight(Utils::StyleHelper::navigationWidgetHeight() - 2);
}
else if (qobject_cast<QLabel*>(widget))
} else if (qobject_cast<QLabel*>(widget)) {
widget->setPalette(panelPalette(widget->palette()));
else if (widget->property("panelwidget_singlerow").toBool())
} else if (widget->property("panelwidget_singlerow").toBool()) {
widget->setFixedHeight(Utils::StyleHelper::navigationWidgetHeight());
else if (qobject_cast<QStatusBar*>(widget))
} else if (qobject_cast<QStatusBar*>(widget)) {
widget->setFixedHeight(Utils::StyleHelper::navigationWidgetHeight() + 2);
else if (qobject_cast<QComboBox*>(widget)) {
} else if (qobject_cast<QComboBox*>(widget)) {
widget->setMaximumHeight(Utils::StyleHelper::navigationWidgetHeight() - 2);
widget->setAttribute(Qt::WA_Hover);
}

View File

@@ -105,8 +105,7 @@ void Transition::paint(QPainter *painter, const QStyleOption *option)
m_running = false;
alpha = 1.0;
}
}
else {
} else {
m_running = false;
}
drawBlendedImage(painter, option->rect, alpha);

View File

@@ -303,7 +303,7 @@ struct CanonicalSymbol
if (classId && classId->isEqualTo(declId))
continue; // skip it, it's a ctor or a dtor.
else if (Function *funTy = r.declaration()->type()->asFunctionType()) {
if (Function *funTy = r.declaration()->type()->asFunctionType()) {
if (funTy->isVirtual())
return r.declaration();
}
@@ -1481,10 +1481,9 @@ CPPEditorWidget::Link CPPEditorWidget::findLinkAt(const QTextCursor &cursor, boo
int depth = 0;
for (; j < tokens.size(); ++j) {
if (tokens.at(j).is(T_LPAREN))
if (tokens.at(j).is(T_LPAREN)) {
++depth;
else if (tokens.at(j).is(T_RPAREN)) {
} else if (tokens.at(j).is(T_RPAREN)) {
if (! --depth)
break;
}
@@ -1576,15 +1575,13 @@ CPPEditorWidget::Link CPPEditorWidget::findLinkAt(const QTextCursor &cursor, boo
const QChar ch = document()->characterAt(pos);
if (ch.isSpace())
continue;
else {
if (ch == QLatin1Char('(') && ! expression.isEmpty()) {
tc.setPosition(pos);
if (TextEditor::TextBlockUserData::findNextClosingParenthesis(&tc, true))
expression.append(tc.selectedText());
}
break;
if (ch == QLatin1Char('(') && ! expression.isEmpty()) {
tc.setPosition(pos);
if (TextEditor::TextBlockUserData::findNextClosingParenthesis(&tc, true))
expression.append(tc.selectedText());
}
break;
}
TypeOfExpression typeOfExpression;
@@ -2070,9 +2067,8 @@ void CPPEditorWidget::updateSemanticInfo(const SemanticInfo &semanticInfo)
if (! m_renameSelections.isEmpty())
setExtraSelections(CodeSemanticsSelection, m_renameSelections); // ###
else {
else
markSymbols(textCursor(), semanticInfo);
}
m_lastSemanticInfo.forced = false; // clear the forced flag

View File

@@ -376,9 +376,8 @@ void CppEditorPlugin::currentEditorChanged(Core::IEditor *editor)
if (! editor)
return;
else if (CPPEditorWidget *textEditor = qobject_cast<CPPEditorWidget *>(editor->widget())) {
if (CPPEditorWidget *textEditor = qobject_cast<CPPEditorWidget *>(editor->widget()))
textEditor->semanticRehighlight(/*force = */ true);
}
}
void CppEditorPlugin::openTypeHierarchy()

View File

@@ -778,9 +778,8 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ
FullySpecifiedType type = rewriteType(newParam->type(), &env, control);
newTargetParam = overview.prettyType(type, newParam->name());
hadChanges = true;
}
// otherwise preserve as much as possible from the existing parameter
else {
} else {
Symbol *targetParam = targetFunction->argumentAt(existingParamIndex);
Symbol *sourceParam = sourceFunction->argumentAt(existingParamIndex);
ParameterDeclarationAST *targetParamAst = targetParameterDecls.at(existingParamIndex);
@@ -833,9 +832,8 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ
newTargetParam += overview.prettyType(replacementType, replacementName);
newTargetParam += targetFile->textOf(parameterTypeEnd, parameterEnd);
hadChanges = true;
}
// change the name only?
else if (!namesEqual(targetParam->name(), replacementName)) {
} else if (!namesEqual(targetParam->name(), replacementName)) {
DeclaratorIdAST *id = getDeclaratorId(targetParamAst->declarator);
const QString &replacementNameStr = overview.prettyName(replacementName);
if (id) {
@@ -878,9 +876,8 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ
newTargetParam += rest;
}
hadChanges = true;
}
// change nothing - though the parameter might still have moved
else {
} else {
if (existingParamIndex != newParamIndex)
hadChanges = true;
newTargetParam = targetFile->textOf(parameterStart, parameterEnd);
@@ -934,9 +931,8 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ
if (!targetFunction->isConst() && !targetFunction->isVolatile()) {
cvString.prepend(QLatin1Char(' '));
changes.insert(targetFile->endOf(targetFunctionDeclarator->rparen_token), cvString);
}
// modify/remove existing specifiers
else {
} else {
SimpleSpecifierAST *constSpecifier = 0;
SimpleSpecifierAST *volatileSpecifier = 0;
for (SpecifierListAST *it = targetFunctionDeclarator->cv_qualifier_list; it; it = it->next) {
@@ -954,9 +950,8 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ
changes.remove(targetFile->endOf(constSpecifier->specifier_token - 1), targetFile->endOf(constSpecifier));
if (!newFunction->isVolatile())
changes.remove(targetFile->endOf(volatileSpecifier->specifier_token - 1), targetFile->endOf(volatileSpecifier));
}
// otherwise adjust, remove or extend the one existing specifier
else {
} else {
SimpleSpecifierAST *specifier = constSpecifier ? constSpecifier : volatileSpecifier;
QTC_ASSERT(specifier, return changes);

View File

@@ -160,13 +160,11 @@ void CppHighlighter::highlightBlock(const QString &text)
onlyHighlightComments = true;
}
} else if (tk.is(T_NUMERIC_LITERAL))
} else if (tk.is(T_NUMERIC_LITERAL)) {
setFormat(tk.begin(), tk.length(), m_formats[CppNumberFormat]);
else if (tk.isStringLiteral() || tk.isCharLiteral())
} else if (tk.isStringLiteral() || tk.isCharLiteral()) {
highlightLine(text, tk.begin(), tk.length(), m_formats[CppStringFormat]);
else if (tk.isComment()) {
} else if (tk.isComment()) {
const int startPosition = initialState ? previousTokenEnd : tk.begin();
if (tk.is(T_COMMENT) || tk.is(T_CPP_COMMENT))
highlightLine(text, startPosition, tk.end() - startPosition, m_formats[CppCommentFormat]);
@@ -192,18 +190,15 @@ void CppHighlighter::highlightBlock(const QString &text)
initialState = 0;
}
} else if (tk.isKeyword() || CppTools::isQtKeyword(text.midRef(tk.begin(), tk.length())) || tk.isObjCAtKeyword())
} else if (tk.isKeyword() || CppTools::isQtKeyword(text.midRef(tk.begin(), tk.length())) || tk.isObjCAtKeyword()) {
setFormat(tk.begin(), tk.length(), m_formats[CppKeywordFormat]);
else if (tk.isOperator())
} else if (tk.isOperator()) {
setFormat(tk.begin(), tk.length(), m_formats[CppOperatorFormat]);
else if (i == 0 && tokens.size() > 1 && tk.is(T_IDENTIFIER) && tokens.at(1).is(T_COLON))
} else if (i == 0 && tokens.size() > 1 && tk.is(T_IDENTIFIER) && tokens.at(1).is(T_COLON)) {
setFormat(tk.begin(), tk.length(), m_formats[CppLabelFormat]);
else if (tk.is(T_IDENTIFIER))
} else if (tk.is(T_IDENTIFIER)) {
highlightWord(text.midRef(tk.begin(), tk.length()), tk.begin(), tk.length());
}
}
// mark the trailing white spaces

View File

@@ -624,10 +624,9 @@ void SplitSimpleDeclaration::match(const CppQuickFixInterface &interface,
for (int index = path.size() - 1; index != -1; --index) {
AST *node = path.at(index);
if (CoreDeclaratorAST *coreDecl = node->asCoreDeclarator())
if (CoreDeclaratorAST *coreDecl = node->asCoreDeclarator()) {
core_declarator = coreDecl;
else if (SimpleDeclarationAST *simpleDecl = node->asSimpleDeclaration()) {
} else if (SimpleDeclarationAST *simpleDecl = node->asSimpleDeclaration()) {
if (checkDeclaration(simpleDecl)) {
SimpleDeclarationAST *declaration = simpleDecl;
@@ -1702,7 +1701,7 @@ void AddLocalDeclaration::match(const CppQuickFixInterface &interface, QuickFixO
foreach (const LookupItem &r, results) {
if (! r.declaration())
continue;
else if (Declaration *d = r.declaration()->asDeclaration()) {
if (Declaration *d = r.declaration()->asDeclaration()) {
if (! d->type()->isFunctionType()) {
decl = d;
break;
@@ -4078,8 +4077,7 @@ void MoveFuncDefToDecl::match(const CppQuickFixInterface &interface, QuickFixOpe
if (!declText.isEmpty())
break;
}
}
else if (Namespace *matchingNamespace = isNamespaceFunction(interface->context(), func)) {
} else if (Namespace *matchingNamespace = isNamespaceFunction(interface->context(), func)) {
// Dealing with free functions
bool isHeaderFile = false;
declFileName = correspondingHeaderOrSource(interface->fileName(), &isHeaderFile);

View File

@@ -57,10 +57,9 @@ static void parse(QFutureInterface<void> &future,
const QString fileName = files.at(i);
const bool isSourceFile = i < sourceCount;
if (isSourceFile)
if (isSourceFile) {
(void) preproc->run(conf);
else if (! processingHeaders) {
} else if (! processingHeaders) {
(void) preproc->run(conf);
processingHeaders = true;

View File

@@ -96,7 +96,7 @@ protected:
{
if (! doc)
return;
else if (! processed->contains(doc->globalNamespace())) {
if (! processed->contains(doc->globalNamespace())) {
processed->insert(doc->globalNamespace());
foreach (const Document::Include &i, doc->includes())
@@ -738,7 +738,7 @@ bool CheckSymbols::hasVirtualDestructor(Class *klass) const
for (Symbol *s = klass->find(id); s; s = s->next()) {
if (! s->name())
continue;
else if (s->name()->isDestructorNameId()) {
if (s->name()->isDestructorNameId()) {
if (Function *funTy = s->type()->asFunctionType()) {
if (funTy->isVirtual() && id->isEqualTo(s->identifier()))
return true;
@@ -1335,9 +1335,8 @@ NameAST *CheckSymbols::declaratorId(DeclaratorAST *ast) const
if (ast && ast->core_declarator) {
if (NestedDeclaratorAST *nested = ast->core_declarator->asNestedDeclarator())
return declaratorId(nested->declarator);
else if (DeclaratorIdAST *declId = ast->core_declarator->asDeclaratorId()) {
if (DeclaratorIdAST *declId = ast->core_declarator->asDeclaratorId())
return declId->name;
}
}
return 0;

View File

@@ -519,9 +519,9 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block)
int previousPreviousMarker = -1;
for (int i = size - 1; i >= 0; --i) {
if (m_currentState.at(i).type == cpp_macro_conditional) {
if (previousMarker == -1)
if (previousMarker == -1) {
previousMarker = i;
else {
} else {
previousPreviousMarker = i;
break;
}

View File

@@ -572,7 +572,7 @@ Class *asClassOrTemplateClassType(FullySpecifiedType ty)
{
if (Class *classTy = ty->asClassType())
return classTy;
else if (Template *templ = ty->asTemplateType()) {
if (Template *templ = ty->asTemplateType()) {
if (Symbol *decl = templ->declaration())
return decl->asClass();
}
@@ -595,7 +595,7 @@ Function *asFunctionOrTemplateFunctionType(FullySpecifiedType ty)
{
if (Function *funTy = ty->asFunctionType())
return funTy;
else if (Template *templ = ty->asTemplateType()) {
if (Template *templ = ty->asTemplateType()) {
if (Symbol *decl = templ->declaration())
return decl->asFunction();
}
@@ -799,13 +799,11 @@ int CppCompletionAssistProcessor::startOfOperator(int pos,
&& *kind != T_DOT))) {
*kind = T_EOF_SYMBOL;
start = pos;
}
// Include completion: can be triggered by slash, but only in a string
else if (*kind == T_SLASH && (tk.isNot(T_STRING_LITERAL) && tk.isNot(T_ANGLE_STRING_LITERAL))) {
} else if (*kind == T_SLASH && (tk.isNot(T_STRING_LITERAL) && tk.isNot(T_ANGLE_STRING_LITERAL))) {
*kind = T_EOF_SYMBOL;
start = pos;
}
else if (*kind == T_LPAREN) {
} else if (*kind == T_LPAREN) {
if (tokenIdx > 0) {
const Token &previousToken = tokens.at(tokenIdx - 1); // look at the token at the left of T_LPAREN
switch (previousToken.kind()) {
@@ -943,13 +941,11 @@ int CppCompletionAssistProcessor::startCompletionHelper()
startOfExpression = endOfExpression - expression.length();
if (m_model->m_completionOperator == T_LPAREN) {
if (expression.endsWith(QLatin1String("SIGNAL")))
if (expression.endsWith(QLatin1String("SIGNAL"))) {
m_model->m_completionOperator = T_SIGNAL;
else if (expression.endsWith(QLatin1String("SLOT")))
} else if (expression.endsWith(QLatin1String("SLOT"))) {
m_model->m_completionOperator = T_SLOT;
else if (m_interface->position() != endOfOperator) {
} else if (m_interface->position() != endOfOperator) {
// We don't want a function completion when the cursor isn't at the opening brace
expression.clear();
m_model->m_completionOperator = T_EOF_SYMBOL;
@@ -1225,7 +1221,7 @@ int CppCompletionAssistProcessor::startCompletionInternal(const QString fileName
return m_startPosition;
}
else if (m_model->m_completionOperator == T_SIGNAL || m_model->m_completionOperator == T_SLOT) {
if (m_model->m_completionOperator == T_SIGNAL || m_model->m_completionOperator == T_SLOT) {
// Apply signal/slot completion on 'this'
expression = QLatin1String("this");
}
@@ -1335,7 +1331,7 @@ void CppCompletionAssistProcessor::globalCompletion(CPlusPlus::Scope *currentSco
Symbol *member = scope->memberAt(i);
if (! member->name())
continue;
else if (UsingNamespaceDirective *u = member->asUsingNamespaceDirective()) {
if (UsingNamespaceDirective *u = member->asUsingNamespaceDirective()) {
if (ClassOrNamespace *b = binding->lookupType(u->name()))
usingBindings.append(b);
}

View File

@@ -84,7 +84,7 @@ protected:
if (Symbol *member = scope->memberAt(i)) {
if (member->isTypedef())
continue;
else if (! member->isGenerated() && (member->isDeclaration() || member->isArgument())) {
if (! member->isGenerated() && (member->isDeclaration() || member->isArgument())) {
if (member->name() && member->name()->isNameId()) {
const Identifier *id = member->identifier();
unsigned line, column;
@@ -106,10 +106,10 @@ protected:
const Identifier *id = identifier(simpleName->identifier_token);
for (int i = _scopeStack.size() - 1; i != -1; --i) {
if (Symbol *member = _scopeStack.at(i)->find(id)) {
if (member->isTypedef() ||
!(member->isDeclaration() || member->isArgument()))
if (member->isTypedef() || !(member->isDeclaration() || member->isArgument()))
continue;
else if (!member->isGenerated() && (member->sourceLocation() < firstToken || member->enclosingScope()->isFunction())) {
if (!member->isGenerated() && (member->sourceLocation() < firstToken
|| member->enclosingScope()->isFunction())) {
unsigned line, column;
getTokenStartPosition(simpleName->identifier_token, &line, &column);
localUses[member].append(

View File

@@ -74,11 +74,10 @@ protected:
if (_functionDefinition)
return false;
else if (FunctionDefinitionAST *def = ast->asFunctionDefinition()) {
if (FunctionDefinitionAST *def = ast->asFunctionDefinition())
return checkDeclaration(def);
}
else if (ObjCMethodDeclarationAST *method = ast->asObjCMethodDeclaration()) {
if (ObjCMethodDeclarationAST *method = ast->asObjCMethodDeclaration()) {
if (method->function_body)
return checkDeclaration(method);
}

View File

@@ -277,13 +277,11 @@ QList<IncludeGroup> IncludeGroup::detectIncludeGroupsByNewLines(QList<Document::
if (isFirst) {
isFirst = false;
currentIncludes << include;
}
// Include belongs to current group
else if (lastLine + 1 == include.line()) {
} else if (lastLine + 1 == include.line()) {
currentIncludes << include;
}
// Include is member of new group
else {
} else {
result << IncludeGroup(currentIncludes);
currentIncludes.clear();
currentIncludes << include;
@@ -312,13 +310,11 @@ QList<IncludeGroup> IncludeGroup::detectIncludeGroupsByIncludeDir(const QList<In
if (isFirst) {
isFirst = false;
currentIncludes << include;
}
// Include belongs to current group
else if (lastDir == currentDirPrefix) {
} else if (lastDir == currentDirPrefix) {
currentIncludes << include;
}
// Include is member of new group
else {
} else {
result << IncludeGroup(currentIncludes);
currentIncludes.clear();
currentIncludes << include;
@@ -347,13 +343,11 @@ QList<IncludeGroup> IncludeGroup::detectIncludeGroupsByIncludeType(const QList<I
if (isFirst) {
isFirst = false;
currentIncludes << include;
}
// Include belongs to current group
else if (lastIncludeType == currentIncludeType) {
} else if (lastIncludeType == currentIncludeType) {
currentIncludes << include;
}
// Include is member of new group
else {
} else {
result << IncludeGroup(currentIncludes);
currentIncludes.clear();
currentIncludes << include;

View File

@@ -176,7 +176,7 @@ Function *SymbolFinder::findMatchingDefinition(Symbol *declaration,
foreach (Function *fun, viableFunctions) {
if (! (fun->unqualifiedName() && fun->unqualifiedName()->isEqualTo(declaration->unqualifiedName())))
continue;
else if (fun->argumentCount() == declarationTy->argumentCount()) {
if (fun->argumentCount() == declarationTy->argumentCount()) {
if (! strict && ! best)
best = fun;
@@ -287,13 +287,9 @@ void SymbolFinder::findMatchingDeclaration(const LookupContext &context,
continue;
for (Symbol *s = scope->find(funcId); s; s = s->next()) {
if (! s->name())
if (! s->name() || ! funcId->isEqualTo(s->identifier()) || ! s->type()->isFunctionType())
continue;
else if (! funcId->isEqualTo(s->identifier()))
continue;
else if (! s->type()->isFunctionType())
continue;
else if (Declaration *decl = s->asDeclaration()) {
if (Declaration *decl = s->asDeclaration()) {
if (Function *declFunTy = decl->type()->asFunctionType()) {
if (functionType->isEqualTo(declFunTy))
typeMatch->prepend(decl);

View File

@@ -224,15 +224,13 @@ void DebuggerMainWindowPrivate::updateActiveLanguages()
{
DebuggerLanguages newLanguages = AnyLanguage;
if (m_engineDebugLanguages != AnyLanguage)
if (m_engineDebugLanguages != AnyLanguage) {
newLanguages = m_engineDebugLanguages;
else {
if (m_previousRunConfiguration) {
if (m_previousRunConfiguration->extraAspect<Debugger::DebuggerRunConfigurationAspect>()->useCppDebugger())
newLanguages |= CppLanguage;
if (m_previousRunConfiguration->extraAspect<Debugger::DebuggerRunConfigurationAspect>()->useQmlDebugger())
newLanguages |= QmlLanguage;
}
} else if (m_previousRunConfiguration) {
if (m_previousRunConfiguration->extraAspect<Debugger::DebuggerRunConfigurationAspect>()->useCppDebugger())
newLanguages |= CppLanguage;
if (m_previousRunConfiguration->extraAspect<Debugger::DebuggerRunConfigurationAspect>()->useQmlDebugger())
newLanguages |= QmlLanguage;
}
if (newLanguages != m_activeDebugLanguages) {

View File

@@ -1405,11 +1405,11 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
QString key = arg.section(QLatin1Char('='), 0, 0);
QString val = arg.section(QLatin1Char('='), 1, 1);
if (val.isEmpty()) {
if (key.isEmpty())
if (key.isEmpty()) {
continue;
else if (sp.executable.isEmpty())
} else if (sp.executable.isEmpty()) {
sp.executable = key;
else {
} else {
*errorMessage = DebuggerPlugin::tr("Only one executable allowed!");
return false;
}
@@ -1419,15 +1419,13 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
sp.remoteChannel = val;
sp.displayName = tr("Remote: \"%1\"").arg(sp.remoteChannel);
sp.startMessage = tr("Attaching to remote server %1.").arg(sp.remoteChannel);
}
else if (key == QLatin1String("core")) {
} else if (key == QLatin1String("core")) {
sp.startMode = AttachCore;
sp.closeMode = DetachAtClose;
sp.coreFile = val;
sp.displayName = tr("Core file \"%1\"").arg(sp.coreFile);
sp.startMessage = tr("Attaching to core file %1.").arg(sp.coreFile);
}
else if (key == QLatin1String("kit")) {
} else if (key == QLatin1String("kit")) {
kit = KitManager::instance()->find(Id::fromString(val));
}
}

View File

@@ -150,9 +150,9 @@ void GdbCoreEngine::continueSetupEngine()
}
}
}
if (isCore)
if (isCore) {
startGdb();
else {
} else {
showMessageBox(QMessageBox::Warning,
tr("Error Loading Core File"),
tr("The specified file does not appear to be a core file."));

View File

@@ -699,9 +699,9 @@ void QmlCppEngine::slaveEngineStateChanged
break;
}
case InferiorShutdownOk: {
if (state() == InferiorShutdownRequested)
if (state() == InferiorShutdownRequested) {
notifyInferiorShutdownOk();
else {
} else {
// we got InferiorExitOk before, but ignored it ...
notifyInferiorExited();
}

View File

@@ -230,9 +230,9 @@ void RegisterTreeView::contextMenuEvent(QContextMenuEvent *ev)
const QPoint position = ev->globalPos();
QAction *act = menu.exec(position);
if (act == actReload)
if (act == actReload) {
engine->reloadRegisters();
else if (act == actEditMemory) {
} else if (act == actEditMemory) {
const QString registerName = QString::fromLatin1(aRegister.name);
engine->openMemoryView(address, 0,
RegisterMemoryView::registerMarkup(address, registerName),

View File

@@ -182,9 +182,9 @@ void StackTreeView::contextMenuEvent(QContextMenuEvent *ev)
if (!act)
return;
if (act == actCopyContents)
if (act == actCopyContents) {
copyContentsToClipboard();
else if (act == actShowMemory) {
} else if (act == actShowMemory) {
const QString title = tr("Memory at Frame #%1 (%2) 0x%3").
arg(row).arg(frame.function).arg(address, 0, 16);
QList<MemoryMarkup> ml;

View File

@@ -952,12 +952,10 @@ ChunkData DiffEditorWidget::calculateOriginalData(const QList<Diff> &diffList) c
if (diff.command == Diff::Delete) {
leftLines.last() += line;
currentLeftPos += line.count();
}
else if (diff.command == Diff::Insert) {
} else if (diff.command == Diff::Insert) {
rightLines.last() += line;
currentRightPos += line.count();
}
else if (diff.command == Diff::Equal) {
} else if (diff.command == Diff::Equal) {
if ((line.count() || (j && j < lines.count() - 1)) && // don't treat empty ending line as a line to be aligned unless a line is a one char '/n' only.
currentLeftLine != lastAlignedLeftLine &&
currentRightLine != lastAlignedRightLine) {

View File

@@ -246,8 +246,7 @@ void CurrentDocumentFind::aggregationChanged()
m_candidateWidget = m_currentWidget;
m_candidateFind = currentFind;
acceptCandidate();
}
else {
} else {
clearFindSupport();
}
}

View File

@@ -90,9 +90,7 @@ void PkgConfigTool::packages_helper() const
if (ch.isSpace()) {
do { ++index; }
while (index < cflags.size() && cflags.at(index).isSpace());
}
else if (ch == QLatin1Char('-') && index + 1 < cflags.size()) {
} else if (ch == QLatin1Char('-') && index + 1 < cflags.size()) {
++index;
const QChar opt = cflags.at(index);
@@ -109,9 +107,7 @@ void PkgConfigTool::packages_helper() const
qDebug() << "*** add include path:" << cflags.mid(start, index - start);
package.includePaths.append(cflags.mid(start, index - start));
}
}
else {
} else {
for (; index < cflags.size(); ++index) {
if (cflags.at(index).isSpace())
break;

View File

@@ -1463,9 +1463,9 @@ bool GitClient::synchronousInit(const QString &workingDirectory)
const bool rc = fullySynchronousGit(workingDirectory, arguments, &outputText, &errorText);
// '[Re]Initialized...'
outputWindow()->append(commandOutputFromLocal8Bit(outputText));
if (!rc)
if (!rc) {
outputWindow()->appendError(commandOutputFromLocal8Bit(errorText));
else {
} else {
// TODO: Turn this into a VcsBaseClient and use resetCachedVcsInfo(...)
Core::ICore::vcsManager()->resetVersionControlForDirectory(workingDirectory);
}

View File

@@ -920,9 +920,9 @@ void GitPlugin::gitkForCurrentFolder()
*
*/
QDir dir(state.currentFileDirectory());
if (QFileInfo(dir,QLatin1String(".git")).exists() || dir.cd(QLatin1String(".git")))
if (QFileInfo(dir,QLatin1String(".git")).exists() || dir.cd(QLatin1String(".git"))) {
m_gitClient->launchGitK(state.currentFileDirectory());
else {
} else {
QString folderName = dir.absolutePath();
dir.cdUp();
folderName = folderName.remove(0, dir.absolutePath().length() + 1);

View File

@@ -102,8 +102,7 @@ bool MergeTool::start(const QString &workingDirectory, const QStringList &files)
if (m_process->waitForStarted()) {
connect(m_process, SIGNAL(finished(int)), this, SLOT(done()));
connect(m_process, SIGNAL(readyRead()), this, SLOT(readData()));
}
else {
} else {
delete m_process;
m_process = 0;
return false;

View File

@@ -85,8 +85,7 @@ bool GLSLCompleter::contextAllowsElectricCharacters(const QTextCursor &cursor) c
if (pos < tk.end())
return false;
}
else if (tk.isStringLiteral() || tk.isCharLiteral()) {
} else if (tk.isStringLiteral() || tk.isCharLiteral()) {
const unsigned pos = cursor.selectionEnd() - cursor.block().position();
if (pos <= tk.end())
return false;

View File

@@ -160,13 +160,13 @@ void Highlighter::highlightBlock(const QString &text)
highlightLine(text, tk.begin(), tk.length, m_formats[GLSLPreprocessorFormat]);
highlightAsPreprocessor = true;
} else if (highlightCurrentWordAsPreprocessor && isPPKeyword(text.midRef(tk.begin(), tk.length)))
} else if (highlightCurrentWordAsPreprocessor && isPPKeyword(text.midRef(tk.begin(), tk.length))) {
setFormat(tk.begin(), tk.length, m_formats[GLSLPreprocessorFormat]);
else if (tk.is(GLSL::Parser::T_NUMBER))
} else if (tk.is(GLSL::Parser::T_NUMBER)) {
setFormat(tk.begin(), tk.length, m_formats[GLSLNumberFormat]);
else if (tk.is(GLSL::Parser::T_COMMENT)) {
} else if (tk.is(GLSL::Parser::T_COMMENT)) {
highlightLine(text, tk.begin(), tk.length, m_formats[GLSLCommentFormat]);
// we need to insert a close comment parenthesis, if
@@ -362,11 +362,11 @@ void Highlighter::highlightBlock(const QString &text)
for (int i = 0; i < tokens.size(); ++i) {
const GLSL::Token &tk = tokens.at(i);
if (tk.is(GLSL::Parser::T_NUMBER))
if (tk.is(GLSL::Parser::T_NUMBER)) {
setFormat(tk.position, tk.length, m_formats[GLSLNumberFormat]);
else if (tk.is(GLSL::Parser::T_COMMENT))
} else if (tk.is(GLSL::Parser::T_COMMENT)) {
setFormat(tk.position, tk.length, Qt::darkGreen); // ### FIXME: m_formats[GLSLCommentFormat]);
else if (tk.is(GLSL::Parser::T_IDENTIFIER)) {
} else if (tk.is(GLSL::Parser::T_IDENTIFIER)) {
int kind = lex.findKeyword(data.constData() + tk.position, tk.length);
if (kind == GLSL::Parser::T_RESERVED)
setFormat(tk.position, tk.length, m_formats[GLSLReservedKeyword]);

View File

@@ -139,9 +139,9 @@ MaemoQemuRuntime MaemoQemuRuntimeParserV1::parseRuntime()
&& m_madInfoReader.name() == QLatin1String("installed")) {
if (m_madInfoReader.readNext() == QXmlStreamReader::Characters
&& m_madInfoReader.text() == QLatin1String("true")) {
if (attrs.hasAttribute(QLatin1String("runtime_id")))
if (attrs.hasAttribute(QLatin1String("runtime_id"))) {
installedRuntimes << attrs.value(QLatin1String("runtime_id")).toString();
else if (attrs.hasAttribute(QLatin1String("id"))) {
} else if (attrs.hasAttribute(QLatin1String("id"))) {
// older MADDE seems to use only id
installedRuntimes << attrs.value(QLatin1String("id")).toString();
}

View File

@@ -79,9 +79,9 @@ bool CeSdkHandler::parse(const QString &vsdir)
xml.readNext();
if (xml.isStartElement()) {
currentElement = xml.name().toString();
if (currentElement == QLatin1String("Platform"))
if (currentElement == QLatin1String("Platform")) {
currentItem = CeSdkInfo();
else if (currentElement == QLatin1String("Directories")) {
} else if (currentElement == QLatin1String("Directories")) {
QXmlStreamAttributes attr = xml.attributes();
currentItem.m_include = fixPaths(attr.value(QLatin1String("Include")).toString());
currentItem.m_lib = fixPaths(attr.value(QLatin1String("Library")).toString());

View File

@@ -676,9 +676,9 @@ void Target::updateDefaultRunConfigurations()
// Make sure a configured RC is active:
if (activeRunConfiguration() && !activeRunConfiguration()->isConfigured()) {
if (!existingConfigured.isEmpty())
if (!existingConfigured.isEmpty()) {
setActiveRunConfiguration(existingConfigured.at(0));
else if (!newConfigured.isEmpty()) {
} else if (!newConfigured.isEmpty()) {
RunConfiguration *selected = newConfigured.at(0);
// Try to find a runconfiguration that matches the project name. That is a good
// candidate for something to run initially.

View File

@@ -93,8 +93,7 @@ static QString winExpandDelayedEnvReferences(QString in, const Utils::Environmen
if (replacement.isEmpty()) {
qWarning() << "No replacement for var: " << var;
pos = nextPos;
}
else {
} else {
// Not sure about this, but we need to account for the case where
// the end of the replacement doesn't have the directory seperator and
// neither does the start of the insert. This solution assumes:

View File

@@ -164,9 +164,9 @@ void SelectionTool::hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
void SelectionTool::mouseReleaseEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event)
{
if (m_singleSelectionManipulator.isActive())
if (m_singleSelectionManipulator.isActive()) {
m_singleSelectionManipulator.end(event->scenePos());
else if (m_rubberbandSelectionManipulator.isActive()) {
} else if (m_rubberbandSelectionManipulator.isActive()) {
QPointF mouseMovementVector = m_rubberbandSelectionManipulator.beginPoint() - event->scenePos();
if (mouseMovementVector.toPoint().manhattanLength() < s_startDragDistance) {

View File

@@ -101,8 +101,7 @@ void CustomDragAndDropIcon::mouseMoveEvent(QMouseEvent *event)
resize(m_size);
show();
update();
}
else {
} else {
move(-1000, -1000); // if no top level widget is found we are out of the main window
}
QWidget* target = QApplication::widgetAt(globalPos - QPoint(2,2)); //-(2, 2) because:

View File

@@ -193,9 +193,9 @@ reasons and then passed to the section views */
/* Limit the content position. Without this, resizing would get the
content position out of scope regarding the scrollbar. */
function limitContentPos() {
if (contentY < 0)
if (contentY < 0) {
contentY = 0;
else {
} else {
var maxContentY = Math.max(0, contentHeight - height)
if (contentY > maxContentY)
contentY = maxContentY;

View File

@@ -149,8 +149,7 @@ bool NavigatorTreeModel::dropMimeData(const QMimeData *data,
return false;
targetIndex -= visibleProperties(parentNode).count();
parentPropertyName = parentNode.metaInfo().defaultPropertyName();
}
else {
} else {
parentItemIndex = parentIndex.parent();
parentPropertyName = parentIndex.data(Qt::DisplayRole).toByteArray();
}
@@ -295,8 +294,7 @@ void NavigatorTreeModel::updateItemRowOrder(const NodeListProperty &listProperty
parentIdItem = parentRow.idItem;
newRow += visibleProperties(listProperty.parentModelNode()).count();
}
}
else {
} else {
parentIdItem = itemRow.idItem->parent();
}
Q_ASSERT(parentIdItem);

View File

@@ -145,8 +145,7 @@ public:
if (option->rect.height() == 0) {
if (option->rect.top()>0)
painter->drawLine(rect.topLeft(), rect.topRight());
}
else {
} else {
highlight.setAlphaF(0.2);
painter->setBrush(highlight);
painter->drawRect(rect.adjusted(0, 0, -1, -1));
@@ -280,8 +279,7 @@ void NameItemDelegate::paint(QPainter *painter,
displayString = fm.elidedText(displayString,Qt::ElideMiddle,option.rect.width()-extraSpace);
displayStringOffset = QPoint(5+pixmapSide,-5);
width = fm.width(displayString);
}
else {
} else {
displayString = index.data(Qt::DisplayRole).toString();
displayStringOffset = QPoint(0, -2);
}

View File

@@ -1242,8 +1242,7 @@ void QGroupBoxDeclarativeUI::finish()
gb->setUpdatesEnabled(true);
//gb->resize(gb->sizeHint());
gb->finishFirstExpand();
}
else {
} else {
gb->setMinimumHeight(30);
gb->setMaximumHeight(30);
gb->resize(gb->sizeHint().width(), 30);
@@ -1315,8 +1314,7 @@ void QGroupBoxDeclarativeUI::animate(int frame)
if (m_expanded) {
height = ((qreal(frame) / 5.0) * qreal(m_oldHeight)) + (30.0 * (1.0 - qreal(frame) / 5.0));
gb->setPixmap(m_contens, qreal(frame) / 5.0);
}
else {
} else {
height = ((qreal(frame) / 5.0) * 30.0) + (qreal(m_oldHeight) * (1.0 - qreal(frame) / 5.0));
qreal alpha = 0.8 - qreal(frame) / 4.0;
if (alpha < 0)

View File

@@ -115,9 +115,8 @@ void ChangePropertyVisitor::replaceInMembers(UiObjectInitializer *initializer,
}
break;
}
// for grouped properties:
else if (!prefix.isEmpty()) {
} else if (!prefix.isEmpty()) {
if (UiObjectDefinition *def = cast<UiObjectDefinition *>(member)) {
if (toString(def->qualifiedTypeNameId) == prefix)
replaceInMembers(def->initializer, suffix);

View File

@@ -83,10 +83,10 @@ void RemovePropertyVisitor::removeFrom(QmlJS::AST::UiObjectInitializer *ast)
UiObjectMember *member = it->member;
// run full name match (for ungrouped properties):
if (memberNameMatchesPropertyName(propertyName, member))
if (memberNameMatchesPropertyName(propertyName, member)) {
removeMember(member);
// check for grouped properties:
else if (!prefix.isEmpty()) {
} else if (!prefix.isEmpty()) {
if (UiObjectDefinition *def = cast<UiObjectDefinition *>(member)) {
if (toString(def->qualifiedTypeNameId) == prefix)
removeGroupedProperty(def);

View File

@@ -294,23 +294,23 @@ void NodeInstanceServerProxy::dispatchCommand(const QVariant &command)
static const int tokenCommandType = QMetaType::type("TokenCommand");
static const int debugOutputCommandType = QMetaType::type("DebugOutputCommand");
if (command.userType() == informationChangedCommandType)
if (command.userType() == informationChangedCommandType) {
nodeInstanceClient()->informationChanged(command.value<InformationChangedCommand>());
else if (command.userType() == valuesChangedCommandType)
} else if (command.userType() == valuesChangedCommandType) {
nodeInstanceClient()->valuesChanged(command.value<ValuesChangedCommand>());
else if (command.userType() == pixmapChangedCommandType)
} else if (command.userType() == pixmapChangedCommandType) {
nodeInstanceClient()->pixmapChanged(command.value<PixmapChangedCommand>());
else if (command.userType() == childrenChangedCommandType)
} else if (command.userType() == childrenChangedCommandType) {
nodeInstanceClient()->childrenChanged(command.value<ChildrenChangedCommand>());
else if (command.userType() == statePreviewImageChangedCommandType)
} else if (command.userType() == statePreviewImageChangedCommandType) {
nodeInstanceClient()->statePreviewImagesChanged(command.value<StatePreviewImageChangedCommand>());
else if (command.userType() == componentCompletedCommandType)
} else if (command.userType() == componentCompletedCommandType) {
nodeInstanceClient()->componentCompleted(command.value<ComponentCompletedCommand>());
else if (command.userType() == tokenCommandType)
} else if (command.userType() == tokenCommandType) {
nodeInstanceClient()->token(command.value<TokenCommand>());
else if (command.userType() == debugOutputCommandType)
} else if (command.userType() == debugOutputCommandType) {
nodeInstanceClient()->debugOutput(command.value<DebugOutputCommand>());
else if (command.userType() == synchronizeCommandType) {
} else if (command.userType() == synchronizeCommandType) {
SynchronizeCommand synchronizeCommand = command.value<SynchronizeCommand>();
m_synchronizeId = synchronizeCommand.synchronizeId();
} else

View File

@@ -286,9 +286,8 @@ private:
{
if (! value)
return;
else if (const ObjectValue *object = value->asObjectValue()) {
if (const ObjectValue *object = value->asObjectValue())
processProperties(object);
}
}
void processProperties(const ObjectValue *object)

View File

@@ -379,17 +379,10 @@ void HoverHandler::operateTooltip(TextEditor::ITextEditor *editor, const QPoint
{
if (toolTip().isEmpty())
Utils::ToolTip::instance()->hide();
else {
if (m_colorTip.isValid()) {
Utils::ToolTip::instance()->show(point,
Utils::ColorContent(m_colorTip),
editor->widget());
} else {
Utils::ToolTip::instance()->show(point,
Utils::TextContent(toolTip()),
editor->widget());
}
}
else if (m_colorTip.isValid())
Utils::ToolTip::instance()->show(point, Utils::ColorContent(m_colorTip), editor->widget());
else
Utils::ToolTip::instance()->show(point, Utils::TextContent(toolTip()), editor->widget());
}
void HoverHandler::prettyPrintTooltip(const QmlJS::Value *value,

View File

@@ -107,9 +107,9 @@ QmlConsoleView::QmlConsoleView(QWidget *parent) :
if (Utils::HostOsInfo::isAnyUnixHost() && !Utils::HostOsInfo::isMacHost()
&& baseName == QLatin1String("windows")) {
// Sometimes we get the standard windows 95 style as a fallback
if (QStyleFactory::keys().contains(QLatin1String("Fusion")))
if (QStyleFactory::keys().contains(QLatin1String("Fusion"))) {
baseName = QLatin1String("fusion"); // Qt5
else { // Qt4
} else { // Qt4
// e.g. if we are running on a KDE4 desktop
QByteArray desktopEnvironment = qgetenv("DESKTOP_SESSION");
if (desktopEnvironment == "kde")

View File

@@ -309,9 +309,8 @@ protected:
if (QString::fromUtf8(id->chars(), id->size()) != QLatin1String("QVariant"))
return ast;
return call->expression_list->value;
}
// QVariant::fromValue(foo) -> foo
else if (QualifiedNameAST *q = idExp->name->asQualifiedName()) {
} else if (QualifiedNameAST *q = idExp->name->asQualifiedName()) {
SimpleNameAST *simpleRhsName = q->unqualified_name->asSimpleName();
if (!simpleRhsName
|| !q->nested_name_specifier_list

View File

@@ -511,17 +511,17 @@ QString Context2D::textBaseline()
void Context2D::setTextBaseline(const QString &baseline)
{
if (baseline==QLatin1String("alphabetic"))
if (baseline==QLatin1String("alphabetic")) {
m_state.textBaseline = Context2D::Alphabetic;
else if (baseline == QLatin1String("hanging"))
} else if (baseline == QLatin1String("hanging")) {
m_state.textBaseline = Context2D::Hanging;
else if (baseline == QLatin1String("top"))
} else if (baseline == QLatin1String("top")) {
m_state.textBaseline = Context2D::Top;
else if (baseline == QLatin1String("bottom"))
} else if (baseline == QLatin1String("bottom")) {
m_state.textBaseline = Context2D::Bottom;
else if (baseline == QLatin1String("middle"))
} else if (baseline == QLatin1String("middle")) {
m_state.textBaseline = Context2D::Middle;
else {
} else {
m_state.textBaseline = Context2D::Alphabetic;
qWarning() << (QLatin1String("Context2D: invalid baseline:") + baseline);
}
@@ -550,17 +550,17 @@ QString Context2D::textAlign()
void Context2D::setTextAlign(const QString &baseline)
{
if (baseline==QLatin1String("start"))
if (baseline==QLatin1String("start")) {
m_state.textAlign = Context2D::Start;
else if (baseline == QLatin1String("end"))
} else if (baseline == QLatin1String("end")) {
m_state.textAlign = Context2D::End;
else if (baseline == QLatin1String("left"))
} else if (baseline == QLatin1String("left")) {
m_state.textAlign = Context2D::Left;
else if (baseline == QLatin1String("right"))
} else if (baseline == QLatin1String("right")) {
m_state.textAlign = Context2D::Right;
else if (baseline == QLatin1String("center"))
} else if (baseline == QLatin1String("center")) {
m_state.textAlign = Context2D::Center;
else {
} else {
m_state.textAlign= Context2D::Start;
qWarning("Context2D: invalid text align");
}
@@ -574,11 +574,11 @@ void Context2D::setFont(const QString &fontString)
// ### this is simplified and incomplete
QStringList tokens = fontString.split(QLatin1Char(QLatin1Char(' ')));
foreach (const QString &token, tokens) {
if (token == QLatin1String("italic"))
if (token == QLatin1String("italic")) {
font.setItalic(true);
else if (token == QLatin1String("bold"))
} else if (token == QLatin1String("bold")) {
font.setBold(true);
else if (token.endsWith(QLatin1String("px"))) {
} else if (token.endsWith(QLatin1String("px"))) {
QString number = token;
number.remove(QLatin1String("px"));
#ifdef Q_OS_MACX
@@ -589,8 +589,9 @@ void Context2D::setFont(const QString &fontString)
#else
font.setPointSizeF(number.trimmed().toFloat());
#endif
} else
} else {
font.setFamily(token);
}
}
m_state.font = font;
m_state.flags |= DirtyFont;

View File

@@ -310,9 +310,9 @@ void QmlProfilerDataModel::addRangedEvent(int type, int bindingType, qint64 star
setState(AcquiringData);
// generate details string
if (data.isEmpty())
if (data.isEmpty()) {
details = tr("Source code not available.");
else {
} else {
details = data.join(QLatin1String(" ")).replace(QLatin1Char('\n'),QLatin1Char(' ')).simplified();
QRegExp rewrite(QLatin1String("\\(function \\$(\\w+)\\(\\) \\{ (return |)(.+) \\}\\)"));
bool match = rewrite.exactMatch(details);
@@ -613,18 +613,14 @@ qint64 QmlProfilerDataModel::firstTimeMark() const
{
if (d->startInstanceList.isEmpty())
return 0;
else {
return d->startInstanceList[0].startTime;
}
return d->startInstanceList[0].startTime;
}
qint64 QmlProfilerDataModel::lastTimeMark() const
{
if (d->endInstanceList.isEmpty())
return 0;
else {
return d->endInstanceList.last().endTime;
}
return d->endInstanceList.last().endTime;
}
////////////////////////////////////////////////////////////////////////////////////
@@ -1046,9 +1042,9 @@ void QmlProfilerDataModel::QmlProfilerDataModelPrivate::computeNestingDepth()
for (int i = 0; i < endInstanceList.count(); i++) {
int type = endInstanceList[i].description->eventType;
int nestingInType = startInstanceList[endInstanceList[i].startTimeIndex].nestingLevel;
if (!nestingDepth.contains(type))
if (!nestingDepth.contains(type)) {
nestingDepth[type] = nestingInType;
else {
} else {
int nd = nestingDepth[type];
nestingDepth[type] = nd > nestingInType ? nd : nestingInType;
}

View File

@@ -970,8 +970,7 @@ void QmlProfilerEventsParentsAndChildrenView::displayEvent(int eventId)
if (isChildren) {
QList <QV8EventSub *> childrenList = v8event->childrenHash.values();
rebuildTree((QObject *)&childrenList);
}
else {
} else {
QList <QV8EventSub *> parentList = v8event->parentHash.values();
rebuildTree((QObject *)&parentList);
}
@@ -982,8 +981,7 @@ void QmlProfilerEventsParentsAndChildrenView::displayEvent(int eventId)
if (isChildren) {
QList <QmlRangeEventRelative *> childrenList = qmlEvent->childrenHash.values();
rebuildTree((QObject *)&childrenList);
}
else {
} else {
QList <QmlRangeEventRelative *> parentList = qmlEvent->parentHash.values();
rebuildTree((QObject *)&parentList);
}

View File

@@ -117,8 +117,7 @@ QMultiMap<QString, QString> QnxUtils::parseEnvironmentFile(const QString &fileNa
else
value = systemVarRegExp.cap(3);
}
}
else if (Utils::HostOsInfo::isAnyUnixHost()) {
} else if (Utils::HostOsInfo::isAnyUnixHost()) {
QRegExp systemVarRegExp(QLatin1String("\\$\\{([\\w\\d]+):=([\\w\\d]+)\\}")); // to match e.g. "${QNX_HOST_VERSION:=10_0_9_52}"
if (value.contains(systemVarRegExp)) {
Utils::Environment sysEnv = Utils::Environment::systemEnvironment();

View File

@@ -101,9 +101,8 @@ DebuggingHelperBuildTask::DebuggingHelperBuildTask(const BaseQtVersion *version,
// explicitly set 32 or 64 bit in case Qt is compiled with both
if (toolChain->targetAbi().wordWidth() == 32)
m_qmakeArguments << QLatin1String("CONFIG+=x86");
else if (toolChain->targetAbi().wordWidth() == 64) {
else if (toolChain->targetAbi().wordWidth() == 64)
m_qmakeArguments << QLatin1String("CONFIG+=x86_64");
}
}
m_makeCommand = toolChain->makeCommand(m_environment);
m_mkspec = version->mkspec();

View File

@@ -122,8 +122,7 @@ QString AutoCompleter::autoComplete(QTextCursor &cursor, const QString &textToIn
str += QLatin1String("}") + QString(QChar::ParagraphSeparator);
else
str += QString(QChar::ParagraphSeparator) + QLatin1String("}");
}
else {
} else {
str += QLatin1String("}");
}
return str;

View File

@@ -680,10 +680,8 @@ void BaseTextDocumentLayout::setFolded(const QTextBlock &block, bool folded)
{
if (folded)
userData(block)->setFolded(true);
else {
if (TextBlockUserData *userData = testUserData(block))
return userData->setFolded(false);
}
else if (TextBlockUserData *userData = testUserData(block))
return userData->setFolded(false);
}
void BaseTextDocumentLayout::requestExtraAreaUpdate()

View File

@@ -1424,55 +1424,44 @@ bool BaseTextEditorWidget::cursorMoveKeyEvent(QKeyEvent *e)
QTextCursor::MoveMode mode = QTextCursor::MoveAnchor;
QTextCursor::MoveOperation op = QTextCursor::NoMove;
if (e == QKeySequence::MoveToNextChar)
if (e == QKeySequence::MoveToNextChar) {
op = QTextCursor::Right;
else if (e == QKeySequence::MoveToPreviousChar)
} else if (e == QKeySequence::MoveToPreviousChar) {
op = QTextCursor::Left;
else if (e == QKeySequence::SelectNextChar) {
} else if (e == QKeySequence::SelectNextChar) {
op = QTextCursor::Right;
mode = QTextCursor::KeepAnchor;
}
else if (e == QKeySequence::SelectPreviousChar) {
} else if (e == QKeySequence::SelectPreviousChar) {
op = QTextCursor::Left;
mode = QTextCursor::KeepAnchor;
}
else if (e == QKeySequence::SelectNextWord) {
} else if (e == QKeySequence::SelectNextWord) {
op = QTextCursor::WordRight;
mode = QTextCursor::KeepAnchor;
}
else if (e == QKeySequence::SelectPreviousWord) {
} else if (e == QKeySequence::SelectPreviousWord) {
op = QTextCursor::WordLeft;
mode = QTextCursor::KeepAnchor;
}
else if (e == QKeySequence::SelectStartOfLine) {
} else if (e == QKeySequence::SelectStartOfLine) {
op = QTextCursor::StartOfLine;
mode = QTextCursor::KeepAnchor;
}
else if (e == QKeySequence::SelectEndOfLine) {
} else if (e == QKeySequence::SelectEndOfLine) {
op = QTextCursor::EndOfLine;
mode = QTextCursor::KeepAnchor;
}
else if (e == QKeySequence::SelectStartOfBlock) {
} else if (e == QKeySequence::SelectStartOfBlock) {
op = QTextCursor::StartOfBlock;
mode = QTextCursor::KeepAnchor;
}
else if (e == QKeySequence::SelectEndOfBlock) {
} else if (e == QKeySequence::SelectEndOfBlock) {
op = QTextCursor::EndOfBlock;
mode = QTextCursor::KeepAnchor;
}
else if (e == QKeySequence::SelectStartOfDocument) {
} else if (e == QKeySequence::SelectStartOfDocument) {
op = QTextCursor::Start;
mode = QTextCursor::KeepAnchor;
}
else if (e == QKeySequence::SelectEndOfDocument) {
} else if (e == QKeySequence::SelectEndOfDocument) {
op = QTextCursor::End;
mode = QTextCursor::KeepAnchor;
}
else if (e == QKeySequence::SelectPreviousLine) {
} else if (e == QKeySequence::SelectPreviousLine) {
op = QTextCursor::Up;
mode = QTextCursor::KeepAnchor;
}
else if (e == QKeySequence::SelectNextLine) {
} else if (e == QKeySequence::SelectNextLine) {
op = QTextCursor::Down;
mode = QTextCursor::KeepAnchor;
{
@@ -1483,41 +1472,29 @@ bool BaseTextEditorWidget::cursorMoveKeyEvent(QKeyEvent *e)
&& line.lineNumber() == block.layout()->lineCount() - 1)
op = QTextCursor::End;
}
}
else if (e == QKeySequence::MoveToNextWord) {
} else if (e == QKeySequence::MoveToNextWord) {
op = QTextCursor::WordRight;
}
else if (e == QKeySequence::MoveToPreviousWord) {
} else if (e == QKeySequence::MoveToPreviousWord) {
op = QTextCursor::WordLeft;
}
else if (e == QKeySequence::MoveToEndOfBlock) {
} else if (e == QKeySequence::MoveToEndOfBlock) {
op = QTextCursor::EndOfBlock;
}
else if (e == QKeySequence::MoveToStartOfBlock) {
} else if (e == QKeySequence::MoveToStartOfBlock) {
op = QTextCursor::StartOfBlock;
}
else if (e == QKeySequence::MoveToNextLine) {
} else if (e == QKeySequence::MoveToNextLine) {
op = QTextCursor::Down;
}
else if (e == QKeySequence::MoveToPreviousLine) {
} else if (e == QKeySequence::MoveToPreviousLine) {
op = QTextCursor::Up;
}
else if (e == QKeySequence::MoveToPreviousLine) {
} else if (e == QKeySequence::MoveToPreviousLine) {
op = QTextCursor::Up;
}
else if (e == QKeySequence::MoveToStartOfLine) {
} else if (e == QKeySequence::MoveToStartOfLine) {
op = QTextCursor::StartOfLine;
}
else if (e == QKeySequence::MoveToEndOfLine) {
} else if (e == QKeySequence::MoveToEndOfLine) {
op = QTextCursor::EndOfLine;
}
else if (e == QKeySequence::MoveToStartOfDocument) {
} else if (e == QKeySequence::MoveToStartOfDocument) {
op = QTextCursor::Start;
}
else if (e == QKeySequence::MoveToEndOfDocument) {
} else if (e == QKeySequence::MoveToEndOfDocument) {
op = QTextCursor::End;
}
else {
} else {
return false;
}
@@ -1865,9 +1842,7 @@ void BaseTextEditorWidget::keyPressEvent(QKeyEvent *e)
}
if (ro || e->text().isEmpty() || !e->text().at(0).isPrint()) {
if (cursorMoveKeyEvent(e))
;
else {
if (!cursorMoveKeyEvent(e)) {
QTextCursor cursor = textCursor();
bool cursorWithinSnippet = false;
if (d->m_snippetOverlay->isVisible()
@@ -4001,9 +3976,9 @@ void BaseTextEditorWidget::slotModificationChanged(bool m)
void BaseTextEditorWidget::slotUpdateRequest(const QRect &r, int dy)
{
if (dy)
if (dy) {
d->m_extraArea->scroll(0, dy);
else if (r.width() > 4) { // wider than cursor width, not just cursor blinking
} else if (r.width() > 4) { // wider than cursor width, not just cursor blinking
d->m_extraArea->update(0, r.y(), d->m_extraArea->width(), r.height());
if (!d->m_searchExpr.isEmpty()) {
const int m = d->m_searchResultOverlay->dropShadowWidth();

View File

@@ -260,15 +260,15 @@ QColor FormatDescription::foreground() const
QColor FormatDescription::background() const
{
if (m_id == C_TEXT)
if (m_id == C_TEXT) {
return Qt::white;
else if (m_id == C_LINE_NUMBER)
} else if (m_id == C_LINE_NUMBER) {
return QApplication::palette().background().color();
else if (m_id == C_SEARCH_RESULT)
} else if (m_id == C_SEARCH_RESULT) {
return QColor(0xffef0b);
else if (m_id == C_PARENTHESES)
} else if (m_id == C_PARENTHESES) {
return QColor(0xb4, 0xee, 0xb4);
else if (m_id == C_CURRENT_LINE || m_id == C_SEARCH_SCOPE) {
} else if (m_id == C_CURRENT_LINE || m_id == C_SEARCH_SCOPE) {
const QPalette palette = QApplication::palette();
const QColor &fg = palette.color(QPalette::Highlight);
const QColor &bg = palette.color(QPalette::Base);

View File

@@ -84,9 +84,9 @@ void ManageDefinitionsDialog::populateDefinitionsWidget()
for (int j = 0; j < 3; ++j) {
QTableWidgetItem *item = new QTableWidgetItem;
if (j == 0)
if (j == 0) {
item->setText(downloadData.name);
else if (j == 1) {
} else if (j == 1) {
item->setText(dirVersion);
item->setTextAlignment(Qt::AlignCenter);
} else if (j == 2) {

View File

@@ -214,7 +214,7 @@ QTextDocument *RefactoringFile::mutableDocument() const
{
if (m_editor)
return m_editor->document();
else if (!m_document) {
if (!m_document) {
QString fileContents;
if (!m_fileName.isEmpty()) {
QString error;
@@ -238,7 +238,7 @@ const QTextCursor RefactoringFile::cursor() const
{
if (m_editor)
return m_editor->textCursor();
else if (!m_fileName.isEmpty()) {
if (!m_fileName.isEmpty()) {
if (QTextDocument *doc = mutableDocument())
return QTextCursor(doc);
}

View File

@@ -79,10 +79,8 @@ void TodoItemsProvider::updateList()
if (m_settings.scanningScope == ScanningScopeCurrentFile) {
if (m_currentEditor)
m_itemsList = m_itemsHash.value(m_currentEditor->document()->filePath());
}
// Show only items of the startup project if any
else {
} else {
if (m_startupProject)
setItemsListWithinStartupProject();
}

View File

@@ -408,8 +408,7 @@ void CallgrindToolPrivate::handleFilterProjectCosts()
if (m_filterProjectCosts->isChecked()) {
const QString projectDir = pro->projectDirectory();
m_proxyModel->setFilterBaseDir(projectDir);
}
else {
} else {
m_proxyModel->setFilterBaseDir(QString());
}
}

View File

@@ -188,8 +188,7 @@ void FunctionGraphicsItem::paint(QPainter *painter,
gradient.setColorAt(0.5, color.lighter(200));
gradient.setColorAt(1, color.darker(100));
painter->setBrush(gradient);
}
else {
} else {
painter->setBrush(color);
}
@@ -256,9 +255,9 @@ void Visualisation::Private::handleMousePressEvent(QMouseEvent *event,
if (itemAtPos) {
const Function *func = q->functionForItem(itemAtPos);
if (doubleClicked)
if (doubleClicked) {
q->functionActivated(func);
else {
} else {
q->scene()->clearSelection();
itemAtPos->setSelected(true);
q->functionSelected(func);

View File

@@ -440,29 +440,27 @@ void Parser::Private::parseError()
if (reader.isStartElement())
lastAuxWhat++;
const QStringRef name = reader.name();
if (name == QLatin1String("unique"))
if (name == QLatin1String("unique")) {
e.setUnique(parseHex(blockingReadElementText(), QLatin1String("unique")));
else if (name == QLatin1String("tid"))
} else if (name == QLatin1String("tid")) {
e.setTid(parseInt64(blockingReadElementText(), QLatin1String("error/tid")));
else if (name == QLatin1String("kind")) //TODO this is memcheck-specific:
} else if (name == QLatin1String("kind")) { //TODO this is memcheck-specific:
e.setKind(parseErrorKind(blockingReadElementText()));
else if (name == QLatin1String("suppression"))
} else if (name == QLatin1String("suppression")) {
e.setSuppression(parseSuppression());
else if (name == QLatin1String("xwhat")) {
} else if (name == QLatin1String("xwhat")) {
const XWhat xw = parseXWhat();
e.setWhat(xw.text);
e.setLeakedBlocks(xw.leakedblocks);
e.setLeakedBytes(xw.leakedbytes);
e.setHelgrindThreadId(xw.hthreadid);
}
else if (name == QLatin1String("what"))
} else if (name == QLatin1String("what")) {
e.setWhat(blockingReadElementText());
else if (name == QLatin1String("xauxwhat")) {
} else if (name == QLatin1String("xauxwhat")) {
if (!currentAux.text.isEmpty())
auxs.push_back(currentAux);
currentAux = parseXauxWhat();
}
else if (name == QLatin1String("auxwhat")) {
} else if (name == QLatin1String("auxwhat")) {
const QString aux = blockingReadElementText();
//concatenate multiple consecutive <auxwhat> tags
if (lastAuxWhat > 1) {
@@ -476,12 +474,11 @@ void Parser::Private::parseError()
currentAux.text.append(aux);
}
lastAuxWhat = 0;
}
else if (name == QLatin1String("stack")) {
} else if (name == QLatin1String("stack")) {
frames.push_back(parseStack());
}
else if (reader.isStartElement())
} else if (reader.isStartElement()) {
reader.skipCurrentElement();
}
}
if (!currentAux.text.isEmpty())

View File

@@ -600,13 +600,11 @@ Command *VcsBaseClient::createCommand(const QString &workingDirectory,
if (editor) { // assume that the commands output is the important thing
connect(cmd, SIGNAL(outputData(QByteArray)),
::vcsOutputWindow(), SLOT(appendDataSilently(QByteArray)));
}
else {
} else {
connect(cmd, SIGNAL(outputData(QByteArray)),
::vcsOutputWindow(), SLOT(appendData(QByteArray)));
}
}
else if (editor) {
} else if (editor) {
connect(cmd, SIGNAL(outputData(QByteArray)),
editor, SLOT(setPlainTextData(QByteArray)));
}

View File

@@ -44,11 +44,11 @@ QString CGI::encodeURL(const QString &rawText)
const char ch = *it;
if (('A' <= ch && ch <= 'Z')
|| ('a' <= ch && ch <= 'z')
|| ('0' <= ch && ch <= '9'))
|| ('0' <= ch && ch <= '9')) {
enc.append(QLatin1Char(ch));
else if (ch == ' ')
} else if (ch == ' ') {
enc.append(QLatin1Char('+'));
else {
} else {
switch (ch) {
case '-': case '_':
case '(': case ')':

View File

@@ -236,8 +236,7 @@ void BookmarkDialog::customContextMenuRequested(const QPoint &point)
if (index.isValid())
name = index.data().toString();
ui.bookmarkFolders->setCurrentIndex(ui.bookmarkFolders->findText(name));
}
else if (picked == renameItem) {
} else if (picked == renameItem) {
BookmarkModel *model = bookmarkManager->treeBookmarkModel();
if (QStandardItem *item = model->itemFromIndex(proxyIndex)) {
item->setEditable(true);
@@ -397,15 +396,14 @@ void BookmarkWidget::customContextMenuRequested(const QPoint &point)
if (!pickedAction)
return;
if (pickedAction == showItem)
if (pickedAction == showItem) {
emit linkActivated(data);
else if (pickedAction == showItemNewTab)
} else if (pickedAction == showItemNewTab) {
emit createPage(QUrl(data), false);
else if (pickedAction == removeItem) {
} else if (pickedAction == removeItem) {
bookmarkManager->removeBookmarkItem(treeView,
filterBookmarkModel->mapToSource(index));
}
else if (pickedAction == renameItem) {
} else if (pickedAction == renameItem) {
const QModelIndex &source = filterBookmarkModel->mapToSource(index);
QStandardItem *item =
bookmarkManager->treeBookmarkModel()->itemFromIndex(source);

View File

@@ -149,9 +149,8 @@ bool IndexWindow::eventFilter(QObject *obj, QEvent *e)
QAction *action = menu.exec();
if (curTab == action)
m_indexWidget->activateCurrentItem();
else if (newTab == action) {
else if (newTab == action)
open(m_indexWidget, idx);
}
}
} else if (m_indexWidget && obj == m_indexWidget->viewport()
&& e->type() == QEvent::MouseButtonRelease) {

View File

@@ -98,8 +98,7 @@ void OutputGenerator::produceRuntimeError()
int i = 1 / zero;
Q_UNUSED(i);
Q_ASSERT(false);
}
else if (m_garbage) {
} else if (m_garbage) {
std::cerr << "Writing garbage" << std::endl;
blockingWrite(m_output, "<</GARBAGE = '\"''asdfaqre");
m_output->flush();

View File

@@ -210,9 +210,9 @@ QString niceType(QString type)
QRegExp re5(QString("map<%1, %2, std::less<%3>, %4\\s*>")
.arg(key, value, key, alloc));
re5.setMinimal(true);
if (re5.indexIn(type) != -1)
if (re5.indexIn(type) != -1) {
type.replace(re5.cap(0), QString("map<%1, %2>").arg(key, value));
else {
} else {
QRegExp re7(QString("map<const %1, %2, std::less<const %3>, %4\\s*>")
.arg(key, value, key, alloc));
re7.setMinimal(true);

View File

@@ -111,18 +111,16 @@ void Preprocessor::scanActualArgument(Token *tk, std::vector<Token> *tokens)
int count = 0;
while (tk->isNot(T_EOF_SYMBOL)) {
if (tk->is(T_LPAREN))
if (tk->is(T_LPAREN)) {
++count;
else if (tk->is(T_RPAREN)) {
} else if (tk->is(T_RPAREN)) {
if (! count)
break;
--count;
}
else if (! count && tk->is(T_COMMA))
} else if (! count && tk->is(T_COMMA)) {
break;
}
tokens->push_back(*tk);
lex(tk);
@@ -165,9 +163,9 @@ _Lclassify:
for (size_t i = 0; i < body.size(); ++i) {
const Token &token = body[i];
if (token.isNot(T_IDENTIFIER))
if (token.isNot(T_IDENTIFIER)) {
expanded.push_back(token);
else {
} else {
const StringRef id = asStringRef(token);
size_t j = 0;
for (; j < macro->formals.size(); ++j) {
@@ -309,10 +307,9 @@ void Preprocessor::run(const char *source, unsigned size)
lex(&tk);
if (lineno != tk.lineno) {
if (lineno > tk.lineno || tk.lineno - lineno > 3)
if (lineno > tk.lineno || tk.lineno - lineno > 3) {
out << std::endl << "#line " << tk.lineno << " \"" << _currentFileName << "\"" << std::endl;
else {
} else {
for (unsigned i = lineno; i < tk.lineno; ++i)
out << std::endl;
}

Some files were not shown because too many files have changed in this diff Show More