1// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#include "actionanalyseplugin.h"
6#include "mainframe/configure.h"
7#include "mainframe/analysekeeper.h"
8
9#include "common/common.h"
10#include "base/abstractaction.h"
11#include "services/window/windowservice.h"
12#include "services/window/windowelement.h"
13
14#include <QProcess>
15#include <QAction>
16#include <QLabel>
17#include <QTreeView>
18
19void ActionAnalyse::initialize()
20{
21
22}
23
24bool ActionAnalyse::start()
25{
26 qInfo() << __FUNCTION__;
27 using namespace dpfservice;
28 auto &ctx = dpfInstance.serviceContext();
29 WindowService *windowService = ctx.service<WindowService>(WindowService::name());
30
31 if (windowService) {
32 auto action = new QAction(MWMTA_USR_ACTION_ANALYZE);
33 ActionManager::getInstance()->registerAction(action, "Analyze.UsrActionAnalyze", action->text(), QKeySequence());
34 action->setCheckable(true);
35 action->setChecked(Configure::enabled());
36 QObject::connect(action, &QAction::toggled, Configure::setEnabled);
37 windowService->addAction(MWM_TOOLS, new AbstractAction(action));
38 }
39
40 return true;
41}
42
43dpf::Plugin::ShutdownFlag ActionAnalyse::stop()
44{
45 return Sync;
46}
47