Braces cleanup

Change-Id: I8413252c90a1487d291f15d92837c30ab697b245
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
Orgad Shaneh
2013-11-11 22:20:47 +02:00
committed by hjk
parent bfad6f107a
commit 4442a92729
61 changed files with 119 additions and 212 deletions

View File

@@ -344,9 +344,8 @@ ClassOrNamespace *LookupContext::lookupType(const Name *name, Scope *scope,
if (name->isNameId()) { if (name->isNameId()) {
if (const Name *usingDeclarationName = ud->name()) { if (const Name *usingDeclarationName = ud->name()) {
if (const QualifiedNameId *q = usingDeclarationName->asQualifiedNameId()) { 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); return bindings()->globalNamespace()->lookupType(q);
}
} }
} }
} }
@@ -802,9 +801,8 @@ ClassOrNamespace *ClassOrNamespace::findBlock(Block *block)
flush(); flush();
QHash<Block *, ClassOrNamespace *>::const_iterator citBlock = _blocks.find(block); QHash<Block *, ClassOrNamespace *>::const_iterator citBlock = _blocks.find(block);
if (citBlock != _blocks.end()) { if (citBlock != _blocks.end())
return citBlock.value(); return citBlock.value();
}
for (citBlock = _blocks.begin(); citBlock != _blocks.end(); ++citBlock) { for (citBlock = _blocks.begin(); citBlock != _blocks.end(); ++citBlock) {
if (ClassOrNamespace *foundNestedBlock = citBlock.value()->findBlock(block)) 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){ for (unsigned i = 0; i < klassMemberCount; ++i){
Symbol *klassMemberAsSymbol = klass->memberAt(i); Symbol *klassMemberAsSymbol = klass->memberAt(i);
if (klassMemberAsSymbol->isTypedef()) { if (klassMemberAsSymbol->isTypedef()) {
if (Declaration *declaration = klassMemberAsSymbol->asDeclaration()) { if (Declaration *declaration = klassMemberAsSymbol->asDeclaration())
qDebug() << "Member: " << oo(declaration->type(), declaration->name()); qDebug() << "Member: " << oo(declaration->type(), declaration->name());
}
} }
} }
} }

View File

@@ -1121,9 +1121,8 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas
if (! isTypeTypedefed(originalType, ty) if (! isTypeTypedefed(originalType, ty)
|| ! areOriginalAndTypedefedTypePointer(originalType, ty)) { || ! areOriginalAndTypedefedTypePointer(originalType, ty)) {
*replacedDotOperator = originalType->isPointerType() || ty->isPointerType(); *replacedDotOperator = originalType->isPointerType() || ty->isPointerType();
if (PointerType *ptrTy = ty->asPointerType()) { if (PointerType *ptrTy = ty->asPointerType())
ty = ptrTy->elementType(); ty = ptrTy->elementType();
}
} }
} }

View File

@@ -311,9 +311,8 @@ Import LinkPrivate::importFileOrDirectory(Document::Ptr doc, const ImportInfo &i
QLocale locale; QLocale locale;
QStringList filePaths = ModelManagerInterface::instance() QStringList filePaths = ModelManagerInterface::instance()
->filesAtQrcPath(path, &locale, 0, ModelManagerInterface::ActiveQrcResources); ->filesAtQrcPath(path, &locale, 0, ModelManagerInterface::ActiveQrcResources);
if (filePaths.isEmpty()) { if (filePaths.isEmpty())
filePaths = ModelManagerInterface::instance()->filesAtQrcPath(path); filePaths = ModelManagerInterface::instance()->filesAtQrcPath(path);
}
if (!filePaths.isEmpty()) { if (!filePaths.isEmpty()) {
Document::Ptr importedDoc = snapshot.document(filePaths.at(0)); Document::Ptr importedDoc = snapshot.document(filePaths.at(0));
if (importedDoc) if (importedDoc)

View File

@@ -111,11 +111,10 @@ private:
QString QrcParser::normalizedQrcFilePath(const QString &path) { QString QrcParser::normalizedQrcFilePath(const QString &path) {
QString normPath = path; QString normPath = path;
int endPrefix = 0; int endPrefix = 0;
if (path.startsWith(QLatin1String("qrc:/"))) { if (path.startsWith(QLatin1String("qrc:/")))
endPrefix = 4; endPrefix = 4;
} else if (path.startsWith(QLatin1String(":/"))) { else if (path.startsWith(QLatin1String(":/")))
endPrefix = 1; endPrefix = 1;
}
if (endPrefix < path.size() && path.at(endPrefix) == QLatin1Char('/')) if (endPrefix < path.size() && path.at(endPrefix) == QLatin1Char('/'))
while (endPrefix + 1 < path.size() && path.at(endPrefix+1) == QLatin1Char('/')) while (endPrefix + 1 < path.size() && path.at(endPrefix+1) == QLatin1Char('/'))
++endPrefix; ++endPrefix;
@@ -377,9 +376,8 @@ void QrcParserPrivate::collectFilesInPath(const QString &path, QMap<QString,QStr
QString fileName = res.key().right(res.key().size()-key.size()); QString fileName = res.key().right(res.key().size()-key.size());
QStringList &els = (*contents)[fileName]; QStringList &els = (*contents)[fileName];
foreach (const QString &val, res.value()) foreach (const QString &val, res.value())
if (!els.contains(val)){ if (!els.contains(val))
els << val; els << val;
}
++res; ++res;
} else { } else {
QString dirName = res.key().mid(key.size(), endDir - key.size() + 1); QString dirName = res.key().mid(key.size(), endDir - key.size() + 1);

View File

@@ -632,8 +632,7 @@ void TypeDescriptionReader::readEnumValues(AST::UiScriptBinding *ast, LanguageUt
continue; continue;
} }
PropertyGetterSetter *getterSetter = AST::cast<PropertyGetterSetter *>(it->assignment); 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.")); addError(objectLit->firstSourceLocation(), tr("Enum should not contain getter and setters, but only 'string: number' elements."));
}
} }
} }

View File

@@ -1011,11 +1011,10 @@ extern "C" HRESULT CALLBACK stack(CIDebugClient *Client, PCSTR argsIn)
tokens.pop_front(); tokens.pop_front();
} }
if (!tokens.empty()) { if (!tokens.empty()) {
if (tokens.front() == "unlimited") { if (tokens.front() == "unlimited")
maxFrames = 1000; maxFrames = 1000;
} else { else
integerFromString(tokens.front(), &maxFrames); integerFromString(tokens.front(), &maxFrames);
}
} }
const std::string stack = gdbmiStack(exc.control(), exc.symbols(), const std::string stack = gdbmiStack(exc.control(), exc.symbols(),

View File

@@ -117,9 +117,8 @@ void AndroidDeployStepWidget::setQASIPackagePath()
QString packagePath = QString packagePath =
QFileDialog::getOpenFileName(this, tr("Qt Android Smart Installer"), QFileDialog::getOpenFileName(this, tr("Qt Android Smart Installer"),
QDir::homePath(), tr("Android package (*.apk)")); QDir::homePath(), tr("Android package (*.apk)"));
if (!packagePath.isEmpty()) { if (!packagePath.isEmpty())
AndroidManager::installQASIPackage(m_step->target(), packagePath); AndroidManager::installQASIPackage(m_step->target(), packagePath);
}
} }

View File

