aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/mcusupport
diff options
context:
space:
mode:
authorYasser Grimes <yasser.grimes@qt.io>2023-09-29 11:43:28 +0300
committerYasser Grimes <yasser.grimes@qt.io>2023-10-17 13:02:14 +0000
commita9a74992def0f95071361045ca47ad9a2eedda3a (patch)
treef7b115f47af07622506a7fdf744809d8edb0cfc4 /src/plugins/mcusupport
parenta671014125104a589442d3e74df7c2a5ac14ee5a (diff)
McuSupport: Notify users to read QtMCUs on QDS documentation
Make the documentation for using QtMCUs design studio easier to locate for new users by showing an InfoBar notification with the link to the online documentation. Task-number: QDS-10332 Change-Id: I9344216ef36369cdfb284ab18dba91cd0b5d4c92 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Diffstat (limited to 'src/plugins/mcusupport')
-rw-r--r--src/plugins/mcusupport/mcubuildstep.cpp3
-rw-r--r--src/plugins/mcusupport/mcusupportplugin.cpp39
2 files changed, 42 insertions, 0 deletions
diff --git a/src/plugins/mcusupport/mcubuildstep.cpp b/src/plugins/mcusupport/mcubuildstep.cpp
index 3b0c639df5e..0250eb82f30 100644
--- a/src/plugins/mcusupport/mcubuildstep.cpp
+++ b/src/plugins/mcusupport/mcubuildstep.cpp
@@ -119,6 +119,9 @@ DeployMcuProcessStep::DeployMcuProcessStep(ProjectExplorer::BuildStepList *bc, U
cmdLine.addArg(directory);
return cmdLine;
});
+
+ if(target())
+ target()->setNamedSettings("IS_MCU_QDS_PROJECT", true);
}
QString DeployMcuProcessStep::findKitInformation(ProjectExplorer::Kit *kit, const QString &key)
diff --git a/src/plugins/mcusupport/mcusupportplugin.cpp b/src/plugins/mcusupport/mcusupportplugin.cpp
index 21a993866b6..90bc2af509c 100644
--- a/src/plugins/mcusupport/mcusupportplugin.cpp
+++ b/src/plugins/mcusupport/mcusupportplugin.cpp
@@ -43,6 +43,7 @@
#include <QAction>
#include <QDateTime>
+#include <QDesktopServices>
#include <QTimer>
using namespace Core;
@@ -51,6 +52,7 @@ using namespace ProjectExplorer;
namespace McuSupport::Internal {
const char setupMcuSupportKits[] = "SetupMcuSupportKits";
+const char qdsMcuDocInfoEntry[] = "McuDocInfoEntry";
void printMessage(const QString &message, bool important)
{
@@ -114,6 +116,25 @@ McuSupportPlugin::~McuSupportPlugin()
dd = nullptr;
}
+static bool isQtMCUsProject(ProjectExplorer::Project *p)
+{
+ if (!Core::ICore::isQtDesignStudio())
+ // should be unreachable
+ printMessage("Testing if the QDS project is an MCU project outside the QDS", true);
+
+ if (!p || !p->rootProjectNode())
+ return false;
+
+ ProjectExplorer::Target *target = p->activeTarget();
+ if (!target)
+ return false;
+
+ if (!target->namedSettings("IS_MCU_QDS_PROJECT").toBool())
+ return false;
+
+ return true;
+}
+
void McuSupportPlugin::initialize()
{
setObjectName("McuSupportPlugin");
@@ -160,6 +181,23 @@ void McuSupportPlugin::initialize()
->action()
->trigger();
});
+ } else {
+ // Only in design studio
+ connect(ProjectManager::instance(),
+ &ProjectManager::projectFinishedParsing,
+ [&](ProjectExplorer::Project *p) {
+ if (!isQtMCUsProject(p) || !ICore::infoBar()->canInfoBeAdded(qdsMcuDocInfoEntry))
+ return;
+ Utils::InfoBarEntry docInfo(qdsMcuDocInfoEntry,
+ Tr::tr("Read about Using QtMCUs in the Qt Design Studio"),
+ Utils::InfoBarEntry::GlobalSuppression::Enabled);
+ docInfo.addCustomButton(Tr::tr("Go to the Documentation"), [] {
+ ICore::infoBar()->suppressInfo(qdsMcuDocInfoEntry);
+ QDesktopServices::openUrl(
+ QUrl("https://doc.qt.io/qtdesignstudio/studio-on-mcus.html"));
+ });
+ ICore::infoBar()->addInfo(docInfo);
+ });
}
dd->m_options.registerQchFiles();
@@ -270,3 +308,4 @@ void McuSupportPlugin::updateDeployStep(ProjectExplorer::Target *target, bool en
}
} // namespace McuSupport::Internal
+