aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/boot2qt
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2023-11-10 16:24:01 +0100
committerhjk <hjk@qt.io>2023-11-14 10:59:38 +0000
commit5922227642a726ac4e79134ae28ac7046339a5bb (patch)
tree199707b598afcfe05ea13226678dc43d5d4f42f9 /src/plugins/boot2qt
parent031b2162ee776d68262e9495fdcfc5b52b70de5d (diff)
Boot2Qt: Use ActionBuilder to create flash action
Clearer code. Change-Id: I9fc8f7f8ddc704689fed6e40d92f827067d19e40 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/boot2qt')
-rw-r--r--src/plugins/boot2qt/qdbplugin.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/plugins/boot2qt/qdbplugin.cpp b/src/plugins/boot2qt/qdbplugin.cpp
index de1a7557c8..ec61e7c33a 100644
--- a/src/plugins/boot2qt/qdbplugin.cpp
+++ b/src/plugins/boot2qt/qdbplugin.cpp
@@ -36,6 +36,7 @@
#include <QAction>
+using namespace Core;
using namespace ProjectExplorer;
using namespace Utils;
@@ -80,21 +81,16 @@ void registerFlashAction(QObject *parentForAction)
}
const char flashActionId[] = "Qdb.FlashAction";
- if (Core::ActionManager::command(flashActionId))
+ if (ActionManager::command(flashActionId))
return; // The action has already been registered.
- Core::ActionContainer *toolsContainer =
- Core::ActionManager::actionContainer(Core::Constants::M_TOOLS);
+ ActionContainer *toolsContainer = ActionManager::actionContainer(Core::Constants::M_TOOLS);
toolsContainer->insertGroup(Core::Constants::G_TOOLS_DEBUG, flashActionId);
- Core::Context globalContext(Core::Constants::C_GLOBAL);
-
- QAction *flashAction = new QAction(Tr::tr("Flash Boot to Qt Device"), parentForAction);
- Core::Command *flashCommand = Core::ActionManager::registerAction(flashAction,
- flashActionId,
- globalContext);
- QObject::connect(flashAction, &QAction::triggered, startFlashingWizard);
- toolsContainer->addAction(flashCommand, flashActionId);
+ ActionBuilder flashAction(parentForAction, flashActionId);
+ flashAction.setText(Tr::tr("Flash Boot to Qt Device"));
+ flashAction.setContainer(Core::Constants::G_TOOLS_DEBUG, flashActionId);
+ flashAction.setOnTriggered(&startFlashingWizard);
}
class QdbDeployStepFactory : public BuildStepFactory