1// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#include "console.h"
6#include "base/abstractwidget.h"
7#include "services/window/windowservice.h"
8#include "consolewidget.h"
9
10using namespace dpfservice;
11void Console::initialize()
12{
13 qInfo() << __FUNCTION__;
14 //发布Console到edit导航栏界面布局
15 if (QString(getenv("TERM")).isEmpty()) {
16 setenv("TERM", "xterm-256color", 1);
17 }
18}
19
20bool Console::start()
21{
22 qInfo() << __FUNCTION__;
23
24 auto &ctx = dpfInstance.serviceContext();
25 WindowService *windowService = ctx.service<WindowService>(WindowService::name());
26 if (windowService) {
27 windowService->addContextWidget(QString(tr("&Console")), new AbstractWidget(ConsoleWidget::instance()), "A");
28 }
29 return true;
30}
31
32dpf::Plugin::ShutdownFlag Console::stop()
33{
34 qInfo() << __FUNCTION__;
35 return Sync;
36}
37