@@ -367,15 +367,13 @@ bool AndroidManager::bundleQt(ProjectExplorer::Target *target)
{ {
AndroidDeployStep *androidDeployStep AndroidDeployStep *androidDeployStep
= AndroidGlobal::buildStep<AndroidDeployStep>(target->activeDeployConfiguration()); = AndroidGlobal::buildStep<AndroidDeployStep>(target->activeDeployConfiguration());
if (androidDeployStep) { if (androidDeployStep)
return androidDeployStep->deployAction() == AndroidDeployStep::BundleLibraries; return androidDeployStep->deployAction() == AndroidDeployStep::BundleLibraries;
}
AndroidDeployQtStep *androidDeployQtStep AndroidDeployQtStep *androidDeployQtStep
= AndroidGlobal::buildStep<AndroidDeployQtStep>(target->activeDeployConfiguration()); = AndroidGlobal::buildStep<AndroidDeployQtStep>(target->activeDeployConfiguration());
if (androidDeployQtStep) { if (androidDeployQtStep)
return androidDeployQtStep->deployAction() == AndroidDeployQtStep::BundleLibrariesDeployment; return androidDeployQtStep->deployAction() == AndroidDeployQtStep::BundleLibrariesDeployment;
}
return false; return false;
} }
@@ -819,9 +817,8 @@ QVector<AndroidManager::Library> AndroidManager::availableQtLibsWithDependencies
if (!qmakeProject || !version) if (!qmakeProject || !version)
return QVector<AndroidManager::Library>(); return QVector<AndroidManager::Library>();
QString qtLibsPath = version->qmakeProperty("QT_INSTALL_LIBS"); QString qtLibsPath = version->qmakeProperty("QT_INSTALL_LIBS");
if (!readelfPath.toFileInfo().exists()) { if (!readelfPath.toFileInfo().exists())
return QVector<AndroidManager::Library>(); return QVector<AndroidManager::Library>();
}
LibrariesMap mapLibs; LibrariesMap mapLibs;
QDir libPath; QDir libPath;
QDirIterator it(qtLibsPath, QStringList() << QLatin1String("*.so"), QDir::Files, QDirIterator::Subdirectories); 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); dependencyLib = dependencyLib.arg(apiLevel);
if (libElement.hasAttribute(QLatin1String("extends"))) { if (libElement.hasAttribute(QLatin1String("extends"))) {
const QString extends = libElement.attribute(QLatin1String("extends")); const QString extends = libElement.attribute(QLatin1String("extends"));
if (libs.contains(extends)) { if (libs.contains(extends))
dependencyLibs << dependencyLib; dependencyLibs << dependencyLib;
}
} else if (!dependencyLibs.contains(dependencyLib)) { } else if (!dependencyLibs.contains(dependencyLib)) {
dependencyLibs << dependencyLib; dependencyLibs << dependencyLib;
} }

View File

@@ -455,9 +455,8 @@ void AndroidManifestEditorWidget::initializePage()
bool AndroidManifestEditorWidget::eventFilter(QObject *obj, QEvent *event) bool AndroidManifestEditorWidget::eventFilter(QObject *obj, QEvent *event)
{ {
if (obj == m_targetLineEdit) { if (obj == m_targetLineEdit) {
if (event->type() == QEvent::FocusIn) { if (event->type() == QEvent::FocusIn)
QTimer::singleShot(0, this, SLOT(updateTargetComboBox())); QTimer::singleShot(0, this, SLOT(updateTargetComboBox()));
}
} }
if (obj == m_overlayWidget) if (obj == m_overlayWidget)
@@ -561,9 +560,8 @@ bool AndroidManifestEditorWidget::setActivePage(EditorPage page)
syncToEditor(); syncToEditor();
setFocus(); setFocus();
} else { } else {
if (!syncToWidgets()) { if (!syncToWidgets())
return false; return false;
}
QWidget *fw = m_overlayWidget->focusWidget(); QWidget *fw = m_overlayWidget->focusWidget();
if (fw && fw != m_overlayWidget) if (fw && fw != m_overlayWidget)

View File

@@ -44,9 +44,8 @@ BareMetalGdbCommandsDeployStepWidget::BareMetalGdbCommandsDeployStepWidget(BareM
m_commands = new QPlainTextEdit(this); m_commands = new QPlainTextEdit(this);
fl->addRow(tr("GDB commands:"),m_commands); fl->addRow(tr("GDB commands:"),m_commands);
m_commands->setPlainText(m_step.gdbCommands()); 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."; qDebug()<<"BareMetalGdbCommandsDeployStepWidget connect failed.";
}
} }
void BareMetalGdbCommandsDeployStepWidget::update() void BareMetalGdbCommandsDeployStepWidget::update()

View File

@@ -58,11 +58,10 @@ void CMakeParser::stdError(const QString &line)
{ {
QString trimmedLine = rightTrimmed(line); QString trimmedLine = rightTrimmed(line);
if (trimmedLine.isEmpty() && !m_lastTask.isNull()) { if (trimmedLine.isEmpty() && !m_lastTask.isNull()) {
if (m_skippedFirstEmptyLine) { if (m_skippedFirstEmptyLine)
doFlush(); doFlush();
} else { else
m_skippedFirstEmptyLine = true; m_skippedFirstEmptyLine = true;
}
return; return;
} }
if (m_skippedFirstEmptyLine) if (m_skippedFirstEmptyLine)

View File

@@ -728,9 +728,8 @@ void EditorManager::closeView(Core::Internal::EditorView *view)
bool EditorManager::closeAllEditors(bool askAboutModifiedEditors) bool EditorManager::closeAllEditors(bool askAboutModifiedEditors)
{ {
d->m_documentModel->removeAllRestoredDocuments(); d->m_documentModel->removeAllRestoredDocuments();
if (closeDocuments(d->m_documentModel->openedDocuments(), askAboutModifiedEditors)) { if (closeDocuments(d->m_documentModel->openedDocuments(), askAboutModifiedEditors))
return true; return true;
}
return false; return false;
} }

View File

@@ -270,8 +270,7 @@ void OpenEditorsWindow::addHistoryItems(const QList<EditLocation> &history, Edit
m_editorList->addTopLevelItem(item); m_editorList->addTopLevelItem(item);
if (m_editorList->topLevelItemCount() == 1){ if (m_editorList->topLevelItemCount() == 1)
m_editorList->setCurrentItem(item); m_editorList->setCurrentItem(item);
}
} }
} }

View File

@@ -468,9 +468,8 @@ BaseTextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &
// token[.....] == .... // token[.....] == ....
// token[i + n] == T_RPAREN // 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); closingParenthesisPos = skipMatchingParentheses(tokens, i - 1, 0);
}
} else if ((i > 3 && tk.is(T_LPAREN) && tokens.at(i - 1).is(T_IDENTIFIER) } 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 - 2).is(T_LPAREN)
&& (tokens.at(i - 3).is(T_SIGNAL) || tokens.at(i - 3).is(T_SLOT)))) { && (tokens.at(i - 3).is(T_SIGNAL) || tokens.at(i - 3).is(T_SLOT)))) {

View File

@@ -242,11 +242,10 @@ int LineForNewIncludeDirective::operator()(const QString &newIncludeFileName,
if (group.commonIncludeDir() == IncludeGroup::includeDir(pureIncludeFileName)) if (group.commonIncludeDir() == IncludeGroup::includeDir(pureIncludeFileName))
localBestIncludeGroup = group; localBestIncludeGroup = group;
} }
if (!localBestIncludeGroup.isEmpty()) { if (!localBestIncludeGroup.isEmpty())
bestGroup = localBestIncludeGroup; bestGroup = localBestIncludeGroup;
} else { else
bestGroup = groupsMixedIncludeDirs.last(); bestGroup = groupsMixedIncludeDirs.last();
}
} }
} }

View File

@@ -141,9 +141,8 @@ bool SearchSymbols::visit(Class *symbol)
QString name = symbolName(symbol); QString name = symbolName(symbol);
QString scopedName = scopedSymbolName(name); QString scopedName = scopedSymbolName(name);
QString previousScope = switchScope(scopedName); QString previousScope = switchScope(scopedName);
if (symbolsToSearchFor & SymbolSearcher::Classes) { if (symbolsToSearchFor & SymbolSearcher::Classes)
appendItem(name, QString(), previousScope, ModelItemInfo::Class, symbol); appendItem(name, QString(), previousScope, ModelItemInfo::Class, symbol);
}
for (unsigned i = 0; i < symbol->memberCount(); ++i) { for (unsigned i = 0; i < symbol->memberCount(); ++i) {
accept(symbol->memberAt(i)); accept(symbol->memberAt(i));
} }

