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

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() {
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;
}
......
......@@ -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;
......
......@@ -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());
......
......@@ -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;
......
......@@ -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
......@@ -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 {
......
......@@ -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
......
......@@ -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));
}
......
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
......@@ -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("};");
......
......@@ -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') {
......
......@@ -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());
}
......
......@@ -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,
......
......@@ -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;
......
......@@ -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);
}
......
......@@ -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 {
......
......@@ -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())
......
......@@ -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")));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment