Commit 4442a927 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by hjk
Browse files

Braces cleanup



Change-Id: I8413252c90a1487d291f15d92837c30ab697b245
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent bfad6f10
......@@ -344,9 +344,8 @@ ClassOrNamespace *LookupContext::lookupType(const Name *name, Scope *scope,
if (name->isNameId()) {
if (const Name *usingDeclarationName = ud->name()) {
if (const QualifiedNameId *q = usingDeclarationName->asQualifiedNameId()) {
if (q->name() && q->name()->isEqualTo(name)) {
if (q->name() && q->name()->isEqualTo(name))
return bindings()->globalNamespace()->lookupType(q);
}
}
}
}
......@@ -802,9 +801,8 @@ ClassOrNamespace *ClassOrNamespace::findBlock(Block *block)
flush();
QHash<Block *, ClassOrNamespace *>::const_iterator citBlock = _blocks.find(block);
if (citBlock != _blocks.end()) {
if (citBlock != _blocks.end())
return citBlock.value();
}
for (citBlock = _blocks.begin(); citBlock != _blocks.end(); ++citBlock) {
if (ClassOrNamespace *foundNestedBlock = citBlock.value()->findBlock(block))
......@@ -1110,9 +1108,8 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name, ClassOrNamespac
for (unsigned i = 0; i < klassMemberCount; ++i){
Symbol *klassMemberAsSymbol = klass->memberAt(i);
if (klassMemberAsSymbol->isTypedef()) {
if (Declaration *declaration = klassMemberAsSymbol->asDeclaration()) {
if (Declaration *declaration = klassMemberAsSymbol->asDeclaration())
qDebug() << "Member: " << oo(declaration->type(), declaration->name());
}
}
}
}
......
......@@ -1121,9 +1121,8 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas
if (! isTypeTypedefed(originalType, ty)
|| ! areOriginalAndTypedefedTypePointer(originalType, ty)) {
*replacedDotOperator = originalType->isPointerType() || ty->isPointerType();
if (PointerType *ptrTy = ty->asPointerType()) {
if (PointerType *ptrTy = ty->asPointerType())
ty = ptrTy->elementType();
}
}
}
......
......@@ -311,9 +311,8 @@ Import LinkPrivate::importFileOrDirectory(Document::Ptr doc, const ImportInfo &i
QLocale locale;
QStringList filePaths = ModelManagerInterface::instance()
->filesAtQrcPath(path, &locale, 0, ModelManagerInterface::ActiveQrcResources);
if (filePaths.isEmpty()) {
if (filePaths.isEmpty())
filePaths = ModelManagerInterface::instance()->filesAtQrcPath(path);
}
if (!filePaths.isEmpty()) {
Document::Ptr importedDoc = snapshot.document(filePaths.at(0));
if (importedDoc)
......
......@@ -111,11 +111,10 @@ private:
QString QrcParser::normalizedQrcFilePath(const QString &path) {
QString normPath = path;
int endPrefix = 0;
if (path.startsWith(QLatin1String("qrc:/"))) {
if (path.startsWith(QLatin1String("qrc:/")))
endPrefix = 4;
} else if (path.startsWith(QLatin1String(":/"))) {
else if (path.startsWith(QLatin1String(":/")))
endPrefix = 1;
}
if (endPrefix < path.size() && path.at(endPrefix) == QLatin1Char('/'))
while (endPrefix + 1 < path.size() && path.at(endPrefix+1) == QLatin1Char('/'))
++endPrefix;
......@@ -377,9 +376,8 @@ void QrcParserPrivate::collectFilesInPath(const QString &path, QMap<QString,QStr
QString fileName = res.key().right(res.key().size()-key.size());
QStringList &els = (*contents)[fileName];
foreach (const QString &val, res.value())
if (!els.contains(val)){
if (!els.contains(val))
els << val;
}
++res;
} else {
QString dirName = res.key().mid(key.size(), endDir - key.size() + 1);
......
......@@ -632,8 +632,7 @@ void TypeDescriptionReader::readEnumValues(AST::UiScriptBinding *ast, LanguageUt
continue;
}
PropertyGetterSetter *getterSetter = AST::cast<PropertyGetterSetter *>(it->assignment);
if (getterSetter) {
if (getterSetter)
addError(objectLit->firstSourceLocation(), tr("Enum should not contain getter and setters, but only 'string: number' elements."));
}
}
}
......@@ -1011,11 +1011,10 @@ extern "C" HRESULT CALLBACK stack(CIDebugClient *Client, PCSTR argsIn)
tokens.pop_front();
}
if (!tokens.empty()) {
if (tokens.front() == "unlimited") {
if (tokens.front() == "unlimited")
maxFrames = 1000;
} else {
else
integerFromString(tokens.front(), &maxFrames);
}
}
const std::string stack = gdbmiStack(exc.control(), exc.symbols(),
......
......@@ -117,9 +117,8 @@ void AndroidDeployStepWidget::setQASIPackagePath()
QString packagePath =
QFileDialog::getOpenFileName(this, tr("Qt Android Smart Installer"),
QDir::homePath(), tr("Android package (*.apk)"));
if (!packagePath.isEmpty()) {
if (!packagePath.isEmpty())
AndroidManager::installQASIPackage(m_step->target(), packagePath);
}
}
......
......@@ -367,15 +367,13 @@ bool AndroidManager::bundleQt(ProjectExplorer::Target *target)
{
AndroidDeployStep *androidDeployStep
= AndroidGlobal::buildStep<AndroidDeployStep>(target->activeDeployConfiguration());
if (androidDeployStep) {
if (androidDeployStep)
return androidDeployStep->deployAction() == AndroidDeployStep::BundleLibraries;
}
AndroidDeployQtStep *androidDeployQtStep
= AndroidGlobal::buildStep<AndroidDeployQtStep>(target->activeDeployConfiguration());
if (androidDeployQtStep) {
if (androidDeployQtStep)
return androidDeployQtStep->deployAction() == AndroidDeployQtStep::BundleLibrariesDeployment;
}
return false;
}
......@@ -819,9 +817,8 @@ QVector<AndroidManager::Library> AndroidManager::availableQtLibsWithDependencies
if (!qmakeProject || !version)
return QVector<AndroidManager::Library>();
QString qtLibsPath = version->qmakeProperty("QT_INSTALL_LIBS");
if (!readelfPath.toFileInfo().exists()) {
if (!readelfPath.toFileInfo().exists())
return QVector<AndroidManager::Library>();
}
LibrariesMap mapLibs;
QDir libPath;
QDirIterator it(qtLibsPath, QStringList() << QLatin1String("*.so"), QDir::Files, QDirIterator::Subdirectories);
......@@ -997,9 +994,8 @@ QString AndroidManager::loadLocal(ProjectExplorer::Target *target, int apiLevel,
dependencyLib = dependencyLib.arg(apiLevel);
if (libElement.hasAttribute(QLatin1String("extends"))) {
const QString extends = libElement.attribute(QLatin1String("extends"));
if (libs.contains(extends)) {
if (libs.contains(extends))
dependencyLibs << dependencyLib;
}
} else if (!dependencyLibs.contains(dependencyLib)) {
dependencyLibs << dependencyLib;
}
......
......@@ -455,9 +455,8 @@ void AndroidManifestEditorWidget::initializePage()
bool AndroidManifestEditorWidget::eventFilter(QObject *obj, QEvent *event)
{
if (obj == m_targetLineEdit) {
if (event->type() == QEvent::FocusIn) {
if (event->type() == QEvent::FocusIn)
QTimer::singleShot(0, this, SLOT(updateTargetComboBox()));
}
}
if (obj == m_overlayWidget)
......@@ -561,9 +560,8 @@ bool AndroidManifestEditorWidget::setActivePage(EditorPage page)
syncToEditor();
setFocus();
} else {
if (!syncToWidgets()) {
if (!syncToWidgets())
return false;
}
QWidget *fw = m_overlayWidget->focusWidget();
if (fw && fw != m_overlayWidget)
......
......@@ -44,9 +44,8 @@ BareMetalGdbCommandsDeployStepWidget::BareMetalGdbCommandsDeployStepWidget(BareM
m_commands = new QPlainTextEdit(this);
fl->addRow(tr("GDB commands:"),m_commands);
m_commands->setPlainText(m_step.gdbCommands());
if (!connect(m_commands,SIGNAL(textChanged()),SLOT(update()))) {
if (!connect(m_commands,SIGNAL(textChanged()),SLOT(update())))
qDebug()<<"BareMetalGdbCommandsDeployStepWidget connect failed.";
}
}
void BareMetalGdbCommandsDeployStepWidget::update()
......
......@@ -58,11 +58,10 @@ void CMakeParser::stdError(const QString &line)
{
QString trimmedLine = rightTrimmed(line);
if (trimmedLine.isEmpty() && !m_lastTask.isNull()) {
if (m_skippedFirstEmptyLine) {
if (m_skippedFirstEmptyLine)
doFlush();
} else {
else
m_skippedFirstEmptyLine = true;
}
return;
}
if (m_skippedFirstEmptyLine)
......
......@@ -728,9 +728,8 @@ void EditorManager::closeView(Core::Internal::EditorView *view)
bool EditorManager::closeAllEditors(bool askAboutModifiedEditors)
{
d->m_documentModel->removeAllRestoredDocuments();
if (closeDocuments(d->m_documentModel->openedDocuments(), askAboutModifiedEditors)) {
if (closeDocuments(d->m_documentModel->openedDocuments(), askAboutModifiedEditors))
return true;
}
return false;
}
......
......@@ -270,8 +270,7 @@ void OpenEditorsWindow::addHistoryItems(const QList<EditLocation> &history, Edit
m_editorList->addTopLevelItem(item);
if (m_editorList->topLevelItemCount() == 1){
if (m_editorList->topLevelItemCount() == 1)
m_editorList->setCurrentItem(item);
}
}
}
......@@ -468,9 +468,8 @@ BaseTextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &
// token[.....] == ....
// token[i + n] == T_RPAREN
if (i + 1 < tokens.size() && tokens.at(i + 1).is(T_LPAREN)) {
if (i + 1 < tokens.size() && tokens.at(i + 1).is(T_LPAREN))
closingParenthesisPos = skipMatchingParentheses(tokens, i - 1, 0);
}
} else if ((i > 3 && tk.is(T_LPAREN) && tokens.at(i - 1).is(T_IDENTIFIER)
&& tokens.at(i - 2).is(T_LPAREN)
&& (tokens.at(i - 3).is(T_SIGNAL) || tokens.at(i - 3).is(T_SLOT)))) {
......
......@@ -242,11 +242,10 @@ int LineForNewIncludeDirective::operator()(const QString &newIncludeFileName,
if (group.commonIncludeDir() == IncludeGroup::includeDir(pureIncludeFileName))
localBestIncludeGroup = group;
}
if (!localBestIncludeGroup.isEmpty()) {
if (!localBestIncludeGroup.isEmpty())
bestGroup = localBestIncludeGroup;
} else {
else
bestGroup = groupsMixedIncludeDirs.last();
}
}
}
......
......@@ -141,9 +141,8 @@ bool SearchSymbols::visit(Class *symbol)
QString name = symbolName(symbol);
QString scopedName = scopedSymbolName(name);
QString previousScope = switchScope(scopedName);
if (symbolsToSearchFor & SymbolSearcher::Classes) {
if (symbolsToSearchFor & SymbolSearcher::Classes)
appendItem(name, QString(), previousScope, ModelItemInfo::Class, symbol);
}
for (unsigned i = 0; i < symbol->memberCount(); ++i) {
accept(symbol->memberAt(i));
}
......
......@@ -155,11 +155,10 @@ void ImageViewer::contextMenuEvent(QContextMenuEvent *ev)
copyAction->setEnabled(hasImage);
imageViewerAction->setEnabled(hasImage);
QAction *action = menu.exec(ev->globalPos());
if (action == copyAction) {
if (action == copyAction)
QApplication::clipboard()->setImage(image);
} else if (action == imageViewerAction) {
else if (action == imageViewerAction)
openImageViewer(image);
}
}
#include "imageviewer.moc"
......@@ -148,11 +148,10 @@ void LldbEngine::abortDebugger()
void LldbEngine::setupEngine()
{
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
if (startParameters().remoteSetupNeeded) {
if (startParameters().remoteSetupNeeded)
notifyEngineRequestRemoteSetup();
} else {
else
startLldb();
}
}
void LldbEngine::startLldb()
......
......@@ -128,9 +128,8 @@ void DiffEditorPlugin::diff()
QString DiffEditorPlugin::getFileContents(const QString &fileName, QTextCodec *codec) const
{
QFile file(fileName);
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
if (file.open(QIODevice::ReadOnly | QIODevice::Text))
return codec->toUnicode(file.readAll());
}
return QString();
}
......
......@@ -1051,11 +1051,10 @@ ChunkData DiffEditorWidget::calculateOriginalData(const QList<Diff> &diffList) c
const QStringList lines = diff.text.split(QLatin1Char('\n'));
const bool equal = isEqual(diffList, i);
if (diff.command == Diff::Insert) {
if (diff.command == Diff::Insert)
lastRightLineEqual = lastRightLineEqual && equal;
} else if (diff.command == Diff::Delete) {
else if (diff.command == Diff::Delete)
lastLeftLineEqual = lastLeftLineEqual && equal;
}
const int lastLeftPos = currentLeftPos;
const int lastRightPos = currentRightPos;
......
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