View File

@@ -155,11 +155,10 @@ void ImageViewer::contextMenuEvent(QContextMenuEvent *ev)
copyAction->setEnabled(hasImage); copyAction->setEnabled(hasImage);
imageViewerAction->setEnabled(hasImage); imageViewerAction->setEnabled(hasImage);
QAction *action = menu.exec(ev->globalPos()); QAction *action = menu.exec(ev->globalPos());
if (action == copyAction) { if (action == copyAction)
QApplication::clipboard()->setImage(image); QApplication::clipboard()->setImage(image);
} else if (action == imageViewerAction) { else if (action == imageViewerAction)
openImageViewer(image); openImageViewer(image);
}
} }
#include "imageviewer.moc" #include "imageviewer.moc"

View File

@@ -148,11 +148,10 @@ void LldbEngine::abortDebugger()
void LldbEngine::setupEngine() void LldbEngine::setupEngine()
{ {
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state()); QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
if (startParameters().remoteSetupNeeded) { if (startParameters().remoteSetupNeeded)
notifyEngineRequestRemoteSetup(); notifyEngineRequestRemoteSetup();
} else { else
startLldb(); startLldb();
}
} }
void LldbEngine::startLldb() void LldbEngine::startLldb()

View File

@@ -128,9 +128,8 @@ void DiffEditorPlugin::diff()
QString DiffEditorPlugin::getFileContents(const QString &fileName, QTextCodec *codec) const QString DiffEditorPlugin::getFileContents(const QString &fileName, QTextCodec *codec) const
{ {
QFile file(fileName); QFile file(fileName);
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { if (file.open(QIODevice::ReadOnly | QIODevice::Text))
return codec->toUnicode(file.readAll()); return codec->toUnicode(file.readAll());
}
return QString(); return QString();
} }

View File

@@ -1051,11 +1051,10 @@ ChunkData DiffEditorWidget::calculateOriginalData(const QList<Diff> &diffList) c
const QStringList lines = diff.text.split(QLatin1Char('\n')); const QStringList lines = diff.text.split(QLatin1Char('\n'));
const bool equal = isEqual(diffList, i); const bool equal = isEqual(diffList, i);
if (diff.command == Diff::Insert) { if (diff.command == Diff::Insert)
lastRightLineEqual = lastRightLineEqual && equal; lastRightLineEqual = lastRightLineEqual && equal;
} else if (diff.command == Diff::Delete) { else if (diff.command == Diff::Delete)
lastLeftLineEqual = lastLeftLineEqual && equal; lastLeftLineEqual = lastLeftLineEqual && equal;
}
const int lastLeftPos = currentLeftPos; const int lastLeftPos = currentLeftPos;
const int lastRightPos = currentRightPos; const int lastRightPos = currentRightPos;

View File

