diff options
author | Eike Ziller <eike.ziller@qt.io> | 2019-11-19 17:01:08 +0100 |
---|---|---|
committer | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2019-11-21 22:18:35 +0200 |
commit | 4e6142c93226862458252da84a5ce0539e6008ae (patch) | |
tree | a75c38085df5769e21e11c3b6c5b0b774434c9f2 /src/plugins | |
parent | fd8afd564f847f24ad119fd519929de6dcb94139 (diff) | |
parent | e53e0a808b5d0075c95fd7635ce53cc4de277f3a (diff) | |
download | qt-creator-4e6142c93226862458252da84a5ce0539e6008ae.tar.gz |
Merge remote-tracking branch 'origin/4.11'
Conflicts:
src/plugins/autotest/testresultspane.cpp
src/plugins/cmakeprojectmanager/cmaketool.cpp
Change-Id: Iade695ac9cab8bf3e3a1abd6e2c71f4a19132ac0
Diffstat (limited to 'src/plugins')
52 files changed, 524 insertions, 359 deletions
diff --git a/src/plugins/android/androidconfigurations.cpp b/src/plugins/android/androidconfigurations.cpp index 87f2d8b60e..d8714476ed 100644 --- a/src/plugins/android/androidconfigurations.cpp +++ b/src/plugins/android/androidconfigurations.cpp @@ -870,6 +870,7 @@ FilePath AndroidConfig::qtLiveApkPath() const /////////////////////////////////// void AndroidConfigurations::setConfig(const AndroidConfig &devConfigs) { + emit m_instance->aboutToUpdate(); m_instance->m_config = devConfigs; m_instance->save(); diff --git a/src/plugins/android/androidconfigurations.h b/src/plugins/android/androidconfigurations.h index aba533fc27..c19e68dbf4 100644 --- a/src/plugins/android/androidconfigurations.h +++ b/src/plugins/android/androidconfigurations.h @@ -209,6 +209,7 @@ public: static QProcessEnvironment toolsEnvironment(const AndroidConfig &config); signals: + void aboutToUpdate(); void updated(); private: diff --git a/src/plugins/android/androidmanager.cpp b/src/plugins/android/androidmanager.cpp index 4958bd02a3..80e6fbbd80 100644 --- a/src/plugins/android/androidmanager.cpp +++ b/src/plugins/android/androidmanager.cpp @@ -288,8 +288,8 @@ QJsonObject AndroidManager::deploymentSettings(const Target *target) Utils::FilePath AndroidManager::dirPath(const ProjectExplorer::Target *target) { - if (target->activeBuildConfiguration()) - return target->activeBuildConfiguration()->buildDirectory().pathAppended(Constants::ANDROID_BUILDDIRECTORY); + if (auto *bc = target->activeBuildConfiguration()) + return bc->buildDirectory().pathAppended(Constants::ANDROID_BUILDDIRECTORY); return Utils::FilePath(); } diff --git a/src/plugins/android/androidqtversion.cpp b/src/plugins/android/androidqtversion.cpp index ff8606a1e0..48aeab8e54 100644 --- a/src/plugins/android/androidqtversion.cpp +++ b/src/plugins/android/androidqtversion.cpp @@ -49,7 +49,12 @@ namespace Internal { AndroidQtVersion::AndroidQtVersion() : QtSupport::BaseQtVersion() + , m_guard(std::make_unique<QObject>()) { + QObject::connect(AndroidConfigurations::instance(), + &AndroidConfigurations::aboutToUpdate, + m_guard.get(), + [this] { resetCache(); }); } bool AndroidQtVersion::isValid() const diff --git a/src/plugins/android/androidqtversion.h b/src/plugins/android/androidqtversion.h index c986960819..5098f53356 100644 --- a/src/plugins/android/androidqtversion.h +++ b/src/plugins/android/androidqtversion.h @@ -58,6 +58,7 @@ public: protected: void parseMkSpec(ProFileEvaluator *) const override; private: + std::unique_ptr<QObject> m_guard; mutable QStringList m_androidAbis; mutable int m_minNdk = -1; }; diff --git a/src/plugins/android/androidrunnerworker.cpp b/src/plugins/android/androidrunnerworker.cpp index e4e1adf924..caf97cb282 100644 --- a/src/plugins/android/androidrunnerworker.cpp +++ b/src/plugins/android/androidrunnerworker.cpp @@ -67,7 +67,7 @@ using namespace Utils; namespace Android { namespace Internal { -static const QString pidScript = "pidof -s \"%1\""; +static const QString pidScript = "pidof -s '%1'"; static const QString pidScriptPreNougat = QStringLiteral("for p in /proc/[0-9]*; " "do cat <$p/cmdline && echo :${p##*/}; done"); static const QString pidPollingScript = QStringLiteral("while [ -d /proc/%1 ]; do sleep 1; done"); @@ -288,8 +288,8 @@ bool AndroidRunnerWorker::uploadGdbServer() qCDebug(androidRunWorkerLog) << "Gdbserver copy from temp directory failed"; return false; } - QTC_ASSERT(runAdb({"shell", "run-as", m_packageName, "chmod", "+x", "./gdbserver"}), - qCDebug(androidRunWorkerLog) << "Gdbserver chmod +x failed."); + QTC_ASSERT(runAdb({"shell", "run-as", m_packageName, "chmod", "777", "./gdbserver"}), + qCDebug(androidRunWorkerLog) << "Gdbserver chmod 777 failed."); return true; } diff --git a/src/plugins/autotest/gtest/gtest_utils.cpp b/src/plugins/autotest/gtest/gtest_utils.cpp index 94f608b334..1035cf5bb2 100644 --- a/src/plugins/autotest/gtest/gtest_utils.cpp +++ b/src/plugins/autotest/gtest/gtest_utils.cpp @@ -34,7 +34,8 @@ namespace GTestUtils { static const QStringList valid = { QStringLiteral("TEST"), QStringLiteral("TEST_F"), QStringLiteral("TEST_P"), - QStringLiteral("TYPED_TEST"), QStringLiteral("TYPED_TEST_P") + QStringLiteral("TYPED_TEST"), QStringLiteral("TYPED_TEST_P"), + QStringLiteral("GTEST_TEST") }; bool isGTestMacro(const QString ¯o) diff --git a/src/plugins/autotest/testresultspane.cpp b/src/plugins/autotest/testresultspane.cpp index 234c521b87..baac198a37 100644 --- a/src/plugins/autotest/testresultspane.cpp +++ b/src/plugins/autotest/testresultspane.cpp @@ -46,7 +46,9 @@ #include <coreplugin/icore.h> #include <projectexplorer/buildmanager.h> #include <projectexplorer/projectexplorer.h> +#include <texteditor/fontsettings.h> #include <texteditor/texteditor.h> +#include <texteditor/texteditorsettings.h> #include <utils/qtcassert.h> #include <utils/theme/theme.h> #include <utils/utilsicons.h> @@ -131,9 +133,7 @@ TestResultsPane::TestResultsPane(QObject *parent) : m_textOutput = new QPlainTextEdit; m_textOutput->setPalette(pal); - QFont font("monospace"); - font.setStyleHint(QFont::TypeWriter); - m_textOutput->setFont(font); + m_textOutput->setFont(TextEditor::TextEditorSettings::fontSettings().font()); m_textOutput->setWordWrapMode(QTextOption::WordWrap); m_textOutput->setReadOnly(true); new OutputHighlighter(m_textOutput->document()); diff --git a/src/plugins/bineditor/bineditorwidget.cpp b/src/plugins/bineditor/bineditorwidget.cpp index 561b133925..9cf0a06c4d 100644 --- a/src/plugins/bineditor/bineditorwidget.cpp +++ b/src/plugins/bineditor/bineditorwidget.cpp @@ -1179,7 +1179,6 @@ QString BinEditorWidget::toolTip(const QHelpEvent *helpEvent) const if (!pos) return QString(); selStart = pos.value(); - selEnd = selStart; byteCount = 1; } diff --git a/src/plugins/clangcodemodel/clangutils.cpp b/src/plugins/clangcodemodel/clangutils.cpp index e7d7de420a..2734f23255 100644 --- a/src/plugins/clangcodemodel/clangutils.cpp +++ b/src/plugins/clangcodemodel/clangutils.cpp @@ -315,15 +315,11 @@ static ::Utils::FilePath compilerPath(const CppTools::ProjectPart &projectPart) static ::Utils::FilePath buildDirectory(const ProjectExplorer::Project &project) { - ProjectExplorer::Target *target = project.activeTarget(); - if (!target) - return ::Utils::FilePath(); - - ProjectExplorer::BuildConfiguration *buildConfig = target->activeBuildConfiguration(); - if (!buildConfig) - return ::Utils::FilePath(); - - return buildConfig->buildDirectory(); + if (auto *target = project.activeTarget()) { + if (auto *bc = target->activeBuildConfiguration()) + return bc->buildDirectory(); + } + return {}; } static QStringList projectPartArguments(const ProjectPart &projectPart) diff --git a/src/plugins/clangtools/clangtoolruncontrol.cpp b/src/plugins/clangtools/clangtoolruncontrol.cpp index e58b77a769..b4d7804f96 100644 --- a/src/plugins/clangtools/clangtoolruncontrol.cpp +++ b/src/plugins/clangtools/clangtoolruncontrol.cpp @@ -495,7 +495,7 @@ void ClangToolRunWorker::finalize() QString msg = tr("%1: Not all files could be analyzed.").arg(toolName); TaskHub::addTask(Task::Error, msg, Debugger::Constants::ANALYZERTASK_ID); Target *target = runControl()->target(); - if (target && !target->activeBuildConfiguration()->buildDirectory().exists() + if (target && target->activeBuildConfiguration() && !target->activeBuildConfiguration()->buildDirectory().exists() && !m_runSettings.buildBeforeAnalysis()) { msg = tr("%1: You might need to build the project to generate or update source " "files. To build automatically, enable \"Build the project before starting " diff --git a/src/plugins/clangtools/clangtoolsunittests.cpp b/src/plugins/clangtools/clangtoolsunittests.cpp index 609d666ed5..cd20781c17 100644 --- a/src/plugins/clangtools/clangtoolsunittests.cpp +++ b/src/plugins/clangtools/clangtoolsunittests.cpp @@ -159,7 +159,7 @@ void ClangToolsUnitTests::testProject_data() // Test that tidy and clazy diagnostics are emitted for the same project. addTestRow("clangtidy_clazy/clangtidy_clazy.pro", 1 /*tidy*/ + 1 /*clazy*/, - configFor("misc-unconventional-assign-operator", "base-class-event")); + configFor("misc-unconventional-assign-operator", "qgetenv")); } void ClangToolsUnitTests::addTestRow(const QByteArray &relativeFilePath, diff --git a/src/plugins/clangtools/unit-tests/clangtidy_clazy/clazy_example.cpp b/src/plugins/clangtools/unit-tests/clangtidy_clazy/clazy_example.cpp index 5cd980d24c..c692e5e697 100644 --- a/src/plugins/clangtools/unit-tests/clangtidy_clazy/clazy_example.cpp +++ b/src/plugins/clangtools/unit-tests/clangtidy_clazy/clazy_example.cpp @@ -23,19 +23,11 @@ ** ****************************************************************************/ -#include <QCoreApplication> +#include <QByteArray> +#include <QtGlobal> -// -Wclazy-ctor-missing-parent-argument -class TestObject : public QObject +void test() { - Q_OBJECT - -public: - TestObject(); - - bool event(QEvent *) override - { - // -Wclazy-base-class-event - return false; - } -}; + // -Wclazy-qgetenv + qgetenv("Foo").isEmpty(); +} diff --git a/src/plugins/cmakeprojectmanager/builddirparameters.cpp b/src/plugins/cmakeprojectmanager/builddirparameters.cpp index 6bf4ccc8c3..1c71396c76 100644 --- a/src/plugins/cmakeprojectmanager/builddirparameters.cpp +++ b/src/plugins/cmakeprojectmanager/builddirparameters.cpp @@ -27,6 +27,8 @@ #include "cmakebuildconfiguration.h" #include "cmakekitinformation.h" +#include "cmakeprojectplugin.h" +#include "cmakespecificsettings.h" #include "cmaketoolmanager.h" #include <projectexplorer/kit.h> @@ -61,6 +63,10 @@ BuildDirParameters::BuildDirParameters(CMakeBuildConfiguration *bc) if (Utils::HostOsInfo::isAnyUnixHost()) environment.set("ICECC", "no"); + CMakeSpecificSettings *settings = CMakeProjectPlugin::projectTypeSpecificSettings(); + if (!settings->ninjaPath().isEmpty()) + environment.appendOrSetPath(settings->ninjaPath().toString()); + cmakeToolId = CMakeKitAspect::cmakeToolId(k); auto tc = ToolChainKitAspect::toolChain(k, Constants::CXX_LANGUAGE_ID); diff --git a/src/plugins/cmakeprojectmanager/cmakespecificsettings.cpp b/src/plugins/cmakeprojectmanager/cmakespecificsettings.cpp index 53f69dac90..4976154566 100644 --- a/src/plugins/cmakeprojectmanager/cmakespecificsettings.cpp +++ b/src/plugins/cmakeprojectmanager/cmakespecificsettings.cpp @@ -31,20 +31,24 @@ namespace Internal { namespace { static const char SETTINGS_KEY[] = "CMakeSpecificSettings"; static const char AFTER_ADD_FILE_ACTION_KEY[] = "ProjectPopupSetting"; +static const char NINJA_PATH[] = "NinjaPath"; } void CMakeSpecificSettings::fromSettings(QSettings *settings) { const QString rootKey = QString(SETTINGS_KEY) + '/'; - afterAddFileToProjectSetting = static_cast<AfterAddFileAction>( + m_afterAddFileToProjectSetting = static_cast<AfterAddFileAction>( settings->value(rootKey + AFTER_ADD_FILE_ACTION_KEY, static_cast<int>(AfterAddFileAction::ASK_USER)).toInt()); + + m_ninjaPath = Utils::FilePath::fromUserInput( + settings->value(rootKey + NINJA_PATH, QString()).toString()); } void CMakeSpecificSettings::toSettings(QSettings *settings) const { settings->beginGroup(QString(SETTINGS_KEY)); - settings->setValue(QString(AFTER_ADD_FILE_ACTION_KEY), static_cast<int>(afterAddFileToProjectSetting)); + settings->setValue(QString(AFTER_ADD_FILE_ACTION_KEY), static_cast<int>(m_afterAddFileToProjectSetting)); settings->endGroup(); } } diff --git a/src/plugins/cmakeprojectmanager/cmakespecificsettings.h b/src/plugins/cmakeprojectmanager/cmakespecificsettings.h index fe4d222593..ca94bc2c73 100644 --- a/src/plugins/cmakeprojectmanager/cmakespecificsettings.h +++ b/src/plugins/cmakeprojectmanager/cmakespecificsettings.h @@ -24,6 +24,7 @@ ****************************************************************************/ #pragma once +#include <utils/fileutils.h> #include <QSettings> namespace CMakeProjectManager { @@ -42,11 +43,14 @@ public: void fromSettings(QSettings *settings); void toSettings(QSettings *settings) const; - void setAfterAddFileSetting(AfterAddFileAction settings) { afterAddFileToProjectSetting = settings; } - AfterAddFileAction afterAddFileSetting() const { return afterAddFileToProjectSetting; } + void setAfterAddFileSetting(AfterAddFileAction settings) { m_afterAddFileToProjectSetting = settings; } + AfterAddFileAction afterAddFileSetting() const { return m_afterAddFileToProjectSetting; } + + Utils::FilePath ninjaPath() const { return m_ninjaPath; } private: - AfterAddFileAction afterAddFileToProjectSetting; + AfterAddFileAction m_afterAddFileToProjectSetting; + Utils::FilePath m_ninjaPath; }; } diff --git a/src/plugins/cmakeprojectmanager/cmaketool.cpp b/src/plugins/cmakeprojectmanager/cmaketool.cpp index e8284c5e7e..4efc351529 100644 --- a/src/plugins/cmakeprojectmanager/cmaketool.cpp +++ b/src/plugins/cmakeprojectmanager/cmaketool.cpp @@ -107,7 +107,7 @@ class IntrospectionData { public: bool m_didAttemptToRun = false; - bool m_didRun = false; + bool m_didRun = true; bool m_hasServerMode = false; bool m_queriedServerMode = false; @@ -207,26 +207,17 @@ bool CMakeTool::isValid() const return m_introspection->m_didRun; } -Utils::SynchronousProcessResponse CMakeTool::run(const QStringList &args, bool mayFail) const +Utils::SynchronousProcessResponse CMakeTool::run(const QStringList &args, int timeoutS) const { - if (m_introspection->m_didAttemptToRun && !m_introspection->m_didRun) { - Utils::SynchronousProcessResponse response; - response.result = Utils::SynchronousProcessResponse::StartFailed; - return response; - } - Utils::SynchronousProcess cmake; - cmake.setTimeoutS(1); + cmake.setTimeoutS(timeoutS); cmake.setFlags(Utils::SynchronousProcess::UnixTerminalDisabled); Utils::Environment env = Utils::Environment::systemEnvironment(); Utils::Environment::setupEnglishOutput(&env); cmake.setProcessEnvironment(env.toProcessEnvironment()); cmake.setTimeOutMessageBoxEnabled(false); - Utils::SynchronousProcessResponse response = cmake.runBlocking({cmakeExecutable(), args}); - m_introspection->m_didAttemptToRun = true; - m_introspection->m_didRun = mayFail ? true : (response.result == Utils::SynchronousProcessResponse::Finished); - return response; + return cmake.runBlocking({cmakeExecutable(), args}); } QVariantMap CMakeTool::toMap() const @@ -298,21 +289,21 @@ QList<CMakeTool::Generator> CMakeTool::supportedGenerators() const TextEditor::Keywords CMakeTool::keywords() { - if (m_introspection->m_functions.isEmpty()) { + if (m_introspection->m_functions.isEmpty() && m_introspection->m_didRun) { Utils::SynchronousProcessResponse response; - response = run({"--help-command-list"}); + response = run({"--help-command-list"}, 5); if (response.result == Utils::SynchronousProcessResponse::Finished) m_introspection->m_functions = response.stdOut().split('\n'); - response = run({"--help-commands"}); + response = run({"--help-commands"}, 5); if (response.result == Utils::SynchronousProcessResponse::Finished) parseFunctionDetailsOutput(response.stdOut()); - response = run({"--help-property-list"}); + response = run({"--help-property-list"}, 5); if (response.result == Utils::SynchronousProcessResponse::Finished) m_introspection->m_variables = parseVariableOutput(response.stdOut()); - response = run({"--help-variable-list"}); + response = run({"--help-variable-list"}, 5); if (response.result == Utils::SynchronousProcessResponse::Finished) { m_introspection->m_variables.append(parseVariableOutput(response.stdOut())); m_introspection->m_variables = Utils::filteredUnique(m_introspection->m_variables); @@ -417,25 +408,30 @@ Utils::FilePath CMakeTool::searchQchFile(const Utils::FilePath &executable) void CMakeTool::readInformation(CMakeTool::QueryType type) const { + if (!m_introspection->m_didRun && m_introspection->m_didAttemptToRun) + return; + + m_introspection->m_didAttemptToRun = true; + if (!m_introspection->m_triedCapabilities) { fetchFromCapabilities(); m_introspection->m_triedCapabilities = true; m_introspection->m_queriedServerMode = true; // Got added after "-E capabilities" support! - } - - if ((type == QueryType::GENERATORS && !m_introspection->m_generators.isEmpty()) - || (type == QueryType::SERVER_MODE && m_introspection->m_queriedServerMode) - || (type == QueryType::VERSION && !m_introspection->m_version.fullVersion.isEmpty())) - return; - - if (type == QueryType::GENERATORS) { - fetchGeneratorsFromHelp(); - } else if (type == QueryType::SERVER_MODE) { - // Nothing to do... - } else if (type == QueryType::VERSION) { - fetchVersionFromVersionOutput(); } else { - QTC_ASSERT(false, return ); + if ((type == QueryType::GENERATORS && !m_introspection->m_generators.isEmpty()) + || (type == QueryType::SERVER_MODE && m_introspection->m_queriedServerMode) + || (type == QueryType::VERSION && !m_introspection->m_version.fullVersion.isEmpty())) + return; + + if (type == QueryType::GENERATORS) { + fetchGeneratorsFromHelp(); + } else if (type == QueryType::SERVER_MODE) { + // Nothing to do... + } else if (type == QueryType::VERSION) { + fetchVersionFromVersionOutput(); + } else { + QTC_ASSERT(false, return ); + } } } @@ -533,9 +529,11 @@ QStringList CMakeTool::parseVariableOutput(const QString &output) void CMakeTool::fetchGeneratorsFromHelp() const { Utils::SynchronousProcessResponse response = run({"--help"}); - if (response.result != Utils::SynchronousProcessResponse::Finished) - return; - parseGeneratorsFromHelp(response.stdOut().split('\n')); + m_introspection->m_didRun = m_introspection->m_didRun + && response.result == Utils::SynchronousProcessResponse::Finished; + + if (response.result == Utils::SynchronousProcessResponse::Finished) + parseGeneratorsFromHelp(response.stdOut().split('\n')); } void CMakeTool::parseGeneratorsFromHelp(const QStringList &lines) const @@ -588,10 +586,12 @@ void CMakeTool::parseGeneratorsFromHelp(const QStringList &lines) const void CMakeTool::fetchVersionFromVersionOutput() const { Utils::SynchronousProcessResponse response = run({"--version"}); - if (response.result != Utils::SynchronousProcessResponse::Finished) - return; - parseVersionFormVersionOutput(response.stdOut().split('\n')); + m_introspection->m_didRun = m_introspection->m_didRun + && response.result == Utils::SynchronousProcessResponse::Finished; + + if (response.result == Utils::SynchronousProcessResponse::Finished) + parseVersionFormVersionOutput(response.stdOut().split('\n')); } void CMakeTool::parseVersionFormVersionOutput(const QStringList &lines) const @@ -612,11 +612,10 @@ void CMakeTool::parseVersionFormVersionOutput(const QStringList &lines) const void CMakeTool::fetchFromCapabilities() const { - Utils::SynchronousProcessResponse response = run({"-E", "capabilities"}, true); - if (response.result != Utils::SynchronousProcessResponse::Finished) - return; + Utils::SynchronousProcessResponse response = run({"-E", "capabilities"}); - parseFromCapabilities(response.stdOut()); + if (response.result == Utils::SynchronousProcessResponse::Finished) + parseFromCapabilities(response.stdOut()); } static int getVersion(const QVariantMap &obj, const QString value) diff --git a/src/plugins/cmakeprojectmanager/cmaketool.h b/src/plugins/cmakeprojectmanager/cmaketool.h index 1e305b2dd3..fd2c087c20 100644 --- a/src/plugins/cmakeprojectmanager/cmaketool.h +++ b/src/plugins/cmakeprojectmanager/cmaketool.h @@ -126,7 +126,7 @@ private: }; void readInformation(QueryType type) const; - Utils::SynchronousProcessResponse run(const QStringList &args, bool mayFail = false) const; + Utils::SynchronousProcessResponse run(const QStringList &args, int timeoutS = 1) const; void parseFunctionDetailsOutput(const QString &output); QStringList parseVariableOutput(const QString &output); diff --git a/src/plugins/coreplugin/editormanager/editorview.cpp b/src/plugins/coreplugin/editormanager/editorview.cpp index 193a675833..01e838f83c 100644 --- a/src/plugins/coreplugin/editormanager/editorview.cpp +++ b/src/plugins/coreplugin/editormanager/editorview.cpp @@ -735,7 +735,7 @@ EditorView *SplitterOrView::takeView() return oldView; } -void SplitterOrView::split(Qt::Orientation orientation) +void SplitterOrView::split(Qt::Orientation orientation, bool activateView) { Q_ASSERT(m_view && m_splitter == nullptr); m_splitter = new MiniSplitter(this); @@ -766,7 +766,8 @@ void SplitterOrView::split(Qt::Orientation orientation) otherView->view()->setCloseSplitIcon(Utils::Icons::CLOSE_SPLIT_BOTTOM.icon()); } - EditorManagerPrivate::activateView(otherView->view()); + if (activateView) + EditorManagerPrivate::activateView(otherView->view()); emit splitStateChanged(); } @@ -933,7 +934,7 @@ void SplitterOrView::restoreState(const QByteArray &state) qint32 orientation; QByteArray splitter, first, second; stream >> orientation >> splitter >> first >> second; - split((Qt::Orientation)orientation); + split((Qt::Orientation) orientation, false); m_splitter->restoreState(splitter); static_cast<SplitterOrView*>(m_splitter->widget(0))->restoreState(first); static_cast<SplitterOrView*>(m_splitter->widget(1))->restoreState(second); diff --git a/src/plugins/coreplugin/editormanager/editorview.h b/src/plugins/coreplugin/editormanager/editorview.h index 7187989579..752addecb3 100644 --- a/src/plugins/coreplugin/editormanager/editorview.h +++ b/src/plugins/coreplugin/editormanager/editorview.h @@ -173,7 +173,7 @@ public: explicit SplitterOrView(EditorView *view); ~SplitterOrView() override; - void split(Qt::Orientation orientation); + void split(Qt::Orientation orientation, bool activateView = true); void unsplit(); inline bool isView() const { return m_view != nullptr; } diff --git a/src/plugins/cpptools/headerpathfilter.cpp b/src/plugins/cpptools/headerpathfilter.cpp index 2fa71b58b2..b656f8e136 100644 --- a/src/plugins/cpptools/headerpathfilter.cpp +++ b/src/plugins/cpptools/headerpathfilter.cpp @@ -116,7 +116,7 @@ QString clangIncludeDirectory(const QString &clangVersion, const QString &clangR #else Q_UNUSED(clangVersion) Q_UNUSED(clangResourceDirectory) - return CLANG_RESOURCE_DIR; + return {CLANG_RESOURCE_DIR}; #endif } diff --git a/src/plugins/debugger/stackhandler.cpp b/src/plugins/debugger/stackhandler.cpp index 65c6f09264..ea26e92999 100644 --- a/src/plugins/debugger/stackhandler.cpp +++ b/src/plugins/debugger/stackhandler.cpp @@ -457,33 +457,31 @@ bool StackHandler::contextMenuEvent(const ItemViewEvent &ev) void StackHandler::copyContentsToClipboard() { - QString str; - int n = rowCount(); - int m = columnCount(QModelIndex()); + const int m = columnCount(QModelIndex()); QVector<int> largestColumnWidths(m, 0); // First, find the widths of the largest columns, // so that we can print them out nicely aligned. - for (int i = 0; i != n; ++i) { + forItemsAtLevel<2>([m, &largestColumnWidths](StackFrameItem *item) { for (int j = 0; j < m; ++j) { - const QModelIndex idx = index(i, j); - const int columnWidth = data(idx, Qt::DisplayRole).toString().size(); + const int columnWidth = item->data(j, Qt::DisplayRole).toString().size(); if (columnWidth > largestColumnWidths.at(j)) largestColumnWidths[j] = columnWidth; } - } + }); - for (int i = 0; i != n; ++i) { + QString str; + forItemsAtLevel<2>([m, largestColumnWidths, &str](StackFrameItem *item) { for (int j = 0; j != m; ++j) { - QModelIndex idx = index(i, j); - const QString columnEntry = data(idx, Qt::DisplayRole).toString(); + const QString columnEntry = item->data(j, Qt::DisplayRole).toString(); str += columnEntry; const int difference = largestColumnWidths.at(j) - columnEntry.size(); // Add one extra space between columns. - str += QString().fill(' ', difference > 0 ? difference + 1 : 1); + str += QString(qMax(difference, 0) + 1, QChar(' ')); } str += '\n'; - } + }); + QClipboard *clipboard = QApplication::clipboard(); clipboard->setText(str, QClipboard::Selection); clipboard->setText(str, QClipboard::Clipboard); diff --git a/src/plugins/help/qlitehtml/CMakeLists.txt b/src/plugins/help/qlitehtml/CMakeLists.txt index 357e60cf2c..6dde535396 100644 --- a/src/plugins/help/qlitehtml/CMakeLists.txt +++ b/src/plugins/help/qlitehtml/CMakeLists.txt @@ -5,7 +5,7 @@ project(QLiteHtml) if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/litehtml/CMakeLists.txt) set(ORIG_FPIC ${CMAKE_POSITION_INDEPENDENT_CODE}) if (WIN32) - set(LITEHTML_UTF8 ON) + set(LITEHTML_UTF8 ON CACHE BOOL "") endif() set(CMAKE_POSITION_INDEPENDENT_CODE ON) add_subdirectory(litehtml) diff --git a/src/plugins/languageclient/languageclientmanager.cpp b/src/plugins/languageclient/languageclientmanager.cpp index defbd0bdac..543ec74a20 100644 --- a/src/plugins/languageclient/languageclientmanager.cpp +++ b/src/plugins/languageclient/languageclientmanager.cpp @@ -503,9 +503,9 @@ void LanguageClientManager::findLinkAt(TextEditor::TextDocument *document, } } }); - for (Client *interface : reachableClients()) { - if (interface->findLinkAt(request)) - m_exclusiveRequests[request.id()] << interface; + if (Client *client = clientForUri(uri)) { + if (client->reachable()) + client->findLinkAt(request); } } diff --git a/src/plugins/mcusupport/mcusupportconstants.h b/src/plugins/mcusupport/mcusupportconstants.h index 4643ed3475..cc9233eee4 100644 --- a/src/plugins/mcusupport/mcusupportconstants.h +++ b/src/plugins/mcusupport/mcusupportconstants.h @@ -28,23 +28,15 @@ namespace McuSupport { namespace Constants { -const char TOOLCHAIN_TYPEID[] = "McuSupport.ToolChain.ARM-GCC"; const char DEVICE_TYPE[] = "McuSupport.DeviceType"; const char DEVICE_ID[] = "McuSupport.Device"; -const char MCUSUPPORT_QT_VERSION[] = "Qt4ProjectManager.QtVersion.McuSupport"; const char RUNCONFIGURATION[] = "McuSupport.RunConfiguration"; const char SETTINGS_ID[] = "CC.McuSupport.Configuration"; -const char KIT_BOARD_VENDOR_KEY[] = "McuSupport.BoardVendor"; -const char KIT_BOARD_MODEL_KEY[] = "McuSupport.BoardModel"; - -const char ENVVAR_ARMGCC_DIR[] = "ARMGCC_DIR"; -const char ENVVAR_STM32CUBE_FW_F7_SDK_PATH[] = "STM32Cube_FW_F7_SDK_PATH"; +const char KIT_MCUTARGET_VENDOR_KEY[] = "McuSupport.McuTargetVendor"; +const char KIT_MCUTARGET_MODEL_KEY[] = "McuSupport.McuTargetModel"; const char SETTINGS_GROUP[] = "McuSupport"; -const char SETTINGS_KEY_PACKAGE_PREFIX[] = "package_"; -const char SETTINGS_KEY_PACKAGE_ARMGCC[] = "ArmGcc"; -const char SETTINGS_KEY_STM32CUBE_FW_F7_SDK_PATH[] = "STM32Cube_FW_F7_SDK_PATH"; -const char SETTINGS_KEY_STM32CUBE_PROGRAMMER_PATH[] = "STM32Cube_Cube_Programmer_Path"; +const char SETTINGS_KEY_PACKAGE_PREFIX[] = "Package_"; } // namespace McuSupport } // namespace Constants diff --git a/src/plugins/mcusupport/mcusupportoptions.cpp b/src/plugins/mcusupport/mcusupportoptions.cpp index 4352f49f1f..10147d2ac3 100644 --- a/src/plugins/mcusupport/mcusupportoptions.cpp +++ b/src/plugins/mcusupport/mcusupportoptions.cpp @@ -54,8 +54,8 @@ namespace McuSupport { namespace Internal { -PackageOptions::PackageOptions(const QString &label, const QString &defaultPath, - const QString &detectionPath, const QString &settingsKey) +McuPackage::McuPackage(const QString &label, const QString &defaultPath, + const QString &detectionPath, const QString &settingsKey) : m_label(label) , m_defaultPath(defaultPath) , m_detectionPath(detectionPath) @@ -68,33 +68,28 @@ PackageOptions::PackageOptions(const QString &label, const QString &defaultPath, s->endGroup(); } -QString PackageOptions::path() const +QString McuPackage::path() const { return QFileInfo(m_fileChooser->path() + m_relativePathModifier).absoluteFilePath(); } -QString PackageOptions::label() const +QString McuPackage::label() const { return m_label; } -QString PackageOptions::detectionPath() const +QString McuPackage::detectionPath() const { return m_detectionPath; } -QWidget *PackageOptions::widget() +QWidget *McuPackage::widget() { if (m_widget) return m_widget; m_widget = new QWidget; m_fileChooser = new Utils::PathChooser; - QObject::connect(m_fileChooser, &Utils::PathChooser::pathChanged, - [this](){ - updateStatus(); - emit changed(); - }); auto layout = new QGridLayout(m_widget); layout->setContentsMargins(0, 0, 0, 0); @@ -119,41 +114,49 @@ QWidget *PackageOptions::widget() layout->addWidget(m_statusIcon, 1, 0); layout->addWidget(m_statusLabel, 1, 1, 1, -1); - m_fileChooser->setPath(m_path); // Triggers updateStatus() call + m_fileChooser->setPath(m_path); + + QObject::connect(m_fileChooser, &Utils::PathChooser::pathChanged, + [this](){ + updateStatus(); + emit changed(); + }); + + updateStatus(); return m_widget; } -PackageOptions::Status PackageOptions::status() const +McuPackage::Status McuPackage::status() const { return m_status; } -void PackageOptions::setDownloadUrl(const QString &url) +void McuPackage::setDownloadUrl(const QString &url) { m_downloadUrl = url; } -void PackageOptions::setEnvironmentVariableName(const QString &name) +void McuPackage::setEnvironmentVariableName(const QString &name) { m_environmentVariableName = name; } -QString PackageOptions::environmentVariableName() const +QString McuPackage::environmentVariableName() const { return m_environmentVariableName; } -void PackageOptions::setAddToPath(bool addToPath) +void McuPackage::setAddToPath(bool addToPath) { m_addToPath = addToPath; } -bool PackageOptions::addToPath() const +bool McuPackage::addToPath() const { return m_addToPath; } -void PackageOptions::writeToSettings() const +void McuPackage::writeToSettings() const { if (m_path.compare(m_defaultPath) == 0) return; @@ -163,12 +166,12 @@ void PackageOptions::writeToSettings() const s->endGroup(); } -void PackageOptions::setRelativePathModifier(const QString &path) +void McuPackage::setRelativePathModifier(const QString &path) { m_relativePathModifier = path; } -void PackageOptions::updateStatus() +void McuPackage::updateStatus() { m_path = m_fileChooser->rawPath(); const bool validPath = m_fileChooser->isValid(); @@ -198,54 +201,78 @@ void PackageOptions::updateStatus() m_statusLabel->setText(statusText); } -BoardOptions::BoardOptions(const QString &vendor, const QString &model, - const QString &toolChainFileName, const QString &qulPlatform, - const QVector<PackageOptions*> &packages) +McuTarget::McuTarget(const QString &vendor, const QString &model, + const QVector<McuPackage*> &packages) : m_vendor(vendor) , m_model(model) - , m_toolChainFile(toolChainFileName) - , m_qulPlatform(qulPlatform) , m_packages(packages) { } -QString BoardOptions::model() const +QString McuTarget::vendor() const +{ + return m_vendor; +} + +QString McuTarget::model() const { return m_model; } -QString BoardOptions::toolChainFile() const +QVector<McuPackage *> McuTarget::packages() const +{ + return m_packages; +} + +void McuTarget::setToolChainFile(const QString &toolChainFile) +{ + m_toolChainFile = toolChainFile; +} + +QString McuTarget::toolChainFile() const { return m_toolChainFile; } -QString BoardOptions::qulPlatform() const +void McuTarget::setQulPlatform(const QString &qulPlatform) +{ + m_qulPlatform = qulPlatform; +} + +QString McuTarget::qulPlatform() const { return m_qulPlatform; } -QVector<PackageOptions *> BoardOptions::packages() const +bool McuTarget::isValid() const { - return m_packages; + return !Utils::anyOf(packages(), [](McuPackage *package) { + return package->status() != McuPackage::ValidPackage; + }); } -QString BoardOptions::vendor() const +int McuTarget::colorDepth() const { - return m_vendor; + return m_colorDepth; +} + +void McuTarget::setColorDepth(int colorDepth) +{ + m_colorDepth = colorDepth; } -static PackageOptions *createQulPackage() +static McuPackage *createQtForMCUsPackage() { - auto result = new PackageOptions( - PackageOptions::tr("Qt MCU SDK"), + auto result = new McuPackage( + McuPackage::tr("Qt for MCUs SDK"), QDir::homePath(), Utils::HostOsInfo::withExecutableSuffix("bin/qmltocpp"), - "qulSdk"); + "QtMCUSdk"); result->setEnvironmentVariableName("Qul_DIR"); return result; } -static PackageOptions *createArmGccPackage() +static McuPackage *createArmGccPackage() { const char envVar[] = "ARMGCC_DIR"; @@ -267,43 +294,43 @@ static PackageOptions *createArmGccPackage() if (defaultPath.isEmpty()) defaultPath = QDir::homePath(); - auto result = new PackageOptions( - PackageOptions::tr("GNU Arm Embedded Toolchain"), + auto result = new McuPackage( + McuPackage::tr("GNU Arm Embedded Toolchain"), defaultPath, Utils::HostOsInfo::withExecutableSuffix("bin/arm-none-eabi-g++"), - Constants::SETTINGS_KEY_PACKAGE_ARMGCC); + "GNUArmEmbeddedToolchain"); result->setDownloadUrl( "https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads"); result->setEnvironmentVariableName(envVar); return result; } -static PackageOptions *createStm32CubeFwF7SdkPackage() +static McuPackage *createStm32CubeFwF7SdkPackage() { - auto result = new PackageOptions( - PackageOptions::tr("STM32Cube SDK"), + auto result = new McuPackage( + McuPackage::tr("STM32Cube SDK"), "%{Env:STM32Cube_FW_F7_SDK_PATH}", "Drivers/STM32F7xx_HAL_Driver", - "stm32CubeFwF7Sdk"); + "Stm32CubeFwF7Sdk"); result->setDownloadUrl( "https://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-mcu-packages/stm32cubef7.html"); result->setEnvironmentVariableName("STM32Cube_FW_F7_SDK_PATH"); return result; } -static PackageOptions *createStm32CubeProgrammerPackage() +static McuPackage *createStm32CubeProgrammerPackage() { const QString defaultPath = Utils::HostOsInfo::isWindowsHost() ? QDir::fromNativeSeparators(qEnvironmentVariable("ProgramFiles")) + "/STMicroelectronics/STM32Cube/STM32CubeProgrammer/" : QDir::homePath(); - auto result = new PackageOptions( - PackageOptions::tr("STM32CubeProgrammer"), + auto result = new McuPackage( + McuPackage::tr("STM32CubeProgrammer"), defaultPath, QLatin1String(Utils::HostOsInfo::isWindowsHost() ? "/bin/STM32_Programmer_CLI.exe" : "/bin/STM32_Programmer.sh"), - "stm32CubeProgrammer"); + "Stm32CubeProgrammer"); result->setRelativePathModifier("/bin"); result->setDownloadUrl( "https://www.st.com/en/development-tools/stm32cubeprog.html"); @@ -311,29 +338,29 @@ static PackageOptions *createStm32CubeProgrammerPackage() return result; } -static PackageOptions *createEvkbImxrt1050SdkPackage() +static McuPackage *createEvkbImxrt1050SdkPackage() { - auto result = new PackageOptions( - PackageOptions::tr("NXP i.MXRT SDK"), + auto result = new McuPackage( + McuPackage::tr("NXP i.MXRT SDK"), "%{Env:EVKB_IMXRT1050_SDK_PATH}", // TODO: Try to not use 1050 specifics "EVKB-IMXRT1050_manifest_v3_5.xml", - "evkbImxrt1050Sdk"); + "EvkbImxrt1050Sdk"); result->setDownloadUrl("https://mcuxpresso.nxp.com/en/welcome"); return result; } -static PackageOptions *createSeggerJLinkPackage() +static McuPackage *createSeggerJLinkPackage() { const QString defaultPath = Utils::HostOsInfo::isWindowsHost() ? QDir::fromNativeSeparators(qEnvironmentVariable("ProgramFiles(x86)")) + "/SEGGER/JLink" : QString("%{Env:SEGGER_JLINK_SOFTWARE_AND_DOCUMENTATION_PATH}"); - auto result = new PackageOptions( - PackageOptions::tr("SEGGER JLink"), + auto result = new McuPackage( + McuPackage::tr("SEGGER JLink"), defaultPath, Utils::HostOsInfo::withExecutableSuffix("JLink"), - "seggerJLink"); + "SeggerJLink"); result->setDownloadUrl("https://www.segger.com/downloads/jlink"); result->setEnvironmentVariableName("SEGGER_JLINK_SOFTWARE_AND_DOCUMENTATION_PATH"); return result; @@ -342,38 +369,65 @@ static PackageOptions *createSeggerJLinkPackage() McuSupportOptions::McuSupportOptions(QObject *parent) : QObject(parent) { - PackageOptions* qulPackage = createQulPackage(); - PackageOptions* armGccPackage = createArmGccPackage(); - PackageOptions* stm32CubeFwF7SdkPackage = createStm32CubeFwF7SdkPackage(); - PackageOptions* stm32CubeProgrammerPackage = createStm32CubeProgrammerPackage(); - PackageOptions* evkbImxrt1050SdkPackage = createEvkbImxrt1050SdkPackage(); - PackageOptions* seggerJLinkPackage = createSeggerJLinkPackage(); - - toolchainPackage = armGccPackage; - - - auto stmPackages = {armGccPackage, stm32CubeFwF7SdkPackage, stm32CubeProgrammerPackage, - qulPackage}; - auto nxpPackages = {armGccPackage, evkbImxrt1050SdkPackage, seggerJLinkPackage, - qulPackage}; - auto desktopPackages = {qulPackage}; - packages = {armGccPackage, stm32CubeFwF7SdkPackage, stm32CubeProgrammerPackage, - evkbImxrt1050SdkPackage, seggerJLinkPackage, qulPackage}; + qtForMCUsSdkPackage = createQtForMCUsPackage(); + armGccPackage = createArmGccPackage(); + McuPackage* stm32CubeFwF7SdkPackage = createStm32CubeFwF7SdkPackage(); + McuPackage* stm32CubeProgrammerPackage = createStm32CubeProgrammerPackage(); + McuPackage* evkbImxrt1050SdkPackage = createEvkbImxrt1050SdkPackage(); + McuPackage* seggerJLinkPackage = createSeggerJLinkPackage(); + + auto stmEvalPackages = { + armGccPackage, stm32CubeProgrammerPackage, qtForMCUsSdkPackage}; + auto stmEngPackages = { + armGccPackage, stm32CubeFwF7SdkPackage, stm32CubeProgrammerPackage, qtForMCUsSdkPackage}; + auto nxpEvalPackages = { + armGccPackage, seggerJLinkPackage, qtForMCUsSdkPackage}; + auto nxpEngPackages = { + armGccPackage, evkbImxrt1050SdkPackage, seggerJLinkPackage, qtForMCUsSdkPackage}; + auto desktopPackages = { + qtForMCUsSdkPackage}; + packages = { + armGccPackage, stm32CubeFwF7SdkPackage, stm32CubeProgrammerPackage, evkbImxrt1050SdkPackage, + seggerJLinkPackage, qtForMCUsSdkPackage}; const QString vendorStm = "STM"; const QString vendorNxp = "NXP"; const QString vendorQt = "Qt"; - boards.append(new BoardOptions(vendorStm, - "stm32f7508", "CMake/stm32f7508-discovery.cmake", "", stmPackages)); - boards.append(new BoardOptions(vendorStm, - "stm32f769i", "CMake/stm32f769i-discovery.cmake", "", stmPackages)); - boards.append(new BoardOptions(vendorNxp, - "evkbimxrt1050", "CMake/evkbimxrt1050-toolchain.cmake", "", nxpPackages)); - boards.append(new BoardOptions(vendorQt, - "Desktop", "", "Qt", desktopPackages)); + + // STM + auto mcuTarget = new McuTarget(vendorStm, "stm32f7508", stmEvalPackages); + mcuTarget->setToolChainFile("CMake/stm32f7508-discovery.cmake"); + mcuTarget->setColorDepth(32); + mcuTargets.append(mcuTarget); + + mcuTarget = new McuTarget(vendorStm, "stm32f7508", stmEvalPackages); + mcuTarget->setToolChainFile("CMake/stm32f7508-discovery.cmake"); + mcuTarget->setColorDepth(16); + mcuTargets.append(mcuTarget); + + mcuTarget = new McuTarget(vendorStm, "stm32f769i", stmEvalPackages); + mcuTarget->setToolChainFile("CMake/stm32f769i-discovery.cmake"); + mcuTargets.append(mcuTarget); + + mcuTarget = new McuTarget(vendorStm, "Engineering", stmEngPackages); + mcuTargets.append(mcuTarget); + + // NXP + mcuTarget = new McuTarget(vendorNxp, "evkbimxrt1050", nxpEvalPackages); + mcuTarget->setToolChainFile("CMake/evkbimxrt1050-toolchain.cmake"); + mcuTargets.append(mcuTarget); + + mcuTarget = new McuTarget(vendorNxp, "Engineering", nxpEngPackages); + mcuTargets.append(mcuTarget); + + // Desktop + mcuTarget = new McuTarget(vendorQt, "Desktop", desktopPackages); + mcuTarget->setQulPlatform("Qt"); + mcuTarget->setColorDepth(32); + mcuTargets.append(mcuTarget); for (auto package : packages) - connect(package, &PackageOptions::changed, [this](){ + connect(package, &McuPackage::changed, [this](){ emit changed(); }); } @@ -382,16 +436,8 @@ McuSupportOptions::~McuSupportOptions() { qDeleteAll(packages); packages.clear(); - qDeleteAll(boards); - boards.clear(); -} - -QVector<BoardOptions *> McuSupportOptions::validBoards() const -{ - return Utils::filtered(boards, [](BoardOptions *board){ - return !Utils::anyOf(board->packages(), [](PackageOptions *package){ - return package->status() != PackageOptions::ValidPackage;}); - }); + qDeleteAll(mcuTargets); + mcuTargets.clear(); } static ProjectExplorer::ToolChain* armGccToolchain(const Utils::FilePath &path, Core::Id language) @@ -420,20 +466,24 @@ static ProjectExplorer::ToolChain* armGccToolchain(const Utils::FilePath &path, return toolChain; } -static bool isDesktop(const BoardOptions* board) +static bool mcuTargetIsDesktop(const McuTarget* mcuTarget) { - return board->qulPlatform() == "Qt"; + return mcuTarget->qulPlatform() == "Qt"; } -static void setKitProperties(ProjectExplorer::Kit *k, const BoardOptions* board) +static void setKitProperties(const QString &kitName, ProjectExplorer::Kit *k, + const McuTarget* mcuTarget) { using namespace ProjectExplorer; - k->setUnexpandedDisplayName("QtMCU - " + board->model()); - k->setValue(Constants::KIT_BOARD_VENDOR_KEY, board->vendor()); - k->setValue(Constants::KIT_BOARD_MODEL_KEY, board->model()); - k->setAutoDetected(false); - if (!isDesktop(board)) { + k->setUnexpandedDisplayName(kitName); + k->setValue(Constants::KIT_MCUTARGET_VENDOR_KEY, mcuTarget->vendor()); + k->setValue(Constants::KIT_MCUTARGET_MODEL_KEY, mcuTarget->model()); + k->setAutoDetected(true); + k->makeSticky(); + if (mcuTargetIsDesktop(mcuTarget)) { + k->setDeviceTypeForIcon(Constants::DEVICE_TYPE); + } else { k->setIrrelevantAspects({SysRootKitAspect::id(), "QtSupport.QtInformation" // QtKitAspect::id() }); @@ -468,7 +518,7 @@ static void setKitDebugger(ProjectExplorer::Kit *k, const QString &armGccPath) DebuggerItem newDebugger; newDebugger.setCommand(command); newDebugger.setUnexpandedDisplayName( - PackageOptions::tr("Arm GDB at %1").arg(command.toUserOutput())); + McuPackage::tr("Arm GDB at %1").arg(command.toUserOutput())); debuggerId = DebuggerItemManager::registerDebugger(newDebugger); } else { debuggerId = debugger->id(); @@ -484,13 +534,13 @@ static void setKitDevice(ProjectExplorer::Kit *k) DeviceTypeKitAspect::setDeviceTypeId(k, Constants::DEVICE_TYPE); } -static void setKitEnvironment(ProjectExplorer::Kit *k, const BoardOptions* board) +static void setKitEnvironment(ProjectExplorer::Kit *k, const McuTarget* mcuTarget) { using namespace ProjectExplorer; Utils::EnvironmentItems changes; QStringList pathAdditions; - for (auto package : board->packages()) { + for (auto package : mcuTarget->packages()) { if (package->addToPath()) pathAdditions.append(QDir::toNativeSeparators(package->path())); if (!package->environmentVariableName().isEmpty()) @@ -505,55 +555,72 @@ static void setKitEnvironment(ProjectExplorer::Kit *k, const BoardOptions* board EnvironmentKitAspect::setEnvironmentChanges(k, changes); } -static void setKitCMakeOptions(ProjectExplorer::Kit *k, const BoardOptions* board) +static void setKitCMakeOptions(ProjectExplorer::Kit *k, const McuTarget* mcuTarget, + const QString &qulDir) { using namespace CMakeProjectManager; CMakeConfig config = CMakeConfigurationKitAspect::configuration(k); - if (!board->toolChainFile().isEmpty()) + config.append(CMakeConfigItem("CMAKE_CXX_COMPILER", "%{Compiler:Executable:Cxx}")); + config.append(CMakeConfigItem("CMAKE_C_COMPILER", "%{Compiler:Executable:C}")); + if (!mcuTarget->toolChainFile().isEmpty()) config.append(CMakeConfigItem("CMAKE_TOOLCHAIN_FILE", - ("%{CurrentBuild:Env:Qul_DIR}/" + - board->toolChainFile()).toUtf8())); - if (!board->qulPlatform().isEmpty()) + (qulDir + "/" + mcuTarget->toolChainFile()).toUtf8())); + if (!mcuTarget->qulPlatform().isEmpty()) config.append(CMakeConfigItem("QUL_PLATFORM", - board->qulPlatform().toUtf8())); - if (isDesktop(board)) { + mcuTarget->qulPlatform().toUtf8())); + if (mcuTargetIsDesktop(mcuTarget)) config.append(CMakeConfigItem("CMAKE_PREFIX_PATH", "%{Qt:QT_INSTALL_PREFIX}")); - // TODO: Hack! Implement color depth variants of all targets - config.append(CMakeConfigItem("QUL_COLOR_DEPTH", "32")); - } + if (mcuTarget->colorDepth() >= 0) + config.append(CMakeConfigItem("QUL_COLOR_DEPTH", + QString::number(mcuTarget->colorDepth()).toLatin1())); CMakeConfigurationKitAspect::setConfiguration(k, config); if (Utils::HostOsInfo::isWindowsHost()) CMakeGeneratorKitAspect::setGenerator(k, "NMake Makefiles JOM"); } -ProjectExplorer::Kit *McuSupportOptions::kit(const BoardOptions* board) +QString McuSupportOptions::kitName(const McuTarget *mcuTarget) const { - using namespace ProjectExplorer; + // TODO: get version from qulSdkPackage and insert into name + const QString colorDepth = mcuTarget->colorDepth() > 0 + ? QString::fromLatin1(" %1bpp").arg(mcuTarget->colorDepth()) + : ""; + return QString::fromLatin1("Qt for MCUs - %1 %2%3") + .arg(mcuTarget->vendor(), mcuTarget->model(), colorDepth); +} - Kit *kit = KitManager::kit([board](const Kit *k){ - return board->model() == k->value(Constants::KIT_BOARD_MODEL_KEY).toString(); +QList<ProjectExplorer::Kit *> McuSupportOptions::existingKits(const McuTarget *mcuTargt) +{ + using namespace ProjectExplorer; + const QString mcuTargetKitName = kitName(mcuTargt); + return Utils::filtered(KitManager::kits(), [&mcuTargetKitName](Kit *kit) { + return kit->isAutoDetected() && kit->unexpandedDisplayName() == mcuTargetKitName; }); - if (!kit) { - const QString armGccPath = toolchainPackage->path(); - const auto init = [board, &armGccPath](Kit *k) { - KitGuard kitGuard(k); - - setKitProperties(k, board); - if (!isDesktop(board)) { - setKitToolchains(k, armGccPath); - setKitDebugger(k, armGccPath); - setKitDevice(k); - } - setKitEnvironment(k, board); - setKitCMakeOptions(k, board); +} - k->setup(); - k->fix(); - }; - kit = KitManager::registerKit(init); - } - return kit; +ProjectExplorer::Kit *McuSupportOptions::newKit(const McuTarget *mcuTarget) +{ + using namespace ProjectExplorer; + + const QString armGccPath = armGccPackage->path(); + const QString qulDir = qtForMCUsSdkPackage->path(); + const auto init = [this, mcuTarget](Kit *k) { + KitGuard kitGuard(k); + + setKitProperties(kitName(mcuTarget), k, mcuTarget); + if (!mcuTargetIsDesktop(mcuTarget)) { + setKitToolchains(k, armGccPackage->path()); + setKitDebugger(k, armGccPackage->path()); + setKitDevice(k); + } + setKitEnvironment(k, mcuTarget); + setKitCMakeOptions(k, mcuTarget, qtForMCUsSdkPackage->path()); + + k->setup(); + k->fix(); + }; + + return KitManager::registerKit(init); } } // Internal diff --git a/src/plugins/mcusupport/mcusupportoptions.h b/src/plugins/mcusupport/mcusupportoptions.h index f7f2d84b39..f8cba93199 100644 --- a/src/plugins/mcusupport/mcusupportoptions.h +++ b/src/plugins/mcusupport/mcusupportoptions.h @@ -42,7 +42,7 @@ class Kit; namespace McuSupport { namespace Internal { -class PackageOptions : public QObject +class McuPackage : public QObject { Q_OBJECT @@ -53,8 +53,8 @@ public: ValidPackage }; - PackageOptions(const QString &label, const QString &defaultPath, const QString &detectionPath, - const QString &settingsKey); + McuPackage(const QString &label, const QString &defaultPath, const QString &detectionPath, + const QString &settingsKey); QString path() const; QString label() const; @@ -96,26 +96,31 @@ private: Status m_status = InvalidPath; }; -class BoardOptions : public QObject +class McuTarget : public QObject { Q_OBJECT public: - BoardOptions(const QString &vendor, const QString &model, const QString &toolChainFile, - const QString &qulPlatform, const QVector<PackageOptions *> &packages); + McuTarget(const QString &vendor, const QString &model, const QVector<McuPackage *> &packages); QString vendor() const; QString model() const; + QVector<McuPackage *> packages() const; + void setToolChainFile(const QString &toolChainFile); QString toolChainFile() const; + void setQulPlatform(const QString &qulPlatform); QString qulPlatform() const; - QVector<PackageOptions *> packages() const; + void setColorDepth(int colorDepth); + int colorDepth() const; + bool isValid() const; private: const QString m_vendor; const QString m_model; - const QString m_toolChainFile; - const QString m_qulPlatform; - const QVector<PackageOptions*> m_packages; + const QVector<McuPackage*> m_packages; + QString m_toolChainFile; + QString m_qulPlatform; + int m_colorDepth = -1; }; class McuSupportOptions : public QObject @@ -126,13 +131,15 @@ public: McuSupportOptions(QObject *parent = nullptr); ~McuSupportOptions() override; - QVector<BoardOptions*> validBoards() const; + QVector<McuPackage*> packages; + QVector<McuTarget*> mcuTargets; + McuPackage *armGccPackage = nullptr; + McuPackage *qtForMCUsSdkPackage = nullptr; - QVector<PackageOptions*> packages; - QVector<BoardOptions*> boards; - PackageOptions *toolchainPackage = nullptr; + QString kitName(const McuTarget* mcuTarget) const; - ProjectExplorer::Kit *kit(const BoardOptions* board); + QList<ProjectExplorer::Kit *> existingKits(const McuTarget *mcuTargt); + ProjectExplorer::Kit *newKit(const McuTarget *mcuTarget); signals: void changed(); diff --git a/src/plugins/mcusupport/mcusupportoptionspage.cpp b/src/plugins/mcusupport/mcusupportoptionspage.cpp index 02c2044cf4..06bb9a86e6 100644 --- a/src/plugins/mcusupport/mcusupportoptionspage.cpp +++ b/src/plugins/mcusupport/mcusupportoptionspage.cpp @@ -28,6 +28,7 @@ #include "mcusupportoptions.h" #include <coreplugin/icore.h> +#include <projectexplorer/kitmanager.h> #include <projectexplorer/projectexplorerconstants.h> #include <utils/algorithm.h> #include <utils/qtcassert.h> @@ -49,16 +50,17 @@ public: McuSupportOptionsWidget(const McuSupportOptions *options, QWidget *parent = nullptr); void updateStatus(); - void showBoardPackages(int boardIndex); + void showMcuTargetPackages(); + McuTarget *currentMcuTarget() const; private: QString m_armGccPath; const McuSupportOptions *m_options; - int m_currentBoardIndex = 0; - QMap <PackageOptions*, QWidget*> m_packageWidgets; - QMap <BoardOptions*, QWidget*> m_boardPacketWidgets; + QMap <McuPackage*, QWidget*> m_packageWidgets; + QMap <McuTarget*, QWidget*> m_mcuTargetPacketWidgets; QFormLayout *m_packagesLayout = nullptr; QLabel *m_statusLabel = nullptr; + QComboBox *m_mcuTargetComboBox = nullptr; }; McuSupportOptionsWidget::McuSupportOptionsWidget(const McuSupportOptions *options, QWidget *parent) @@ -67,16 +69,18 @@ McuSupportOptionsWidget::McuSupportOptionsWidget(const McuSupportOptions *option { auto mainLayout = new QVBoxLayout(this); - auto boardChooserlayout = new QHBoxLayout; - auto boardChooserLabel = new QLabel(McuSupportOptionsPage::tr("Target:")); - boardChooserlayout->addWidget(boardChooserLabel); - auto boardComboBox = new QComboBox; - boardChooserLabel->setBuddy(boardComboBox); - boardChooserLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); - boardComboBox->addItems(Utils::transform<QStringList>(m_options->boards, [](BoardOptions *b){ - return b->model();})); - boardChooserlayout->addWidget(boardComboBox); - mainLayout->addLayout(boardChooserlayout); + auto mcuTargetChooserlayout = new QHBoxLayout; + auto mcuTargetChooserLabel = new QLabel(McuSupportOptionsPage::tr("Target:")); + mcuTargetChooserlayout->addWidget(mcuTargetChooserLabel); + m_mcuTargetComboBox = new QComboBox; + mcuTargetChooserLabel->setBuddy(m_mcuTargetComboBox); + mcuTargetChooserLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); + m_mcuTargetComboBox->addItems( + Utils::transform<QStringList>(m_options->mcuTargets, [this](McuTarget *t){ + return m_options->kitName(t); + })); + mcuTargetChooserlayout->addWidget(m_mcuTargetComboBox); + mainLayout->addLayout(mcuTargetChooserlayout); auto m_packagesGroupBox = new QGroupBox(McuSupportOptionsPage::tr("Packages")); mainLayout->addWidget(m_packagesGroupBox); @@ -84,57 +88,59 @@ McuSupportOptionsWidget::McuSupportOptionsWidget(const McuSupportOptions *option m_packagesGroupBox->setLayout(m_packagesLayout); m_statusLabel = new QLabel; - mainLayout->addWidget(m_statusLabel); - m_statusLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + mainLayout->addWidget(m_statusLabel, 2); m_statusLabel->setWordWrap(true); - m_statusLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft); + m_statusLabel->setAlignment(Qt::AlignBottom | Qt::AlignLeft); connect(options, &McuSupportOptions::changed, this, &McuSupportOptionsWidget::updateStatus); - connect(boardComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), - this, &McuSupportOptionsWidget::showBoardPackages); + connect(m_mcuTargetComboBox, &QComboBox::currentTextChanged, + this, &McuSupportOptionsWidget::showMcuTargetPackages); - showBoardPackages(m_currentBoardIndex); -} - -static QString ulOfBoardModels(const QVector<BoardOptions*> &validBoards) -{ - return "<ul><li>" - + Utils::transform<QStringList>(validBoards,[](BoardOptions* board) - {return board->model();}).join("</li><li>") - + "</li></ul>"; + showMcuTargetPackages(); + updateStatus(); } void McuSupportOptionsWidget::updateStatus() { - const QVector<BoardOptions*> validBoards = m_options->validBoards(); - m_statusLabel->setText(validBoards.isEmpty() - ? McuSupportOptionsPage::tr("No kits can currently be generated. " - "Select a target and provide the package paths. " - "Afterwards, press Apply to generate a kit for " - "your board.") - : McuSupportOptionsPage::tr("Kits for the following targets can be generated: " - "%1 " - "Press Apply to generate a kit for " - "your target.").arg(ulOfBoardModels(validBoards))); + const McuTarget *mcuTarget = currentMcuTarget(); + if (!mcuTarget) + return; + + m_statusLabel->setText(mcuTarget->isValid() + ? QString::fromLatin1("A kit <b>%1</b> for the selected target can be generated. " + "Press Apply to generate it.").arg(m_options->kitName( + mcuTarget)) + : QString::fromLatin1("Provide the package paths in order to create a kit for " + "your target.")); } -void McuSupportOptionsWidget::showBoardPackages(int boardIndex) +void McuSupportOptionsWidget::showMcuTargetPackages() { + const McuTarget *mcuTarget = currentMcuTarget(); + if (!mcuTarget) + return; + while (m_packagesLayout->rowCount() > 0) { QFormLayout::TakeRowResult row = m_packagesLayout->takeRow(0); row.labelItem->widget()->hide(); row.fieldItem->widget()->hide(); } - const BoardOptions *currentBoard = m_options->boards.at(boardIndex); - for (auto package : m_options->packages) { QWidget *packageWidget = package->widget(); - if (!currentBoard->packages().contains(package)) + if (!mcuTarget->packages().contains(package)) continue; m_packagesLayout->addRow(package->label(), packageWidget); packageWidget->show(); } + + updateStatus(); +} + +McuTarget *McuSupportOptionsWidget::currentMcuTarget() const +{ + const int mcuTargetIndex = m_mcuTargetComboBox->currentIndex(); + return m_options->mcuTargets.isEmpty() ? nullptr : m_options->mcuTargets.at(mcuTargetIndex); } McuSupportOptionsPage::McuSupportOptionsPage(QObject* parent) @@ -159,14 +165,18 @@ void McuSupportOptionsPage::apply() for (auto package : m_options->packages) package->writeToSettings(); - QTC_ASSERT(m_options->toolchainPackage, return); + QTC_ASSERT(m_options->armGccPackage, return); + QTC_ASSERT(m_options->qtForMCUsSdkPackage, return); - const QVector<BoardOptions*> validBoards = m_options->validBoards(); + const McuTarget *mcuTarget = m_widget->currentMcuTarget(); + if (!mcuTarget) + return; using namespace ProjectExplorer; - for (auto board : validBoards) - m_options->kit(board); + for (auto existingKit : m_options->existingKits(mcuTarget)) + ProjectExplorer::KitManager::deregisterKit(existingKit); + m_options->newKit(mcuTarget); } void McuSupportOptionsPage::finish() diff --git a/src/plugins/mcusupport/mcusupportrunconfiguration.cpp b/src/plugins/mcusupport/mcusupportrunconfiguration.cpp index 83acc2035b..47e2d6af4f 100644 --- a/src/plugins/mcusupport/mcusupportrunconfiguration.cpp +++ b/src/plugins/mcusupport/mcusupportrunconfiguration.cpp @@ -51,7 +51,7 @@ static CommandLine flashAndRunCommand(Target *target) // TODO: Hack! Implement flash target name handling, properly const QString targetName = - target->kit()->value(Constants::KIT_BOARD_VENDOR_KEY).toString() == "NXP" + target->kit()->value(Constants::KIT_MCUTARGET_VENDOR_KEY).toString() == "NXP" ? QString("flash_%1").arg(projectName) : QString("flash_%1_and_bootloader").arg(projectName); diff --git a/src/plugins/mcusupport/wizards/application/wizard.json b/src/plugins/mcusupport/wizards/application/wizard.json index 4583b48c2b..5e512f420a 100644 --- a/src/plugins/mcusupport/wizards/application/wizard.json +++ b/src/plugins/mcusupport/wizards/application/wizard.json @@ -51,6 +51,11 @@ "source": "main.qml.tpl", "target": "%{ProjectDirectory}/%{MainQmlFile}", "openInEditor": true + }, + { + "source": "%{IDE:ResourcePath}/templates/wizards/projects/git.ignore", + "target": ".gitignore", + "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" } ] } diff --git a/src/plugins/perfprofiler/perfloaddialog.cpp b/src/plugins/perfprofiler/perfloaddialog.cpp index a88c57ae64..b0602ed725 100644 --- a/src/plugins/perfprofiler/perfloaddialog.cpp +++ b/src/plugins/perfprofiler/perfloaddialog.cpp @@ -106,11 +106,8 @@ void PerfLoadDialog::chooseDefaults() ui->kitChooser->setCurrentKitId(target->kit()->id()); - ProjectExplorer::BuildConfiguration *buildConfig = target->activeBuildConfiguration(); - if (!buildConfig) - return; - - ui->executableDirLineEdit->setText(buildConfig->buildDirectory().toString()); + if (auto *bc = target->activeBuildConfiguration()) + ui->executableDirLineEdit->setText(bc->buildDirectory().toString()); } } // namespace Internal diff --git a/src/plugins/projectexplorer/kitinformation.cpp b/src/plugins/projectexplorer/kitinformation.cpp index d3c14a0250..500dd7d705 100644 --- a/src/plugins/projectexplorer/kitinformation.cpp +++ b/src/plugins/projectexplorer/kitinformation.cpp @@ -39,6 +39,7 @@ #include <coreplugin/variablechooser.h> #include <ssh/sshconnection.h> #include <utils/algorithm.h> +#include <utils/elidinglabel.h> #include <utils/environment.h> #include <utils/environmentdialog.h> #include <utils/macroexpander.h> @@ -1129,7 +1130,7 @@ class EnvironmentKitAspectWidget : public KitAspectWidget public: EnvironmentKitAspectWidget(Kit *workingCopy, const KitAspect *ki) : KitAspectWidget(workingCopy, ki), - m_summaryLabel(new QLabel), + m_summaryLabel(new Utils::ElidingLabel), m_manageButton(new QPushButton), m_mainWidget(new QWidget) { @@ -1153,9 +1154,7 @@ private: void refresh() override { const Utils::EnvironmentItems changes = currentEnvironment(); - QString shortSummary = Utils::EnvironmentItem::toStringList(changes).join(QLatin1String("; ")); - QFontMetrics fm(m_summaryLabel->font()); - shortSummary = fm.elidedText(shortSummary, Qt::ElideRight, m_summaryLabel->width()); + const QString shortSummary = Utils::EnvironmentItem::toStringList(changes).join("; "); m_summaryLabel->setText(shortSummary.isEmpty() ? tr("No changes to apply.") : shortSummary); } @@ -1216,7 +1215,7 @@ private: }); } - QLabel *m_summaryLabel; + Utils::ElidingLabel *m_summaryLabel; QPushButton *m_manageButton; QCheckBox *m_vslangCheckbox; QWidget *m_mainWidget; diff --git a/src/plugins/python/pythonrunconfiguration.cpp b/src/plugins/python/pythonrunconfiguration.cpp index fa6931fb99..e4fb477d90 100644 --- a/src/plugins/python/pythonrunconfiguration.cpp +++ b/src/plugins/python/pythonrunconfiguration.cpp @@ -270,6 +270,7 @@ PythonRunConfiguration::PythonRunConfiguration(Target *target, Core::Id id) auto argumentsAspect = addAspect<ArgumentsAspect>(); + addAspect<WorkingDirectoryAspect>(); addAspect<TerminalAspect>(); setCommandLineGetter([this, interpreterAspect, argumentsAspect] { @@ -299,6 +300,9 @@ void PythonRunConfiguration::updateLanguageServer() PyLSConfigureAssistant::instance()->openDocumentWithPython(python, document); } } + + aspect<WorkingDirectoryAspect>()->setDefaultWorkingDirectory( + Utils::FilePath::fromString(mainScript()).parentDir()); } bool PythonRunConfiguration::supportsDebugger() const @@ -324,7 +328,7 @@ QString PythonRunConfiguration::interpreter() const void PythonRunConfiguration::updateTargetInformation() { const BuildTargetInfo bti = buildTargetInfo(); - const QString script = bti.targetFilePath.toString(); + const QString script = bti.targetFilePath.toUserOutput(); setDefaultDisplayName(tr("Run %1").arg(script)); aspect<MainScriptAspect>()->setValue(script); } diff --git a/src/plugins/qmakeprojectmanager/qmakestep.cpp b/src/plugins/qmakeprojectmanager/qmakestep.cpp index d212caa10d..299e550e52 100644 --- a/src/plugins/qmakeprojectmanager/qmakestep.cpp +++ b/src/plugins/qmakeprojectmanager/qmakestep.cpp @@ -599,7 +599,17 @@ QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step) connect(step->qmakeBuildConfiguration(), &QmakeBuildConfiguration::qmakeBuildConfigurationChanged, this, &QMakeStepConfigWidget::qmakeBuildConfigChanged); connect(step->target(), &Target::kitChanged, this, &QMakeStepConfigWidget::qtVersionChanged); - connect(m_ui->abisListWidget, &QListWidget::itemChanged, this, &QMakeStepConfigWidget::abisChanged); + connect(m_ui->abisListWidget, &QListWidget::itemChanged, this, [this]{ + abisChanged(); + QmakeBuildConfiguration *bc = m_step->qmakeBuildConfiguration(); + if (!bc) + return; + + QList<ProjectExplorer::BuildStepList *> stepLists; + const Core::Id clean = ProjectExplorer::Constants::BUILDSTEPS_CLEAN; + stepLists << bc->stepList(clean); + BuildManager::buildLists(stepLists, {ProjectExplorerPlugin::displayNameForStepId(clean)}); + }); auto chooser = new Core::VariableChooser(m_ui->qmakeAdditonalArgumentsLineEdit); chooser->addMacroExpanderProvider([step] { return step->macroExpander(); }); chooser->addSupportedWidget(m_ui->qmakeAdditonalArgumentsLineEdit); diff --git a/src/plugins/qmldesigner/CMakeLists.txt b/src/plugins/qmldesigner/CMakeLists.txt index df5d381511..9d291c7bad 100644 --- a/src/plugins/qmldesigner/CMakeLists.txt +++ b/src/plugins/qmldesigner/CMakeLists.txt @@ -139,6 +139,7 @@ extend_qtc_plugin(QmlDesigner tokencommand.cpp tokencommand.h valueschangedcommand.cpp valueschangedcommand.h changeselectioncommand.cpp changeselectioncommand.h + drop3dlibraryitemcommand.cpp drop3dlibraryitemcommand.h ) extend_qtc_plugin(QmlDesigner diff --git a/src/plugins/qmldesigner/components/bindingeditor/bindingeditor.cpp b/src/plugins/qmldesigner/components/bindingeditor/bindingeditor.cpp index c98789587f..e56822b2a3 100644 --- a/src/plugins/qmldesigner/components/bindingeditor/bindingeditor.cpp +++ b/src/plugins/qmldesigner/components/bindingeditor/bindingeditor.cpp @@ -134,7 +134,7 @@ bool BindingEditorWidget::event(QEvent *event) TextEditor::AssistInterface *BindingEditorWidget::createAssistInterface( TextEditor::AssistKind assistKind, TextEditor::AssistReason assistReason) const { - Q_UNUSED(assistKind); + Q_UNUSED(assistKind) return new QmlJSEditor::QmlJSCompletionAssistInterface( document(), position(), QString(), assistReason, qmljsdocument->semanticInfo()); @@ -489,44 +489,56 @@ void BindingEditor::setModelNodeBackend(const QVariant &modelNodeBackend) if (!modelNodeBackend.isNull() && modelNodeBackend.isValid()) { m_modelNodeBackend = modelNodeBackend; + const auto modelNodeBackendObject = m_modelNodeBackend.value<QObject*>(); + + const auto backendObjectCasted = + qobject_cast<const QmlDesigner::QmlModelNodeProxy *>(modelNodeBackendObject); + + if (backendObjectCasted) { + m_modelNode = backendObjectCasted->qmlObjectNode().modelNode(); + } + emit modelNodeBackendChanged(); } } -void BindingEditor::prepareBindings() +void BindingEditor::setStateModelNode(const QVariant &stateModelNode) { - if (m_backendValue.isNull() || m_modelNodeBackend.isNull()) - return; + if (stateModelNode.isValid()) + { + m_stateModelNode = stateModelNode; + m_modelNode = m_stateModelNode.value<QmlDesigner::ModelNode>(); - if (!(m_backendValue.isValid() && m_modelNodeBackend.isValid())) - return; + if (m_modelNode.isValid()) + m_backendValueTypeName = "bool"; - const auto modelNodeBackendObject = m_modelNodeBackend.value<QObject*>(); + emit stateModelNodeChanged(); + } +} - const auto backendObjectCasted = - qobject_cast<const QmlDesigner::QmlModelNodeProxy *>(modelNodeBackendObject); +void BindingEditor::prepareBindings() +{ + if (!m_modelNode.isValid() || m_backendValueTypeName.isEmpty()) + return; - if (backendObjectCasted) { - const QmlDesigner::ModelNode a = backendObjectCasted->qmlObjectNode().modelNode(); - const QList<QmlDesigner::ModelNode> allNodes = a.view()->allModelNodes(); + const QList<QmlDesigner::ModelNode> allNodes = m_modelNode.view()->allModelNodes(); - QList<BindingEditorDialog::BindingOption> bindings; + QList<BindingEditorDialog::BindingOption> bindings; - for (auto objnode : allNodes) { - BindingEditorDialog::BindingOption binding; - for (auto propertyName : objnode.metaInfo().propertyNames()) - if (m_backendValueTypeName == objnode.metaInfo().propertyTypeName(propertyName)) - binding.properties.append(QString::fromUtf8(propertyName)); + for (auto objnode : allNodes) { + BindingEditorDialog::BindingOption binding; + for (auto propertyName : objnode.metaInfo().propertyNames()) + if (m_backendValueTypeName == objnode.metaInfo().propertyTypeName(propertyName)) + binding.properties.append(QString::fromUtf8(propertyName)); - if (!binding.properties.isEmpty() && objnode.hasId()) { - binding.item = objnode.displayName(); - bindings.append(binding); - } + if (!binding.properties.isEmpty() && objnode.hasId()) { + binding.item = objnode.displayName(); + bindings.append(binding); } - - if (!bindings.isEmpty() && !m_dialog.isNull()) - m_dialog->setAllBindings(bindings); } + + if (!bindings.isEmpty() && !m_dialog.isNull()) + m_dialog->setAllBindings(bindings); } QVariant BindingEditor::backendValue() const @@ -539,5 +551,10 @@ QVariant BindingEditor::modelNodeBackend() const return m_modelNodeBackend; } +QVariant BindingEditor::stateModelNode() const +{ + return m_stateModelNode; +} + } diff --git a/src/plugins/qmldesigner/components/bindingeditor/bindingeditor.h b/src/plugins/qmldesigner/components/bindingeditor/bindingeditor.h index 7861400477..a1deb74108 100644 --- a/src/plugins/qmldesigner/components/bindingeditor/bindingeditor.h +++ b/src/plugins/qmldesigner/components/bindingeditor/bindingeditor.h @@ -144,6 +144,7 @@ class BindingEditor : public QObject Q_PROPERTY(QString text READ bindingValue WRITE setBindingValue) Q_PROPERTY(QVariant backendValueProperty READ backendValue WRITE setBackendValue NOTIFY backendValueChanged) Q_PROPERTY(QVariant modelNodeBackendProperty READ modelNodeBackend WRITE setModelNodeBackend NOTIFY modelNodeBackendChanged) + Q_PROPERTY(QVariant stateModelNodeProperty READ stateModelNode WRITE setStateModelNode NOTIFY stateModelNodeChanged) public: BindingEditor(QObject *parent = nullptr); @@ -159,6 +160,7 @@ public: void setBackendValue(const QVariant &backendValue); void setModelNodeBackend(const QVariant &modelNodeBackend); + void setStateModelNode(const QVariant &stateModelNode); Q_INVOKABLE void prepareBindings(); @@ -167,15 +169,19 @@ signals: void rejected(); void backendValueChanged(); void modelNodeBackendChanged(); + void stateModelNodeChanged(); private: QVariant backendValue() const; QVariant modelNodeBackend() const; + QVariant stateModelNode() const; private: QPointer<BindingEditorDialog> m_dialog; QVariant m_backendValue; QVariant m_modelNodeBackend; + QVariant m_stateModelNode; + QmlDesigner::ModelNode m_modelNode; TypeName m_backendValueTypeName; }; diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp index df58f309ec..c4a928b1ec 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp @@ -145,6 +145,7 @@ void PropertyEditorValue::setValueWithEmit(const QVariant &value) emit valueChanged(nameAsQString(), value); emit valueChangedQml(); emit isBoundChanged(); + emit isExplicitChanged(); } } @@ -160,6 +161,8 @@ void PropertyEditorValue::setValue(const QVariant &value) if (m_value.isValid()) emit valueChangedQml(); + + emit isExplicitChanged(); emit isBoundChanged(); } diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.h b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.h index 99c38feb34..e74196f55c 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.h +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.h @@ -77,8 +77,8 @@ class PropertyEditorValue : public QObject Q_PROPERTY(QVariant enumeration READ enumeration NOTIFY valueChangedQml) Q_PROPERTY(QString expression READ expression WRITE setExpressionWithEmit NOTIFY expressionChanged FINAL) Q_PROPERTY(QString valueToString READ valueToString NOTIFY valueChangedQml FINAL) - Q_PROPERTY(bool isInModel READ isInModel NOTIFY valueChangedQml FINAL) - Q_PROPERTY(bool isInSubState READ isInSubState NOTIFY valueChangedQml FINAL) + Q_PROPERTY(bool isInModel READ isInModel NOTIFY isExplicitChanged FINAL) + Q_PROPERTY(bool isInSubState READ isInSubState NOTIFY isExplicitChanged FINAL) Q_PROPERTY(bool isBound READ isBound NOTIFY isBoundChanged FINAL) Q_PROPERTY(bool isValid READ isValid NOTIFY isValidChanged FINAL) Q_PROPERTY(bool isTranslated READ isTranslated NOTIFY expressionChanged FINAL) @@ -147,6 +147,7 @@ signals: void complexNodeChanged(); void isBoundChanged(); void isValidChanged(); + void isExplicitChanged(); private: //variables QmlDesigner::ModelNode m_modelNode; diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp index 5676cc2ca4..d5e21ebe94 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp @@ -216,4 +216,9 @@ QStringList StatesEditorModel::autoComplete(const QString &text, int pos, bool e return QStringList(); } +QVariant StatesEditorModel::stateModelNode() +{ + return QVariant::fromValue(m_statesEditorView->currentStateNode()); +} + } // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.h b/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.h index 2ea806c9ba..40cad6efef 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.h +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.h @@ -61,6 +61,7 @@ public: Q_INVOKABLE void setWhenCondition(int internalNodeId, const QString &condition); Q_INVOKABLE void resetWhenCondition(int internalNodeId); Q_INVOKABLE QStringList autoComplete(const QString &text, int pos, bool explicitComplete); + Q_INVOKABLE QVariant stateModelNode(); void reset(); diff --git a/src/plugins/qmldesigner/components/timelineeditor/animationcurveeditormodel.cpp b/src/plugins/qmldesigner/components/timelineeditor/animationcurveeditormodel.cpp index 7b27194582..34f3afea96 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/animationcurveeditormodel.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/animationcurveeditormodel.cpp @@ -113,7 +113,9 @@ void AnimationCurveEditorModel::setMaximumTime(double time) DesignTools::ValueType typeFrom(const QmlTimelineKeyframeGroup &group) { - if (group.valueType() == TypeName("double") || group.valueType() == TypeName("real")) + if (group.valueType() == TypeName("double") + || group.valueType() == TypeName("real") + || group.valueType() == TypeName("float")) return DesignTools::ValueType::Double; if (group.valueType() == TypeName("boolean") || group.valueType() == TypeName("bool")) diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelinesettingsmodel.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinesettingsmodel.cpp index e308d65772..6ecb4ef232 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/timelinesettingsmodel.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/timelinesettingsmodel.cpp @@ -149,7 +149,7 @@ void TimelineSettingsModel::resetModel() setHorizontalHeaderLabels( QStringList({tr("State"), tr("Timeline"), tr("Animation"), tr("Fixed Frame")})); - if (timelineView()->isAttached() && timelineView()->rootModelNode().hasId()) { + if (timelineView()->isAttached()) { addState(ModelNode()); for (const QmlModelState &state : QmlVisualNode(timelineView()->rootModelNode()).states().allStates()) diff --git a/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h b/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h index ba2f6b283c..ae58c597d3 100644 --- a/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h +++ b/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h @@ -128,6 +128,7 @@ public: void sendToken(const QString &token, int number, const QVector<ModelNode> &nodeVector); void selectionChanged(const ChangeSelectionCommand &command) override; + void library3DItemDropped(const Drop3DLibraryItemCommand &command) override; void selectedNodesChanged(const QList<ModelNode> &selectedNodeList, const QList<ModelNode> &lastSelectedNodeList) override; diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp index 025402f7bc..158bbefb6d 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp @@ -42,6 +42,7 @@ #include <completecomponentcommand.h> #include <changenodesourcecommand.h> #include <changeselectioncommand.h> +#include <drop3dlibraryitemcommand.h> #include <informationchangedcommand.h> #include <pixmapchangedcommand.h> @@ -280,6 +281,7 @@ void NodeInstanceServerProxy::dispatchCommand(const QVariant &command, PuppetStr static const int debugOutputCommandType = QMetaType::type("DebugOutputCommand"); static const int puppetAliveCommandType = QMetaType::type("PuppetAliveCommand"); static const int changeSelectionCommandType = QMetaType::type("ChangeSelectionCommand"); + static const int drop3DLibraryItemCommandType = QMetaType::type("Drop3DLibraryItemCommand"); if (m_destructing) return; @@ -305,6 +307,8 @@ void NodeInstanceServerProxy::dispatchCommand(const QVariant &command, PuppetStr nodeInstanceClient()->debugOutput(command.value<DebugOutputCommand>()); } else if (command.userType() == changeSelectionCommandType) { nodeInstanceClient()->selectionChanged(command.value<ChangeSelectionCommand>()); + } else if (command.userType() == drop3DLibraryItemCommandType) { + nodeInstanceClient()->library3DItemDropped(command.value<Drop3DLibraryItemCommand>()); } else if (command.userType() == puppetAliveCommandType) { puppetAlive(puppetStreamType); } else if (command.userType() == synchronizeCommandType) { diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp index 899dc5caee..6a285130c5 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp @@ -41,6 +41,7 @@ #include "qmlstate.h" #include "qmltimeline.h" #include "qmltimelinekeyframegroup.h" +#include "qmlvisualnode.h" #include "createscenecommand.h" #include "createinstancescommand.h" @@ -52,6 +53,7 @@ #include "changebindingscommand.h" #include "changeidscommand.h" #include "changeselectioncommand.h" +#include "drop3dlibraryitemcommand.h" #include "changenodesourcecommand.h" #include "removeinstancescommand.h" #include "removepropertiescommand.h" @@ -66,7 +68,6 @@ #include "tokencommand.h" #include "removesharedmemorycommand.h" #include "debugoutputcommand.h" - #include "nodeinstanceserverproxy.h" #include <utils/algorithm.h> @@ -1431,6 +1432,17 @@ void NodeInstanceView::selectionChanged(const ChangeSelectionCommand &command) selectModelNode(modelNodeForInternalId(instanceId)); } } +void NodeInstanceView::library3DItemDropped(const Drop3DLibraryItemCommand &command) +{ + QDataStream stream(command.itemData()); + ItemLibraryEntry itemLibraryEntry; + stream >> itemLibraryEntry; + + if (itemLibraryEntry.category() != "Qt Quick 3D") + return; + + QmlVisualNode::createQmlVisualNode(this, itemLibraryEntry, {}); +} void NodeInstanceView::selectedNodesChanged(const QList<ModelNode> &selectedNodeList, const QList<ModelNode> & /*lastSelectedNodeList*/) diff --git a/src/plugins/qmldesigner/designercore/model/qmlvisualnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlvisualnode.cpp index e9977d5c98..b3444ce611 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlvisualnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlvisualnode.cpp @@ -56,6 +56,9 @@ bool QmlVisualNode::isItemOr3DNode(const ModelNode &modelNode) if (modelNode.metaInfo().isSubclassOf("QtQuick3D.Node")) return true; + if (modelNode.metaInfo().isGraphicalItem() && modelNode.isRootNode()) + return true; + return false; } diff --git a/src/plugins/qmldesigner/qmldesignerplugin.qbs b/src/plugins/qmldesigner/qmldesignerplugin.qbs index f2fdd76598..4ebac8ce31 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.qbs +++ b/src/plugins/qmldesigner/qmldesignerplugin.qbs @@ -169,6 +169,8 @@ Project { "commands/valueschangedcommand.h", "commands/changeselectioncommand.cpp", "commands/changeselectioncommand.h", + "commands/drop3dlibraryitemcommand.cpp", + "commands/drop3dlibraryitemcommand.h", "container/addimportcontainer.cpp", "container/addimportcontainer.h", "container/idcontainer.cpp", diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index d6d4f7fb53..23fe51d544 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -2230,6 +2230,11 @@ Abis BaseQtVersion::qtAbisFromLibrary(const FilePathList &coreLibraries) return res; } +void BaseQtVersion::resetCache() const +{ + d->m_data.hasQtAbis = false; + d->m_mkspecReadUpToDate = false; +} // QtVersionFactory diff --git a/src/plugins/qtsupport/baseqtversion.h b/src/plugins/qtsupport/baseqtversion.h index 4a90ca531b..80489d1bb9 100644 --- a/src/plugins/qtsupport/baseqtversion.h +++ b/src/plugins/qtsupport/baseqtversion.h @@ -244,6 +244,8 @@ protected: // helper function for desktop and simulator to figure out the supported abis based on the libraries static ProjectExplorer::Abis qtAbisFromLibrary(const Utils::FilePathList &coreLibraries); + void resetCache() const; + void ensureMkSpecParsed() const; virtual void parseMkSpec(ProFileEvaluator *) const; diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index b21684a9f5..a194b524e0 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -8440,8 +8440,9 @@ void TextEditorWidget::setupGenericHighlighter() // TextEditorLinkLabel // TextEditorLinkLabel::TextEditorLinkLabel(QWidget *parent) - : QLabel(parent) + : Utils::ElidingLabel(parent) { + setElideMode(Qt::ElideMiddle); } void TextEditorLinkLabel::setLink(Utils::Link link) diff --git a/src/plugins/texteditor/texteditor.h b/src/plugins/texteditor/texteditor.h index d5a9a68ead..dddfa54868 100644 --- a/src/plugins/texteditor/texteditor.h +++ b/src/plugins/texteditor/texteditor.h @@ -35,10 +35,10 @@ #include <coreplugin/editormanager/ieditorfactory.h> #include <coreplugin/helpitem.h> +#include <utils/elidinglabel.h> #include <utils/link.h> #include <utils/uncommentselection.h> -#include <QLabel> #include <QPlainTextEdit> #include <QSharedPointer> #include <functional> @@ -611,7 +611,7 @@ private: friend class RefactorOverlay; }; -class TEXTEDITOR_EXPORT TextEditorLinkLabel : public QLabel +class TEXTEDITOR_EXPORT TextEditorLinkLabel : public Utils::ElidingLabel { public: TextEditorLinkLabel(QWidget *parent = nullptr); |