Commit ad9e7cca authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

Fix coding style for else statements

Change-Id: I1309db70e98d678e150388c76ce665e988fdf081
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent c67f7f63
...@@ -57,9 +57,9 @@ function build() { ...@@ -57,9 +57,9 @@ function build() {
if (nrButtons == 0) if (nrButtons == 0)
return; return;
if (self.checkedButton) if (self.checkedButton) {
self.checkedButton.checked = true; self.checkedButton.checked = true;
else if (self.exclusive) { } else if (self.exclusive) {
self.checkedButton = visibleButtons[0]; self.checkedButton = visibleButtons[0];
self.checkedButton.checked = true; self.checkedButton.checked = true;
} }
......
...@@ -3770,9 +3770,7 @@ void *qDumpObjectData440( ...@@ -3770,9 +3770,7 @@ void *qDumpObjectData440(
d.put(",namespace=\"" NS "\","); d.put(",namespace=\"" NS "\",");
d.put("dumperversion=\"1.3\","); d.put("dumperversion=\"1.3\",");
d.disarm(); d.disarm();
} } else if (protocolVersion == 2 || protocolVersion == 3) {
else if (protocolVersion == 2 || protocolVersion == 3) {
QDumper d; QDumper d;
d.protocolVersion = protocolVersion; d.protocolVersion = protocolVersion;
...@@ -3796,9 +3794,7 @@ void *qDumpObjectData440( ...@@ -3796,9 +3794,7 @@ void *qDumpObjectData440(
<< d.outerType << d.iname << d.exp << d.iname; << d.outerType << d.iname << d.exp << d.iname;
#endif #endif
handleProtocolVersion2and3(d); handleProtocolVersion2and3(d);
} } else {
else {
#if USE_QT_CORE #if USE_QT_CORE
# ifndef QT_BOOTSTRAPPED # ifndef QT_BOOTSTRAPPED
qDebug() << "Unsupported protocol version" << protocolVersion; qDebug() << "Unsupported protocol version" << protocolVersion;
......
...@@ -257,9 +257,7 @@ void LiveSelectionTool::mouseReleaseEvent(QMouseEvent *event) ...@@ -257,9 +257,7 @@ void LiveSelectionTool::mouseReleaseEvent(QMouseEvent *event)
{ {
if (m_singleSelectionManipulator.isActive()) { if (m_singleSelectionManipulator.isActive()) {
m_singleSelectionManipulator.end(event->pos()); m_singleSelectionManipulator.end(event->pos());
} } else if (m_rubberbandSelectionManipulator.isActive()) {
else if (m_rubberbandSelectionManipulator.isActive()) {
QPointF mouseMovementVector = m_rubberbandSelectionManipulator.beginPoint() - event->pos(); QPointF mouseMovementVector = m_rubberbandSelectionManipulator.beginPoint() - event->pos();
if (mouseMovementVector.toPoint().manhattanLength() < Constants::DragStartDistance) { if (mouseMovementVector.toPoint().manhattanLength() < Constants::DragStartDistance) {
m_singleSelectionManipulator.begin(event->pos()); m_singleSelectionManipulator.begin(event->pos());
......
...@@ -84,8 +84,7 @@ QNetworkProxy ProxySettings::httpProxy () ...@@ -84,8 +84,7 @@ QNetworkProxy ProxySettings::httpProxy ()
proxy.setUser (settings.value ("http_proxy/username", "").toString ()); proxy.setUser (settings.value ("http_proxy/username", "").toString ());
proxy.setPassword (settings.value ("http_proxy/password", "").toString ()); proxy.setPassword (settings.value ("http_proxy/password", "").toString ());
//QNetworkProxy::setApplicationProxy (proxy); //QNetworkProxy::setApplicationProxy (proxy);
} } else {
else {
proxy.setType (QNetworkProxy::NoProxy); proxy.setType (QNetworkProxy::NoProxy);
} }
return proxy; return proxy;
......
...@@ -464,7 +464,8 @@ void NodeInstanceClientProxy::dispatchCommand(const QVariant &command) ...@@ -464,7 +464,8 @@ void NodeInstanceClientProxy::dispatchCommand(const QVariant &command)
else if (command.userType() == synchronizeCommandType) { else if (command.userType() == synchronizeCommandType) {
SynchronizeCommand synchronizeCommand = command.value<SynchronizeCommand>(); SynchronizeCommand synchronizeCommand = command.value<SynchronizeCommand>();
m_synchronizeId = synchronizeCommand.synchronizeId(); m_synchronizeId = synchronizeCommand.synchronizeId();
} else } else {
Q_ASSERT(false); Q_ASSERT(false);
}
} }
} // namespace QmlDesigner } // namespace QmlDesigner
...@@ -38,9 +38,9 @@ AnimatedToolButton { ...@@ -38,9 +38,9 @@ AnimatedToolButton {
hoverIconFromFile: "images/submenu.png"; hoverIconFromFile: "images/submenu.png";
function setIcon() { function setIcon() {
if (backendValue == null) if (backendValue == null) {
extendedFunctionButton.iconFromFile = "images/placeholder.png" extendedFunctionButton.iconFromFile = "images/placeholder.png"
else if (backendValue.isBound ) { } else if (backendValue.isBound ) {
if (backendValue.isTranslated) { //translations are a special case if (backendValue.isTranslated) { //translations are a special case
extendedFunctionButton.iconFromFile = "images/placeholder.png" extendedFunctionButton.iconFromFile = "images/placeholder.png"
} else { } else {
......
...@@ -400,12 +400,11 @@ int main(int argc, char **argv) ...@@ -400,12 +400,11 @@ int main(int argc, char **argv)
QNetworkProxy proxy(QNetworkProxy::HttpProxy, proxyUrl.host(), QNetworkProxy proxy(QNetworkProxy::HttpProxy, proxyUrl.host(),
proxyUrl.port(), proxyUrl.userName(), proxyUrl.password()); proxyUrl.port(), proxyUrl.userName(), proxyUrl.password());
QNetworkProxy::setApplicationProxy(proxy); QNetworkProxy::setApplicationProxy(proxy);
}
# if defined(Q_OS_MAC) // unix and mac # if defined(Q_OS_MAC) // unix and mac
else { } else {
QNetworkProxyFactory::setUseSystemConfiguration(true); QNetworkProxyFactory::setUseSystemConfiguration(true);
}
# endif # endif
}
#else // windows #else // windows
QNetworkProxyFactory::setUseSystemConfiguration(true); QNetworkProxyFactory::setUseSystemConfiguration(true);
#endif #endif
......
...@@ -129,9 +129,9 @@ public: ...@@ -129,9 +129,9 @@ public:
virtual void visit(NamedType *type) virtual void visit(NamedType *type)
{ {
FullySpecifiedType ty = rewrite->env->apply(type->name(), rewrite); FullySpecifiedType ty = rewrite->env->apply(type->name(), rewrite);
if (! ty->isUndefinedType()) if (! ty->isUndefinedType()) {
temps.append(ty); temps.append(ty);
else { } else {
const Name *name = rewrite->rewriteName(type->name()); const Name *name = rewrite->rewriteName(type->name());
temps.append(control()->namedType(name)); temps.append(control()->namedType(name));
} }
......
...@@ -264,7 +264,7 @@ private: ...@@ -264,7 +264,7 @@ private:
if (! name) if (! name)
return 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()); const Identifier *id = control()->identifier(nameId->chars(), nameId->size());
return id; return id;
......
...@@ -263,19 +263,20 @@ int ExpressionUnderCursor::startOfFunctionCall(const QTextCursor &cursor) const ...@@ -263,19 +263,20 @@ int ExpressionUnderCursor::startOfFunctionCall(const QTextCursor &cursor) const
forever { forever {
const Token &tk = scanner[index - 1]; const Token &tk = scanner[index - 1];
if (tk.is(T_EOF_SYMBOL)) if (tk.is(T_EOF_SYMBOL)) {
break; break;
else if (tk.is(T_LPAREN)) } else if (tk.is(T_LPAREN)) {
return scanner.startPosition() + tk.begin(); return scanner.startPosition() + tk.begin();
else if (tk.is(T_RPAREN)) { } else if (tk.is(T_RPAREN)) {
int matchingBrace = scanner.startOfMatchingBrace(index); int matchingBrace = scanner.startOfMatchingBrace(index);
if (matchingBrace == index) // If no matching brace found if (matchingBrace == index) // If no matching brace found
return -1; return -1;
index = matchingBrace; index = matchingBrace;
} else } else {
--index; --index;
}
} }
return -1; return -1;
......
...@@ -57,7 +57,7 @@ static void addNames(const Name *name, QList<const Name *> *names, bool addAllNa ...@@ -57,7 +57,7 @@ static void addNames(const Name *name, QList<const Name *> *names, bool addAllNa
{ {
if (! name) if (! name)
return; return;
else if (const QualifiedNameId *q = name->asQualifiedNameId()) { if (const QualifiedNameId *q = name->asQualifiedNameId()) {
addNames(q->base(), names); addNames(q->base(), names);
addNames(q->name(), names, addAllNames); addNames(q->name(), names, addAllNames);
} else if (addAllNames || name->isNameId() || name->isTemplateNameId() || name->isAnonymousNameId()) { } else if (addAllNames || name->isNameId() || name->isTemplateNameId() || name->isAnonymousNameId()) {
...@@ -98,7 +98,7 @@ static inline bool compareName(const Name *name, const Name *other) ...@@ -98,7 +98,7 @@ static inline bool compareName(const Name *name, const Name *other)
if (name == other) if (name == other)
return true; return true;
else if (name && other) { if (name && other) {
const Identifier *id = name->identifier(); const Identifier *id = name->identifier();
const Identifier *otherId = other->identifier(); const Identifier *otherId = other->identifier();
...@@ -599,10 +599,9 @@ QList<LookupItem> ClassOrNamespace::lookup_helper(const Name *name, bool searchI ...@@ -599,10 +599,9 @@ QList<LookupItem> ClassOrNamespace::lookup_helper(const Name *name, bool searchI
if (name) { if (name) {
if (const QualifiedNameId *q = name->asQualifiedNameId()) { 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()); result = globalNamespace()->find(q->name());
} else if (ClassOrNamespace *binding = lookupType(q->base())) {
else if (ClassOrNamespace *binding = lookupType(q->base())) {
result = binding->find(q->name()); result = binding->find(q->name());
QList<const Name *> fullName; QList<const Name *> fullName;
...@@ -864,7 +863,7 @@ ClassOrNamespace *ClassOrNamespace::lookupType_helper(const Name *name, ...@@ -864,7 +863,7 @@ ClassOrNamespace *ClassOrNamespace::lookupType_helper(const Name *name,
if (ClassOrNamespace *e = nestedType(name, origin)) if (ClassOrNamespace *e = nestedType(name, origin))
return e; return e;
else if (_templateId) { if (_templateId) {
if (_usings.size() == 1) { if (_usings.size() == 1) {
ClassOrNamespace *delegate = _usings.first(); ClassOrNamespace *delegate = _usings.first();
...@@ -1265,8 +1264,7 @@ bool ClassOrNamespace::NestedClassInstantiator::isInstantiateNestedClassNeeded(c ...@@ -1265,8 +1264,7 @@ bool ClassOrNamespace::NestedClassInstantiator::isInstantiateNestedClassNeeded(c
if (Declaration *declaration = memberAsSymbol->asDeclaration()) { if (Declaration *declaration = memberAsSymbol->asDeclaration()) {
if (containsTemplateType(declaration)) if (containsTemplateType(declaration))
return true; return true;
} } else if (Function *function = memberAsSymbol->asFunction()) {
else if (Function *function = memberAsSymbol->asFunction()) {
if (containsTemplateType(function)) if (containsTemplateType(function))
return true; return true;
} }
...@@ -1447,7 +1445,7 @@ void CreateBindings::process(Document::Ptr doc) ...@@ -1447,7 +1445,7 @@ void CreateBindings::process(Document::Ptr doc)
if (! doc) if (! doc)
return; return;
else if (Namespace *globalNamespace = doc->globalNamespace()) { if (Namespace *globalNamespace = doc->globalNamespace()) {
if (! _processed.contains(globalNamespace)) { if (! _processed.contains(globalNamespace)) {
_processed.insert(globalNamespace); _processed.insert(globalNamespace);
......
...@@ -244,7 +244,7 @@ QString MatchingText::insertParagraphSeparator(const QTextCursor &tc) const ...@@ -244,7 +244,7 @@ QString MatchingText::insertParagraphSeparator(const QTextCursor &tc) const
if (current.is(T_EOF_SYMBOL)) if (current.is(T_EOF_SYMBOL))
break; 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. // found a class key.
QString str = QLatin1String("};"); QString str = QLatin1String("};");
......
...@@ -170,8 +170,7 @@ bool Environment::isBuiltinMacro(const ByteArrayRef &s) ...@@ -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[3] == 'I') {
if (s[4] == 'L') { if (s[4] == 'L') {
if (s[5] == 'E') { if (s[5] == 'E') {
...@@ -183,8 +182,7 @@ bool Environment::isBuiltinMacro(const ByteArrayRef &s) ...@@ -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[3] == 'I') {
if (s[4] == 'N') { if (s[4] == 'N') {
if (s[5] == 'E') { if (s[5] == 'E') {
...@@ -196,8 +194,7 @@ bool Environment::isBuiltinMacro(const ByteArrayRef &s) ...@@ -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[3] == 'I') {
if (s[4] == 'M') { if (s[4] == 'M') {
if (s[5] == 'E') { if (s[5] == 'E') {
......
...@@ -576,16 +576,14 @@ bool ResolveExpression::visit(SimpleNameAST *ast) ...@@ -576,16 +576,14 @@ bool ResolveExpression::visit(SimpleNameAST *ast)
if (n == 0) { if (n == 0) {
item.setType(newType); item.setType(newType);
item.setScope(typeItems[n].scope()); item.setScope(typeItems[n].scope());
} } else {
else {
LookupItem newItem(item); LookupItem newItem(item);
newItem.setType(newType); newItem.setType(newType);
newItem.setScope(typeItems[n].scope()); newItem.setScope(typeItems[n].scope());
newCandidates.push_back(newItem); newCandidates.push_back(newItem);
} }
} }
} } else {
else {
item.setType(item.declaration()->type()); item.setType(item.declaration()->type());
item.setScope(item.declaration()->enclosingScope()); item.setScope(item.declaration()->enclosingScope());
} }
......
...@@ -1862,12 +1862,11 @@ void Preprocessor::handleElseDirective(PPToken *tk, const PPToken &poundToken) ...@@ -1862,12 +1862,11 @@ void Preprocessor::handleElseDirective(PPToken *tk, const PPToken &poundToken)
else if (m_client && !wasSkipping && startSkipping) else if (m_client && !wasSkipping && startSkipping)
startSkippingBlocks(poundToken); startSkippingBlocks(poundToken);
} }
}
#ifndef NO_DEBUG #ifndef NO_DEBUG
else { } else {
std::cerr << "*** WARNING #else without #if" << std::endl; std::cerr << "*** WARNING #else without #if" << std::endl;
}
#endif // NO_DEBUG #endif // NO_DEBUG
}
} }
void Preprocessor::handleEndIfDirective(PPToken *tk, const PPToken &poundToken) void Preprocessor::handleEndIfDirective(PPToken *tk, const PPToken &poundToken)
...@@ -1930,12 +1929,11 @@ void Preprocessor::handleIfDefDirective(bool checkUndefined, PPToken *tk) ...@@ -1930,12 +1929,11 @@ void Preprocessor::handleIfDefDirective(bool checkUndefined, PPToken *tk)
startSkippingBlocks(*tk); startSkippingBlocks(*tk);
lex(tk); // consume the identifier lex(tk); // consume the identifier
}
#ifndef NO_DEBUG #ifndef NO_DEBUG
else { } else {
std::cerr << "*** WARNING #ifdef without identifier" << std::endl; std::cerr << "*** WARNING #ifdef without identifier" << std::endl;
}
#endif // NO_DEBUG #endif // NO_DEBUG
}
} }
void Preprocessor::handleUndefDirective(PPToken *tk) void Preprocessor::handleUndefDirective(PPToken *tk)
...@@ -1948,12 +1946,11 @@ void Preprocessor::handleUndefDirective(PPToken *tk) ...@@ -1948,12 +1946,11 @@ void Preprocessor::handleUndefDirective(PPToken *tk)
if (m_client && macro) if (m_client && macro)
m_client->macroAdded(*macro); m_client->macroAdded(*macro);
lex(tk); // consume macro name lex(tk); // consume macro name
}
#ifndef NO_DEBUG #ifndef NO_DEBUG
else { } else {
std::cerr << "*** WARNING #undef without identifier" << std::endl; std::cerr << "*** WARNING #undef without identifier" << std::endl;
}
#endif // NO_DEBUG #endif // NO_DEBUG
}
} }
PPToken Preprocessor::generateToken(enum Kind kind, PPToken Preprocessor::generateToken(enum Kind kind,
......
...@@ -259,13 +259,13 @@ const char *pp_skip_argument::operator () (const char *__first, const char *__la ...@@ -259,13 +259,13 @@ const char *pp_skip_argument::operator () (const char *__first, const char *__la
lines = 0; lines = 0;
while (__first != __last) { while (__first != __last) {
if (!depth && (*__first == ')' || *__first == ',')) if (!depth && (*__first == ')' || *__first == ',')) {
break; break;
else if (*__first == '(') } else if (*__first == '(') {
++depth, ++__first; ++depth, ++__first;
else if (*__first == ')') } else if (*__first == ')') {
--depth, ++__first; --depth, ++__first;
else if (*__first == '\"') { } else if (*__first == '\"') {
__first = skip_string_literal (__first, __last); __first = skip_string_literal (__first, __last);
lines += skip_string_literal.lines; lines += skip_string_literal.lines;
} else if (*__first == '\'') { } else if (*__first == '\'') {
...@@ -283,8 +283,9 @@ const char *pp_skip_argument::operator () (const char *__first, const char *__la ...@@ -283,8 +283,9 @@ const char *pp_skip_argument::operator () (const char *__first, const char *__la
} else if (*__first == '\n') { } else if (*__first == '\n') {
++__first; ++__first;
++lines; ++lines;
} else } else {
++__first; ++__first;
}
} }
return __first; return __first;
......
...@@ -1183,9 +1183,9 @@ void PluginManagerPrivate::readPluginPaths() ...@@ -1183,9 +1183,9 @@ void PluginManagerPrivate::readPluginPaths()
PluginCollection *collection = 0; PluginCollection *collection = 0;
// find correct plugin collection or create a new one // find correct plugin collection or create a new one
if (pluginCategories.contains(spec->category())) if (pluginCategories.contains(spec->category())) {
collection = pluginCategories.value(spec->category()); collection = pluginCategories.value(spec->category());
else { } else {
collection = new PluginCollection(spec->category()); collection = new PluginCollection(spec->category());
pluginCategories.insert(spec->category(), collection); pluginCategories.insert(spec->category(), collection);
} }
......
...@@ -109,9 +109,9 @@ QList<Symbol *> Namespace::members() const ...@@ -109,9 +109,9 @@ QList<Symbol *> Namespace::members() const
void Namespace::add(Symbol *symbol) void Namespace::add(Symbol *symbol)
{ {
Symbol *&sym = _members[symbol->name()]; Symbol *&sym = _members[symbol->name()];
if (! sym) if (! sym) {
sym = symbol; sym = symbol;
else if (Function *fun = symbol->asFunction()) { } else if (Function *fun = symbol->asFunction()) {
if (OverloadSet *o = sym->asOverloadSet()) { if (OverloadSet *o = sym->asOverloadSet()) {
o->addFunction(fun); o->addFunction(fun);
} else if (Function *firstFunction = sym->asFunction()) { } else if (Function *firstFunction = sym->asFunction()) {
...@@ -121,8 +121,7 @@ void Namespace::add(Symbol *symbol) ...@@ -121,8 +121,7 @@ void Namespace::add(Symbol *symbol)
o->addFunction(firstFunction); o->addFunction(firstFunction);
o->addFunction(fun); o->addFunction(fun);
sym = o; sym = o;
} } else {
else {
// ### warning? return false? // ### warning? return false?
} }
} else { } else {
......
...@@ -298,9 +298,9 @@ bool MatrixType::isLessThan(const Type *other) const ...@@ -298,9 +298,9 @@ bool MatrixType::isLessThan(const Type *other) const
Q_ASSERT(other != 0); Q_ASSERT(other != 0);
const MatrixType *mat = other->asMatrixType(); const MatrixType *mat = other->asMatrixType();
Q_ASSERT(mat != 0); Q_ASSERT(mat != 0);
if (_columns < mat->columns()) if (_columns < mat->columns()) {
return true; return true;
else if (_columns == mat->columns()) { } else if (_columns == mat->columns()) {
if (_rows < mat->rows()) if (_rows < mat->rows())
return true; return true;
else if (_rows == mat->rows() && _elementType < mat->elementType()) else if (_rows == mat->rows() && _elementType < mat->elementType())
......
...@@ -228,9 +228,9 @@ void EasingContextPane::setGraphDisplayMode(GraphDisplayMode newMode) ...@@ -228,9 +228,9 @@ void EasingContextPane::setGraphDisplayMode(GraphDisplayMode newMode)
void EasingContextPane::startAnimation() void EasingContextPane::startAnimation()
{ {
if (m_simulation->running()) if (m_simulation->running()) {
m_simulation->stop(); m_simulation->stop();
else { } else {
m_simulation->animate(ui->durationSpinBox->value(), m_easingGraph->easingCurve()); m_simulation->animate(ui->durationSpinBox->value(), m_easingGraph->easingCurve());