@@ -405,11 +405,10 @@ QList<Diff> Differ::diffMyers(const QString &text1, const QString &text2)
k <= qMin(d, kMaxForward - qAbs(d + kMaxForward) % 2); k <= qMin(d, kMaxForward - qAbs(d + kMaxForward) % 2);
k = k + 2) { k = k + 2) {
int x; int x;
if (k == -d || (k < d && forwardV[k + vShift - 1] < forwardV[k + vShift + 1])) { if (k == -d || (k < d && forwardV[k + vShift - 1] < forwardV[k + vShift + 1]))
x = forwardV[k + vShift + 1]; // copy vertically from diagonal k + 1, y increases, y may exceed the graph x = forwardV[k + vShift + 1]; // copy vertically from diagonal k + 1, y increases, y may exceed the graph
} else { else
x = forwardV[k + vShift - 1] + 1; // copy horizontally from diagonal k - 1, x increases, x may exceed the graph x = forwardV[k + vShift - 1] + 1; // copy horizontally from diagonal k - 1, x increases, x may exceed the graph
}
int y = x - k; int y = x - k;
if (x > n) { if (x > n) {
@@ -441,11 +440,10 @@ QList<Diff> Differ::diffMyers(const QString &text1, const QString &text2)
k <= qMin(d, kMaxReverse - qAbs(d + kMaxReverse) % 2); k <= qMin(d, kMaxReverse - qAbs(d + kMaxReverse) % 2);
k = k + 2) { k = k + 2) {
int x; int x;
if (k == -d || (k < d && reverseV[k + vShift - 1] < reverseV[k + vShift + 1])) { if (k == -d || (k < d && reverseV[k + vShift - 1] < reverseV[k + vShift + 1]))
x = reverseV[k + vShift + 1]; x = reverseV[k + vShift + 1];
} else { else
x = reverseV[k + vShift - 1] + 1; x = reverseV[k + vShift - 1] + 1;
}
int y = x - k; int y = x - k;
if (x > n) { if (x > n) {
@@ -559,9 +557,8 @@ int Differ::findSubtextEnd(const QString &text,
{ {
if (m_currentDiffMode == Differ::LineMode) { if (m_currentDiffMode == Differ::LineMode) {
int subtextEnd = text.indexOf(QLatin1Char('\n'), subtextStart); int subtextEnd = text.indexOf(QLatin1Char('\n'), subtextStart);
if (subtextEnd == -1) { if (subtextEnd == -1)
subtextEnd = text.count() - 1; subtextEnd = text.count() - 1;
}
return ++subtextEnd; return ++subtextEnd;
} else if (m_currentDiffMode == Differ::WordMode) { } else if (m_currentDiffMode == Differ::WordMode) {
if (!text.at(subtextStart).isLetter()) if (!text.at(subtextStart).isLetter())
@@ -732,9 +729,8 @@ QList<Diff> Differ::cleanupSemantics(const QList<Diff> &diffList)
} }
equalitiesToBeSplit.insert(data.equalityIndex, true); equalitiesToBeSplit.insert(data.equalityIndex, true);
equalities.removeAt(i); equalities.removeAt(i);
if (i > 0) { if (i > 0)
i--; // reexamine previous equality i--; // reexamine previous equality
}
} else { } else {
i++; i++;
} }
@@ -807,9 +803,8 @@ QList<Diff> Differ::cleanupSemanticsLossless(const QList<Diff> &diffList)
thisDiff.text = bestEdit; thisDiff.text = bestEdit;
nextDiff.text = bestEquality2; nextDiff.text = bestEquality2;
if (!bestEquality1.isEmpty()) { if (!bestEquality1.isEmpty())
newDiffList.append(prevDiff); // append modified equality1 newDiffList.append(prevDiff); // append modified equality1
}
if (bestEquality2.isEmpty()) { if (bestEquality2.isEmpty()) {
i++; i++;
if (i < diffList.count()) if (i < diffList.count())

View File

@@ -163,11 +163,10 @@ QWidget *DiffShowEditor::toolBar()
void DiffShowEditor::setDescriptionVisible(bool visible) void DiffShowEditor::setDescriptionVisible(bool visible)
{ {
if (visible) { if (visible)
m_toggleDescriptionButton->setToolTip(tr("Hide Change Description")); m_toggleDescriptionButton->setToolTip(tr("Hide Change Description"));
} else { else
m_toggleDescriptionButton->setToolTip(tr("Show Change Description")); m_toggleDescriptionButton->setToolTip(tr("Show Change Description"));
}
m_diffShowWidget->setVisible(visible); m_diffShowWidget->setVisible(visible);
} }

View File

@@ -207,9 +207,8 @@ QModelIndex TreeViewFind::nextIndex(const QModelIndex &idx, bool *wrapped) const
QModelIndex current = model->index(idx.row(), 0, idx.parent()); QModelIndex current = model->index(idx.row(), 0, idx.parent());
// check for children // check for children
if (model->rowCount(current) > 0) { if (model->rowCount(current) > 0)
return current.child(0, 0); return current.child(0, 0);
}
// no more children, go up and look for parent with more children // no more children, go up and look for parent with more children
QModelIndex nextIndex; QModelIndex nextIndex;

View File

@@ -380,9 +380,8 @@ void BranchModel::setCurrentBranch()
BranchNode *local = m_rootNode->children.at(LocalBranches); BranchNode *local = m_rootNode->children.at(LocalBranches);
int pos = 0; int pos = 0;
for (pos = 0; pos < local->count(); ++pos) { for (pos = 0; pos < local->count(); ++pos) {
if (local->children.at(pos)->name == currentBranch) { if (local->children.at(pos)->name == currentBranch)
m_currentBranch = local->children[pos]; m_currentBranch = local->children[pos];
}
} }
} }

View File

@@ -537,9 +537,8 @@ QString GitDiffHandler::workingTreeContents(const QString &fileName) const
QString absoluteFileName = workingDir.absoluteFilePath(fileName); QString absoluteFileName = workingDir.absoluteFilePath(fileName);
QFile file(absoluteFileName); QFile file(absoluteFileName);
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { if (file.open(QIODevice::ReadOnly | QIODevice::Text))
return m_editor->editorWidget()->codec()->toUnicode(file.readAll()); return m_editor->editorWidget()->codec()->toUnicode(file.readAll());
}
return QString(); return QString();
} }

View File

@@ -145,9 +145,8 @@ QString IosRunConfiguration::appName() const
const QmakeProFileNode *node = pro->rootQmakeProjectNode()->findProFileFor(profilePath()); const QmakeProFileNode *node = pro->rootQmakeProjectNode()->findProFileFor(profilePath());
if (node) { if (node) {
TargetInformation ti = node->targetInformation(); TargetInformation ti = node->targetInformation();
if (ti.valid) { if (ti.valid)
return ti.target; return ti.target;
}
} }
} }
qDebug() << "IosRunConfiguration::appName failed"; qDebug() << "IosRunConfiguration::appName failed";

View File

@@ -342,19 +342,16 @@ void AbstractMsvcToolChain::inferWarningsForLevel(int warningLevel, WarningFlags
// reset all except unrelated flag // reset all except unrelated flag
flags = flags & WarningsAsErrors; flags = flags & WarningsAsErrors;
if (warningLevel >= 1) { if (warningLevel >= 1)
flags |= WarningFlags(WarningsDefault | WarnIgnoredQualfiers | WarnHiddenLocals | WarnUnknownPragma); flags |= WarningFlags(WarningsDefault | WarnIgnoredQualfiers | WarnHiddenLocals | WarnUnknownPragma);
} if (warningLevel >= 2)
if (warningLevel >= 2) {
flags |= WarningsAll; flags |= WarningsAll;
}
if (warningLevel >= 3) { if (warningLevel >= 3) {
flags |= WarningFlags(WarningsExtra | WarnNonVirtualDestructor | WarnSignedComparison flags |= WarningFlags(WarningsExtra | WarnNonVirtualDestructor | WarnSignedComparison
| WarnUnusedLocals | WarnDeprecated); | WarnUnusedLocals | WarnDeprecated);
} }
if (warningLevel >= 4) { if (warningLevel >= 4)
flags |= WarnUnusedParams; flags |= WarnUnusedParams;
}
} }
bool AbstractMsvcToolChain::operator ==(const ToolChain &other) const bool AbstractMsvcToolChain::operator ==(const ToolChain &other) const

View File

@@ -89,11 +89,10 @@ protected:
void mouseDoubleClickEvent(QMouseEvent *ev) void mouseDoubleClickEvent(QMouseEvent *ev)
{ {
int line = cursorForPosition(ev->pos()).block().blockNumber(); int line = cursorForPosition(ev->pos()).block().blockNumber();
if (unsigned taskid = m_taskids.value(line, 0)) { if (unsigned taskid = m_taskids.value(line, 0))
TaskHub::showTaskInEditor(taskid); TaskHub::showTaskInEditor(taskid);
} else { else
QPlainTextEdit::mouseDoubleClickEvent(ev); QPlainTextEdit::mouseDoubleClickEvent(ev);
}
} }
private: private:

View File

@@ -1176,9 +1176,8 @@ void ProjectExplorerPlugin::updateVariable(const QByteArray &variable)
projectFilePath = doc->filePath(); projectFilePath = doc->filePath();
if (Target *target = project->activeTarget()) { if (Target *target = project->activeTarget()) {
kit = target->kit(); kit = target->kit();
if (BuildConfiguration *buildConfiguration = target->activeBuildConfiguration()) { if (BuildConfiguration *buildConfiguration = target->activeBuildConfiguration())
buildConfigurationName = buildConfiguration->displayName(); buildConfigurationName = buildConfiguration->displayName();
}
} }
} }
ProjectMacroExpander expander(projectFilePath, projectName, kit, buildConfigurationName); ProjectMacroExpander expander(projectFilePath, projectName, kit, buildConfigurationName);

View File

