diff --git a/src/plugins/mcusupport/CMakeLists.txt b/src/plugins/mcusupport/CMakeLists.txt index f2c8cf9b762..2af652f2602 100644 --- a/src/plugins/mcusupport/CMakeLists.txt +++ b/src/plugins/mcusupport/CMakeLists.txt @@ -1,6 +1,6 @@ add_qtc_plugin(McuSupport DEPENDS Qt5::Core - PLUGIN_DEPENDS Core ProjectExplorer Debugger CMakeProjectManager + PLUGIN_DEPENDS Core ProjectExplorer Debugger CMakeProjectManager QtSupport SOURCES mcusupport.qrc mcusupport_global.h diff --git a/src/plugins/mcusupport/mcusupport.qbs b/src/plugins/mcusupport/mcusupport.qbs index f3bb8a12e99..f3200d49b1c 100644 --- a/src/plugins/mcusupport/mcusupport.qbs +++ b/src/plugins/mcusupport/mcusupport.qbs @@ -11,6 +11,7 @@ QtcPlugin { Depends { name: "ProjectExplorer" } Depends { name: "Debugger" } Depends { name: "CMakeProjectManager" } + Depends { name: "QtSupport" } files: [ "mcusupport.qrc", diff --git a/src/plugins/mcusupport/mcusupport_dependencies.pri b/src/plugins/mcusupport/mcusupport_dependencies.pri index 1f2dd5bc644..f68cd308a95 100644 --- a/src/plugins/mcusupport/mcusupport_dependencies.pri +++ b/src/plugins/mcusupport/mcusupport_dependencies.pri @@ -8,4 +8,5 @@ QTC_PLUGIN_DEPENDS += \ coreplugin \ projectexplorer \ debugger \ - cmakeprojectmanager + cmakeprojectmanager \ + qtsupport diff --git a/src/plugins/mcusupport/mcusupportoptions.cpp b/src/plugins/mcusupport/mcusupportoptions.cpp index 159c88e7a0a..6d888b48f5e 100644 --- a/src/plugins/mcusupport/mcusupportoptions.cpp +++ b/src/plugins/mcusupport/mcusupportoptions.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -356,22 +357,45 @@ void McuSupportOptions::populatePackagesAndTargets() setQulDir(Utils::FilePath::fromUserInput(qtForMCUsSdkPackage->path())); } +static Utils::FilePath qulDocsDir() +{ + const Utils::FilePath qulDir = McuSupportOptions::qulDirFromSettings(); + if (qulDir.isEmpty() || !qulDir.exists()) + return {}; + const Utils::FilePath docsDir = qulDir.pathAppended("docs"); + return docsDir.exists() ? docsDir : Utils::FilePath(); +} + void McuSupportOptions::registerQchFiles() { - const QString qulDir = qulDirFromSettings().toString(); - if (qulDir.isEmpty() || !QFileInfo::exists(qulDir)) + const QString docsDir = qulDocsDir().toString(); + if (docsDir.isEmpty()) return; - const QString docsPath = qulDir + "/docs/"; const QStringList qchFiles = { - docsPath + "quickultralite.qch", - docsPath + "quickultralitecmake.qch" + docsDir + "/quickultralite.qch", + docsDir + "/quickultralitecmake.qch" }; Core::HelpManager::registerDocumentation( Utils::filtered(qchFiles, [](const QString &file) { return QFileInfo::exists(file); })); } +void McuSupportOptions::registerExamples() +{ + const Utils::FilePath docsDir = qulDocsDir(); + if (docsDir.isEmpty()) + return; + + const Utils::FilePath examplesDir = + McuSupportOptions::qulDirFromSettings().pathAppended("demos"); + if (!examplesDir.exists()) + return; + + QtSupport::QtVersionManager::registerExampleSet("Qt for MCUs", docsDir.toString(), + examplesDir.toString()); +} + void McuSupportOptions::deletePackagesAndTargets() { qDeleteAll(packages); diff --git a/src/plugins/mcusupport/mcusupportoptions.h b/src/plugins/mcusupport/mcusupportoptions.h index b22f32375e3..92790bac13c 100644 --- a/src/plugins/mcusupport/mcusupportoptions.h +++ b/src/plugins/mcusupport/mcusupportoptions.h @@ -168,6 +168,7 @@ public: ProjectExplorer::Kit *newKit(const McuTarget *mcuTarget); void populatePackagesAndTargets(); static void registerQchFiles(); + static void registerExamples(); private: void deletePackagesAndTargets(); diff --git a/src/plugins/mcusupport/mcusupportplugin.cpp b/src/plugins/mcusupport/mcusupportplugin.cpp index 4182713e866..3028c7e80e2 100644 --- a/src/plugins/mcusupport/mcusupportplugin.cpp +++ b/src/plugins/mcusupport/mcusupportplugin.cpp @@ -76,6 +76,7 @@ bool McuSupportPlugin::initialize(const QStringList& arguments, QString* errorSt dd = new McuSupportPluginPrivate; McuSupportOptions::registerQchFiles(); + McuSupportOptions::registerExamples(); ProjectExplorer::JsonWizardFactory::addWizardPath( Utils::FilePath::fromString(":/mcusupport/wizards/"));