1// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#include "binarytools.h"
6#include "mainframe/binarytoolsdialog.h"
7
8#include "common/common.h"
9#include "base/abstractaction.h"
10#include "services/window/windowservice.h"
11
12void BinaryTools::initialize()
13{
14}
15
16bool BinaryTools::start()
17{
18 qInfo() << __FUNCTION__;
19 using namespace dpfservice;
20 auto &ctx = dpfInstance.serviceContext();
21 WindowService *windowService = ctx.service<WindowService>(WindowService::name());
22
23 if (windowService) {
24 auto action = new QAction(MWMTA_BINARY_TOOLS);
25 ActionManager::getInstance()->registerAction(action, "Tools.Binary", action->text(), QKeySequence());
26 windowService->addAction(MWM_TOOLS, new AbstractAction(action));
27
28 QObject::connect(action, &QAction::triggered, [=](){
29 BinaryToolsDialog dlg;
30 dlg.exec();
31 });
32 }
33
34 return true;
35}
36
37dpf::Plugin::ShutdownFlag BinaryTools::stop()
38{
39 return Sync;
40}
41