@@ -591,9 +591,8 @@ QPair<QString, QString> DesktopQmakeRunConfiguration::extractWorkingDirAndExecut
QString workingDir; QString workingDir;
if (!destDir.isEmpty()) { if (!destDir.isEmpty()) {
bool workingDirIsBaseDir = false; bool workingDirIsBaseDir = false;
if (destDir == ti.buildTarget) { if (destDir == ti.buildTarget)
workingDirIsBaseDir = true; workingDirIsBaseDir = true;
}
if (QDir::isRelativePath(destDir)) if (QDir::isRelativePath(destDir))
destDir = QDir::cleanPath(ti.buildDir + QLatin1Char('/') + destDir); destDir = QDir::cleanPath(ti.buildDir + QLatin1Char('/') + destDir);

View File

@@ -156,11 +156,10 @@ QByteArray AbstractMobileApp::generateMainCpp(QString *errorMessage) const
QString line; QString line;
while (!(line = in.readLine()).isNull()) { while (!(line = in.readLine()).isNull()) {
bool adaptLine = true; bool adaptLine = true;
if (line.contains(QLatin1String("// DELETE_LINE"))) { if (line.contains(QLatin1String("// DELETE_LINE")))
continue; // omit this line in the output continue; // omit this line in the output
} else { else
adaptLine = adaptCurrentMainCppTemplateLine(line); adaptLine = adaptCurrentMainCppTemplateLine(line);
}
if (adaptLine) { if (adaptLine) {
const int commentIndex = line.indexOf(QLatin1String(" //")); const int commentIndex = line.indexOf(QLatin1String(" //"));
if (commentIndex != -1) if (commentIndex != -1)

View File

@@ -146,9 +146,8 @@ LibraryWizardDialog::LibraryWizardDialog(const QString &templateName,
// Use the intro page instead, set up initially // Use the intro page instead, set up initially
setIntroDescription(tr("This wizard generates a C++ library project.")); setIntroDescription(tr("This wizard generates a C++ library project."));
if (!parameters.extraValues().contains(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS))) { if (!parameters.extraValues().contains(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS)))
m_targetPageId = addTargetSetupPage(); m_targetPageId = addTargetSetupPage();
}
m_modulesPageId = addModulesPage(); m_modulesPageId = addModulesPage();

View File

@@ -75,11 +75,10 @@ const Import ImportLabel::import() const
void ImportLabel::setReadOnly(bool readOnly) const void ImportLabel::setReadOnly(bool readOnly) const
{ {
m_removeButton->setDisabled(readOnly); m_removeButton->setDisabled(readOnly);
if (readOnly) { if (readOnly)
m_removeButton->setIcon(QIcon()); m_removeButton->setIcon(QIcon());
} else { else
m_removeButton->setIcon(QIcon(Core::Constants::ICON_CLOSE_DOCUMENT)); m_removeButton->setIcon(QIcon(Core::Constants::ICON_CLOSE_DOCUMENT));
}
} }
void ImportLabel::emitRemoveImport() void ImportLabel::emitRemoveImport()

View File

@@ -194,11 +194,10 @@ QString DesignDocument::displayName() const
QString DesignDocument::simplfiedDisplayName() const QString DesignDocument::simplfiedDisplayName() const
{ {
if (rootModelNode().id().isEmpty()) { if (rootModelNode().id().isEmpty())
return rootModelNode().id(); return rootModelNode().id();
} else { else
return rootModelNode().simplifiedTypeName(); return rootModelNode().simplifiedTypeName();
}
QStringList list = displayName().split(QLatin1Char('/')); QStringList list = displayName().split(QLatin1Char('/'));
return list.last(); return list.last();
@@ -637,9 +636,8 @@ void DesignDocument::redo()
static bool isFileInProject(DesignDocument *designDocument, ProjectExplorer::Project *project) static bool isFileInProject(DesignDocument *designDocument, ProjectExplorer::Project *project)
{ {
foreach (const QString &fileNameInProject, project->files(ProjectExplorer::Project::ExcludeGeneratedFiles)) { foreach (const QString &fileNameInProject, project->files(ProjectExplorer::Project::ExcludeGeneratedFiles)) {
if (designDocument->fileName() == fileNameInProject) { if (designDocument->fileName() == fileNameInProject)
return true; return true;
}
} }
return false; return false;

View File

@@ -75,9 +75,8 @@ QVariant ItemLibrarySortedModel::data(const QModelIndex &index, int role) const
if (m_roleNames.contains(role)) { if (m_roleNames.contains(role)) {
QVariant value = m_privList.at(index.row())->property(m_roleNames.value(role)); QVariant value = m_privList.at(index.row())->property(m_roleNames.value(role));
if (ItemLibrarySortedModel* model = qobject_cast<ItemLibrarySortedModel *>(value.value<QObject*>())) { if (ItemLibrarySortedModel* model = qobject_cast<ItemLibrarySortedModel *>(value.value<QObject*>()))
return QVariant::fromValue(model); return QVariant::fromValue(model);
}
return m_privList.at(index.row())->property(m_roleNames.value(role)); return m_privList.at(index.row())->property(m_roleNames.value(role));
} }
@@ -145,11 +144,10 @@ bool ItemLibrarySortedModel::setElementVisible(int libId, bool visible)
return false; return false;
int visiblePos = visibleElementPosition(libId); int visiblePos = visibleElementPosition(libId);
if (visible) { if (visible)
privateInsert(visiblePos, (m_elementModels.value(libId))); privateInsert(visiblePos, (m_elementModels.value(libId)));
} else { else
privateRemove(visiblePos); privateRemove(visiblePos);
}
m_elementOrder[pos].visible = visible; m_elementOrder[pos].visible = visible;
return true; return true;
@@ -240,9 +238,8 @@ void ItemLibrarySortedModel::resetModel()
void ItemLibrarySortedModel::addRoleName(const QByteArray &roleName) void ItemLibrarySortedModel::addRoleName(const QByteArray &roleName)
{ {
if (m_roleNames.values().contains(roleName)) { if (m_roleNames.values().contains(roleName))
return; return;
}
int key = m_roleNames.count(); int key = m_roleNames.count();
m_roleNames.insert(key, roleName); m_roleNames.insert(key, roleName);

View File

@@ -81,11 +81,10 @@ QVariant GradientModel::data(const QModelIndex &index, int role) const
return index.row(); return index.row();
} }
if (role == Qt::UserRole + 1) { if (role == Qt::UserRole + 1)
return getPosition(index.row()); return getPosition(index.row());
} else if (role == Qt::UserRole + 2) { else if (role == Qt::UserRole + 2)
return getColor(index.row()); return getColor(index.row());
}
qWarning() << Q_FUNC_INFO << "invalid role"; qWarning() << Q_FUNC_INFO << "invalid role";
} else { } else {
@@ -181,9 +180,8 @@ void GradientModel::setColor(int index, const QColor &color)
if (index < rowCount()) { if (index < rowCount()) {
QmlDesigner::ModelNode gradientNode = m_itemNode.modelNode().nodeProperty(gradientPropertyName().toUtf8()).modelNode(); QmlDesigner::ModelNode gradientNode = m_itemNode.modelNode().nodeProperty(gradientPropertyName().toUtf8()).modelNode();
QmlDesigner::QmlObjectNode stop = gradientNode.nodeListProperty("stops").toModelNodeList().at(index); QmlDesigner::QmlObjectNode stop = gradientNode.nodeListProperty("stops").toModelNodeList().at(index);
if (stop.isValid()) { if (stop.isValid())
stop.setVariantProperty("color", color); stop.setVariantProperty("color", color);
}
setupModel(); setupModel();
} }
} }
@@ -196,9 +194,8 @@ void GradientModel::setPosition(int index, qreal positition)
if (index < rowCount()) { if (index < rowCount()) {
QmlDesigner::ModelNode gradientNode = m_itemNode.modelNode().nodeProperty(gradientPropertyName().toUtf8()).modelNode(); QmlDesigner::ModelNode gradientNode = m_itemNode.modelNode().nodeProperty(gradientPropertyName().toUtf8()).modelNode();
QmlDesigner::QmlObjectNode stop = gradientNode.nodeListProperty("stops").toModelNodeList().at(index); QmlDesigner::QmlObjectNode stop = gradientNode.nodeListProperty("stops").toModelNodeList().at(index);
if (stop.isValid()) { if (stop.isValid())
stop.setVariantProperty("position", positition); stop.setVariantProperty("position", positition);
}
setupModel(); setupModel();
} }
} }
@@ -208,9 +205,8 @@ QColor GradientModel::getColor(int index) const
if (index < rowCount()) { if (index < rowCount()) {
QmlDesigner::ModelNode gradientNode = m_itemNode.modelNode().nodeProperty(gradientPropertyName().toUtf8()).modelNode(); QmlDesigner::ModelNode gradientNode = m_itemNode.modelNode().nodeProperty(gradientPropertyName().toUtf8()).modelNode();
QmlDesigner::QmlObjectNode stop = gradientNode.nodeListProperty("stops").toModelNodeList().at(index); QmlDesigner::QmlObjectNode stop = gradientNode.nodeListProperty("stops").toModelNodeList().at(index);
if (stop.isValid()) { if (stop.isValid())
return stop.modelValue("color").value<QColor>(); return stop.modelValue("color").value<QColor>();
}
} }
qWarning() << Q_FUNC_INFO << "invalid color index"; qWarning() << Q_FUNC_INFO << "invalid color index";
return QColor(); return QColor();
@@ -221,9 +217,8 @@ qreal GradientModel::getPosition(int index) const
if (index < rowCount()) { if (index < rowCount()) {
QmlDesigner::ModelNode gradientNode = m_itemNode.modelNode().nodeProperty(gradientPropertyName().toUtf8()).modelNode(); QmlDesigner::ModelNode gradientNode = m_itemNode.modelNode().nodeProperty(gradientPropertyName().toUtf8()).modelNode();
QmlDesigner::QmlObjectNode stop = gradientNode.nodeListProperty("stops").toModelNodeList().at(index); QmlDesigner::QmlObjectNode stop = gradientNode.nodeListProperty("stops").toModelNodeList().at(index);
if (stop.isValid()) { if (stop.isValid())
return stop.modelValue("position").toReal(); return stop.modelValue("position").toReal();
}
} }
qWarning() << Q_FUNC_INFO << "invalid position index"; qWarning() << Q_FUNC_INFO << "invalid position index";
return 0.0; return 0.0;

View File

@@ -396,9 +396,8 @@ void PropertyEditorView::setupQmlBackend()
QString specificQmlData; QString specificQmlData;
if (m_selectedNode.isValid() && m_selectedNode.metaInfo().isValid() && diffClassName != m_selectedNode.type()) { if (m_selectedNode.isValid() && m_selectedNode.metaInfo().isValid() && diffClassName != m_selectedNode.type())
specificQmlData = PropertyEditorQmlBackend::templateGeneration(m_selectedNode.metaInfo(), model()->metaInfo(diffClassName), m_selectedNode); specificQmlData = PropertyEditorQmlBackend::templateGeneration(m_selectedNode.metaInfo(), model()->metaInfo(diffClassName), m_selectedNode);
}
PropertyEditorQmlBackend *currentQmlBackend = m_qmlBackendHash.value(qmlFile.toString()); PropertyEditorQmlBackend *currentQmlBackend = m_qmlBackendHash.value(qmlFile.toString());

View File

@@ -78,11 +78,10 @@ void QmlAnchorBindingProxy::setup(const QmlItemNode &fxItemNode)
m_ignoreQml = true; m_ignoreQml = true;
if (m_qmlItemNode.modelNode().hasParentProperty()) { if (m_qmlItemNode.modelNode().hasParentProperty())
setDefaultAnchorTarget(m_qmlItemNode.modelNode().parentProperty().parentModelNode()); setDefaultAnchorTarget(m_qmlItemNode.modelNode().parentProperty().parentModelNode());
} else { else
setDefaultAnchorTarget(ModelNode()); setDefaultAnchorTarget(ModelNode());
}
if (topAnchored()) { if (topAnchored()) {
ModelNode targetNode = m_qmlItemNode.anchors().instanceAnchor(AnchorLine::Top).qmlItemNode(); ModelNode targetNode = m_qmlItemNode.anchors().instanceAnchor(AnchorLine::Top).qmlItemNode();
@@ -404,16 +403,14 @@ QStringList QmlAnchorBindingProxy::possibleTargetItems() const
itemList.removeAll(node); itemList.removeAll(node);
foreach (const QmlItemNode &itemNode, itemList) { foreach (const QmlItemNode &itemNode, itemList) {
if (itemNode.isValid() && !itemNode.id().isEmpty()) { if (itemNode.isValid() && !itemNode.id().isEmpty())
stringList.append(itemNode.id()); stringList.append(itemNode.id());
}
} }
QmlItemNode parent(m_qmlItemNode.instanceParent().toQmlItemNode()); QmlItemNode parent(m_qmlItemNode.instanceParent().toQmlItemNode());
if (parent.isValid()) { if (parent.isValid())
stringList.append(QLatin1String("parent")); stringList.append(QLatin1String("parent"));
}
return stringList; return stringList;
} }

View File

@@ -192,11 +192,10 @@ static QString getSourceForUrl(const QString &fileURl)
{ {
Utils::FileReader fileReader; Utils::FileReader fileReader;
if (fileReader.fetch(fileURl)) { if (fileReader.fetch(fileURl))
return fileReader.data(); return fileReader.data();
} else { else
return Utils::FileReader::fetchQrc(fileURl); return Utils::FileReader::fetchQrc(fileURl);
}
} }
void ItemLibraryEntry::setQmlPath(const QString &qml) void ItemLibraryEntry::setQmlPath(const QString &qml)

View File

@@ -956,9 +956,8 @@ QString NodeMetaInfoPrivate::importDirectoryPath() const
if (modelManager) { if (modelManager) {
foreach (const QString &importPath, modelManager->importPaths()) { foreach (const QString &importPath, modelManager->importPaths()) {
const QString targetPath = QDir(importPath).filePath(importInfo.path()); const QString targetPath = QDir(importPath).filePath(importInfo.path());
if (QDir(targetPath).exists()) { if (QDir(targetPath).exists())
return targetPath; return targetPath;
}
} }
} }
} }

View File

@@ -1938,14 +1938,12 @@ void Model::attachView(AbstractView *view)
{ {
// Internal::WriteLocker locker(d); // Internal::WriteLocker locker(d);
RewriterView *rewriterView = qobject_cast<RewriterView*>(view); RewriterView *rewriterView = qobject_cast<RewriterView*>(view);
if (rewriterView) { if (rewriterView)
return; return;
}
NodeInstanceView *nodeInstanceView = qobject_cast<NodeInstanceView*>(view); NodeInstanceView *nodeInstanceView = qobject_cast<NodeInstanceView*>(view);
if (nodeInstanceView) { if (nodeInstanceView)
return; return;
}
d->attachView(view); d->attachView(view);
} }
@@ -1964,14 +1962,12 @@ void Model::detachView(AbstractView *view, ViewNotification emitDetachNotify)
bool emitNotify = (emitDetachNotify == NotifyView); bool emitNotify = (emitDetachNotify == NotifyView);
RewriterView *rewriterView = qobject_cast<RewriterView*>(view); RewriterView *rewriterView = qobject_cast<RewriterView*>(view);
if (rewriterView) { if (rewriterView)
return; return;
}
NodeInstanceView *nodeInstanceView = qobject_cast<NodeInstanceView*>(view); NodeInstanceView *nodeInstanceView = qobject_cast<NodeInstanceView*>(view);
if (nodeInstanceView) { if (nodeInstanceView)
return; return;
}
d->detachView(view, emitNotify); d->detachView(view, emitNotify);
} }

View File

@@ -1235,9 +1235,8 @@ void TextToModelMerger::syncSignalHandler(AbstractProperty &modelProperty,
{ {
if (modelProperty.isSignalHandlerProperty()) { if (modelProperty.isSignalHandlerProperty()) {
SignalHandlerProperty signalHandlerProperty = modelProperty.toSignalHandlerProperty(); SignalHandlerProperty signalHandlerProperty = modelProperty.toSignalHandlerProperty();
if (signalHandlerProperty.source() != javascript) { if (signalHandlerProperty.source() != javascript)
differenceHandler.signalHandlerSourceDiffer(signalHandlerProperty, javascript); differenceHandler.signalHandlerSourceDiffer(signalHandlerProperty, javascript);
}
} else { } else {
differenceHandler.shouldBeSignalHandlerProperty(modelProperty, javascript); differenceHandler.shouldBeSignalHandlerProperty(modelProperty, javascript);
} }

View File

@@ -264,17 +264,15 @@ void QmlDesignerPlugin::selectModelNodeUnderTextCursor()
{ {
const int cursorPos = currentDesignDocument()->plainTextEdit()->textCursor().position(); const int cursorPos = currentDesignDocument()->plainTextEdit()->textCursor().position();
ModelNode node = currentDesignDocument()->rewriterView()->nodeAtTextCursorPosition(cursorPos); ModelNode node = currentDesignDocument()->rewriterView()->nodeAtTextCursorPosition(cursorPos);
if (currentDesignDocument()->rewriterView() && node.isValid()) { if (currentDesignDocument()->rewriterView() && node.isValid())
currentDesignDocument()->rewriterView()->setSelectedModelNodes(QList<ModelNode>() << node); currentDesignDocument()->rewriterView()->setSelectedModelNodes(QList<ModelNode>() << node);
}
} }
void QmlDesignerPlugin::activateAutoSynchronization() void QmlDesignerPlugin::activateAutoSynchronization()
{ {
// text editor -> visual editor // text editor -> visual editor
if (!currentDesignDocument()->isDocumentLoaded()) { if (!currentDesignDocument()->isDocumentLoaded())
currentDesignDocument()->loadDocument(currentDesignDocument()->plainTextEdit()); currentDesignDocument()->loadDocument(currentDesignDocument()->plainTextEdit());
}
currentDesignDocument()->attachRewriterToModel(); currentDesignDocument()->attachRewriterToModel();

View File

@@ -138,9 +138,8 @@ ModelManagerInterface::ProjectInfo QmlJSTools::defaultProjectInfoForProject(
void QmlJSTools::setupProjectInfoQmlBundles(ModelManagerInterface::ProjectInfo &projectInfo) void QmlJSTools::setupProjectInfoQmlBundles(ModelManagerInterface::ProjectInfo &projectInfo)
{ {
ProjectExplorer::Target *activeTarget = 0; ProjectExplorer::Target *activeTarget = 0;
if (projectInfo.project) { if (projectInfo.project)
activeTarget = projectInfo.project->activeTarget(); activeTarget = projectInfo.project->activeTarget();
}
ProjectExplorer::Kit *activeKit = activeTarget ProjectExplorer::Kit *activeKit = activeTarget
? activeTarget->kit() : ProjectExplorer::KitManager::defaultKit(); ? activeTarget->kit() : ProjectExplorer::KitManager::defaultKit();
QHash<QString, QString> replacements; QHash<QString, QString> replacements;
@@ -377,9 +376,8 @@ QFuture<void> ModelManager::refreshSourceFiles(const QStringList &sourceFiles,
m_synchronizer.addFuture(result); m_synchronizer.addFuture(result);
if (sourceFiles.count() > 1) { if (sourceFiles.count() > 1)
ProgressManager::addTask(result, tr("Indexing"), Constants::TASK_INDEX); ProgressManager::addTask(result, tr("Indexing"), Constants::TASK_INDEX);
}
return result; return result;
} }

View File

@@ -104,13 +104,11 @@ QmlProfilerClientManager::~QmlProfilerClientManager()
void QmlProfilerClientManager::setModelManager(QmlProfilerModelManager *m) void QmlProfilerClientManager::setModelManager(QmlProfilerModelManager *m)
{ {
if (d->modelManager) { if (d->modelManager)
disconnect(this,SIGNAL(dataReadyForProcessing()), d->modelManager, SLOT(complete())); disconnect(this,SIGNAL(dataReadyForProcessing()), d->modelManager, SLOT(complete()));
}
d->modelManager = m; d->modelManager = m;
if (d->modelManager) { if (d->modelManager)
connect(this,SIGNAL(dataReadyForProcessing()), d->modelManager, SLOT(complete())); connect(this,SIGNAL(dataReadyForProcessing()), d->modelManager, SLOT(complete()));
}
} }
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////

View File

@@ -113,11 +113,10 @@ bool QmlProfilerRunControl::startEngine()
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppStarting); d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppStarting);
if (startParameters().startMode == StartLocal) { if (startParameters().startMode == StartLocal)
d->m_noDebugOutputTimer.start(); d->m_noDebugOutputTimer.start();
} else { else
emit processRunning(startParameters().analyzerPort); emit processRunning(startParameters().analyzerPort);
}
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppRunning); d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppRunning);
engineStarted(); engineStarted();

View File

@@ -548,9 +548,8 @@ void QmlProfilerFileWriter::calculateMeasuredTime(const QVector<QmlProfilerSimpl
level--; level--;
} }
endtimesPerLevel[level] = event.startTime + event.duration; endtimesPerLevel[level] = event.startTime + event.duration;
if (level == QmlDebug::Constants::QML_MIN_LEVEL) { if (level == QmlDebug::Constants::QML_MIN_LEVEL)
duration += event.duration; duration += event.duration;
}
} }
m_measuredTime = duration; m_measuredTime = duration;

View File

@@ -482,9 +482,8 @@ void QmlProfilerTraceView::contextMenuEvent(QContextMenuEvent *ev)
d->m_viewContainer->selectionStart(), d->m_viewContainer->selectionStart(),
d->m_viewContainer->selectionEnd()); d->m_viewContainer->selectionEnd());
} }
if (selectedAction == getGlobalStatsAction) { if (selectedAction == getGlobalStatsAction)
d->m_viewContainer->getStatisticsInRange(-1, -1); d->m_viewContainer->getStatisticsInRange(-1, -1);
}
} }
} }

