1// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#include "mainframe/mainwindow.h"
6#include "performance.h"
7#include "base/abstractmenu.h"
8#include "base/abstractaction.h"
9#include "base/abstractcentral.h"
10#include "base/abstractwidget.h"
11#include "services/window/windowservice.h"
12
13#include <QAction>
14#include <QLabel>
15
16#include <unistd.h>
17
18namespace {
19static MainWindow *mainWindow{nullptr};
20}
21
22using namespace dpfservice;
23
24void Performance::initialize()
25{
26
27}
28
29bool Performance::start()
30{
31 qInfo() << __FUNCTION__;
32
33 if (!::mainWindow) {
34 ::mainWindow = new MainWindow();
35 }
36
37 auto &ctx = dpfInstance.serviceContext();
38 WindowService *windowService = ctx.service<WindowService>(WindowService::name());
39
40 if (::mainWindow && windowService) {
41 windowService->addContextWidget(QString(tr("&Performance")), new AbstractWidget(::mainWindow), "Performance");
42 }
43
44 return true;
45}
46
47dpf::Plugin::ShutdownFlag Performance::stop()
48{
49 return Sync;
50}
51