diff options
author | Eike Ziller <eike.ziller@theqtcompany.com> | 2015-01-08 10:38:20 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@theqtcompany.com> | 2015-01-08 10:38:20 +0100 |
commit | b5b47f7df2a70064f5e1041cefb18636d20d0bd4 (patch) | |
tree | 7f57b886355129a7dd13611787b7de96065dde3a /src | |
parent | 0a5186700c036a541f5fa0baebb5e9ce0d506fed (diff) | |
parent | ecd9c4c813be37dec46514462f1fcba901165a93 (diff) | |
download | qt-creator-b5b47f7df2a70064f5e1041cefb18636d20d0bd4.tar.gz |
Merge remote-tracking branch 'origin/3.3'
Conflicts:
src/plugins/cppeditor/cppdocumentationcommenthelper.cpp
Change-Id: I2cf25eba1de149765a6c44ad354d606ce9de512d
Diffstat (limited to 'src')
34 files changed, 259 insertions, 58 deletions
diff --git a/src/libs/3rdparty/cplusplus/TranslationUnit.cpp b/src/libs/3rdparty/cplusplus/TranslationUnit.cpp index 86eb25f1e3..4f1ff72139 100644 --- a/src/libs/3rdparty/cplusplus/TranslationUnit.cpp +++ b/src/libs/3rdparty/cplusplus/TranslationUnit.cpp @@ -534,9 +534,10 @@ bool TranslationUnit::maybeSplitGreaterGreaterToken(unsigned tokenIndex) newGreater.byteOffset = tok.byteOffset + 1; newGreater.utf16charOffset = tok.utf16charOffset + 1; + TokenLineColumn::const_iterator it = _expandedLineColumn.find(tok.bytesBegin()); + _tokens->insert(_tokens->begin() + tokenIndex + 1, newGreater); - TokenLineColumn::const_iterator it = _expandedLineColumn.find(tok.bytesBegin()); if (it != _expandedLineColumn.end()) { const std::pair<unsigned, unsigned> newPosition(it->second.first, it->second.second + 1); _expandedLineColumn.insert(std::make_pair(newGreater.bytesBegin(), newPosition)); diff --git a/src/plugins/clangcodemodel/clang_installation.pri b/src/plugins/clangcodemodel/clang_installation.pri index 584e844cae..079b00ebc1 100644 --- a/src/plugins/clangcodemodel/clang_installation.pri +++ b/src/plugins/clangcodemodel/clang_installation.pri @@ -1,5 +1,5 @@ isEmpty(LLVM_INSTALL_DIR):LLVM_INSTALL_DIR=$$(LLVM_INSTALL_DIR) -LLVM_INSTALL_DIR ~= s,\\\\,/,g +LLVM_INSTALL_DIR = $$clean_path($$LLVM_INSTALL_DIR) DEFINES += CLANG_COMPLETION DEFINES += CLANG_HIGHLIGHTING diff --git a/src/plugins/clangcodemodel/semanticmarker.cpp b/src/plugins/clangcodemodel/semanticmarker.cpp index 0d7c6946fd..025ef0398c 100644 --- a/src/plugins/clangcodemodel/semanticmarker.cpp +++ b/src/plugins/clangcodemodel/semanticmarker.cpp @@ -154,6 +154,12 @@ QList<Diagnostic> SemanticMarker::diagnostics() const const unsigned size = qMin(ATTACHED_NOTES_LIMIT, numChildren); for (unsigned di = 0; di < size; ++di) { ScopedCXDiagnostic child(clang_getDiagnosticInSet(cxChildren, di)); + + const Diagnostic::Severity severity + = static_cast<Diagnostic::Severity>(clang_getDiagnosticSeverity(child)); + if (severity == Diagnostic::Ignored || severity == Diagnostic::Note) + continue; + spelling.append(QLatin1String("\n ")); spelling.append(Internal::getQString(clang_getDiagnosticSpelling(child))); } diff --git a/src/plugins/clearcase/checkoutdialog.cpp b/src/plugins/clearcase/checkoutdialog.cpp index 0d9fc75617..8ee423e65c 100644 --- a/src/plugins/clearcase/checkoutdialog.cpp +++ b/src/plugins/clearcase/checkoutdialog.cpp @@ -36,6 +36,7 @@ #include <QList> #include <QPair> #include <QPalette> +#include <QPushButton> namespace ClearCase { namespace Internal { @@ -57,6 +58,8 @@ CheckOutDialog::CheckOutDialog(const QString &fileName, bool isUcm, QWidget *par ui->verticalLayout->insertWidget(1, line); } + + ui->buttonBox->button(QDialogButtonBox::Ok)->setFocus(); } CheckOutDialog::~CheckOutDialog() diff --git a/src/plugins/clearcase/clearcaseplugin.cpp b/src/plugins/clearcase/clearcaseplugin.cpp index a4a9741825..a2d864a406 100644 --- a/src/plugins/clearcase/clearcaseplugin.cpp +++ b/src/plugins/clearcase/clearcaseplugin.cpp @@ -47,6 +47,7 @@ #include <coreplugin/actionmanager/command.h> #include <coreplugin/coreconstants.h> #include <coreplugin/documentmanager.h> +#include <coreplugin/editormanager/documentmodel.h> #include <coreplugin/editormanager/editormanager.h> #include <coreplugin/icore.h> #include <coreplugin/infobar.h> @@ -1648,6 +1649,14 @@ bool ClearCasePlugin::vcsOpen(const QString &workingDir, const QString &fileName && !m_settings.disableIndexer) { setStatus(absPath, FileStatus::CheckedOut); } + + foreach (DocumentModel::Entry *e, DocumentModel::entries()) { + if (e->fileName() == absPath) { + e->document->checkPermissions(); + break; + } + } + return !response.error; } return true; diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp index 873c5b5deb..fa19445743 100644 --- a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp @@ -276,7 +276,7 @@ CMakeEditorFactory::CMakeEditorFactory(CMakeSettingsPage *settingsPage) setEditorCreator([]() { return new CMakeEditor; }); setEditorWidgetCreator([]() { return new CMakeEditorWidget; }); setDocumentCreator([]() { return new CMakeDocument; }); - setGenericSyntaxHighlighter(QLatin1String(Constants::CMAKEMIMETYPE)); + setGenericSyntaxHighlighterByName(QLatin1String("CMake")); setCommentStyle(Utils::CommentDefinition::HashStyle); setCodeFoldingSupported(true); diff --git a/src/plugins/coreplugin/designmode.cpp b/src/plugins/coreplugin/designmode.cpp index c84e957ede..50a9b38bd9 100644 --- a/src/plugins/coreplugin/designmode.cpp +++ b/src/plugins/coreplugin/designmode.cpp @@ -189,6 +189,7 @@ void DesignMode::unregisterDesignWidget(QWidget *widget) foreach (DesignEditorInfo *info, d->m_editors) { if (info->widget == widget) { d->m_editors.removeAll(info); + delete info; break; } } diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp index ef849f427c..aec3259de7 100644 --- a/src/plugins/coreplugin/manhattanstyle.cpp +++ b/src/plugins/coreplugin/manhattanstyle.cpp @@ -619,7 +619,10 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt switch (element) { case CE_Splitter: - painter->fillRect(option->rect, Utils::StyleHelper::borderColor()); + if (creatorTheme()->widgetStyle() == Theme::StyleFlat) + painter->fillRect(option->rect, creatorTheme()->color(Theme::BackgroundColorSelected)); + else + painter->fillRect(option->rect, Utils::StyleHelper::borderColor()); break; case CE_TabBarTabShape: diff --git a/src/plugins/coreplugin/testdatadir.cpp b/src/plugins/coreplugin/testdatadir.cpp index 8e67db098a..1cf0bc1c73 100644 --- a/src/plugins/coreplugin/testdatadir.cpp +++ b/src/plugins/coreplugin/testdatadir.cpp @@ -38,17 +38,9 @@ using namespace Core::Tests; -static void maybeAppendSlash(QString *string) -{ - const QChar slash = QLatin1Char('/'); - if (!string->endsWith(slash)) - string->append(slash); -} - TestDataDir::TestDataDir(const QString &directory) : m_directory(directory) { - maybeAppendSlash(&m_directory); QFileInfo fi(m_directory); QVERIFY(fi.exists()); QVERIFY(fi.isDir()); @@ -56,7 +48,7 @@ TestDataDir::TestDataDir(const QString &directory) QString TestDataDir::file(const QString &fileName) const { - return directory() + fileName; + return directory() + QLatin1Char('/') + fileName; } QString TestDataDir::path() const @@ -71,6 +63,5 @@ QString TestDataDir::directory(const QString &subdir, bool clean) const path += QLatin1Char('/') + subdir; if (clean) path = QDir::cleanPath(path); - maybeAppendSlash(&path); return path; } diff --git a/src/plugins/cppeditor/cppdocumentationcommenthelper.cpp b/src/plugins/cppeditor/cppdocumentationcommenthelper.cpp index 390618549e..fbf9830337 100644 --- a/src/plugins/cppeditor/cppdocumentationcommenthelper.cpp +++ b/src/plugins/cppeditor/cppdocumentationcommenthelper.cpp @@ -119,8 +119,8 @@ bool isCppStyleContinuation(const QTextCursor& cursor) return isPreviousLineCppStyleComment(cursor) || isNextLineCppStyleComment(cursor); } -/// Check if line is a CppStyle Doxygen comment and the cursor is after the comment -bool isCursorAfterCppComment(const QTextCursor &cursor, const QTextDocument *doc) +bool lineStartsWithCppDoxygenCommentAndCursorIsAfter(const QTextCursor &cursor, + const QTextDocument *doc) { QTextCursor cursorFirstNonBlank(cursor); cursorFirstNonBlank.movePosition(QTextCursor::StartOfLine); @@ -136,6 +136,27 @@ bool isCursorAfterCppComment(const QTextCursor &cursor, const QTextDocument *doc return false; } +bool isCursorAfterNonNestedCppStyleComment(const QTextCursor &cursor, + TextEditor::TextEditorWidget *editorWidget) +{ + QTextDocument *document = editorWidget->document(); + QTextCursor cursorBeforeCppComment(cursor); + while (document->characterAt(cursorBeforeCppComment.position()) != QLatin1Char('/') + && cursorBeforeCppComment.movePosition(QTextCursor::PreviousCharacter)) { + } + + if (!cursorBeforeCppComment.movePosition(QTextCursor::PreviousCharacter)) + return false; + + if (document->characterAt(cursorBeforeCppComment.position()) != QLatin1Char('/')) + return false; + + if (!cursorBeforeCppComment.movePosition(QTextCursor::PreviousCharacter)) + return false; + + return !editorWidget->autoCompleter()->isInComment(cursorBeforeCppComment); +} + bool handleDoxygenCppStyleContinuation(QTextCursor &cursor) { const int blockPos = cursor.positionInBlock(); @@ -166,16 +187,23 @@ bool handleDoxygenCppStyleContinuation(QTextCursor &cursor) } bool handleDoxygenContinuation(QTextCursor &cursor, - const QTextDocument *doc, + TextEditor::TextEditorWidget *editorWidget, const bool enableDoxygen, const bool leadingAsterisks) { + const QTextDocument *doc = editorWidget->document(); + // It might be a continuation if: // a) current line starts with /// or //! and cursor is positioned after the comment // b) current line is in the middle of a multi-line Qt or Java style comment - if (enableDoxygen && !cursor.atEnd() && isCursorAfterCppComment(cursor, doc)) - return handleDoxygenCppStyleContinuation(cursor); + if (!cursor.atEnd()) { + if (enableDoxygen && lineStartsWithCppDoxygenCommentAndCursorIsAfter(cursor, doc)) + return handleDoxygenCppStyleContinuation(cursor); + + if (isCursorAfterNonNestedCppStyleComment(cursor, editorWidget)) + return false; + } // We continue the comment if the cursor is after a comment's line asterisk and if // there's no asterisk immediately after the cursor (that would already be considered @@ -219,6 +247,14 @@ bool handleDoxygenContinuation(QTextCursor &cursor, else newLine.append(QLatin1String(" ")); } else { + // If '*' is not within a comment, skip. + QTextCursor cursorOnFirstNonWhiteSpace(cursor); + const int positionOnFirstNonWhiteSpace = cursor.position() - blockPos + offset; + cursorOnFirstNonWhiteSpace.setPosition(positionOnFirstNonWhiteSpace); + if (!editorWidget->autoCompleter()->isInComment(cursorOnFirstNonWhiteSpace)) + return false; + + // ...otherwise do the continuation int start = offset; while (offset < blockPos && currentLine.at(offset) == QLatin1Char('*')) ++offset; @@ -292,12 +328,11 @@ bool trySplitComment(TextEditor::TextEditorWidget *editorWidget) return true; } } - } } // right after first doxygen comment return handleDoxygenContinuation(cursor, - editorWidget->document(), + editorWidget, settings.m_enableDoxygen, settings.m_leadingAsterisks); } diff --git a/src/plugins/cppeditor/cppdoxygen_test.cpp b/src/plugins/cppeditor/cppdoxygen_test.cpp index 3d3b7e0d5a..fbc5443d71 100644 --- a/src/plugins/cppeditor/cppdoxygen_test.cpp +++ b/src/plugins/cppeditor/cppdoxygen_test.cpp @@ -261,6 +261,24 @@ void CppEditorPlugin::test_doxygen_comments_data() "void d(); ///\n" "\n" ); + + QTest::newRow("noContinuationForExpressionAndComment1") << _( + "bool preventFolding;\n" + "*foo //|\n" + ) << _( + "bool preventFolding;\n" + "*foo //\n" + "\n" + ); + + QTest::newRow("noContinuationForExpressionAndComment2") << _( + "bool preventFolding;\n" + "*foo /*|\n" + ) << _( + "bool preventFolding;\n" + "*foo /*\n" + " \n" + ); } void CppEditorPlugin::test_doxygen_comments() diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index 6485cca330..3ea97b7324 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -493,7 +493,8 @@ void CppEditorWidget::contextMenuEvent(QContextMenuEvent *e) QSignalMapper mapper; connect(&mapper, SIGNAL(mapped(int)), this, SLOT(performQuickFix(int))); - if (isSemanticInfoValid()) { + if (isSemanticInfoValidExceptLocalUses()) { + d->m_useSelectionsUpdater.update(CppUseSelectionsUpdater::Synchronous); AssistInterface *interface = createAssistInterface(QuickFix, ExplicitlyInvoked); if (interface) { QScopedPointer<IAssistProcessor> processor( diff --git a/src/plugins/cppeditor/cppquickfix_test.cpp b/src/plugins/cppeditor/cppquickfix_test.cpp index c32e96bf58..533f036582 100644 --- a/src/plugins/cppeditor/cppquickfix_test.cpp +++ b/src/plugins/cppeditor/cppquickfix_test.cpp @@ -1497,6 +1497,57 @@ void CppEditorPlugin::test_quickfix_data() " f1(*str);\n" "}\n"); + QTest::newRow("ConvertAutoFromPointer") + << CppQuickFixFactoryPtr(new ConvertFromAndToPointer) + << _("void foo() {\n" + " auto @str = new QString(QLatin1String(\"foo\"));\n" + " if (!str->isEmpty())\n" + " str->clear();\n" + " f1(*str);\n" + " f2(str);\n" + "}\n") + << _("void foo() {\n" + " auto str = QString(QLatin1String(\"foo\"));\n" + " if (!str.isEmpty())\n" + " str.clear();\n" + " f1(str);\n" + " f2(&str);\n" + "}\n"); + + QTest::newRow("ConvertAutoFromPointer2") + << CppQuickFixFactoryPtr(new ConvertFromAndToPointer) + << _("void foo() {\n" + " auto *@str = new QString;\n" + " if (!str->isEmpty())\n" + " str->clear();\n" + " f1(*str);\n" + " f2(str);\n" + "}\n") + << _("void foo() {\n" + " auto str = QString();\n" + " if (!str.isEmpty())\n" + " str.clear();\n" + " f1(str);\n" + " f2(&str);\n" + "}\n"); + + QTest::newRow("ConvertAutoToPointer") + << CppQuickFixFactoryPtr(new ConvertFromAndToPointer) + << _("void foo() {\n" + " auto @str = QString(QLatin1String(\"foo\"));\n" + " if (!str.isEmpty())\n" + " str.clear();\n" + " f1(str);\n" + " f2(&str);\n" + "}\n") + << _("void foo() {\n" + " auto @str = new QString(QLatin1String(\"foo\"));\n" + " if (!str->isEmpty())\n" + " str->clear();\n" + " f1(*str);\n" + " f2(str);\n" + "}\n"); + QTest::newRow("InsertQtPropertyMembers_noTriggerInvalidCode") << CppQuickFixFactoryPtr(new InsertQtPropertyMembers) << _("class C { @Q_PROPERTY(typeid foo READ foo) };\n") diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index d84f7f81ba..7ca242fe30 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -3862,12 +3862,14 @@ public: enum Mode { FromPointer, FromVariable, FromReference }; ConvertFromAndToPointerOp(const CppQuickFixInterface &interface, int priority, Mode mode, + bool isAutoDeclaration, const SimpleDeclarationAST *simpleDeclaration, const DeclaratorAST *declaratorAST, const SimpleNameAST *identifierAST, Symbol *symbol) : CppQuickFixOperation(interface, priority) , m_mode(mode) + , m_isAutoDeclaration(isAutoDeclaration) , m_simpleDeclaration(simpleDeclaration) , m_declaratorAST(declaratorAST) , m_identifierAST(identifierAST) @@ -3906,6 +3908,8 @@ public: private: void removePointerOperator(ChangeSet &changes) const { + if (!m_declaratorAST->ptr_operator_list) + return; PointerAST *ptrAST = m_declaratorAST->ptr_operator_list->value->asPointer(); QTC_ASSERT(ptrAST, return); const int pos = m_file->startOf(ptrAST->star_token); @@ -3942,12 +3946,26 @@ private: } } + void removeNewKeyword(ChangeSet &changes, NewExpressionAST *newExprAST) const + { + // remove 'new' keyword before initializer + changes.remove(m_file->startOf(newExprAST->new_token), + m_file->startOf(newExprAST->new_type_id)); + } + void convertToStackVariable(ChangeSet &changes) const { // Handle the initializer. if (m_declaratorAST->initializer) { - if (NewExpressionAST *newExpression = m_declaratorAST->initializer->asNewExpression()) - removeNewExpression(changes, newExpression); + if (NewExpressionAST *newExpression = m_declaratorAST->initializer->asNewExpression()) { + if (m_isAutoDeclaration) { + if (!newExpression->new_initializer) + changes.insert(m_file->endOf(newExpression), QStringLiteral("()")); + removeNewKeyword(changes, newExpression); + } else { + removeNewExpression(changes, newExpression); + } + } } // Fix all occurrences of the identifier in this function. @@ -3955,10 +3973,15 @@ private: foreach (const SemanticInfo::Use &use, semanticInfo().localUses.value(m_symbol)) { const QList<AST *> path = astPath(use.line, use.column); AST *idAST = path.last(); + bool declarationFound = false; bool starFound = false; int ampersandPos = 0; bool memberAccess = false; for (int i = path.count() - 2; i >= 0; --i) { + if (path.at(i) == m_declaratorAST) { + declarationFound = true; + break; + } if (MemberAccessAST *memberAccessAST = path.at(i)->asMemberAccess()) { if (m_file->tokenAt(memberAccessAST->access_token).kind() != T_ARROW) continue; @@ -3987,7 +4010,7 @@ private: break; } } - if (!starFound && !memberAccess) { + if (!declarationFound && !starFound && !memberAccess) { if (ampersandPos) { changes.insert(ampersandPos, QLatin1String("&(")); changes.insert(m_file->endOf(idAST->firstToken()), QLatin1String(")")); @@ -4017,11 +4040,13 @@ private: void insertNewExpression(ChangeSet &changes, CallAST *callAST) const { const QString typeName = typeNameOfDeclaration(); - if (typeName.isEmpty()) - return; - changes.insert(m_file->startOf(callAST), - QLatin1String("new ") + typeName + QLatin1Char('(')); - changes.insert(m_file->startOf(callAST->lastToken()), QLatin1String(")")); + if (typeName.isEmpty()) { + changes.insert(m_file->startOf(callAST), QLatin1String("new ")); + } else { + changes.insert(m_file->startOf(callAST), + QLatin1String("new ") + typeName + QLatin1Char('(')); + changes.insert(m_file->startOf(callAST->lastToken()), QLatin1String(")")); + } } void insertNewExpression(ChangeSet &changes, ExpressionListParenAST *exprListAST) const @@ -4054,6 +4079,10 @@ private: AST *idAST = path.last(); bool insertStar = true; for (int i = path.count() - 2; i >= 0; --i) { + if (m_isAutoDeclaration && path.at(i) == m_declaratorAST) { + insertStar = false; + break; + } if (MemberAccessAST *memberAccessAST = path.at(i)->asMemberAccess()) { const int pos = m_file->startOf(memberAccessAST->access_token); changes.replace(pos, pos + 1, QLatin1String("->")); @@ -4076,6 +4105,7 @@ private: } const Mode m_mode; + const bool m_isAutoDeclaration; const SimpleDeclarationAST * const m_simpleDeclaration; const DeclaratorAST * const m_declaratorAST; const SimpleNameAST * const m_identifierAST; @@ -4129,7 +4159,23 @@ void ConvertFromAndToPointer::match(const CppQuickFixInterface &interface, if (!symbol) return; - if (declarator->ptr_operator_list) { + bool isAutoDeclaration = false; + if (symbol->storage() == Symbol::Auto) { + // For auto variables we must deduce the type from the initializer. + if (!declarator->initializer) + return; + + isAutoDeclaration = true; + TypeOfExpression typeOfExpression; + typeOfExpression.init(interface.semanticInfo().doc, interface.snapshot()); + typeOfExpression.setExpandTemplates(true); + CppRefactoringFilePtr file = interface.currentFile(); + Scope *scope = file->scopeAt(declarator->firstToken()); + QList<LookupItem> result = typeOfExpression(file->textOf(declarator->initializer).toUtf8(), + scope, TypeOfExpression::Preprocess); + if (!result.isEmpty() && result.first().type()->isPointerType()) + mode = ConvertFromAndToPointerOp::FromPointer; + } else if (declarator->ptr_operator_list) { for (PtrOperatorListAST *ops = declarator->ptr_operator_list; ops; ops = ops->next) { if (ops != declarator->ptr_operator_list) { // Bail out on more complex pointer types (e.g. pointer of pointer, @@ -4144,8 +4190,8 @@ void ConvertFromAndToPointer::match(const CppQuickFixInterface &interface, } const int priority = path.size() - 1; - result.append(new ConvertFromAndToPointerOp(interface, priority, mode, simpleDeclaration, - declarator, identifier, symbol)); + result.append(new ConvertFromAndToPointerOp(interface, priority, mode, isAutoDeclaration, + simpleDeclaration, declarator, identifier, symbol)); } namespace { diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index 546d3613bc..a2c263ee0a 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -394,8 +394,7 @@ ProjectPart::HeaderPaths CppModelManager::internalHeaderPaths() const const ProjectInfo pinfo = it.value(); foreach (const ProjectPart::Ptr &part, pinfo.projectParts()) { foreach (const ProjectPart::HeaderPath &path, part->headerPaths) { - const ProjectPart::HeaderPath hp(CppSourceProcessor::cleanPath(path.path), - path.type); + const ProjectPart::HeaderPath hp(QDir::cleanPath(path.path), path.type); if (!headerPaths.contains(hp)) headerPaths += hp; } diff --git a/src/plugins/cpptools/cppmodelmanager_test.cpp b/src/plugins/cpptools/cppmodelmanager_test.cpp index 915da3828c..c1ec0a33f9 100644 --- a/src/plugins/cpptools/cppmodelmanager_test.cpp +++ b/src/plugins/cpptools/cppmodelmanager_test.cpp @@ -75,7 +75,7 @@ public: { return directory(_("frameworks"), cleaned); } QString fileFromSourcesDir(const QString &fileName) const - { return directory(_("sources")) + fileName; } + { return directory(_("sources")) + QLatin1Char('/') + fileName; } }; QStringList toAbsolutePaths(const QStringList &relativePathList, diff --git a/src/plugins/cpptools/cppprojects.cpp b/src/plugins/cpptools/cppprojects.cpp index 9152549650..edec18ce44 100644 --- a/src/plugins/cpptools/cppprojects.cpp +++ b/src/plugins/cpptools/cppprojects.cpp @@ -37,6 +37,8 @@ #include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/target.h> +#include <utils/qtcassert.h> + #include <QSet> #include <QTextStream> @@ -448,12 +450,16 @@ void ProjectPartBuilder::createProjectPart(const QStringList &theSources, CppTools::ProjectPart::Ptr part(m_templatePart->copy()); part->displayName = partName; - Kit *k = part->project->activeTarget()->kit(); - if (ToolChain *tc = ToolChainKitInformation::toolChain(k)) - part->evaluateToolchain(tc, - languageVersion >= ProjectPart::CXX98 ? m_cxxFlags - : m_cFlags, - SysRootKitInformation::sysRoot(k)); + QTC_ASSERT(part->project, return); + if (ProjectExplorer::Target *activeTarget = part->project->activeTarget()) { + if (Kit *kit = activeTarget->kit()) { + if (ToolChain *toolChain = ToolChainKitInformation::toolChain(kit)) { + const QStringList flags = languageVersion >= ProjectPart::CXX98 ? m_cxxFlags + : m_cFlags; + part->evaluateToolchain(toolChain, flags, SysRootKitInformation::sysRoot(kit)); + } + } + } part->languageExtensions |= languageExtensions; diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index ea2de8f24a..38b9795ca0 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -270,6 +270,7 @@ void GitDiffHandler::addJob(VcsCommand *command, args << QLatin1String("--ignore-space-change"); args << QLatin1String("--unified=") + QString::number( m_controller->contextLinesNumber()); + args << QLatin1String("--src-prefix=a/") << QLatin1String("--dst-prefix=b/"); args << arguments; command->addJob(args, timeout()); } diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index 10b778883c..9b711af5fe 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -658,7 +658,7 @@ void HelpPlugin::slotOpenSupportPage() void HelpPlugin::slotReportBug() { - QDesktopServices::openUrl(QUrl(QLatin1String("https://bugreports.qt-project.org"))); + QDesktopServices::openUrl(QUrl(QLatin1String("https://bugreports.qt.io"))); } void HelpPlugin::doSetupIfNeeded() diff --git a/src/plugins/projectexplorer/abi.cpp b/src/plugins/projectexplorer/abi.cpp index 4d3400048d..c18a5130bf 100644 --- a/src/plugins/projectexplorer/abi.cpp +++ b/src/plugins/projectexplorer/abi.cpp @@ -746,6 +746,16 @@ Abi Abi::hostAbi() os = MacOS; subos = GenericMacFlavor; format = MachOFormat; +#elif defined (Q_OS_BSD4) + os = BsdOS; +# if defined (Q_OS_FREEBSD) + subos = FreeBsdFlavor; +# elif defined (Q_OS_NETBSD) + subos = NetBsdFlavor; +# elif defined (Q_OS_OPENBSD) + subos = OpenBsdFlavor; +# endif + format = ElfFormat; #endif const Abi result(arch, os, subos, format, QSysInfo::WordSize); diff --git a/src/plugins/projectexplorer/msvctoolchain.cpp b/src/plugins/projectexplorer/msvctoolchain.cpp index cbf4962166..082738c58e 100644 --- a/src/plugins/projectexplorer/msvctoolchain.cpp +++ b/src/plugins/projectexplorer/msvctoolchain.cpp @@ -391,16 +391,14 @@ QList<Utils::FileName> MsvcToolChain::suggestedMkspecList() const case Abi::WindowsMsvc2010Flavor: return QList<Utils::FileName>() << Utils::FileName::fromLatin1("win32-msvc2010"); case Abi::WindowsMsvc2012Flavor: - QList<Utils::FileName>() + return QList<Utils::FileName>() << Utils::FileName::fromLatin1("win32-msvc2012") << Utils::FileName::fromLatin1("win32-msvc2010"); - break; case Abi::WindowsMsvc2013Flavor: - QList<Utils::FileName>() + return QList<Utils::FileName>() << Utils::FileName::fromLatin1("win32-msvc2013") << Utils::FileName::fromLatin1("win32-msvc2012") << Utils::FileName::fromLatin1("win32-msvc2010"); - break; default: break; } diff --git a/src/plugins/qmldesigner/components/componentcore/crumblebar.cpp b/src/plugins/qmldesigner/components/componentcore/crumblebar.cpp index e12725a5ee..776e2892bc 100644 --- a/src/plugins/qmldesigner/components/componentcore/crumblebar.cpp +++ b/src/plugins/qmldesigner/components/componentcore/crumblebar.cpp @@ -84,6 +84,11 @@ CrumbleBar::CrumbleBar(QObject *parent) : updateVisibility(); } +CrumbleBar::~CrumbleBar() +{ + delete m_crumblePath; +} + void CrumbleBar::pushFile(const QString &fileName) { if (m_isInternalCalled == false) { diff --git a/src/plugins/qmldesigner/components/componentcore/crumblebar.h b/src/plugins/qmldesigner/components/componentcore/crumblebar.h index 7586087c37..8d24be1356 100644 --- a/src/plugins/qmldesigner/components/componentcore/crumblebar.h +++ b/src/plugins/qmldesigner/components/componentcore/crumblebar.h @@ -42,6 +42,7 @@ class CrumbleBar : public QObject Q_OBJECT public: explicit CrumbleBar(QObject *parent = 0); + ~CrumbleBar(); void pushFile(const QString &fileName); void pushInFileComponent(const ModelNode &modelNode); diff --git a/src/plugins/qnx/qnxconfigurationmanager.cpp b/src/plugins/qnx/qnxconfigurationmanager.cpp index 8c2ca184ad..826d2ad5a6 100644 --- a/src/plugins/qnx/qnxconfigurationmanager.cpp +++ b/src/plugins/qnx/qnxconfigurationmanager.cpp @@ -71,6 +71,7 @@ QnxConfigurationManager::~QnxConfigurationManager() { m_instance = 0; qDeleteAll(m_configurations); + delete m_writer; } QList<QnxConfiguration *> QnxConfigurationManager::configurations() const diff --git a/src/plugins/texteditor/textdocumentlayout.h b/src/plugins/texteditor/textdocumentlayout.h index 7f5e46c468..b1271c37e6 100644 --- a/src/plugins/texteditor/textdocumentlayout.h +++ b/src/plugins/texteditor/textdocumentlayout.h @@ -28,8 +28,8 @@ ** ****************************************************************************/ -#ifndef BASETEXTDOCUMENTLAYOUT_H -#define BASETEXTDOCUMENTLAYOUT_H +#ifndef TEXTDOCUMENTLAYOUT_H +#define TEXTDOCUMENTLAYOUT_H #include "texteditor_global.h" @@ -229,4 +229,4 @@ signals: } // namespace TextEditor -#endif // BASETEXTDOCUMENTLAYOUT_H +#endif // TEXTDOCUMENTLAYOUT_H diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index ce6a8bec6e..243616be09 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -7373,6 +7373,20 @@ void TextEditorFactory::setGenericSyntaxHighlighter(const QString &mimeType) }; } +void TextEditorFactory::setGenericSyntaxHighlighterByName(const QString &name) +{ + d->m_syntaxHighlighterCreator = [this, name]() -> SyntaxHighlighter * { + TextEditor::Highlighter *highlighter = new TextEditor::Highlighter(); + QString definitionId = Manager::instance()->definitionIdByName(name); + if (!definitionId.isEmpty()) { + const QSharedPointer<HighlightDefinition> &definition = Manager::instance()->definition(definitionId); + if (!definition.isNull() && definition->isValid()) + highlighter->setDefaultContext(definition->initialContext()); + } + return highlighter; + }; +} + void TextEditorFactory::setAutoCompleterCreator(const AutoCompleterCreator &creator) { d->m_autoCompleterCreator = creator; diff --git a/src/plugins/texteditor/texteditor.h b/src/plugins/texteditor/texteditor.h index 3eb38d6b3f..0ea3c963f2 100644 --- a/src/plugins/texteditor/texteditor.h +++ b/src/plugins/texteditor/texteditor.h @@ -665,6 +665,7 @@ public: void setIndenterCreator(const IndenterCreator &creator); void setSyntaxHighlighterCreator(const SyntaxHighLighterCreator &creator); void setGenericSyntaxHighlighter(const QString &mimeType); + void setGenericSyntaxHighlighterByName(const QString &name); void setAutoCompleterCreator(const AutoCompleterCreator &creator); void setEditorActionHandlers(Core::Id contextId, uint optionalActions); diff --git a/src/plugins/valgrind/callgrind/callgrinddatamodel.cpp b/src/plugins/valgrind/callgrind/callgrinddatamodel.cpp index c1f01bcc84..7c82d08f72 100644 --- a/src/plugins/valgrind/callgrind/callgrinddatamodel.cpp +++ b/src/plugins/valgrind/callgrind/callgrinddatamodel.cpp @@ -186,7 +186,7 @@ QModelIndex DataModel::indexForObject(const Function *function) const } /** - * Evil workaround for https://bugreports.qt-project.org/browse/QTBUG-1135 + * Evil workaround for https://bugreports.qt.io/browse/QTBUG-1135 * Just replace the bad hyphens by a 'NON-BREAKING HYPHEN' unicode char */ static QString noWrap(const QString &str) diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp index 9af5548a5e..23b2d2775d 100644 --- a/src/plugins/valgrind/callgrindtool.cpp +++ b/src/plugins/valgrind/callgrindtool.cpp @@ -794,7 +794,7 @@ QWidget *CallgrindToolPrivate::createWidgets() m_filterProjectCosts = action; // filter - ///FIXME: find workaround for https://bugreports.qt-project.org/browse/QTCREATORBUG-3247 + ///FIXME: find workaround for https://bugreports.qt.io/browse/QTCREATORBUG-3247 QLineEdit *filter = new QLineEdit; filter->setPlaceholderText(tr("Filter...")); connect(filter, SIGNAL(textChanged(QString)), m_updateTimer, SLOT(start())); diff --git a/src/plugins/valgrind/callgrindvisualisation.cpp b/src/plugins/valgrind/callgrindvisualisation.cpp index 8507a1c9b1..0ad4a6c78c 100644 --- a/src/plugins/valgrind/callgrindvisualisation.cpp +++ b/src/plugins/valgrind/callgrindvisualisation.cpp @@ -54,7 +54,7 @@ // Margin from hardcoded value in: // QGraphicsView::fitInView(const QRectF &rect, // Qt::AspectRatioMode aspectRatioMode) -// Bug report here: https://bugreports.qt-project.org/browse/QTBUG-11945 +// Bug report here: https://bugreports.qt.io/browse/QTBUG-11945 static const int FIT_IN_VIEW_MARGIN = 2; using namespace Valgrind::Callgrind; diff --git a/src/plugins/valgrind/workarounds.h b/src/plugins/valgrind/workarounds.h index 80d545d23b..0ecd8c2099 100644 --- a/src/plugins/valgrind/workarounds.h +++ b/src/plugins/valgrind/workarounds.h @@ -37,7 +37,7 @@ QT_BEGIN_NAMESPACE class QPalette; QT_END_NAMESPACE -///FIXME: remove this once https://bugreports.qt-project.org/browse/QTCREATORBUG-3247 gets fixed +///FIXME: remove this once https://bugreports.qt.io/browse/QTCREATORBUG-3247 gets fixed QPalette panelPalette(const QPalette &oldPalette, bool lightColored = false); #endif // WORKAROUNDS_H diff --git a/src/tools/3rdparty/iossim/iphonesimulator.mm b/src/tools/3rdparty/iossim/iphonesimulator.mm index b120fab64e..c75acef7a9 100644 --- a/src/tools/3rdparty/iossim/iphonesimulator.mm +++ b/src/tools/3rdparty/iossim/iphonesimulator.mm @@ -608,8 +608,8 @@ static void ChildSignal(int /*arg*/) { NSArray* devices = [deviceSet availableDevices]; NSArray* deviceTypeAndVersion = [devTypeId componentsSeparatedByString:@","]; if(deviceTypeAndVersion.count == 2) { - NSString* typeIdentifier = [deviceTypeAndVersion.firstObject stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; - NSString* versionString = [deviceTypeAndVersion.lastObject stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];; + NSString* typeIdentifier = [[deviceTypeAndVersion objectAtIndex:0] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; + NSString* versionString = [[deviceTypeAndVersion objectAtIndex:1] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];; for (SimDevice* device in devices) { if ([device.deviceType.identifier isEqualToString:typeIdentifier] && [device.runtime.versionString isEqualToString:versionString]) { return device; diff --git a/src/tools/buildoutputparser/buildoutputparser.pro b/src/tools/buildoutputparser/buildoutputparser.pro index 4f762f2b02..207890898e 100644 --- a/src/tools/buildoutputparser/buildoutputparser.pro +++ b/src/tools/buildoutputparser/buildoutputparser.pro @@ -13,7 +13,7 @@ include(../../rpath.pri) win32|equals(TEST, 1):DEFINES += HAS_MSVC_PARSER DESTDIR = $$IDE_BIN_PATH -target.path = /bin +target.path = $$QTC_PREFIX/bin INSTALLS += target SOURCES = \ diff --git a/src/tools/qtcreatorcrashhandler/utils.h b/src/tools/qtcreatorcrashhandler/utils.h index 4c7c74bad2..294503be87 100644 --- a/src/tools/qtcreatorcrashhandler/utils.h +++ b/src/tools/qtcreatorcrashhandler/utils.h @@ -35,7 +35,7 @@ #include <QString> const char APPLICATION_NAME[] = "Qt Creator Crash Handler"; -const char URL_BUGTRACKER[] = "https://bugreports.qt-project.org/"; +const char URL_BUGTRACKER[] = "https://bugreports.qt.io/"; QByteArray fileContents(const QString &filePath); |