View File

@@ -207,11 +207,10 @@ int TimelineModelAggregator::modelIndexForCategory(int absoluteCategoryIndex) co
{ {
int categoryIndex = absoluteCategoryIndex; int categoryIndex = absoluteCategoryIndex;
for (int modelIndex = 0; modelIndex < d->modelList.count(); modelIndex++) for (int modelIndex = 0; modelIndex < d->modelList.count(); modelIndex++)
if (categoryIndex < d->modelList[modelIndex]->categoryCount()) { if (categoryIndex < d->modelList[modelIndex]->categoryCount())
return modelIndex; return modelIndex;
} else { else
categoryIndex -= d->modelList[modelIndex]->categoryCount(); categoryIndex -= d->modelList[modelIndex]->categoryCount();
}
return modelCount()-1; return modelCount()-1;
} }

View File

@@ -55,14 +55,12 @@ TimelineRenderer::TimelineRenderer(QQuickPaintedItem *parent) :
void TimelineRenderer::setProfilerModelProxy(QObject *profilerModelProxy) void TimelineRenderer::setProfilerModelProxy(QObject *profilerModelProxy)
{ {
if (m_profilerModelProxy) { if (m_profilerModelProxy)
disconnect(m_profilerModelProxy, SIGNAL(expandedChanged()), this, SLOT(requestPaint())); disconnect(m_profilerModelProxy, SIGNAL(expandedChanged()), this, SLOT(requestPaint()));
}
m_profilerModelProxy = qobject_cast<TimelineModelAggregator *>(profilerModelProxy); m_profilerModelProxy = qobject_cast<TimelineModelAggregator *>(profilerModelProxy);
if (m_profilerModelProxy) { if (m_profilerModelProxy)
connect(m_profilerModelProxy, SIGNAL(expandedChanged()), this, SLOT(requestPaint())); connect(m_profilerModelProxy, SIGNAL(expandedChanged()), this, SLOT(requestPaint()));
}
emit profilerModelProxyChanged(m_profilerModelProxy); emit profilerModelProxyChanged(m_profilerModelProxy);
} }

