diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2016-11-14 11:15:40 +0200 |
---|---|---|
committer | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2016-11-14 11:17:13 +0200 |
commit | 9c09ca9e42c7a7f39bf279adcb14ae1691a409bc (patch) | |
tree | 4a3e10324aa97692fb57e13d4a9870edc7d3e35b /src/plugins | |
parent | 1a2f649b70c67380d29cdececbce3fad1b97dfca (diff) | |
parent | b5f587efb540cff5f51052a6e30be3139d8b930d (diff) | |
download | qt-creator-9c09ca9e42c7a7f39bf279adcb14ae1691a409bc.tar.gz |
Merge remote-tracking branch 'origin/4.2'
Change-Id: Ia98031eb87f1859c3736faa0cdd8b655e8a50689
Diffstat (limited to 'src/plugins')
108 files changed, 934 insertions, 704 deletions
diff --git a/src/plugins/android/androidrunner.cpp b/src/plugins/android/androidrunner.cpp index 30df0bd75e..955f88f261 100644 --- a/src/plugins/android/androidrunner.cpp +++ b/src/plugins/android/androidrunner.cpp @@ -388,6 +388,9 @@ void AndroidRunnerWorker::forceStop() void AndroidRunnerWorker::asyncStart(const QString &intentName, const QVector<QStringList> &adbCommands) { + m_tries = 0; + m_wasStarted = false; + // Its assumed that the device or avd serial returned by selector() is online. m_adbLogcatProcess->start(m_adb, selector() << "logcat"); m_psProc->start(m_adb, selector() << "shell" @@ -526,9 +529,6 @@ void AndroidRunnerWorker::asyncStart(const QString &intentName, } } - - m_tries = 0; - m_wasStarted = false; } bool AndroidRunnerWorker::adbShellAmNeedsQuotes() diff --git a/src/plugins/autotest/autotest.pro b/src/plugins/autotest/autotest.pro index 9cf411299d..a22a584ff3 100644 --- a/src/plugins/autotest/autotest.pro +++ b/src/plugins/autotest/autotest.pro @@ -32,6 +32,7 @@ SOURCES += \ gtest/gtestframework.cpp \ gtest/gtestsettings.cpp \ gtest/gtestsettingspage.cpp \ + gtest/gtest_utils.cpp \ qtest/qttesttreeitem.cpp \ qtest/qttestvisitors.cpp \ qtest/qttestconfiguration.cpp \ @@ -41,11 +42,13 @@ SOURCES += \ qtest/qttestframework.cpp \ qtest/qttestsettings.cpp \ qtest/qttestsettingspage.cpp \ + qtest/qttest_utils.cpp \ quick/quicktestconfiguration.cpp \ quick/quicktestparser.cpp \ quick/quicktesttreeitem.cpp \ quick/quicktestvisitors.cpp \ quick/quicktestframework.cpp \ + quick/quicktest_utils.cpp \ testframeworkmanager.cpp diff --git a/src/plugins/autotest/autotest.qbs b/src/plugins/autotest/autotest.qbs index 9552909ed7..6f6354e00c 100644 --- a/src/plugins/autotest/autotest.qbs +++ b/src/plugins/autotest/autotest.qbs @@ -23,7 +23,7 @@ QtcPlugin { } Depends { - name: "Qt.test" + name: "Qt.testlib" condition: qtc.testsEnabled } diff --git a/src/plugins/autotest/gtest/gtest_utils.cpp b/src/plugins/autotest/gtest/gtest_utils.cpp new file mode 100644 index 0000000000..4ce68760a2 --- /dev/null +++ b/src/plugins/autotest/gtest/gtest_utils.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "gtest_utils.h" + +#include <QStringList> + +namespace Autotest { +namespace Internal { +namespace GTestUtils { + +static const QStringList valid = { + QStringLiteral("TEST"), QStringLiteral("TEST_F"), QStringLiteral("TEST_P"), + QStringLiteral("TYPED_TEST"), QStringLiteral("TYPED_TEST_P") +}; + +bool isGTestMacro(const QString ¯o) +{ + return valid.contains(macro); +} + +bool isGTestParameterized(const QString ¯o) +{ + return macro == QStringLiteral("TEST_P") || macro == QStringLiteral("TYPED_TEST_P"); +} + +bool isGTestTyped(const QString ¯o) +{ + return macro == QStringLiteral("TYPED_TEST") || macro == QStringLiteral("TYPED_TEST_P"); +} + +} // namespace GTestUtils +} // namespace Internal +} // namespace Autotest diff --git a/src/plugins/autotest/gtest/gtest_utils.h b/src/plugins/autotest/gtest/gtest_utils.h index 3a46a4e52a..93dd1ad621 100644 --- a/src/plugins/autotest/gtest/gtest_utils.h +++ b/src/plugins/autotest/gtest/gtest_utils.h @@ -25,31 +25,16 @@ #pragma once +#include <QString> + namespace Autotest { namespace Internal { +namespace GTestUtils { -class GTestUtils -{ -public: - static bool isGTestMacro(const QString ¯o) - { - static QStringList valid = { - QStringLiteral("TEST"), QStringLiteral("TEST_F"), QStringLiteral("TEST_P"), - QStringLiteral("TYPED_TEST"), QStringLiteral("TYPED_TEST_P") - }; - return valid.contains(macro); - } - - static bool isGTestParameterized(const QString ¯o) - { - return macro == QStringLiteral("TEST_P") || macro == QStringLiteral("TYPED_TEST_P"); - } - - static bool isGTestTyped(const QString ¯o) - { - return macro == QStringLiteral("TYPED_TEST") || macro == QStringLiteral("TYPED_TEST_P"); - } -}; +bool isGTestMacro(const QString ¯o); +bool isGTestParameterized(const QString ¯o); +bool isGTestTyped(const QString ¯o); +} // namespace GTestUtils } // namespace Internal } // namespace Autotest diff --git a/src/plugins/autotest/qtest/qttest_utils.cpp b/src/plugins/autotest/qtest/qttest_utils.cpp new file mode 100644 index 0000000000..bb80570ed1 --- /dev/null +++ b/src/plugins/autotest/qtest/qttest_utils.cpp @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "qttest_utils.h" +#include "../testframeworkmanager.h" +#include "../testtreeitem.h" + +#include <utils/qtcassert.h> + +#include <QByteArrayList> + +namespace Autotest { +namespace Internal { +namespace QTestUtils { + +static const QByteArrayList valid = {"QTEST_MAIN", "QTEST_APPLESS_MAIN", "QTEST_GUILESS_MAIN"}; + +bool isQTestMacro(const QByteArray ¯o) +{ + return valid.contains(macro); +} + +QHash<QString, QString> testCaseNamesForFiles(const Core::Id &id, + const QStringList &files) +{ + QHash<QString, QString> result; + TestTreeItem *rootNode = TestFrameworkManager::instance()->rootNodeForTestFramework(id); + QTC_ASSERT(rootNode, return result); + + for (int row = 0, rootCount = rootNode->childCount(); row < rootCount; ++row) { + const TestTreeItem *child = rootNode->childItem(row); + if (files.contains(child->filePath())) { + result.insert(child->filePath(), child->name()); + } + for (int childRow = 0, count = child->childCount(); childRow < count; ++childRow) { + const TestTreeItem *grandChild = child->childItem(childRow); + if (files.contains(grandChild->filePath())) + result.insert(grandChild->filePath(), child->name()); + } + } + return result; +} + +} // namespace QTestUtils +} // namespace Internal +} // namespace Autotest diff --git a/src/plugins/autotest/qtest/qttest_utils.h b/src/plugins/autotest/qtest/qttest_utils.h index 75024b9bc9..0d4f661a35 100644 --- a/src/plugins/autotest/qtest/qttest_utils.h +++ b/src/plugins/autotest/qtest/qttest_utils.h @@ -25,45 +25,17 @@ #pragma once -#include "../testframeworkmanager.h" +#include <QHash> -#include <utils/qtcassert.h> - -#include <QByteArrayList> +namespace Core { class Id; } namespace Autotest { namespace Internal { +namespace QTestUtils { -class QTestUtils -{ -public: - static bool isQTestMacro(const QByteArray ¯o) - { - static QByteArrayList valid = {"QTEST_MAIN", "QTEST_APPLESS_MAIN", "QTEST_GUILESS_MAIN"}; - return valid.contains(macro); - } - - static QHash<QString, QString> testCaseNamesForFiles(const Core::Id &id, - const QStringList &files) - { - QHash<QString, QString> result; - TestTreeItem *rootNode = TestFrameworkManager::instance()->rootNodeForTestFramework(id); - QTC_ASSERT(rootNode, return result); - - for (int row = 0, rootCount = rootNode->childCount(); row < rootCount; ++row) { - const TestTreeItem *child = rootNode->childItem(row); - if (files.contains(child->filePath())) { - result.insert(child->filePath(), child->name()); - } - for (int childRow = 0, count = child->childCount(); childRow < count; ++childRow) { - const TestTreeItem *grandChild = child->childItem(childRow); - if (files.contains(grandChild->filePath())) - result.insert(grandChild->filePath(), child->name()); - } - } - return result; - } -}; +bool isQTestMacro(const QByteArray ¯o); +QHash<QString, QString> testCaseNamesForFiles(const Core::Id &id, const QStringList &files); +} // namespace QTestUtils } // namespace Internal } // namespace Autotest diff --git a/src/plugins/autotest/qtest/qttestparser.cpp b/src/plugins/autotest/qtest/qttestparser.cpp index 7472441d4d..2835427d58 100644 --- a/src/plugins/autotest/qtest/qttestparser.cpp +++ b/src/plugins/autotest/qtest/qttestparser.cpp @@ -101,7 +101,7 @@ static QString testClass(const CppTools::CppModelManager *modelManager, document = snapshot.preprocessedDocument(fileContent, fileName); document->check(); CPlusPlus::AST *ast = document->translationUnit()->ast(); - TestAstVisitor astVisitor(document); + TestAstVisitor astVisitor(document, snapshot); astVisitor.accept(ast); return astVisitor.className(); } @@ -178,7 +178,7 @@ static bool handleQtTest(QFutureInterface<TestParseResultPtr> futureInterface, if (declaringDoc.isNull()) return false; - TestVisitor visitor(testCaseName); + TestVisitor visitor(testCaseName, snapshot); visitor.accept(declaringDoc->globalNamespace()); if (!visitor.resultValid()) return false; diff --git a/src/plugins/autotest/qtest/qttestvisitors.cpp b/src/plugins/autotest/qtest/qttestvisitors.cpp index 3de8448eb7..579a4ff974 100644 --- a/src/plugins/autotest/qtest/qttestvisitors.cpp +++ b/src/plugins/autotest/qtest/qttestvisitors.cpp @@ -39,8 +39,9 @@ static QStringList specialFunctions({ "initTestCase", "cleanupTestCase", "init", /************************** Cpp Test Symbol Visitor ***************************/ -TestVisitor::TestVisitor(const QString &fullQualifiedClassName) - : m_className(fullQualifiedClassName) +TestVisitor::TestVisitor(const QString &fullQualifiedClassName, const CPlusPlus::Snapshot &snapshot) + : m_className(fullQualifiedClassName), + m_snapshot(snapshot) { } @@ -48,7 +49,6 @@ bool TestVisitor::visit(CPlusPlus::Class *symbol) { const CPlusPlus::Overview o; CPlusPlus::LookupContext lc; - const CPlusPlus::Snapshot snapshot = CppTools::CppModelManager::instance()->snapshot(); unsigned count = symbol->memberCount(); for (unsigned i = 0; i < count; ++i) { @@ -67,7 +67,7 @@ bool TestVisitor::visit(CPlusPlus::Class *symbol) TestCodeLocationAndType locationAndType; CPlusPlus::Function *functionDefinition = m_symbolFinder.findMatchingDefinition( - func, snapshot, true); + func, m_snapshot, true); if (functionDefinition && functionDefinition->fileId()) { locationAndType.m_name = QString::fromUtf8(functionDefinition->fileName()); locationAndType.m_line = functionDefinition->line(); @@ -92,9 +92,10 @@ bool TestVisitor::visit(CPlusPlus::Class *symbol) /**************************** Cpp Test AST Visitor ****************************/ -TestAstVisitor::TestAstVisitor(CPlusPlus::Document::Ptr doc) +TestAstVisitor::TestAstVisitor(CPlusPlus::Document::Ptr doc, const CPlusPlus::Snapshot &snapshot) : ASTVisitor(doc->translationUnit()), - m_currentDoc(doc) + m_currentDoc(doc), + m_snapshot(snapshot) { } @@ -113,8 +114,7 @@ bool TestAstVisitor::visit(CPlusPlus::CallAST *ast) // first argument is the one we need if (const auto argumentExpressionAST = expressionListAST->value) { CPlusPlus::TypeOfExpression toe; - CppTools::CppModelManager *cppMM = CppTools::CppModelManager::instance(); - toe.init(m_currentDoc, cppMM->snapshot()); + toe.init(m_currentDoc, m_snapshot); QList<CPlusPlus::LookupItem> toeItems = toe(argumentExpressionAST, m_currentDoc, m_currentScope); diff --git a/src/plugins/autotest/qtest/qttestvisitors.h b/src/plugins/autotest/qtest/qttestvisitors.h index 64d4e8c511..21bfb2ba22 100644 --- a/src/plugins/autotest/qtest/qttestvisitors.h +++ b/src/plugins/autotest/qtest/qttestvisitors.h @@ -42,7 +42,7 @@ namespace Internal { class TestVisitor : public CPlusPlus::SymbolVisitor { public: - explicit TestVisitor(const QString &fullQualifiedClassName); + explicit TestVisitor(const QString &fullQualifiedClassName, const CPlusPlus::Snapshot &snapshot); QMap<QString, TestCodeLocationAndType> privateSlots() const { return m_privSlots; } bool resultValid() const { return m_valid; } @@ -52,6 +52,7 @@ public: private: CppTools::SymbolFinder m_symbolFinder; QString m_className; + CPlusPlus::Snapshot m_snapshot; QMap<QString, TestCodeLocationAndType> m_privSlots; bool m_valid = false; }; @@ -59,7 +60,7 @@ private: class TestAstVisitor : public CPlusPlus::ASTVisitor { public: - explicit TestAstVisitor(CPlusPlus::Document::Ptr doc); + explicit TestAstVisitor(CPlusPlus::Document::Ptr doc, const CPlusPlus::Snapshot &snapshot); bool visit(CPlusPlus::CallAST *ast); bool visit(CPlusPlus::CompoundStatementAST *ast); @@ -70,6 +71,7 @@ private: QString m_className; CPlusPlus::Scope *m_currentScope = 0; CPlusPlus::Document::Ptr m_currentDoc; + CPlusPlus::Snapshot m_snapshot; }; class TestDataFunctionVisitor : public CPlusPlus::ASTVisitor diff --git a/src/plugins/autotest/quick/quicktest_utils.cpp b/src/plugins/autotest/quick/quicktest_utils.cpp new file mode 100644 index 0000000000..2e7c4f1594 --- /dev/null +++ b/src/plugins/autotest/quick/quicktest_utils.cpp @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "quicktest_utils.h" +#include "../testframeworkmanager.h" +#include "../testtreeitem.h" + +#include <utils/qtcassert.h> + +#include <QByteArrayList> + +namespace Autotest { +namespace Internal { +namespace QuickTestUtils { + +static const QByteArrayList valid = {"QUICK_TEST_MAIN", "QUICK_TEST_OPENGL_MAIN"}; + +bool isQuickTestMacro(const QByteArray ¯o) +{ + return valid.contains(macro); +} + +QHash<QString, QString> proFilesForQmlFiles(const Core::Id &id, const QStringList &files) +{ + QHash<QString, QString> result; + TestTreeItem *rootNode = TestFrameworkManager::instance()->rootNodeForTestFramework(id); + QTC_ASSERT(rootNode, return result); + + if (files.isEmpty()) + return result; + + for (int row = 0, rootCount = rootNode->childCount(); row < rootCount; ++row) { + const TestTreeItem *child = rootNode->childItem(row); + const QString &file = child->filePath(); + if (!file.isEmpty() && files.contains(file)) { + const QString &proFile = child->proFile(); + if (!proFile.isEmpty()) + result.insert(file, proFile); + } + for (int subRow = 0, subCount = child->childCount(); subRow < subCount; ++subRow) { + const TestTreeItem *grandChild = child->childItem(subRow); + const QString &file = grandChild->filePath(); + if (!file.isEmpty() && files.contains(file)) { + const QString &proFile = grandChild->proFile(); + if (!proFile.isEmpty()) + result.insert(file, proFile); + } + } + } + return result; +} + +} // namespace QuickTestUtils +} // namespace Internal +} // namespace Autotest diff --git a/src/plugins/autotest/quick/quicktest_utils.h b/src/plugins/autotest/quick/quicktest_utils.h index f7a17ad538..af5cfdb7bf 100644 --- a/src/plugins/autotest/quick/quicktest_utils.h +++ b/src/plugins/autotest/quick/quicktest_utils.h @@ -25,54 +25,17 @@ #pragma once -#include "../testframeworkmanager.h" +#include <QHash> -#include <utils/qtcassert.h> - -#include <QByteArrayList> +namespace Core { class Id; } namespace Autotest { namespace Internal { +namespace QuickTestUtils { -class QuickTestUtils -{ -public: - static bool isQuickTestMacro(const QByteArray ¯o) - { - static const QByteArrayList valid = {"QUICK_TEST_MAIN", "QUICK_TEST_OPENGL_MAIN"}; - return valid.contains(macro); - } - - static QHash<QString, QString> proFilesForQmlFiles(const Core::Id &id, const QStringList &files) - { - QHash<QString, QString> result; - TestTreeItem *rootNode = TestFrameworkManager::instance()->rootNodeForTestFramework(id); - QTC_ASSERT(rootNode, return result); - - if (files.isEmpty()) - return result; - - for (int row = 0, rootCount = rootNode->childCount(); row < rootCount; ++row) { - const TestTreeItem *child = rootNode->childItem(row); - const QString &file = child->filePath(); - if (!file.isEmpty() && files.contains(file)) { - const QString &proFile = child->proFile(); - if (!proFile.isEmpty()) - result.insert(file, proFile); - } - for (int subRow = 0, subCount = child->childCount(); subRow < subCount; ++subRow) { - const TestTreeItem *grandChild = child->childItem(subRow); - const QString &file = grandChild->filePath(); - if (!file.isEmpty() && files.contains(file)) { - const QString &proFile = grandChild->proFile(); - if (!proFile.isEmpty()) - result.insert(file, proFile); - } - } - } - return result; - } -}; +bool isQuickTestMacro(const QByteArray ¯o); +QHash<QString, QString> proFilesForQmlFiles(const Core::Id &id, const QStringList &files); +} // namespace QuickTestUtils } // namespace Internal } // namespace Autotest diff --git a/src/plugins/autotest/testcodeparser.cpp b/src/plugins/autotest/testcodeparser.cpp index 2cbf9f703e..bc0845411b 100644 --- a/src/plugins/autotest/testcodeparser.cpp +++ b/src/plugins/autotest/testcodeparser.cpp @@ -38,6 +38,7 @@ #include <qmljstools/qmljsmodelmanager.h> #include <utils/algorithm.h> +#include <utils/mapreduce.h> #include <utils/qtcassert.h> #include <utils/runextensions.h> @@ -168,38 +169,6 @@ void TestCodeParser::updateTestTree() // is not (yet) part of the CppModelManager's snapshot static bool parsingHasFailed; -static bool checkDocumentForTestCode(QFutureInterface<TestParseResultPtr> &futureInterface, - const QString &fileName, - const QVector<ITestParser *> &parsers) -{ - foreach (ITestParser *currentParser, parsers) { - if (futureInterface.isCanceled()) - return false; - if (currentParser->processDocument(futureInterface, fileName)) - return true; - } - return false; -} - -static void performParse(QFutureInterface<TestParseResultPtr> &futureInterface, - const QStringList &list, const QVector<ITestParser *> &parsers) -{ - int progressValue = 0; - futureInterface.setProgressRange(0, list.size()); - futureInterface.setProgressValue(progressValue); - - foreach (const QString &file, list) { - if (futureInterface.isCanceled()) - return; - futureInterface.setProgressValue(++progressValue); - if (!checkDocumentForTestCode(futureInterface, file, parsers)) { - parsingHasFailed |= !CppTools::CppModelManager::instance()->snapshot().contains(file) - && (CppTools::ProjectFile::classify(file) != CppTools::ProjectFile::Unclassified); - } - } - futureInterface.setProgressValue(list.size()); -} - /****** threaded parsing stuff *******/ void TestCodeParser::onDocumentUpdated(const QString &fileName) @@ -314,6 +283,18 @@ bool TestCodeParser::postponed(const QStringList &fileList) QTC_ASSERT(false, return false); // should not happen at all } +static void parseFileForTests(const QVector<ITestParser *> &parsers, + QFutureInterface<TestParseResultPtr> &futureInterface, + const QString &fileName) +{ + foreach (ITestParser *parser, parsers) { + if (futureInterface.isCanceled()) + return; + if (parser->processDocument(futureInterface, fileName)) + break; + } +} + void TestCodeParser::scanForTests(const QStringList &fileList) { if (m_parserState == Disabled || m_parserState == Shutdown) { @@ -372,7 +353,11 @@ void TestCodeParser::scanForTests(const QStringList &fileList) foreach (ITestParser *parser, m_testCodeParsers) parser->init(list); - QFuture<TestParseResultPtr> future = Utils::runAsync(&performParse, list, m_testCodeParsers); + QFuture<TestParseResultPtr> future = Utils::map(list, + [this](QFutureInterface<TestParseResultPtr> &fi, const QString &file) { + parseFileForTests(m_testCodeParsers, fi, file); + }, + Utils::MapReduceOption::Unordered); m_futureWatcher.setFuture(future); if (list.size() > 5) { Core::ProgressManager::addTask(future, tr("Scanning for Tests"), @@ -411,6 +396,8 @@ void TestCodeParser::onAllTasksFinished(Core::Id type) void TestCodeParser::onFinished() { + if (m_futureWatcher.isCanceled()) + parsingHasFailed = true; switch (m_parserState) { case PartialParse: qCDebug(LOG) << "setting state to Idle (onFinished, PartialParse)"; diff --git a/src/plugins/autotest/testrunner.cpp b/src/plugins/autotest/testrunner.cpp index bec21cba0e..598e51b0b4 100644 --- a/src/plugins/autotest/testrunner.cpp +++ b/src/plugins/autotest/testrunner.cpp @@ -74,9 +74,10 @@ TestRunner::TestRunner(QObject *parent) : connect(this, &TestRunner::requestStopTestRun, &m_futureWatcher, &QFutureWatcher<TestResultPtr>::cancel); connect(&m_futureWatcher, &QFutureWatcher<TestResultPtr>::canceled, - this, [this]() { emit testResultReady(TestResultPtr(new FaultyTestResult( - Result::MessageFatal, - tr("Test run canceled by user.")))); + this, [this]() { + emit testResultReady(TestResultPtr(new FaultyTestResult( + Result::MessageFatal, tr("Test run canceled by user.")))); + m_executingTests = false; // avoid being stuck if finished() signal won't get emitted }); } @@ -231,15 +232,12 @@ void TestRunner::prepareToRunTests(Mode mode) if (!projectExplorerSettings.buildBeforeDeploy || mode == TestRunner::DebugWithoutDeploy || mode == TestRunner::RunWithoutDeploy) { runOrDebugTests(); + } else if (project->hasActiveBuildSettings()) { + buildProject(project); } else { - if (project->hasActiveBuildSettings()) { - buildProject(project); - } else { - emit testResultReady(TestResultPtr(new FaultyTestResult(Result::MessageFatal, - tr("Project is not configured. Canceling test run.")))); - onFinished(); - return; - } + emit testResultReady(TestResultPtr(new FaultyTestResult(Result::MessageFatal, + tr("Project is not configured. Canceling test run.")))); + onFinished(); } } @@ -368,6 +366,7 @@ void TestRunner::runOrDebugTests() debugTests(); break; default: + onFinished(); QTC_ASSERT(false, return); // unexpected run mode } } @@ -380,6 +379,8 @@ void TestRunner::buildProject(ProjectExplorer::Project *project) connect(buildManager, &ProjectExplorer::BuildManager::buildQueueFinished, this, &TestRunner::buildFinished); ProjectExplorer::ProjectExplorerPlugin::buildProject(project); + if (!buildManager->isBuilding()) + buildFinished(false); } void TestRunner::buildFinished(bool success) diff --git a/src/plugins/autotest/unit_test/mixed_atp/tests/auto/bench/bench.qbs b/src/plugins/autotest/unit_test/mixed_atp/tests/auto/bench/bench.qbs index d10891316a..971fcfaf04 100644 --- a/src/plugins/autotest/unit_test/mixed_atp/tests/auto/bench/bench.qbs +++ b/src/plugins/autotest/unit_test/mixed_atp/tests/auto/bench/bench.qbs @@ -6,7 +6,7 @@ CppApplication { targetName: "tst_benchtest" Depends { name: "cpp" } - Depends { name: "Qt.test" } + Depends { name: "Qt.testlib" } files: [ "tst_benchtest.cpp" ] diff --git a/src/plugins/autotest/unit_test/mixed_atp/tests/auto/dummy/dummy.qbs b/src/plugins/autotest/unit_test/mixed_atp/tests/auto/dummy/dummy.qbs index 012ba11a67..f5ad64f926 100644 --- a/src/plugins/autotest/unit_test/mixed_atp/tests/auto/dummy/dummy.qbs +++ b/src/plugins/autotest/unit_test/mixed_atp/tests/auto/dummy/dummy.qbs @@ -5,7 +5,7 @@ CppApplication { name: "Dummy auto test" targetName: "tst_FooBar" - Depends { name: "Qt.test" } + Depends { name: "Qt.testlib" } Depends { name: "Qt.gui" } files: [ "tst_foo.cpp", "tst_foo.h" ] diff --git a/src/plugins/autotest/unit_test/plain/test_plain/test_plain.qbs b/src/plugins/autotest/unit_test/plain/test_plain/test_plain.qbs index 1b7937ce6a..295c8a6acf 100644 --- a/src/plugins/autotest/unit_test/plain/test_plain/test_plain.qbs +++ b/src/plugins/autotest/unit_test/plain/test_plain/test_plain.qbs @@ -4,7 +4,7 @@ CppApplication { type: "application" // suppress bundle generation on OSX Depends { name: "Qt.gui" } - Depends { name: "Qt.test" } + Depends { name: "Qt.testlib" } files: [ "tst_simple.cpp", "tst_simple.h" ] } diff --git a/src/plugins/beautifier/beautifierplugin.cpp b/src/plugins/beautifier/beautifierplugin.cpp index 043881b219..e58d746964 100644 --- a/src/plugins/beautifier/beautifierplugin.cpp +++ b/src/plugins/beautifier/beautifierplugin.cpp @@ -196,7 +196,11 @@ bool BeautifierPlugin::initialize(const QStringList &arguments, QString *errorSt menu->menu()->setTitle(QCoreApplication::translate("Beautifier", Constants::OPTION_TR_CATEGORY)); menu->setOnAllDisabledBehavior(Core::ActionContainer::Show); Core::ActionManager::actionContainer(Core::Constants::M_TOOLS)->addMenu(menu); + return true; +} +void BeautifierPlugin::extensionsInitialized() +{ m_tools << new ArtisticStyle::ArtisticStyle(this); m_tools << new ClangFormat::ClangFormat(this); m_tools << new Uncrustify::Uncrustify(this); @@ -216,11 +220,7 @@ bool BeautifierPlugin::initialize(const QStringList &arguments, QString *errorSt addAutoReleasedObject(settingsPage); updateActions(); - return true; -} -void BeautifierPlugin::extensionsInitialized() -{ const Core::EditorManager *editorManager = Core::EditorManager::instance(); connect(editorManager, &Core::EditorManager::currentEditorChanged, this, &BeautifierPlugin::updateActions); diff --git a/src/plugins/clangcodemodel/clangcodemodel.qbs b/src/plugins/clangcodemodel/clangcodemodel.qbs index 509e75963d..ed36629504 100644 --- a/src/plugins/clangcodemodel/clangcodemodel.qbs +++ b/src/plugins/clangcodemodel/clangcodemodel.qbs @@ -45,6 +45,7 @@ QtcPlugin { "clangbackendipcintegration.h", "clangcodemodelplugin.cpp", "clangcodemodelplugin.h", + "clangcodemodel.qrc", "clangcompletionassistinterface.cpp", "clangcompletionassistinterface.h", "clangcompletionassistprocessor.cpp", diff --git a/src/plugins/cmakeprojectmanager/builddirreader.cpp b/src/plugins/cmakeprojectmanager/builddirreader.cpp index fb7d30bf62..741ddc2da4 100644 --- a/src/plugins/cmakeprojectmanager/builddirreader.cpp +++ b/src/plugins/cmakeprojectmanager/builddirreader.cpp @@ -61,6 +61,7 @@ BuildDirReader::Parameters::Parameters(const CMakeBuildConfiguration *bc) cmakeExecutable = cmake->cmakeExecutable(); pathMapper = cmake->pathMapper(); + isAutorun = cmake->isAutoRun(); auto tc = ProjectExplorer::ToolChainKitInformation::toolChain(k, ProjectExplorer::ToolChain::Language::Cxx); if (tc) diff --git a/src/plugins/cmakeprojectmanager/builddirreader.h b/src/plugins/cmakeprojectmanager/builddirreader.h index 20b0de2fd0..db0a5bfc46 100644 --- a/src/plugins/cmakeprojectmanager/builddirreader.h +++ b/src/plugins/cmakeprojectmanager/builddirreader.h @@ -83,6 +83,7 @@ public: QString platform; QString toolset; QStringList generatorArguments; + bool isAutorun = false; }; static BuildDirReader *createReader(const BuildDirReader::Parameters &p); diff --git a/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp b/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp index 6144ad575c..d38155c345 100644 --- a/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp +++ b/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp @@ -507,7 +507,7 @@ CMakeConfig CMakeConfigurationKitInformation::defaultConfiguration(const Kit *k) // Qt4: config << CMakeConfigItem(CMAKE_QMAKE_KEY, "%{Qt:qmakeExecutable}"); // Qt5: - config << CMakeConfigItem(CMAKE_PREFIX_PATH_KEY, "%{Qt:QT_INSTALL_LIBS}"); + config << CMakeConfigItem(CMAKE_PREFIX_PATH_KEY, "%{Qt:QT_INSTALL_PREFIX}"); config << CMakeConfigItem(CMAKE_C_TOOLCHAIN_KEY, "%{Compiler:Executable:C}"); config << CMakeConfigItem(CMAKE_CXX_TOOLCHAIN_KEY, "%{Compiler:Executable:Cxx}"); @@ -535,7 +535,7 @@ QList<Task> CMakeConfigurationKitInformation::validate(const Kit *k) const const bool isQt4 = version && version->qtVersion() < QtSupport::QtVersionNumber(5, 0, 0); Utils::FileName qmakePath; - QStringList qtLibDirs; + QStringList qtInstallDirs; Utils::FileName tcCPath; Utils::FileName tcCxxPath; foreach (const CMakeConfigItem &i, config) { @@ -549,7 +549,7 @@ QList<Task> CMakeConfigurationKitInformation::validate(const Kit *k) const else if (i.key == CMAKE_CXX_TOOLCHAIN_KEY) tcCxxPath = expandedValue; else if (i.key == CMAKE_PREFIX_PATH_KEY) - qtLibDirs = CMakeConfigItem::cmakeSplitValue(expandedValue.toString()); + qtInstallDirs = CMakeConfigItem::cmakeSplitValue(expandedValue.toString()); } QList<Task> result; @@ -572,7 +572,7 @@ QList<Task> CMakeConfigurationKitInformation::validate(const Kit *k) const Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)); } } - if (version && !qtLibDirs.contains(version->qmakeProperty("QT_INSTALL_LIBS")) && !isQt4) { + if (version && !qtInstallDirs.contains(version->qmakeProperty("QT_INSTALL_PREFIX")) && !isQt4) { if (version->isValid()) { result << Task(Task::Warning, tr("CMake configuration has no CMAKE_PREFIX_PATH set " "that points to the kit Qt version."), diff --git a/src/plugins/cmakeprojectmanager/tealeafreader.cpp b/src/plugins/cmakeprojectmanager/tealeafreader.cpp index 8a6fefda01..9ed8373f52 100644 --- a/src/plugins/cmakeprojectmanager/tealeafreader.cpp +++ b/src/plugins/cmakeprojectmanager/tealeafreader.cpp @@ -153,7 +153,7 @@ TeaLeafReader::TeaLeafReader() { connect(EditorManager::instance(), &EditorManager::aboutToSave, this, [this](const IDocument *document) { - if (m_cmakeFiles.contains(document->filePath())) + if (m_cmakeFiles.contains(document->filePath()) || !m_parameters.isAutorun) emit dirty(); }); } @@ -583,7 +583,7 @@ void TeaLeafReader::cmakeFinished(int code, QProcess::ExitStatus status) QString msg; if (status != QProcess::NormalExit) - msg = tr("*** cmake process crashed!"); + msg = tr("*** cmake process crashed."); else if (code != 0) msg = tr("*** cmake process exited with exit code %1.").arg(code); diff --git a/src/plugins/coreplugin/documentmanager.cpp b/src/plugins/coreplugin/documentmanager.cpp index 5a936731fa..ef5ab7b776 100644 --- a/src/plugins/coreplugin/documentmanager.cpp +++ b/src/plugins/coreplugin/documentmanager.cpp @@ -738,40 +738,36 @@ QString DocumentManager::getSaveFileNameWithExtension(const QString &title, cons /*! Asks the user for a new file name (\gui {Save File As}) for \a document. */ -QString DocumentManager::getSaveAsFileName(const IDocument *document, const QString &filter, QString *selectedFilter) +QString DocumentManager::getSaveAsFileName(const IDocument *document) { - if (!document) - return QLatin1String(""); - QString absoluteFilePath = document->filePath().toString(); - const QFileInfo fi(absoluteFilePath); - QString path; - QString fileName; - if (absoluteFilePath.isEmpty()) { - fileName = document->fallbackSaveAsFileName(); + QTC_ASSERT(document, return QString()); + Utils::MimeDatabase mdb; + const QString filter = Utils::MimeDatabase::allFiltersString(); + const QString filePath = document->filePath().toString(); + QString selectedFilter; + QString fileDialogPath = filePath; + if (!filePath.isEmpty()) { + selectedFilter = mdb.mimeTypeForFile(filePath).filterString(); + } else { + const QString suggestedName = document->fallbackSaveAsFileName(); + if (!suggestedName.isEmpty()) { + const QList<MimeType> types = mdb.mimeTypesForFileName(suggestedName); + if (!types.isEmpty()) + selectedFilter = types.first().filterString(); + } const QString defaultPath = document->fallbackSaveAsPath(); if (!defaultPath.isEmpty()) - path = defaultPath; - } else { - path = fi.absolutePath(); - fileName = fi.fileName(); - } - - QString filterString; - if (filter.isEmpty()) { - Utils::MimeDatabase mdb; - const Utils::MimeType &mt = mdb.mimeTypeForFile(fi); - if (mt.isValid()) - filterString = mt.filterString(); - selectedFilter = &filterString; - } else { - filterString = filter; + fileDialogPath = defaultPath + (suggestedName.isEmpty() + ? QString() + : '/' + suggestedName); } + if (selectedFilter.isEmpty()) + selectedFilter = mdb.mimeTypeForName(document->mimeType()).filterString(); - absoluteFilePath = getSaveFileName(tr("Save File As"), - path + QLatin1Char('/') + fileName, - filterString, - selectedFilter); - return absoluteFilePath; + return getSaveFileName(tr("Save File As"), + fileDialogPath, + filter, + &selectedFilter); } /*! diff --git a/src/plugins/coreplugin/documentmanager.h b/src/plugins/coreplugin/documentmanager.h index bf8692f3cb..b259dfcaa5 100644 --- a/src/plugins/coreplugin/documentmanager.h +++ b/src/plugins/coreplugin/documentmanager.h @@ -92,8 +92,7 @@ public: const QString &filter = QString(), QString *selectedFilter = 0); static QString getSaveFileNameWithExtension(const QString &title, const QString &pathIn, const QString &filter); - static QString getSaveAsFileName(const IDocument *document, const QString &filter = QString(), - QString *selectedFilter = 0); + static QString getSaveAsFileName(const IDocument *document); static bool saveAllModifiedDocumentsSilently(bool *canceled = 0, QList<IDocument *> *failedToClose = 0); diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 5db180a447..679e963dc9 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -2100,25 +2100,8 @@ bool EditorManagerPrivate::saveDocumentAs(IDocument *document) if (!document) return false; - emit m_instance->aboutToSave(document); - Utils::MimeDatabase mdb; - const QString filter = Utils::MimeDatabase::allFiltersString(); - QString selectedFilter; - const QString filePath = document->filePath().toString(); - if (!filePath.isEmpty()) { - selectedFilter = mdb.mimeTypeForFile(filePath).filterString(); - } else { - const QString suggestedName = document->fallbackSaveAsFileName(); - if (!suggestedName.isEmpty()) { - const QList<MimeType> types = mdb.mimeTypesForFileName(suggestedName); - if (!types.isEmpty()) - selectedFilter = types.first().filterString(); - } - } - if (selectedFilter.isEmpty()) - selectedFilter = mdb.mimeTypeForName(document->mimeType()).filterString(); const QString &absoluteFilePath = - DocumentManager::getSaveAsFileName(document, filter, &selectedFilter); + DocumentManager::getSaveAsFileName(document); if (absoluteFilePath.isEmpty()) return false; @@ -2130,6 +2113,7 @@ bool EditorManagerPrivate::saveDocumentAs(IDocument *document) EditorManager::closeDocuments(QList<IDocument *>() << otherDocument, false); } + emit m_instance->aboutToSave(document); const bool success = DocumentManager::saveDocument(document, absoluteFilePath); document->checkPermissions(); diff --git a/src/plugins/coreplugin/variablechooser.cpp b/src/plugins/coreplugin/variablechooser.cpp index 4e5a05d68e..1fdf68512c 100644 --- a/src/plugins/coreplugin/variablechooser.cpp +++ b/src/plugins/coreplugin/variablechooser.cpp @@ -118,6 +118,7 @@ public: VariableTreeView *m_variableTree; QLabel *m_variableDescription; + QSortFilterProxyModel *m_sortModel; QString m_defaultDescription; QByteArray m_currentVariableName; // Prevent recursive insertion of currently expanded item }; @@ -258,10 +259,10 @@ VariableChooserPrivate::VariableChooserPrivate(VariableChooser *parent) m_variableTree = new VariableTreeView(q, this); m_variableDescription = new QLabel(q); - auto sorter = new QSortFilterProxyModel(this); - sorter->setSourceModel(&m_model); - sorter->sort(0); - m_variableTree->setModel(sorter); + m_sortModel = new QSortFilterProxyModel(this); + m_sortModel->setSourceModel(&m_model); + m_sortModel->sort(0); + m_variableTree->setModel(m_sortModel); m_variableDescription->setText(m_defaultDescription); m_variableDescription->setMinimumSize(QSize(0, 60)); m_variableDescription->setAlignment(Qt::AlignLeft|Qt::AlignTop); @@ -416,7 +417,8 @@ void VariableChooser::addSupportForChildWidgets(QWidget *parent, MacroExpander * void VariableChooserPrivate::updateDescription(const QModelIndex &index) { if (m_variableDescription) - m_variableDescription->setText(m_model.data(index, Qt::ToolTipRole).toString()); + m_variableDescription->setText(m_model.data(m_sortModel->mapToSource(index), + Qt::ToolTipRole).toString()); } /*! @@ -534,7 +536,7 @@ QWidget *VariableChooserPrivate::currentWidget() */ void VariableChooserPrivate::handleItemActivated(const QModelIndex &index) { - QString text = m_model.data(index, UnexpandedTextRole).toString(); + QString text = m_model.data(m_sortModel->mapToSource(index), UnexpandedTextRole).toString(); if (!text.isEmpty()) insertText(text); } diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index 15d82c3436..5afd9da1a1 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -1217,7 +1217,7 @@ void CdbEngine::activateFrame(int index) void CdbEngine::doUpdateLocals(const UpdateParameters &updateParameters) { if (m_pythonVersion > 0x030000) { - watchHandler()->notifyUpdateStarted(updateParameters.partialVariables()); + watchHandler()->notifyUpdateStarted(updateParameters); DebuggerCommand cmd("theDumper.fetchVariables", ScriptCommand); watchHandler()->appendFormatRequests(&cmd); @@ -1270,7 +1270,7 @@ void CdbEngine::doUpdateLocals(const UpdateParameters &updateParameters) return; } - watchHandler()->notifyUpdateStarted(updateParameters.partialVariables()); + watchHandler()->notifyUpdateStarted(updateParameters); /* Watchers: Forcibly discard old symbol group as switching from * thread 0/frame 0 -> thread 1/assembly -> thread 0/frame 0 will otherwise re-use it diff --git a/src/plugins/debugger/commonoptionspage.cpp b/src/plugins/debugger/commonoptionspage.cpp index 96977c9fc8..47654f52bd 100644 --- a/src/plugins/debugger/commonoptionspage.cpp +++ b/src/plugins/debugger/commonoptionspage.cpp @@ -45,208 +45,11 @@ using namespace Core; using namespace Debugger::Constants; using namespace ProjectExplorer; +using namespace Utils; namespace Debugger { namespace Internal { -class CommonOptionsPageWidget : public QWidget -{ - Q_OBJECT - -public: - explicit CommonOptionsPageWidget(const QSharedPointer<Utils::SavedActionSet> &group); - - GlobalDebuggerOptions globalOptions() const; - void setGlobalOptions(const GlobalDebuggerOptions &go); - -private: - QCheckBox *checkBoxUseAlternatingRowColors; - QCheckBox *checkBoxFontSizeFollowsEditor; - QCheckBox *checkBoxUseToolTipsInMainEditor; - QCheckBox *checkBoxCloseSourceBuffersOnExit; - QCheckBox *checkBoxCloseMemoryBuffersOnExit; - QCheckBox *checkBoxSwitchModeOnExit; - QCheckBox *checkBoxBringToForegroundOnInterrrupt; - QCheckBox *checkBoxShowQmlObjectTree; - QCheckBox *checkBoxBreakpointsFullPath; - QCheckBox *checkBoxRegisterForPostMortem; - QCheckBox *checkBoxWarnOnReleaseBuilds; - QCheckBox *checkBoxKeepEditorStationaryWhileStepping; - QLabel *labelMaximalStackDepth; - QSpinBox *spinBoxMaximalStackDepth; - - DebuggerSourcePathMappingWidget *sourcesMappingWidget; - const QSharedPointer<Utils::SavedActionSet> m_group; -}; - -CommonOptionsPageWidget::CommonOptionsPageWidget - (const QSharedPointer<Utils::SavedActionSet> &group) - : m_group(group) -{ - QGroupBox *behaviorBox = new QGroupBox(this); - behaviorBox->setTitle(tr("Behavior")); - - checkBoxUseAlternatingRowColors = new QCheckBox(behaviorBox); - checkBoxUseAlternatingRowColors->setText(tr("Use alternating row colors in debug views")); - - checkBoxFontSizeFollowsEditor = new QCheckBox(behaviorBox); - checkBoxFontSizeFollowsEditor->setToolTip(tr("Changes the font size in the debugger views when the font size in the main editor changes.")); - checkBoxFontSizeFollowsEditor->setText(tr("Debugger font size follows main editor")); - - checkBoxUseToolTipsInMainEditor = new QCheckBox(behaviorBox); - checkBoxUseToolTipsInMainEditor->setText(tr("Use tooltips in main editor while debugging")); - - QString t = tr("Stopping and stepping in the debugger " - "will automatically open views associated with the current location.") + QLatin1Char('\n'); - checkBoxCloseSourceBuffersOnExit = new QCheckBox(behaviorBox); - checkBoxCloseSourceBuffersOnExit->setText(tr("Close temporary source views on debugger exit")); - checkBoxCloseSourceBuffersOnExit->setToolTip(t + tr("Select this option to close " - "automatically opened source views when the debugger exits.")); - - checkBoxCloseMemoryBuffersOnExit = new QCheckBox(behaviorBox); - checkBoxCloseMemoryBuffersOnExit->setText(tr("Close temporary memory views on debugger exit")); - checkBoxCloseMemoryBuffersOnExit->setToolTip(t + tr("Select this option to close " - "automatically opened memory views when the debugger exits.")); - - checkBoxSwitchModeOnExit = new QCheckBox(behaviorBox); - checkBoxSwitchModeOnExit->setText(tr("Switch to previous mode on debugger exit")); - - checkBoxBringToForegroundOnInterrrupt = new QCheckBox(behaviorBox); - checkBoxBringToForegroundOnInterrrupt->setText(tr("Bring Qt Creator to foreground when application interrupts")); - - checkBoxShowQmlObjectTree = new QCheckBox(behaviorBox); - checkBoxShowQmlObjectTree->setToolTip(tr("Shows QML object tree in Locals and Expressions when connected and not stepping.")); - checkBoxShowQmlObjectTree->setText(tr("Show QML object tree")); - - checkBoxBreakpointsFullPath = new QCheckBox(behaviorBox); - checkBoxBreakpointsFullPath->setToolTip(tr("Enables a full file path in breakpoints by default also for GDB.")); - checkBoxBreakpointsFullPath->setText(tr("Set breakpoints using a full absolute path")); - - checkBoxRegisterForPostMortem = new QCheckBox(behaviorBox); - checkBoxRegisterForPostMortem->setToolTip(tr("Registers Qt Creator for debugging crashed applications.")); - checkBoxRegisterForPostMortem->setText(tr("Use Qt Creator for post-mortem debugging")); - - checkBoxWarnOnReleaseBuilds = new QCheckBox(behaviorBox); - checkBoxWarnOnReleaseBuilds->setText(tr("Warn when debugging \"Release\" builds")); - checkBoxWarnOnReleaseBuilds->setToolTip(tr("Shows a warning when starting the debugger " - "on a binary with insufficient debug information.")); - - checkBoxKeepEditorStationaryWhileStepping = new QCheckBox(behaviorBox); - checkBoxKeepEditorStationaryWhileStepping->setText(tr("Keep editor stationary when stepping")); - checkBoxKeepEditorStationaryWhileStepping->setToolTip(tr("Scrolls the editor only when it is necessary " - "to keep the current line in view, " - "instead of keeping the next statement centered at " - "all times.")); - - labelMaximalStackDepth = new QLabel(tr("Maximum stack depth:"), behaviorBox); - - spinBoxMaximalStackDepth = new QSpinBox(behaviorBox); - spinBoxMaximalStackDepth->setSpecialValueText(tr("<unlimited>")); - spinBoxMaximalStackDepth->setMaximum(999); - spinBoxMaximalStackDepth->setSingleStep(5); - spinBoxMaximalStackDepth->setValue(10); - - sourcesMappingWidget = new DebuggerSourcePathMappingWidget(this); - - QHBoxLayout *horizontalLayout = new QHBoxLayout(); - horizontalLayout->addWidget(labelMaximalStackDepth); - horizontalLayout->addWidget(spinBoxMaximalStackDepth); - horizontalLayout->addStretch(); - - QGridLayout *gridLayout = new QGridLayout(behaviorBox); - gridLayout->addWidget(checkBoxUseAlternatingRowColors, 0, 0, 1, 1); - gridLayout->addWidget(checkBoxUseToolTipsInMainEditor, 1, 0, 1, 1); - gridLayout->addWidget(checkBoxCloseSourceBuffersOnExit, 2, 0, 1, 1); - gridLayout->addWidget(checkBoxCloseMemoryBuffersOnExit, 3, 0, 1, 1); - gridLayout->addWidget(checkBoxBringToForegroundOnInterrrupt, 4, 0, 1, 1); - gridLayout->addWidget(checkBoxBreakpointsFullPath, 5, 0, 1, 1); - gridLayout->addWidget(checkBoxWarnOnReleaseBuilds, 6, 0, 1, 1); - gridLayout->addLayout(horizontalLayout, 7, 0, 1, 2); - - gridLayout->addWidget(checkBoxFontSizeFollowsEditor, 0, 1, 1, 1); - gridLayout->addWidget(checkBoxSwitchModeOnExit, 1, 1, 1, 1); - gridLayout->addWidget(checkBoxShowQmlObjectTree, 2, 1, 1, 1); - gridLayout->addWidget(checkBoxKeepEditorStationaryWhileStepping, 3, 1, 1, 1); - gridLayout->addWidget(checkBoxRegisterForPostMortem, 4, 1, 1, 1); - - QVBoxLayout *verticalLayout = new QVBoxLayout(this); - verticalLayout->addWidget(behaviorBox); - verticalLayout->addWidget(sourcesMappingWidget); - verticalLayout->addStretch(); - - m_group->clear(); - - m_group->insert(action(UseAlternatingRowColors), - checkBoxUseAlternatingRowColors); - m_group->insert(action(UseToolTipsInMainEditor), - checkBoxUseToolTipsInMainEditor); - m_group->insert(action(CloseSourceBuffersOnExit), - checkBoxCloseSourceBuffersOnExit); - m_group->insert(action(CloseMemoryBuffersOnExit), - checkBoxCloseMemoryBuffersOnExit); - m_group->insert(action(SwitchModeOnExit), - checkBoxSwitchModeOnExit); - m_group->insert(action(BreakpointsFullPathByDefault), - checkBoxBreakpointsFullPath); - m_group->insert(action(RaiseOnInterrupt), - checkBoxBringToForegroundOnInterrrupt); - m_group->insert(action(ShowQmlObjectTree), - checkBoxShowQmlObjectTree); - m_group->insert(action(WarnOnReleaseBuilds), - checkBoxWarnOnReleaseBuilds); - m_group->insert(action(StationaryEditorWhileStepping), - checkBoxKeepEditorStationaryWhileStepping); - m_group->insert(action(FontSizeFollowsEditor), - checkBoxFontSizeFollowsEditor); - m_group->insert(action(AutoDerefPointers), 0); - m_group->insert(action(UseToolTipsInLocalsView), 0); - m_group->insert(action(AlwaysAdjustColumnWidths), 0); - m_group->insert(action(UseToolTipsInBreakpointsView), 0); - m_group->insert(action(UseToolTipsInStackView), 0); - m_group->insert(action(UseAddressInBreakpointsView), 0); - m_group->insert(action(UseAddressInStackView), 0); - m_group->insert(action(MaximalStackDepth), spinBoxMaximalStackDepth); - m_group->insert(action(ShowStdNamespace), 0); - m_group->insert(action(ShowQtNamespace), 0); - m_group->insert(action(ShowQObjectNames), 0); - m_group->insert(action(SortStructMembers), 0); - m_group->insert(action(LogTimeStamps), 0); - m_group->insert(action(BreakOnThrow), 0); - m_group->insert(action(BreakOnCatch), 0); - if (Utils::HostOsInfo::isWindowsHost()) { - Utils::SavedAction *registerAction = action(RegisterForPostMortem); - m_group->insert(registerAction, - checkBoxRegisterForPostMortem); - connect(registerAction, &QAction::toggled, - checkBoxRegisterForPostMortem, &QAbstractButton::setChecked); - } else { - checkBoxRegisterForPostMortem->setVisible(false); - } -} - -GlobalDebuggerOptions CommonOptionsPageWidget::globalOptions() const -{ - GlobalDebuggerOptions o; - SourcePathMap allPathMap = sourcesMappingWidget->sourcePathMap(); - for (auto it = allPathMap.begin(), end = allPathMap.end(); it != end; ++it) { - const QString key = it.key(); - if (key.startsWith(QLatin1Char('('))) - o.sourcePathRegExpMap.append(qMakePair(QRegExp(key), it.value())); - else - o.sourcePathMap.insert(key, it.value()); - } - return o; -} - -void CommonOptionsPageWidget::setGlobalOptions(const GlobalDebuggerOptions &go) -{ - SourcePathMap allPathMap = go.sourcePathMap; - foreach (auto regExpMap, go.sourcePathRegExpMap) - allPathMap.insert(regExpMap.first.pattern(), regExpMap.second); - - sourcesMappingWidget->setSourcePathMap(allPathMap); -} - /////////////////////////////////////////////////////////////////////// // // CommonOptionsPage @@ -260,41 +63,184 @@ CommonOptionsPage::CommonOptionsPage(const QSharedPointer<GlobalDebuggerOptions> setDisplayName(QCoreApplication::translate("Debugger", "General")); setCategory(DEBUGGER_SETTINGS_CATEGORY); setDisplayCategory(QCoreApplication::translate("Debugger", DEBUGGER_SETTINGS_TR_CATEGORY)); - setCategoryIcon(Utils::Icon(DEBUGGER_COMMON_SETTINGS_CATEGORY_ICON)); -} - -CommonOptionsPage::~CommonOptionsPage() -{ + setCategoryIcon(Icon(DEBUGGER_COMMON_SETTINGS_CATEGORY_ICON)); } void CommonOptionsPage::apply() { - QTC_ASSERT(!m_widget.isNull() && !m_group.isNull(), return); + m_group.apply(ICore::settings()); - m_group->apply(ICore::settings()); + GlobalDebuggerOptions newOptions; + SourcePathMap allPathMap = m_sourceMappingWidget->sourcePathMap(); + for (auto it = allPathMap.begin(), end = allPathMap.end(); it != end; ++it) { + const QString key = it.key(); + if (key.startsWith(QLatin1Char('('))) + newOptions.sourcePathRegExpMap.append(qMakePair(QRegExp(key), it.value())); + else + newOptions.sourcePathMap.insert(key, it.value()); + } - const GlobalDebuggerOptions newGlobalOptions = m_widget->globalOptions(); - if (newGlobalOptions != *m_options) { - *m_options = newGlobalOptions; + if (newOptions.sourcePathMap != m_options->sourcePathMap + || newOptions.sourcePathRegExpMap != m_options->sourcePathRegExpMap) { + *m_options = newOptions; m_options->toSettings(); } } void CommonOptionsPage::finish() { - if (!m_group.isNull()) - m_group->finish(); + m_group.finish(); delete m_widget; } QWidget *CommonOptionsPage::widget() { - if (m_group.isNull()) - m_group = QSharedPointer<Utils::SavedActionSet>(new Utils::SavedActionSet); - if (!m_widget) { - m_widget = new CommonOptionsPageWidget(m_group); - m_widget->setGlobalOptions(*m_options); + m_widget = new QWidget; + + auto behaviorBox = new QGroupBox(m_widget); + behaviorBox->setTitle(tr("Behavior")); + + auto checkBoxUseAlternatingRowColors = new QCheckBox(behaviorBox); + checkBoxUseAlternatingRowColors->setText(tr("Use alternating row colors in debug views")); + + auto checkBoxFontSizeFollowsEditor = new QCheckBox(behaviorBox); + checkBoxFontSizeFollowsEditor->setToolTip(tr("Changes the font size in the debugger views when the font size in the main editor changes.")); + checkBoxFontSizeFollowsEditor->setText(tr("Debugger font size follows main editor")); + + auto checkBoxUseToolTipsInMainEditor = new QCheckBox(behaviorBox); + checkBoxUseToolTipsInMainEditor->setText(tr("Use tooltips in main editor while debugging")); + + QString t = tr("Stopping and stepping in the debugger " + "will automatically open views associated with the current location.") + QLatin1Char('\n'); + auto checkBoxCloseSourceBuffersOnExit = new QCheckBox(behaviorBox); + checkBoxCloseSourceBuffersOnExit->setText(tr("Close temporary source views on debugger exit")); + checkBoxCloseSourceBuffersOnExit->setToolTip(t + tr("Select this option to close " + "automatically opened source views when the debugger exits.")); + + auto checkBoxCloseMemoryBuffersOnExit = new QCheckBox(behaviorBox); + checkBoxCloseMemoryBuffersOnExit->setText(tr("Close temporary memory views on debugger exit")); + checkBoxCloseMemoryBuffersOnExit->setToolTip(t + tr("Select this option to close " + "automatically opened memory views when the debugger exits.")); + + auto checkBoxSwitchModeOnExit = new QCheckBox(behaviorBox); + checkBoxSwitchModeOnExit->setText(tr("Switch to previous mode on debugger exit")); + + auto checkBoxBringToForegroundOnInterrrupt = new QCheckBox(behaviorBox); + checkBoxBringToForegroundOnInterrrupt->setText(tr("Bring Qt Creator to foreground when application interrupts")); + + auto checkBoxShowQmlObjectTree = new QCheckBox(behaviorBox); + checkBoxShowQmlObjectTree->setToolTip(tr("Shows QML object tree in Locals and Expressions when connected and not stepping.")); + checkBoxShowQmlObjectTree->setText(tr("Show QML object tree")); + + auto checkBoxBreakpointsFullPath = new QCheckBox(behaviorBox); + checkBoxBreakpointsFullPath->setToolTip(tr("Enables a full file path in breakpoints by default also for GDB.")); + checkBoxBreakpointsFullPath->setText(tr("Set breakpoints using a full absolute path")); + + auto checkBoxRegisterForPostMortem = new QCheckBox(behaviorBox); + checkBoxRegisterForPostMortem->setToolTip(tr("Registers Qt Creator for debugging crashed applications.")); + checkBoxRegisterForPostMortem->setText(tr("Use Qt Creator for post-mortem debugging")); + + auto checkBoxWarnOnReleaseBuilds = new QCheckBox(behaviorBox); + checkBoxWarnOnReleaseBuilds->setText(tr("Warn when debugging \"Release\" builds")); + checkBoxWarnOnReleaseBuilds->setToolTip(tr("Shows a warning when starting the debugger " + "on a binary with insufficient debug information.")); + + auto checkBoxKeepEditorStationaryWhileStepping = new QCheckBox(behaviorBox); + checkBoxKeepEditorStationaryWhileStepping->setText(tr("Keep editor stationary when stepping")); + checkBoxKeepEditorStationaryWhileStepping->setToolTip(tr("Scrolls the editor only when it is necessary " + "to keep the current line in view, " + "instead of keeping the next statement centered at " + "all times.")); + + auto labelMaximalStackDepth = new QLabel(tr("Maximum stack depth:"), behaviorBox); + + auto spinBoxMaximalStackDepth = new QSpinBox(behaviorBox); + spinBoxMaximalStackDepth->setSpecialValueText(tr("<unlimited>")); + spinBoxMaximalStackDepth->setMaximum(999); + spinBoxMaximalStackDepth->setSingleStep(5); + spinBoxMaximalStackDepth->setValue(10); + + m_sourceMappingWidget = new DebuggerSourcePathMappingWidget(m_widget); + + auto horizontalLayout = new QHBoxLayout; + horizontalLayout->addWidget(labelMaximalStackDepth); + horizontalLayout->addWidget(spinBoxMaximalStackDepth); + horizontalLayout->addStretch(); + + auto gridLayout = new QGridLayout(behaviorBox); + gridLayout->addWidget(checkBoxUseAlternatingRowColors, 0, 0, 1, 1); + gridLayout->addWidget(checkBoxUseToolTipsInMainEditor, 1, 0, 1, 1); + gridLayout->addWidget(checkBoxCloseSourceBuffersOnExit, 2, 0, 1, 1); + gridLayout->addWidget(checkBoxCloseMemoryBuffersOnExit, 3, 0, 1, 1); + gridLayout->addWidget(checkBoxBringToForegroundOnInterrrupt, 4, 0, 1, 1); + gridLayout->addWidget(checkBoxBreakpointsFullPath, 5, 0, 1, 1); + gridLayout->addWidget(checkBoxWarnOnReleaseBuilds, 6, 0, 1, 1); + gridLayout->addLayout(horizontalLayout, 7, 0, 1, 2); + + gridLayout->addWidget(checkBoxFontSizeFollowsEditor, 0, 1, 1, 1); + gridLayout->addWidget(checkBoxSwitchModeOnExit, 1, 1, 1, 1); + gridLayout->addWidget(checkBoxShowQmlObjectTree, 2, 1, 1, 1); + gridLayout->addWidget(checkBoxKeepEditorStationaryWhileStepping, 3, 1, 1, 1); + gridLayout->addWidget(checkBoxRegisterForPostMortem, 4, 1, 1, 1); + + auto verticalLayout = new QVBoxLayout(m_widget); + verticalLayout->addWidget(behaviorBox); + verticalLayout->addWidget(m_sourceMappingWidget); + verticalLayout->addStretch(); + + m_group.clear(); + + m_group.insert(action(UseAlternatingRowColors), + checkBoxUseAlternatingRowColors); + m_group.insert(action(UseToolTipsInMainEditor), + checkBoxUseToolTipsInMainEditor); + m_group.insert(action(CloseSourceBuffersOnExit), + checkBoxCloseSourceBuffersOnExit); + m_group.insert(action(CloseMemoryBuffersOnExit), + checkBoxCloseMemoryBuffersOnExit); + m_group.insert(action(SwitchModeOnExit), + checkBoxSwitchModeOnExit); + m_group.insert(action(BreakpointsFullPathByDefault), + checkBoxBreakpointsFullPath); + m_group.insert(action(RaiseOnInterrupt), + checkBoxBringToForegroundOnInterrrupt); + m_group.insert(action(ShowQmlObjectTree), + checkBoxShowQmlObjectTree); + m_group.insert(action(WarnOnReleaseBuilds), + checkBoxWarnOnReleaseBuilds); + m_group.insert(action(StationaryEditorWhileStepping), + checkBoxKeepEditorStationaryWhileStepping); + m_group.insert(action(FontSizeFollowsEditor), + checkBoxFontSizeFollowsEditor); + m_group.insert(action(AutoDerefPointers), 0); + m_group.insert(action(UseToolTipsInLocalsView), 0); + m_group.insert(action(AlwaysAdjustColumnWidths), 0); + m_group.insert(action(UseToolTipsInBreakpointsView), 0); + m_group.insert(action(UseToolTipsInStackView), 0); + m_group.insert(action(UseAddressInBreakpointsView), 0); + m_group.insert(action(UseAddressInStackView), 0); + m_group.insert(action(MaximalStackDepth), spinBoxMaximalStackDepth); + m_group.insert(action(ShowStdNamespace), 0); + m_group.insert(action(ShowQtNamespace), 0); + m_group.insert(action(ShowQObjectNames), 0); + m_group.insert(action(SortStructMembers), 0); + m_group.insert(action(LogTimeStamps), 0); + m_group.insert(action(BreakOnThrow), 0); + m_group.insert(action(BreakOnCatch), 0); + if (HostOsInfo::isWindowsHost()) { + SavedAction *registerAction = action(RegisterForPostMortem); + m_group.insert(registerAction, checkBoxRegisterForPostMortem); + connect(registerAction, &QAction::toggled, + checkBoxRegisterForPostMortem, &QAbstractButton::setChecked); + } else { + checkBoxRegisterForPostMortem->setVisible(false); + } + + SourcePathMap allPathMap = m_options->sourcePathMap; + foreach (auto regExpMap, m_options->sourcePathRegExpMap) + allPathMap.insert(regExpMap.first.pattern(), regExpMap.second); + m_sourceMappingWidget->setSourcePathMap(allPathMap); } return m_widget; } @@ -331,7 +277,7 @@ LocalsAndExpressionsOptionsPage::LocalsAndExpressionsOptionsPage() setDisplayName(QCoreApplication::translate("Debugger", "Locals && Expressions")); setCategory(DEBUGGER_SETTINGS_CATEGORY); setDisplayCategory(QCoreApplication::translate("Debugger", DEBUGGER_SETTINGS_TR_CATEGORY)); - setCategoryIcon(Utils::Icon(DEBUGGER_COMMON_SETTINGS_CATEGORY_ICON)); + setCategoryIcon(Icon(DEBUGGER_COMMON_SETTINGS_CATEGORY_ICON)); } void LocalsAndExpressionsOptionsPage::apply() @@ -428,5 +374,3 @@ QWidget *LocalsAndExpressionsOptionsPage::widget() } // namespace Internal } // namespace Debugger - -#include "commonoptionspage.moc" diff --git a/src/plugins/debugger/commonoptionspage.h b/src/plugins/debugger/commonoptionspage.h index 05f4a120fa..ea2383f54c 100644 --- a/src/plugins/debugger/commonoptionspage.h +++ b/src/plugins/debugger/commonoptionspage.h @@ -33,15 +33,11 @@ #include <QPointer> #include <QSharedPointer> -QT_BEGIN_NAMESPACE -class QSpinBox; -QT_END_NAMESPACE - namespace Debugger { namespace Internal { class GlobalDebuggerOptions; -class CommonOptionsPageWidget; +class DebuggerSourcePathMappingWidget; /////////////////////////////////////////////////////////////////////// // @@ -55,21 +51,21 @@ class CommonOptionsPage : public Core::IOptionsPage public: explicit CommonOptionsPage(const QSharedPointer<GlobalDebuggerOptions> &go); - ~CommonOptionsPage(); // IOptionsPage - QWidget *widget(); - void apply(); - void finish(); + QWidget *widget() final; + void apply() final; + void finish() final; static QString msgSetBreakpointAtFunction(const char *function); static QString msgSetBreakpointAtFunctionToolTip(const char *function, const QString &hint = QString()); private: + QPointer<QWidget> m_widget; + Utils::SavedActionSet m_group; const QSharedPointer<GlobalDebuggerOptions> m_options; - QSharedPointer<Utils::SavedActionSet> m_group; - QPointer<CommonOptionsPageWidget> m_widget; + DebuggerSourcePathMappingWidget *m_sourceMappingWidget = nullptr; }; @@ -87,9 +83,9 @@ public: LocalsAndExpressionsOptionsPage(); // IOptionsPage - QWidget *widget(); - void apply(); - void finish(); + QWidget *widget() final; + void apply() final; + void finish() final; private: QPointer<QWidget> m_widget; diff --git a/src/plugins/debugger/debugger.qbs b/src/plugins/debugger/debugger.qbs index b80189782d..626be0e04f 100644 --- a/src/plugins/debugger/debugger.qbs +++ b/src/plugins/debugger/debugger.qbs @@ -21,12 +21,6 @@ Project { Depends { name: "QtSupport" } Depends { name: "TextEditor" } - - Depends { - name: "Qt.test" - condition: qtc.testsEnabled - } - pluginTestDepends: [ "QmakeProjectManager" ] diff --git a/src/plugins/debugger/debugger.qrc b/src/plugins/debugger/debugger.qrc index f49e25cd7b..301234efae 100644 --- a/src/plugins/debugger/debugger.qrc +++ b/src/plugins/debugger/debugger.qrc @@ -25,8 +25,6 @@ <file>images/debugger_stepout_small@2x.png</file> <file>images/debugger_stepover_small.png</file> <file>images/debugger_stepover_small@2x.png</file> - <file>images/breakpoint.png</file> - <file>images/breakpoint@2x.png</file> <file>images/breakpoint_disabled.png</file> <file>images/breakpoint_disabled@2x.png</file> <file>images/breakpoint_pending_overlay.png</file> diff --git a/src/plugins/debugger/debuggeractions.h b/src/plugins/debugger/debuggeractions.h index b1f180c53c..4cf54ea50c 100644 --- a/src/plugins/debugger/debuggeractions.h +++ b/src/plugins/debugger/debuggeractions.h @@ -45,15 +45,6 @@ class GlobalDebuggerOptions public: void toSettings() const; void fromSettings(); - bool operator==(const GlobalDebuggerOptions &rhs) const - { - return sourcePathMap == rhs.sourcePathMap - && sourcePathRegExpMap == rhs.sourcePathRegExpMap; - } - bool operator!=(const GlobalDebuggerOptions &rhs) const - { - return !(*this == rhs); - } SourcePathMap sourcePathMap; SourcePathRegExpMap sourcePathRegExpMap; diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index e96885a9cc..f23da12034 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -1240,6 +1240,7 @@ void DebuggerEngine::notifyDebuggerProcessFinished(int exitCode, // Nothing to do. break; case EngineShutdownRequested: + case InferiorShutdownRequested: notifyEngineShutdownOk(); break; case InferiorRunOk: @@ -2059,7 +2060,7 @@ void DebuggerEngine::updateItem(const QString &iname) WatchModelBase *model = handler->model(); QTC_CHECK(model); if (item && !model->hasChildren(model->indexForItem(item))) { - handler->notifyUpdateStarted({iname}); + handler->notifyUpdateStarted(UpdateParameters(iname)); item->setValue(decodeData({}, "notaccessible")); item->setHasChildren(false); item->outdated = false; diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index e2dfd41d32..770d079c44 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -122,7 +122,8 @@ public: class UpdateParameters { public: - UpdateParameters() {} + UpdateParameters(const QString &partialVariable = QString()) : + partialVariable(partialVariable) {} QStringList partialVariables() const { diff --git a/src/plugins/debugger/debuggericons.cpp b/src/plugins/debugger/debuggericons.cpp index e16fd5cd0f..3fc7fd50b9 100644 --- a/src/plugins/debugger/debuggericons.cpp +++ b/src/plugins/debugger/debuggericons.cpp @@ -31,11 +31,11 @@ namespace Debugger { namespace Icons { const Icon BREAKPOINT({ - {":/debugger/images/breakpoint.png", Theme::IconsErrorColor}}, Icon::Tint); + {":/utils/images/filledcircle.png", Theme::IconsErrorColor}}, Icon::Tint); const Icon BREAKPOINT_DISABLED({ {":/debugger/images/breakpoint_disabled.png", Theme::IconsErrorColor}}, Icon::Tint); const Icon BREAKPOINT_PENDING({ - {":/debugger/images/breakpoint.png", Theme::IconsErrorColor}, + {":/utils/images/filledcircle.png", Theme::IconsErrorColor}, {":/debugger/images/breakpoint_pending_overlay.png", Theme::PanelTextColorDark}}, Icon::IconStyleOptions(Icon::Tint | Icon::PunchEdges)); const Icon BREAKPOINTS( ":/debugger/images/debugger_breakpoints.png"); diff --git a/src/plugins/debugger/debuggerkitinformation.cpp b/src/plugins/debugger/debuggerkitinformation.cpp index da20b9170c..6aaaa4074c 100644 --- a/src/plugins/debugger/debuggerkitinformation.cpp +++ b/src/plugins/debugger/debuggerkitinformation.cpp @@ -294,7 +294,7 @@ QList<Task> DebuggerKitInformation::validateDebugger(const Kit *k) if (errors & DebuggerDoesNotMatch) { const QString message = tr("The ABI of the selected debugger does not " "match the toolchain ABI."); - result << Task(Task::Error, message, FileName(), -1, id); + result << Task(Task::Warning, message, FileName(), -1, id); } return result; } diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index 47dc345feb..c31cbff994 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -474,9 +474,13 @@ static DebuggerRunControl *doCreate(DebuggerRunParameters rp, RunConfiguration * if (rp.languages & CppLanguage) { const QList<Task> tasks = DebuggerKitInformation::validateDebugger(kit); if (!tasks.isEmpty()) { - foreach (const Task &t, tasks) + foreach (const Task &t, tasks) { + if (t.type == Task::Warning) + continue; errors->append(t.description); - return 0; + } + if (!errors->isEmpty()) + return 0; } } diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index cdcdb13c55..53f94c4f6b 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -4493,7 +4493,7 @@ void GdbEngine::doUpdateLocals(const UpdateParameters ¶ms) { m_pendingBreakpointRequests = 0; - watchHandler()->notifyUpdateStarted(params.partialVariables()); + watchHandler()->notifyUpdateStarted(params); DebuggerCommand cmd("fetchVariables", Discardable|InUpdateLocals|PythonCommand); watchHandler()->appendFormatRequests(&cmd); diff --git a/src/plugins/debugger/images/breakpoint.png b/src/plugins/debugger/images/breakpoint.png Binary files differdeleted file mode 100644 index 57dc3054c8..0000000000 --- a/src/plugins/debugger/images/breakpoint.png +++ /dev/null diff --git a/src/plugins/debugger/images/breakpoint@2x.png b/src/plugins/debugger/images/breakpoint@2x.png Binary files differdeleted file mode 100644 index d4062c909c..0000000000 --- a/src/plugins/debugger/images/breakpoint@2x.png +++ /dev/null diff --git a/src/plugins/debugger/lldb/lldbengine.cpp b/src/plugins/debugger/lldb/lldbengine.cpp index 0b79fdbb0a..eba04d0ca1 100644 --- a/src/plugins/debugger/lldb/lldbengine.cpp +++ b/src/plugins/debugger/lldb/lldbengine.cpp @@ -796,7 +796,7 @@ void LldbEngine::assignValueInDebugger(WatchItem *, void LldbEngine::doUpdateLocals(const UpdateParameters ¶ms) { - watchHandler()->notifyUpdateStarted(params.partialVariables()); + watchHandler()->notifyUpdateStarted(params); DebuggerCommand cmd("fetchVariables"); watchHandler()->appendFormatRequests(&cmd); diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp index c3aec855a0..83f3fed071 100644 --- a/src/plugins/debugger/qml/qmlengine.cpp +++ b/src/plugins/debugger/qml/qmlengine.cpp @@ -1087,6 +1087,12 @@ void QmlEngine::quitDebugger() shutdownInferior(); } +void QmlEngine::doUpdateLocals(const UpdateParameters ¶ms) +{ + Q_UNUSED(params); + d->updateLocals(); +} + void QmlEngine::disconnected() { showMessage(tr("QML Debugger disconnected."), StatusBar); @@ -2150,7 +2156,7 @@ void QmlEnginePrivate::handleFrame(const QVariantMap &response) StackHandler *stackHandler = engine->stackHandler(); WatchHandler * watchHandler = engine->watchHandler(); - watchHandler->notifyUpdateStarted({"local"}); + watchHandler->notifyUpdateStarted(); const int frameIndex = stackHandler->currentIndex(); if (frameIndex < 0) diff --git a/src/plugins/debugger/qml/qmlengine.h b/src/plugins/debugger/qml/qmlengine.h index 2ce3efd73e..1f6b9c9bbe 100644 --- a/src/plugins/debugger/qml/qmlengine.h +++ b/src/plugins/debugger/qml/qmlengine.h @@ -129,6 +129,8 @@ private: bool hasCapability(unsigned) const override; void quitDebugger() override; + void doUpdateLocals(const UpdateParameters ¶ms) override; + void closeConnection(); void startApplicationLauncher(); void stopApplicationLauncher(); diff --git a/src/plugins/debugger/qml/qmlinspectoragent.cpp b/src/plugins/debugger/qml/qmlinspectoragent.cpp index 30d72c378c..0f430bb45e 100644 --- a/src/plugins/debugger/qml/qmlinspectoragent.cpp +++ b/src/plugins/debugger/qml/qmlinspectoragent.cpp @@ -84,6 +84,8 @@ QmlInspectorAgent::QmlInspectorAgent(QmlEngine *engine, QmlDebugConnection *conn m_debugIdToIname.insert(WatchItem::InvalidId, "inspect"); connect(action(ShowQmlObjectTree), &Utils::SavedAction::valueChanged, this, &QmlInspectorAgent::updateState); + connect(action(SortStructMembers), &Utils::SavedAction::valueChanged, + this, &QmlInspectorAgent::updateState); m_delayQueryTimer.setSingleShot(true); m_delayQueryTimer.setInterval(100); connect(&m_delayQueryTimer, &QTimer::timeout, diff --git a/src/plugins/debugger/registerhandler.cpp b/src/plugins/debugger/registerhandler.cpp index ea914102b0..187a769eaa 100644 --- a/src/plugins/debugger/registerhandler.cpp +++ b/src/plugins/debugger/registerhandler.cpp @@ -748,7 +748,7 @@ bool RegisterHandler::contextMenuEvent(const ItemViewEvent &ev) }; addFormatAction(tr("Hexadecimal"), HexadecimalFormat); - addFormatAction(tr("DecimalFormat"), DecimalFormat); + addFormatAction(tr("Decimal"), DecimalFormat); addFormatAction(tr("Octal"), OctalFormat); addFormatAction(tr("Binary"), BinaryFormat); diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 1b47b7cf95..b0de874251 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -1755,8 +1755,9 @@ QMenu *WatchModel::createFormatMenu(WatchItem *item) const DisplayFormats alternativeFormats = typeFormatList(item); + const QString iname = item->iname; const int typeFormat = theTypeFormats.value(stripForFormat(item->type), AutomaticFormat); - const int individualFormat = theIndividualFormats.value(item->iname, AutomaticFormat); + const int individualFormat = theIndividualFormats.value(iname, AutomaticFormat); auto addBaseChangeAction = [this, menu](const QString &text, int base) { addCheckableAction(menu, text, true, theUnprintableBase == base, [this, base] { @@ -1775,26 +1776,26 @@ QMenu *WatchModel::createFormatMenu(WatchItem *item) const QString spacer = " "; menu->addSeparator(); - addAction(menu, tr("Change Display for Object Named \"%1\":").arg(item->name), false); + addAction(menu, tr("Change Display for Object Named \"%1\":").arg(iname), false); QString msg = (individualFormat == AutomaticFormat && typeFormat != AutomaticFormat) ? tr("Use Format for Type (Currently %1)").arg(nameForFormat(typeFormat)) : QString(tr("Use Display Format Based on Type") + ' '); addCheckableAction(menu, spacer + msg, true, individualFormat == AutomaticFormat, - [this, item] { + [this, iname] { // FIXME: Extend to multi-selection. //const QModelIndexList active = activeRows(); //foreach (const QModelIndex &idx, active) // setModelData(LocalsIndividualFormatRole, AutomaticFormat, idx); - setIndividualFormat(item->iname, AutomaticFormat); + setIndividualFormat(iname, AutomaticFormat); m_engine->updateLocals(); }); for (int format : alternativeFormats) { addCheckableAction(menu, spacer + nameForFormat(format), true, format == individualFormat, - [this, act, format, item] { - setIndividualFormat(item->iname, format); + [this, act, format, iname] { + setIndividualFormat(iname, format); m_engine->updateLocals(); }); } @@ -1803,18 +1804,18 @@ QMenu *WatchModel::createFormatMenu(WatchItem *item) addAction(menu, tr("Change Display for Type \"%1\":").arg(item->type), false); addCheckableAction(menu, spacer + tr("Automatic"), true, typeFormat == AutomaticFormat, - [this, item] { + [this, iname] { //const QModelIndexList active = activeRows(); //foreach (const QModelIndex &idx, active) // setModelData(LocalsTypeFormatRole, AutomaticFormat, idx); - setTypeFormat(item->iname, AutomaticFormat); + setTypeFormat(iname, AutomaticFormat); m_engine->updateLocals(); }); for (int format : alternativeFormats) { addCheckableAction(menu, spacer + nameForFormat(format), true, format == typeFormat, - [this, act, format, item] { - setTypeFormat(item->iname, format); + [this, act, format, iname] { + setTypeFormat(iname, format); m_engine->updateLocals(); }); } @@ -1999,8 +2000,12 @@ void WatchHandler::resetWatchers() loadSessionData(); } -void WatchHandler::notifyUpdateStarted(const QStringList &inames) +void WatchHandler::notifyUpdateStarted(const UpdateParameters &updateParameters) { + QStringList inames = updateParameters.partialVariables(); + if (inames.isEmpty()) + inames.append("local"); + auto marker = [](WatchItem *item) { item->outdated = true; }; if (inames.isEmpty()) { diff --git a/src/plugins/debugger/watchhandler.h b/src/plugins/debugger/watchhandler.h index cf62cf2aed..e47fa012fd 100644 --- a/src/plugins/debugger/watchhandler.h +++ b/src/plugins/debugger/watchhandler.h @@ -26,6 +26,7 @@ #pragma once #include "watchdata.h" +#include "debuggerengine.h" #include <QVector> @@ -111,7 +112,7 @@ public: void resetValueCache(); void resetWatchers(); - void notifyUpdateStarted(const QStringList &inames = {}); + void notifyUpdateStarted(const UpdateParameters &updateParameters = UpdateParameters()); void notifyUpdateFinished(); void reexpandItems(); diff --git a/src/plugins/designer/designer.qbs b/src/plugins/designer/designer.qbs index fe903990cf..b991840f91 100644 --- a/src/plugins/designer/designer.qbs +++ b/src/plugins/designer/designer.qbs @@ -4,7 +4,10 @@ import qbs.FileInfo QtcPlugin { name: "Designer" - Depends { name: "Qt"; submodules: ["widgets", "xml", "printsupport", "designer", "designercomponents"] } + Depends { + name: "Qt" + submodules: ["widgets", "xml", "printsupport", "designer", "designercomponents-private"] + } Depends { name: "CPlusPlus" } Depends { name: "Utils" } diff --git a/src/plugins/git/commitdata.cpp b/src/plugins/git/commitdata.cpp index 3ba792ae50..d48aeb4906 100644 --- a/src/plugins/git/commitdata.cpp +++ b/src/plugins/git/commitdata.cpp @@ -94,6 +94,8 @@ static FileStates stateFor(const QChar &c) return CopiedFile; case 'U': return UnmergedFile; + case 'T': + return TypeChangedFile; case '?': return UntrackedFile; default: @@ -195,27 +197,29 @@ QString CommitData::stateDisplayName(const FileStates &state) { QString resultState; if (state == UntrackedFile) - return QCoreApplication::translate("Git::Internal::CommitData", "untracked"); + return tr("untracked"); if (state & StagedFile) - resultState = QCoreApplication::translate("Git::Internal::CommitData", "staged + "); + resultState = tr("staged + "); if (state & ModifiedFile) - resultState.append(QCoreApplication::translate("Git::Internal::CommitData", "modified")); + resultState.append(tr("modified")); else if (state & AddedFile) - resultState.append(QCoreApplication::translate("Git::Internal::CommitData", "added")); + resultState.append(tr("added")); else if (state & DeletedFile) - resultState.append(QCoreApplication::translate("Git::Internal::CommitData", "deleted")); + resultState.append(tr("deleted")); else if (state & RenamedFile) - resultState.append(QCoreApplication::translate("Git::Internal::CommitData", "renamed")); + resultState.append(tr("renamed")); else if (state & CopiedFile) - resultState.append(QCoreApplication::translate("Git::Internal::CommitData", "copied")); + resultState.append(tr("copied")); + else if (state & TypeChangedFile) + resultState.append(tr("typechange")); if (state & UnmergedUs) { if (state & UnmergedThem) - resultState.append(QCoreApplication::translate("Git::Internal::CommitData", " by both")); + resultState.append(tr(" by both")); else - resultState.append(QCoreApplication::translate("Git::Internal::CommitData", " by us")); + resultState.append(tr(" by us")); } else if (state & UnmergedThem) { - resultState.append(QCoreApplication::translate("Git::Internal::CommitData", " by them")); + resultState.append(tr(" by them")); } return resultState; } diff --git a/src/plugins/git/commitdata.h b/src/plugins/git/commitdata.h index e9ad1abdc6..06eeedf336 100644 --- a/src/plugins/git/commitdata.h +++ b/src/plugins/git/commitdata.h @@ -27,6 +27,7 @@ #include "gitsettings.h" // CommitType +#include <QCoreApplication> #include <QStringList> #include <QPair> @@ -71,6 +72,7 @@ enum FileState { RenamedFile = 0x10, CopiedFile = 0x20, UnmergedFile = 0x40, + TypeChangedFile = 0x80, UnmergedUs = 0x100, UnmergedThem = 0x200, @@ -82,6 +84,8 @@ Q_DECLARE_FLAGS(FileStates, FileState) class CommitData { + Q_DECLARE_TR_FUNCTIONS(Git::Internal::CommitData) + public: CommitData(CommitType type = SimpleCommit); // A pair of state string/file name ('modified', 'file.cpp'). diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 4b25cecf62..3ab1733a05 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -2477,7 +2477,7 @@ bool GitClient::addAndCommit(const QString &repositoryDirectory, filesToAdd.append(file); if ((state & StagedFile) && !checked) { - if (state & (ModifiedFile | AddedFile | DeletedFile)) { + if (state & (ModifiedFile | AddedFile | DeletedFile | TypeChangedFile)) { filesToReset.append(file); } else if (state & (RenamedFile | CopiedFile)) { const QString newFile = file.mid(file.indexOf(renameSeparator) + renameSeparator.count()); @@ -2487,7 +2487,7 @@ bool GitClient::addAndCommit(const QString &repositoryDirectory, QTC_ASSERT(false, continue); // There should not be unmerged files when committing! } - if (state == ModifiedFile && checked) { + if ((state == ModifiedFile || state == TypeChangedFile) && checked) { filesToReset.removeAll(file); filesToAdd.append(file); } else if (state == AddedFile && checked) { @@ -2703,7 +2703,8 @@ void GitClient::synchronousAbortCommand(const QString &workingDir, const QString } const SynchronousProcessResponse resp = vcsFullySynchronousExec( - workingDir, { abortCommand, "--abort" }, VcsCommand::ExpectRepoChanges); + workingDir, { abortCommand, "--abort" }, + VcsCommand::ExpectRepoChanges | VcsCommand::ShowSuccessMessage); VcsOutputWindow::append(resp.stdOut()); } diff --git a/src/plugins/git/gitgrep.cpp b/src/plugins/git/gitgrep.cpp index 496e6c3490..05060f413b 100644 --- a/src/plugins/git/gitgrep.cpp +++ b/src/plugins/git/gitgrep.cpp @@ -112,6 +112,15 @@ public: + text.mid(matchEnd + resetColor.size()); } single.matchingLine = text; + + if (m_parameters.flags & FindRegularExpression) { + const QRegularExpression::PatternOptions patternOptions = + (m_parameters.flags & QTextDocument::FindCaseSensitively) + ? QRegularExpression::NoPatternOption : QRegularExpression::CaseInsensitiveOption; + QRegularExpression regexp(m_parameters.text, patternOptions); + QRegularExpressionMatch regexpMatch = regexp.match(line); + single.regexpCapturedTexts = regexpMatch.capturedTexts(); + } foreach (auto match, matches) { single.matchStart = match.first; single.matchLength = match.second; diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 98c94260b3..9049828235 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -1396,6 +1396,10 @@ void GitPlugin::testStatusParsing_data() QTest::newRow(" M") << FileStates(ModifiedFile) << FileStates(UnknownFileState); QTest::newRow(" D") << FileStates(DeletedFile) << FileStates(UnknownFileState); + QTest::newRow(" T") << FileStates(TypeChangedFile) << FileStates(UnknownFileState); + QTest::newRow("T ") << (TypeChangedFile | StagedFile) << FileStates(UnknownFileState); + QTest::newRow("TM") << (TypeChangedFile | StagedFile) << FileStates(ModifiedFile); + QTest::newRow("MT") << (ModifiedFile | StagedFile) << FileStates(TypeChangedFile); QTest::newRow("M ") << (ModifiedFile | StagedFile) << FileStates(UnknownFileState); QTest::newRow("MM") << (ModifiedFile | StagedFile) << FileStates(ModifiedFile); QTest::newRow("MD") << (ModifiedFile | StagedFile) << FileStates(DeletedFile); diff --git a/src/plugins/git/gitsubmiteditor.cpp b/src/plugins/git/gitsubmiteditor.cpp index c43065e24b..5ac2fbdd83 100644 --- a/src/plugins/git/gitsubmiteditor.cpp +++ b/src/plugins/git/gitsubmiteditor.cpp @@ -146,7 +146,7 @@ void GitSubmitEditor::setCommitData(const CommitData &d) return SubmitFileModel::FileUnmerged; if (state.testFlag(AddedFile) || state.testFlag(UntrackedFile)) return SubmitFileModel::FileAdded; - if (state.testFlag(ModifiedFile)) + if (state.testFlag(ModifiedFile) || state.testFlag(TypeChangedFile)) return SubmitFileModel::FileModified; if (state.testFlag(DeletedFile)) return SubmitFileModel::FileDeleted; diff --git a/src/plugins/git/logchangedialog.cpp b/src/plugins/git/logchangedialog.cpp index 301c6ac903..e529ca2246 100644 --- a/src/plugins/git/logchangedialog.cpp +++ b/src/plugins/git/logchangedialog.cpp @@ -157,6 +157,7 @@ bool LogChangeWidget::populateLog(const QString &repository, const QString &comm arguments << (commit.isEmpty() ? "HEAD" : commit); if (!(flags & IncludeRemotes)) arguments << "--not" << "--remotes"; + arguments << "--"; QString output; if (!GitPlugin::client()->synchronousLog(repository, arguments, &output, 0, VcsCommand::NoOutput)) return false; diff --git a/src/plugins/git/mergetool.cpp b/src/plugins/git/mergetool.cpp index 75d2f330b3..f25b9fd2d9 100644 --- a/src/plugins/git/mergetool.cpp +++ b/src/plugins/git/mergetool.cpp @@ -200,26 +200,39 @@ void MergeTool::prompt(const QString &title, const QString &question) void MergeTool::readData() { + bool waitForFurtherInput = false; while (m_process->bytesAvailable()) { - QByteArray line = m_process->canReadLine() ? m_process->readLine() : m_process->readAllStandardOutput(); + const bool hasLine = m_process->canReadLine(); + const QByteArray line = hasLine ? m_process->readLine() : m_process->readAllStandardOutput(); VcsOutputWindow::append(QString::fromLocal8Bit(line)); + m_line += line; // {Normal|Deleted|Submodule|Symbolic link} merge conflict for 'foo.cpp' - int index = line.indexOf(" merge conflict for "); + const int index = m_line.indexOf(" merge conflict for "); if (index != -1) { - m_mergeType = mergeType(line.left(index)); - int quote = line.indexOf('\''); - m_fileName = QString::fromLocal8Bit(line.mid(quote + 1, line.lastIndexOf('\'') - quote - 1)); - } else if (line.startsWith(" {local}")) { - m_localState = parseStatus(line, m_localInfo); - } else if (line.startsWith(" {remote}")) { - m_remoteState = parseStatus(line, m_remoteInfo); + m_mergeType = mergeType(m_line.left(index)); + int quote = m_line.indexOf('\''); + m_fileName = QString::fromLocal8Bit(m_line.mid(quote + 1, m_line.lastIndexOf('\'') - quote - 1)); + } else if (m_line.startsWith(" {local}")) { + waitForFurtherInput = !hasLine; + if (waitForFurtherInput) + continue; + m_localState = parseStatus(m_line, m_localInfo); + m_line.clear(); + } else if (m_line.startsWith(" {remote}")) { + waitForFurtherInput = !hasLine; + if (waitForFurtherInput) + continue; + m_remoteState = parseStatus(m_line, m_remoteInfo); + m_line.clear(); chooseAction(); - } else if (line.startsWith("Was the merge successful")) { + } else if (m_line.startsWith("Was the merge successful")) { prompt(tr("Unchanged File"), tr("Was the merge successful?")); - } else if (line.startsWith("Continue merging")) { + } else if (m_line.startsWith("Continue merging")) { prompt(tr("Continue Merging"), tr("Continue merging other unresolved paths?")); } } + if (!waitForFurtherInput) + m_line.clear(); } void MergeTool::done() diff --git a/src/plugins/git/mergetool.h b/src/plugins/git/mergetool.h index 7217d473f8..f905cf25a0 100644 --- a/src/plugins/git/mergetool.h +++ b/src/plugins/git/mergetool.h @@ -82,6 +82,7 @@ private: QString m_localInfo; FileState m_remoteState = UnknownState; QString m_remoteInfo; + QByteArray m_line; bool m_merging = false; }; diff --git a/src/plugins/ios/iosrunner.cpp b/src/plugins/ios/iosrunner.cpp index 20fbd794be..c8ece1871b 100644 --- a/src/plugins/ios/iosrunner.cpp +++ b/src/plugins/ios/iosrunner.cpp @@ -58,7 +58,7 @@ IosRunner::IosRunner(QObject *parent, IosRunConfiguration *runConfig, bool cppDe m_arguments(runConfig->commandLineArguments()), m_device(DeviceKitInformation::device(runConfig->target()->kit())), m_cppDebug(cppDebug), m_qmlDebugServices(qmlDebugServices), m_cleanExit(false), - m_qmlPort(0), m_pid(0) + m_pid(0) { m_deviceType = runConfig->deviceType(); } diff --git a/src/plugins/modeleditor/modeleditor.cpp b/src/plugins/modeleditor/modeleditor.cpp index f0fd3de9e8..ea30818f5a 100644 --- a/src/plugins/modeleditor/modeleditor.cpp +++ b/src/plugins/modeleditor/modeleditor.cpp @@ -341,13 +341,13 @@ void ModelEditor::init(QWidget *parent) syncToggleButton->setDefaultAction(d->actionHandler->synchronizeBrowserAction()); QMenu *syncMenu = new QMenu(syncToggleButton); QActionGroup *syncGroup = new QActionGroup(syncMenu); - d->syncBrowserWithDiagramAction = syncMenu->addAction(QStringLiteral("Synchronize Browser with Diagram")); + d->syncBrowserWithDiagramAction = syncMenu->addAction(QStringLiteral("Synchronize Structure with Diagram")); d->syncBrowserWithDiagramAction->setCheckable(true); d->syncBrowserWithDiagramAction->setActionGroup(syncGroup); - d->syncDiagramWithBrowserAction = syncMenu->addAction(QStringLiteral("Synchronize Diagram with Browser")); + d->syncDiagramWithBrowserAction = syncMenu->addAction(QStringLiteral("Synchronize Diagram with Structure")); d->syncDiagramWithBrowserAction->setCheckable(true); d->syncDiagramWithBrowserAction->setActionGroup(syncGroup); - d->syncEachOtherAction = syncMenu->addAction(QStringLiteral("Synchronize Each Other")); + d->syncEachOtherAction = syncMenu->addAction(QStringLiteral("Keep Synchronized")); d->syncEachOtherAction->setCheckable(true); d->syncEachOtherAction->setActionGroup(syncGroup); syncToggleButton->setMenu(syncMenu); diff --git a/src/plugins/nim/Nim.mimetypes.xml b/src/plugins/nim/Nim.mimetypes.xml index 3e06d398fd..f7e94aa3dd 100644 --- a/src/plugins/nim/Nim.mimetypes.xml +++ b/src/plugins/nim/Nim.mimetypes.xml @@ -12,4 +12,10 @@ <comment>Nim source file </comment> <glob pattern="*.nim"/> </mime-type> + + <mime-type type="text/x-nim-script"> + <sub-class-of type="text/plain"/> + <comment>Nim script file </comment> + <glob pattern="*.nims"/> + </mime-type> </mime-info> diff --git a/src/plugins/nim/editor/nimeditorfactory.cpp b/src/plugins/nim/editor/nimeditorfactory.cpp index 32e23d0eeb..8e733b2adb 100644 --- a/src/plugins/nim/editor/nimeditorfactory.cpp +++ b/src/plugins/nim/editor/nimeditorfactory.cpp @@ -45,6 +45,7 @@ NimEditorFactory::NimEditorFactory() setId(Constants::C_NIMEDITOR_ID); setDisplayName(tr(Nim::Constants::C_EDITOR_DISPLAY_NAME)); addMimeType(QLatin1String(Nim::Constants::C_NIM_MIMETYPE)); + addMimeType(QLatin1String(Nim::Constants::C_NIM_SCRIPT_MIMETYPE)); setEditorActionHandlers(TextEditorActionHandler::Format | TextEditorActionHandler::UnCommentSelection diff --git a/src/plugins/nim/nimconstants.h b/src/plugins/nim/nimconstants.h index 7f2dc90d8e..65fbeb611f 100644 --- a/src/plugins/nim/nimconstants.h +++ b/src/plugins/nim/nimconstants.h @@ -104,6 +104,7 @@ const char C_NIMCODESTYLEPREVIEWSNIPPET[] = * MIME type ******************************************************************************/ const char C_NIM_MIMETYPE[] = "text/x-nim"; +const char C_NIM_SCRIPT_MIMETYPE[] = "text/x-nim-script"; const char C_NIM_MIME_ICON[] = "text-x-nim"; const char C_NIM_PROJECT_MIMETYPE[] = "text/x-nim-project"; diff --git a/src/plugins/nim/nimplugin.cpp b/src/plugins/nim/nimplugin.cpp index b89676e0eb..98760d7b6e 100644 --- a/src/plugins/nim/nimplugin.cpp +++ b/src/plugins/nim/nimplugin.cpp @@ -81,8 +81,10 @@ bool NimPlugin::initialize(const QStringList &arguments, QString *errorMessage) // Add MIME overlay icons (these icons displayed at Project dock panel) const QIcon icon((QLatin1String(Constants::C_NIM_ICON_PATH))); - if (!icon.isNull()) + if (!icon.isNull()) { Core::FileIconProvider::registerIconOverlayForMimeType(icon, Constants::C_NIM_MIMETYPE); + Core::FileIconProvider::registerIconOverlayForMimeType(icon, Constants::C_NIM_SCRIPT_MIMETYPE); + } return true; } diff --git a/src/plugins/nim/settings/nimsettings.cpp b/src/plugins/nim/settings/nimsettings.cpp index 40ac7b74a2..cd43df4849 100644 --- a/src/plugins/nim/settings/nimsettings.cpp +++ b/src/plugins/nim/settings/nimsettings.cpp @@ -80,6 +80,7 @@ NimSettings::NimSettings(QObject *parent) m_globalCodeStyle->fromSettings(QLatin1String(Nim::Constants::C_NIMLANGUAGE_ID), s); TextEditorSettings::registerMimeTypeForLanguageId(Nim::Constants::C_NIM_MIMETYPE, Nim::Constants::C_NIMLANGUAGE_ID); + TextEditorSettings::registerMimeTypeForLanguageId(Nim::Constants::C_NIM_SCRIPT_MIMETYPE, Nim::Constants::C_NIMLANGUAGE_ID); } NimSettings::~NimSettings() diff --git a/src/plugins/projectexplorer/abstractmsvctoolchain.cpp b/src/plugins/projectexplorer/abstractmsvctoolchain.cpp index 50a7b8ba65..cb056cd938 100644 --- a/src/plugins/projectexplorer/abstractmsvctoolchain.cpp +++ b/src/plugins/projectexplorer/abstractmsvctoolchain.cpp @@ -35,6 +35,7 @@ #include <QDir> #include <QTemporaryFile> +#include <QTextCodec> enum { debug = 0 }; @@ -269,6 +270,7 @@ bool AbstractMsvcToolChain::generateEnvironmentSettings(Utils::Environment &env, call += ' '; call += batchArgs.toLocal8Bit(); } + saver.write("chcp 65001\r\n"); saver.write(call + "\r\n"); saver.write("@echo " + marker.toLocal8Bit() + "\r\n"); saver.write("set\r\n"); @@ -295,6 +297,7 @@ bool AbstractMsvcToolChain::generateEnvironmentSettings(Utils::Environment &env, if (debug) qDebug() << "readEnvironmentSetting: " << call << cmdPath << cmdArguments.join(' ') << " Env: " << env.size(); + run.setCodec(QTextCodec::codecForName("UTF-8")); Utils::SynchronousProcessResponse response = run.runBlocking(cmdPath.toString(), cmdArguments); if (response.result != Utils::SynchronousProcessResponse::Finished) { qWarning() << response.exitMessage(cmdPath.toString(), 10); diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 8af46fc50e..4e53fc1087 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -267,6 +267,7 @@ public: void startupProjectChanged(); // Calls updateRunAction void activeTargetChanged(); void activeRunConfigurationChanged(); + void activeBuildConfigurationChanged(); void slotUpdateRunActions(); @@ -2629,13 +2630,18 @@ void ProjectExplorerPluginPrivate::activeTargetChanged() if (previousTarget) { disconnect(previousTarget.data(), &Target::activeRunConfigurationChanged, this, &ProjectExplorerPluginPrivate::activeRunConfigurationChanged); + disconnect(previousTarget.data(), &Target::activeBuildConfigurationChanged, + this, &ProjectExplorerPluginPrivate::activeBuildConfigurationChanged); } previousTarget = target; if (target) { connect(target, &Target::activeRunConfigurationChanged, this, &ProjectExplorerPluginPrivate::activeRunConfigurationChanged); + connect(previousTarget.data(), &Target::activeBuildConfigurationChanged, + this, &ProjectExplorerPluginPrivate::activeBuildConfigurationChanged); } + activeBuildConfigurationChanged(); activeRunConfigurationChanged(); updateDeployActions(); } @@ -2661,6 +2667,27 @@ void ProjectExplorerPluginPrivate::activeRunConfigurationChanged() emit m_instance->updateRunActions(); } +void ProjectExplorerPluginPrivate::activeBuildConfigurationChanged() +{ + static QPointer<BuildConfiguration> previousBuildConfiguration = nullptr; + BuildConfiguration *bc = nullptr; + Project *startupProject = SessionManager::startupProject(); + if (startupProject && startupProject->activeTarget()) + bc = startupProject->activeTarget()->activeBuildConfiguration(); + if (bc == previousBuildConfiguration) + return; + if (previousBuildConfiguration) { + disconnect(previousBuildConfiguration.data(), &BuildConfiguration::enabledChanged, + m_instance, &ProjectExplorerPlugin::updateRunActions); + } + previousBuildConfiguration = bc; + if (bc) { + connect(bc, &BuildConfiguration::enabledChanged, + m_instance, &ProjectExplorerPlugin::updateRunActions); + } + emit m_instance->updateRunActions(); +} + void ProjectExplorerPluginPrivate::updateDeployActions() { Project *project = SessionManager::startupProject(); diff --git a/src/plugins/projectexplorer/projectexplorericons.cpp b/src/plugins/projectexplorer/projectexplorericons.cpp index 7ae3a28128..e86fe915bc 100644 --- a/src/plugins/projectexplorer/projectexplorericons.cpp +++ b/src/plugins/projectexplorer/projectexplorericons.cpp @@ -44,10 +44,16 @@ const Icon RUN_FLAT({ const Icon WINDOW(":/projectexplorer/images/window.png"); const Icon DEBUG_START(":/projectexplorer/images/debugger_start.png"); const Icon DEVICE_READY_INDICATOR({ + {":/utils/images/filledcircle.png", Theme::IconsRunColor}}, Icon::Tint); +const Icon DEVICE_READY_INDICATOR_OVERLAY({ {":/projectexplorer/images/devicestatusindicator.png", Theme::IconsRunToolBarColor}}); const Icon DEVICE_CONNECTED_INDICATOR({ + {":/utils/images/filledcircle.png", Theme::IconsWarningColor}}, Icon::Tint); +const Icon DEVICE_CONNECTED_INDICATOR_OVERLAY({ {":/projectexplorer/images/devicestatusindicator.png", Theme::IconsWarningToolBarColor}}); const Icon DEVICE_DISCONNECTED_INDICATOR({ + {":/utils/images/filledcircle.png", Theme::IconsStopColor}}, Icon::Tint); +const Icon DEVICE_DISCONNECTED_INDICATOR_OVERLAY({ {":/projectexplorer/images/devicestatusindicator.png", Theme::IconsStopToolBarColor}}); const Icon DEBUG_START_FLAT({ diff --git a/src/plugins/projectexplorer/projectexplorericons.h b/src/plugins/projectexplorer/projectexplorericons.h index 7b14ea97fb..fbef189663 100644 --- a/src/plugins/projectexplorer/projectexplorericons.h +++ b/src/plugins/projectexplorer/projectexplorericons.h @@ -41,8 +41,11 @@ PROJECTEXPLORER_EXPORT extern const Utils::Icon RUN_FLAT; PROJECTEXPLORER_EXPORT extern const Utils::Icon WINDOW; PROJECTEXPLORER_EXPORT extern const Utils::Icon DEBUG_START; PROJECTEXPLORER_EXPORT extern const Utils::Icon DEVICE_READY_INDICATOR; +PROJECTEXPLORER_EXPORT extern const Utils::Icon DEVICE_READY_INDICATOR_OVERLAY; PROJECTEXPLORER_EXPORT extern const Utils::Icon DEVICE_CONNECTED_INDICATOR; +PROJECTEXPLORER_EXPORT extern const Utils::Icon DEVICE_CONNECTED_INDICATOR_OVERLAY; PROJECTEXPLORER_EXPORT extern const Utils::Icon DEVICE_DISCONNECTED_INDICATOR; +PROJECTEXPLORER_EXPORT extern const Utils::Icon DEVICE_DISCONNECTED_INDICATOR_OVERLAY; PROJECTEXPLORER_EXPORT extern const Utils::Icon DEBUG_START_FLAT; PROJECTEXPLORER_EXPORT extern const Utils::Icon DEBUG_START_SMALL; diff --git a/src/plugins/projectexplorer/projectwindow.cpp b/src/plugins/projectexplorer/projectwindow.cpp index 6dea76edd8..328f259190 100644 --- a/src/plugins/projectexplorer/projectwindow.cpp +++ b/src/plugins/projectexplorer/projectwindow.cpp @@ -347,7 +347,7 @@ public: QVariant data(int column, int role) const final { - return m_projectItem->data(column, role); + return m_projectItem ? m_projectItem->data(column, role) : QVariant(); } ProjectItem *m_projectItem; @@ -413,6 +413,7 @@ public: if (item->m_projectItem->parent()) m_projectsModel.takeItem(item->m_projectItem); delete item->m_projectItem; + item->m_projectItem = nullptr; m_comboBoxModel.destroyItem(item); } @@ -466,9 +467,9 @@ public: if (!menu.actions().isEmpty()) menu.addSeparator(); - QAction *importBuild = menu.addAction(tr("Import Existing Build...")); + QAction *importBuild = menu.addAction(ProjectWindow::tr("Import Existing Build...")); importBuild->setEnabled(projectImporter != 0); - QAction *manageKits = menu.addAction(tr("Manage Kits...")); + QAction *manageKits = menu.addAction(ProjectWindow::tr("Manage Kits...")); QAction *act = menu.exec(m_selectorTree->mapToGlobal(pos)); diff --git a/src/plugins/projectexplorer/target.cpp b/src/plugins/projectexplorer/target.cpp index ec86c680b8..1a45c8db4b 100644 --- a/src/plugins/projectexplorer/target.cpp +++ b/src/plugins/projectexplorer/target.cpp @@ -723,7 +723,7 @@ void Target::updateDeviceState() IDevice::ConstPtr current = DeviceKitInformation::device(kit()); QIcon overlay; - static const QIcon disconnected = Icons::DEVICE_DISCONNECTED_INDICATOR.icon(); + static const QIcon disconnected = Icons::DEVICE_DISCONNECTED_INDICATOR_OVERLAY.icon(); if (current.isNull()) { overlay = disconnected; } else { @@ -733,12 +733,12 @@ void Target::updateDeviceState() setToolTip(QString()); return; case IDevice::DeviceReadyToUse: { - static const QIcon ready = Icons::DEVICE_READY_INDICATOR.icon(); + static const QIcon ready = Icons::DEVICE_READY_INDICATOR_OVERLAY.icon(); overlay = ready; break; } case IDevice::DeviceConnected: { - static const QIcon connected = Icons::DEVICE_CONNECTED_INDICATOR.icon(); + static const QIcon connected = Icons::DEVICE_CONNECTED_INDICATOR_OVERLAY.icon(); overlay = connected; break; } diff --git a/src/plugins/pythoneditor/pythoneditorplugin.cpp b/src/plugins/pythoneditor/pythoneditorplugin.cpp index aabe26c719..60ed1a9d7f 100644 --- a/src/plugins/pythoneditor/pythoneditorplugin.cpp +++ b/src/plugins/pythoneditor/pythoneditorplugin.cpp @@ -905,13 +905,16 @@ bool PythonEditorPlugin::initialize(const QStringList &arguments, QString *error addAutoReleasedObject(new PythonRunConfigurationFactory); addAutoReleasedObject(new PythonRunControlFactory); + return true; +} + +void PythonEditorPlugin::extensionsInitialized() +{ // Initialize editor actions handler // Add MIME overlay icons (these icons displayed at Project dock panel) const QIcon icon = QIcon::fromTheme(C_PY_MIME_ICON); if (!icon.isNull()) Core::FileIconProvider::registerIconOverlayForMimeType(icon, C_PY_MIMETYPE); - - return true; } } // namespace Internal diff --git a/src/plugins/pythoneditor/pythoneditorplugin.h b/src/plugins/pythoneditor/pythoneditorplugin.h index 9e5750b7bb..7c71142c25 100644 --- a/src/plugins/pythoneditor/pythoneditorplugin.h +++ b/src/plugins/pythoneditor/pythoneditorplugin.h @@ -40,7 +40,7 @@ public: ~PythonEditorPlugin() override; bool initialize(const QStringList &arguments, QString *errorMessage) override; - void extensionsInitialized() override {} + void extensionsInitialized() override; }; } // namespace Internal diff --git a/src/plugins/qbsprojectmanager/customqbspropertiesdialog.cpp b/src/plugins/qbsprojectmanager/customqbspropertiesdialog.cpp index 649ca97856..e78308514c 100644 --- a/src/plugins/qbsprojectmanager/customqbspropertiesdialog.cpp +++ b/src/plugins/qbsprojectmanager/customqbspropertiesdialog.cpp @@ -26,6 +26,8 @@ #include "customqbspropertiesdialog.h" #include "ui_customqbspropertiesdialog.h" +#include <qbs.h> + #include <utils/algorithm.h> #include <utils/qtcassert.h> @@ -47,7 +49,7 @@ CustomQbsPropertiesDialog::CustomQbsPropertiesDialog(const QVariantMap &properti nameItem->setData(Qt::DisplayRole, it.key()); m_ui->propertiesTable->setItem(currentRow, 0, nameItem); QTableWidgetItem * const valueItem = new QTableWidgetItem; - valueItem->setData(Qt::DisplayRole, it.value()); + valueItem->setData(Qt::DisplayRole, qbs::settingsValueToRepresentation(it.value())); m_ui->propertiesTable->setItem(currentRow, 1, valueItem); ++currentRow; } @@ -68,7 +70,8 @@ QVariantMap CustomQbsPropertiesDialog::properties() const const QString name = nameItem->text(); if (name.isEmpty()) continue; - properties.insert(name, m_ui->propertiesTable->item(row, 1)->text()); + const QString rawString = m_ui->propertiesTable->item(row, 1)->text(); + properties.insert(name, qbs::representationToSettingsValue(rawString)); } return properties; } diff --git a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp index 56090e59c7..5517c3f8eb 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp +++ b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp @@ -211,8 +211,11 @@ QVariantMap QbsBuildStep::qbsConfiguration(VariableHandling variableHandling) co config.insert(QLatin1String(Constants::QBS_FORCE_PROBES_KEY), m_forceProbes); if (variableHandling == ExpandVariables) { const Utils::MacroExpander *expander = Utils::globalMacroExpander(); - for (auto it = config.begin(), end = config.end(); it != end; ++it) - it.value() = expander->expand(it.value().toString()); + for (auto it = config.begin(), end = config.end(); it != end; ++it) { + const QString rawString = it.value().toString(); + const QString expandedString = expander->expand(rawString); + it.value() = qbs::representationToSettingsValue(expandedString); + } } return config; } diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp index 002fbdaba7..3e4b43f581 100644 --- a/src/plugins/qbsprojectmanager/qbsproject.cpp +++ b/src/plugins/qbsprojectmanager/qbsproject.cpp @@ -252,7 +252,7 @@ bool QbsProject::ensureWriteableQbsFile(const QString &file) bool makeWritable = QFile::setPermissions(file, fi.permissions() | QFile::WriteUser); if (!makeWritable) { QMessageBox::warning(ICore::mainWindow(), - tr("Failed!"), + tr("Failed"), tr("Could not write project file %1.").arg(file)); return false; } @@ -774,6 +774,89 @@ static QString groupLocationToProjectFile(const qbs::CodeLocation &location) .arg(location.column()); } +// TODO: Receive the values from qbs when QBS-1030 is resolved. +static void getExpandedCompilerFlags(QStringList &cFlags, QStringList &cxxFlags, + const qbs::PropertyMap &properties) +{ + const auto getCppProp = [properties](const char *propertyName) { + return properties.getModuleProperty("cpp", QLatin1String(propertyName)); + }; + const QVariant &enableExceptions = getCppProp("enableExceptions"); + const QVariant &enableRtti = getCppProp("enableRtti"); + QStringList commonFlags = getCppProp("platformCommonCompilerFlags").toStringList(); + commonFlags << getCppProp("commonCompilerFlags").toStringList() + << getCppProp("platformDriverFlags").toStringList() + << getCppProp("driverFlags").toStringList(); + const QStringList toolchain = properties.getModulePropertiesAsStringList("qbs", "toolchain"); + if (toolchain.contains("gcc")) { + bool hasTargetOption = false; + if (toolchain.contains("clang")) { + const int majorVersion = getCppProp("compilerVersionMajor").toInt(); + const int minorVersion = getCppProp("compilerVersionMinor").toInt(); + if (majorVersion > 3 || (majorVersion == 3 && minorVersion >= 1)) + hasTargetOption = true; + } + if (hasTargetOption) { + commonFlags << "-target" << getCppProp("target").toString(); + } else { + const QString targetArch = getCppProp("targetArch").toString(); + if (targetArch == "x86_64") + commonFlags << "-m64"; + else if (targetArch == "i386") + commonFlags << "-m32"; + const QString machineType = getCppProp("machineType").toString(); + if (!machineType.isEmpty()) + commonFlags << ("-march=" + machineType); + } + const QStringList targetOS = properties.getModulePropertiesAsStringList( + "qbs", "targetOS"); + if (targetOS.contains("unix")) { + const QVariant positionIndependentCode = getCppProp("positionIndependentCode"); + if (!positionIndependentCode.isValid() || positionIndependentCode.toBool()) + commonFlags << "-fPIC"; + } + cFlags = cxxFlags = commonFlags; + + const QString cxxLanguageVersion = getCppProp("cxxLanguageVersion").toString(); + if (cxxLanguageVersion == "c++11") + cxxFlags << "-std=c++0x"; + else if (cxxLanguageVersion == "c++14") + cxxFlags << "-std=c++1y"; + else if (!cxxLanguageVersion.isEmpty()) + cxxFlags << ("-std=" + cxxLanguageVersion); + const QString cxxStandardLibrary = getCppProp("cxxStandardLibrary").toString(); + if (!cxxStandardLibrary.isEmpty() && toolchain.contains("clang")) + cxxFlags << ("-stdlib=" + cxxStandardLibrary); + if (enableExceptions.isValid()) { + cxxFlags << QLatin1String(enableExceptions.toBool() + ? "-fexceptions" : "-fno-exceptions"); + } + if (enableRtti.isValid()) + cxxFlags << QLatin1String(enableRtti.toBool() ? "-frtti" : "-fno-rtti"); + + const QString cLanguageVersion = getCppProp("cLanguageVersion").toString(); + if (cLanguageVersion == "c11") + cFlags << "-std=c1x"; + else if (!cLanguageVersion.isEmpty()) + cFlags << ("-std=" + cLanguageVersion); + } else if (toolchain.contains("msvc")) { + if (enableExceptions.toBool()) { + const QString exceptionModel = getCppProp("exceptionHandlingModel").toString(); + if (exceptionModel == "default") + commonFlags << "/EHsc"; + else if (exceptionModel == "seh") + commonFlags << "/EHa"; + else if (exceptionModel == "externc") + commonFlags << "/EHs"; + } + cFlags = cxxFlags = commonFlags; + cFlags << "/TC"; + cxxFlags << "/TP"; + if (enableRtti.isValid()) + cxxFlags << QLatin1String(enableRtti.toBool() ? "/GR" : "/GR-"); + } +} + void QbsProject::updateCppCodeModel() { if (!m_projectData.isValid()) @@ -806,12 +889,11 @@ void QbsProject::updateCppCodeModel() foreach (const qbs::GroupData &grp, prd.groups()) { const qbs::PropertyMap &props = grp.properties(); - ppBuilder.setCxxFlags(props.getModulePropertiesAsStringList( - QLatin1String(CONFIG_CPP_MODULE), - QLatin1String(CONFIG_CXXFLAGS))); - ppBuilder.setCFlags(props.getModulePropertiesAsStringList( - QLatin1String(CONFIG_CPP_MODULE), - QLatin1String(CONFIG_CFLAGS))); + QStringList cFlags; + QStringList cxxFlags; + getExpandedCompilerFlags(cFlags, cxxFlags, props); + ppBuilder.setCxxFlags(cxxFlags); + ppBuilder.setCFlags(cFlags); QStringList list = props.getModulePropertiesAsStringList( QLatin1String(CONFIG_CPP_MODULE), diff --git a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp index ed3dfec658..3c6e6bd828 100644 --- a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp +++ b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp @@ -125,8 +125,8 @@ void DesktopQmakeRunConfiguration::proFileUpdated(QmakeProFileNode *pro, bool su { if (m_proFilePath != pro->filePath()) return; - bool enabled = isEnabled(); - QString reason = disabledReason(); + const bool enabled = isEnabled(); + const QString reason = disabledReason(); m_parseSuccess = success; m_parseInProgress = parseInProgress; if (enabled != isEnabled() || reason != disabledReason()) diff --git a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.h b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.h index 2f534ca888..120a375806 100644 --- a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.h +++ b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.h @@ -137,7 +137,7 @@ private: LastKitState m_lastKitState; bool m_shadowBuild = true; - bool m_isEnabled = false; + bool m_isEnabled = true; QtSupport::BaseQtVersion::QmakeBuildConfigs m_qmakeBuildConfiguration = 0; QmakeProjectManager::QmakeProFileNode *m_subNodeBuild = nullptr; ProjectExplorer::FileNode *m_fileNodeBuild = nullptr; diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.cpp b/src/plugins/qmakeprojectmanager/qmakenodes.cpp index 7f694cb336..0881b6313a 100644 --- a/src/plugins/qmakeprojectmanager/qmakenodes.cpp +++ b/src/plugins/qmakeprojectmanager/qmakenodes.cpp @@ -1322,8 +1322,6 @@ void QmakePriFileNode::save(const QStringList &lines) FileSaver saver(m_projectFilePath.toString(), QIODevice::Text); saver.write(lines.join(QLatin1Char('\n')).toLocal8Bit()); saver.finalize(Core::ICore::mainWindow()); - - m_project->projectManager()->notifyChanged(m_projectFilePath); } // This is a hack. @@ -1673,16 +1671,6 @@ QString QmakeProFileNode::singleVariableValue(const QmakeVariable var) const return values.isEmpty() ? QString() : values.first(); } -void QmakeProFileNode::emitProFileUpdatedRecursive() -{ - emit m_project->proFileUpdated(this, m_validParse, m_parseInProgress); - - foreach (ProjectNode *subNode, projectNodes()) { - if (QmakeProFileNode *node = dynamic_cast<QmakeProFileNode *>(subNode)) - node->emitProFileUpdatedRecursive(); - } -} - void QmakeProFileNode::setParseInProgressRecursive(bool b) { setParseInProgress(b); @@ -2169,6 +2157,7 @@ void QmakeProFileNode::applyEvaluate(EvalResult *evalResult) qmakeProFileNode->setIncludedInExactParse( result->exactSubdirs.contains(qmakeProFileNode->filePath()) && pn->includedInExactParse()); + qmakeProFileNode->setParseInProgress(true); qmakeProFileNode->asyncUpdate(); toAdd << qmakeProFileNode; } diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.h b/src/plugins/qmakeprojectmanager/qmakenodes.h index 01228a8f9f..3df8d04f5a 100644 --- a/src/plugins/qmakeprojectmanager/qmakenodes.h +++ b/src/plugins/qmakeprojectmanager/qmakenodes.h @@ -364,7 +364,6 @@ public: void setParseInProgressRecursive(bool b); void setValidParse(bool b); void setValidParseRecursive(bool b); - void emitProFileUpdatedRecursive(); void asyncUpdate(); @@ -401,7 +400,7 @@ private: static InstallsList installsList(const QtSupport::ProFileReader *reader, const QString &projectFilePath, const QString &projectDir, const QString &buildDir); bool m_validParse = false; - bool m_parseInProgress = true; + bool m_parseInProgress = false; QmakeProjectType m_projectType = InvalidProject; QmakeVariablesHash m_varValues; diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp index 3308264ae4..1f5a79d8dc 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp @@ -71,25 +71,6 @@ using namespace Utils; enum { debug = 0 }; -// ----------------------------------------------------------------------- -// Helpers: -// ----------------------------------------------------------------------- - -namespace { - -QmakeBuildConfiguration *enableActiveQmakeBuildConfiguration(Target *t, bool enabled) -{ - if (!t) - return 0; - QmakeBuildConfiguration *bc = static_cast<QmakeBuildConfiguration *>(t->activeBuildConfiguration()); - if (!bc) - return 0; - bc->setEnabled(enabled); - return bc; -} - -} // namespace - namespace QmakeProjectManager { namespace Internal { @@ -603,7 +584,8 @@ void QmakeProject::scheduleAsyncUpdate(QmakeProFileNode *node, QmakeProFileNode: return; } - enableActiveQmakeBuildConfiguration(activeTarget(), false); + node->setParseInProgressRecursive(true); + setAllBuildConfigurationsEnabled(false); if (m_asyncUpdateState == AsyncFullUpdatePending) { // Just postpone @@ -643,7 +625,6 @@ void QmakeProject::scheduleAsyncUpdate(QmakeProFileNode *node, QmakeProFileNode: m_codeModelFuture.cancel(); startAsyncTimer(delay); - } else if (m_asyncUpdateState == AsyncUpdateInProgress) { // A update is in progress // And this slot only gets called if a file changed on disc @@ -671,21 +652,21 @@ void QmakeProject::scheduleAsyncUpdate(QmakeProFileNode::AsyncUpdateDelay delay) qDebug()<<" canceling is in progress, doing nothing"; return; } + + rootProjectNode()->setParseInProgressRecursive(true); + setAllBuildConfigurationsEnabled(false); + if (m_asyncUpdateState == AsyncUpdateInProgress) { if (debug) qDebug()<<" update in progress, canceling and setting state to full update pending"; m_cancelEvaluate = true; m_asyncUpdateState = AsyncFullUpdatePending; - enableActiveQmakeBuildConfiguration(activeTarget(), false); - rootProjectNode()->setParseInProgressRecursive(true); return; } if (debug) qDebug()<<" starting timer for full update, setting state to full update pending"; m_partialEvaluate.clear(); - enableActiveQmakeBuildConfiguration(activeTarget(), false); - rootProjectNode()->setParseInProgressRecursive(true); m_asyncUpdateState = AsyncFullUpdatePending; // Cancel running code model update @@ -734,11 +715,14 @@ void QmakeProject::decrementPendingEvaluateFutures() if (m_asyncUpdateState == AsyncFullUpdatePending || m_asyncUpdateState == AsyncPartialUpdatePending) { if (debug) qDebug()<<" Oh update is pending start the timer"; + rootProjectNode()->setParseInProgressRecursive(true); + setAllBuildConfigurationsEnabled(false); startAsyncTimer(QmakeProFileNode::ParseLater); } else if (m_asyncUpdateState != ShuttingDown){ // After being done, we need to call: + setAllBuildConfigurationsEnabled(true); + m_asyncUpdateState = Base; - enableActiveQmakeBuildConfiguration(activeTarget(), true); updateFileList(); updateCodeModels(); updateBuildSystemData(); @@ -1071,6 +1055,17 @@ void QmakeProject::activeTargetWasChanged() scheduleAsyncUpdate(); } +void QmakeProject::setAllBuildConfigurationsEnabled(bool enabled) +{ + foreach (Target *t, targets()) { + foreach (BuildConfiguration *bc, t->buildConfigurations()) { + auto qmakeBc = qobject_cast<QmakeBuildConfiguration *>(bc); + if (qmakeBc) + qmakeBc->setEnabled(enabled); + } + } +} + bool QmakeProject::hasSubNode(QmakePriFileNode *root, const FileName &path) { if (root->filePath() == path) diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.h b/src/plugins/qmakeprojectmanager/qmakeproject.h index 9a2ecb8aad..c109dd8e2c 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.h +++ b/src/plugins/qmakeprojectmanager/qmakeproject.h @@ -153,6 +153,8 @@ private: void buildFinished(bool success); void activeTargetWasChanged(); + void setAllBuildConfigurationsEnabled(bool enabled); + QString executableFor(const QmakeProFileNode *node); void updateRunConfigurations(); diff --git a/src/plugins/qmldesigner/components/componentcore/theming.cpp b/src/plugins/qmldesigner/components/componentcore/theming.cpp index d1429ff45b..e74a0561e8 100644 --- a/src/plugins/qmldesigner/components/componentcore/theming.cpp +++ b/src/plugins/qmldesigner/components/componentcore/theming.cpp @@ -33,11 +33,13 @@ namespace QmlDesigner { -void Theming::insertTheme(QQmlPropertyMap *map) +const QVariantMap &Theming::theme() { - const QVariantHash creatorTheme = Utils::creatorTheme()->values(); - for (auto it = creatorTheme.constBegin(); it != creatorTheme.constEnd(); ++it) - map->insert(it.key(), it.value()); + static QVariantMap map; + if (!map.isEmpty()) + return map; + + map = Utils::creatorTheme()->values(); /* Define QmlDesigner colors and remove alpha channels */ const QColor backgroundColor = Utils::creatorTheme()->color(Utils::Theme::QmlDesigner_BackgroundColor); @@ -58,18 +60,18 @@ void Theming::insertTheme(QQmlPropertyMap *map) tabDark = tabDark.darker(260); } - map->insert("QmlDesignerBackgroundColorDarker", darkerBackground); - map->insert("QmlDesignerBackgroundColorDarkAlternate", backgroundColor); - map->insert("QmlDesignerTabLight", tabLight); - map->insert("QmlDesignerTabDark", tabDark); - map->insert("QmlDesignerButtonColor", buttonColor); - map->insert("QmlDesignerBorderColor", Utils::creatorTheme()->color(Utils::Theme::SplitterColor)); + map.insert("QmlDesignerBackgroundColorDarker", darkerBackground); + map.insert("QmlDesignerBackgroundColorDarkAlternate", backgroundColor); + map.insert("QmlDesignerTabLight", tabLight); + map.insert("QmlDesignerTabDark", tabDark); + map.insert("QmlDesignerButtonColor", buttonColor); + map.insert("QmlDesignerBorderColor", Utils::creatorTheme()->color(Utils::Theme::SplitterColor)); + return map; } QString Theming::replaceCssColors(const QString &input) { - QQmlPropertyMap map; - insertTheme(&map); + const QVariantMap &map = theme(); QRegExp rx("creatorTheme\\.(\\w+);"); int pos = 0; diff --git a/src/plugins/qmldesigner/components/componentcore/theming.h b/src/plugins/qmldesigner/components/componentcore/theming.h index cb582994bf..d9a11ce7b5 100644 --- a/src/plugins/qmldesigner/components/componentcore/theming.h +++ b/src/plugins/qmldesigner/components/componentcore/theming.h @@ -33,7 +33,7 @@ namespace QmlDesigner { class Theming { public: - static void insertTheme(QQmlPropertyMap *map); + static const QVariantMap &theme(); static QString replaceCssColors(const QString &input); static void registerIconProvider(QQmlEngine *engine); }; diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp index 039a2be448..ad59291fe6 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp @@ -83,8 +83,7 @@ ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) : rootContext->setContextProperty(QStringLiteral("itemLibraryIconWidth"), m_itemIconSize.width()); rootContext->setContextProperty(QStringLiteral("itemLibraryIconHeight"), m_itemIconSize.height()); rootContext->setContextProperty(QStringLiteral("rootView"), this); - Theming::insertTheme(&m_themeProperties); - rootContext->setContextProperty(QLatin1String("creatorTheme"), &m_themeProperties); + rootContext->setContextProperty(QLatin1String("creatorTheme"), Theming::theme()); m_itemViewQuickWidget->rootContext()->setContextProperty(QStringLiteral("highlightColor"), Utils::StyleHelper::notTooBrightHighlightColor()); @@ -170,8 +169,7 @@ void ItemLibraryWidget::setItemLibraryInfo(ItemLibraryInfo *itemLibraryInfo) if (itemLibraryInfo) connect(m_itemLibraryInfo.data(), SIGNAL(entriesChanged()), this, SLOT(delayedUpdateModel())); - - updateModel(); + delayedUpdateModel(); } void ItemLibraryWidget::updateImports() @@ -229,7 +227,6 @@ void ItemLibraryWidget::setModel(Model *model) if (!model) return; setItemLibraryInfo(model->metaInfo().itemLibraryInfo()); - updateModel(); } void ItemLibraryWidget::setCurrentIndexOfStackedWidget(int index) diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.h b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.h index ca8cd82c31..148b0b90dc 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.h +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.h @@ -132,7 +132,6 @@ private: QPointer<Model> m_model; FilterChangeFlag m_filterFlag; ItemLibraryEntry m_currentitemLibraryEntry; - QQmlPropertyMap m_themeProperties; }; } diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp index 3d4884d9bd..ff299af870 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp @@ -103,8 +103,7 @@ PropertyEditorQmlBackend::PropertyEditorQmlBackend(PropertyEditorView *propertyE m_contextObject->setModel(propertyEditor->model()); m_contextObject->insertInQmlContext(context()); - Theming::insertTheme(&m_themeProperties); - context()->setContextProperty(QLatin1String("creatorTheme"), &m_themeProperties); + context()->setContextProperty(QLatin1String("creatorTheme"), Theming::theme()); QObject::connect(&m_backendValuesPropertyMap, &DesignerPropertyMap::valueChanged, propertyEditor, &PropertyEditorView::changeValue); } diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.h b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.h index 0e073b20be..a272b35aef 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.h +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.h @@ -103,7 +103,6 @@ private: QScopedPointer<PropertyEditorTransaction> m_propertyEditorTransaction; QScopedPointer<PropertyEditorValue> m_dummyPropertyEditorValue; QScopedPointer<PropertyEditorContextObject> m_contextObject; - QQmlPropertyMap m_themeProperties; }; } //QmlDesigner diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp index ae869763cd..a9a96cf05d 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp @@ -99,8 +99,7 @@ StatesEditorWidget::StatesEditorWidget(StatesEditorView *statesEditorView, State rootContext()->setContextProperty(QLatin1String("canAddNewStates"), true); - Theming::insertTheme(&m_themeProperties); - rootContext()->setContextProperty(QLatin1String("creatorTheme"), &m_themeProperties); + rootContext()->setContextProperty(QLatin1String("creatorTheme"), Theming::theme()); Theming::registerIconProvider(engine()); diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.h b/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.h index eb0c26ce04..fc78ecb450 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.h +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.h @@ -67,7 +67,6 @@ private: QPointer<StatesEditorView> m_statesEditorView; Internal::StatesEditorImageProvider *m_imageProvider; QShortcut *m_qmlSourceUpdateShortcut; - QQmlPropertyMap m_themeProperties; }; } diff --git a/src/plugins/qmldesigner/designercore/include/componenttextmodifier.h b/src/plugins/qmldesigner/designercore/include/componenttextmodifier.h index 01b8f63e53..fc9821864f 100644 --- a/src/plugins/qmldesigner/designercore/include/componenttextmodifier.h +++ b/src/plugins/qmldesigner/designercore/include/componenttextmodifier.h @@ -56,8 +56,8 @@ public: bool renameId(const QString & /* oldId */, const QString & /* newId */) override { return false; } - QStringList autoComplete(QTextDocument * /*textDocument*/, int /*position*/, bool /*explicitComplete*/) override - { return QStringList(); } + QStringList autoComplete(QTextDocument * textDocument, int position, bool explicitComplete) override + { return m_originalModifier->autoComplete(textDocument, position, explicitComplete); } bool moveToComponent(int /* nodeOffset */) override { return false; } diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp index e32c95685d..6f1fd6ec77 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp @@ -1231,7 +1231,7 @@ void NodeInstanceView::childrenChanged(const ChildrenChangedCommand &command) foreach (qint32 instanceId, command.childrenInstances()) { if (hasInstanceForId(instanceId)) { NodeInstance instance = instanceForId(instanceId); - if (!instance.directUpdates()) { + if (instance.parentId() == -1 || !instance.directUpdates()) { instance.setParentId(command.parentInstanceId()); childNodeVector.append(instance.modelNode()); } diff --git a/src/plugins/qmldesigner/designercore/model/componenttextmodifier.cpp b/src/plugins/qmldesigner/designercore/model/componenttextmodifier.cpp index a91e47e61e..257c6e67f7 100644 --- a/src/plugins/qmldesigner/designercore/model/componenttextmodifier.cpp +++ b/src/plugins/qmldesigner/designercore/model/componenttextmodifier.cpp @@ -55,7 +55,29 @@ void ComponentTextModifier::move(const MoveInfo &moveInfo) void ComponentTextModifier::indent(int offset, int length) { - m_originalModifier->indent(offset, length); + int componentStartLine = getLineInDocument(m_originalModifier->textDocument(), m_componentStartOffset); + int componentEndLine = getLineInDocument(m_originalModifier->textDocument(), m_componentEndOffset); + + /* Do not indent lines that contain code of the component and the surrounding QML. + * example: + * delegate: Item { //startLine + * ... + * } // endLine + * Indenting such lines will change the offsets of the component. + */ + + --componentStartLine; + --componentEndLine; + + int startLine = getLineInDocument(m_originalModifier->textDocument(), offset); + int endLine = getLineInDocument(m_originalModifier->textDocument(), offset + length); + + if (startLine < componentStartLine) + startLine = componentStartLine; + if (endLine > componentEndLine) + endLine = componentEndLine; + + indentLines(startLine, endLine); } void ComponentTextModifier::indentLines(int startLine, int endLine) @@ -78,7 +100,7 @@ void ComponentTextModifier::flushGroup() { m_originalModifier->flushGroup(); - uint textLength = m_originalModifier->text().length(); + int textLength = m_originalModifier->text().length(); m_componentEndOffset += (textLength - m_startLength); m_startLength = textLength; @@ -88,7 +110,7 @@ void ComponentTextModifier::commitGroup() { m_originalModifier->commitGroup(); - uint textLength = m_originalModifier->text().length(); + int textLength = m_originalModifier->text().length(); m_componentEndOffset += (textLength - m_startLength); m_startLength = textLength; } diff --git a/src/plugins/qmldesigner/qtquickplugin/source/pathviewv2.qml b/src/plugins/qmldesigner/qtquickplugin/source/pathviewv2.qml index 8122bf2d26..693f703596 100644 --- a/src/plugins/qmldesigner/qtquickplugin/source/pathviewv2.qml +++ b/src/plugins/qmldesigner/qtquickplugin/source/pathviewv2.qml @@ -53,21 +53,19 @@ PathView { colorCode: "green" } } - delegate: Component { - Column { - spacing: 5 - Rectangle { - width: 40 - height: 40 - color: colorCode - anchors.horizontalCenter: parent.horizontalCenter - } - Text { - x: 5 - text: name - anchors.horizontalCenter: parent.horizontalCenter - font.bold: true - } + delegate: Column { + spacing: 5 + Rectangle { + width: 40 + height: 40 + color: colorCode + anchors.horizontalCenter: parent.horizontalCenter + } + Text { + x: 5 + text: name + anchors.horizontalCenter: parent.horizontalCenter + font.bold: true } } } diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index 72498a20d8..1ff1bbca45 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -401,7 +401,7 @@ void QmlProfilerTool::finalizeRunControl(QmlProfilerRunControl *runControl) "qthelp://org.qt-project.qtcreator/doc/creator-debugging-qml.html"); case QMessageBox::Cancel: // The actual error message has already been logged. - logState(tr("Failed to connect!")); + logState(tr("Failed to connect.")); runControl->cancelProcess(); break; } diff --git a/src/plugins/qnx/qnxdebugsupport.cpp b/src/plugins/qnx/qnxdebugsupport.cpp index b6af5bcbf1..bb8cd71bc3 100644 --- a/src/plugins/qnx/qnxdebugsupport.cpp +++ b/src/plugins/qnx/qnxdebugsupport.cpp @@ -99,17 +99,18 @@ void QnxDebugSupport::startExecution() setState(StartingRemoteProcess); - if (m_useQmlDebugger) - m_runControl->startParameters().inferior.commandLineArguments += - QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices, m_qmlPort); - + StandardRunnable r = m_runnable; QStringList arguments; if (m_useCppDebugger) arguments << QString::number(m_pdebugPort.number()); - else if (m_useQmlDebugger && !m_useCppDebugger) - arguments = Utils::QtcProcess::splitArgs( - m_runControl->startParameters().inferior.commandLineArguments); - StandardRunnable r; + else { + if (m_useQmlDebugger) { + arguments.append(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices, + m_qmlPort)); + } + arguments.append(Utils::QtcProcess::splitArgs(r.commandLineArguments)); + } + r.executable = processExecutable(); r.commandLineArguments = Utils::QtcProcess::joinArgs(arguments); r.environment = m_runnable.environment; diff --git a/src/plugins/qtsupport/QtSupport.mimetypes.xml b/src/plugins/qtsupport/QtSupport.mimetypes.xml index a851d0c244..4e85be98ba 100644 --- a/src/plugins/qtsupport/QtSupport.mimetypes.xml +++ b/src/plugins/qtsupport/QtSupport.mimetypes.xml @@ -1,11 +1,11 @@ <?xml version="1.0"?> <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'> <mime-type type="application/x-linguist-translation"> - <comment>Linguist translated messages (machine-readable)</comment> + <comment>Linguist compiled translations</comment> <glob pattern="*.qm"/> </mime-type> <mime-type type="application/x-linguist"> - <comment>Linguist message catalog</comment> + <comment>Linguist source translations</comment> <magic> <match value="<TS" type="string" offset="0:256"/> </magic> diff --git a/src/plugins/scxmleditor/plugin_interface/actionhandler.cpp b/src/plugins/scxmleditor/plugin_interface/actionhandler.cpp index e8067fd016..85265cbabe 100644 --- a/src/plugins/scxmleditor/plugin_interface/actionhandler.cpp +++ b/src/plugins/scxmleditor/plugin_interface/actionhandler.cpp @@ -35,8 +35,6 @@ using namespace ScxmlEditor::PluginInterface; ActionHandler::ActionHandler(QObject *parent) : QObject(parent) { - using AH = ActionHandler; - const struct { const Utils::Icon icon; QString name; @@ -44,32 +42,32 @@ ActionHandler::ActionHandler(QObject *parent) const char *keyseq; bool checkable; } actionInfos[] = { - { Utils::Icons::ZOOMIN_TOOLBAR, AH::tr("Zoom In"), AH::tr("Zoom In (Ctrl + + / Ctrl + Wheel)"), "Ctrl++", false }, - { Utils::Icons::ZOOMOUT_TOOLBAR, AH::tr("Zoom Out"), AH::tr("Zoom Out (Ctrl + - / Ctrl + Wheel)"), "Ctrl+-", false }, - { Utils::Icons::FITTOVIEW_TOOLBAR, AH::tr("Fit to View"), AH::tr("Fit to View (F11)"), "F11", false }, - { Utils::Icon({{":/scxmleditor/images/icon-pan.png", Utils::Theme::IconsBaseColor}}), AH::tr("Panning"), AH::tr("Panning (Shift)"), "Shift", true }, + { Utils::Icons::ZOOMIN_TOOLBAR, tr("Zoom In"), tr("Zoom In (Ctrl + + / Ctrl + Wheel)"), "Ctrl++", false }, + { Utils::Icons::ZOOMOUT_TOOLBAR, tr("Zoom Out"), tr("Zoom Out (Ctrl + - / Ctrl + Wheel)"), "Ctrl+-", false }, + { Utils::Icons::FITTOVIEW_TOOLBAR, tr("Fit to View"), tr("Fit to View (F11)"), "F11", false }, + { Utils::Icon({{":/scxmleditor/images/icon-pan.png", Utils::Theme::IconsBaseColor}}), tr("Panning"), tr("Panning (Shift)"), "Shift", true }, - { Utils::Icons::ZOOM_TOOLBAR, AH::tr("Magnifier"), AH::tr("Magnifier Tool (Alt)"), "Alt", true }, - { Utils::Icon(":/scxmleditor/images/navigator.png"), AH::tr("Navigator"), AH::tr("Navigator (Ctrl+E)"), "Ctrl+E", true }, + { Utils::Icons::ZOOM_TOOLBAR, tr("Magnifier"), tr("Magnifier Tool (Alt)"), "Alt", true }, + { Utils::Icon(":/scxmleditor/images/navigator.png"), tr("Navigator"), tr("Navigator (Ctrl+E)"), "Ctrl+E", true }, - { Utils::Icon({{":/utils/images/editcopy.png", Utils::Theme::IconsBaseColor}}), AH::tr("Copy"), AH::tr("Copy (Ctrl + C)"), "Ctrl+C", false }, - { Utils::Icon({{":/utils/images/editcut.png", Utils::Theme::IconsBaseColor}}), AH::tr("Cut"), AH::tr("Cut (Ctrl + X)"), "Ctrl+X", false }, - { Utils::Icon({{":/utils/images/editpaste.png", Utils::Theme::IconsBaseColor}}), AH::tr("Paste"), AH::tr("Paste (Ctrl + V)"), "Ctrl+V", false }, - { Utils::Icons::SNAPSHOT_TOOLBAR, AH::tr("Screenshot"), AH::tr("Screenshot (Ctrl + Shift + C)"), "Ctrl+Shift+C", false }, - { Utils::Icon({{":/scxmleditor/images/icon-export-canvas.png", Utils::Theme::IconsBaseColor}}), AH::tr("Export to Image"), AH::tr("Export to Image"), "Ctrl+Shift+E", false }, - { Utils::Icon({{":/utils/images/namespace.png", Utils::Theme::IconsBaseColor}}), AH::tr("Toggle Full Namespace"), AH::tr("Toggle Full Namespace"), "Ctrl+Shift+N", true }, + { Utils::Icon({{":/utils/images/editcopy.png", Utils::Theme::IconsBaseColor}}), tr("Copy"), tr("Copy (Ctrl + C)"), "Ctrl+C", false }, + { Utils::Icon({{":/utils/images/editcut.png", Utils::Theme::IconsBaseColor}}), tr("Cut"), tr("Cut (Ctrl + X)"), "Ctrl+X", false }, + { Utils::Icon({{":/utils/images/editpaste.png", Utils::Theme::IconsBaseColor}}), tr("Paste"), tr("Paste (Ctrl + V)"), "Ctrl+V", false }, + { Utils::Icons::SNAPSHOT_TOOLBAR, tr("Screenshot"), tr("Screenshot (Ctrl + Shift + C)"), "Ctrl+Shift+C", false }, + { Utils::Icon({{":/scxmleditor/images/icon-export-canvas.png", Utils::Theme::IconsBaseColor}}), tr("Export to Image"), tr("Export to Image"), "Ctrl+Shift+E", false }, + { Utils::Icon({{":/utils/images/namespace.png", Utils::Theme::IconsBaseColor}}), tr("Toggle Full Namespace"), tr("Toggle Full Namespace"), "Ctrl+Shift+N", true }, - { Utils::Icon({{":/scxmleditor/images/align_left.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), AH::tr("Align Left"), AH::tr("Align Left (Ctrl+L,1)"), "Ctrl+L,1", false }, - { Utils::Icon({{":/scxmleditor/images/align_right.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), AH::tr("Align Right"), AH::tr("Align Right (Ctrl+L,2)"), "Ctrl+L,2", false }, - { Utils::Icon({{":/scxmleditor/images/align_top.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), AH::tr("Align Top"), AH::tr("Align Top (Ctrl+L,3)"), "Ctrl+L,3", false }, - { Utils::Icon({{":/scxmleditor/images/align_bottom.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), AH::tr("Align Bottom"), AH::tr("Align Bottom (Ctrl+L,4)"), "Ctrl+L,4", false }, - { Utils::Icon({{":/scxmleditor/images/align_horizontal.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), AH::tr("Align Horizontal"), AH::tr("Align Horizontal (Ctrl+L,5)"), "Ctrl+L,5", false }, - { Utils::Icon({{":/scxmleditor/images/align_vertical.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), AH::tr("Align Vertical"), AH::tr("Align Vertical (Ctrl+L,6)"), "Ctrl+L,6", false }, - { Utils::Icon({{":/scxmleditor/images/adjust_width.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), AH::tr("Adjust Width"), AH::tr("Adjust Width (Ctrl+L,7)"), "Ctrl+L,7", false }, - { Utils::Icon({{":/scxmleditor/images/adjust_height.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), AH::tr("Adjust Height"), AH::tr("Adjust Height (Ctrl+L,8)"), "Ctrl+L,8", false }, - { Utils::Icon({{":/scxmleditor/images/adjust_size.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), AH::tr("Adjust Size"), AH::tr("Adjust Size (Ctrl+L,9)"), "Ctrl+L,9", false }, + { Utils::Icon({{":/scxmleditor/images/align_left.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), tr("Align Left"), tr("Align Left (Ctrl+L,1)"), "Ctrl+L,1", false }, + { Utils::Icon({{":/scxmleditor/images/align_right.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), tr("Align Right"), tr("Align Right (Ctrl+L,2)"), "Ctrl+L,2", false }, + { Utils::Icon({{":/scxmleditor/images/align_top.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), tr("Align Top"), tr("Align Top (Ctrl+L,3)"), "Ctrl+L,3", false }, + { Utils::Icon({{":/scxmleditor/images/align_bottom.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), tr("Align Bottom"), tr("Align Bottom (Ctrl+L,4)"), "Ctrl+L,4", false }, + { Utils::Icon({{":/scxmleditor/images/align_horizontal.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), tr("Align Horizontal"), tr("Align Horizontal (Ctrl+L,5)"), "Ctrl+L,5", false }, + { Utils::Icon({{":/scxmleditor/images/align_vertical.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), tr("Align Vertical"), tr("Align Vertical (Ctrl+L,6)"), "Ctrl+L,6", false }, + { Utils::Icon({{":/scxmleditor/images/adjust_width.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), tr("Adjust Width"), tr("Adjust Width (Ctrl+L,7)"), "Ctrl+L,7", false }, + { Utils::Icon({{":/scxmleditor/images/adjust_height.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), tr("Adjust Height"), tr("Adjust Height (Ctrl+L,8)"), "Ctrl+L,8", false }, + { Utils::Icon({{":/scxmleditor/images/adjust_size.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), tr("Adjust Size"), tr("Adjust Size (Ctrl+L,9)"), "Ctrl+L,9", false }, - { Utils::Icon(":/scxmleditor/images/statistics.png"), AH::tr("Show Statistics..."), AH::tr("Show Statistics"), "", false } + { Utils::Icon(":/scxmleditor/images/statistics.png"), tr("Show Statistics..."), tr("Show Statistics"), "", false } }; // Init actions diff --git a/src/plugins/scxmleditor/plugin_interface/initialwarningitem.h b/src/plugins/scxmleditor/plugin_interface/initialwarningitem.h index 762bb47702..b3f12aa664 100644 --- a/src/plugins/scxmleditor/plugin_interface/initialwarningitem.h +++ b/src/plugins/scxmleditor/plugin_interface/initialwarningitem.h @@ -35,6 +35,7 @@ class InitialStateItem; class InitialWarningItem : public WarningItem { + Q_OBJECT public: InitialWarningItem(InitialStateItem *parent = nullptr); diff --git a/src/plugins/scxmleditor/plugin_interface/scattributeitemmodel.h b/src/plugins/scxmleditor/plugin_interface/scattributeitemmodel.h index 8fbfdf6637..6a17749520 100644 --- a/src/plugins/scxmleditor/plugin_interface/scattributeitemmodel.h +++ b/src/plugins/scxmleditor/plugin_interface/scattributeitemmodel.h @@ -33,6 +33,7 @@ namespace PluginInterface { class SCAttributeItemModel : public AttributeItemModel { + Q_OBJECT public: SCAttributeItemModel(QObject *parent = nullptr); diff --git a/src/plugins/scxmleditor/plugin_interface/scshapeprovider.h b/src/plugins/scxmleditor/plugin_interface/scshapeprovider.h index f4093b5a76..f3a9784268 100644 --- a/src/plugins/scxmleditor/plugin_interface/scshapeprovider.h +++ b/src/plugins/scxmleditor/plugin_interface/scshapeprovider.h @@ -37,6 +37,7 @@ class ScxmlTag; class SCShapeProvider : public ShapeProvider { + Q_OBJECT public: SCShapeProvider(QObject *parent = nullptr); ~SCShapeProvider() override; diff --git a/src/plugins/scxmleditor/plugin_interface/scxmltag.h b/src/plugins/scxmleditor/plugin_interface/scxmltag.h index 7228357fb2..3031c9b465 100644 --- a/src/plugins/scxmleditor/plugin_interface/scxmltag.h +++ b/src/plugins/scxmleditor/plugin_interface/scxmltag.h @@ -50,6 +50,7 @@ class ScxmlDocument; */ class ScxmlTag : public QObject { + Q_OBJECT public: ScxmlTag(TagType type, ScxmlDocument *document = nullptr); ScxmlTag(const QString &prefix, const QString &name, ScxmlDocument *document = nullptr); diff --git a/src/plugins/scxmleditor/scxmleditordata.h b/src/plugins/scxmleditor/scxmleditordata.h index 527659fbbb..785e927531 100644 --- a/src/plugins/scxmleditor/scxmleditordata.h +++ b/src/plugins/scxmleditor/scxmleditordata.h @@ -44,6 +44,7 @@ class ScxmlContext; class ScxmlEditorData : public QObject { + Q_OBJECT public: ScxmlEditorData(QObject *parent = nullptr); ~ScxmlEditorData(); diff --git a/src/plugins/subversion/subversionclient.cpp b/src/plugins/subversion/subversionclient.cpp index 85331d0a4d..73e69806e2 100644 --- a/src/plugins/subversion/subversionclient.cpp +++ b/src/plugins/subversion/subversionclient.cpp @@ -39,6 +39,7 @@ #include <diffeditor/diffutils.h> #include <coreplugin/editormanager/editormanager.h> +#include <utils/algorithm.h> #include <utils/hostosinfo.h> #include <QDir> @@ -89,7 +90,7 @@ VcsCommand *SubversionClient::createCommitCmd(const QString &repositoryRoot, VcsCommand *cmd = createCommand(repositoryRoot); cmd->addFlags(VcsCommand::ShowStdOut); QStringList args(vcsCommandString(CommitCommand)); - cmd->addJob(vcsBinary(), args << svnExtraOptions << files); + cmd->addJob(vcsBinary(), args << svnExtraOptions << escapeFiles(files)); return cmd; } @@ -156,6 +157,16 @@ QString SubversionClient::synchronousTopic(const QString &repository) return result.stdOut().trimmed(); } +QString SubversionClient::escapeFile(const QString &file) +{ + return (file.contains('@') && !file.endsWith('@')) ? file + '@' : file; +} + +QStringList SubversionClient::escapeFiles(const QStringList &files) +{ + return Utils::transform(files, &SubversionClient::escapeFile); +} + class DiffController : public DiffEditorController { Q_OBJECT @@ -200,7 +211,7 @@ void DiffController::setFilesList(const QStringList &filesList) if (isReloading()) return; - m_filesList = filesList; + m_filesList = SubversionClient::escapeFiles(filesList); } void DiffController::setChangeNumber(int changeNumber) @@ -310,13 +321,9 @@ void SubversionClient::log(const QString &workingDir, if (logCount > 0) svnExtraOptions << QLatin1String("-l") << QString::number(logCount); - QStringList nativeFiles; - foreach (const QString& file, files) - nativeFiles.append(QDir::toNativeSeparators(file)); - // subversion stores log in UTF-8 and returns it back in user system locale. // So we do not need to encode it. - VcsBaseClient::log(workingDir, files, svnExtraOptions, enableAnnotationContextMenu); + VcsBaseClient::log(workingDir, escapeFiles(files), svnExtraOptions, enableAnnotationContextMenu); } void SubversionClient::describe(const QString &workingDirectory, int changeNumber, const QString &title) diff --git a/src/plugins/subversion/subversionclient.h b/src/plugins/subversion/subversionclient.h index a5e3d98277..7cc287f210 100644 --- a/src/plugins/subversion/subversionclient.h +++ b/src/plugins/subversion/subversionclient.h @@ -71,6 +71,9 @@ public: QString synchronousTopic(const QString &repository); + static QString escapeFile(const QString &file); + static QStringList escapeFiles(const QStringList &files); + protected: Core::Id vcsEditorKind(VcsCommandTag cmd) const override; diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index fd335e4668..2abc041d12 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -568,7 +568,7 @@ void SubversionPlugin::revertCurrentFile() QStringList args(QLatin1String("diff")); args << SubversionClient::addAuthenticationOptions(client()->settings()); - args.push_back(state.relativeCurrentFile()); + args.push_back(SubversionClient::escapeFile(state.relativeCurrentFile())); const SubversionResponse diffResponse = runSvn(state.currentFileTopLevel(), args, m_client->vcsTimeoutS(), 0); @@ -589,7 +589,7 @@ void SubversionPlugin::revertCurrentFile() args.clear(); args << QLatin1String("revert"); args << SubversionClient::addAuthenticationOptions(client()->settings()); - args << state.relativeCurrentFile(); + args << SubversionClient::escapeFile(state.relativeCurrentFile()); const SubversionResponse revertResponse = runSvn(state.currentFileTopLevel(), args, m_client->vcsTimeoutS(), @@ -652,7 +652,7 @@ void SubversionPlugin::startCommit(const QString &workingDir, const QStringList QStringList args(QLatin1String("status")); args << SubversionClient::addAuthenticationOptions(client()->settings()); - args += files; + args += SubversionClient::escapeFiles(files); const SubversionResponse response = runSvn(workingDir, args, m_client->vcsTimeoutS(), 0); @@ -733,7 +733,7 @@ void SubversionPlugin::svnStatus(const QString &workingDir, const QString &relat QStringList args(QLatin1String("status")); args << SubversionClient::addAuthenticationOptions(client()->settings()); if (!relativePath.isEmpty()) - args.append(relativePath); + args.append(SubversionClient::escapeFile(relativePath)); VcsOutputWindow::setRepository(workingDir); runSvn(workingDir, args, m_client->vcsTimeoutS(), VcsCommand::ShowStdOut | VcsCommand::ShowSuccessMessage); @@ -798,7 +798,7 @@ void SubversionPlugin::vcsAnnotate(const QString &workingDir, const QString &fil if (!revision.isEmpty()) args << QLatin1String("-r") << revision; args.push_back(QLatin1String("-v")); - args.append(QDir::toNativeSeparators(file)); + args.append(QDir::toNativeSeparators(SubversionClient::escapeFile(file))); const SubversionResponse response = runSvn(workingDir, args, m_client->vcsTimeoutS(), @@ -958,7 +958,7 @@ QString SubversionPlugin::synchronousTopic(const QString &repository) const bool SubversionPlugin::vcsAdd(const QString &workingDir, const QString &rawFileName) { - const QString file = QDir::toNativeSeparators(rawFileName); + const QString file = QDir::toNativeSeparators(SubversionClient::escapeFile(rawFileName)); QStringList args; args << QLatin1String("add") << SubversionClient::addAuthenticationOptions(client()->settings()) @@ -971,7 +971,7 @@ bool SubversionPlugin::vcsAdd(const QString &workingDir, const QString &rawFileN bool SubversionPlugin::vcsDelete(const QString &workingDir, const QString &rawFileName) { - const QString file = QDir::toNativeSeparators(rawFileName); + const QString file = QDir::toNativeSeparators(SubversionClient::escapeFile(rawFileName)); QStringList args; args << QLatin1String("delete"); @@ -988,7 +988,8 @@ bool SubversionPlugin::vcsMove(const QString &workingDir, const QString &from, c { QStringList args(QLatin1String("move")); args << SubversionClient::addAuthenticationOptions(client()->settings()); - args << QDir::toNativeSeparators(from) << QDir::toNativeSeparators(to); + args << QDir::toNativeSeparators(SubversionClient::escapeFile(from)) + << QDir::toNativeSeparators(SubversionClient::escapeFile(to)); const SubversionResponse response = runSvn(workingDir, args, m_client->vcsTimeoutS(), VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut @@ -1051,7 +1052,8 @@ bool SubversionPlugin::managesFile(const QString &workingDirectory, const QStrin { QStringList args; args << QLatin1String("status"); - args << SubversionClient::addAuthenticationOptions(client()->settings()) << fileName; + args << SubversionClient::addAuthenticationOptions(client()->settings()) + << QDir::toNativeSeparators(SubversionClient::escapeFile(fileName)); SubversionResponse response = runSvn(workingDirectory, args, m_client->vcsTimeoutS(), 0); return response.stdOut.isEmpty() || response.stdOut.at(0) != QLatin1Char('?'); diff --git a/src/plugins/texteditor/basefilefind.cpp b/src/plugins/texteditor/basefilefind.cpp index 30ac76832e..46ab0f2b48 100644 --- a/src/plugins/texteditor/basefilefind.cpp +++ b/src/plugins/texteditor/basefilefind.cpp @@ -477,7 +477,7 @@ CountingLabel::CountingLabel() void CountingLabel::updateCount(int count) { - setText(BaseFileFind::tr("%1 found").arg(count)); + setText(BaseFileFind::tr("%n found", nullptr, count)); } } // namespace Internal diff --git a/src/plugins/welcome/welcomeplugin.cpp b/src/plugins/welcome/welcomeplugin.cpp index ac3d3a01fa..884eeb30db 100644 --- a/src/plugins/welcome/welcomeplugin.cpp +++ b/src/plugins/welcome/welcomeplugin.cpp @@ -158,7 +158,6 @@ private: void sceneGraphError(QQuickWindow::SceneGraphError, const QString &message); void facilitateQml(QQmlEngine *engine); void addPages(const QList<IWelcomePage *> &pages); - void applyTheme(); void addKeyboardShortcuts(); QWidget *m_modeWidget; @@ -166,7 +165,6 @@ private: QMap<Id, IWelcomePage *> m_idPageMap; QList<IWelcomePage *> m_pluginList; int m_activePlugin; - QQmlPropertyMap m_themeProperties; QStringList m_recentProjectsShortcuts; QStringList m_sessionsShortcuts; }; @@ -197,7 +195,6 @@ WelcomeMode::WelcomeMode() layout->setSpacing(0); m_welcomePage = new QQuickWidget; - applyTheme(); // initialize background color and theme properties m_welcomePage->setResizeMode(QQuickWidget::SizeRootObjectToView); m_welcomePage->setObjectName(QLatin1String("WelcomePage")); @@ -217,13 +214,6 @@ WelcomeMode::WelcomeMode() setWidget(m_modeWidget); } -void WelcomeMode::applyTheme() -{ - const QVariantHash creatorTheme = Utils::creatorTheme()->values(); - for (auto it = creatorTheme.constBegin(); it != creatorTheme.constEnd(); ++it) - m_themeProperties.insert(it.key(), it.value()); -} - void WelcomeMode::addKeyboardShortcuts() { const int actionsCount = 9; @@ -294,7 +284,7 @@ void WelcomeMode::facilitateQml(QQmlEngine *engine) QQmlContext *ctx = engine->rootContext(); ctx->setContextProperty(QLatin1String("welcomeMode"), this); - ctx->setContextProperty(QLatin1String("creatorTheme"), &m_themeProperties); + ctx->setContextProperty(QLatin1String("creatorTheme"), Utils::creatorTheme()->values()); ctx->setContextProperty(QLatin1String("useNativeText"), true); } |