View File

@@ -88,9 +88,8 @@ QmlProjectItem *QmlProjectFileFormat::parseProjectFile(const QString &fileName,
if (importPathsProperty.isValid()) if (importPathsProperty.isValid())
projectItem->setImportPaths(importPathsProperty.toStringList()); projectItem->setImportPaths(importPathsProperty.toStringList());
if (debug) { if (debug)
qDebug() << "importPath:" << importPathsProperty << "mainFile:" << mainFileProperty; qDebug() << "importPath:" << importPathsProperty << "mainFile:" << mainFileProperty;
}
foreach (const QmlJS::SimpleReaderNode::Ptr &childNode, rootNode->children()) { foreach (const QmlJS::SimpleReaderNode::Ptr &childNode, rootNode->children()) {
if (childNode->name() == QLatin1String("QmlFiles")) { if (childNode->name() == QLatin1String("QmlFiles")) {

View File

@@ -418,13 +418,12 @@ Core::GeneratedFiles QmlApp::generateFiles(QString *errorMessage)
if (!canAddTemplate) if (!canAddTemplate)
return Core::GeneratedFiles(); return Core::GeneratedFiles();
if (templateFile.fileName() == QLatin1String("main.pro")) { if (templateFile.fileName() == QLatin1String("main.pro"))
files.last().setAttributes(Core::GeneratedFile::OpenProjectAttribute); files.last().setAttributes(Core::GeneratedFile::OpenProjectAttribute);
} else if (templateFile.fileName() == QLatin1String("main.qmlproject")) { else if (templateFile.fileName() == QLatin1String("main.qmlproject"))
files.last().setAttributes(Core::GeneratedFile::OpenProjectAttribute); files.last().setAttributes(Core::GeneratedFile::OpenProjectAttribute);
} else if (templateFile.fileName() == m_templateInfo.openFile) { else if (templateFile.fileName() == m_templateInfo.openFile)
files.last().setAttributes(Core::GeneratedFile::OpenEditorAttribute); files.last().setAttributes(Core::GeneratedFile::OpenEditorAttribute);
}
} }
} }

View File

@@ -395,11 +395,10 @@ bool QmlProject::fromMap(const QVariantMap &map)
if (!kits.isEmpty()) { if (!kits.isEmpty()) {
Kit *kit = 0; Kit *kit = 0;
if (kits.contains(KitManager::defaultKit())) { if (kits.contains(KitManager::defaultKit()))
kit = KitManager::defaultKit(); kit = KitManager::defaultKit();
} else { else
kit = kits.first(); kit = kits.first();
}
addTarget(createTarget(kit)); addTarget(createTarget(kit));
} }
} }

View File

@@ -193,9 +193,8 @@ QListWidgetItem *BlackBerryDeviceConfigurationWizardSetupPage::findDeviceListIte
int count = m_ui->deviceListWidget->count(); int count = m_ui->deviceListWidget->count();
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
QListWidgetItem *item = m_ui->deviceListWidget->item(i); QListWidgetItem *item = m_ui->deviceListWidget->item(i);
if (item->data(ItemKindRole).value<ItemKind>() == itemKind) { if (item->data(ItemKindRole).value<ItemKind>() == itemKind)
return item; return item;
}
} }
return 0; return 0;
} }

View File

@@ -86,9 +86,8 @@ void BlackBerryDeviceListDetector::processData(const QString &line)
{ {
// line format is: deviceName,deviceHostNameOrIP,deviceType,versionIfSimulator // line format is: deviceName,deviceHostNameOrIP,deviceType,versionIfSimulator
QStringList list = line.split(QLatin1String(",")); QStringList list = line.split(QLatin1String(","));
if (list.count() == 4) { if (list.count() == 4)
emit deviceDetected (list[0], list[1], QLatin1String("Simulator") == list[2]); emit deviceDetected (list[0], list[1], QLatin1String("Simulator") == list[2]);
}
} }
} // namespace Internal } // namespace Internal

View File

@@ -108,9 +108,8 @@ QDomElement BarDescriptorConverter::ensureElement(QDomDocument &doc, const QStri
ret = rootElement.appendChild(doc.createElement(tagName)).toElement(); ret = rootElement.appendChild(doc.createElement(tagName)).toElement();
QTC_ASSERT(!ret.isNull(), return ret); QTC_ASSERT(!ret.isNull(), return ret);
} }
if (!attributeName.isEmpty()) { if (!attributeName.isEmpty())
ret.setAttribute(attributeName, attributeValue); ret.setAttribute(attributeName, attributeValue);
}
return ret; return ret;
} }

View File

@@ -210,11 +210,10 @@ QString QnxUtils::dataDirPath()
QString QnxUtils::qConfigPath() QString QnxUtils::qConfigPath()
{ {
if (Utils::HostOsInfo::isMacHost() || Utils::HostOsInfo::isWindowsHost()) { if (Utils::HostOsInfo::isMacHost() || Utils::HostOsInfo::isWindowsHost())
return dataDirPath() + QLatin1String("/BlackBerry Native SDK/qconfig"); return dataDirPath() + QLatin1String("/BlackBerry Native SDK/qconfig");
} else { else
return dataDirPath() + QLatin1String("/bbndk/qconfig"); return dataDirPath() + QLatin1String("/bbndk/qconfig");
}
} }
QString QnxUtils::defaultTargetVersion(const QString &ndkPath) QString QnxUtils::defaultTargetVersion(const QString &ndkPath)

View File

@@ -125,19 +125,16 @@ public:
if (qtVersionSetting != noQtVersionsId) { if (qtVersionSetting != noQtVersionsId) {
//ensure that the unique Qt id is valid //ensure that the unique Qt id is valid
foreach (BaseQtVersion *version, qtVersions) { foreach (BaseQtVersion *version, qtVersions) {
if (version->uniqueId() == qtVersionSetting) { if (version->uniqueId() == qtVersionSetting)
newQtVersionSetting = qtVersionSetting; newQtVersionSetting = qtVersionSetting;
}
} }
} }
if (newQtVersionSetting == noQtVersionsId) { if (newQtVersionSetting == noQtVersionsId)
newQtVersionSetting = findHighestQtVersion(); newQtVersionSetting = findHighestQtVersion();
}
if (newQtVersionSetting != qtVersionSetting) { if (newQtVersionSetting != qtVersionSetting)
setUniqueQtVersionIdSetting(newQtVersionSetting); setUniqueQtVersionIdSetting(newQtVersionSetting);
}
foreach (BaseQtVersion *version, qtVersions) { foreach (BaseQtVersion *version, qtVersions) {

View File

@@ -1905,9 +1905,8 @@ void BaseTextEditorWidget::keyPressEvent(QKeyEvent *e)
} }
if (!electricChar.isNull() && d->m_autoCompleter->contextAllowsElectricCharacters(cursor)) if (!electricChar.isNull() && d->m_autoCompleter->contextAllowsElectricCharacters(cursor))
indent(document(), cursor, electricChar); indent(document(), cursor, electricChar);
if (!autoText.isEmpty()) { if (!autoText.isEmpty())
cursor.setPosition(autoText.length() == 1 ? cursor.position() : cursor.anchor()); cursor.setPosition(autoText.length() == 1 ? cursor.position() : cursor.anchor());
}
if (doEditBlock) { if (doEditBlock) {
cursor.endEditBlock(); cursor.endEditBlock();
@@ -6321,9 +6320,8 @@ void BaseTextEditor::openGotoLocator()
{ {
Core::EditorManager::activateEditor(this, Core::EditorManager::IgnoreNavigationHistory); Core::EditorManager::activateEditor(this, Core::EditorManager::IgnoreNavigationHistory);
if (Core::Command *cmd = Core::ActionManager::command(Core::Constants::GOTO)) { if (Core::Command *cmd = Core::ActionManager::command(Core::Constants::GOTO)) {
if (QAction *act = cmd->action()) { if (QAction *act = cmd->action())
act->trigger(); act->trigger();
}
} }
} }

View File

@@ -62,9 +62,8 @@ void TextEditor::setMimeTypeForHighlighter(Highlighter *highlighter, const Core:
if (!definitionId.isEmpty()) { if (!definitionId.isEmpty()) {
const QSharedPointer<HighlightDefinition> &definition = const QSharedPointer<HighlightDefinition> &definition =
Manager::instance()->definition(definitionId); Manager::instance()->definition(definitionId);
if (!definition.isNull() && definition->isValid()) { if (!definition.isNull() && definition->isValid())
highlighter->setDefaultContext(definition->initialContext()); highlighter->setDefaultContext(definition->initialContext());
}
} }
} }

View File

@@ -496,13 +496,12 @@ Utils::SynchronousProcessResponse Command::runSynchronous(const QStringList &arg
Utils::ExitCodeInterpreter defaultInterpreter(this); Utils::ExitCodeInterpreter defaultInterpreter(this);
Utils::ExitCodeInterpreter *currentInterpreter = interpreter ? interpreter : &defaultInterpreter; Utils::ExitCodeInterpreter *currentInterpreter = interpreter ? interpreter : &defaultInterpreter;
// Result // Result
if (timedOut) { if (timedOut)
response.result = Utils::SynchronousProcessResponse::Hang; response.result = Utils::SynchronousProcessResponse::Hang;
} else if (process->exitStatus() != QProcess::NormalExit) { else if (process->exitStatus() != QProcess::NormalExit)
response.result = Utils::SynchronousProcessResponse::TerminatedAbnormally; response.result = Utils::SynchronousProcessResponse::TerminatedAbnormally;
} else { else
response.result = currentInterpreter->interpretExitCode(process->exitCode()); response.result = currentInterpreter->interpretExitCode(process->exitCode());
}
return response; return response;
} }