diff --git a/.reuse/dep5 b/.reuse/dep5 index 7d0f6d3..09e864b 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -14,12 +14,12 @@ Copyright: None License: CC0-1.0 #config -Files: *.service *.desktop *.conf +Files: *.service *.desktop *.conf *.policy Copyright: UnionTech Software Technology Co., Ltd. License: CC0-1.0 # Project file -Files: *.pro *.prf *.pri *.qrc +Files: *.pro *.prf *.pri *.qrc *.txt Copyright: None License: CC0-1.0 @@ -29,11 +29,11 @@ Copyright: None License: CC0-1.0 # translation -Files: deepin-pc-manager/translations/* deepin-pc-manager-server/deepin-pc-manager-session-daemon/translations/* +Files: *.ts *.qm Copyright: UnionTech Software Technology Co., Ltd. License: CC0-1.0 # svg -Files: deepin-pc-manager/src/window/icons/*.svg deepin-pc-manager/src/window/icons/*.png +Files: *.svg *.png Copyright: None License: CC0-1.0 diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f557d6..99d769b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,3 @@ -# SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -# -# SPDX-License-Identifier: GPL-3.0-or-later - cmake_minimum_required(VERSION 3.13) # If do't define version number, specify the version number @@ -46,6 +42,13 @@ endif() # 版本号宏定义 add_compile_definitions(QMAKE_VERSION="${VERSION}") - add_subdirectory(deepin-pc-manager) add_subdirectory(deepin-pc-manager-server) +add_subdirectory(deepin-netcheck-plugin) +add_subdirectory(deepin-autostart-plugin) +add_subdirectory(deepin-apprepair-plugin) +add_subdirectory(deepin-hostmodify-plugin) +add_subdirectory(deepin-filename-plugin) +add_subdirectory(deepin-keyclean-plugin) +add_subdirectory(deepin-fcitxrepair-plugin) +add_subdirectory(deepin-fileicon-plugin) diff --git a/CMakeLists.txt.user b/CMakeLists.txt.user deleted file mode 100644 index 884b08a..0000000 --- a/CMakeLists.txt.user +++ /dev/null @@ -1,239 +0,0 @@ - - - - - - EnvironmentId - {4cfd266a-9063-43e9-bb11-fdf9ab69277b} - - - ProjectExplorer.Project.ActiveTarget - 0 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - 0 - false - true - false - 0 - true - true - 0 - 8 - true - false - 1 - true - true - true - *.md, *.MD, Makefile - false - true - true - - - - ProjectExplorer.Project.PluginSettings - - - true - false - true - true - true - true - - - 0 - true - - true - true - Builtin.DefaultTidyAndClazy - 8 - true - - - - true - - - - - ProjectExplorer.Project.Target.0 - - Desktop - 桌面 - 桌面 - {e8cee900-4de0-46cd-ae87-ad96a23347fb} - 0 - 0 - 1 - - Debug - 2 - false - - -DCMAKE_GENERATOR:STRING=Unix Makefiles --DCMAKE_BUILD_TYPE:STRING=Debug --DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake --DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable} --DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX} --DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C} --DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx} --DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG} - /home/uos/Work/github/deepin-pc-manager - 0 - /home/uos/Work/github/build-deepin-pc-manager-unknown-Debug - - - - - all - - false - - true - 构建 - CMakeProjectManager.MakeStep - - 1 - 构建 - 构建 - ProjectExplorer.BuildSteps.Build - - - - - - clean - - false - - true - 构建 - CMakeProjectManager.MakeStep - - 1 - 清除 - 清除 - ProjectExplorer.BuildSteps.Clean - - 2 - false - - false - - Debug - CMakeProjectManager.CMakeBuildConfiguration - - 1 - - - 0 - 部署 - 部署 - ProjectExplorer.BuildSteps.Deploy - - 1 - - false - ProjectExplorer.DefaultDeployConfiguration - - 1 - - true - true - 0 - true - - 2 - - false - deepin-pc-manager - CMakeProjectManager.CMakeRunConfiguration.deepin-pc-manager - deepin-pc-manager - false - true - true - true - /home/uos/Work/github/build-deepin-pc-manager-unknown-Debug/deepin-pc-manager - - - true - true - 0 - true - - 2 - - false - deepin-pc-manager-session-daemon - CMakeProjectManager.CMakeRunConfiguration.deepin-pc-manager-session-daemon - deepin-pc-manager-session-daemon - false - true - true - true - /home/uos/Work/github/build-deepin-pc-manager-unknown-Debug/deepin-pc-manager-server/deepin-pc-manager-session-daemon - - - true - true - 0 - true - - 2 - - false - deepin-pc-manager-system-daemon - CMakeProjectManager.CMakeRunConfiguration.deepin-pc-manager-system-daemon - deepin-pc-manager-system-daemon - false - true - true - true - /home/uos/Work/github/build-deepin-pc-manager-unknown-Debug/deepin-pc-manager-server/deepin-pc-manager-system-daemon - - 3 - - - - ProjectExplorer.Project.TargetCount - 1 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - - diff --git a/README.md b/README.md index 88a78a2..75a5972 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,3 @@ - - # Deepin PC Manager Deepin PC Manager is an application tool designed to help users quickly manage, maintain, and optimize computer systems. diff --git a/README.zh_CN.md b/README.zh_CN.md index 5fea1de..8c69b90 100644 --- a/README.zh_CN.md +++ b/README.zh_CN.md @@ -1,9 +1,3 @@ - - # 电脑管家 电脑管家是一款帮助用户快速管理、维护和优化计算机系统的应用工具。 diff --git a/debian/changelog b/debian/changelog index 0645066..42cf2eb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,8 @@ +deepin-pc-manager (5.0.4) unstable; urgency=medium + + * update + + -- unknown Wed, 24 Apr 2024 09:02:46 +0800 deepin-pc-manager (5.0.3) unstable; urgency=medium * update diff --git a/debian/control b/debian/control index ceda194..c3887cf 100644 --- a/debian/control +++ b/debian/control @@ -3,22 +3,42 @@ Section: utils Priority: optional Maintainer: Packages Build-Depends: debhelper (>= 11), - libdtkwidget-dev, - libdtkgui-dev, - qtbase5-dev, - libgsettings-qt-dev, - qttools5-dev-tools, - cmake, - libqt5x11extras5-dev, - libxext-dev, - libncurses-dev, - libdtkcore5-bin, - libqt5multimedia5, - libqt5svg5, - libudev-dev, - libpolkit-qt5-1-dev, - qtmultimedia5-dev, - libparted-dev + pkg-config, + libx11-dev, + cmake, + qt5-qmake, + qttools5-dev, + qtbase5-dev, + qtdeclarative5-dev, + libqt5svg5-dev, + libdtkcore-dev, + libdtkwidget-dev, + libdtkgui-dev, + libdframeworkdbus-dev, + libgsettings-qt-dev, + qttools5-dev-tools, + libdtkcore5-bin, + qtbase5-private-dev, + libxrandr-dev, + libmtdev-dev, + libfontconfig1-dev, + libegl1-mesa-dev, + libxcb-ewmh-dev, + libudisks2-qt5-dev, + qtmultimedia5-dev, + deepin-desktop-base | deepin-desktop-server | deepin-desktop-device, + libgtest-dev, + libdeepin-pw-check-dev, + libpolkit-qt5-1-dev, + libdareader-dev, + libqt5waylandclient5-dev, + qtwayland5-private-dev, + libkf5wayland-dev, + libwayland-dev, + libxkbcommon-dev, + libdpkg-dev, + libudev-dev, + libparted-dev Standards-Version: 4.1.3 Homepage: https://www.deepin.org diff --git a/deepin-apprepair-plugin/CMakeLists.txt b/deepin-apprepair-plugin/CMakeLists.txt new file mode 100644 index 0000000..60f857c --- /dev/null +++ b/deepin-apprepair-plugin/CMakeLists.txt @@ -0,0 +1,45 @@ +cmake_minimum_required(VERSION 3.7) + +set(PLUGIN_NAME "deepin-apprepair") + +project(${PLUGIN_NAME}) + +set(CMAKE_AUTOMOC ON) + +file(GLOB_RECURSE SRCS + "*.h" + "*.cpp") + +find_package(Qt5 COMPONENTS Core Widgets DBus Svg LinguistTools REQUIRED) +find_package(PkgConfig REQUIRED) +find_package(DtkWidget REQUIRED) + +pkg_check_modules(DFrameworkDBus REQUIRED dframeworkdbus) +pkg_check_modules(QGSettings REQUIRED gsettings-qt) + +file(GLOB TS_FILES "translations/*.ts") +qt5_add_translation(QM_FILES ${TS_FILES}) +add_custom_target(translationsapprepair ALL DEPENDS ${QM_FILES}) +install(FILES ${QM_FILES} DESTINATION share/${PLUGIN_NAME}/translations) + +add_library(${PLUGIN_NAME} SHARED ${SRCS} icons/apprepair_icons.qrc) +set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ./) +target_include_directories(${PLUGIN_NAME} PUBLIC + ${Qt5Widgets_INCLUDE_DIRS} + ${Qt5Svg_INCLUDE_DIRS} + ${DtkWidget_INCLUDE_DIRS} + ${QGSettings_INCLUDE_DIRS} + ${Qt5DBus_INCLUDE_DIRS} + ../deepin-pc-manager/include/ + ) +target_link_libraries(${PLUGIN_NAME} PRIVATE + ${Qt5Widgets_LIBRARIES} + ${Qt5Svg_LIBRARIES} + ${DtkWidget_LIBRARIES} + ${DFrameworkDBus_LIBRARIES} + ${QGSettings_LIBRARIES} + ${Qt5DBus_LIBRARIES} + ) + +install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION /usr/lib/deepin-pc-manager/modules) +install(FILES icons/icons/deepin-app-repair.svg DESTINATION /usr/share/icons/hicolor/scalable/apps) diff --git a/deepin-apprepair-plugin/apprepair_settings.json b/deepin-apprepair-plugin/apprepair_settings.json new file mode 100644 index 0000000..dbc6b7b --- /dev/null +++ b/deepin-apprepair-plugin/apprepair_settings.json @@ -0,0 +1,3 @@ +{ + "api" : "1.0.0" +} \ No newline at end of file diff --git a/deepin-apprepair-plugin/apprepairmodel.cpp b/deepin-apprepair-plugin/apprepairmodel.cpp new file mode 100644 index 0000000..69b217b --- /dev/null +++ b/deepin-apprepair-plugin/apprepairmodel.cpp @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "apprepairmodel.h" + +AppRepairModel::AppRepairModel(QObject *parent) + : QObject(parent) +{ + initData(); +} + +AppRepairModel::~AppRepairModel() +{ +} + +// 初始化数据 +void AppRepairModel::initData() +{ +} diff --git a/deepin-apprepair-plugin/apprepairmodel.h b/deepin-apprepair-plugin/apprepairmodel.h new file mode 100644 index 0000000..6439d25 --- /dev/null +++ b/deepin-apprepair-plugin/apprepairmodel.h @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include + +class AppRepairModel : public QObject +{ + Q_OBJECT +public: + explicit AppRepairModel(QObject *parent = nullptr); + ~AppRepairModel(); + +private: + void initData(); + +private: +}; diff --git a/deepin-apprepair-plugin/apprepairmodule.cpp b/deepin-apprepair-plugin/apprepairmodule.cpp new file mode 100644 index 0000000..1393e6d --- /dev/null +++ b/deepin-apprepair-plugin/apprepairmodule.cpp @@ -0,0 +1,79 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "apprepairmodule.h" +#include "apprepairmodel.h" +#include "apprepairwidget.h" + +#include + +#include +#include + +DWIDGET_USE_NAMESPACE +DCORE_USE_NAMESPACE + +AppRepairModule::AppRepairModule() + : QObject() + , ToolBoxInterface() + , m_appRepairModel(nullptr) + , m_appRepairWidget(nullptr) +{ + QTranslator *translator = new QTranslator(this); + translator->load(QString("/usr/share/deepin-apprepair/translations/deepin-apprepair_%1.qm").arg(QLocale::system().name())); + QCoreApplication::installTranslator(translator); +} + +AppRepairModule::~AppRepairModule() +{ +} + +void AppRepairModule::active() +{ + if (!m_appRepairModel) { + m_appRepairModel = new AppRepairModel; + } + if (!m_appRepairWidget) { + m_appRepairWidget = new AppRepairWidget(m_appRepairModel); + } + + m_frameProxy->pushWidget(this, m_appRepairWidget); + m_appRepairWidget->setVisible(true); +} + +const QString AppRepairModule::name() const +{ + return "DEEPINAPPREPAIR"; +} +const QString AppRepairModule::apptitle() const +{ + return tr("Application Repair"); +} +const QString AppRepairModule::apptip() const +{ + return tr("Apply anomaly quick fix, update continuously"); +} +const QString AppRepairModule::appsupporter() const +{ + return tr("Supported by UOS"); +} +const QString AppRepairModule::icon() const +{ + return "deepin-app-repair"; +} + +int AppRepairModule::apptype() const +{ + return ToolBoxProxyInterface::Repair; +} + +bool AppRepairModule::enable() const +{ + return false; +} + +bool AppRepairModule::checkauth() const +{ + return false; +} diff --git a/deepin-apprepair-plugin/apprepairmodule.h b/deepin-apprepair-plugin/apprepairmodule.h new file mode 100644 index 0000000..cbde95a --- /dev/null +++ b/deepin-apprepair-plugin/apprepairmodule.h @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include +#include + +#include "interface/toolboxinterface.h" +#include "interface/toolboxproxyinterface.h" + +namespace PCC_NAMESPACE { +class ToolBoxInterface; +class ToolBoxProxyInterface; +} // namespace PCC_NAMESPACE + +using namespace PCC_NAMESPACE; + +class AppRepairWidget; +class AppRepairModel; +class AppRepairModule : public QObject + , public ToolBoxInterface +{ + Q_OBJECT + + Q_PLUGIN_METADATA(IID ToolBoxInterface_iid FILE "apprepair_settings.json") + Q_INTERFACES(PCC_NAMESPACE::ToolBoxInterface) + +public: + explicit AppRepairModule(); + + ~AppRepairModule() Q_DECL_OVERRIDE; + + const QString name() const Q_DECL_OVERRIDE; + const QString apptitle() const Q_DECL_OVERRIDE; + const QString apptip() const Q_DECL_OVERRIDE; + const QString appsupporter() const Q_DECL_OVERRIDE; + const QString icon() const Q_DECL_OVERRIDE; + int apptype() const Q_DECL_OVERRIDE; + bool enable() const Q_DECL_OVERRIDE; + bool checkauth() const Q_DECL_OVERRIDE; + +private: + void onStatusChanged(); + +public Q_SLOTS: + void active() Q_DECL_OVERRIDE; + +private: + AppRepairModel *m_appRepairModel; + AppRepairWidget *m_appRepairWidget; +}; diff --git a/deepin-apprepair-plugin/apprepairwidget.cpp b/deepin-apprepair-plugin/apprepairwidget.cpp new file mode 100644 index 0000000..e2ad7e7 --- /dev/null +++ b/deepin-apprepair-plugin/apprepairwidget.cpp @@ -0,0 +1,44 @@ +// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "apprepairwidget.h" + +#include + +#include + +AppRepairWidget::AppRepairWidget(AppRepairModel *model, QWidget *parent) + : DFrame(parent) + , m_model(model) +{ + initUI(); +} + +AppRepairWidget::~AppRepairWidget() +{ +} + +void AppRepairWidget::initUI() +{ + QVBoxLayout *layout = new QVBoxLayout(this); + layout->setSpacing(10); + layout->setContentsMargins(0, 0, 0, 0); + this->setLayout(layout); + + QLabel *title = new QLabel(tr("Application Repair"), this); + QFont font1 = title->font(); + font1.setBold(true); + font1.setWeight(QFont::DemiBold); + DFontSizeManager::instance()->bind(title, DFontSizeManager::T5); + title->setContentsMargins(20, 0, 0, 0); + + QLabel *detailInfo = new QLabel(tr("Apply anomaly quick fix, update continuously"), this); + DFontSizeManager::instance()->bind(detailInfo, DFontSizeManager::T8); + detailInfo->setContentsMargins(20, 0, 0, 0); + + layout->addWidget(title); + layout->addWidget(detailInfo); + layout->addStretch(); +} diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/hoverballs/hoverballsdlg.h b/deepin-apprepair-plugin/apprepairwidget.h similarity index 52% rename from deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/hoverballs/hoverballsdlg.h rename to deepin-apprepair-plugin/apprepairwidget.h index 2b9a6eb..1efd526 100644 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/hoverballs/hoverballsdlg.h +++ b/deepin-apprepair-plugin/apprepairwidget.h @@ -2,26 +2,29 @@ // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later -#pragma once -#include "hoverballsprogress.h" +#pragma once -#include -#include #include -#include +#include + +#include +#include +#include DWIDGET_USE_NAMESPACE -class HoverBallsDlg : public DAbstractDialog +class AppRepairModel; +class AppRepairWidget : public DFrame { Q_OBJECT public: - explicit HoverBallsDlg(QWidget *parent = nullptr); + explicit AppRepairWidget(AppRepairModel *model, QWidget *parent = nullptr); + ~AppRepairWidget(); private: // 初始化界面 void initUI(); private: - HoverBallsProgress *m_waterProgress; + AppRepairModel *m_model; }; diff --git a/deepin-apprepair-plugin/icons/apprepair_icons.qrc b/deepin-apprepair-plugin/icons/apprepair_icons.qrc new file mode 100644 index 0000000..0b0e5f4 --- /dev/null +++ b/deepin-apprepair-plugin/icons/apprepair_icons.qrc @@ -0,0 +1,5 @@ + + + icons/deepin-app-repair.svg + + diff --git a/deepin-apprepair-plugin/icons/icons/deepin-app-repair.svg b/deepin-apprepair-plugin/icons/icons/deepin-app-repair.svg new file mode 100644 index 0000000..fe0f4f2 --- /dev/null +++ b/deepin-apprepair-plugin/icons/icons/deepin-app-repair.svg @@ -0,0 +1,100 @@ + + + ICON/Security_tools/应用修复 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/translate_generation.sh b/deepin-apprepair-plugin/translate_generation.sh similarity index 100% rename from deepin-pc-manager-server/deepin-pc-manager-session-daemon/translate_generation.sh rename to deepin-apprepair-plugin/translate_generation.sh diff --git a/deepin-apprepair-plugin/translations/deepin-apprepair_en_US.ts b/deepin-apprepair-plugin/translations/deepin-apprepair_en_US.ts new file mode 100644 index 0000000..352c449 --- /dev/null +++ b/deepin-apprepair-plugin/translations/deepin-apprepair_en_US.ts @@ -0,0 +1,35 @@ + + + + + AppRepairModule + + + Application Repair + + + + + Apply anomaly quick fix, update continuously + + + + + Supported by UOS + + + + + AppRepairWidget + + + Application Repair + + + + + Apply anomaly quick fix, update continuously + + + + diff --git a/deepin-apprepair-plugin/translations/deepin-apprepair_zh_CN.ts b/deepin-apprepair-plugin/translations/deepin-apprepair_zh_CN.ts new file mode 100644 index 0000000..703d1a0 --- /dev/null +++ b/deepin-apprepair-plugin/translations/deepin-apprepair_zh_CN.ts @@ -0,0 +1,35 @@ + + + + + AppRepairModule + + + Application Repair + 应用修复 + + + + Apply anomaly quick fix, update continuously + 应用异常快速修复,持续更新中 + + + + Supported by UOS + 由UOS提供服务 + + + + AppRepairWidget + + + Application Repair + 应用修复 + + + + Apply anomaly quick fix, update continuously + 应用异常快速修复,持续更新中 + + + diff --git a/deepin-autostart-plugin/CMakeLists.txt b/deepin-autostart-plugin/CMakeLists.txt new file mode 100644 index 0000000..11fa153 --- /dev/null +++ b/deepin-autostart-plugin/CMakeLists.txt @@ -0,0 +1,45 @@ +cmake_minimum_required(VERSION 3.7) + +set(PLUGIN_NAME "deepin-autostart") + +project(${PLUGIN_NAME}) + +set(CMAKE_AUTOMOC ON) + +file(GLOB_RECURSE SRCS + "*.h" + "*.cpp") + +find_package(Qt5 COMPONENTS Core Widgets DBus Svg LinguistTools REQUIRED) +find_package(PkgConfig REQUIRED) +find_package(DtkWidget REQUIRED) + +pkg_check_modules(DFrameworkDBus REQUIRED dframeworkdbus) +pkg_check_modules(QGSettings REQUIRED gsettings-qt) + +file(GLOB TS_FILES "translations/*.ts") +qt5_add_translation(QM_FILES ${TS_FILES}) +add_custom_target(translationsautostart ALL DEPENDS ${QM_FILES}) +install(FILES ${QM_FILES} DESTINATION share/${PLUGIN_NAME}/translations) + +add_library(${PLUGIN_NAME} SHARED ${SRCS} icons/autostart_icons.qrc) +set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ./) +target_include_directories(${PLUGIN_NAME} PUBLIC + ${Qt5Widgets_INCLUDE_DIRS} + ${Qt5Svg_INCLUDE_DIRS} + ${DtkWidget_INCLUDE_DIRS} + ${QGSettings_INCLUDE_DIRS} + ${Qt5DBus_INCLUDE_DIRS} + ../deepin-pc-manager/include/ + ) +target_link_libraries(${PLUGIN_NAME} PRIVATE + ${Qt5Widgets_LIBRARIES} + ${Qt5Svg_LIBRARIES} + ${DtkWidget_LIBRARIES} + ${DFrameworkDBus_LIBRARIES} + ${QGSettings_LIBRARIES} + ${Qt5DBus_LIBRARIES} + ) + +install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION /usr/lib/deepin-pc-manager/modules) +install(FILES icons/icons/deepin-auto-start.svg DESTINATION /usr/share/icons/hicolor/scalable/apps) diff --git a/deepin-autostart-plugin/autostart_settings.json b/deepin-autostart-plugin/autostart_settings.json new file mode 100644 index 0000000..dbc6b7b --- /dev/null +++ b/deepin-autostart-plugin/autostart_settings.json @@ -0,0 +1,3 @@ +{ + "api" : "1.0.0" +} \ No newline at end of file diff --git a/deepin-autostart-plugin/autostartmodel.cpp b/deepin-autostart-plugin/autostartmodel.cpp new file mode 100644 index 0000000..9aa92aa --- /dev/null +++ b/deepin-autostart-plugin/autostartmodel.cpp @@ -0,0 +1,96 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "autostartmodel.h" +#include "invokers/dbusinvoker.h" +#include "invokers/invokerfactory.h" +#include "dpinyin.h" + +AutoStartModel::AutoStartModel(QObject *parent) + : QObject(parent) + , m_launcherInter(nullptr) + , m_startManagerInterface(nullptr) +{ + initData(); + initLauncherData(); +} + +AutoStartModel::~AutoStartModel() +{ +} + +// 初始化数据 +void AutoStartModel::initData() +{ + registerLauncherItemInfoMetaType(); + + // 取应用数据接口 + m_launcherInter = InvokerFactory::GetInstance().CreateInvoker("com.deepin.dde.daemon.Launcher", + "/com/deepin/dde/daemon/Launcher", + "com.deepin.dde.daemon.Launcher", + ConnectType::SESSION, this); + + m_startManagerInterface = InvokerFactory::GetInstance().CreateInvoker("com.deepin.SessionManager", + "/com/deepin/StartManager", + "com.deepin.StartManager", + ConnectType::SESSION, this); + + // 启动器与应用商店应用程序更新信号接收 + m_launcherInter->Connect("ItemChanged", this, SLOT(doRefreshPackageTable())); +} + +void AutoStartModel::initLauncherData() +{ + m_appInfoEnableList.clear(); + m_appInfoDisableList.clear(); + + QDBusMessage msg = DBUS_BLOCK_INVOKE(m_launcherInter, "GetAllItemInfos"); + QDBusArgument arg = msg.arguments().first().value(); + QList datas; + arg >> datas; + + for (const auto &it : datas) { + QString path = it.Path; + if (isAutostart(path)) { + m_appInfoEnableList.append(it); + } else { + m_appInfoDisableList.append(it); + } + } +} + +// 判断是否是开机自启 +bool AutoStartModel::isAutostart(QString sPath) +{ + QDBusMessage msg = DBUS_BLOCK_INVOKE(m_startManagerInterface, "IsAutostart", sPath); + GET_MESSAGE_VALUE(bool, flag, msg); + + return flag; +} + +bool AutoStartModel::exeAutostart(int status, QString sPath) +{ + // 执行自启动关闭操作 + if (Action_Flag_Disable == status) { + QDBusMessage msg = DBUS_BLOCK_INVOKE(m_startManagerInterface, "RemoveAutostart", sPath); + GET_MESSAGE_VALUE(bool, flag, msg); + return flag; + } else { + // 执行自启动开启操作 + QDBusMessage msg = DBUS_BLOCK_INVOKE(m_startManagerInterface, "AddAutostart", sPath); + GET_MESSAGE_VALUE(bool, flag, msg); + return flag; + } +} + +QString AutoStartModel::getRealName(QString name) +{ + return DTK_CORE_NAMESPACE::Chinese2Pinyin(name); +} + +void AutoStartModel::doRefreshPackageTable() +{ + initLauncherData(); + Q_EMIT sendRefreshTable(); +} diff --git a/deepin-autostart-plugin/autostartmodel.h b/deepin-autostart-plugin/autostartmodel.h new file mode 100644 index 0000000..634730d --- /dev/null +++ b/deepin-autostart-plugin/autostartmodel.h @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "defenderlauncherinfo.h" + +#include + +#define Action_Flag_Disable 0 // 状态标志 - 不允许 +#define Action_Flag_Enable 1 // 状态标志 - 允许 +class DBusInvokerInterface; +class AutoStartModel : public QObject +{ + Q_OBJECT +public: + explicit AutoStartModel(QObject *parent = nullptr); + ~AutoStartModel(); + + LauncherItemInfoList getAppInfoEnableList() { return m_appInfoEnableList; } + LauncherItemInfoList getAppInfoDisableList() { return m_appInfoDisableList; } + + bool isAutostart(QString sPath); + bool exeAutostart(int status, QString sPath); + QString getRealName(QString name); + +private: + void initData(); + void initLauncherData(); + +public Q_SLOTS: + void doRefreshPackageTable(); + +Q_SIGNALS: + void sendRefreshTable(); + +private: + DBusInvokerInterface *m_launcherInter; // 取应用数据接口 + DBusInvokerInterface *m_startManagerInterface; // 自启动接口 + + LauncherItemInfoList m_appInfoEnableList; + LauncherItemInfoList m_appInfoDisableList; +}; diff --git a/deepin-autostart-plugin/autostartmodule.cpp b/deepin-autostart-plugin/autostartmodule.cpp new file mode 100644 index 0000000..e9d2662 --- /dev/null +++ b/deepin-autostart-plugin/autostartmodule.cpp @@ -0,0 +1,79 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "autostartmodule.h" +#include "autostartmodel.h" +#include "autostartwidget.h" + +#include + +#include +#include + +DWIDGET_USE_NAMESPACE +DCORE_USE_NAMESPACE + +AutoStartModule::AutoStartModule() + : QObject() + , ToolBoxInterface() + , m_autoStartModel(nullptr) + , m_autoStartWidget(nullptr) +{ + QTranslator *translator = new QTranslator(this); + translator->load(QString("/usr/share/deepin-autostart/translations/deepin-autostart_%1.qm").arg(QLocale::system().name())); + QCoreApplication::installTranslator(translator); +} + +AutoStartModule::~AutoStartModule() +{ +} + +void AutoStartModule::active() +{ + if (!m_autoStartModel) { + m_autoStartModel = new AutoStartModel; + } + if (!m_autoStartWidget) { + m_autoStartWidget = new AutoStartWidget(m_autoStartModel); + } + + m_frameProxy->pushWidget(this, m_autoStartWidget); + m_autoStartWidget->setVisible(true); +} + +const QString AutoStartModule::name() const +{ + return "DEEPINAUTOSTART"; +} +const QString AutoStartModule::apptitle() const +{ + return tr("Startup Programs"); +} +const QString AutoStartModule::apptip() const +{ + return tr("Manage auto startup programs"); +} +const QString AutoStartModule::appsupporter() const +{ + return tr("Supported by UOS"); +} +const QString AutoStartModule::icon() const +{ + return "deepin-auto-start"; +} + +int AutoStartModule::apptype() const +{ + return ToolBoxProxyInterface::Apps; +} + +bool AutoStartModule::enable() const +{ + return true; +} + +bool AutoStartModule::checkauth() const +{ + return false; +} diff --git a/deepin-autostart-plugin/autostartmodule.h b/deepin-autostart-plugin/autostartmodule.h new file mode 100644 index 0000000..ffe311a --- /dev/null +++ b/deepin-autostart-plugin/autostartmodule.h @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include +#include + +#include "interface/toolboxinterface.h" +#include "interface/toolboxproxyinterface.h" + +namespace PCC_NAMESPACE { +class ToolBoxInterface; +class ToolBoxProxyInterface; +} // namespace PCC_NAMESPACE + +using namespace PCC_NAMESPACE; + +class AutoStartWidget; +class AutoStartModel; +class AutoStartModule : public QObject + , public ToolBoxInterface +{ + Q_OBJECT + + Q_PLUGIN_METADATA(IID ToolBoxInterface_iid FILE "autostart_settings.json") + Q_INTERFACES(PCC_NAMESPACE::ToolBoxInterface) + +public: + explicit AutoStartModule(); + + ~AutoStartModule() Q_DECL_OVERRIDE; + + const QString name() const Q_DECL_OVERRIDE; + const QString apptitle() const Q_DECL_OVERRIDE; + const QString apptip() const Q_DECL_OVERRIDE; + const QString appsupporter() const Q_DECL_OVERRIDE; + const QString icon() const Q_DECL_OVERRIDE; + int apptype() const Q_DECL_OVERRIDE; + bool enable() const Q_DECL_OVERRIDE; + bool checkauth() const Q_DECL_OVERRIDE; + +private: + void onStatusChanged(); + +public Q_SLOTS: + void active() Q_DECL_OVERRIDE; + +private: + AutoStartModel *m_autoStartModel; + AutoStartWidget *m_autoStartWidget; +}; diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/startupdialog/startupwidget.cpp b/deepin-autostart-plugin/autostartwidget.cpp similarity index 56% rename from deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/startupdialog/startupwidget.cpp rename to deepin-autostart-plugin/autostartwidget.cpp index fef033e..16ab6f9 100644 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/startupdialog/startupwidget.cpp +++ b/deepin-autostart-plugin/autostartwidget.cpp @@ -3,78 +3,83 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -#include "startupwidget.h" +#include "autostartwidget.h" +#include "qpaintdevice.h" -#include "../../deepin-pc-manager/src/window/modules/common/common.h" -#include "autostartmodel.h" - -#include - -#include -#include -#include +#include #include +#include #include -#include -#include +#include +#include -#include -#include -#include -#include -#include +#include #include +#include +#include #include -#include #include +#include +#include +#include +#include +#include +#include #include #include -#include #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include #define ALL_INTEVAL 0 #define LEFT_INTEVAL 10 -#define PIX_INTEVAL 4 // 表格里图片距离表格边线 间隔 -#define ACTION_FLAG_DISABLE 0 // 状态标志 - 不允许 -#define ACTION_FLAG_ENABLE 1 // 状态标志 - 允许 +#define PIX_INTEVAL 8 // 表格里图片距离表格边线 间隔 +#define ACTION_FLAG_DISABLE 0 // 状态标志 - 不允许 +#define ACTION_FLAG_ENABLE 1 // 状态标志 - 允许 #define TABLE_HEADER_SORT_HIDE 2 // 第3列掩藏 -#define NAME_COL_NAME 697 // 第1列列宽 -#define NAME_COL_ACTION 214 // 第2列列宽 +#define NAME_COL_NAME 500 // 第1列列宽 +#define NAME_COL_ACTION 217 // 第2列列宽 -#define Startup_Disable \ - ":/icons/deepin/builtin/icons/dcc_startup_disable_29px.svg" // 状态资源图片 - 不允许 -#define Startup_Enable \ - ":/icons/deepin/builtin/icons/dcc_startup_enable_29px.svg" // 状态资源图片 - 允许 +#define Startup_Disable ":/icons/deepin/builtin/icons/dcc_startup_disable_29px.svg" // 状态资源图片 - 不允许 +#define Startup_Enable ":/icons/deepin/builtin/icons/dcc_startup_enable_29px.svg" // 状态资源图片 - 允许 -QString GetAppsSourceType(QString sPath) +bool judgeIsSysAppByExecPath(const QString &execPath) { - QFile fileInfo(sPath); - QString source; - if (QFileInfo(sPath).isSymLink()) { - source = "Third-party"; - } else if (fileInfo.open(QIODevice::ReadOnly | QIODevice::Text)) { - QTextStream in(&fileInfo); - in.setCodec("UTF-8"); - QString sAllInfo = in.readAll(); - int nIndex = sAllInfo.indexOf("Exec"); - QString sOptInfo = sAllInfo.mid(nIndex, 10); - if (sOptInfo.contains("opt")) - source = "Third-party"; - else - source = "System"; + // 判断是否是系统应用 + bool isbSysApp = true; + if (execPath.contains("/opt/")) { + isbSysApp = false; + } + // android 也判定为第三方应用,非系统应用 + if (execPath.contains("android")) { + isbSysApp = false; } + + return isbSysApp; +} +bool judgeIsSysAppFromDesktop(const QString &desktopPath) +{ + // 获取执行路径 + QSettings readIniSettingMethod(desktopPath, QSettings::Format::IniFormat); + readIniSettingMethod.beginGroup("Desktop Entry"); + QString execPath = readIniSettingMethod.value("Exec").toString(); + readIniSettingMethod.endGroup(); + + // 判断是否是系统应用 + return judgeIsSysAppByExecPath(execPath); +} + +QString GetAppsSourceType(QString sPath) +{ + QString source = judgeIsSysAppFromDesktop(sPath) ? "System" : "Third-party"; return source; } -StartupWidget::StartupWidget(AutoStartModel *model, QWidget *parent) - : QWidget(parent) +AutoStartWidget::AutoStartWidget(AutoStartModel *model, QWidget *parent) + : DFrame(parent) , m_model(model) , m_detailInfo(nullptr) , m_table_view(nullptr) @@ -84,14 +89,13 @@ StartupWidget::StartupWidget(AutoStartModel *model, QWidget *parent) , m_rowCount(0) , m_nSaveSortColumn(1) { - this->setAccessibleName("rightWidget_startupWidget"); initUI(); + setLineWidth(0); - // 后台自启动数据刷新信号连接 - connect(m_model, &AutoStartModel::itemStatusChanged, this, &StartupWidget::refreshData); + connect(m_model, &AutoStartModel::sendRefreshTable, this, &AutoStartWidget::refreshData); } -StartupWidget::~StartupWidget() +AutoStartWidget::~AutoStartWidget() { Q_EMIT requstCloseInfo(); @@ -100,7 +104,7 @@ StartupWidget::~StartupWidget() m_item_model = nullptr; } -void StartupWidget::initUI() +void AutoStartWidget::initUI() { setBackgroundRole(QPalette::Window); QVBoxLayout *layout = new QVBoxLayout; @@ -108,29 +112,29 @@ void StartupWidget::initUI() layout->setContentsMargins(ALL_INTEVAL, ALL_INTEVAL, ALL_INTEVAL, ALL_INTEVAL); QLabel *title = new QLabel(tr("Startup Programs"), this); - title->setAccessibleName("startupWidget_titleLable"); QFont font1 = title->font(); font1.setBold(true); - font1.setPixelSize(16); - title->setFont(font1); + font1.setWeight(QFont::DemiBold); + DFontSizeManager::instance()->bind(title, DFontSizeManager::T5); + title->setContentsMargins(20, 0, 0, 0); m_detailInfo = new QLabel(this); - m_detailInfo->setAccessibleName("startupWidget_detalInfoLable"); - m_detailInfo->setFont(Utils::getFixFontSize(12)); + DFontSizeManager::instance()->bind(m_detailInfo, DFontSizeManager::T8); + m_detailInfo->setContentsMargins(20, 0, 0, 0); layout->addWidget(title); layout->addWidget(m_detailInfo); // table_view 属性 m_table_view = new DTableView(this); - m_table_view->setFont(Utils::getFixFontSize(14)); - m_table_view->setAccessibleName("tableFrame_tableView"); m_table_view->setSelectionBehavior(QAbstractItemView::SelectRows); m_table_view->setSelectionMode(QAbstractItemView::NoSelection); m_table_view->setEditTriggers(QAbstractItemView::NoEditTriggers); + m_table_view->horizontalHeader()->setStretchLastSection(true); m_table_view->verticalHeader()->setHidden(true); m_table_view->setSortingEnabled(true); m_table_view->verticalHeader()->setDefaultSectionSize(48); + m_table_view->horizontalHeader()->setVisible(true); m_table_view->setShowGrid(false); m_table_view->setFrameShape(QTableView::NoFrame); @@ -162,7 +166,6 @@ void StartupWidget::initUI() // 表格 m_tableWidget = new DefenderTable(this); - m_tableWidget->setAccessibleName("startupWidget_tableFrame"); m_tableWidget->setHeadViewSortHide(TABLE_HEADER_SORT_HIDE); m_tableWidget->setTableAndModel(m_table_view, m_item_model); layout->addWidget(m_tableWidget); @@ -172,73 +175,44 @@ void StartupWidget::initUI() getAppsData(); m_table_view->horizontalHeader()->setHighlightSections(false); m_table_view->horizontalHeader()->setSortIndicator(1, Qt::DescendingOrder); - m_table_view->horizontalHeader()->setStretchLastSection(true); - m_table_view->horizontalHeader()->setVisible(true); } // 取系统所有应用 -void StartupWidget::getAppsData() +void AutoStartWidget::getAppsData() { - m_mapEnable.clear(); - m_mapDisable.clear(); - - // 取所有应用数据信息 - bool succeed = m_model->updateAppsAutoStartStatus(); - if (succeed) { - QString sEnableInfo = m_model->getAllAutoStartAppsInfoStr(); - QString sDisableInfo = m_model->getAllNonautoStartAppsInfoStr(); - - auto formatData = [&](QString info, QMap &map) { - QStringList sList = info.split("|"); - for (int i = 0; i < sList.count(); ++i) { - QStringList sDetailInfoList = sList.at(i).split(","); - if (sDetailInfoList.count() >= 5) { - QList sListDetail; - sListDetail.append(sDetailInfoList.at(0)); - sListDetail.append(sDetailInfoList.at(1)); - sListDetail.append(sDetailInfoList.at(2)); - sListDetail.append(sDetailInfoList.at(3)); - map[sDetailInfoList.at(4)] = sListDetail; - } - } - }; - - formatData(sEnableInfo, m_mapEnable); - formatData(sDisableInfo, m_mapDisable); + // 清空列表内容 + for (int i = m_item_model->rowCount() - 1; i >= 0; --i) { + m_item_model->removeRow(i); + } - m_appNamefromId.clear(); - // 先按状态降序 再按名称升序 - m_rowCount = 0; - if (m_mapEnable.count() > 0) - loadMap(m_mapEnable); + m_appInfoEnableList = m_model->getAppInfoEnableList(); + m_appInfoDisableList = m_model->getAppInfoDisableList(); + m_nEnableCount = m_appInfoEnableList.count(); + m_nDisableCount = m_appInfoDisableList.count(); + m_rowCount = 0; + if (m_appInfoEnableList.count() > 0) + loadMap(m_appInfoEnableList); - if (m_mapDisable.count() > 0) - loadMap(m_mapDisable); + if (m_appInfoDisableList.count() > 0) + loadMap(m_appInfoDisableList); - // 设置统计行数据 - showTotalInfo(); - } + // 设置统计行数据 + showTotalInfo(); } // QMap容器 数据加载 -void StartupWidget::loadMap(QMap map) +void AutoStartWidget::loadMap(LauncherItemInfoList list) { - // 加载应用 - QMapIterator i(map); - while (i.hasNext()) { - i.next(); - QStringList list = i.value(); - if (list.count() < 4) - break; - - QString sName = i.key(); - QString sPath = list.at(0); - QString sIcon = list.at(1); - QString sId = list.at(2); - QString sRealName = list.at(3); + for (const auto &it : list) { + QString name = it.Name; + QString path = it.Path; + QString icon = it.Icon; + QString id = it.ID; + + //QString sRealName = m_model->getRealName(name); // 加载应用 - loadAppData(m_rowCount, sPath, sName, sIcon, sId, sRealName); + loadAppData(m_rowCount, path, name, icon, id, name); m_rowCount++; } @@ -250,31 +224,25 @@ void StartupWidget::loadMap(QMap map) m_table_view->setColumnHidden(6, true); // 设置前三列的宽度 - m_table_view->setColumnWidth(0, NAME_COL_NAME); - m_table_view->setColumnWidth(2, NAME_COL_ACTION); + m_table_view->setColumnWidth(0, 700); + m_table_view->setColumnWidth(2, 217); } // 加载每个应用的详细信息 -void StartupWidget::loadAppData( - int nRow, QString sPath, QString sName, QString sIcon, QString sId, QString sRealName) +void AutoStartWidget::loadAppData(int nRow, QString sPath, QString sName, QString sIcon, QString sId, QString sRealName) { // 判断该应用状态(是否是自启动) - bool bStatus = m_model->isAppAutoStart(sPath); + bool bStatus = m_model->isAutostart(sPath); // 设置每一行数据 m_item_model->setItem(nRow, 0, new QStandardItem(QString("%1").arg(sName))); - m_item_model->setItem( - nRow, - 1, - new QStandardItem(QString("%1").arg(bStatus ? ACTION_FLAG_ENABLE : ACTION_FLAG_DISABLE))); + m_item_model->setItem(nRow, 1, new QStandardItem(QString("%1").arg(bStatus ? ACTION_FLAG_ENABLE : ACTION_FLAG_DISABLE))); m_item_model->setItem(nRow, 2, new QStandardItem("statusButton")); m_item_model->setItem(nRow, 3, new QStandardItem(QString("%1").arg(sId))); m_item_model->setItem(nRow, 4, new QStandardItem(QString("%1").arg(sIcon))); m_item_model->setItem(nRow, 5, new QStandardItem(QString("%1").arg(sPath))); m_item_model->setItem(nRow, 6, new QStandardItem(QString("%1").arg(sRealName))); - m_appNamefromId[sId] = sRealName; - // 字体样式 QPalette pal; if (bStatus) @@ -288,7 +256,7 @@ void StartupWidget::loadAppData( button->setProperty("status", bStatus ? ACTION_FLAG_DISABLE : ACTION_FLAG_ENABLE); button->setProperty("path", sPath); button->setProperty("id", sId); - connect(button, &QPushButton::clicked, this, &StartupWidget::onTableBtnClicked); + connect(button, &QPushButton::clicked, this, &AutoStartWidget::onTableBtnClicked); DFrame *buttonFrame = new DFrame(this); QVBoxLayout *buttonLayout = new QVBoxLayout; @@ -300,7 +268,7 @@ void StartupWidget::loadAppData( } // 表格按钮点击槽 -void StartupWidget::onTableBtnClicked() +void AutoStartWidget::onTableBtnClicked() { QPushButton *button = qobject_cast(sender()); int nStatus = button->property("status").toInt(); @@ -308,32 +276,32 @@ void StartupWidget::onTableBtnClicked() QString sID = button->property("id").toString(); // 执行自启动开启/关闭操作 - bool isExeAutoStart = m_model->setAppAutoStart(nStatus, sPath); + bool isExeAutoStart = m_model->exeAutostart(nStatus, sPath); if (isExeAutoStart) { - if (ACTION_FLAG_DISABLE == nStatus) + if (ACTION_FLAG_DISABLE == nStatus) { changeItemStatus(false, sID); - else + m_nEnableCount -= 1; + m_nDisableCount += 1; + } else { changeItemStatus(true, sID); + m_nEnableCount += 1; + m_nDisableCount -= 1; + } - // 添加安全日志 - QString log = nStatus ? tr("Enabled auto startup for %1").arg(m_appNamefromId[sID]) - : tr("Disabled auto startup for %1").arg(m_appNamefromId[sID]); - m_model->addSecurityLog(SECURITY_LOG_TYPE_TOOL, log); showTotalInfo(); } } // 按钮点击后改变相应行的显示数据和状态 -void StartupWidget::changeItemStatus(bool isStartup, QString sFlagData) +void AutoStartWidget::changeItemStatus(bool isStartup, QString sFlagData) { QModelIndex index = m_table_view->currentIndex(); int rows = m_item_model->rowCount(); int column = m_item_model->columnCount(); for (int i = 0; i < rows; ++i) { for (int j = 0; j < column; ++j) { - QString sData = - m_item_model->data(m_item_model->index(i, j), Qt::DisplayRole).toString(); + QString sData = m_item_model->data(m_item_model->index(i, j), Qt::DisplayRole).toString(); if (j == 3 && sData == sFlagData) { QWidget *widget = m_table_view->indexWidget(m_item_model->index(i, 2)); QPushButton *button = widget->findChild(sFlagData); @@ -352,64 +320,43 @@ void StartupWidget::changeItemStatus(bool isStartup, QString sFlagData) } // 设置前三列的宽度 - m_table_view->setColumnWidth(0, NAME_COL_NAME); + m_table_view->setColumnWidth(0, 700); m_table_view->setColumnWidth(2, NAME_COL_ACTION); m_table_view->selectRow(index.row()); } // 外部调用刷新表格数据 -void StartupWidget::refreshData(bool bAdd, QString sID) +void AutoStartWidget::refreshData() { - changeItemStatus(bAdd, sID); - showTotalInfo(); + getAppsData(); } // 设置统计行信息 -void StartupWidget::showTotalInfo() +void AutoStartWidget::showTotalInfo() { - int nAllCount = 0; - int nEnableCount = 0; - int nDisableCount = 0; - - bool isStarted = m_model->updateAppsAutoStartStatus(); - if (isStarted) { - QString sEnableInfo = m_model->getAllAutoStartAppsInfoStr(); - QString sDisableInfo = m_model->getAllNonautoStartAppsInfoStr(); - - if (!sEnableInfo.isEmpty()) - nEnableCount = sEnableInfo.split("|").count(); - - if (!sDisableInfo.isEmpty()) - nDisableCount = sDisableInfo.split("|").count(); - } - nAllCount = nEnableCount + nDisableCount; + int nAllCount = m_nEnableCount + m_nDisableCount; // 设置统计行数据 - m_detailInfo->setText(tr("Startup apps") + QString(": %1 ").arg(nEnableCount) - + tr("All apps") + QString(": %1").arg(nAllCount)); + m_detailInfo->setText(tr("Startup apps") + QString(": %1 ").arg(m_nEnableCount) + tr("All apps") + QString(": %1").arg(nAllCount)); } // 代理函数 -MyItemDelegate::MyItemDelegate(StartupWidget *widget, QObject *parent) +MyItemDelegate::MyItemDelegate(AutoStartWidget *widget, QObject *parent) : QItemDelegate(parent) { m_widget = widget; } // 重绘操作 -void MyItemDelegate::paint(QPainter *painter, - const QStyleOptionViewItem &option, - const QModelIndex &index) const +void MyItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { // 第一列 if (index.column() == 0) { // 图标路径 - QString sIconPath = - index.model()->data(index.model()->index(index.row(), 4), Qt::DisplayRole).toString(); + QString sIconPath = index.model()->data(index.model()->index(index.row(), 4), Qt::DisplayRole).toString(); // 读取该应用执行信息 - QString sPath = - index.model()->data(index.model()->index(index.row(), 5), Qt::DisplayRole).toString(); + QString sPath = index.model()->data(index.model()->index(index.row(), 5), Qt::DisplayRole).toString(); // 设置图片 QRect rect = option.rect; @@ -418,19 +365,11 @@ void MyItemDelegate::paint(QPainter *painter, int height = rect.height() - PIX_INTEVAL * 2; QFont font2; - font2.setFamily("SourceHanSansSC-Normal"); // 字体 - font2.setPixelSize(12); // 文字像素大小 + font2.setFamily("SourceHanSansSC-Normal"); //字体 + font2.setPixelSize(12); //文字像素大小 QPen pen2; pen2.setColor(QColor("#52607f")); - QString sStr = GetAppsSourceType(sPath).toStdString().c_str(); - QString sAppsSources; - if (sStr == "Third-party") { - sAppsSources = tr("Third-party"); - } else { - sAppsSources = tr("System"); - } - QFile file(sIconPath); if (file.open(QIODevice::ReadOnly) && sIconPath.contains("/")) { file.close(); @@ -451,20 +390,14 @@ void MyItemDelegate::paint(QPainter *painter, int textWidth = rect.width() - height - PIX_INTEVAL * 8; int x = pix_x + height + PIX_INTEVAL * 2; int y = pix_y + rect.height() / 4 + height / 8; - int y1 = pix_y + rect.height() / 2 + height / 4 + PIX_INTEVAL; - QString sName = - index.model()->data(index.model()->index(index.row(), 6), Qt::DisplayRole).toString(); - QString sElidedName = painter->fontMetrics().elidedText(sName, - Qt::ElideRight, - textWidth, - Qt::TextShowMnemonic); + int y1 = pix_y + rect.height() / 2 + height / 4; + QString sName = index.model()->data(index.model()->index(index.row(), 6), Qt::DisplayRole).toString(); + QString sElidedName = painter->fontMetrics().elidedText(sName, Qt::ElideRight, textWidth, Qt::TextShowMnemonic); painter->drawText(x + LEFT_INTEVAL, y, sElidedName); // 绘画应用来源 - QString sElidedSource = painter->fontMetrics().elidedText(sAppsSources, - Qt::ElideRight, - textWidth, - Qt::TextShowMnemonic); + QString sAppsSources = judgeIsSysAppFromDesktop(sPath) ? tr("System") : tr("Third-party"); + QString sElidedSource = painter->fontMetrics().elidedText(sAppsSources, Qt::ElideRight, textWidth, Qt::TextShowMnemonic); painter->setFont(font2); painter->setPen(pen2); painter->drawText(x + LEFT_INTEVAL, y1, sElidedSource); @@ -474,7 +407,9 @@ void MyItemDelegate::paint(QPainter *painter, else if (index.column() == 1) { // 设置图片 int nStatus = index.model()->data(index, Qt::DisplayRole).toInt(); - QPixmap pixmap = (nStatus == 0) ? QPixmap(Startup_Disable) : QPixmap(Startup_Enable); + QPixmap pixmap = (nStatus == 0) + ? QPixmap(Startup_Disable) + : QPixmap(Startup_Enable); pixmap = m_widget->getPixmap(pixmap); const QPixmap &star = pixmap; @@ -492,7 +427,7 @@ void MyItemDelegate::paint(QPainter *painter, } } -QPixmap StartupWidget::getPixmap(QPixmap pixmap) +QPixmap AutoStartWidget::getPixmap(QPixmap pixmap) { const qreal ratio = devicePixelRatioF(); pixmap.scaled(pixmap.size() * ratio, Qt::KeepAspectRatio, Qt::SmoothTransformation); @@ -500,7 +435,9 @@ QPixmap StartupWidget::getPixmap(QPixmap pixmap) return pixmap; } -StartupModel::StartupModel() { } +StartupModel::StartupModel() +{ +} QVariant StartupModel::data(const QModelIndex &index, int role) const { @@ -511,7 +448,7 @@ QVariant StartupModel::data(const QModelIndex &index, int role) const return int(Qt::AlignLeft | Qt::AlignVCenter); } else if (role == Qt::DisplayRole) { return QStandardItemModel::data(index, role); - } else if (role == Qt::BackgroundRole) { + } else if (role == Qt::BackgroundColorRole) { if (index.row() % 2 == 0) { return QColor(0, 0, 0, 8); } else if (index.row() % 5 == 1) @@ -522,21 +459,3 @@ QVariant StartupModel::data(const QModelIndex &index, int role) const return QVariant(); } - -StartupMainWindow::StartupMainWindow(QWidget *pParent) - : DefSecurityToolsMnd(pParent) - , m_pStartupWidget(nullptr) -{ - AutoStartModel *pAutoStartModel = new AutoStartModel(this); - m_pStartupWidget = new StartupWidget(pAutoStartModel); - addContent(m_pStartupWidget); - setFixedSize(960, 640); -} - -StartupMainWindow::~StartupMainWindow() { } - -void StartupMainWindow::closeEvent(QCloseEvent *event) -{ - Q_EMIT sendWindowClose(); - event->accept(); -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/startupdialog/startupwidget.h b/deepin-autostart-plugin/autostartwidget.h similarity index 68% rename from deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/startupdialog/startupwidget.h rename to deepin-autostart-plugin/autostartwidget.h index 88fe137..be1cccd 100644 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/startupdialog/startupwidget.h +++ b/deepin-autostart-plugin/autostartwidget.h @@ -4,24 +4,27 @@ // SPDX-License-Identifier: GPL-3.0-or-later #pragma once -#include "widgets/defendertable.h" -#include "../defsecuritytoolsmnd.h" + +#include "defendertable.h" +#include "autostartmodel.h" + +#include +#include #include +#include -class DBusInvokerInterface; class AutoStartModel; - DWIDGET_USE_NAMESPACE using namespace def::widgets; /************************* StartupWidget实现类 表格代理 ***********************/ -class StartupWidget; +class AutoStartWidget; class MyItemDelegate : public QItemDelegate { Q_OBJECT public: - MyItemDelegate(StartupWidget *widget, QObject *parent = nullptr); + MyItemDelegate(AutoStartWidget *widget, QObject *parent = nullptr); virtual ~MyItemDelegate() {} void paint(QPainter *painter, @@ -30,7 +33,7 @@ class MyItemDelegate : public QItemDelegate private: QPixmap m_pixmap; - StartupWidget *m_widget; + AutoStartWidget *m_widget; }; /************************* StartupWidget实现类 表格颜色重载 ***********************/ @@ -44,12 +47,12 @@ class StartupModel : public QStandardItemModel /**************************** StartupWidget实现类 ********************************/ class QLabel; -class StartupWidget : public QWidget +class AutoStartWidget : public DFrame { Q_OBJECT public: - explicit StartupWidget(AutoStartModel *model, QWidget *parent = nullptr); - ~StartupWidget(); + explicit AutoStartWidget(AutoStartModel *model, QWidget *parent = nullptr); + ~AutoStartWidget(); QPixmap getPixmap(QPixmap); Q_SIGNALS: @@ -62,14 +65,14 @@ public Q_SLOTS: void getAppsData(); // 外部调用刷新表格数据 - void refreshData(bool bAdd, QString sID); + void refreshData(); private: // 初始化界面 void initUI(); // 加再数据到Map容器 进行数据处理 - void loadMap(QMap); + void loadMap(LauncherItemInfoList list); // 将处理后的数据加载到QTableView表格 void loadAppData(int nRow, QString sPath, QString sName, QString sIcon, QString sId, QString sRealName); @@ -88,27 +91,11 @@ public Q_SLOTS: DefenderTable *m_tableWidget; int m_rowCount; // 表格加载数据总行数 - QMap m_mapEnable; // 不允许自启动数据容器 - QMap m_mapDisable; // 允许自启动数据容器 - QMap m_appNamefromId; + LauncherItemInfoList m_appInfoEnableList; + LauncherItemInfoList m_appInfoDisableList; + int m_nEnableCount; + int m_nDisableCount; int m_nSaveSortColumn; Qt::SortOrder m_nSaveSortOrder = Qt::DescendingOrder; }; - -class StartupMainWindow : public DefSecurityToolsMnd -{ - Q_OBJECT -public: - explicit StartupMainWindow(QWidget *pParent = nullptr); - ~StartupMainWindow() override; - -protected: - void closeEvent(QCloseEvent *event) override; - -Q_SIGNALS: - void sendWindowClose(); - -private: - StartupWidget *m_pStartupWidget; -}; diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/defenderlauncherinfo.cpp b/deepin-autostart-plugin/defenderlauncherinfo.cpp similarity index 100% rename from deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/defenderlauncherinfo.cpp rename to deepin-autostart-plugin/defenderlauncherinfo.cpp diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/defenderlauncherinfo.h b/deepin-autostart-plugin/defenderlauncherinfo.h similarity index 100% rename from deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/defenderlauncherinfo.h rename to deepin-autostart-plugin/defenderlauncherinfo.h diff --git a/deepin-pc-manager/src/widgets/defendertable.cpp b/deepin-autostart-plugin/defendertable.cpp similarity index 95% rename from deepin-pc-manager/src/widgets/defendertable.cpp rename to deepin-autostart-plugin/defendertable.cpp index 3a8934e..f1cbde5 100755 --- a/deepin-pc-manager/src/widgets/defendertable.cpp +++ b/deepin-autostart-plugin/defendertable.cpp @@ -4,17 +4,15 @@ // SPDX-License-Identifier: GPL-3.0-or-later #include "defendertable.h" - #include "defendertableheaderview.h" -#include #include #include +#include #include DWIDGET_USE_NAMESPACE - namespace def { namespace widgets { @@ -38,7 +36,9 @@ DefenderTable::DefenderTable(QWidget *parent, int height) initUI(); } -DefenderTable::~DefenderTable() { } +DefenderTable::~DefenderTable() +{ +} void DefenderTable::initUI() { @@ -47,7 +47,7 @@ void DefenderTable::initUI() mainLayout->setContentsMargins(2, 2, 2, 2); setLayout(mainLayout); - // 创建主题风格背景 + //创建主题风格背景 m_mainBackgroundWidgt = new DFrame(this); m_mainBackgroundWidgt->setAccessibleName(accessibleName() + "_bgWidget"); m_mainBackgroundWidgt->lower(); @@ -232,11 +232,11 @@ void DefenderTable::setTableAndModel(DTableView *table, QStandardItemModel *mode }); } -// 废弃于2020.4.30 +//废弃于2020.4.30 void DefenderTable::setRowHeight(int height) { m_rowHeight = height; - // 设置每一行的高度 + //设置每一行的高度 for (int i = 0; i < m_rowCount; i++) m_table->setRowHeight(i, m_rowHeight); } @@ -252,10 +252,9 @@ void DefenderTable::resizeEvent(QResizeEvent *event) for (int i = 0; i < m_rowCount; i++) { int rowHeight = m_table->rowHeight(i); m_table->setRowHeight(i, rowHeight); - m_backgroundLst[i]->setFixedWidth(m_table->width() - + m_table->horizontalScrollBar()->maximum() - 1); + m_backgroundLst[i]->setFixedWidth(m_table->width() + m_table->horizontalScrollBar()->maximum() - 20); m_backgroundLst[i]->setFixedHeight(rowHeight); - m_backgroundLst[i]->move(-m_table->horizontalScrollBar()->value(), + m_backgroundLst[i]->move(-m_table->horizontalScrollBar()->value() + 10, initY + i * rowHeight - m_table->verticalScrollBar()->value()); } } @@ -269,10 +268,9 @@ void DefenderTable::paintEvent(QPaintEvent *event) for (int i = 0; i < m_rowCount; i++) { int rowHeight = m_table->rowHeight(i); m_table->setRowHeight(i, rowHeight); - m_backgroundLst[i]->setFixedWidth(m_table->width() - + m_table->horizontalScrollBar()->maximum() - 1); + m_backgroundLst[i]->setFixedWidth(m_table->width() + m_table->horizontalScrollBar()->maximum() - 20); m_backgroundLst[i]->setFixedHeight(rowHeight); - m_backgroundLst[i]->move(-m_table->horizontalScrollBar()->value(), + m_backgroundLst[i]->move(-m_table->horizontalScrollBar()->value() + 10, initY + i * rowHeight - m_table->verticalScrollBar()->value()); } } diff --git a/deepin-pc-manager/src/widgets/defendertable.h b/deepin-autostart-plugin/defendertable.h similarity index 85% rename from deepin-pc-manager/src/widgets/defendertable.h rename to deepin-autostart-plugin/defendertable.h index 583c665..177c8de 100755 --- a/deepin-pc-manager/src/widgets/defendertable.h +++ b/deepin-autostart-plugin/defendertable.h @@ -8,18 +8,17 @@ #include #include -#include -#include +#include #include +#include #include -#include +#include DWIDGET_USE_NAMESPACE #define ROW_HEIGHT 30 // 初始化高度 class DefenderTableHeaderView; - namespace def { namespace widgets { @@ -49,13 +48,13 @@ class DefenderTable : public DFrame private: DefenderTableHeaderView *m_headerDelegate; // 表头代理类 - DFrame *m_mainBackgroundWidgt; // 填充背景的frame控件 + DFrame *m_mainBackgroundWidgt; // 填充背景的frame控件 QStandardItemModel *m_tableModel; // 数据模型 - DTableView *m_table; // 表格 - QList m_backgroundLst; // 背景列表 + DTableView *m_table; // 表格 + QList m_backgroundLst; // 背景列表 int m_rowHeight; // 行高 - int m_rowCount; // 总共的行数 + int m_rowCount; // 总共的行数 }; } // namespace widgets diff --git a/deepin-pc-manager/src/widgets/defendertableheaderview.cpp b/deepin-autostart-plugin/defendertableheaderview.cpp similarity index 83% rename from deepin-pc-manager/src/widgets/defendertableheaderview.cpp rename to deepin-autostart-plugin/defendertableheaderview.cpp index a64d932..12781eb 100644 --- a/deepin-pc-manager/src/widgets/defendertableheaderview.cpp +++ b/deepin-autostart-plugin/defendertableheaderview.cpp @@ -5,17 +5,17 @@ #include "defendertableheaderview.h" -#include -#include -#include -#include -#include - #include #include #include #include +#include +#include +#include +#include +#include + static const int kSpacingMargin = 4; DefenderTableHeaderView::DefenderTableHeaderView(Qt::Orientation orientation, QWidget *parent) @@ -30,16 +30,10 @@ DefenderTableHeaderView::DefenderTableHeaderView(Qt::Orientation orientation, QW setFixedHeight(37); setFocusPolicy(Qt::StrongFocus); setSortIndicatorShown(true); - - QFont f; - f.setPixelSize(14); - setFont(f); } // 绘制表头 -void DefenderTableHeaderView::paintSection(QPainter *painter, - const QRect &rect, - int logicalIndex) const +void DefenderTableHeaderView::paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const { // 绘制设置 painter->save(); @@ -50,7 +44,8 @@ void DefenderTableHeaderView::paintSection(QPainter *painter, cg = DPalette::Active; // 获取系统样式 - DPalette palette = qApp->palette(); + DApplicationHelper *dAppHelper = DApplicationHelper::instance(); + DPalette palette = dAppHelper->applicationPalette(); // 设置风格 DStyle *style = dynamic_cast(DApplication::style()); @@ -62,9 +57,7 @@ void DefenderTableHeaderView::paintSection(QPainter *painter, // 标题 QRect contentRect(rect.x(), rect.y(), rect.width(), rect.height() - m_spacing); - QRect hSpacingRect(rect.x(), - contentRect.height(), - rect.width(), + QRect hSpacingRect(rect.x(), contentRect.height(), rect.width(), rect.height() - contentRect.height()); QBrush contentBrush(palette.color(cg, DPalette::Base)); @@ -72,9 +65,7 @@ void DefenderTableHeaderView::paintSection(QPainter *painter, QBrush hSpacingBrush(palette.color(cg, DPalette::FrameBorder)); // 纵向间隔 QBrush vSpacingBrush(palette.color(cg, DPalette::FrameBorder)); - QRectF vSpacingRect(rect.x(), - rect.y() + kSpacingMargin, - m_spacing, + QRectF vSpacingRect(rect.x(), rect.y() + kSpacingMargin, m_spacing, rect.height() - kSpacingMargin * 2); QBrush clearBrush(palette.color(cg, DPalette::Window)); @@ -92,15 +83,11 @@ void DefenderTableHeaderView::paintSection(QPainter *painter, // 绘制文字 QRect textRect; if (sortIndicatorSection() == logicalIndex) { - textRect = { contentRect.x() + margin, - contentRect.y(), - contentRect.width() - margin * 3 - 8, - contentRect.height() }; + textRect = {contentRect.x() + margin, contentRect.y(), contentRect.width() - margin * 3 - 8, + contentRect.height()}; } else { - textRect = { contentRect.x() + margin, - contentRect.y(), - contentRect.width() - margin, - contentRect.height() }; + textRect = {contentRect.x() + margin, contentRect.y(), contentRect.width() - margin, + contentRect.height()}; } QString title = model()->headerData(logicalIndex, orientation(), Qt::DisplayRole).toString(); int align = Qt::AlignLeft | Qt::AlignVCenter; @@ -123,9 +110,7 @@ void DefenderTableHeaderView::paintSection(QPainter *painter, && !m_indicatorHiddingColList.contains(logicalIndex)) { // 绘制排序的箭头图标(8×5) QRect sortIndicator(textRect.x() + textRect.width() + margin, - textRect.y() + (textRect.height() - 5) / 2, - 8, - 5); + textRect.y() + (textRect.height() - 5) / 2, 8, 5); option.rect = sortIndicator; if (sortIndicatorOrder() == Qt::DescendingOrder) { style->drawPrimitive(DStyle::PE_IndicatorArrowDown, &option, painter, this); @@ -153,7 +138,8 @@ void DefenderTableHeaderView::paintEvent(QPaintEvent *event) cg = DPalette::Active; // 获取系统样式 - DPalette palette = qApp->palette(); + DApplicationHelper *dAppHelper = DApplicationHelper::instance(); + DPalette palette = dAppHelper->applicationPalette(); // 设置风格 DStyle *style = dynamic_cast(DApplication::style()); @@ -181,10 +167,7 @@ void DefenderTableHeaderView::paintEvent(QPaintEvent *event) if (hasFocus() && (m_reson == Qt::TabFocusReason || m_reson == Qt::BacktabFocusReason)) { QStyleOptionFocusRect o; o.QStyleOption::operator=(option); - QRect focusRect{ rect.x() - offset(), - rect.y(), - length() - sectionPosition(0), - rect.height() }; + QRect focusRect {rect.x() - offset(), rect.y(), length() - sectionPosition(0), rect.height()}; o.rect = style->visualRect(layoutDirection(), rect, focusRect); style->drawPrimitive(DStyle::PE_FrameFocusRect, &o, &painter); } @@ -206,9 +189,9 @@ int DefenderTableHeaderView::sectionSizeHint(int logicalIndex) const QFontMetrics fm(DApplication::font()); QString buf = model()->headerData(logicalIndex, Qt::Horizontal, Qt::DisplayRole).toString(); if (sortIndicatorSection() == logicalIndex) { - return fm.horizontalAdvance(buf) + margin * 3 + 8; + return fm.width(buf) + margin * 3 + 8; } else { - return fm.horizontalAdvance(buf) + margin * 2; + return fm.width(buf) + margin * 2; } } diff --git a/deepin-pc-manager/src/widgets/defendertableheaderview.h b/deepin-autostart-plugin/defendertableheaderview.h similarity index 87% rename from deepin-pc-manager/src/widgets/defendertableheaderview.h rename to deepin-autostart-plugin/defendertableheaderview.h index 40d7334..536f375 100644 --- a/deepin-pc-manager/src/widgets/defendertableheaderview.h +++ b/deepin-autostart-plugin/defendertableheaderview.h @@ -22,7 +22,6 @@ class DefenderTableHeaderView : public DHeaderView // 表头间隔 inline int getSpacing() const { return m_spacing; } - inline void setSpacing(int spacing) { m_spacing = spacing; } // 掩藏某列表头下标 @@ -33,9 +32,7 @@ class DefenderTableHeaderView : public DHeaderView protected: // 表头类绘制事件 void paintEvent(QPaintEvent *e) override; - virtual void paintSection(QPainter *painter, - const QRect &rect, - int logicalIndex) const override; + virtual void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const override; // 焦点事件 void focusInEvent(QFocusEvent *event) override; diff --git a/deepin-autostart-plugin/icons/autostart_icons.qrc b/deepin-autostart-plugin/icons/autostart_icons.qrc new file mode 100644 index 0000000..16dda7c --- /dev/null +++ b/deepin-autostart-plugin/icons/autostart_icons.qrc @@ -0,0 +1,5 @@ + + + icons/deepin-auto-start.svg + + diff --git a/deepin-pc-manager/src/window/icons/icons/Startup_Programs_48px.svg b/deepin-autostart-plugin/icons/icons/deepin-auto-start.svg similarity index 100% rename from deepin-pc-manager/src/window/icons/icons/Startup_Programs_48px.svg rename to deepin-autostart-plugin/icons/icons/deepin-auto-start.svg diff --git a/deepin-autostart-plugin/invokers/dbusinvoker.cpp b/deepin-autostart-plugin/invokers/dbusinvoker.cpp new file mode 100644 index 0000000..58219a5 --- /dev/null +++ b/deepin-autostart-plugin/invokers/dbusinvoker.cpp @@ -0,0 +1,104 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "dbusinvoker.h" + +#include +#include + +DBusInvoker::DBusInvoker(const QString &service, + const QString &path, + const QString &interface, + ConnectType type, + QObject *parent) + : QObject(parent) + , m_service(service) + , m_path(path) + , m_interface(interface) + , m_type(type) + , m_connection(QDBusConnection::sessionBus()) +{ + if (SYSTEM == m_type) { + m_connection = QDBusConnection::systemBus(); + } +} + +// signal-slot connection +bool DBusInvoker::Connect(const QString &signal, QObject *reciver, const char *slot) +{ + bool connectRst = false; + connectRst = m_connection.connect(m_service, m_path, m_interface, signal, reciver, slot); + if (!connectRst) { + qCritical() << "signal connect failed : " << signal << "for reason [" + << m_connection.lastError().message() << "]"; + } + Q_ASSERT(connectRst); + return connectRst; +} + +// signal-slot disconnection +bool DBusInvoker::Disconnect(const QString &signal, QObject *reciver, const char *slot) +{ + bool disconnectRst = false; + disconnectRst = m_connection.disconnect(m_service, m_path, m_interface, signal, reciver, slot); + if (!disconnectRst) { + qCritical() << "signal disconnect failed : " << signal << "for reason [" + << m_connection.lastError().message() << "]"; + } + Q_ASSERT(disconnectRst); + return disconnectRst; +} + +DBusInvoker::~DBusInvoker() +{ + // 确保在调用delete时,释放自身成员对象 + deleteLater(); +} + +// create method call or signal emit +// invoke like this : +// invoker->Connect("signalFunc", this, SLOT(slotFunc(bool, QString))); +// there would be param type validate when signal emitted +QDBusMessage DBusInvoker::Invoke(const QString &name, + const QList &functionParams, + BlockMode mode) +{ + if (name.isEmpty()) { + return QDBusMessage::createError(QDBusError::InvalidArgs, QString("name.isEmpty")); + } + + QDBusMessage msg; + if (DBUS_PROPERTY_INVOKER_NAME == name) { + if (functionParams.isEmpty()) { + return QDBusMessage::createError(QDBusError::InvalidArgs, + QString("property not exist")); + } + + msg = QDBusMessage::createMethodCall(m_service, + m_path, + "org.freedesktop.DBus.Properties", + "Get"); + msg.setArguments({m_interface, functionParams.first().toString()}); + + QDBusMessage retMsg = m_connection.call(msg, QDBus::CallMode(mode)); + return retMsg; + } + + msg = QDBusMessage::createMethodCall(m_service, m_path, m_interface, name); + msg.setArguments(functionParams); + + return m_connection.call(msg, QDBus::CallMode(mode)); +} + +// emit signal +bool DBusInvoker::EmitSignal(const QString &name, const QList &arguments) +{ + if (name.isEmpty()) { + return false; + } + + QDBusMessage signal = QDBusMessage::createSignal(m_path, m_interface, name); + signal.setArguments(arguments); + return m_connection.send(signal); +} diff --git a/deepin-autostart-plugin/invokers/dbusinvoker.h b/deepin-autostart-plugin/invokers/dbusinvoker.h new file mode 100644 index 0000000..d1a8ab9 --- /dev/null +++ b/deepin-autostart-plugin/invokers/dbusinvoker.h @@ -0,0 +1,48 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef DBUS_INVOKER_H +#define DBUS_INVOKER_H + +#include "invokerinterface.h" + +#include +#include + +// 公共dbus接口类 +#define DBUS_PROPERTY_INVOKER_NAME "dbusPropertyInvoker" // 公共dbus接口属性获取识别 +// interface +class DBusInvoker : public QObject + , public DBusInvokerInterface +{ + Q_OBJECT +public: + DBusInvoker(const QString &service, + const QString &path, + const QString &interface, + ConnectType type = ConnectType::SESSION, + QObject *parent = nullptr); + + virtual QDBusMessage Invoke(const QString &name, + const QList &functionParams = QList(), + BlockMode mode = BlockMode::BLOCKWITHGUI) override; + virtual bool EmitSignal(const QString &name, + const QList &arguments = QList()) override; + virtual bool Connect(const QString &signal, QObject *reciver, const char *slot) override; + virtual bool Disconnect(const QString &signal, QObject *reciver, const char *slot) override; + virtual ~DBusInvoker() override; + +private: + QString m_service; + QString m_path; + QString m_interface; + ConnectType m_type; + QDBusConnection m_connection; + +private: + DBusInvoker(const DBusInvoker &); + DBusInvoker &operator=(const DBusInvoker &); +}; + +#endif diff --git a/deepin-autostart-plugin/invokers/invokerfactory.cpp b/deepin-autostart-plugin/invokers/invokerfactory.cpp new file mode 100644 index 0000000..f0c0634 --- /dev/null +++ b/deepin-autostart-plugin/invokers/invokerfactory.cpp @@ -0,0 +1,38 @@ +// Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "invokerfactory.h" + +#include "dbusinvoker.h" + +InvokerFactory::InvokerFactory() +{ +} + +InvokerFactory::~InvokerFactory() +{ +} + +DBusInvokerInterface *InvokerFactory::CreateInvoker(const QString &service, + const QString &path, + const QString &interface, + ConnectType type, + QObject *parent) +{ + return new DBusInvoker(service, path, interface, type, parent); +} + +// 单元测试扩展处理 +void InvokerFactory::setInvokerInteface(const QString &interfaceName, + DBusInvokerInterface *interface) +{ +#ifdef DEEPIN_DEFENDER_UNITTEST + // 不关心是否重复 + m_intefaceMap.insert(interfaceName, interface); +#else + Q_UNUSED(interfaceName); + Q_UNUSED(interface); +#endif +} diff --git a/deepin-pc-manager/src/window/modules/common/invokers/invokerfactory.h b/deepin-autostart-plugin/invokers/invokerfactory.h similarity index 68% rename from deepin-pc-manager/src/window/modules/common/invokers/invokerfactory.h rename to deepin-autostart-plugin/invokers/invokerfactory.h index 330bb53..2f25e78 100644 --- a/deepin-pc-manager/src/window/modules/common/invokers/invokerfactory.h +++ b/deepin-autostart-plugin/invokers/invokerfactory.h @@ -12,15 +12,16 @@ // 简化DBUS调用方法的写法 #define DBUS_BLOCK_INVOKE(interface, funName, ...) \ - interface->Invoke(funName, { __VA_ARGS__ }, BlockMode::BLOCK) + interface->Invoke(funName, {__VA_ARGS__}, BlockMode::BLOCK) #define DBUS_INVOKE(interface, funName, ...) \ - interface->Invoke(funName, { __VA_ARGS__ }, BlockMode::BLOCKWITHGUI) + interface->Invoke(funName, {__VA_ARGS__}, BlockMode::BLOCKWITHGUI) #define DBUS_NOBLOCK_INVOKE(interface, funName, ...) \ - interface->Invoke(funName, { __VA_ARGS__ }, BlockMode::NOBLOCK) + interface->Invoke(funName, {__VA_ARGS__}, BlockMode::NOBLOCK) #define GET_MESSAGE_VALUE(type, output, message) type output = QDBusReply(message).value() // implement -class InvokerFactory : public QObject, public InvokerFactoryInterface +class InvokerFactory : public QObject + , public InvokerFactoryInterface { Q_OBJECT public: @@ -35,13 +36,9 @@ class InvokerFactory : public QObject, public InvokerFactoryInterface const QString &interface, ConnectType type = ConnectType::SESSION, QObject *parent = nullptr) override; - virtual SettingsInvokerInterface *CreateSettings(const QByteArray &schema_id, - const QByteArray &path = QByteArray(), - QObject *parent = nullptr) override; public: void setInvokerInteface(const QString &, DBusInvokerInterface *); - void setSettinsInteface(const QString &, SettingsInvokerInterface *); private: InvokerFactory(); @@ -50,7 +47,6 @@ class InvokerFactory : public QObject, public InvokerFactoryInterface ~InvokerFactory() override; QMap m_intefaceMap; - QMap m_settingsMap; }; #endif diff --git a/deepin-pc-manager/src/window/modules/common/invokers/invokerinterface.h b/deepin-autostart-plugin/invokers/invokerinterface.h similarity index 64% rename from deepin-pc-manager/src/window/modules/common/invokers/invokerinterface.h rename to deepin-autostart-plugin/invokers/invokerinterface.h index f052de0..4702801 100644 --- a/deepin-pc-manager/src/window/modules/common/invokers/invokerinterface.h +++ b/deepin-autostart-plugin/invokers/invokerinterface.h @@ -10,11 +10,16 @@ #include #include -enum ConnectType { SYSTEM, SESSION }; +enum ConnectType { SYSTEM, + SESSION }; -enum InvokeType { CALL, SIGNAL }; +enum InvokeType { CALL, + SIGNAL }; -enum BlockMode { NOBLOCK, BLOCK, BLOCKWITHGUI, AUTODETECT }; +enum BlockMode { NOBLOCK, + BLOCK, + BLOCKWITHGUI, + AUTODETECT }; // interface class DBusInvokerInterface @@ -28,17 +33,7 @@ class DBusInvokerInterface virtual bool Connect(const QString &signal, QObject *reciver, const char *slot) = 0; virtual bool Disconnect(const QString &signal, QObject *reciver, const char *slot) = 0; - virtual ~DBusInvokerInterface() { } -}; - -class SettingsInvokerInterface -{ -public: - virtual QVariant GetValue(const QString &key) const = 0; - virtual void SetValue(const QString &key, const QVariant &value) = 0; - virtual void Reset(const QString &key) = 0; - - virtual ~SettingsInvokerInterface() { } + virtual ~DBusInvokerInterface() {} }; class InvokerFactoryInterface @@ -49,11 +44,7 @@ class InvokerFactoryInterface const QString &interface, ConnectType type = ConnectType::SESSION, QObject *parent = nullptr) = 0; - virtual SettingsInvokerInterface *CreateSettings(const QByteArray &schema_id, - const QByteArray &path = QByteArray(), - QObject *parent = nullptr) = 0; - - virtual ~InvokerFactoryInterface() { } + virtual ~InvokerFactoryInterface() {} }; #endif diff --git a/deepin-autostart-plugin/translate_generation.sh b/deepin-autostart-plugin/translate_generation.sh new file mode 100644 index 0000000..6b67c53 --- /dev/null +++ b/deepin-autostart-plugin/translate_generation.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +# +# SPDX-License-Identifier: GPL-3.0-or-later + +# this file is used to auto-generate .qm file from .ts file. +# author: shibowen at linuxdeepin.com + +ts_list=($(ls translations/*.ts)) + +for ts in "${ts_list[@]}"; do + printf "\nprocess ${ts}\n" + lrelease "${ts}" +done diff --git a/deepin-autostart-plugin/translations/deepin-autostart_en_US.ts b/deepin-autostart-plugin/translations/deepin-autostart_en_US.ts new file mode 100644 index 0000000..d638c63 --- /dev/null +++ b/deepin-autostart-plugin/translations/deepin-autostart_en_US.ts @@ -0,0 +1,80 @@ + + + + + AutoStartModule + + + Startup Programs + + + + + Manage auto startup programs + + + + + Supported by UOS + + + + + AutoStartWidget + + + Startup Programs + + + + + Name + + + + + Auto Startup + + + + + Action + + + + + + Enabled + + + + + + Disabled + + + + + Startup apps + + + + + All apps + + + + + MyItemDelegate + + + System + + + + + Third-party + + + + diff --git a/deepin-autostart-plugin/translations/deepin-autostart_zh_CN.ts b/deepin-autostart-plugin/translations/deepin-autostart_zh_CN.ts new file mode 100644 index 0000000..bb793b0 --- /dev/null +++ b/deepin-autostart-plugin/translations/deepin-autostart_zh_CN.ts @@ -0,0 +1,80 @@ + + + + + AutoStartModule + + + Startup Programs + 自启动应用 + + + + Manage auto startup programs + 管理应用开机自启情况 + + + + Supported by UOS + 由UOS提供服务 + + + + AutoStartWidget + + + Startup Programs + 自启动应用 + + + + Name + 名称 + + + + Auto Startup + 自启动状态 + + + + Action + 操作 + + + + + Enabled + 已启动 + + + + + Disabled + 已禁止 + + + + Startup apps + 已允许应用 + + + + All apps + 全部应用 + + + + MyItemDelegate + + + System + 系统 + + + + Third-party + 第三方 + + + diff --git a/deepin-fcitxrepair-plugin/CMakeLists.txt b/deepin-fcitxrepair-plugin/CMakeLists.txt new file mode 100644 index 0000000..0392d9f --- /dev/null +++ b/deepin-fcitxrepair-plugin/CMakeLists.txt @@ -0,0 +1,46 @@ +cmake_minimum_required(VERSION 3.7) + +set(PLUGIN_NAME "deepin-fcitxrepair") + +project(${PLUGIN_NAME}) + +set(CMAKE_AUTOMOC ON) + +file(GLOB_RECURSE SRCS + "*.h" + "*.cpp") + +find_package(Qt5 COMPONENTS Core Widgets DBus Svg LinguistTools REQUIRED) +find_package(PkgConfig REQUIRED) +find_package(DtkWidget REQUIRED) + +pkg_check_modules(DFrameworkDBus REQUIRED dframeworkdbus) +pkg_check_modules(QGSettings REQUIRED gsettings-qt) + +file(GLOB TS_FILES "translations/*.ts") +qt5_add_translation(QM_FILES ${TS_FILES}) +add_custom_target(translationsfcitxrepair ALL DEPENDS ${QM_FILES}) +install(FILES ${QM_FILES} DESTINATION share/${PLUGIN_NAME}/translations) + +add_library(${PLUGIN_NAME} SHARED ${SRCS} icons/fcitxrepair_icons.qrc) +set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ./) +target_include_directories(${PLUGIN_NAME} PUBLIC + ${Qt5Widgets_INCLUDE_DIRS} + ${Qt5Svg_INCLUDE_DIRS} + ${DtkWidget_INCLUDE_DIRS} + ${QGSettings_INCLUDE_DIRS} + ${Qt5DBus_INCLUDE_DIRS} + ../deepin-pc-manager/include/ + ) +target_link_libraries(${PLUGIN_NAME} PRIVATE + ${Qt5Widgets_LIBRARIES} + ${Qt5Svg_LIBRARIES} + ${DtkWidget_LIBRARIES} + ${DFrameworkDBus_LIBRARIES} + ${QGSettings_LIBRARIES} + ${Qt5DBus_LIBRARIES} + ) + +install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION /usr/lib/deepin-pc-manager/modules) +install(FILES icons/icons/deepin-fcitx-repair.svg DESTINATION /usr/share/icons/hicolor/scalable/apps) +install(FILES ./fcitxrepair.sh DESTINATION /usr/share/deepin-pc-manager) diff --git a/deepin-fcitxrepair-plugin/fcitxrepair.sh b/deepin-fcitxrepair-plugin/fcitxrepair.sh new file mode 100644 index 0000000..1754d5c --- /dev/null +++ b/deepin-fcitxrepair-plugin/fcitxrepair.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +# +# SPDX-License-Identifier: GPL-3.0-or-later + +echo '操作开始' +cd /home/${USER}/.config/ +echo '正在清理输入法缓存目录' +rm -rf com.sogou.sogoupinyin-uos/ fcitx/ iflytek/ iflyime-qimpanel/ SogouPY/ sogoupinyin/ .com.sogou.sogoupinyin-uos-zyb/ /fcitx-huayupy +echo '操作完成' +echo '请重启系统后打开输入法配置进行配置' \ No newline at end of file diff --git a/deepin-fcitxrepair-plugin/fcitxrepair_settings.json b/deepin-fcitxrepair-plugin/fcitxrepair_settings.json new file mode 100644 index 0000000..dbc6b7b --- /dev/null +++ b/deepin-fcitxrepair-plugin/fcitxrepair_settings.json @@ -0,0 +1,3 @@ +{ + "api" : "1.0.0" +} \ No newline at end of file diff --git a/deepin-fcitxrepair-plugin/fcitxrepairmodel.cpp b/deepin-fcitxrepair-plugin/fcitxrepairmodel.cpp new file mode 100644 index 0000000..6aa23cf --- /dev/null +++ b/deepin-fcitxrepair-plugin/fcitxrepairmodel.cpp @@ -0,0 +1,36 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "fcitxrepairmodel.h" + +#include +#define LOOG_FCITX_REPAIR_DIR "/usr/share/deepin-pc-manager/" +#define LOOG_FCITX_REPAIR_PATH "/usr/share/deepin-pc-manager/fcitxrepair.sh" +FcitxRepairModel::FcitxRepairModel(QObject *parent) + : QObject(parent) +{ + initData(); +} + +FcitxRepairModel::~FcitxRepairModel() +{ +} + +// 初始化数据 +void FcitxRepairModel::initData() +{ +} + +QString FcitxRepairModel::repairFcitxIssue() +{ + QProcess builder; + builder.setWorkingDirectory(LOOG_FCITX_REPAIR_DIR); + builder.setProcessChannelMode(QProcess::MergedChannels); + builder.start(QString("/bin/bash %1 %2").arg(LOOG_FCITX_REPAIR_PATH)); + if (!builder.waitForFinished()) { + builder.close(); + return "修复输入法失败"; + } + return QString::fromLocal8Bit(builder.readAllStandardOutput()).trimmed(); +} diff --git a/deepin-fcitxrepair-plugin/fcitxrepairmodel.h b/deepin-fcitxrepair-plugin/fcitxrepairmodel.h new file mode 100644 index 0000000..e92ea47 --- /dev/null +++ b/deepin-fcitxrepair-plugin/fcitxrepairmodel.h @@ -0,0 +1,22 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include + +class FcitxRepairModel : public QObject +{ + Q_OBJECT +public: + explicit FcitxRepairModel(QObject *parent = nullptr); + ~FcitxRepairModel(); + + QString repairFcitxIssue(); + +private: + void initData(); + +private: +}; diff --git a/deepin-fcitxrepair-plugin/fcitxrepairmodule.cpp b/deepin-fcitxrepair-plugin/fcitxrepairmodule.cpp new file mode 100644 index 0000000..4035b70 --- /dev/null +++ b/deepin-fcitxrepair-plugin/fcitxrepairmodule.cpp @@ -0,0 +1,79 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "fcitxrepairmodule.h" +#include "fcitxrepairmodel.h" +#include "fcitxrepairwidget.h" + +#include + +#include +#include + +DWIDGET_USE_NAMESPACE +DCORE_USE_NAMESPACE + +FcitxRepairModule::FcitxRepairModule() + : QObject() + , ToolBoxInterface() + , m_fcitxRepairModel(nullptr) + , m_fcitxRepairWidget(nullptr) +{ + QTranslator *translator = new QTranslator(this); + translator->load(QString("/usr/share/deepin-fcitxrepair/translations/deepin-fcitxrepair_%1.qm").arg(QLocale::system().name())); + QCoreApplication::installTranslator(translator); +} + +FcitxRepairModule::~FcitxRepairModule() +{ +} + +void FcitxRepairModule::active() +{ + if (!m_fcitxRepairModel) { + m_fcitxRepairModel = new FcitxRepairModel; + } + if (!m_fcitxRepairWidget) { + m_fcitxRepairWidget = new FcitxRepairWidget(m_fcitxRepairModel); + } + + m_frameProxy->pushWidget(this, m_fcitxRepairWidget); + m_fcitxRepairWidget->setVisible(true); +} + +const QString FcitxRepairModule::name() const +{ + return "DEEPINFCITXREPAIR"; +} +const QString FcitxRepairModule::apptitle() const +{ + return tr("Input method repair"); +} +const QString FcitxRepairModule::apptip() const +{ + return tr("Fix input method anomalies"); +} +const QString FcitxRepairModule::appsupporter() const +{ + return tr("Supported by UOS"); +} +const QString FcitxRepairModule::icon() const +{ + return "deepin-fcitx-repair"; +} + +int FcitxRepairModule::apptype() const +{ + return ToolBoxProxyInterface::Repair; +} + +bool FcitxRepairModule::enable() const +{ + return true; +} + +bool FcitxRepairModule::checkauth() const +{ + return false; +} diff --git a/deepin-fcitxrepair-plugin/fcitxrepairmodule.h b/deepin-fcitxrepair-plugin/fcitxrepairmodule.h new file mode 100644 index 0000000..6939af1 --- /dev/null +++ b/deepin-fcitxrepair-plugin/fcitxrepairmodule.h @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include +#include + +#include "interface/toolboxinterface.h" +#include "interface/toolboxproxyinterface.h" + +namespace PCC_NAMESPACE { +class ToolBoxInterface; +class ToolBoxProxyInterface; +} // namespace PCC_NAMESPACE + +using namespace PCC_NAMESPACE; + +class FcitxRepairWidget; +class FcitxRepairModel; +class FcitxRepairModule : public QObject + , public ToolBoxInterface +{ + Q_OBJECT + + Q_PLUGIN_METADATA(IID ToolBoxInterface_iid FILE "fcitxrepair_settings.json") + Q_INTERFACES(PCC_NAMESPACE::ToolBoxInterface) + +public: + explicit FcitxRepairModule(); + + ~FcitxRepairModule() Q_DECL_OVERRIDE; + + const QString name() const Q_DECL_OVERRIDE; + const QString apptitle() const Q_DECL_OVERRIDE; + const QString apptip() const Q_DECL_OVERRIDE; + const QString appsupporter() const Q_DECL_OVERRIDE; + const QString icon() const Q_DECL_OVERRIDE; + int apptype() const Q_DECL_OVERRIDE; + bool enable() const Q_DECL_OVERRIDE; + bool checkauth() const Q_DECL_OVERRIDE; + +private: + void onStatusChanged(); + +public Q_SLOTS: + void active() Q_DECL_OVERRIDE; + +private: + FcitxRepairModel *m_fcitxRepairModel; + FcitxRepairWidget *m_fcitxRepairWidget; +}; diff --git a/deepin-fcitxrepair-plugin/fcitxrepairwidget.cpp b/deepin-fcitxrepair-plugin/fcitxrepairwidget.cpp new file mode 100644 index 0000000..bbf64bb --- /dev/null +++ b/deepin-fcitxrepair-plugin/fcitxrepairwidget.cpp @@ -0,0 +1,105 @@ +// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "fcitxrepairwidget.h" +#include "fcitxrepairmodel.h" + +#include +#include +#include +#include +#include + +#include + +FcitxRepairWidget::FcitxRepairWidget(FcitxRepairModel *model, QWidget *parent) + : DFrame(parent) + , m_model(model) +{ + initUI(); + connect(m_execButton, &DSuggestButton::clicked, this, &FcitxRepairWidget::repairFcitxIssue); +} + +FcitxRepairWidget::~FcitxRepairWidget() +{ +} + +void FcitxRepairWidget::initUI() +{ + QVBoxLayout *layout = new QVBoxLayout(this); + layout->setSpacing(10); + layout->setContentsMargins(20, 20, 20, 20); + this->setLayout(layout); + + QLabel *title = new QLabel(tr("Input method repair"), this); + QFont font1 = title->font(); + font1.setBold(true); + font1.setWeight(QFont::DemiBold); + DFontSizeManager::instance()->bind(title, DFontSizeManager::T5); + title->setContentsMargins(10, 0, 0, 0); + + QLabel *detailInfo = new QLabel(tr("Fix input method anomalies"), this); + DFontSizeManager::instance()->bind(detailInfo, DFontSizeManager::T8); + detailInfo->setContentsMargins(10, 0, 0, 0); + + QLabel *descriptionInfo = new QLabel(tr("Tool Description"), this); + DFontSizeManager::instance()->bind(descriptionInfo, DFontSizeManager::T8); + descriptionInfo->setContentsMargins(10, 0, 0, 0); + + DTipLabel *tipLabel = new DTipLabel(tr("Resolves issues with input method anomalies, such as inability to use or switch input methods"), this); + DFontSizeManager::instance()->bind(tipLabel, DFontSizeManager::T8); + tipLabel->setContentsMargins(10, 0, 0, 0); + tipLabel->setAlignment(Qt::AlignLeft); + + DFrame *textFrame = new DFrame(this); + QVBoxLayout *textLayout = new QVBoxLayout(textFrame); + textLayout->setContentsMargins(2, 2, 2, 2); + textLayout->setSpacing(0); + textFrame->setLayout(textLayout); + + m_textEdit = new QTextEdit(textFrame); + m_textEdit->setFixedSize(QSize(900, 400)); + m_textEdit->setLineWidth(0); + textLayout->addWidget(m_textEdit, 0, Qt::AlignCenter); + + m_execButton = new DSuggestButton(this); + m_execButton->setFixedWidth(180); + m_execButton->setText(tr("Execute immediately")); + + layout->addWidget(title); + layout->addWidget(detailInfo); + layout->addSpacing(10); + layout->addWidget(descriptionInfo); + layout->addWidget(tipLabel); + layout->addWidget(textFrame, 0, Qt::AlignCenter); + layout->addWidget(m_execButton, 0, Qt::AlignRight); + layout->addStretch(); +} + +void FcitxRepairWidget::repairFcitxIssue() +{ + DDialog *dlg = new DDialog(this); + dlg->setOnButtonClickedClose(true); + // 设置属性当关闭时候删除自己 + dlg->setAttribute(Qt::WA_DeleteOnClose); + dlg->setIcon(QIcon::fromTheme("deepin-fcitx-repair")); + dlg->setMessage(tr("The operation cannot be undone. Please confirm if you want to proceed?")); + dlg->addButton(tr("Cancel", "button"), false, DDialog::ButtonType::ButtonNormal); + dlg->addButton(tr("Continue"), false, DDialog::ButtonType::ButtonRecommend); + + connect(dlg, &DDialog::buttonClicked, this, [&](int index, const QString &text) { + Q_UNUSED(text); + if (1 == index) { + m_textEdit->setText(m_model->repairFcitxIssue()); + DFloatingMessage *floMsgSwitchOff = new DFloatingMessage(DFloatingMessage::TransientType); + floMsgSwitchOff->setDuration(2000); + floMsgSwitchOff->setIcon(QIcon::fromTheme("dcc_ok_tip")); + floMsgSwitchOff->setMessage(tr("Please restart the system and open the input method configuration to make adjustments")); + DMessageManager::instance()->sendMessage(this, floMsgSwitchOff); + DMessageManager::instance()->setContentMargens(this, QMargins(0, 0, 0, 20)); + } + }); + dlg->exec(); +} diff --git a/deepin-fcitxrepair-plugin/fcitxrepairwidget.h b/deepin-fcitxrepair-plugin/fcitxrepairwidget.h new file mode 100644 index 0000000..e0c1bb7 --- /dev/null +++ b/deepin-fcitxrepair-plugin/fcitxrepairwidget.h @@ -0,0 +1,37 @@ +// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include +#include +#include + +#include +#include +#include +#include + +DWIDGET_USE_NAMESPACE +class FcitxRepairModel; +class FcitxRepairWidget : public DFrame +{ + Q_OBJECT +public: + explicit FcitxRepairWidget(FcitxRepairModel *model, QWidget *parent = nullptr); + ~FcitxRepairWidget(); + +private: + // 初始化界面 + void initUI(); + +public Q_SLOTS: + void repairFcitxIssue(); + +private: + FcitxRepairModel *m_model; + QTextEdit *m_textEdit; + DSuggestButton *m_execButton; +}; diff --git a/deepin-fcitxrepair-plugin/icons/fcitxrepair_icons.qrc b/deepin-fcitxrepair-plugin/icons/fcitxrepair_icons.qrc new file mode 100644 index 0000000..a5e85b1 --- /dev/null +++ b/deepin-fcitxrepair-plugin/icons/fcitxrepair_icons.qrc @@ -0,0 +1,5 @@ + + + icons/deepin-fcitx-repair.svg + + diff --git a/deepin-fcitxrepair-plugin/icons/icons/deepin-fcitx-repair.svg b/deepin-fcitxrepair-plugin/icons/icons/deepin-fcitx-repair.svg new file mode 100644 index 0000000..4ad17f2 --- /dev/null +++ b/deepin-fcitxrepair-plugin/icons/icons/deepin-fcitx-repair.svg @@ -0,0 +1,71 @@ + + + ICON/Security_tools/输入法修复 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/deepin-fcitxrepair-plugin/translate_generation.sh b/deepin-fcitxrepair-plugin/translate_generation.sh new file mode 100644 index 0000000..6b67c53 --- /dev/null +++ b/deepin-fcitxrepair-plugin/translate_generation.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +# +# SPDX-License-Identifier: GPL-3.0-or-later + +# this file is used to auto-generate .qm file from .ts file. +# author: shibowen at linuxdeepin.com + +ts_list=($(ls translations/*.ts)) + +for ts in "${ts_list[@]}"; do + printf "\nprocess ${ts}\n" + lrelease "${ts}" +done diff --git a/deepin-fcitxrepair-plugin/translations/deepin-fcitxrepair_en_US.ts b/deepin-fcitxrepair-plugin/translations/deepin-fcitxrepair_en_US.ts new file mode 100644 index 0000000..338805d --- /dev/null +++ b/deepin-fcitxrepair-plugin/translations/deepin-fcitxrepair_en_US.ts @@ -0,0 +1,71 @@ + + + + + FcitxRepairModule + + + Input method repair + + + + + Fix input method anomalies + + + + + Supported by UOS + + + + + FcitxRepairWidget + + + Input method repair + + + + + Fix input method anomalies + + + + + Tool Description + + + + + Resolves issues with input method anomalies, such as inability to use or switch input methods + + + + + Execute immediately + + + + + The operation cannot be undone. Please confirm if you want to proceed? + + + + + Cancel + button + + + + + Continue + + + + + Please restart the system and open the input method configuration to make adjustments + + + + diff --git a/deepin-fcitxrepair-plugin/translations/deepin-fcitxrepair_zh_CN.ts b/deepin-fcitxrepair-plugin/translations/deepin-fcitxrepair_zh_CN.ts new file mode 100644 index 0000000..bfa7b4d --- /dev/null +++ b/deepin-fcitxrepair-plugin/translations/deepin-fcitxrepair_zh_CN.ts @@ -0,0 +1,76 @@ + + + + + FcitxRepairModule + + + Input method repair + 输入法修复 + + + + Fix input method anomalies + 修复输入法异常问题 + + + + Supported by UOS + 由UOS提供服务 + + + + FcitxRepairWidget + + + Input method repair + 输入法修复 + + + + Fix input method anomalies + 修复输入法异常问题 + + + + Tool Description + 工具描述 + + + + Resolves issues with input method anomalies, such as inability to use or switch input methods + 解决输入法异常的问题,如输入法无法使用、无法切换等 + + + + Execute immediately + 立即执行 + + + + The operation cannot be undone. Please confirm if you want to proceed? + 操作无法撤销,请确认是否继续执行? + + + + Cancel + button + 取消 + + + + Continue + 继续执行 + + + + Execute successful + 执行成功 + + + + Please restart the system and open the input method configuration to make adjustments + 请重启系统后打开输入法配置进行配置 + + + diff --git a/deepin-fileicon-plugin/CMakeLists.txt b/deepin-fileicon-plugin/CMakeLists.txt new file mode 100644 index 0000000..567e134 --- /dev/null +++ b/deepin-fileicon-plugin/CMakeLists.txt @@ -0,0 +1,46 @@ +cmake_minimum_required(VERSION 3.7) + +set(PLUGIN_NAME "deepin-fileicon") + +project(${PLUGIN_NAME}) + +set(CMAKE_AUTOMOC ON) + +file(GLOB_RECURSE SRCS + "*.h" + "*.cpp") + +find_package(Qt5 COMPONENTS Core Widgets DBus Svg LinguistTools REQUIRED) +find_package(PkgConfig REQUIRED) +find_package(DtkWidget REQUIRED) + +pkg_check_modules(DFrameworkDBus REQUIRED dframeworkdbus) +pkg_check_modules(QGSettings REQUIRED gsettings-qt) + +file(GLOB TS_FILES "translations/*.ts") +qt5_add_translation(QM_FILES ${TS_FILES}) +add_custom_target(translationsfileicon ALL DEPENDS ${QM_FILES}) +install(FILES ${QM_FILES} DESTINATION share/${PLUGIN_NAME}/translations) + +add_library(${PLUGIN_NAME} SHARED ${SRCS} icons/fileicon_icons.qrc) +set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ./) +target_include_directories(${PLUGIN_NAME} PUBLIC + ${Qt5Widgets_INCLUDE_DIRS} + ${Qt5Svg_INCLUDE_DIRS} + ${DtkWidget_INCLUDE_DIRS} + ${QGSettings_INCLUDE_DIRS} + ${Qt5DBus_INCLUDE_DIRS} + ../deepin-pc-manager/include/ + ) +target_link_libraries(${PLUGIN_NAME} PRIVATE + ${Qt5Widgets_LIBRARIES} + ${Qt5Svg_LIBRARIES} + ${DtkWidget_LIBRARIES} + ${DFrameworkDBus_LIBRARIES} + ${QGSettings_LIBRARIES} + ${Qt5DBus_LIBRARIES} + ) + +install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION /usr/lib/deepin-pc-manager/modules) +install(FILES icons/icons/deepin-file-icon.svg DESTINATION /usr/share/icons/hicolor/scalable/apps) +install(FILES ./fileicon.sh DESTINATION /usr/share/deepin-pc-manager) diff --git a/deepin-fileicon-plugin/fileicon.sh b/deepin-fileicon-plugin/fileicon.sh new file mode 100644 index 0000000..8d12708 --- /dev/null +++ b/deepin-fileicon-plugin/fileicon.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +# +# SPDX-License-Identifier: GPL-3.0-or-later + +echo '操作开始' +sed -i '/^inode/d' ~/.config/mimeapps.list +echo 'mimeapps.list字符替换成功' +echo '操作完成' \ No newline at end of file diff --git a/deepin-fileicon-plugin/fileicon_settings.json b/deepin-fileicon-plugin/fileicon_settings.json new file mode 100644 index 0000000..dbc6b7b --- /dev/null +++ b/deepin-fileicon-plugin/fileicon_settings.json @@ -0,0 +1,3 @@ +{ + "api" : "1.0.0" +} \ No newline at end of file diff --git a/deepin-fileicon-plugin/fileiconmodel.cpp b/deepin-fileicon-plugin/fileiconmodel.cpp new file mode 100644 index 0000000..3edcbd0 --- /dev/null +++ b/deepin-fileicon-plugin/fileiconmodel.cpp @@ -0,0 +1,37 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "fileiconmodel.h" + +#include + +#define LOOG_FILE_ICON_DIR "/usr/share/deepin-pc-manager/" +#define LOOG_FILE_ICON_PATH "/usr/share/deepin-pc-manager/fileicon.sh" +FileIconModel::FileIconModel(QObject *parent) + : QObject(parent) +{ + initData(); +} + +FileIconModel::~FileIconModel() +{ +} + +// 初始化数据 +void FileIconModel::initData() +{ +} + +QString FileIconModel::resolveIconIssue() +{ + QProcess builder; + builder.setWorkingDirectory(LOOG_FILE_ICON_DIR); + builder.setProcessChannelMode(QProcess::MergedChannels); + builder.start(QString("/bin/bash %1 %2").arg(LOOG_FILE_ICON_PATH)); + if (!builder.waitForFinished()) { + builder.close(); + return "修复图标异常失败"; + } + return QString::fromLocal8Bit(builder.readAllStandardOutput()).trimmed(); +} diff --git a/deepin-fileicon-plugin/fileiconmodel.h b/deepin-fileicon-plugin/fileiconmodel.h new file mode 100644 index 0000000..f60b705 --- /dev/null +++ b/deepin-fileicon-plugin/fileiconmodel.h @@ -0,0 +1,21 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include + +class FileIconModel : public QObject +{ + Q_OBJECT +public: + explicit FileIconModel(QObject *parent = nullptr); + ~FileIconModel(); + QString resolveIconIssue(); + +private: + void initData(); + +private: +}; diff --git a/deepin-fileicon-plugin/fileiconmodule.cpp b/deepin-fileicon-plugin/fileiconmodule.cpp new file mode 100644 index 0000000..4d8668a --- /dev/null +++ b/deepin-fileicon-plugin/fileiconmodule.cpp @@ -0,0 +1,79 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "fileiconmodule.h" +#include "fileiconmodel.h" +#include "fileiconwidget.h" + +#include + +#include +#include + +DWIDGET_USE_NAMESPACE +DCORE_USE_NAMESPACE + +FileIconModule::FileIconModule() + : QObject() + , ToolBoxInterface() + , m_fileIconModel(nullptr) + , m_fileIconWidget(nullptr) +{ + QTranslator *translator = new QTranslator(this); + translator->load(QString("/usr/share/deepin-fileicon/translations/deepin-fileicon_%1.qm").arg(QLocale::system().name())); + QCoreApplication::installTranslator(translator); +} + +FileIconModule::~FileIconModule() +{ +} + +void FileIconModule::active() +{ + if (!m_fileIconModel) { + m_fileIconModel = new FileIconModel; + } + if (!m_fileIconWidget) { + m_fileIconWidget = new FileIconWidget(m_fileIconModel); + } + + m_frameProxy->pushWidget(this, m_fileIconWidget); + m_fileIconWidget->setVisible(true); +} + +const QString FileIconModule::name() const +{ + return "DEEPINFILEICON"; +} +const QString FileIconModule::apptitle() const +{ + return tr("File icon anomaly repair"); +} +const QString FileIconModule::apptip() const +{ + return tr("Resolves the issue of abnormal file icon display"); +} +const QString FileIconModule::appsupporter() const +{ + return tr("Supported by UOS"); +} +const QString FileIconModule::icon() const +{ + return "deepin-file-icon"; +} + +int FileIconModule::apptype() const +{ + return ToolBoxProxyInterface::Repair; +} + +bool FileIconModule::enable() const +{ + return true; +} + +bool FileIconModule::checkauth() const +{ + return false; +} diff --git a/deepin-fileicon-plugin/fileiconmodule.h b/deepin-fileicon-plugin/fileiconmodule.h new file mode 100644 index 0000000..ff3f502 --- /dev/null +++ b/deepin-fileicon-plugin/fileiconmodule.h @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include +#include + +#include "interface/toolboxinterface.h" +#include "interface/toolboxproxyinterface.h" + +namespace PCC_NAMESPACE { +class ToolBoxInterface; +class ToolBoxProxyInterface; +} // namespace PCC_NAMESPACE + +using namespace PCC_NAMESPACE; + +class FileIconWidget; +class FileIconModel; +class FileIconModule : public QObject + , public ToolBoxInterface +{ + Q_OBJECT + + Q_PLUGIN_METADATA(IID ToolBoxInterface_iid FILE "fileicon_settings.json") + Q_INTERFACES(PCC_NAMESPACE::ToolBoxInterface) + +public: + explicit FileIconModule(); + + ~FileIconModule() Q_DECL_OVERRIDE; + + const QString name() const Q_DECL_OVERRIDE; + const QString apptitle() const Q_DECL_OVERRIDE; + const QString apptip() const Q_DECL_OVERRIDE; + const QString appsupporter() const Q_DECL_OVERRIDE; + const QString icon() const Q_DECL_OVERRIDE; + int apptype() const Q_DECL_OVERRIDE; + bool enable() const Q_DECL_OVERRIDE; + bool checkauth() const Q_DECL_OVERRIDE; + +private: + void onStatusChanged(); + +public Q_SLOTS: + void active() Q_DECL_OVERRIDE; + +private: + FileIconModel *m_fileIconModel; + FileIconWidget *m_fileIconWidget; +}; diff --git a/deepin-fileicon-plugin/fileiconwidget.cpp b/deepin-fileicon-plugin/fileiconwidget.cpp new file mode 100644 index 0000000..95136eb --- /dev/null +++ b/deepin-fileicon-plugin/fileiconwidget.cpp @@ -0,0 +1,97 @@ +// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "fileiconwidget.h" +#include "fileiconmodel.h" + +#include +#include +#include + +#include + +FileIconWidget::FileIconWidget(FileIconModel *model, QWidget *parent) + : DFrame(parent) + , m_model(model) +{ + initUI(); + connect(m_execButton, &DSuggestButton::clicked, this, &FileIconWidget::resolveIconIssue); +} + +FileIconWidget::~FileIconWidget() +{ +} + +void FileIconWidget::initUI() +{ + QVBoxLayout *layout = new QVBoxLayout(this); + layout->setSpacing(10); + layout->setContentsMargins(20, 20, 20, 20); + this->setLayout(layout); + + QLabel *title = new QLabel(tr("File icon anomaly repair"), this); + QFont font1 = title->font(); + font1.setBold(true); + font1.setWeight(QFont::DemiBold); + DFontSizeManager::instance()->bind(title, DFontSizeManager::T5); + title->setContentsMargins(10, 0, 0, 0); + + QLabel *detailInfo = new QLabel(tr("Resolves the issue of abnormal file icon display"), this); + DFontSizeManager::instance()->bind(detailInfo, DFontSizeManager::T8); + detailInfo->setContentsMargins(10, 0, 0, 0); + + QLabel *descriptionInfo = new QLabel(tr("Tool Description"), this); + DFontSizeManager::instance()->bind(descriptionInfo, DFontSizeManager::T8); + descriptionInfo->setContentsMargins(10, 0, 0, 0); + + DTipLabel *tipLabel = new DTipLabel(tr("Resolves the issue of abnormal file icon display"), this); + DFontSizeManager::instance()->bind(tipLabel, DFontSizeManager::T8); + tipLabel->setContentsMargins(10, 0, 0, 0); + tipLabel->setAlignment(Qt::AlignLeft); + + DFrame *textFrame = new DFrame(this); + QVBoxLayout *textLayout = new QVBoxLayout(textFrame); + textLayout->setContentsMargins(2, 2, 2, 2); + textLayout->setSpacing(0); + textFrame->setLayout(textLayout); + + m_textEdit = new QTextEdit(textFrame); + m_textEdit->setFixedSize(QSize(900, 400)); + m_textEdit->setLineWidth(0); + textLayout->addWidget(m_textEdit, 0, Qt::AlignCenter); + + m_execButton = new DSuggestButton(this); + m_execButton->setFixedWidth(180); + m_execButton->setText(tr("Execute immediately")); + + layout->addWidget(title); + layout->addWidget(detailInfo); + layout->addSpacing(10); + layout->addWidget(descriptionInfo); + layout->addWidget(tipLabel); + layout->addWidget(textFrame, 0, Qt::AlignCenter); + layout->addWidget(m_execButton, 0, Qt::AlignRight); + layout->addStretch(); +} + +void FileIconWidget::resolveIconIssue() +{ + DDialog *dlg = new DDialog(this); + dlg->setOnButtonClickedClose(true); + // 设置属性当关闭时候删除自己 + dlg->setAttribute(Qt::WA_DeleteOnClose); + dlg->setIcon(QIcon::fromTheme("deepin-file-icon")); + dlg->setMessage(tr("The operation cannot be undone. Please confirm if you want to proceed?")); + dlg->addButton(tr("Cancel", "button"), false, DDialog::ButtonType::ButtonNormal); + dlg->addButton(tr("Continue"), false, DDialog::ButtonType::ButtonRecommend); + + connect(dlg, &DDialog::buttonClicked, this, [&](int index, const QString &text) { + Q_UNUSED(text); + if (1 == index) { + m_textEdit->setText(m_model->resolveIconIssue()); + } + }); + dlg->exec(); +} diff --git a/deepin-fileicon-plugin/fileiconwidget.h b/deepin-fileicon-plugin/fileiconwidget.h new file mode 100644 index 0000000..7e147d8 --- /dev/null +++ b/deepin-fileicon-plugin/fileiconwidget.h @@ -0,0 +1,37 @@ +// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include +#include +#include + +#include +#include +#include +#include + +DWIDGET_USE_NAMESPACE +class FileIconModel; +class FileIconWidget : public DFrame +{ + Q_OBJECT +public: + explicit FileIconWidget(FileIconModel *model, QWidget *parent = nullptr); + ~FileIconWidget(); + +private: + // 初始化界面 + void initUI(); + +public Q_SLOTS: + void resolveIconIssue(); + +private: + FileIconModel *m_model; + QTextEdit *m_textEdit; + DSuggestButton *m_execButton; +}; diff --git a/deepin-fileicon-plugin/icons/fileicon_icons.qrc b/deepin-fileicon-plugin/icons/fileicon_icons.qrc new file mode 100644 index 0000000..7c6403f --- /dev/null +++ b/deepin-fileicon-plugin/icons/fileicon_icons.qrc @@ -0,0 +1,5 @@ + + + icons/deepin-file-icon.svg + + diff --git a/deepin-fileicon-plugin/icons/icons/deepin-file-icon.svg b/deepin-fileicon-plugin/icons/icons/deepin-file-icon.svg new file mode 100644 index 0000000..3069e7b --- /dev/null +++ b/deepin-fileicon-plugin/icons/icons/deepin-file-icon.svg @@ -0,0 +1,72 @@ + + + ICON/Security_tools/文件图标异常修复 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/deepin-fileicon-plugin/translate_generation.sh b/deepin-fileicon-plugin/translate_generation.sh new file mode 100644 index 0000000..6b67c53 --- /dev/null +++ b/deepin-fileicon-plugin/translate_generation.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +# +# SPDX-License-Identifier: GPL-3.0-or-later + +# this file is used to auto-generate .qm file from .ts file. +# author: shibowen at linuxdeepin.com + +ts_list=($(ls translations/*.ts)) + +for ts in "${ts_list[@]}"; do + printf "\nprocess ${ts}\n" + lrelease "${ts}" +done diff --git a/deepin-fileicon-plugin/translations/deepin-fileicon_en_US.ts b/deepin-fileicon-plugin/translations/deepin-fileicon_en_US.ts new file mode 100644 index 0000000..bb1d8a5 --- /dev/null +++ b/deepin-fileicon-plugin/translations/deepin-fileicon_en_US.ts @@ -0,0 +1,67 @@ + + + + + FileIconModule + + + File icon anomaly repair + + + + + Resolves the issue of abnormal file icon display + + + + + Supported by UOS + + + + + FileIconWidget + + + File icon anomaly repair + + + + + + Resolves the issue of abnormal file icon display + + + + + Tool Description + + + + + Execute immediately + + + + + The operation cannot be undone. Please confirm if you want to proceed? + + + + + Cancel + button + + + + + Continue + + + + + Execute successful + + + + diff --git a/deepin-fileicon-plugin/translations/deepin-fileicon_zh_CN.ts b/deepin-fileicon-plugin/translations/deepin-fileicon_zh_CN.ts new file mode 100644 index 0000000..3ca7b8c --- /dev/null +++ b/deepin-fileicon-plugin/translations/deepin-fileicon_zh_CN.ts @@ -0,0 +1,67 @@ + + + + + FileIconModule + + + File icon anomaly repair + 文件图标异常修复 + + + + Resolves the issue of abnormal file icon display + 解决文件图标显示异常问题 + + + + Supported by UOS + 由UOS提供服务 + + + + FileIconWidget + + + File icon anomaly repair + 文件图标异常修复 + + + + + Resolves the issue of abnormal file icon display + 解决文件图标显示异常问题 + + + + Tool Description + 工具描述 + + + + Execute immediately + 立即执行 + + + + The operation cannot be undone. Please confirm if you want to proceed? + 操作无法撤销,请确认是否继续执行? + + + + Cancel + button + 取 消 + + + + Continue + 继续执行 + + + + Execute successful + 执行成功 + + + diff --git a/deepin-filename-plugin/CMakeLists.txt b/deepin-filename-plugin/CMakeLists.txt new file mode 100644 index 0000000..15c4fee --- /dev/null +++ b/deepin-filename-plugin/CMakeLists.txt @@ -0,0 +1,46 @@ +cmake_minimum_required(VERSION 3.7) + +set(PLUGIN_NAME "deepin-filename") + +project(${PLUGIN_NAME}) + +set(CMAKE_AUTOMOC ON) + +file(GLOB_RECURSE SRCS + "*.h" + "*.cpp") + +find_package(Qt5 COMPONENTS Core Widgets DBus Svg LinguistTools REQUIRED) +find_package(PkgConfig REQUIRED) +find_package(DtkWidget REQUIRED) + +pkg_check_modules(DFrameworkDBus REQUIRED dframeworkdbus) +pkg_check_modules(QGSettings REQUIRED gsettings-qt) + +file(GLOB TS_FILES "translations/*.ts") +qt5_add_translation(QM_FILES ${TS_FILES}) +add_custom_target(translationsfilename ALL DEPENDS ${QM_FILES}) +install(FILES ${QM_FILES} DESTINATION share/${PLUGIN_NAME}/translations) + +add_library(${PLUGIN_NAME} SHARED ${SRCS} icons/filename_icons.qrc) +set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ./) +target_include_directories(${PLUGIN_NAME} PUBLIC + ${Qt5Widgets_INCLUDE_DIRS} + ${Qt5Svg_INCLUDE_DIRS} + ${DtkWidget_INCLUDE_DIRS} + ${QGSettings_INCLUDE_DIRS} + ${Qt5DBus_INCLUDE_DIRS} + ../deepin-pc-manager/include/ + ) +target_link_libraries(${PLUGIN_NAME} PRIVATE + ${Qt5Widgets_LIBRARIES} + ${Qt5Svg_LIBRARIES} + ${DtkWidget_LIBRARIES} + ${DFrameworkDBus_LIBRARIES} + ${QGSettings_LIBRARIES} + ${Qt5DBus_LIBRARIES} + ) + +install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION /usr/lib/deepin-pc-manager/modules) +install(FILES icons/icons/deepin-file-name.svg DESTINATION /usr/share/icons/hicolor/scalable/apps) +install(FILES ./loogfilename.sh DESTINATION /usr/share/deepin-pc-manager) diff --git a/deepin-filename-plugin/filename_settings.json b/deepin-filename-plugin/filename_settings.json new file mode 100644 index 0000000..dbc6b7b --- /dev/null +++ b/deepin-filename-plugin/filename_settings.json @@ -0,0 +1,3 @@ +{ + "api" : "1.0.0" +} \ No newline at end of file diff --git a/deepin-filename-plugin/filenamemodel.cpp b/deepin-filename-plugin/filenamemodel.cpp new file mode 100644 index 0000000..2662766 --- /dev/null +++ b/deepin-filename-plugin/filenamemodel.cpp @@ -0,0 +1,38 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "filenamemodel.h" + +#include + +#define LOOG_FILE_NAME_DIR "/usr/share/deepin-pc-manager/" +#define LOOG_FILE_NAME_PATH "/usr/share/deepin-pc-manager/loogfilename.sh" +FileNameModel::FileNameModel(QObject *parent) + : QObject(parent) +{ + initData(); +} + +FileNameModel::~FileNameModel() +{ +} + +// 初始化数据 +void FileNameModel::initData() +{ +} + +QString FileNameModel::startLoogFileNameSupport() +{ + QProcess builder; + builder.setWorkingDirectory(LOOG_FILE_NAME_DIR); + builder.setProcessChannelMode(QProcess::MergedChannels); + builder.start(QString("/bin/bash %1 %2").arg(LOOG_FILE_NAME_PATH)); + if (!builder.waitForFinished()) { + builder.close(); + return "长文件名支持失败"; + } + + return QString::fromLocal8Bit(builder.readAllStandardOutput()).trimmed(); +} diff --git a/deepin-filename-plugin/filenamemodel.h b/deepin-filename-plugin/filenamemodel.h new file mode 100644 index 0000000..1db638e --- /dev/null +++ b/deepin-filename-plugin/filenamemodel.h @@ -0,0 +1,22 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include + +class FileNameModel : public QObject +{ + Q_OBJECT +public: + explicit FileNameModel(QObject *parent = nullptr); + ~FileNameModel(); + + QString startLoogFileNameSupport(); + +private: + void initData(); + +private: +}; diff --git a/deepin-filename-plugin/filenamemodule.cpp b/deepin-filename-plugin/filenamemodule.cpp new file mode 100644 index 0000000..e891705 --- /dev/null +++ b/deepin-filename-plugin/filenamemodule.cpp @@ -0,0 +1,79 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "filenamemodule.h" +#include "filenamemodel.h" +#include "filenamewidget.h" + +#include + +#include +#include + +DWIDGET_USE_NAMESPACE +DCORE_USE_NAMESPACE + +FileNameModule::FileNameModule() + : QObject() + , ToolBoxInterface() + , m_fileNameModel(nullptr) + , m_fileNameWidget(nullptr) +{ + QTranslator *translator = new QTranslator(this); + translator->load(QString("/usr/share/deepin-filename/translations/deepin-filename_%1.qm").arg(QLocale::system().name())); + QCoreApplication::installTranslator(translator); +} + +FileNameModule::~FileNameModule() +{ +} + +void FileNameModule::active() +{ + if (!m_fileNameModel) { + m_fileNameModel = new FileNameModel; + } + if (!m_fileNameWidget) { + m_fileNameWidget = new FileNameWidget(m_fileNameModel); + } + + m_frameProxy->pushWidget(this, m_fileNameWidget); + m_fileNameWidget->setVisible(true); +} + +const QString FileNameModule::name() const +{ + return "DEEPINFILENAME"; +} +const QString FileNameModule::apptitle() const +{ + return tr("Long filename support"); +} +const QString FileNameModule::apptip() const +{ + return tr("Extend file name length to 225 chinese characters"); +} +const QString FileNameModule::appsupporter() const +{ + return tr("Supported by UOS"); +} +const QString FileNameModule::icon() const +{ + return "deepin-file-name"; +} + +int FileNameModule::apptype() const +{ + return ToolBoxProxyInterface::System; +} + +bool FileNameModule::enable() const +{ + return true; +} + +bool FileNameModule::checkauth() const +{ + return false; +} diff --git a/deepin-filename-plugin/filenamemodule.h b/deepin-filename-plugin/filenamemodule.h new file mode 100644 index 0000000..7798b67 --- /dev/null +++ b/deepin-filename-plugin/filenamemodule.h @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include +#include + +#include "interface/toolboxinterface.h" +#include "interface/toolboxproxyinterface.h" + +namespace PCC_NAMESPACE { +class ToolBoxInterface; +class ToolBoxProxyInterface; +} // namespace PCC_NAMESPACE + +using namespace PCC_NAMESPACE; + +class FileNameWidget; +class FileNameModel; +class FileNameModule : public QObject + , public ToolBoxInterface +{ + Q_OBJECT + + Q_PLUGIN_METADATA(IID ToolBoxInterface_iid FILE "filename_settings.json") + Q_INTERFACES(PCC_NAMESPACE::ToolBoxInterface) + +public: + explicit FileNameModule(); + + ~FileNameModule() Q_DECL_OVERRIDE; + + const QString name() const Q_DECL_OVERRIDE; + const QString apptitle() const Q_DECL_OVERRIDE; + const QString apptip() const Q_DECL_OVERRIDE; + const QString appsupporter() const Q_DECL_OVERRIDE; + const QString icon() const Q_DECL_OVERRIDE; + int apptype() const Q_DECL_OVERRIDE; + bool enable() const Q_DECL_OVERRIDE; + bool checkauth() const Q_DECL_OVERRIDE; + +private: + void onStatusChanged(); + +public Q_SLOTS: + void active() Q_DECL_OVERRIDE; + +private: + FileNameModel *m_fileNameModel; + FileNameWidget *m_fileNameWidget; +}; diff --git a/deepin-filename-plugin/filenamewidget.cpp b/deepin-filename-plugin/filenamewidget.cpp new file mode 100644 index 0000000..5d8a9aa --- /dev/null +++ b/deepin-filename-plugin/filenamewidget.cpp @@ -0,0 +1,112 @@ +// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "filenamewidget.h" +#include "filenamemodel.h" + +#include +#include +#include +#include +#include + +#include + +FileNameWidget::FileNameWidget(FileNameModel *model, QWidget *parent) + : DFrame(parent) + , m_model(model) + , m_textEdit(nullptr) + , m_execButton(nullptr) +{ + initUI(); + connect(m_execButton, &DSuggestButton::clicked, this, &FileNameWidget::supportLoogFileName); +} + +FileNameWidget::~FileNameWidget() +{ +} + +void FileNameWidget::initUI() +{ + QVBoxLayout *layout = new QVBoxLayout(this); + layout->setSpacing(10); + layout->setContentsMargins(20, 20, 20, 20); + this->setLayout(layout); + + QLabel *title = new QLabel(tr("Long filename support"), this); + QFont font1 = title->font(); + font1.setBold(true); + font1.setWeight(QFont::DemiBold); + DFontSizeManager::instance()->bind(title, DFontSizeManager::T5); + title->setFont(font1); + title->setContentsMargins(10, 0, 0, 0); + + QLabel *detailInfo = new QLabel(tr("Extend file name length to 225 chinese characters"), this); + DFontSizeManager::instance()->bind(detailInfo, DFontSizeManager::T8); + detailInfo->setContentsMargins(10, 0, 0, 0); + + QLabel *descriptionInfo = new QLabel(tr("Tool Description"), this); + DFontSizeManager::instance()->bind(descriptionInfo, DFontSizeManager::T8); + descriptionInfo->setContentsMargins(10, 0, 0, 0); + + DTipLabel *tipLabel = new DTipLabel(tr("Extend the maximum filename length to 255 Chinese characters, only supported on UOS1060 and above systems."), this); + DFontSizeManager::instance()->bind(tipLabel, DFontSizeManager::T8); + tipLabel->setContentsMargins(10, 0, 0, 0); + tipLabel->setAlignment(Qt::AlignLeft); + + DFrame *textFrame = new DFrame(this); + QVBoxLayout *textLayout = new QVBoxLayout(textFrame); + textLayout->setContentsMargins(2, 2, 2, 2); + textLayout->setSpacing(0); + textFrame->setLayout(textLayout); + + m_textEdit = new QTextEdit(textFrame); + m_textEdit->setFixedSize(QSize(900, 400)); + m_textEdit->setLineWidth(0); + textLayout->addWidget(m_textEdit, 0, Qt::AlignCenter); + + m_execButton = new DSuggestButton(this); + m_execButton->setFixedWidth(180); + m_execButton->setText(tr("Execute immediately")); + + layout->addWidget(title); + layout->addWidget(detailInfo); + layout->addSpacing(10); + layout->addWidget(descriptionInfo); + layout->addWidget(tipLabel); + layout->addWidget(textFrame, 0, Qt::AlignCenter); + layout->addWidget(m_execButton, 0, Qt::AlignRight); + layout->addStretch(); +} + +void FileNameWidget::supportLoogFileName() +{ + DDialog *dlg = new DDialog(this); + dlg->setOnButtonClickedClose(true); + // 设置属性当关闭时候删除自己 + dlg->setAttribute(Qt::WA_DeleteOnClose); + dlg->setIcon(QIcon::fromTheme("deepin-file-name")); + dlg->setMessage(tr("The operation cannot be undone. Please confirm if you want to proceed?")); + dlg->addButton(tr("Cancel", "button"), false, DDialog::ButtonType::ButtonNormal); + dlg->addButton(tr("Continue"), false, DDialog::ButtonType::ButtonRecommend); + + connect(dlg, &DDialog::buttonClicked, this, [&](int index, const QString &text) { + Q_UNUSED(text); + if (1 == index) { + QString result = m_model->startLoogFileNameSupport(); + m_textEdit->setText(result); + + if (result.contains("true")) { + DFloatingMessage *floMsgSwitchOff = new DFloatingMessage(DFloatingMessage::TransientType); + floMsgSwitchOff->setDuration(2000); + floMsgSwitchOff->setIcon(QIcon::fromTheme("dcc_ok_tip")); + floMsgSwitchOff->setMessage(tr("Long filename support enabled, effective after restarting the computer")); + DMessageManager::instance()->sendMessage(this, floMsgSwitchOff); + DMessageManager::instance()->setContentMargens(this, QMargins(0, 0, 0, 20)); + } + } + }); + dlg->exec(); +} diff --git a/deepin-filename-plugin/filenamewidget.h b/deepin-filename-plugin/filenamewidget.h new file mode 100644 index 0000000..dd91dac --- /dev/null +++ b/deepin-filename-plugin/filenamewidget.h @@ -0,0 +1,37 @@ +// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include +#include +#include + +#include +#include +#include +#include + +DWIDGET_USE_NAMESPACE +class FileNameModel; +class FileNameWidget : public DFrame +{ + Q_OBJECT +public: + explicit FileNameWidget(FileNameModel *model, QWidget *parent = nullptr); + ~FileNameWidget(); + +private: + // 初始化界面 + void initUI(); + +public Q_SLOTS: + void supportLoogFileName(); + +private: + FileNameModel *m_model; + QTextEdit *m_textEdit; + DSuggestButton *m_execButton; +}; diff --git a/deepin-filename-plugin/icons/filename_icons.qrc b/deepin-filename-plugin/icons/filename_icons.qrc new file mode 100644 index 0000000..cf27cab --- /dev/null +++ b/deepin-filename-plugin/icons/filename_icons.qrc @@ -0,0 +1,5 @@ + + + icons/deepin-file-name.svg + + diff --git a/deepin-filename-plugin/icons/icons/deepin-file-name.svg b/deepin-filename-plugin/icons/icons/deepin-file-name.svg new file mode 100644 index 0000000..8d56e7b --- /dev/null +++ b/deepin-filename-plugin/icons/icons/deepin-file-name.svg @@ -0,0 +1,52 @@ + + + ICON/Security_tools/长命名修改 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/deepin-filename-plugin/loogfilename.sh b/deepin-filename-plugin/loogfilename.sh new file mode 100644 index 0000000..4dea9c6 --- /dev/null +++ b/deepin-filename-plugin/loogfilename.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +# +# SPDX-License-Identifier: GPL-3.0-or-later + +echo '操作开始' +dde-dconfig --set -a org.deepin.dde.file-manager -r org.deepin.dde.file-manager -k dfm.mount.dlnfs -v true +echo 'dde-dconfig 配置完成' +echo '操作完成,dlnfs状态:'`dde-dconfig --get -a org.deepin.dde.file-manager -r org.deepin.dde.file-manager -k dfm.mount.dlnfs` +echo '已打开长文件名支持,重启电脑后生效' \ No newline at end of file diff --git a/deepin-filename-plugin/translate_generation.sh b/deepin-filename-plugin/translate_generation.sh new file mode 100644 index 0000000..6b67c53 --- /dev/null +++ b/deepin-filename-plugin/translate_generation.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +# +# SPDX-License-Identifier: GPL-3.0-or-later + +# this file is used to auto-generate .qm file from .ts file. +# author: shibowen at linuxdeepin.com + +ts_list=($(ls translations/*.ts)) + +for ts in "${ts_list[@]}"; do + printf "\nprocess ${ts}\n" + lrelease "${ts}" +done diff --git a/deepin-filename-plugin/translations/deepin-filename_en_US.ts b/deepin-filename-plugin/translations/deepin-filename_en_US.ts new file mode 100644 index 0000000..83bb03f --- /dev/null +++ b/deepin-filename-plugin/translations/deepin-filename_en_US.ts @@ -0,0 +1,72 @@ + + + + + FileNameModule + + + Long filename support + + + + + Extend file name length to 225 chinese characters + + + + + Supported by UOS + + + + + FileNameWidget + + + Long filename support + + + + + Extend file name length to 225 chinese characters + + + + + Tool Description + + + + + Extend the maximum filename length to 255 Chinese characters, only supported on UOS1060 and above systems. + + + + + Execute immediately + + + + + The operation cannot be undone. Please confirm if you want to proceed? + + + + + Cancel + button + + + + + Continue + + + + + + Long filename support enabled, effective after restarting the computer + + + + diff --git a/deepin-filename-plugin/translations/deepin-filename_zh_CN.ts b/deepin-filename-plugin/translations/deepin-filename_zh_CN.ts new file mode 100644 index 0000000..7cbde34 --- /dev/null +++ b/deepin-filename-plugin/translations/deepin-filename_zh_CN.ts @@ -0,0 +1,72 @@ + + + + + FileNameModule + + + Long filename support + 长文件名支持 + + + + Extend file name length to 225 chinese characters + 将文件名长度扩展到225个中文字符 + + + + Supported by UOS + 由UOS提供服务 + + + + FileNameWidget + + + Long filename support + 长文件名支持 + + + + Extend file name length to 225 chinese characters + 将文件名长度扩展到225个中文字符 + + + + Tool Description + 工具描述 + + + + Extend the maximum filename length to 255 Chinese characters, only supported on UOS1060 and above systems. + 将文件名最大长度扩展至255个中文字符,仅支持UOS1060及以上系统 + + + + Execute immediately + 立即执行 + + + + The operation cannot be undone. Please confirm if you want to proceed? + 操作无法撤销,请确认是否继续执行? + + + + Cancel + button + 取 消 + + + + Continue + 继续执行 + + + + + Long filename support enabled, effective after restarting the computer + 已打开长文件名支持,重启电脑后生效 + + + diff --git a/deepin-hostmodify-plugin/CMakeLists.txt b/deepin-hostmodify-plugin/CMakeLists.txt new file mode 100644 index 0000000..7d6b34f --- /dev/null +++ b/deepin-hostmodify-plugin/CMakeLists.txt @@ -0,0 +1,45 @@ +cmake_minimum_required(VERSION 3.7) + +set(PLUGIN_NAME "deepin-hostmodify") + +project(${PLUGIN_NAME}) + +set(CMAKE_AUTOMOC ON) + +file(GLOB_RECURSE SRCS + "*.h" + "*.cpp") + +find_package(Qt5 COMPONENTS Core Widgets DBus Svg LinguistTools REQUIRED) +find_package(PkgConfig REQUIRED) +find_package(DtkWidget REQUIRED) + +pkg_check_modules(DFrameworkDBus REQUIRED dframeworkdbus) +pkg_check_modules(QGSettings REQUIRED gsettings-qt) + +file(GLOB TS_FILES "translations/*.ts") +qt5_add_translation(QM_FILES ${TS_FILES}) +add_custom_target(translationshostmodify ALL DEPENDS ${QM_FILES}) +install(FILES ${QM_FILES} DESTINATION share/${PLUGIN_NAME}/translations) + +add_library(${PLUGIN_NAME} SHARED ${SRCS} icons/hostmodify_icons.qrc) +set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ./) +target_include_directories(${PLUGIN_NAME} PUBLIC + ${Qt5Widgets_INCLUDE_DIRS} + ${Qt5Svg_INCLUDE_DIRS} + ${DtkWidget_INCLUDE_DIRS} + ${QGSettings_INCLUDE_DIRS} + ${Qt5DBus_INCLUDE_DIRS} + ../deepin-pc-manager/include/ + ) +target_link_libraries(${PLUGIN_NAME} PRIVATE + ${Qt5Widgets_LIBRARIES} + ${Qt5Svg_LIBRARIES} + ${DtkWidget_LIBRARIES} + ${DFrameworkDBus_LIBRARIES} + ${QGSettings_LIBRARIES} + ${Qt5DBus_LIBRARIES} + ) + +install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION /usr/lib/deepin-pc-manager/modules) +install(FILES icons/icons/deepin-host-modify.svg DESTINATION /usr/share/icons/hicolor/scalable/apps) diff --git a/deepin-hostmodify-plugin/hostmodify_settings.json b/deepin-hostmodify-plugin/hostmodify_settings.json new file mode 100644 index 0000000..dbc6b7b --- /dev/null +++ b/deepin-hostmodify-plugin/hostmodify_settings.json @@ -0,0 +1,3 @@ +{ + "api" : "1.0.0" +} \ No newline at end of file diff --git a/deepin-hostmodify-plugin/hostmodifymodel.cpp b/deepin-hostmodify-plugin/hostmodifymodel.cpp new file mode 100644 index 0000000..db28777 --- /dev/null +++ b/deepin-hostmodify-plugin/hostmodifymodel.cpp @@ -0,0 +1,46 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "hostmodifymodel.h" +#include "invokers/invokerfactory.h" + +#include + +HostModifyModel::HostModifyModel(QObject *parent) + : QObject(parent) + , m_sysetemDaemonInvokerInter(nullptr) +{ + initData(); +} + +HostModifyModel::~HostModifyModel() +{ +} + +// 初始化数据 +void HostModifyModel::initData() +{ + m_sysetemDaemonInvokerInter = InvokerFactory::GetInstance().CreateInvoker("com.deepin.pc.manager.system.daemon", + "/com/deepin/pc/manager/system/daemon", + "com.deepin.pc.manager.system.daemon", + ConnectType::SYSTEM, + this); +} + +// 获取hosts文件信息 +QString HostModifyModel::getHostsFileInfo() +{ + QProcess proc; + proc.start("cat /etc/hosts"); + proc.waitForStarted(-1); + proc.waitForFinished(-1); + m_hostInfo = proc.readAllStandardOutput(); + return m_hostInfo; +} + +void HostModifyModel::saveHostFile(QString host) +{ + m_hostInfo = host; + DBUS_NOBLOCK_INVOKE(m_sysetemDaemonInvokerInter, "ReplaceHostFile", host); +} diff --git a/deepin-hostmodify-plugin/hostmodifymodel.h b/deepin-hostmodify-plugin/hostmodifymodel.h new file mode 100644 index 0000000..b19d4ea --- /dev/null +++ b/deepin-hostmodify-plugin/hostmodifymodel.h @@ -0,0 +1,30 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include + +class DBusInvokerInterface; +class HostModifyModel : public QObject +{ + Q_OBJECT +public: + explicit HostModifyModel(QObject *parent = nullptr); + ~HostModifyModel(); + + QString getDefaultHostInfo() { return m_hostInfo; } + // 获取hosts文件信息 + QString getHostsFileInfo(); + + void saveHostFile(QString host); + +private: + void initData(); + +private: + DBusInvokerInterface *m_sysetemDaemonInvokerInter; + + QString m_hostInfo; +}; diff --git a/deepin-hostmodify-plugin/hostmodifymodule.cpp b/deepin-hostmodify-plugin/hostmodifymodule.cpp new file mode 100644 index 0000000..66289ab --- /dev/null +++ b/deepin-hostmodify-plugin/hostmodifymodule.cpp @@ -0,0 +1,79 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "hostmodifymodule.h" +#include "hostmodifymodel.h" +#include "hostmodifywidget.h" + +#include + +#include +#include + +DWIDGET_USE_NAMESPACE +DCORE_USE_NAMESPACE + +HostModifyModule::HostModifyModule() + : QObject() + , ToolBoxInterface() + , m_hostModifyModel(nullptr) + , m_hostModifyWidget(nullptr) +{ + QTranslator *translator = new QTranslator(this); + translator->load(QString("/usr/share/deepin-hostmodify/translations/deepin-hostmodify_%1.qm").arg(QLocale::system().name())); + QCoreApplication::installTranslator(translator); +} + +HostModifyModule::~HostModifyModule() +{ +} + +void HostModifyModule::active() +{ + if (!m_hostModifyModel) { + m_hostModifyModel = new HostModifyModel; + } + if (!m_hostModifyWidget) { + m_hostModifyWidget = new HostModifyWidget(m_hostModifyModel); + } + + m_frameProxy->pushWidget(this, m_hostModifyWidget); + m_hostModifyWidget->setVisible(true); +} + +const QString HostModifyModule::name() const +{ + return "DEEPINHOSTMODIFY"; +} +const QString HostModifyModule::apptitle() const +{ + return tr("Hosts configuration modification"); +} +const QString HostModifyModule::apptip() const +{ + return tr("Manually modify hosts file"); +} +const QString HostModifyModule::appsupporter() const +{ + return tr("Supported by UOS"); +} +const QString HostModifyModule::icon() const +{ + return "deepin-host-modify"; +} + +int HostModifyModule::apptype() const +{ + return ToolBoxProxyInterface::Network; +} + +bool HostModifyModule::enable() const +{ + return true; +} + +bool HostModifyModule::checkauth() const +{ + return true; +} diff --git a/deepin-hostmodify-plugin/hostmodifymodule.h b/deepin-hostmodify-plugin/hostmodifymodule.h new file mode 100644 index 0000000..3d7b69d --- /dev/null +++ b/deepin-hostmodify-plugin/hostmodifymodule.h @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include +#include + +#include "interface/toolboxinterface.h" +#include "interface/toolboxproxyinterface.h" + +namespace PCC_NAMESPACE { +class ToolBoxInterface; +class ToolBoxProxyInterface; +} // namespace PCC_NAMESPACE + +using namespace PCC_NAMESPACE; + +class HostModifyWidget; +class HostModifyModel; +class HostModifyModule : public QObject + , public ToolBoxInterface +{ + Q_OBJECT + + Q_PLUGIN_METADATA(IID ToolBoxInterface_iid FILE "hostmodify_settings.json") + Q_INTERFACES(PCC_NAMESPACE::ToolBoxInterface) + +public: + explicit HostModifyModule(); + + ~HostModifyModule() Q_DECL_OVERRIDE; + + const QString name() const Q_DECL_OVERRIDE; + const QString apptitle() const Q_DECL_OVERRIDE; + const QString apptip() const Q_DECL_OVERRIDE; + const QString appsupporter() const Q_DECL_OVERRIDE; + const QString icon() const Q_DECL_OVERRIDE; + int apptype() const Q_DECL_OVERRIDE; + bool enable() const Q_DECL_OVERRIDE; + bool checkauth() const Q_DECL_OVERRIDE; + +private: + void onStatusChanged(); + +public Q_SLOTS: + void active() Q_DECL_OVERRIDE; + +private: + HostModifyModel *m_hostModifyModel; + HostModifyWidget *m_hostModifyWidget; +}; diff --git a/deepin-hostmodify-plugin/hostmodifywidget.cpp b/deepin-hostmodify-plugin/hostmodifywidget.cpp new file mode 100644 index 0000000..dbf5b76 --- /dev/null +++ b/deepin-hostmodify-plugin/hostmodifywidget.cpp @@ -0,0 +1,119 @@ +// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "hostmodifywidget.h" +#include "hostmodifymodel.h" + +#include +#include +#include +#include +#include + +HostModifyWidget::HostModifyWidget(HostModifyModel *model, QWidget *parent) + : DFrame(parent) + , m_model(model) + , m_textEdit(nullptr) + , m_resetButton(nullptr) + , m_saveButton(nullptr) +{ + initUI(); + + m_textEdit->setText(m_model->getHostsFileInfo()); + connect(m_textEdit, &QTextEdit::textChanged, this, &HostModifyWidget::acceptTextChanged); + connect(m_resetButton, &QPushButton::clicked, this, &HostModifyWidget::resetHostFile); + connect(m_saveButton, &DSuggestButton::clicked, this, &HostModifyWidget::saveHostFile); +} + +HostModifyWidget::~HostModifyWidget() +{ +} + +void HostModifyWidget::initUI() +{ + QVBoxLayout *layout = new QVBoxLayout(this); + layout->setSpacing(10); + layout->setContentsMargins(20, 20, 20, 20); + this->setLayout(layout); + + QLabel *title = new QLabel(tr("Hosts configuration modification"), this); + QFont font1 = title->font(); + font1.setBold(true); + font1.setWeight(QFont::DemiBold); + title->setFont(font1); + DFontSizeManager::instance()->bind(title, DFontSizeManager::T5); + title->setContentsMargins(0, 0, 0, 0); + title->setContentsMargins(10, 0, 0, 0); + + QLabel *detailInfo = new QLabel(tr("Manually modify hosts file"), this); + DFontSizeManager::instance()->bind(detailInfo, DFontSizeManager::T8); + detailInfo->setContentsMargins(0, 0, 0, 0); + detailInfo->setContentsMargins(10, 0, 0, 0); + + DFrame *textFrame = new DFrame(this); + QVBoxLayout *textLayout = new QVBoxLayout(textFrame); + textLayout->setContentsMargins(2, 2, 2, 2); + textLayout->setSpacing(0); + textFrame->setLayout(textLayout); + + m_textEdit = new QTextEdit(textFrame); + m_textEdit->setFixedSize(QSize(900, 400)); + m_textEdit->setLineWidth(0); + textLayout->addWidget(m_textEdit, 0, Qt::AlignCenter); + + layout->addWidget(title); + layout->addWidget(detailInfo); + layout->addWidget(textFrame, 0, Qt::AlignCenter); + + QHBoxLayout *btnLayout = new QHBoxLayout; + btnLayout->setContentsMargins(0, 0, 0, 0); + btnLayout->setSpacing(10); + m_resetButton = new DPushButton(this); + m_resetButton->setFixedWidth(150); + m_resetButton->setText(tr("Reset")); + m_saveButton = new DSuggestButton(this); + m_saveButton->setFixedWidth(150); + m_saveButton->setText(tr("Save")); + + m_resetButton->setEnabled(false); + m_saveButton->setEnabled(false); + btnLayout->addStretch(); + btnLayout->addWidget(m_resetButton, 0, Qt::AlignRight); + btnLayout->addWidget(m_saveButton, 0, Qt::AlignRight); + layout->addLayout(btnLayout); +} + +void HostModifyWidget::acceptTextChanged() +{ + QString sDefaultInfo = m_model->getDefaultHostInfo(); + QString sCurrentInfo = m_textEdit->toPlainText(); + + if (sDefaultInfo != sCurrentInfo) { + m_resetButton->setEnabled(true); + m_saveButton->setEnabled(true); + } else { + m_resetButton->setEnabled(false); + m_saveButton->setEnabled(false); + } +} + +void HostModifyWidget::resetHostFile() +{ + m_textEdit->setText(m_model->getDefaultHostInfo()); +} +void HostModifyWidget::saveHostFile() +{ + m_model->saveHostFile(m_textEdit->toPlainText()); + + m_resetButton->setEnabled(false); + m_saveButton->setEnabled(false); + + DFloatingMessage *floMsgSwitchOff = new DFloatingMessage(DFloatingMessage::TransientType); + floMsgSwitchOff->setDuration(2000); + floMsgSwitchOff->setIcon(QIcon::fromTheme("dcc_ok_tip")); + floMsgSwitchOff->setMessage(tr("Save successful")); + DMessageManager::instance()->sendMessage(this, floMsgSwitchOff); + DMessageManager::instance()->setContentMargens(this, QMargins(0, 0, 0, 20)); +} diff --git a/deepin-hostmodify-plugin/hostmodifywidget.h b/deepin-hostmodify-plugin/hostmodifywidget.h new file mode 100644 index 0000000..ca3eab1 --- /dev/null +++ b/deepin-hostmodify-plugin/hostmodifywidget.h @@ -0,0 +1,41 @@ +// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include +#include +#include + +#include +#include +#include +#include + +DWIDGET_USE_NAMESPACE +class HostModifyModel; +class HostModifyWidget : public DFrame +{ + Q_OBJECT +public: + explicit HostModifyWidget(HostModifyModel *model, QWidget *parent = nullptr); + ~HostModifyWidget(); + +private: + // 初始化界面 + void initUI(); + +public Q_SLOTS: + void acceptTextChanged(); + void resetHostFile(); + void saveHostFile(); + +private: + HostModifyModel *m_model; + QTextEdit *m_textEdit; + + DPushButton *m_resetButton; + DSuggestButton *m_saveButton; +}; diff --git a/deepin-hostmodify-plugin/icons/hostmodify_icons.qrc b/deepin-hostmodify-plugin/icons/hostmodify_icons.qrc new file mode 100644 index 0000000..eac3316 --- /dev/null +++ b/deepin-hostmodify-plugin/icons/hostmodify_icons.qrc @@ -0,0 +1,6 @@ + + + icons/deepin-host-modify.svg + icons/dcc_ok_tip_20px.svg + + diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_antiav_normal_20px.svg b/deepin-hostmodify-plugin/icons/icons/dcc_ok_tip_20px.svg similarity index 100% rename from deepin-pc-manager/src/window/icons/icons/dcc_antiav_normal_20px.svg rename to deepin-hostmodify-plugin/icons/icons/dcc_ok_tip_20px.svg diff --git a/deepin-hostmodify-plugin/icons/icons/deepin-host-modify.svg b/deepin-hostmodify-plugin/icons/icons/deepin-host-modify.svg new file mode 100644 index 0000000..84c264b --- /dev/null +++ b/deepin-hostmodify-plugin/icons/icons/deepin-host-modify.svg @@ -0,0 +1,34 @@ + + + ICON/Security_tools/Host配置修改 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/deepin-hostmodify-plugin/invokers/dbusinvoker.cpp b/deepin-hostmodify-plugin/invokers/dbusinvoker.cpp new file mode 100644 index 0000000..58219a5 --- /dev/null +++ b/deepin-hostmodify-plugin/invokers/dbusinvoker.cpp @@ -0,0 +1,104 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "dbusinvoker.h" + +#include +#include + +DBusInvoker::DBusInvoker(const QString &service, + const QString &path, + const QString &interface, + ConnectType type, + QObject *parent) + : QObject(parent) + , m_service(service) + , m_path(path) + , m_interface(interface) + , m_type(type) + , m_connection(QDBusConnection::sessionBus()) +{ + if (SYSTEM == m_type) { + m_connection = QDBusConnection::systemBus(); + } +} + +// signal-slot connection +bool DBusInvoker::Connect(const QString &signal, QObject *reciver, const char *slot) +{ + bool connectRst = false; + connectRst = m_connection.connect(m_service, m_path, m_interface, signal, reciver, slot); + if (!connectRst) { + qCritical() << "signal connect failed : " << signal << "for reason [" + << m_connection.lastError().message() << "]"; + } + Q_ASSERT(connectRst); + return connectRst; +} + +// signal-slot disconnection +bool DBusInvoker::Disconnect(const QString &signal, QObject *reciver, const char *slot) +{ + bool disconnectRst = false; + disconnectRst = m_connection.disconnect(m_service, m_path, m_interface, signal, reciver, slot); + if (!disconnectRst) { + qCritical() << "signal disconnect failed : " << signal << "for reason [" + << m_connection.lastError().message() << "]"; + } + Q_ASSERT(disconnectRst); + return disconnectRst; +} + +DBusInvoker::~DBusInvoker() +{ + // 确保在调用delete时,释放自身成员对象 + deleteLater(); +} + +// create method call or signal emit +// invoke like this : +// invoker->Connect("signalFunc", this, SLOT(slotFunc(bool, QString))); +// there would be param type validate when signal emitted +QDBusMessage DBusInvoker::Invoke(const QString &name, + const QList &functionParams, + BlockMode mode) +{ + if (name.isEmpty()) { + return QDBusMessage::createError(QDBusError::InvalidArgs, QString("name.isEmpty")); + } + + QDBusMessage msg; + if (DBUS_PROPERTY_INVOKER_NAME == name) { + if (functionParams.isEmpty()) { + return QDBusMessage::createError(QDBusError::InvalidArgs, + QString("property not exist")); + } + + msg = QDBusMessage::createMethodCall(m_service, + m_path, + "org.freedesktop.DBus.Properties", + "Get"); + msg.setArguments({m_interface, functionParams.first().toString()}); + + QDBusMessage retMsg = m_connection.call(msg, QDBus::CallMode(mode)); + return retMsg; + } + + msg = QDBusMessage::createMethodCall(m_service, m_path, m_interface, name); + msg.setArguments(functionParams); + + return m_connection.call(msg, QDBus::CallMode(mode)); +} + +// emit signal +bool DBusInvoker::EmitSignal(const QString &name, const QList &arguments) +{ + if (name.isEmpty()) { + return false; + } + + QDBusMessage signal = QDBusMessage::createSignal(m_path, m_interface, name); + signal.setArguments(arguments); + return m_connection.send(signal); +} diff --git a/deepin-hostmodify-plugin/invokers/dbusinvoker.h b/deepin-hostmodify-plugin/invokers/dbusinvoker.h new file mode 100644 index 0000000..d1a8ab9 --- /dev/null +++ b/deepin-hostmodify-plugin/invokers/dbusinvoker.h @@ -0,0 +1,48 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef DBUS_INVOKER_H +#define DBUS_INVOKER_H + +#include "invokerinterface.h" + +#include +#include + +// 公共dbus接口类 +#define DBUS_PROPERTY_INVOKER_NAME "dbusPropertyInvoker" // 公共dbus接口属性获取识别 +// interface +class DBusInvoker : public QObject + , public DBusInvokerInterface +{ + Q_OBJECT +public: + DBusInvoker(const QString &service, + const QString &path, + const QString &interface, + ConnectType type = ConnectType::SESSION, + QObject *parent = nullptr); + + virtual QDBusMessage Invoke(const QString &name, + const QList &functionParams = QList(), + BlockMode mode = BlockMode::BLOCKWITHGUI) override; + virtual bool EmitSignal(const QString &name, + const QList &arguments = QList()) override; + virtual bool Connect(const QString &signal, QObject *reciver, const char *slot) override; + virtual bool Disconnect(const QString &signal, QObject *reciver, const char *slot) override; + virtual ~DBusInvoker() override; + +private: + QString m_service; + QString m_path; + QString m_interface; + ConnectType m_type; + QDBusConnection m_connection; + +private: + DBusInvoker(const DBusInvoker &); + DBusInvoker &operator=(const DBusInvoker &); +}; + +#endif diff --git a/deepin-hostmodify-plugin/invokers/invokerfactory.cpp b/deepin-hostmodify-plugin/invokers/invokerfactory.cpp new file mode 100644 index 0000000..f0c0634 --- /dev/null +++ b/deepin-hostmodify-plugin/invokers/invokerfactory.cpp @@ -0,0 +1,38 @@ +// Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "invokerfactory.h" + +#include "dbusinvoker.h" + +InvokerFactory::InvokerFactory() +{ +} + +InvokerFactory::~InvokerFactory() +{ +} + +DBusInvokerInterface *InvokerFactory::CreateInvoker(const QString &service, + const QString &path, + const QString &interface, + ConnectType type, + QObject *parent) +{ + return new DBusInvoker(service, path, interface, type, parent); +} + +// 单元测试扩展处理 +void InvokerFactory::setInvokerInteface(const QString &interfaceName, + DBusInvokerInterface *interface) +{ +#ifdef DEEPIN_DEFENDER_UNITTEST + // 不关心是否重复 + m_intefaceMap.insert(interfaceName, interface); +#else + Q_UNUSED(interfaceName); + Q_UNUSED(interface); +#endif +} diff --git a/deepin-hostmodify-plugin/invokers/invokerfactory.h b/deepin-hostmodify-plugin/invokers/invokerfactory.h new file mode 100644 index 0000000..2f25e78 --- /dev/null +++ b/deepin-hostmodify-plugin/invokers/invokerfactory.h @@ -0,0 +1,52 @@ +// Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef DBUS_INVOKER_FACTORY +#define DBUS_INVOKER_FACTORY + +#include "invokerinterface.h" + +#include + +// 简化DBUS调用方法的写法 +#define DBUS_BLOCK_INVOKE(interface, funName, ...) \ + interface->Invoke(funName, {__VA_ARGS__}, BlockMode::BLOCK) +#define DBUS_INVOKE(interface, funName, ...) \ + interface->Invoke(funName, {__VA_ARGS__}, BlockMode::BLOCKWITHGUI) +#define DBUS_NOBLOCK_INVOKE(interface, funName, ...) \ + interface->Invoke(funName, {__VA_ARGS__}, BlockMode::NOBLOCK) +#define GET_MESSAGE_VALUE(type, output, message) type output = QDBusReply(message).value() + +// implement +class InvokerFactory : public QObject + , public InvokerFactoryInterface +{ + Q_OBJECT +public: + static InvokerFactory &GetInstance() + { + static InvokerFactory instance; + return instance; + } + + virtual DBusInvokerInterface *CreateInvoker(const QString &service, + const QString &path, + const QString &interface, + ConnectType type = ConnectType::SESSION, + QObject *parent = nullptr) override; + +public: + void setInvokerInteface(const QString &, DBusInvokerInterface *); + +private: + InvokerFactory(); + InvokerFactory(InvokerFactory &); + InvokerFactory &operator=(const InvokerFactory &); + ~InvokerFactory() override; + + QMap m_intefaceMap; +}; + +#endif diff --git a/deepin-hostmodify-plugin/invokers/invokerinterface.h b/deepin-hostmodify-plugin/invokers/invokerinterface.h new file mode 100644 index 0000000..4702801 --- /dev/null +++ b/deepin-hostmodify-plugin/invokers/invokerinterface.h @@ -0,0 +1,50 @@ +// Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef DBUS_INVOKE_INTERFACE_H +#define DBUS_INVOKE_INTERFACE_H + +#include +#include +#include + +enum ConnectType { SYSTEM, + SESSION }; + +enum InvokeType { CALL, + SIGNAL }; + +enum BlockMode { NOBLOCK, + BLOCK, + BLOCKWITHGUI, + AUTODETECT }; + +// interface +class DBusInvokerInterface +{ +public: + virtual QDBusMessage Invoke(const QString &name, + const QList &functionParams = QList(), + BlockMode mode = BlockMode::BLOCKWITHGUI) = 0; + virtual bool EmitSignal(const QString &name, + const QList &arguments = QList()) = 0; + virtual bool Connect(const QString &signal, QObject *reciver, const char *slot) = 0; + virtual bool Disconnect(const QString &signal, QObject *reciver, const char *slot) = 0; + + virtual ~DBusInvokerInterface() {} +}; + +class InvokerFactoryInterface +{ +public: + virtual DBusInvokerInterface *CreateInvoker(const QString &service, + const QString &path, + const QString &interface, + ConnectType type = ConnectType::SESSION, + QObject *parent = nullptr) = 0; + virtual ~InvokerFactoryInterface() {} +}; + +#endif diff --git a/deepin-hostmodify-plugin/translate_generation.sh b/deepin-hostmodify-plugin/translate_generation.sh new file mode 100644 index 0000000..6b67c53 --- /dev/null +++ b/deepin-hostmodify-plugin/translate_generation.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +# +# SPDX-License-Identifier: GPL-3.0-or-later + +# this file is used to auto-generate .qm file from .ts file. +# author: shibowen at linuxdeepin.com + +ts_list=($(ls translations/*.ts)) + +for ts in "${ts_list[@]}"; do + printf "\nprocess ${ts}\n" + lrelease "${ts}" +done diff --git a/deepin-hostmodify-plugin/translations/deepin-hostmodify_en_US.ts b/deepin-hostmodify-plugin/translations/deepin-hostmodify_en_US.ts new file mode 100644 index 0000000..68dc2c8 --- /dev/null +++ b/deepin-hostmodify-plugin/translations/deepin-hostmodify_en_US.ts @@ -0,0 +1,50 @@ + + + + + HostModifyModule + + + Hosts configuration modification + + + + + Manually modify hosts file + + + + + Supported by UOS + + + + + HostModifyWidget + + + Hosts configuration modification + + + + + Manually modify hosts file + + + + + Reset + + + + + Save + + + + + Save successful + + + + diff --git a/deepin-hostmodify-plugin/translations/deepin-hostmodify_zh_CN.ts b/deepin-hostmodify-plugin/translations/deepin-hostmodify_zh_CN.ts new file mode 100644 index 0000000..f0e828d --- /dev/null +++ b/deepin-hostmodify-plugin/translations/deepin-hostmodify_zh_CN.ts @@ -0,0 +1,50 @@ + + + + + HostModifyModule + + + Hosts configuration modification + Hosts配置修改 + + + + Manually modify hosts file + 手动修改host文件 + + + + Supported by UOS + 由UOS提供服务 + + + + HostModifyWidget + + + Hosts configuration modification + Hosts配置修改 + + + + Manually modify hosts file + 手动修改host文件 + + + + Reset + 重置 + + + + Save + 保存 + + + + Save successful + 保存成功 + + + diff --git a/deepin-keyclean-plugin/CMakeLists.txt b/deepin-keyclean-plugin/CMakeLists.txt new file mode 100644 index 0000000..09b81a5 --- /dev/null +++ b/deepin-keyclean-plugin/CMakeLists.txt @@ -0,0 +1,46 @@ +cmake_minimum_required(VERSION 3.7) + +set(PLUGIN_NAME "deepin-keyclean") + +project(${PLUGIN_NAME}) + +set(CMAKE_AUTOMOC ON) + +file(GLOB_RECURSE SRCS + "*.h" + "*.cpp") + +find_package(Qt5 COMPONENTS Core Widgets DBus Svg LinguistTools REQUIRED) +find_package(PkgConfig REQUIRED) +find_package(DtkWidget REQUIRED) + +pkg_check_modules(DFrameworkDBus REQUIRED dframeworkdbus) +pkg_check_modules(QGSettings REQUIRED gsettings-qt) + +file(GLOB TS_FILES "translations/*.ts") +qt5_add_translation(QM_FILES ${TS_FILES}) +add_custom_target(translationskeyclean ALL DEPENDS ${QM_FILES}) +install(FILES ${QM_FILES} DESTINATION share/${PLUGIN_NAME}/translations) + +add_library(${PLUGIN_NAME} SHARED ${SRCS} icons/keyclean_icons.qrc) +set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ./) +target_include_directories(${PLUGIN_NAME} PUBLIC + ${Qt5Widgets_INCLUDE_DIRS} + ${Qt5Svg_INCLUDE_DIRS} + ${DtkWidget_INCLUDE_DIRS} + ${QGSettings_INCLUDE_DIRS} + ${Qt5DBus_INCLUDE_DIRS} + ../deepin-pc-manager/include/ + ) +target_link_libraries(${PLUGIN_NAME} PRIVATE + ${Qt5Widgets_LIBRARIES} + ${Qt5Svg_LIBRARIES} + ${DtkWidget_LIBRARIES} + ${DFrameworkDBus_LIBRARIES} + ${QGSettings_LIBRARIES} + ${Qt5DBus_LIBRARIES} + ) + +install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION /usr/lib/deepin-pc-manager/modules) +install(FILES icons/icons/deepin-key-clean.svg DESTINATION /usr/share/icons/hicolor/scalable/apps) +install(FILES ./keyclean.sh DESTINATION /usr/share/deepin-pc-manager) diff --git a/deepin-keyclean-plugin/icons/icons/deepin-key-clean.svg b/deepin-keyclean-plugin/icons/icons/deepin-key-clean.svg new file mode 100644 index 0000000..2bac520 --- /dev/null +++ b/deepin-keyclean-plugin/icons/icons/deepin-key-clean.svg @@ -0,0 +1,64 @@ + + + ICON/Security_tools/密钥环 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/deepin-keyclean-plugin/icons/keyclean_icons.qrc b/deepin-keyclean-plugin/icons/keyclean_icons.qrc new file mode 100644 index 0000000..0bc6269 --- /dev/null +++ b/deepin-keyclean-plugin/icons/keyclean_icons.qrc @@ -0,0 +1,5 @@ + + + icons/deepin-key-clean.svg + + diff --git a/deepin-keyclean-plugin/keyclean.sh b/deepin-keyclean-plugin/keyclean.sh new file mode 100644 index 0000000..3d880c7 --- /dev/null +++ b/deepin-keyclean-plugin/keyclean.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +# +# SPDX-License-Identifier: GPL-3.0-or-later + +echo '操作开始' +echo '移动keyrings目录到回收站:'`mv ~/.local/share/keyrings/* ~/.local/share/Trash/files/` +echo 'deepin-keyrings-wb:'`mv ~/.local/share/deepin-keyrings-wb/* ~/.local/share/Trash/files/` +echo '操作完成' \ No newline at end of file diff --git a/deepin-keyclean-plugin/keyclean_settings.json b/deepin-keyclean-plugin/keyclean_settings.json new file mode 100644 index 0000000..dbc6b7b --- /dev/null +++ b/deepin-keyclean-plugin/keyclean_settings.json @@ -0,0 +1,3 @@ +{ + "api" : "1.0.0" +} \ No newline at end of file diff --git a/deepin-keyclean-plugin/keycleanmodel.cpp b/deepin-keyclean-plugin/keycleanmodel.cpp new file mode 100644 index 0000000..4b10be2 --- /dev/null +++ b/deepin-keyclean-plugin/keycleanmodel.cpp @@ -0,0 +1,37 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "keycleanmodel.h" + +#include + +#define LOOG_KEY_LOCK_DIR "/usr/share/deepin-pc-manager/" +#define LOOG_KEY_LOCK_PATH "/usr/share/deepin-pc-manager/keyclean.sh" +KeyCleanModel::KeyCleanModel(QObject *parent) + : QObject(parent) +{ + initData(); +} + +KeyCleanModel::~KeyCleanModel() +{ +} + +// 初始化数据 +void KeyCleanModel::initData() +{ +} + +QString KeyCleanModel::startCleanKeyLock() +{ + QProcess builder; + builder.setWorkingDirectory(LOOG_KEY_LOCK_DIR); + builder.setProcessChannelMode(QProcess::MergedChannels); + builder.start(QString("/bin/bash %1 %2").arg(LOOG_KEY_LOCK_PATH)); + if (!builder.waitForFinished()) { + builder.close(); + return "秘钥环清理失败"; + } + return QString::fromLocal8Bit(builder.readAllStandardOutput()).trimmed(); +} diff --git a/deepin-keyclean-plugin/keycleanmodel.h b/deepin-keyclean-plugin/keycleanmodel.h new file mode 100644 index 0000000..cdbafde --- /dev/null +++ b/deepin-keyclean-plugin/keycleanmodel.h @@ -0,0 +1,22 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include + +class KeyCleanModel : public QObject +{ + Q_OBJECT +public: + explicit KeyCleanModel(QObject *parent = nullptr); + ~KeyCleanModel(); + + QString startCleanKeyLock(); + +private: + void initData(); + +private: +}; diff --git a/deepin-keyclean-plugin/keycleanmodule.cpp b/deepin-keyclean-plugin/keycleanmodule.cpp new file mode 100644 index 0000000..8efa60e --- /dev/null +++ b/deepin-keyclean-plugin/keycleanmodule.cpp @@ -0,0 +1,79 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "keycleanmodule.h" +#include "keycleanmodel.h" +#include "keycleanwidget.h" + +#include + +#include +#include + +DWIDGET_USE_NAMESPACE +DCORE_USE_NAMESPACE + +KeyCLeanModule::KeyCLeanModule() + : QObject() + , ToolBoxInterface() + , m_keyCleanModel(nullptr) + , m_keyCleanWidget(nullptr) +{ + QTranslator *translator = new QTranslator(this); + translator->load(QString("/usr/share/deepin-keyclean/translations/deepin-keyclean_%1.qm").arg(QLocale::system().name())); + QCoreApplication::installTranslator(translator); +} + +KeyCLeanModule::~KeyCLeanModule() +{ +} + +void KeyCLeanModule::active() +{ + if (!m_keyCleanModel) { + m_keyCleanModel = new KeyCleanModel; + } + if (!m_keyCleanWidget) { + m_keyCleanWidget = new KeyCleanWidget(m_keyCleanModel); + } + + m_frameProxy->pushWidget(this, m_keyCleanWidget); + m_keyCleanWidget->setVisible(true); +} + +const QString KeyCLeanModule::name() const +{ + return "DEEPINKEYCLEAN"; +} +const QString KeyCLeanModule::apptitle() const +{ + return tr("Keyring cleaning"); +} +const QString KeyCLeanModule::apptip() const +{ + return tr("Resolve repeated keyring unlock requests"); +} +const QString KeyCLeanModule::appsupporter() const +{ + return tr("Supported by UOS"); +} +const QString KeyCLeanModule::icon() const +{ + return "deepin-key-clean"; +} + +int KeyCLeanModule::apptype() const +{ + return ToolBoxProxyInterface::System; +} + +bool KeyCLeanModule::enable() const +{ + return true; +} + +bool KeyCLeanModule::checkauth() const +{ + return false; +} diff --git a/deepin-keyclean-plugin/keycleanmodule.h b/deepin-keyclean-plugin/keycleanmodule.h new file mode 100644 index 0000000..1808408 --- /dev/null +++ b/deepin-keyclean-plugin/keycleanmodule.h @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include +#include + +#include "interface/toolboxinterface.h" +#include "interface/toolboxproxyinterface.h" + +namespace PCC_NAMESPACE { +class ToolBoxInterface; +class ToolBoxProxyInterface; +} // namespace PCC_NAMESPACE + +using namespace PCC_NAMESPACE; + +class KeyCleanWidget; +class KeyCleanModel; +class KeyCLeanModule : public QObject + , public ToolBoxInterface +{ + Q_OBJECT + + Q_PLUGIN_METADATA(IID ToolBoxInterface_iid FILE "keyclean_settings.json") + Q_INTERFACES(PCC_NAMESPACE::ToolBoxInterface) + +public: + explicit KeyCLeanModule(); + + ~KeyCLeanModule() Q_DECL_OVERRIDE; + + const QString name() const Q_DECL_OVERRIDE; + const QString apptitle() const Q_DECL_OVERRIDE; + const QString apptip() const Q_DECL_OVERRIDE; + const QString appsupporter() const Q_DECL_OVERRIDE; + const QString icon() const Q_DECL_OVERRIDE; + int apptype() const Q_DECL_OVERRIDE; + bool enable() const Q_DECL_OVERRIDE; + bool checkauth() const Q_DECL_OVERRIDE; + +private: + void onStatusChanged(); + +public Q_SLOTS: + void active() Q_DECL_OVERRIDE; + +private: + KeyCleanModel *m_keyCleanModel; + KeyCleanWidget *m_keyCleanWidget; +}; diff --git a/deepin-keyclean-plugin/keycleanwidget.cpp b/deepin-keyclean-plugin/keycleanwidget.cpp new file mode 100644 index 0000000..d1249a9 --- /dev/null +++ b/deepin-keyclean-plugin/keycleanwidget.cpp @@ -0,0 +1,96 @@ +// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "keycleanwidget.h" +#include "keycleanmodel.h" + +#include +#include + +#include + +KeyCleanWidget::KeyCleanWidget(KeyCleanModel *model, QWidget *parent) + : DFrame(parent) + , m_model(model) +{ + initUI(); + connect(m_execButton, &DSuggestButton::clicked, this, &KeyCleanWidget::cleanKeyLock); +} + +KeyCleanWidget::~KeyCleanWidget() +{ +} + +void KeyCleanWidget::initUI() +{ + QVBoxLayout *layout = new QVBoxLayout(this); + layout->setSpacing(10); + layout->setContentsMargins(20, 20, 20, 20); + this->setLayout(layout); + + QLabel *title = new QLabel(tr("Keyring cleaning"), this); + QFont font1 = title->font(); + font1.setBold(true); + font1.setWeight(QFont::DemiBold); + DFontSizeManager::instance()->bind(title, DFontSizeManager::T5); + title->setContentsMargins(10, 0, 0, 0); + + QLabel *detailInfo = new QLabel(tr("Resolve repeated keyring unlock requests"), this); + DFontSizeManager::instance()->bind(detailInfo, DFontSizeManager::T8); + detailInfo->setContentsMargins(10, 0, 0, 0); + + QLabel *descriptionInfo = new QLabel(tr("Tool Description"), this); + DFontSizeManager::instance()->bind(descriptionInfo, DFontSizeManager::T8); + descriptionInfo->setContentsMargins(10, 0, 0, 0); + + DTipLabel *tipLabel = new DTipLabel(tr("Resolve the issue of repeatedly prompting for 'Unlock Login Keyring' dialog and being unable to prevent the pop-up through operations."), this); + DFontSizeManager::instance()->bind(tipLabel, DFontSizeManager::T8); + tipLabel->setContentsMargins(10, 0, 0, 0); + tipLabel->setAlignment(Qt::AlignLeft); + + DFrame *textFrame = new DFrame(this); + QVBoxLayout *textLayout = new QVBoxLayout(textFrame); + textLayout->setContentsMargins(2, 2, 2, 2); + textLayout->setSpacing(0); + textFrame->setLayout(textLayout); + + m_textEdit = new QTextEdit(textFrame); + m_textEdit->setFixedSize(QSize(900, 400)); + m_textEdit->setLineWidth(0); + textLayout->addWidget(m_textEdit, 0, Qt::AlignCenter); + + m_execButton = new DSuggestButton(this); + m_execButton->setFixedWidth(180); + m_execButton->setText(tr("Execute immediately")); + + layout->addWidget(title); + layout->addWidget(detailInfo); + layout->addSpacing(10); + layout->addWidget(descriptionInfo); + layout->addWidget(tipLabel); + layout->addWidget(textFrame, 0, Qt::AlignCenter); + layout->addWidget(m_execButton, 0, Qt::AlignRight); + layout->addStretch(); +} + +void KeyCleanWidget::cleanKeyLock() +{ + DDialog *dlg = new DDialog(this); + dlg->setOnButtonClickedClose(true); + // 设置属性当关闭时候删除自己 + dlg->setAttribute(Qt::WA_DeleteOnClose); + dlg->setIcon(QIcon::fromTheme("deepin-key-clean")); + dlg->setMessage(tr("The operation cannot be undone. Please confirm if you want to proceed?")); + dlg->addButton(tr("Cancel", "button"), false, DDialog::ButtonType::ButtonNormal); + dlg->addButton(tr("Continue"), false, DDialog::ButtonType::ButtonRecommend); + + connect(dlg, &DDialog::buttonClicked, this, [&](int index, const QString &text) { + Q_UNUSED(text); + if (1 == index) { + m_textEdit->setText(m_model->startCleanKeyLock()); + } + }); + dlg->exec(); +} diff --git a/deepin-keyclean-plugin/keycleanwidget.h b/deepin-keyclean-plugin/keycleanwidget.h new file mode 100644 index 0000000..9eebca4 --- /dev/null +++ b/deepin-keyclean-plugin/keycleanwidget.h @@ -0,0 +1,38 @@ +// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include +#include +#include +#include + +#include +#include +#include +#include + +DWIDGET_USE_NAMESPACE +class KeyCleanModel; +class KeyCleanWidget : public DFrame +{ + Q_OBJECT +public: + explicit KeyCleanWidget(KeyCleanModel *model, QWidget *parent = nullptr); + ~KeyCleanWidget(); + +private: + // 初始化界面 + void initUI(); + +public Q_SLOTS: + void cleanKeyLock(); + +private: + KeyCleanModel *m_model; + QTextEdit *m_textEdit; + DSuggestButton *m_execButton; +}; diff --git a/deepin-keyclean-plugin/translate_generation.sh b/deepin-keyclean-plugin/translate_generation.sh new file mode 100644 index 0000000..6b67c53 --- /dev/null +++ b/deepin-keyclean-plugin/translate_generation.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +# +# SPDX-License-Identifier: GPL-3.0-or-later + +# this file is used to auto-generate .qm file from .ts file. +# author: shibowen at linuxdeepin.com + +ts_list=($(ls translations/*.ts)) + +for ts in "${ts_list[@]}"; do + printf "\nprocess ${ts}\n" + lrelease "${ts}" +done diff --git a/deepin-keyclean-plugin/translations/deepin-keyclean_en_US.ts b/deepin-keyclean-plugin/translations/deepin-keyclean_en_US.ts new file mode 100644 index 0000000..8047829 --- /dev/null +++ b/deepin-keyclean-plugin/translations/deepin-keyclean_en_US.ts @@ -0,0 +1,71 @@ + + + + + KeyCLeanModule + + + Keyring cleaning + + + + + Resolve repeated keyring unlock requests + + + + + Supported by UOS + + + + + KeyCleanWidget + + + Keyring cleaning + + + + + Resolve repeated keyring unlock requests + + + + + Tool Description + + + + + Resolve the issue of repeatedly prompting for 'Unlock Login Keyring' dialog and being unable to prevent the pop-up through operations. + + + + + Execute immediately + + + + + The operation cannot be undone. Please confirm if you want to proceed? + + + + + Cancel + button + + + + + Continue + + + + + Execute successful + + + + diff --git a/deepin-keyclean-plugin/translations/deepin-keyclean_zh_CN.ts b/deepin-keyclean-plugin/translations/deepin-keyclean_zh_CN.ts new file mode 100644 index 0000000..0b62b1c --- /dev/null +++ b/deepin-keyclean-plugin/translations/deepin-keyclean_zh_CN.ts @@ -0,0 +1,71 @@ + + + + + KeyCLeanModule + + + Keyring cleaning + 密钥环清理 + + + + Resolve repeated keyring unlock requests + 清理密钥环信息 + + + + Supported by UOS + 由UOS提供服务 + + + + KeyCleanWidget + + + Keyring cleaning + 密钥环清理 + + + + Resolve repeated keyring unlock requests + 清理密钥环信息 + + + + Tool Description + 工具描述 + + + + Resolve the issue of repeatedly prompting for 'Unlock Login Keyring' dialog and being unable to prevent the pop-up through operations. + 解决多次弹出“解锁登录密钥环”对话框要求输入密码,且无法通过操作禁止弹出的问题 + + + + Execute immediately + 立即执行 + + + + The operation cannot be undone. Please confirm if you want to proceed? + 操作无法撤销,请确认是否继续执行? + + + + Cancel + button + 取 消 + + + + Continue + 继续执行 + + + + Execute successful + 执行成功 + + + diff --git a/deepin-netcheck-plugin/CMakeLists.txt b/deepin-netcheck-plugin/CMakeLists.txt new file mode 100644 index 0000000..9a11730 --- /dev/null +++ b/deepin-netcheck-plugin/CMakeLists.txt @@ -0,0 +1,46 @@ +cmake_minimum_required(VERSION 3.7) + +set(PLUGIN_NAME "deepin-netcheck") + +project(${PLUGIN_NAME}) + +set(CMAKE_AUTOMOC ON) + +file(GLOB_RECURSE SRCS + "*.h" + "*.cpp") + +find_package(Qt5 COMPONENTS Core Widgets DBus Svg LinguistTools REQUIRED) +find_package(PkgConfig REQUIRED) +find_package(DtkWidget REQUIRED) + +pkg_check_modules(DFrameworkDBus REQUIRED dframeworkdbus) +pkg_check_modules(QGSettings REQUIRED gsettings-qt) + +file(GLOB TS_FILES "translations/*.ts") +qt5_add_translation(QM_FILES ${TS_FILES}) +add_custom_target(translationsnetcheck ALL DEPENDS ${QM_FILES}) +install(FILES ${QM_FILES} DESTINATION share/${PLUGIN_NAME}/translations) + +add_library(${PLUGIN_NAME} SHARED ${SRCS} icons/netcheck_icons.qrc) +set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ./) +target_include_directories(${PLUGIN_NAME} PUBLIC + ${Qt5Widgets_INCLUDE_DIRS} + ${Qt5Svg_INCLUDE_DIRS} + ${DtkWidget_INCLUDE_DIRS} + ${QGSettings_INCLUDE_DIRS} + ${Qt5DBus_INCLUDE_DIRS} + ../deepin-pc-manager/include/ + ) +target_link_libraries(${PLUGIN_NAME} PRIVATE + ${Qt5Widgets_LIBRARIES} + ${Qt5Svg_LIBRARIES} + ${DtkWidget_LIBRARIES} + ${DFrameworkDBus_LIBRARIES} + ${QGSettings_LIBRARIES} + ${Qt5DBus_LIBRARIES} + ) + +install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION /usr/lib/deepin-pc-manager/modules) +install(FILES ./configs/org.deepin.dde.deepin-netcheck.json DESTINATION /usr/share/dsg/configs/org.deepin.dde.deepin-netcheck/) +install(FILES icons/icons/deepin-net-check.svg DESTINATION /usr/share/icons/hicolor/scalable/apps) diff --git a/deepin-netcheck-plugin/configs/org.deepin.dde.deepin-netcheck.json b/deepin-netcheck-plugin/configs/org.deepin.dde.deepin-netcheck.json new file mode 100644 index 0000000..ce9dd48 --- /dev/null +++ b/deepin-netcheck-plugin/configs/org.deepin.dde.deepin-netcheck.json @@ -0,0 +1,26 @@ +{ + "magic": "dsg.config.meta", + "version": "1.0", + "contents": { + "netCheckType": { + "value": 0, + "serial": 0, + "flags": ["global"], + "name": "netCheckType", + "description[zh_CN]": "网络检测类型", + "description": "", + "permissions": "readwrite", + "visibility": "private" + }, + "netCheckIntranetDomain": { + "value": "", + "serial": 0, + "flags": ["global"], + "name": "netCheckIntranetDomain", + "description[zh_CN]": "内网域名", + "description": "", + "permissions": "readwrite", + "visibility": "private" + } + } + } diff --git a/deepin-netcheck-plugin/icons/icons/dcc_net_check_96px.svg b/deepin-netcheck-plugin/icons/icons/dcc_net_check_96px.svg new file mode 100644 index 0000000..51546da --- /dev/null +++ b/deepin-netcheck-plugin/icons/icons/dcc_net_check_96px.svg @@ -0,0 +1,75 @@ + + + ICON/网络检测 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_login_tip_32px.svg b/deepin-netcheck-plugin/icons/icons/dcc_yellow_tip_32px.svg similarity index 100% rename from deepin-pc-manager/src/window/icons/icons/dcc_login_tip_32px.svg rename to deepin-netcheck-plugin/icons/icons/dcc_yellow_tip_32px.svg diff --git a/deepin-pc-manager/src/window/icons/icons/Network_in_the_diagnosis of_48px.svg b/deepin-netcheck-plugin/icons/icons/deepin-net-check.svg similarity index 100% rename from deepin-pc-manager/src/window/icons/icons/Network_in_the_diagnosis of_48px.svg rename to deepin-netcheck-plugin/icons/icons/deepin-net-check.svg diff --git a/deepin-netcheck-plugin/icons/netcheck_icons.qrc b/deepin-netcheck-plugin/icons/netcheck_icons.qrc new file mode 100644 index 0000000..2d969bd --- /dev/null +++ b/deepin-netcheck-plugin/icons/netcheck_icons.qrc @@ -0,0 +1,7 @@ + + + icons/deepin-net-check.svg + icons/dcc_yellow_tip_32px.svg + icons/dcc_net_check_96px.svg + + diff --git a/deepin-netcheck-plugin/invokers/dbusinvoker.cpp b/deepin-netcheck-plugin/invokers/dbusinvoker.cpp new file mode 100644 index 0000000..58219a5 --- /dev/null +++ b/deepin-netcheck-plugin/invokers/dbusinvoker.cpp @@ -0,0 +1,104 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "dbusinvoker.h" + +#include +#include + +DBusInvoker::DBusInvoker(const QString &service, + const QString &path, + const QString &interface, + ConnectType type, + QObject *parent) + : QObject(parent) + , m_service(service) + , m_path(path) + , m_interface(interface) + , m_type(type) + , m_connection(QDBusConnection::sessionBus()) +{ + if (SYSTEM == m_type) { + m_connection = QDBusConnection::systemBus(); + } +} + +// signal-slot connection +bool DBusInvoker::Connect(const QString &signal, QObject *reciver, const char *slot) +{ + bool connectRst = false; + connectRst = m_connection.connect(m_service, m_path, m_interface, signal, reciver, slot); + if (!connectRst) { + qCritical() << "signal connect failed : " << signal << "for reason [" + << m_connection.lastError().message() << "]"; + } + Q_ASSERT(connectRst); + return connectRst; +} + +// signal-slot disconnection +bool DBusInvoker::Disconnect(const QString &signal, QObject *reciver, const char *slot) +{ + bool disconnectRst = false; + disconnectRst = m_connection.disconnect(m_service, m_path, m_interface, signal, reciver, slot); + if (!disconnectRst) { + qCritical() << "signal disconnect failed : " << signal << "for reason [" + << m_connection.lastError().message() << "]"; + } + Q_ASSERT(disconnectRst); + return disconnectRst; +} + +DBusInvoker::~DBusInvoker() +{ + // 确保在调用delete时,释放自身成员对象 + deleteLater(); +} + +// create method call or signal emit +// invoke like this : +// invoker->Connect("signalFunc", this, SLOT(slotFunc(bool, QString))); +// there would be param type validate when signal emitted +QDBusMessage DBusInvoker::Invoke(const QString &name, + const QList &functionParams, + BlockMode mode) +{ + if (name.isEmpty()) { + return QDBusMessage::createError(QDBusError::InvalidArgs, QString("name.isEmpty")); + } + + QDBusMessage msg; + if (DBUS_PROPERTY_INVOKER_NAME == name) { + if (functionParams.isEmpty()) { + return QDBusMessage::createError(QDBusError::InvalidArgs, + QString("property not exist")); + } + + msg = QDBusMessage::createMethodCall(m_service, + m_path, + "org.freedesktop.DBus.Properties", + "Get"); + msg.setArguments({m_interface, functionParams.first().toString()}); + + QDBusMessage retMsg = m_connection.call(msg, QDBus::CallMode(mode)); + return retMsg; + } + + msg = QDBusMessage::createMethodCall(m_service, m_path, m_interface, name); + msg.setArguments(functionParams); + + return m_connection.call(msg, QDBus::CallMode(mode)); +} + +// emit signal +bool DBusInvoker::EmitSignal(const QString &name, const QList &arguments) +{ + if (name.isEmpty()) { + return false; + } + + QDBusMessage signal = QDBusMessage::createSignal(m_path, m_interface, name); + signal.setArguments(arguments); + return m_connection.send(signal); +} diff --git a/deepin-netcheck-plugin/invokers/dbusinvoker.h b/deepin-netcheck-plugin/invokers/dbusinvoker.h new file mode 100644 index 0000000..d1a8ab9 --- /dev/null +++ b/deepin-netcheck-plugin/invokers/dbusinvoker.h @@ -0,0 +1,48 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef DBUS_INVOKER_H +#define DBUS_INVOKER_H + +#include "invokerinterface.h" + +#include +#include + +// 公共dbus接口类 +#define DBUS_PROPERTY_INVOKER_NAME "dbusPropertyInvoker" // 公共dbus接口属性获取识别 +// interface +class DBusInvoker : public QObject + , public DBusInvokerInterface +{ + Q_OBJECT +public: + DBusInvoker(const QString &service, + const QString &path, + const QString &interface, + ConnectType type = ConnectType::SESSION, + QObject *parent = nullptr); + + virtual QDBusMessage Invoke(const QString &name, + const QList &functionParams = QList(), + BlockMode mode = BlockMode::BLOCKWITHGUI) override; + virtual bool EmitSignal(const QString &name, + const QList &arguments = QList()) override; + virtual bool Connect(const QString &signal, QObject *reciver, const char *slot) override; + virtual bool Disconnect(const QString &signal, QObject *reciver, const char *slot) override; + virtual ~DBusInvoker() override; + +private: + QString m_service; + QString m_path; + QString m_interface; + ConnectType m_type; + QDBusConnection m_connection; + +private: + DBusInvoker(const DBusInvoker &); + DBusInvoker &operator=(const DBusInvoker &); +}; + +#endif diff --git a/deepin-netcheck-plugin/invokers/invokerfactory.cpp b/deepin-netcheck-plugin/invokers/invokerfactory.cpp new file mode 100644 index 0000000..f0c0634 --- /dev/null +++ b/deepin-netcheck-plugin/invokers/invokerfactory.cpp @@ -0,0 +1,38 @@ +// Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "invokerfactory.h" + +#include "dbusinvoker.h" + +InvokerFactory::InvokerFactory() +{ +} + +InvokerFactory::~InvokerFactory() +{ +} + +DBusInvokerInterface *InvokerFactory::CreateInvoker(const QString &service, + const QString &path, + const QString &interface, + ConnectType type, + QObject *parent) +{ + return new DBusInvoker(service, path, interface, type, parent); +} + +// 单元测试扩展处理 +void InvokerFactory::setInvokerInteface(const QString &interfaceName, + DBusInvokerInterface *interface) +{ +#ifdef DEEPIN_DEFENDER_UNITTEST + // 不关心是否重复 + m_intefaceMap.insert(interfaceName, interface); +#else + Q_UNUSED(interfaceName); + Q_UNUSED(interface); +#endif +} diff --git a/deepin-netcheck-plugin/invokers/invokerfactory.h b/deepin-netcheck-plugin/invokers/invokerfactory.h new file mode 100644 index 0000000..2f25e78 --- /dev/null +++ b/deepin-netcheck-plugin/invokers/invokerfactory.h @@ -0,0 +1,52 @@ +// Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef DBUS_INVOKER_FACTORY +#define DBUS_INVOKER_FACTORY + +#include "invokerinterface.h" + +#include + +// 简化DBUS调用方法的写法 +#define DBUS_BLOCK_INVOKE(interface, funName, ...) \ + interface->Invoke(funName, {__VA_ARGS__}, BlockMode::BLOCK) +#define DBUS_INVOKE(interface, funName, ...) \ + interface->Invoke(funName, {__VA_ARGS__}, BlockMode::BLOCKWITHGUI) +#define DBUS_NOBLOCK_INVOKE(interface, funName, ...) \ + interface->Invoke(funName, {__VA_ARGS__}, BlockMode::NOBLOCK) +#define GET_MESSAGE_VALUE(type, output, message) type output = QDBusReply(message).value() + +// implement +class InvokerFactory : public QObject + , public InvokerFactoryInterface +{ + Q_OBJECT +public: + static InvokerFactory &GetInstance() + { + static InvokerFactory instance; + return instance; + } + + virtual DBusInvokerInterface *CreateInvoker(const QString &service, + const QString &path, + const QString &interface, + ConnectType type = ConnectType::SESSION, + QObject *parent = nullptr) override; + +public: + void setInvokerInteface(const QString &, DBusInvokerInterface *); + +private: + InvokerFactory(); + InvokerFactory(InvokerFactory &); + InvokerFactory &operator=(const InvokerFactory &); + ~InvokerFactory() override; + + QMap m_intefaceMap; +}; + +#endif diff --git a/deepin-netcheck-plugin/invokers/invokerinterface.h b/deepin-netcheck-plugin/invokers/invokerinterface.h new file mode 100644 index 0000000..4702801 --- /dev/null +++ b/deepin-netcheck-plugin/invokers/invokerinterface.h @@ -0,0 +1,50 @@ +// Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef DBUS_INVOKE_INTERFACE_H +#define DBUS_INVOKE_INTERFACE_H + +#include +#include +#include + +enum ConnectType { SYSTEM, + SESSION }; + +enum InvokeType { CALL, + SIGNAL }; + +enum BlockMode { NOBLOCK, + BLOCK, + BLOCKWITHGUI, + AUTODETECT }; + +// interface +class DBusInvokerInterface +{ +public: + virtual QDBusMessage Invoke(const QString &name, + const QList &functionParams = QList(), + BlockMode mode = BlockMode::BLOCKWITHGUI) = 0; + virtual bool EmitSignal(const QString &name, + const QList &arguments = QList()) = 0; + virtual bool Connect(const QString &signal, QObject *reciver, const char *slot) = 0; + virtual bool Disconnect(const QString &signal, QObject *reciver, const char *slot) = 0; + + virtual ~DBusInvokerInterface() {} +}; + +class InvokerFactoryInterface +{ +public: + virtual DBusInvokerInterface *CreateInvoker(const QString &service, + const QString &path, + const QString &interface, + ConnectType type = ConnectType::SESSION, + QObject *parent = nullptr) = 0; + virtual ~InvokerFactoryInterface() {} +}; + +#endif diff --git a/deepin-netcheck-plugin/netcheck_settings.json b/deepin-netcheck-plugin/netcheck_settings.json new file mode 100644 index 0000000..dbc6b7b --- /dev/null +++ b/deepin-netcheck-plugin/netcheck_settings.json @@ -0,0 +1,3 @@ +{ + "api" : "1.0.0" +} \ No newline at end of file diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/netcheckdialog/netcheckitem.cpp b/deepin-netcheck-plugin/netcheckitem.cpp similarity index 96% rename from deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/netcheckdialog/netcheckitem.cpp rename to deepin-netcheck-plugin/netcheckitem.cpp index af61dd6..f7ae4a5 100644 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/netcheckdialog/netcheckitem.cpp +++ b/deepin-netcheck-plugin/netcheckitem.cpp @@ -1,4 +1,3 @@ -// Copyright (C) 2019 ~ 2023 Deepin Technology Co., Ltd. // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -14,7 +13,7 @@ NetCheckItem::NetCheckItem(QString title, QWidget *parent) , m_tipTitle(nullptr) , m_spinner(nullptr) { - setFixedSize(QSize(680, 48)); + setFixedSize(QSize(900, 48)); setLineWidth(0); setBackgroundRole(DPalette::ItemBackground); diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/netcheckdialog/netcheckitem.h b/deepin-netcheck-plugin/netcheckitem.h similarity index 92% rename from deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/netcheckdialog/netcheckitem.h rename to deepin-netcheck-plugin/netcheckitem.h index 007d9a5..19593ad 100644 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/netcheckdialog/netcheckitem.h +++ b/deepin-netcheck-plugin/netcheckitem.h @@ -1,4 +1,3 @@ -// Copyright (C) 2019 ~ 2023 Deepin Technology Co., Ltd. // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/netcheckdialog/netcheckmodel.cpp b/deepin-netcheck-plugin/netcheckmodel.cpp similarity index 82% rename from deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/netcheckdialog/netcheckmodel.cpp rename to deepin-netcheck-plugin/netcheckmodel.cpp index 8086bd6..b8d576f 100644 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/netcheckdialog/netcheckmodel.cpp +++ b/deepin-netcheck-plugin/netcheckmodel.cpp @@ -1,21 +1,29 @@ -// Copyright (C) 2022 ~ 2023 UnionTech Software Technology Co., Ltd. // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later #include "netcheckmodel.h" -#include "window/modules/common/common.h" -#include "window/modules/common/gsettingkey.h" -#include "window/modules/common/invokers/invokerfactory.h" +#include "invokers/dbusinvoker.h" +#include "invokers/invokerfactory.h" + +// 检查并转换QDbusVariant为QVariant +QVariant checkAndTransQDbusVarIntoQVar(const QVariant &var) +{ + QDBusVariant qdbusVar = var.value(); + QVariant retVar = qdbusVar.variant(); + if (!retVar.isNull()) { + return retVar; + } + return var; +} NetCheckModel::NetCheckModel(QObject *parent) : QObject(parent) + , m_dconfig(nullptr) , m_netCheckDBusInvokerInter(nullptr) , m_netWorkDBusInvokerInter(nullptr) - , m_gsetting(nullptr) { - // 初始化安全中心gsetting配置 - m_gsetting = InvokerFactory::GetInstance().CreateSettings(DEEPIN_PC_MANAGER_GSETTING_PATH, QByteArray(), this); + m_dconfig = DConfig::create("org.deepin.dde.deepin-netcheck", "org.deepin.dde.deepin-netcheck"); m_netCheckDBusInvokerInter = InvokerFactory::GetInstance().CreateInvoker("com.deepin.pc.manager.netcheck", "/com/deepin/pc/manager/netcheck", @@ -43,32 +51,45 @@ void NetCheckModel::initData() { } -void NetCheckModel::startNetCheck(QString domainText) -{ - Q_EMIT sendNetCheckStatus(true); - m_domainText = domainText; - Q_EMIT notifyNetCheckReset(); - - startCheckNetDevice(); -} - // 获取/设置网络检测类型和内网域名/ip int NetCheckModel::getNetCheckType() { - return m_gsetting->GetValue(NET_CHECK_TYPE).toInt(); + int type = 0; + if (m_dconfig->isValid()) { + type = m_dconfig->value("netCheckType").toInt(); + } + return type; } void NetCheckModel::setNetCheckType(int type) { - m_gsetting->SetValue(NET_CHECK_TYPE, type); + if (m_dconfig->isValid()) { + m_dconfig->setValue("netCheckType", type); + } } QString NetCheckModel::getNetCheckIntranet() { - return m_gsetting->GetValue(NET_CHECK_INTRANET_DOMAIN).toString(); + QString domain; + if (m_dconfig->isValid()) { + domain = m_dconfig->value("netCheckIntranetDomain").toString(); + } + + return domain; } void NetCheckModel::setNetCheckIntranet(QString domain) { - m_gsetting->SetValue(NET_CHECK_INTRANET_DOMAIN, domain); + if (m_dconfig->isValid()) { + m_dconfig->setValue("netCheckIntranetDomain", domain); + } +} + +void NetCheckModel::startNetCheck(QString domainText) +{ + Q_EMIT sendNetCheckStatus(true); + m_domainText = domainText; + Q_EMIT notifyNetCheckReset(); + + startCheckNetDevice(); } // 开始检测网络设备 @@ -139,7 +160,7 @@ bool NetCheckModel::checkVPNOrProxyOpen() bool flag = false; QDBusMessage msgVPN = DBUS_BLOCK_INVOKE(m_netWorkDBusInvokerInter, DBUS_PROPERTY_INVOKER_NAME, "VpnEnabled"); - QVariant varVPN = Utils::checkAndTransQDbusVarIntoQVar(msgVPN.arguments().first()); + QVariant varVPN = checkAndTransQDbusVarIntoQVar(msgVPN.arguments().first()); if (varVPN.toBool()) { flag = true; } diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/netcheckdialog/netcheckmodel.h b/deepin-netcheck-plugin/netcheckmodel.h similarity index 74% rename from deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/netcheckdialog/netcheckmodel.h rename to deepin-netcheck-plugin/netcheckmodel.h index a918ff6..ac0924a 100644 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/netcheckdialog/netcheckmodel.h +++ b/deepin-netcheck-plugin/netcheckmodel.h @@ -1,14 +1,55 @@ -// Copyright (C) 2022 ~ 2023 UnionTech Software Technology Co., Ltd. // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later #pragma once +#include + #include +// 硬件检测结果 +enum ServiceResult { + ServiceBlock = 0, + NoFound, + CheckSucessed +}; + +// 网络设置检测结果 +enum NetSettingResult { + NoNetConn = 0, + NetSettingSkip, + NetSettingCheckFailed, + NetSettingCheckSucessed +}; + +// DHCP检测结果 +enum DHCPResult { + DHCPCheckFailed = 0, + DHCPCheckSucessed +}; + +// DNS检测结果 +enum DNSResult { + DNSCheckError = 0, + DNSCheckAbnormal, + DNSCheckSucessed +}; + +// host检测结果 +enum HostResult { + HostCheckFailed = 0, + HostCheckSucessed +}; + +// 网络连接访问结果 +enum NetConnResult { + NetConnFailed = 0, + NetConnSucessed +}; + +DCORE_USE_NAMESPACE class DBusInvokerInterface; -class SettingsInvokerInterface; class NetCheckModel : public QObject { Q_OBJECT @@ -16,16 +57,16 @@ class NetCheckModel : public QObject explicit NetCheckModel(QObject *parent = nullptr); ~NetCheckModel(); - // 初始化数据 - void initData(); - void startNetCheck(QString domainText); - // 获取/设置网络检测类型和内网域名/ip int getNetCheckType(); void setNetCheckType(int type); QString getNetCheckIntranet(); void setNetCheckIntranet(QString domain); + // 初始化数据 + void initData(); + void startNetCheck(QString domainText); + // 开始检测网络设备 void startCheckNetDevice(); // 开始检测网络设置 @@ -69,8 +110,8 @@ public Q_SLOTS: void sendNetCheckStatus(bool status); private: + DConfig *m_dconfig; DBusInvokerInterface *m_netCheckDBusInvokerInter; DBusInvokerInterface *m_netWorkDBusInvokerInter; - SettingsInvokerInterface *m_gsetting; // 安全中心gsetting配置 QString m_domainText; }; diff --git a/deepin-netcheck-plugin/netcheckmodule.cpp b/deepin-netcheck-plugin/netcheckmodule.cpp new file mode 100644 index 0000000..2a70f2a --- /dev/null +++ b/deepin-netcheck-plugin/netcheckmodule.cpp @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "netcheckmodule.h" +#include "netcheckwidget.h" + +#include + +#include +#include + +DWIDGET_USE_NAMESPACE +DCORE_USE_NAMESPACE +NetCheckModule::NetCheckModule() + : QObject() + , ToolBoxInterface() + , m_netCheckModel(nullptr) + , m_moduleWidget(nullptr) +{ + QTranslator *translator = new QTranslator(this); + translator->load(QString("/usr/share/deepin-netcheck/translations/deepin-netcheck_%1.qm").arg(QLocale::system().name())); + QCoreApplication::installTranslator(translator); +} + +NetCheckModule::~NetCheckModule() +{ +} + +void NetCheckModule::active() +{ + if (!m_netCheckModel) { + m_netCheckModel = new NetCheckModel; + } + if (!m_moduleWidget) { + m_moduleWidget = new NetCheckWidget(m_netCheckModel); + } + + m_frameProxy->pushWidget(this, m_moduleWidget); + m_moduleWidget->setVisible(true); +} + +const QString NetCheckModule::name() const +{ + return "DEEPINNETCHECK"; +} +const QString NetCheckModule::apptitle() const +{ + return tr("Network Detection"); +} +const QString NetCheckModule::apptip() const +{ + return tr("Quickly detect network anomaly causes"); +} +const QString NetCheckModule::appsupporter() const +{ + return tr("Supported by UOS"); +} +const QString NetCheckModule::icon() const +{ + return "deepin-net-check"; +} + +int NetCheckModule::apptype() const +{ + return ToolBoxProxyInterface::Network; +} + +bool NetCheckModule::enable() const +{ + return true; +} + +bool NetCheckModule::checkauth() const +{ + return false; +} diff --git a/deepin-netcheck-plugin/netcheckmodule.h b/deepin-netcheck-plugin/netcheckmodule.h new file mode 100644 index 0000000..072b90a --- /dev/null +++ b/deepin-netcheck-plugin/netcheckmodule.h @@ -0,0 +1,54 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include +#include +#include + +#include "interface/toolboxinterface.h" +#include "interface/toolboxproxyinterface.h" + +namespace PCC_NAMESPACE { +class ToolBoxInterface; +class ToolBoxProxyInterface; +} // namespace PCC_NAMESPACE + +using namespace PCC_NAMESPACE; + +class NetCheckWidget; +class NetCheckModel; +class NetCheckModule : public QObject + , public ToolBoxInterface +{ + Q_OBJECT + + Q_PLUGIN_METADATA(IID ToolBoxInterface_iid FILE "netcheck_settings.json") + Q_INTERFACES(PCC_NAMESPACE::ToolBoxInterface) + +public: + explicit NetCheckModule(); + + ~NetCheckModule() Q_DECL_OVERRIDE; + + const QString name() const Q_DECL_OVERRIDE; + const QString apptitle() const Q_DECL_OVERRIDE; + const QString apptip() const Q_DECL_OVERRIDE; + const QString appsupporter() const Q_DECL_OVERRIDE; + const QString icon() const Q_DECL_OVERRIDE; + int apptype() const Q_DECL_OVERRIDE; + bool enable() const Q_DECL_OVERRIDE; + bool checkauth() const Q_DECL_OVERRIDE; + +private: + void onStatusChanged(); + +public Q_SLOTS: + void active() Q_DECL_OVERRIDE; + +private: + NetCheckModel *m_netCheckModel; + NetCheckWidget *m_moduleWidget; +}; diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/netcheckdialog/netcheckwidget.cpp b/deepin-netcheck-plugin/netcheckwidget.cpp similarity index 96% rename from deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/netcheckdialog/netcheckwidget.cpp rename to deepin-netcheck-plugin/netcheckwidget.cpp index 0727741..1df48d0 100644 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/netcheckdialog/netcheckwidget.cpp +++ b/deepin-netcheck-plugin/netcheckwidget.cpp @@ -1,11 +1,8 @@ -// Copyright (C) 2023 ~ 2023 Deepin Technology Co., Ltd. // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later #include "netcheckwidget.h" -#include "window/modules/common/common.h" -#include "window/modules/common/compixmap.h" #include "netcheckitem.h" #include @@ -254,7 +251,7 @@ QWidget *NetCheckWidget::loadNetConnCheckUI() QLabel *m_netCheckIcon = new QLabel(this); m_netCheckIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); m_netCheckIcon->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); - m_netCheckIcon->setPixmap(QIcon::fromTheme(FILE_NET_CHECK_ICON).pixmap(96, 96)); + m_netCheckIcon->setPixmap(QIcon::fromTheme("dcc_net_check").pixmap(96, 96)); netCheckInfoLayout->addWidget(m_netCheckIcon); // 网络检测信息 - 子布局 QVBoxLayout *netcheckTimeLayout = new QVBoxLayout; @@ -287,7 +284,7 @@ QWidget *NetCheckWidget::loadNetConnCheckUI() // 分割线 QFrame *line = new QFrame(); - line->setFixedWidth(660); + line->setFixedWidth(900); line->setFrameShape(QFrame::HLine); line->setFrameShadow(QFrame::Sunken); widgetLayout->addWidget(line, 0, Qt::AlignHCenter); @@ -366,7 +363,7 @@ void NetCheckWidget::checkNetConnect() if (m_model->getNetCheckStatus()) { DFloatingMessage *floMsgSwitchOff = new DFloatingMessage(DFloatingMessage::TransientType); floMsgSwitchOff->setDuration(3000); - floMsgSwitchOff->setIcon(QIcon::fromTheme(DIALOG_TIP_YELLOW)); + floMsgSwitchOff->setIcon(QIcon::fromTheme("dcc_yellow_tip")); floMsgSwitchOff->setMessage(tr("Due to abnormal application exit, services need initialization, please wait.")); DMessageManager::instance()->sendMessage(this->parentWidget()->parentWidget(), floMsgSwitchOff); DMessageManager::instance()->setContentMargens(this, QMargins(0, 0, 0, 10)); @@ -603,23 +600,3 @@ void NetCheckWidget::finishNetCheck() m_netSettingwidget->setVisible(true); m_netCheckwidget->setVisible(false); } - -NetCheckMainWindow::NetCheckMainWindow(QWidget *pParent) - : DefSecurityToolsMnd(pParent) - , m_pNetCheckWidget(nullptr) -{ - NetCheckModel *pNetCheckModel = new NetCheckModel(this); - m_pNetCheckWidget = new NetCheckWidget(pNetCheckModel); - addContent(m_pNetCheckWidget); - setFixedSize(960, 640); -} - -NetCheckMainWindow::~NetCheckMainWindow() -{ -} - -void NetCheckMainWindow::closeEvent(QCloseEvent *event) -{ - Q_EMIT sendWindowClose(); - event->accept(); -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/netcheckdialog/netcheckwidget.h b/deepin-netcheck-plugin/netcheckwidget.h similarity index 84% rename from deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/netcheckdialog/netcheckwidget.h rename to deepin-netcheck-plugin/netcheckwidget.h index 64eca3f..d8cc479 100644 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/netcheckdialog/netcheckwidget.h +++ b/deepin-netcheck-plugin/netcheckwidget.h @@ -1,4 +1,3 @@ -// Copyright (C) 2023 ~ 2023 Deepin Technology Co., Ltd. // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -6,7 +5,6 @@ #pragma once #include "netcheckmodel.h" -#include "../defsecuritytoolsmnd.h" #include #include @@ -94,20 +92,3 @@ public Q_SLOTS: bool m_checkingFlag; bool m_checkInfoErrorFlag; }; - -class NetCheckMainWindow : public DefSecurityToolsMnd -{ - Q_OBJECT -public: - explicit NetCheckMainWindow(QWidget *pParent = nullptr); - ~NetCheckMainWindow() override; - -protected: - void closeEvent(QCloseEvent *event) override; - -Q_SIGNALS: - void sendWindowClose(); - -private: - NetCheckWidget *m_pNetCheckWidget; -}; diff --git a/deepin-netcheck-plugin/translate_generation.sh b/deepin-netcheck-plugin/translate_generation.sh new file mode 100644 index 0000000..6b67c53 --- /dev/null +++ b/deepin-netcheck-plugin/translate_generation.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +# +# SPDX-License-Identifier: GPL-3.0-or-later + +# this file is used to auto-generate .qm file from .ts file. +# author: shibowen at linuxdeepin.com + +ts_list=($(ls translations/*.ts)) + +for ts in "${ts_list[@]}"; do + printf "\nprocess ${ts}\n" + lrelease "${ts}" +done diff --git a/deepin-netcheck-plugin/translations/deepin-netcheck_en_US.ts b/deepin-netcheck-plugin/translations/deepin-netcheck_en_US.ts new file mode 100644 index 0000000..f8951b6 --- /dev/null +++ b/deepin-netcheck-plugin/translations/deepin-netcheck_en_US.ts @@ -0,0 +1,259 @@ + + + + + NetCheckItem + + + Awaiting detection + + + + + Detecting... + + + + + NetCheckModule + + + Network Detection + + + + + Quickly detect network anomaly causes + + + + + Supported by UOS + + + + + NetCheckWidget + + + Network Detection + + + + + One-click detection, comprehensive network troubleshooting + + + + + Network Environment Configuration + + + + + Network Environment + + + + + Public Network + + + + + Intranet + + + + + Intranet IP/Domain + + + + + Example: 127.0.0.1 or www.uniontech.com + + + + + Detect Now + + + + + + Network detecting, please wait + + + + + Detection Time + + + + + Network Device Detection + + + + + Network Settings Detection + + + + + DHCP service + + + + + DNS service + + + + + host file configuration + + + + + Network accessibility + + + + + Cancel detection + + + + + Retry + + + + + Done + + + + + Due to abnormal application exit, services need initialization, please wait. + + + + + Intranet IP/Domain cannot be empty + + + + + Network device detected normal + + + + + Network device disabled + + + + + No valid network device detected + + + + + + + + + + + + + Not Detected + + + + + + + Abnormalities exist, please fix and retry + + + + + Not connected to any network + + + + + IP auto configuration, skip detection + + + + + IP manual configuration, network settings abnormal + + + + + IP manual configuration, network settings normal + + + + + DHCP service abnormal + + + + + DHCP service normal + + + + + DNS server unreachable + + + + + DNS server resolution abnormal + + + + + DNS service normal + + + + + host file format error + + + + + host file configuration normal + + + + + Network access normal + + + + + Network access abnormal, please disable system proxy or VPN and retry + + + + + Network access abnormal + + + + + Detection completed, network normal + + + + diff --git a/deepin-netcheck-plugin/translations/deepin-netcheck_zh_CN.ts b/deepin-netcheck-plugin/translations/deepin-netcheck_zh_CN.ts new file mode 100644 index 0000000..3ce999b --- /dev/null +++ b/deepin-netcheck-plugin/translations/deepin-netcheck_zh_CN.ts @@ -0,0 +1,259 @@ + + + + + NetCheckItem + + + Awaiting detection + 等待检测 + + + + Detecting... + 正在检测... + + + + NetCheckModule + + + Network Detection + 网络检测 + + + + Quickly detect network anomaly causes + 快速检测网络异常原因 + + + + Supported by UOS + 由UOS提供服务 + + + + NetCheckWidget + + + Network Detection + 网络检测 + + + + One-click detection, comprehensive network troubleshooting + 快速检测网络异常原因 + + + + Network Environment Configuration + 网络环境配置 + + + + Network Environment + 网络环境 + + + + Public Network + 公网 + + + + Intranet + 内网 + + + + Intranet IP/Domain + 内网IP/域名 + + + + Example: 127.0.0.1 or www.uniontech.com + 示例:127.0.0.1或www.uniontech.com + + + + Detect Now + 立即检测 + + + + + Network detecting, please wait + 网络检测中,请稍等 + + + + Detection Time + 检测用时 + + + + Network Device Detection + 网络设备检测 + + + + Network Settings Detection + 网络设置检测 + + + + DHCP service + DHCP服务 + + + + DNS service + DNS服务 + + + + host file configuration + host文件配置 + + + + Network accessibility + 能否访问网络 + + + + Cancel detection + 取消检测 + + + + Retry + 重新检测 + + + + Done + 完成 + + + + Due to abnormal application exit, services need initialization, please wait. + 由于应用异常退出,服务需初始化,请稍等。 + + + + Intranet IP/Domain cannot be empty + 内网IP/域名不能为空 + + + + Network device detected normal + 网络设备检测正常 + + + + Network device disabled + 网络设备被禁用 + + + + No valid network device detected + 未检测到有效的网络设备 + + + + + + + + + + + + Not Detected + 未检测 + + + + + + Abnormalities exist, please fix and retry + 存在异常,请修复后重新检测 + + + + Not connected to any network + 未连接任何网络 + + + + IP auto configuration, skip detection + IP自动配置,跳过检测 + + + + IP manual configuration, network settings abnormal + IP手动配置,网络设置异常 + + + + IP manual configuration, network settings normal + IP手动配置,网络设置正常 + + + + DHCP service abnormal + DHCP服务异常 + + + + DHCP service normal + DHCP服务正常 + + + + DNS server unreachable + DNS服务器无法访问 + + + + DNS server resolution abnormal + DNS服务器解析异常 + + + + DNS service normal + DNS服务正常 + + + + host file format error + host文件格式错误 + + + + host file configuration normal + host文件配置正常 + + + + Network access normal + 网络访问正常 + + + + Network access abnormal, please disable system proxy or VPN and retry + 网络访问异常,请关闭系统代理或VPN后重新检测 + + + + Network access abnormal + 网络访问异常 + + + + Detection completed, network normal + 检测完成,网络无异常 + + + diff --git a/deepin-pc-manager-server/CMakeLists.txt b/deepin-pc-manager-server/CMakeLists.txt index 31c90ba..c08ef77 100644 --- a/deepin-pc-manager-server/CMakeLists.txt +++ b/deepin-pc-manager-server/CMakeLists.txt @@ -1,6 +1 @@ -# SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -# -# SPDX-License-Identifier: GPL-3.0-or-later - -add_subdirectory(deepin-pc-manager-session-daemon) add_subdirectory(deepin-pc-manager-system-daemon) diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/CMakeLists.txt b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/CMakeLists.txt deleted file mode 100644 index 773de24..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/CMakeLists.txt +++ /dev/null @@ -1,91 +0,0 @@ -# SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -# -# SPDX-License-Identifier: GPL-3.0-or-later - -set(BIN_NAME deepin-pc-manager-session-daemon) - -# 设置包含当前目录,建议头文件的包含写全路径 -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -# 若目标库安装了.cmake文件,则可以直接使用find_package -find_package(PkgConfig REQUIRED) -# 若目标库未安装.cmake文件,但是安装了.pc文件,则可以使用pkgconfig -pkg_check_modules(GSettings REQUIRED IMPORTED_TARGET gsettings-qt) -pkg_check_modules(PolkitQt REQUIRED IMPORTED_TARGET polkit-qt5-1) - -find_package(QT NAMES Qt5 REQUIRED COMPONENTS Core) -find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Sql Gui Widgets DBus Concurrent) -find_package(Dtk REQUIRED COMPONENTS Widget) - -if (NOT (${CMAKE_BUILD_TYPE} STREQUAL "Debug")) - execute_process(COMMAND bash "translate_generation.sh" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - ) - - file(GLOB APP_QM_FILES "translations/*.qm") - install(FILES ${APP_QM_FILES} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${BIN_NAME}/translations) -endif() - -# 建议对不同的模块进行分类,可使用通配符,可指定具名文件 -file(GLOB_RECURSE SRCS - "accessible/*.h" - "accessible/*.cpp" - "widgets/*.h" - "widgets/*.cpp" - "window/*.h" - "window/*.cpp" - "window/modules/common/aes/aes.c" - "../../deepin-pc-manager/src/window/*.cpp" - "../../deepin-pc-manager/src/window/*.h" - "../../deepin-pc-manager/src/widgets/*.cpp" - "../../deepin-pc-manager/src/widgets/*.h" - "common.h" - "main.cpp" - "operatedbusdata.cpp" - "operatedbusdata.h" - "daemon_adaptor.cpp" - "daemon_adaptor.h" -) - -# 生成可执行文件 -add_executable(${BIN_NAME} - ${SRCS} -) - -# 这里针对当前二进制定义了一个宏,保存着版本号,方便程序代码中调用,若程序中需要自定义宏变量并且在代码中使用,可参考此方法。 -# 注意CMAKE_PROJECT_XXX系列变量,某些属性是cmake帮助提供,但某些属性是project方法设置的,所以这里需要注意变量是否可用。 -# 至于是使用add_compile_xxx还是target_compile_xxx,视情况而定,一个是指定所有对象,一个是指定具体的二进制 -# target_compile_definitions(${BIN_NAME} PRIVATE -# VERSION="${CMAKE_PROJECT_VERSION}" -# ) - -# Qt 从5.15版本开始,可以直接使用Qt::Core,而不需要加版本号,但为了兼容性,把版本号加上为好 -target_include_directories(${BIN_NAME} PUBLIC - Qt${QT_VERSION_MAJOR}::Core - Qt${QT_VERSION_MAJOR}::Sql - Qt${QT_VERSION_MAJOR}::Gui - Qt${QT_VERSION_MAJOR}::Widgets - Qt${QT_VERSION_MAJOR}::Concurrent - Dtk::Widget - PkgConfig::GSettings - PkgConfig::PolkitQt - ../../deepin-pc-manager/ - ../../deepin-pc-manager/src/ -) - -target_link_libraries(${BIN_NAME} PRIVATE - Qt${QT_VERSION_MAJOR}::Core - Qt${QT_VERSION_MAJOR}::Sql - Qt${QT_VERSION_MAJOR}::Gui - Qt${QT_VERSION_MAJOR}::Widgets - Qt${QT_VERSION_MAJOR}::Concurrent - Dtk::Widget - PkgConfig::GSettings - PkgConfig::PolkitQt -) - -# 指定安装目录,一般常用有3个: TARGETS(编译出来的目标二进制)、FILES(指定路径的文件,通常是配置文件或服务文件)、DIRECTORY(一般是配置文件较多时使用)。 -install(TARGETS ${BIN_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) - -install(FILES com.deepin.pc.manager.session.daemon.service DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/dbus-1/services) -install(FILES window/modules/config/securitytooldialog/com.deepin.pc.manager.securitytooldialog.service DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/dbus-1/services) diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/accessible/appaccessible.h b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/accessible/appaccessible.h deleted file mode 100644 index da2f25a..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/accessible/appaccessible.h +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (C) 2020 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef APPACCESSIBLE_H -#define APPACCESSIBLE_H - -#include "appaccessiblebutton.h" -#include "appaccessiblelabel.h" -#include "appaccessibleqabstrractbutton.h" - -#endif // APPACCESSIBLE_H diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/accessible/appaccessiblebase.cpp b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/accessible/appaccessiblebase.cpp deleted file mode 100644 index e64b117..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/accessible/appaccessiblebase.cpp +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (C) 2020 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "appaccessiblebase.h" - -AppAccessibleBase::AppAccessibleBase(QWidget *widget) - : QAccessibleWidget(widget) - , m_widget(widget) -{ -} - -void *AppAccessibleBase::interface_cast(QAccessible::InterfaceType t) -{ - switch (t) { - case QAccessible::ActionInterface: - return static_cast(this); - case QAccessible::TextInterface: - return static_cast(this); - default: - return nullptr; - } -} - -QString AppAccessibleBase::text(QAccessible::Text text) const -{ - if (!m_widget) { - return QString(); - } - - switch (text) { - case QAccessible::Name: - return m_widget->accessibleName(); - case QAccessible::Description: - return m_widget->accessibleDescription(); - default: - return QString(); - } -} - -QString AppAccessibleBase::text(int startOffset, int endOffset) const -{ - Q_UNUSED(startOffset); - Q_UNUSED(endOffset); - - return QString(); -} - -void AppAccessibleBase::selection(int selectionIndex, int *startOffset, int *endOffset) const -{ - Q_UNUSED(selectionIndex) - Q_UNUSED(startOffset) - Q_UNUSED(endOffset) - - return; -} - -int AppAccessibleBase::selectionCount() const -{ - return 0; -} - -void AppAccessibleBase::addSelection(int startOffset, int endOffset) -{ - Q_UNUSED(startOffset) - Q_UNUSED(endOffset) - - return; -} - -void AppAccessibleBase::removeSelection(int selectionIndex) -{ - Q_UNUSED(selectionIndex) - - return; -} - -void AppAccessibleBase::setSelection(int selectionIndex, int startOffset, int endOffset) -{ - Q_UNUSED(selectionIndex) - Q_UNUSED(startOffset) - Q_UNUSED(endOffset) - - return; -} - -int AppAccessibleBase::cursorPosition() const -{ - return 0; -} - -void AppAccessibleBase::setCursorPosition(int position) -{ - Q_UNUSED(position) -} - -int AppAccessibleBase::characterCount() const -{ - return 0; -} - -QRect AppAccessibleBase::characterRect(int offset) const -{ - Q_UNUSED(offset) - - return QRect(); -} - -int AppAccessibleBase::offsetAtPoint(const QPoint &point) const -{ - Q_UNUSED(point) - - return 0; -} - -void AppAccessibleBase::scrollToSubstring(int startIndex, int endIndex) -{ - Q_UNUSED(startIndex) - Q_UNUSED(endIndex) - - return; -} - -QString AppAccessibleBase::attributes(int offset, int *startOffset, int *endOffset) const -{ - Q_UNUSED(offset) - Q_UNUSED(startOffset) - Q_UNUSED(endOffset) - - return QString(); -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/accessible/appaccessiblebase.h b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/accessible/appaccessiblebase.h deleted file mode 100644 index 7766a86..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/accessible/appaccessiblebase.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (C) 2020 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef APPACCESSIBLEBASE_H -#define APPACCESSIBLEBASE_H - -#include -#include -#include - -class AppAccessibleBase : public QAccessibleWidget - , public QAccessibleTextInterface -{ -public: - explicit AppAccessibleBase(QWidget *); - virtual ~AppAccessibleBase() Q_DECL_OVERRIDE {} - - // 满足接口需要实现的无关方法 - void *interface_cast(QAccessible::InterfaceType t) Q_DECL_OVERRIDE; - QString text(QAccessible::Text t) const Q_DECL_OVERRIDE; - void selection(int selectionIndex, int *startOffset, int *endOffset) const Q_DECL_OVERRIDE; - int selectionCount() const Q_DECL_OVERRIDE; - void addSelection(int startOffset, int endOffset) Q_DECL_OVERRIDE; - void removeSelection(int selectionIndex) Q_DECL_OVERRIDE; - void setSelection(int selectionIndex, int startOffset, int endOffset) Q_DECL_OVERRIDE; - int cursorPosition() const Q_DECL_OVERRIDE; - void setCursorPosition(int position) Q_DECL_OVERRIDE; - int characterCount() const Q_DECL_OVERRIDE; - QRect characterRect(int offset) const Q_DECL_OVERRIDE; - int offsetAtPoint(const QPoint &point) const Q_DECL_OVERRIDE; - void scrollToSubstring(int startIndex, int endIndex) Q_DECL_OVERRIDE; - QString attributes(int offset, int *startOffset, int *endOffset) const Q_DECL_OVERRIDE; - - // 与自动化测试实现相关处 - // 此处依旧是虚方法以方便继承 - // 因为QWidget没有text()方法,必须在子类中使用控件的text()方法 - virtual QString text(int startOffset, int endOffset) const Q_DECL_OVERRIDE; - -private: - QWidget *m_widget; -}; - -#endif // APPACCESSIBLEBASE_H diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/accessible/appaccessiblebutton.cpp b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/accessible/appaccessiblebutton.cpp deleted file mode 100644 index 3960a35..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/accessible/appaccessiblebutton.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2020 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "appaccessiblebutton.h" - -AppAccessibleButton::AppAccessibleButton(QPushButton *btn) - : AppAccessibleBase(btn) - , m_widget(btn) -{ -} - -QString AppAccessibleButton::text(int startOffset, int endOffset) const -{ - Q_UNUSED(startOffset); - Q_UNUSED(endOffset); - - if (m_widget) { - return m_widget->text(); - } - - return QString(); -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/accessible/appaccessiblebutton.h b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/accessible/appaccessiblebutton.h deleted file mode 100644 index 5bdaabf..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/accessible/appaccessiblebutton.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2020 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef APPACCESSIBLEBUTTON_H -#define APPACCESSIBLEBUTTON_H - -#include "appaccessiblebase.h" - -// 不要使用前置声明,被构造时需要做类型转换 -#include - -class AppAccessibleButton : public AppAccessibleBase -{ -public: - explicit AppAccessibleButton(QPushButton *); - virtual QString text(int startOffset, int endOffset) const Q_DECL_OVERRIDE; - -private: - QPushButton *m_widget; -}; - -#endif // APPACCESSIBLEBUTTON_H diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/accessible/appaccessiblelabel.cpp b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/accessible/appaccessiblelabel.cpp deleted file mode 100644 index af6137f..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/accessible/appaccessiblelabel.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2020 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "appaccessiblelabel.h" - -AppAccessibleLabel::AppAccessibleLabel(QLabel *label) - : AppAccessibleBase(label) - , m_widget(label) -{ -} - -QString AppAccessibleLabel::text(int startOffset, int endOffset) const -{ - Q_UNUSED(startOffset); - Q_UNUSED(endOffset); - - if (m_widget) { - return m_widget->text(); - } - - return QString(); -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/accessible/appaccessiblelabel.h b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/accessible/appaccessiblelabel.h deleted file mode 100644 index 3055baa..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/accessible/appaccessiblelabel.h +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2020 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef APPACCESSIBLELABEL_H -#define APPACCESSIBLELABEL_H - -#include "appaccessiblebase.h" - -#include - -class AppAccessibleLabel : public AppAccessibleBase -{ -public: - explicit AppAccessibleLabel(QLabel *); - virtual QString text(int startOffset, int endOffset) const Q_DECL_OVERRIDE; - -private: - QLabel *m_widget; -}; - -#endif // APPACCESSIBLELABEL_H diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/accessible/appaccessibleqabstractbutton.cpp b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/accessible/appaccessibleqabstractbutton.cpp deleted file mode 100644 index 7730686..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/accessible/appaccessibleqabstractbutton.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2020 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "appaccessibleqabstrractbutton.h" - -AppAccessibleQAbstractButton::AppAccessibleQAbstractButton(QAbstractButton *btn) - : AppAccessibleBase(btn) - , m_widget(btn) -{ -} - -QString AppAccessibleQAbstractButton::text(int startOffset, int endOffset) const -{ - Q_UNUSED(startOffset); - Q_UNUSED(endOffset); - - if (m_widget) { - return m_widget->text(); - } - - return QString(); -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/accessible/appaccessibleqabstrractbutton.h b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/accessible/appaccessibleqabstrractbutton.h deleted file mode 100644 index 5bbb2ca..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/accessible/appaccessibleqabstrractbutton.h +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2020 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef APPACCESSIBLEDCOMMANDLINKBUTTON_H -#define APPACCESSIBLEDCOMMANDLINKBUTTON_H - -#include "appaccessiblebase.h" -#include - -class AppAccessibleQAbstractButton : public AppAccessibleBase -{ -public: - explicit AppAccessibleQAbstractButton(QAbstractButton *); - virtual QString text(int startOffset, int endOffset) const Q_DECL_OVERRIDE; - -private: - QAbstractButton *m_widget; -}; - -#endif // APPACCESSIBLEDCOMMANDLINKBUTTON_H diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/com.deepin.pc.manager.session.daemon.service b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/com.deepin.pc.manager.session.daemon.service deleted file mode 100644 index 655194b..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/com.deepin.pc.manager.session.daemon.service +++ /dev/null @@ -1,3 +0,0 @@ -[D-BUS Service] -Name=com.deepin.pc.manager.session.daemon -Exec=/usr/bin/deepin-pc-manager-session-daemon diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/common.h b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/common.h deleted file mode 100644 index 2ce1029..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/common.h +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include -#include - -const QString service = "com.deepin.pc.manager.session.daemon"; -const QString path = "/com/deepin/pc/manager/session/daemon"; - -#define MB 1 << 10 -#define GB 1 << 20 -#define TB 1 << 30 -#define KB_SECTION(temp) ((temp >= 0 && temp < (MB)) ? true : false) -#define MB_SECTION(temp) ((temp >= (MB) && temp < (GB)) ? true : false) -#define GB_SECTION(temp) ((temp >= (GB) && temp < (TB)) ? true : false) -#define TB_SECTION(temp) ((temp >= (TB)) ? true : false) -//解决转换解析的desktop与系统desktop不匹配问题 - -QString getSystemDesktop(QString desktop); diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/daemon_adaptor.cpp b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/daemon_adaptor.cpp deleted file mode 100644 index 281082e..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/daemon_adaptor.cpp +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright (C) 2020 The Qt Company Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "daemon_adaptor.h" -#include -#include -#include -#include -#include -#include -#include - -/* - * Implementation of adaptor class DaemonAdaptor - */ - -DaemonAdaptor::DaemonAdaptor(QObject *parent) - : QDBusAbstractAdaptor(parent) -{ - // constructor - setAutoRelaySignals(true); -} - -DaemonAdaptor::~DaemonAdaptor() -{ - // destructor -} - -void DaemonAdaptor::DeleteSpecifiedFiles(const QStringList &path) -{ - // handle method call com.deepin.pc.manager.session.daemon.DeleteSpecifiedFiles - QMetaObject::invokeMethod(parent(), "DeleteSpecifiedFiles", Q_ARG(QStringList, path)); -} - -void DaemonAdaptor::ExitApp() -{ - // handle method call com.deepin.pc.manager.session.daemon.ExitApp - QMetaObject::invokeMethod(parent(), "ExitApp"); -} - -QString DaemonAdaptor::GetAppTrashInfoList() -{ - // handle method call com.deepin.pc.manager.session.daemon.GetAppTrashInfoList - QString cleanerPath; - QMetaObject::invokeMethod(parent(), "GetAppTrashInfoList", Q_RETURN_ARG(QString, cleanerPath)); - return cleanerPath; -} - -QString DaemonAdaptor::GetBrowserCookiesInfoList() -{ - // handle method call com.deepin.pc.manager.session.daemon.GetBrowserCookiesInfoList - QString cleanerPath; - QMetaObject::invokeMethod(parent(), "GetBrowserCookiesInfoList", Q_RETURN_ARG(QString, cleanerPath)); - return cleanerPath; -} - -QStringList DaemonAdaptor::GetCacheInfoList() -{ - // handle method call com.deepin.pc.manager.session.daemon.GetCacheInfoList - QStringList cleanerPath; - QMetaObject::invokeMethod(parent(), "GetCacheInfoList", Q_RETURN_ARG(QStringList, cleanerPath)); - return cleanerPath; -} - -QStringList DaemonAdaptor::GetHistoryInfoList() -{ - // handle method call com.deepin.pc.manager.session.daemon.GetHistoryInfoList - QStringList cleanerPath; - QMetaObject::invokeMethod(parent(), "GetHistoryInfoList", Q_RETURN_ARG(QStringList, cleanerPath)); - return cleanerPath; -} - -QStringList DaemonAdaptor::GetLogInfoList() -{ - // handle method call com.deepin.pc.manager.session.daemon.GetLogInfoList - QStringList cleanerPath; - QMetaObject::invokeMethod(parent(), "GetLogInfoList", Q_RETURN_ARG(QStringList, cleanerPath)); - return cleanerPath; -} - -QString DaemonAdaptor::GetSystemArchitecture() -{ - // handle method call com.deepin.pc.manager.session.daemon.GetSystemArchitecture - QString arch; - QMetaObject::invokeMethod(parent(), "GetSystemArchitecture", Q_RETURN_ARG(QString, arch)); - return arch; -} - -QStringList DaemonAdaptor::GetTrashInfoList() -{ - // handle method call com.deepin.pc.manager.session.daemon.GetTrashInfoList - QStringList cleanerPath; - QMetaObject::invokeMethod(parent(), "GetTrashInfoList", Q_RETURN_ARG(QStringList, cleanerPath)); - return cleanerPath; -} - -void DaemonAdaptor::ModulesRequestAuthorityActived() -{ - // handle method call com.deepin.pc.manager.session.daemon.ModulesRequestAuthorityActived - QMetaObject::invokeMethod(parent(), "ModulesRequestAuthorityActived"); -} - -void DaemonAdaptor::RequestAuthWithID(const QString &moduleName, int operationID) -{ - // handle method call com.deepin.pc.manager.session.daemon.RequestAuthWithID - QMetaObject::invokeMethod(parent(), "RequestAuthWithID", Q_ARG(QString, moduleName), Q_ARG(int, operationID)); -} - -void DaemonAdaptor::RequestCleanSelectTrash() -{ - // handle method call com.deepin.pc.manager.session.daemon.RequestCleanSelectTrash - QMetaObject::invokeMethod(parent(), "RequestCleanSelectTrash"); -} - -void DaemonAdaptor::RequestStartTrashScan() -{ - // handle method call com.deepin.pc.manager.session.daemon.RequestStartTrashScan - QMetaObject::invokeMethod(parent(), "RequestStartTrashScan"); -} - -void DaemonAdaptor::StartApp() -{ - // handle method call com.deepin.pc.manager.session.daemon.StartApp - QMetaObject::invokeMethod(parent(), "StartApp"); -} - -bool DaemonAdaptor::exeAutostart(int nStatus, const QString &sPath) -{ - // handle method call com.deepin.pc.manager.session.daemon.exeAutostart - bool value; - QMetaObject::invokeMethod(parent(), "exeAutostart", Q_RETURN_ARG(bool, value), Q_ARG(int, nStatus), Q_ARG(QString, sPath)); - return value; -} - -QString DaemonAdaptor::getAppsInfoDisable() -{ - // handle method call com.deepin.pc.manager.session.daemon.getAppsInfoDisable - QString value; - QMetaObject::invokeMethod(parent(), "getAppsInfoDisable", Q_RETURN_ARG(QString, value)); - return value; -} - -QString DaemonAdaptor::getAppsInfoEnable() -{ - // handle method call com.deepin.pc.manager.session.daemon.getAppsInfoEnable - QString value; - QMetaObject::invokeMethod(parent(), "getAppsInfoEnable", Q_RETURN_ARG(QString, value)); - return value; -} - -bool DaemonAdaptor::isAutostart(const QString &sPath) -{ - // handle method call com.deepin.pc.manager.session.daemon.isAutostart - bool value; - QMetaObject::invokeMethod(parent(), "isAutostart", Q_RETURN_ARG(bool, value), Q_ARG(QString, sPath)); - return value; -} - -void DaemonAdaptor::preInitialize() -{ - // handle method call com.deepin.pc.manager.session.daemon.preInitialize - QMetaObject::invokeMethod(parent(), "preInitialize"); -} - -bool DaemonAdaptor::startLauncherManage() -{ - // handle method call com.deepin.pc.manager.session.daemon.startLauncherManage - bool value; - QMetaObject::invokeMethod(parent(), "startLauncherManage", Q_RETURN_ARG(bool, value)); - return value; -} - diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/daemon_adaptor.h b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/daemon_adaptor.h deleted file mode 100644 index 4b3c102..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/daemon_adaptor.h +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (C) 2020 The Qt Company Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef DAEMON_ADAPTOR_H -#define DAEMON_ADAPTOR_H - -#include -#include -#include "window/modules/common/defenderprocinfolist.h" -#include "../../deepin-pc-manager/src/window/modules/securitytools/defsecuritytoolinfo.h" -QT_BEGIN_NAMESPACE -class QByteArray; -template class QList; -template class QMap; -class QString; -class QStringList; -class QVariant; -QT_END_NAMESPACE - -/* - * Adaptor class for interface com.deepin.pc.manager.session.daemon - */ -class DaemonAdaptor: public QDBusAbstractAdaptor -{ - Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "com.deepin.pc.manager.session.daemon") - Q_CLASSINFO("D-Bus Introspection", "" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" - "") -public: - DaemonAdaptor(QObject *parent); - virtual ~DaemonAdaptor(); - -public: // PROPERTIES -public Q_SLOTS: // METHODS - void DeleteSpecifiedFiles(const QStringList &path); - void ExitApp(); - QString GetAppTrashInfoList(); - QString GetBrowserCookiesInfoList(); - QStringList GetCacheInfoList(); - QStringList GetHistoryInfoList(); - QStringList GetLogInfoList(); - QString GetSystemArchitecture(); - QStringList GetTrashInfoList(); - void ModulesRequestAuthorityActived(); - void RequestAuthWithID(const QString &moduleName, int operationID); - void RequestCleanSelectTrash(); - void RequestStartTrashScan(); - void StartApp(); - bool exeAutostart(int nStatus, const QString &sPath); - QString getAppsInfoDisable(); - QString getAppsInfoEnable(); - bool isAutostart(const QString &sPath); - void preInitialize(); - bool startLauncherManage(); -Q_SIGNALS: // SIGNALS - void AccessRefreshData(bool bAdd, const QString &sID); - void CleanSelectTrashFinished(); - void NotifyAuthFinished(); - void NotifyAuthResult(const QString &moduleName, int operationID, bool isSuccess); - void NotifyAuthStarted(); - void TrashScanFinished(double sum); -}; - -#endif diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/deepin-defender-session-daemon.desktop b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/deepin-defender-session-daemon.desktop deleted file mode 100644 index bb06136..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/deepin-defender-session-daemon.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Exec=/usr/bin/deepin-pc-manager-session-daemon -Name=deepin-pc-manager-session-daemon -NoDisplay=true -Terminal=false -Type=Application -X-Deepin-Vendor=user-custom diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/main.cpp b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/main.cpp deleted file mode 100644 index a0c4fa9..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/main.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "operatedbusdata.h" -#include "window/modules/securitytooldialog/securitytooldialoginter.h" - -#include -#include -#include -#include - -#include - -#include - -DWIDGET_USE_NAMESPACE -DCORE_USE_NAMESPACE - -int main(int argc, char *argv[]) -{ - DApplication a(argc, argv); - a.loadTranslator(); - a.setAttribute(Qt::AA_EnableHighDpiScaling); - a.setAttribute(Qt::AA_UseHighDpiPixmaps); - a.setOrganizationName("deepin"); - a.setApplicationName("deepin-pc-manager-session-daemon"); - a.setApplicationDisplayName(""); // 标题文字设置为空 - a.setQuitOnLastWindowClosed(false); - - // 设置异步线程退出时间,默认为30秒 - QThreadPool::globalInstance()->setExpiryTimeout(100); - - DLogManager::registerConsoleAppender(); - DLogManager::registerFileAppender(); - - OperateDBusData dbus; - SecurityToolDialogInter toolDialogDbusInter; - - return a.exec(); -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/operatedbusdata.cpp b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/operatedbusdata.cpp deleted file mode 100644 index 11ba349..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/operatedbusdata.cpp +++ /dev/null @@ -1,815 +0,0 @@ -// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "operatedbusdata.h" - -#include "../../deepin-pc-manager/src/window/modules/common/common.h" -#include "../../deepin-pc-manager/src/window/modules/common/gsettingkey.h" -#include "../../deepin-pc-manager/src/window/modules/common/invokers/invokerfactory.h" -#include "../../deepin-pc-manager/src/window/modules/common/systemsettings/systemsettings.h" -#include "common.h" -#include "dpinyin.h" - -// 垃圾清理应用过滤类 -#include "window/modules/trashclean/trashcleanappinfofilter.h" -#include "window/modules/trashclean/trashcleanbrowserinfofilter.h" - -// 授权 -#include "window/modules/authority/defenderauthoritywrapper.h" - -// 悬浮框 -#include "window/modules/hoverballs/hoverballsdlg.h" - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#define Action_Flag_Disable 0 // 状态标志 - 不允许 -#define Action_Flag_Enable 1 // 状态标志 - 允许 - -#define MIN_SYSTEM_LOG_SIZE_TO_CLEAN 100 * MB_COUNT - -const QString WhitePathsFile = "/usr/share/deepin-pc-manager/cleanerwhite.json"; -const QString appPathsFile = "/usr/share/deepin-pc-manager/appInfomation.json"; -// 第三方病毒查杀应用程序信息 -const QString natiavOptApps = "/usr/share/deepin-pc-manager/natiavoptapps.json"; - -// 应用项扫描时过滤文件名称 -// 以正则形式执行 -bool isFileinRegexpList(QString file, QStringList filter) -{ - foreach (const auto &target, filter) { - if (!target.length()) { - continue; - } - QRegularExpression regularExpression(target); - if (regularExpression.match(file).hasMatch()) { - return true; - } - } - return false; -} - -// 合法调用进程路径列表 -const QStringList ValidInvokerExePathList = {"/usr/bin/deepin-pc-manager", - "/usr/bin/deepin-pc-manager-session-daemon", - "/usr/bin/deepin-pc-manager-system-daemon"}; - -OperateDBusData::OperateDBusData(QObject *parent) - : QObject(parent) - , m_daemonAdaptor(nullptr) - , m_gsetting(new QGSettings(DEEPIN_PC_MANAGER_GSETTING_PATH, QByteArray(), this)) - , m_sysSettings(new SystemSettings(this)) - , m_launcherInter(nullptr) - , m_startManagerInterface(nullptr) - , m_managerInter(nullptr) - , m_authWrapper(nullptr) -{ - m_daemonAdaptor = new DaemonAdaptor(this); - if (!QDBusConnection::sessionBus().registerService(service) - || !QDBusConnection::sessionBus().registerObject(path, this)) { - exit(0); - } - - registerLauncherItemInfoMetaType(); - - m_authWrapper = new DefenderAuthorityWrapper(this); - connect(m_authWrapper, - &DefenderAuthorityWrapper::notifyAuthStarted, - this, - &OperateDBusData::NotifyAuthStarted); - connect(m_authWrapper, - &DefenderAuthorityWrapper::notifyAuthFinished, - this, - &OperateDBusData::NotifyAuthFinished); - connect(m_authWrapper, - &DefenderAuthorityWrapper::notifyAuthResult, - this, - &OperateDBusData::NotifyAuthResult); - - // 取应用数据接口 - m_launcherInter = InvokerFactory::GetInstance().CreateInvoker("com.deepin.dde.daemon.Launcher", - "/com/deepin/dde/daemon/Launcher", - "com.deepin.dde.daemon.Launcher", - ConnectType::SESSION, - this); - - m_rootMonitorDBusInter = - InvokerFactory::GetInstance().CreateInvoker("com.deepin.pc.manager.system.daemon", - "/com/deepin/pc/manager/sysem/daemon", - "com.deepin.pc.manager.system.daemon", - ConnectType::SYSTEM, - this); - m_managerInter = InvokerFactory::GetInstance().CreateInvoker("org.deepin.lastore1", - "/org/deepin/lastore1", - "org.deepin.lastore1.Manager", - ConnectType::SYSTEM, - this); - m_startManagerInterface = - InvokerFactory::GetInstance().CreateInvoker("com.deepin.SessionManager", - "/com/deepin/StartManager", - "com.deepin.StartManager", - ConnectType::SESSION, - this); - - // 初始化联网管控 - initialize(); - - // 初始化获取系统架构 - initSystemArchitecture(); - - // 电脑管家悬浮框 - HoverBallsDlg *ballsDlg = new HoverBallsDlg; - ballsDlg->show(); - ballsDlg->raise(); - ballsDlg->activateWindow(); -} - -OperateDBusData::~OperateDBusData() -{ -} - -void OperateDBusData::StartApp() -{ -} - -void OperateDBusData::ExitApp() -{ - if (!isValidInvoker()) { - qDebug() << Q_FUNC_INFO << "invalid invoker!"; - return; - } - qApp->quit(); -} - -void OperateDBusData::preInitialize() -{ -} - -void OperateDBusData::initialize() -{ -} - -/*---------------------开机自启动管理---------------------*/ -bool OperateDBusData::startLauncherManage() -{ - m_enableAppsInfo.clear(); - m_disableAppsInfo.clear(); - m_enableData.clear(); - m_disableData.clear(); - - QDBusMessage msg = DBUS_BLOCK_INVOKE(m_launcherInter, "GetAllItemInfos"); - QDBusArgument arg = msg.arguments().first().value(); - QList datas; - arg >> datas; - - // 添加数据到QMap容器 - m_mapEnable.clear(); - m_mapDisable.clear(); - for (const auto &it : datas) { - QString sInfo = it.Path + "," + it.Icon + "," + it.ID + "," + it.Name; - - // 判断该应用状态(是否是自启动) - bool bStatus = isAutostart(it.Path); - - QString sName = DTK_CORE_NAMESPACE::Chinese2Pinyin(it.Name); - for (auto iterEnable = m_mapEnable.begin(); iterEnable != m_mapEnable.end(); ++iterEnable) { - if (sName == iterEnable.key()) - sName = sName + "_deepin"; - } - - for (auto iterDisable = m_mapDisable.begin(); iterDisable != m_mapDisable.end(); - ++iterDisable) { - if (sName == iterDisable.key()) - sName = sName + "_deepin"; - } - sInfo = sInfo + "," + sName; - - if (bStatus) { - m_enableData.append(sInfo); - m_mapEnable[sName] = sInfo; - } else { - m_disableData.append(sInfo); - m_mapDisable[sName] = sInfo; - } - } - - for (int i = 0; i < m_enableData.count(); ++i) { - if (i == 0) - m_enableAppsInfo = m_enableData.at(0); - else - m_enableAppsInfo = m_enableAppsInfo + "|" + m_enableData.at(i); - } - - for (int i = 0; i < m_disableData.count(); ++i) { - if (i == 0) - m_disableAppsInfo = m_disableData.at(0); - else - m_disableAppsInfo = m_disableAppsInfo + "|" + m_disableData.at(i); - } - - return true; -} - -QString OperateDBusData::getAppsInfoEnable() -{ - return m_enableAppsInfo; -} - -QString OperateDBusData::getAppsInfoDisable() -{ - return m_disableAppsInfo; -} - -// 判断是否是开机自启 -bool OperateDBusData::isAutostart(QString sPath) -{ - QDBusMessage msg = DBUS_BLOCK_INVOKE(m_startManagerInterface, "IsAutostart", sPath); - GET_MESSAGE_VALUE(bool, flag, msg); - - return flag; -} - -// 执行开机自启动管理 开启/禁止操作 -bool OperateDBusData::exeAutostart(int nStatus, QString sPath) -{ - // 执行自启动关闭操作 - if (Action_Flag_Disable == nStatus) { - QDBusMessage msg = DBUS_BLOCK_INVOKE(m_startManagerInterface, "RemoveAutostart", sPath); - GET_MESSAGE_VALUE(bool, flag, msg); - return flag; - } else { - // 执行自启动开启操作 - QDBusMessage msg = DBUS_BLOCK_INVOKE(m_startManagerInterface, "AddAutostart", sPath); - GET_MESSAGE_VALUE(bool, flag, msg); - return flag; - } -} - -// 外部调用刷新表格数据 -void OperateDBusData::refreshData(bool bAdd, QString sID) -{ - Q_EMIT AccessRefreshData(bAdd, sID); -} - -// 垃圾清理 - 回收站 -QStringList OperateDBusData::GetTrashInfoList() -{ - // 获取回收站目录下所有文件 - m_fileList.clear(); - QEventLoop loop; - QtConcurrent::run([&] { - QThread::msleep(50); - scanFile(QDir::homePath() + CLEANER_SYSTEM_TRASH_PATH); - loop.exit(); - }); - loop.exec(); - - foreach (const QString &file, m_fileList) { - QFileInfo info(file); - m_dbCleanerSum += info.size(); - m_fileListSum.append(file); - } - return m_fileList; -} - -// 垃圾清理 - 日志 -QStringList OperateDBusData::GetLogInfoList() -{ - // 获取回收站目录下所有文件 - m_fileList.clear(); - QEventLoop loop; - QtConcurrent::run([&] { - QThread::msleep(50); - scanFile(CLEANER_SYSTEM_LOG_PATH); - loop.exit(); - }); - loop.exec(); - - // 系统日志过滤掉白名单 - double sizeCounter = 0.0; - QStringList sPathList; - QFile whiteFile(WhitePathsFile); - if (!whiteFile.open(QFile::ReadOnly)) { - qDebug() << "can not find white file:" << WhitePathsFile; - } - - // 获取白名单数据 - QJsonParseError err; - const QJsonObject &object = QJsonDocument::fromJson(whiteFile.readAll(), &err).object(); - whiteFile.close(); - - if (QJsonParseError::NoError != err.error) { - return QStringList(); - } - const QJsonArray &apps = object.value("whitepaths").toArray(); - - // 判断是否该目录下文件是否加入到白名单,如果加入,直接跳过 - foreach (const QString &file, m_fileList) { - if (file.isEmpty()) { - break; - } - - bool bAddList = false; - // 是否是/var/log/journal目录下的文件 - if (file.contains("/var/log/journal")) { - QFileInfo info(file); - sizeCounter += info.size(); - sPathList.append(file); - } else { - // 黑名单 - 只清除黑名单内带后缀的文件 - for (auto itApp = apps.begin(); itApp != apps.end(); ++itApp) { - QString sPath = itApp->toObject().value("white_path").toString(); - if (file.contains(sPath) && file != sPath) { - bAddList = true; - } - } - } - - // 添加符合规则的文件到清理项 - if (bAddList) { - QFileInfo info(file); - sizeCounter += info.size(); - sPathList.append(file); - } - } - - // 仅超过100M时对系统日志提供清理 - if (sizeCounter > MIN_SYSTEM_LOG_SIZE_TO_CLEAN) { - m_fileListSum.append(sPathList); - m_dbCleanerSum += sizeCounter; - } else { - sPathList.clear(); - } - - return sPathList; -} - -// 垃圾清理 - 缓存 -// 应用laststore接口,获取可以安全删除的deb包路径 -QStringList OperateDBusData::GetCacheInfoList() -{ - QStringList debFileList; - QString debJsonStr; - QEventLoop loop; - QtConcurrent::run([&] { - QThread::msleep(50); - QDBusMessage msg = DBUS_BLOCK_INVOKE(m_managerInter, "GetArchivesInfo"); - debJsonStr = QDBusReply(msg).value(); - loop.exit(); - }); - loop.exec(); - - QJsonParseError err; - QJsonObject object = QJsonDocument::fromJson(debJsonStr.toUtf8(), &err).object(); - if (QJsonParseError::NoError != err.error) { - qDebug() << "incorrect json format:" << debJsonStr; - return debFileList; - } - - // 获取/var/cache/apt/archives 可清理deb缓存 - QJsonArray debObjArrayApt = object.value(CLEANER_SYSTEM_CACHE_ARRAY_NAME) - .toObject() - .value(CLEANER_SYSTEM_CACHE_APT_PATH) - .toArray(); - foreach (const auto &it, debObjArrayApt) { - QString debName = it.toObject().value(CLEANER_SYSTEM_CACHE_DEB_NAME).toString(); - - if (debName.isEmpty()) { - continue; - } - - // 设置文件完整路径 - QString debFilePath = QString("%1%2%3") - .arg(CLEANER_SYSTEM_CACHE_APT_PATH) - .arg(QDir::separator()) - .arg(debName); - QFileInfo info(debFilePath); - if (info.exists()) { - debFileList.append(debFilePath); - m_fileListSum.append(debFilePath); - m_dbCleanerSum += info.size(); - } - } - - // 获取/var/cache/lastore/archives 可清理deb缓存 - QJsonArray debObjArray = object.value(CLEANER_SYSTEM_CACHE_ARRAY_NAME) - .toObject() - .value(CLEANER_SYSTEM_CACHE_LASTORE_PATH) - .toArray(); - foreach (const auto &it, debObjArray) { - QString debName = it.toObject().value(CLEANER_SYSTEM_CACHE_DEB_NAME).toString(); - - if (debName.isEmpty()) { - continue; - } - - // 设置文件完整路径 - QString debFilePath = QString("%1%2%3") - .arg(CLEANER_SYSTEM_CACHE_LASTORE_PATH) - .arg(QDir::separator()) - .arg(debName); - QFileInfo info(debFilePath); - if (info.exists()) { - debFileList.append(debFilePath); - m_fileListSum.append(debFilePath); - m_dbCleanerSum += info.size(); - } - } - - return debFileList; -} - -// 垃圾清理 - 痕迹 -QStringList OperateDBusData::GetHistoryInfoList() -{ - // 统计清理文件大小和路径 - QFileInfo info(QDir::homePath() + CLEANER_SYSTEM_HISTORY_PATH); - m_dbCleanerSum += info.size(); - m_fileListSum.append(info.absoluteFilePath()); - - // 获取回收站目录下所有文件 - m_fileList.clear(); - scanFile(QDir::homePath() + CLEANER_SYSTEM_HISTORY_PATH); - - return m_fileList; -} - -// 浏览器cookies -// 文件暂时没有清单,需要下一步清查各浏览器cookies位置 -QString OperateDBusData::GetBrowserCookiesInfoList() -{ - QJsonDocument appInfoDoc; - QJsonArray appInfoForUI; - - TrashCleanBrowserInfoFilter filter; - - bool isInitSuccess = filter.FromJson(appPathsFile); - if (!isInitSuccess) { - return QString(); - } - - TrashCleanAppList appList = filter.ToList(); - - QEventLoop loop; - QtConcurrent::run([&] { - QThread::msleep(50); - foreach (const auto &app, appList) { - QJsonObject cookiesInfo; - - m_fileList.clear(); - // 在目录下获取文件路径 - foreach (const auto &dir, app.browserCookiesPaths) { - scanFile(QDir::homePath() + dir); - } - // 填充cookies路径 - QJsonArray cookies; - foreach (const auto &cookiesFile, m_fileList) { - cookies.insert(0, QJsonValue(cookiesFile)); - } - cookiesInfo[CLEANER_APP_NAME] = app.appDisplayName; - cookiesInfo[CLEANER_BROWSER_COOKIES_PATH] = cookies; - - m_fileList.clear(); - appInfoForUI.insert(0, cookiesInfo); - } - loop.exit(); - }); - loop.exec(); - - QJsonObject root; - root.insert(CLEANER_BROWSER_JSON_NAME, appInfoForUI); - appInfoDoc.setObject(root); - return appInfoDoc.toJson(); -} - -// 垃圾清理 - 应用 -// 重构,以结构体返回 -// 由于应用存在层次关系,此处返回json字符串以记录层次 -QString OperateDBusData::GetAppTrashInfoList() -{ - // 通过过滤器获取应用配置 - QJsonArray appInfoForUI; // 发给前端的json内容 - TrashCleanAppInfoFilter filter; - bool isInitSuccess = filter.FromJson(appPathsFile); - if (!isInitSuccess) { - return QString(); - } - - TrashCleanAppList appList = filter.ToList(); - - // 由于另外模块中使用double型作为大小值类型。此处也使用double - // 该map用于元素自动排序 - QMultiMap appTrashMap; - - QEventLoop loop; - QtConcurrent::run([&] { - QThread::msleep(50); - foreach (const auto &app, appList) { - QJsonObject appInfo; - qint64 appTrashSize = 0; - appInfo[CLEANER_APP_COM_NAME] = app.appPkgName; - appInfo[CLEANER_APP_NAME] = app.appDisplayName; - appInfo[CLEANER_APP_INSTALL_FLAG] = app.isInstalled; - - // 获取应用的白名单 - QStringList whiteList; - foreach (const auto &filterItem, app.whiteList) { - whiteList.append(filterItem); - } - - m_fileList.clear(); - // 在目录下获取cache文件路径 - foreach (const auto &cacheDir, app.appCachePaths) { - QString path = cacheDir; - scanFile(QDir::homePath() + path); - } - // 填充JSON cache路径 - QJsonArray cache; - foreach (const auto &cacheFile, m_fileList) { - // 如果在白名单中,跳过 - if (isFileinRegexpList(cacheFile, whiteList)) { - continue; - } - cache.insert(0, QJsonValue(cacheFile)); - QFileInfo info(cacheFile); - if (info.exists()) { - appTrashSize += info.size(); - m_fileListSum.append(cacheFile); - } - } - - // 将黑名单内容加入到cache项以进行日常清理 - foreach (const auto &blackFile, app.blackList) { - QString fileName = blackFile; - if (!fileName.length()) { - continue; - } - fileName = QDir::homePath() + fileName; - QFileInfo info(fileName); - if (info.exists()) { - cache.insert(0, QJsonValue(fileName)); - appTrashSize += info.size(); - m_fileListSum.append(fileName); - } - } - - appInfo[CLEANER_APP_CACHE_PATH] = cache; - m_fileList.clear(); - - foreach (const auto &configDir, app.appConfigPaths) { - scanFile(QDir::homePath() + configDir); - } - - QJsonArray config; - if (!app.isInstalled) { - // 填充config路径 - - foreach (const auto &configFile, m_fileList) { - // 如果在白名单中,跳过 - if (isFileinRegexpList(configFile, whiteList)) { - continue; - } - config.insert(0, QJsonValue(configFile)); - - // 卸载残留追加记录 - if (!app.isInstalled) { - QFileInfo info(configFile); - if (info.exists()) { - appTrashSize += info.size(); - m_fileListSum.append(configFile); - } - } - } - } - appInfo[CLEANER_APP_CONFIG_PATH] = config; - - // 通过MAP进行升序排列 - // 存在同样大小的项,不要使用insert() - appTrashMap.insert(appTrashSize, appInfo); - - m_dbCleanerSum += appTrashSize; - } - loop.exit(); - }); - loop.exec(); - - foreach (auto it, appTrashMap) { - // 降序 - // 输出到界面此时MAP中最大值排在0索引处 - appInfoForUI.insert(0, it); - } - - QJsonObject root; - root.insert(CLEANER_APP_JSON_NAME, appInfoForUI); - QJsonDocument appInfoDoc; - appInfoDoc.setObject(root); - return QString(appInfoDoc.toJson()); -} - -// 获取单个文件的大小,同时记录文件总数 -void OperateDBusData::scanFile(const QString &path) -{ - QFileInfo info(path); - if (info.exists()) { - if (info.isFile()) { - // 用户显示在主界面的标题内容,由于文件路径是同检查项层次决定的,所以不需要该文件的路径信息 - QString abpath = info.absoluteFilePath(); - m_fileList.append(abpath); - } else if (info.isDir()) { - QDir dir(path); - for (const QFileInfo &i : - dir.entryInfoList(QDir::NoDotAndDotDot | QDir::Files | QDir::Dirs | QDir::Hidden - | QDir::NoSymLinks)) { - // 递归扫描目录内容 - scanFile(i.absoluteFilePath()); - } - } - } -} - -// 首页体检垃圾清理项大小 -double OperateDBusData::GetCleanerSum() -{ - m_dbCleanerSum = 0.00; - m_fileListSum.clear(); - - // 获取垃圾清理项 - GetTrashInfoList(); - GetLogInfoList(); - GetCacheInfoList(); - GetAppTrashInfoList(); - - return m_dbCleanerSum; -} - -// 首页体检清理所有垃圾 -void OperateDBusData::DeleteAllCleaner() -{ - if (!isValidInvoker()) { - qDebug() << Q_FUNC_INFO << "invalid invoker!"; - return; - } - if (!m_homepageCleanerResultFileList.empty()) { - // 首页清理一定会清空回收站,所以在这里使用DKT功能清空回收站 - DTrashManager::instance()->cleanTrash(); - // 删除其它文件 - DeleteSpecifiedFiles(m_homepageCleanerResultFileList); - m_homepageCleanerResultFileList.clear(); - m_homepageCleanerResultSize = 0; - } -} - -// 请求开始垃圾文件扫描 -void OperateDBusData::RequestStartTrashScan() -{ - GetCleanerSum(); - m_homepageCleanerResultFileList = m_fileListSum; - m_homepageCleanerResultSize = m_dbCleanerSum; - - // 发送扫描结果 - Q_EMIT TrashScanFinished(m_homepageCleanerResultSize); -} - -// 请求清理选中的垃圾文件 -void OperateDBusData::RequestCleanSelectTrash() -{ - if (!isValidInvoker()) { - qDebug() << Q_FUNC_INFO << "invalid invoker!"; - return; - } - DeleteAllCleaner(); - // 清理完成 - Q_EMIT CleanSelectTrashFinished(); -} - -// 清理指定的用户文件 -void OperateDBusData::DeleteSpecifiedFiles(QStringList filePaths) -{ - if (!isValidInvoker()) { - qDebug() << Q_FUNC_INFO << "invalid invoker!"; - return; - } - DBUS_NOBLOCK_INVOKE(m_rootMonitorDBusInter, "CleanSelectFile", filePaths); -} - -// 发生应用安装或卸载时的响应 -void OperateDBusData::OnLauncherItemChanged(const QString &action, - const LauncherItemInfo &appInfo, - qint64 code) -{ - Q_UNUSED(code); - - QString appId = appInfo.ID; - QString appName = appInfo.Name; - if ("created" == action) { - // 删除记录 - if (!appId.isEmpty()) { - DBUS_NOBLOCK_INVOKE(m_rootMonitorDBusInter, "DeleteUninstalledAppRecord", appId); - } - return; - } - - if ("deleted" == action) { - // 更新记录,先删除后插入以更新数据库记录的ID值 - if (!appId.isEmpty()) { - TrashCleanAppInfoFilter filter; - filter.FromJson(appPathsFile); - if (filter.isExistInConfig(appId)) { - DBUS_NOBLOCK_INVOKE(m_rootMonitorDBusInter, "DeleteUninstalledAppRecord", appId); - DBUS_NOBLOCK_INVOKE(m_rootMonitorDBusInter, - "InsertUninstalledAppRecord", - appId, - appName); - } - } - return; - } -} - -// 初始化获取系统架构 -void OperateDBusData::initSystemArchitecture() -{ - QProcess fileCheck; - fileCheck.start("uname", {"-m"}); - fileCheck.waitForFinished(1000); - m_sSystemArchitecture = fileCheck.readAll().trimmed(); -} - -QString OperateDBusData::GetSystemArchitecture() -{ - return m_sSystemArchitecture; -} - -void OperateDBusData::RequestAuthWithID(const QString &moduleName, int id) -{ - if (!isValidInvoker()) { - qDebug() << Q_FUNC_INFO << "invalid invoker!"; - return; - } - Q_EMIT m_authWrapper->onAuthRequest(moduleName, id); -} - -void OperateDBusData::ModulesRequestAuthorityActived() -{ - if (!isValidInvoker()) { - qDebug() << Q_FUNC_INFO << "invalid invoker!"; - return; - } - Q_EMIT m_authWrapper->onModulesActived(); -} - -// 校验调用者 -bool OperateDBusData::isValidInvoker() -{ -#ifdef QT_DEBUG - return true; -#else - // 判断是否位自身调用 - if (!calledFromDBus()) { - return true; - } - - bool valid = false; - QDBusConnection conn = connection(); - QDBusMessage msg = message(); - - // 判断是否存在执行路径且是否存在于可调用者名单中 - uint pid = conn.interface()->servicePid(msg.service()).value(); - QFileInfo f(QString("/proc/%1/exe").arg(pid)); - QString invokerPath = f.canonicalFilePath(); - - // 防止读取的执行路径为空,为空时取cmdline内容 - if (invokerPath.isEmpty()) { - QFile cmdlineFile(QString("/proc/%1/cmdline").arg(pid)); - if (cmdlineFile.open(QIODevice::OpenModeFlag::ReadOnly)) { - QString sCmdline = cmdlineFile.readAll(); - invokerPath = sCmdline.split(" ").first(); - } - cmdlineFile.close(); - } - - if (ValidInvokerExePathList.contains(invokerPath)) { - valid = true; - } - - // 如果是非法调用者,则输出错误 - if (!valid) { - sendErrorReply(QDBusError::ErrorType::Failed, - QString("(pid: %1)[%2] is not allowed to transfer antiav inter") - .arg(pid) - .arg(invokerPath)); - } - - return valid; -#endif -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/operatedbusdata.h b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/operatedbusdata.h deleted file mode 100644 index ebdf31a..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/operatedbusdata.h +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include "window/modules/common/defenderlauncherinfo.h" -#include "daemon_adaptor.h" - -#include - -#include - -class StartupMonitor; -class DBusInvokerInterface; -class DefenderAuthorityWrapper; - -// 系统配置 -namespace def { -class SystemSettings; -} - -class QGSettings; -class QDBusContext; - -using namespace def; - -DCORE_USE_NAMESPACE -class AppsStartToEnd; - -class OperateDBusData : public QObject - , protected QDBusContext -{ - Q_OBJECT - -public: - explicit OperateDBusData(QObject *parent = nullptr); - - ~OperateDBusData(); - -public Q_SLOTS: - // 接口 - void StartApp(); - void ExitApp(); - void preInitialize(); - - // 开机自启动管理 - bool startLauncherManage(); - QString getAppsInfoEnable(); - QString getAppsInfoDisable(); - bool isAutostart(QString sPath); - bool exeAutostart(int nStatus, QString sPath); - - // 垃圾清理 回收站/日志/缓存/痕迹 - QStringList GetTrashInfoList(); - QStringList GetLogInfoList(); - QStringList GetCacheInfoList(); - QStringList GetHistoryInfoList(); - QString GetBrowserCookiesInfoList(); - QString GetAppTrashInfoList(); - void DeleteSpecifiedFiles(QStringList); - - // 请求开始垃圾文件扫描 - void RequestStartTrashScan(); - // 请求清理选中的垃圾文件 - void RequestCleanSelectTrash(); - - QString GetSystemArchitecture(); - - void RequestAuthWithID(const QString &, int); - void ModulesRequestAuthorityActived(); - -private: - // 初始化 - void initialize(); - // 校验调用者 - bool isValidInvoker(); - void refreshData(bool bAdd, QString sID); - void OnLauncherItemChanged(const QString &, const LauncherItemInfo &, qint64); - // 初始化获取系统架构 - void initSystemArchitecture(); - // 递归函数-获取目录下所有文件 - void scanFile(const QString &path); - // 首页体检垃圾清理项大小 - double GetCleanerSum(); - // 首页体检清理所有垃圾 - void DeleteAllCleaner(); - -Q_SIGNALS: - // 开机自启动管理 - void AccessRefreshData(bool bAdd, QString sID); - - void NotifyAuthStarted(); - void NotifyAuthFinished(); - void NotifyAuthResult(const QString &, int, bool); - - void CleanSelectTrashFinished(); - void TrashScanFinished(double); - -private: - DaemonAdaptor *m_daemonAdaptor; - QGSettings *m_gsetting; // gsetting配置对象 - SystemSettings *m_sysSettings; // 系统配置 - - // 开机自启动管理 - QMap m_mapEnable; // 不允许自启动数据容器 - QMap m_mapDisable; // 允许自启动数据容器 - QStringList m_enableData; - QStringList m_disableData; - QString m_enableAppsInfo; - QString m_disableAppsInfo; - DBusInvokerInterface *m_launcherInter; // 取应用数据接口 - DBusInvokerInterface *m_startManagerInterface; // 自启动接口 - - // 垃圾清理 - DBusInvokerInterface *m_managerInter; // 检查/var/cache/apt/archives下,可安全删除的deb包 - QStringList m_fileList; - QStringList m_fileListSum; - double m_dbCleanerSum; - /// 首页垃圾清理 - // 首页垃圾清理扫描结果可清理文件路径列表 - QStringList m_homepageCleanerResultFileList; - // 首页垃圾清理扫描结果可清理文件总大小,byte - double m_homepageCleanerResultSize; - - // 系统服务 - DBusInvokerInterface *m_rootMonitorDBusInter; - - // 系统架构 - QString m_sSystemArchitecture; - - // 提权管理 - DefenderAuthorityWrapper *m_authWrapper; -}; diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/translations/deepin-pc-manager-session-daemon_en_US.qm b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/translations/deepin-pc-manager-session-daemon_en_US.qm deleted file mode 100644 index 937ea3e..0000000 Binary files a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/translations/deepin-pc-manager-session-daemon_en_US.qm and /dev/null differ diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/translations/deepin-pc-manager-session-daemon_en_US.ts b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/translations/deepin-pc-manager-session-daemon_en_US.ts deleted file mode 100644 index a74ec3e..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/translations/deepin-pc-manager-session-daemon_en_US.ts +++ /dev/null @@ -1,347 +0,0 @@ - - - - - MyItemDelegate - - - Third-party - - - - - System - - - - - NetCheckItem - - - Awaiting detection - - - - - Detecting... - - - - - NetCheckWidget - - - Network Detection - - - - - One-click detection, comprehensive network troubleshooting - - - - - Network Environment Configuration - - - - - Network Environment - - - - - Public Network - - - - - Intranet - - - - - Intranet IP/Domain - - - - - Example: 127.0.0.1 or www.uniontech.com - - - - - Detect Now - - - - - - Network detecting, please wait - - - - - Detection Time - - - - - Network Device Detection - - - - - Network Settings Detection - - - - - DHCP service - - - - - DNS service - - - - - host file configuration - - - - - Network accessibility - - - - - Cancel detection - - - - - Retry - - - - - Done - - - - - Due to abnormal application exit, services need initialization, please wait. - - - - - Intranet IP/Domain cannot be empty - - - - - Network device detected normal - - - - - Network device disabled - - - - - No valid network device detected - - - - - - - - - - - - - Not Detected - - - - - - - Abnormalities exist, please fix and retry - - - - - Not connected to any network - - - - - IP auto configuration, skip detection - - - - - IP manual configuration, network settings abnormal - - - - - IP manual configuration, network settings normal - - - - - DHCP service abnormal - - - - - DHCP service normal - - - - - DNS server unreachable - - - - - DNS server resolution abnormal - - - - - DNS service normal - - - - - host file format error - - - - - host file configuration normal - - - - - Network access normal - - - - - Network access abnormal, please disable system proxy or VPN and retry - - - - - Network access abnormal - - - - - Detection completed, network normal - - - - - SearchLineEdit - - - Search - - - - - StartupWidget - - - Startup Programs - - - - - Name - - - - - Auto Startup - - - - - Action - - - - - - Enabled - - - - - - Disabled - - - - - Enabled auto startup for %1 - - - - - Disabled auto startup for %1 - - - - - Startup apps - - - - - All apps - - - - - SystemMessageHelper - - - The %1 antivirus engine service will expire in %2 days. After the expiration, files in the quarantine list cannot be restored. Please restore them in time if you want. - - - - - View - button - - - - - UpdateAddressItem - - - Virus database server address - - - - - VirusWhitelistScanItem - - - (Files in the whitelist will be excluded from virus scan) - - - - diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/translations/deepin-pc-manager-session-daemon_zh_CN.qm b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/translations/deepin-pc-manager-session-daemon_zh_CN.qm deleted file mode 100644 index b7f0e94..0000000 Binary files a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/translations/deepin-pc-manager-session-daemon_zh_CN.qm and /dev/null differ diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/translations/deepin-pc-manager-session-daemon_zh_CN.ts b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/translations/deepin-pc-manager-session-daemon_zh_CN.ts deleted file mode 100644 index c511db4..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/translations/deepin-pc-manager-session-daemon_zh_CN.ts +++ /dev/null @@ -1,347 +0,0 @@ - - - - - MyItemDelegate - - - Third-party - 第三方 - - - - System - 系统 - - - - NetCheckItem - - - Awaiting detection - 等待检测 - - - - Detecting... - 正在检测... - - - - NetCheckWidget - - - Network Detection - 网络检测 - - - - One-click detection, comprehensive network troubleshooting - 快速检测网络异常原因 - - - - Network Environment Configuration - 网络环境配置 - - - - Network Environment - 网络环境 - - - - Public Network - 公网 - - - - Intranet - 内网 - - - - Intranet IP/Domain - 内网IP/域名 - - - - Example: 127.0.0.1 or www.uniontech.com - 示例:127.0.0.1或www.uniontech.com - - - - Detect Now - 立即检测 - - - - - Network detecting, please wait - 网络检测中,请稍等 - - - - Detection Time - 检测用时 - - - - Network Device Detection - 网络设备检测 - - - - Network Settings Detection - 网络设置检测 - - - - DHCP service - DHCP服务 - - - - DNS service - DNS服务 - - - - host file configuration - host文件配置 - - - - Network accessibility - 能否访问网络 - - - - Cancel detection - 取消检测 - - - - Retry - 重新检测 - - - - Done - 完成 - - - - Due to abnormal application exit, services need initialization, please wait. - 由于应用异常退出,服务需初始化,请稍等。 - - - - Intranet IP/Domain cannot be empty - 内网IP/域名不能为空 - - - - Network device detected normal - 网络设备检测正常 - - - - Network device disabled - 网络设备被禁用 - - - - No valid network device detected - 未检测到有效的网络设备 - - - - - - - - - - - - Not Detected - 未检测 - - - - - - Abnormalities exist, please fix and retry - 存在异常,请修复后重新检测 - - - - Not connected to any network - 未连接任何网络 - - - - IP auto configuration, skip detection - IP自动配置,跳过检测 - - - - IP manual configuration, network settings abnormal - IP手动配置,网络设置异常 - - - - IP manual configuration, network settings normal - IP手动配置,网络设置正常 - - - - DHCP service abnormal - DHCP服务异常 - - - - DHCP service normal - DHCP服务正常 - - - - DNS server unreachable - DNS服务器无法访问 - - - - DNS server resolution abnormal - DNS服务器解析异常 - - - - DNS service normal - DNS服务正常 - - - - host file format error - host文件格式错误 - - - - host file configuration normal - host文件配置正常 - - - - Network access normal - 网络访问正常 - - - - Network access abnormal, please disable system proxy or VPN and retry - 网络访问异常,请关闭系统代理或VPN后重新检测 - - - - Network access abnormal - 网络访问异常 - - - - Detection completed, network normal - 检测完成,网络无异常 - - - - SearchLineEdit - - - Search - 搜索 - - - - StartupWidget - - - Startup Programs - 自启动应用 - - - - Name - 名称 - - - - Auto Startup - 自启动状态 - - - - Action - 操作 - - - - - Enabled - 已启动 - - - - - Disabled - 已禁止 - - - - Enabled auto startup for %1 - 允许%1开机自启动 - - - - Disabled auto startup for %1 - 禁止%1开机自启动 - - - - Startup apps - 已允许应用 - - - - All apps - 全部应用 - - - - SystemMessageHelper - - - The %1 antivirus engine service will expire in %2 days. After the expiration, files in the quarantine list cannot be restored. Please restore them in time if you want. - 安全中心%1杀毒引擎服务将于%2天后到期,到期后隔离区中文件无法还原,如需还原请及时处理。 - - - - View - button - 查 看 - - - - UpdateAddressItem - - - Virus database server address - 病毒库升级地址 - - - - VirusWhitelistScanItem - - - (Files in the whitelist will be excluded from virus scan) - (加入白名单后病毒扫描将被跳过) - - - diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/authority/defenderauthority.cpp b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/authority/defenderauthority.cpp deleted file mode 100644 index ae28829..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/authority/defenderauthority.cpp +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (C) 2022 ~ 2022 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "defenderauthority.h" - -#include -#include - -const QString kActionName = "com.deepin.pc.sesseion.daemon.checkAuthentication"; - -DefenderAuthority::DefenderAuthority(QObject *parent) - : QObject(parent) -{ -} - -DefenderAuthority::~DefenderAuthority() -{ - // 检查是否授权过程中,如果是,取消授权 - if (!m_mutex.tryLock()) { - Authority::instance()->checkAuthorizationCancel(); - } else { - // 非授权状态 - m_mutex.unlock(); - } -} - -void DefenderAuthority::checkAuthorization(const QString &name, int id) -{ - // 加锁以处理意外的连接授权 - QMutexLocker locker(&m_mutex); - - preAuthorize(); - - processAuthorize(name, id); - - postAuthorize(); -} - -// 新的授权窗口启动时,需要知道当前的授权状态 -// 仅需要这一时刻的状态,之后的变化由信号通知 -void DefenderAuthority::onModulesActived() -{ - if (m_mutex.tryLock()) { - Q_EMIT notifyAuthFinished(); - m_mutex.unlock(); - return; - } - - Q_EMIT notifyAuthStarted(); -} - -// 收到通知的界面需要处理授权状态 -void DefenderAuthority::preAuthorize() -{ - Q_EMIT notifyAuthStarted(); -} - -// 收到通知的界面需要处理授权状态 -void DefenderAuthority::postAuthorize() -{ - Q_EMIT notifyAuthFinished(); -} - -// 基于QT的信号队列与锁机制 -// 对请求进行序列化处理 -void DefenderAuthority::processAuthorize(const QString &moduldName, int id) -{ - // 需要关注授权错误,在本次处理前,消除旧的错误信息 - Authority::instance()->clearError(); - - Authority::Result result; - - result = Authority::instance()->checkAuthorizationSync(kActionName, - UnixProcessSubject(getpid()), /// 第一个参数是需要验证的action,和规则文件写的保持一致 - Authority::AllowUserInteraction); - - // 根据库建议,添加错误码处理过程 - Authority::ErrorCode err = checkAuthorizeStatus(); - if (Authority::ErrorCode::E_None != err) { - Q_EMIT notifyAuthStatusAbnormal(err); - Q_EMIT notifyAuthResult(moduldName, id, false); - - Authority::instance()->clearError(); - return; - } - - Q_EMIT notifyAuthResult(moduldName, id, Authority::Result::Yes == result); -} - -// 获取状态,如果有异常写入日志 -Authority::ErrorCode DefenderAuthority::checkAuthorizeStatus() -{ - Authority::ErrorCode err = Authority::ErrorCode::E_None; - - if (Authority::instance()->hasError()) { - err = Authority::instance()->lastError(); - qCritical() << Q_FUNC_INFO << "status abnormal : " << Authority::instance()->errorDetails(); - } - - return err; -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/authority/defenderauthority.h b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/authority/defenderauthority.h deleted file mode 100644 index 213e927..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/authority/defenderauthority.h +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (C) 2022 ~ 2022 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef DEFENDERAUTHORIZEADAPTER_H -#define DEFENDERAUTHORIZEADAPTER_H - -#include -#include -#include - -#include - -using namespace PolkitQt1; - -class DefenderAuthority : public QObject -{ - Q_OBJECT - -public: - explicit DefenderAuthority(QObject *parent = nullptr); - ~DefenderAuthority(); - -public Q_SLOTS: - // 外部通知,需要进行授权 - void checkAuthorization(const QString &, int); - void onModulesActived(); - -private: - void preAuthorize(); - - void postAuthorize(); - - void processAuthorize(const QString &, int); - Authority::ErrorCode checkAuthorizeStatus(); - -Q_SIGNALS: - // 告知界面状态变化,所以界面都需要处理 - void notifyAuthStarted(); - void notifyAuthFinished(); - - // 告知授权结果 - void notifyAuthResult(const QString &, int, bool); - // 告知状态错误,返回授权是否可用 - void notifyAuthStatusAbnormal(int); - -private: - QMutex m_mutex; - QPair m_currentAuthRequest; -}; - -#endif // DEFENDERAUTHORIZEADAPTER_H diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/authority/defenderauthoritywrapper.cpp b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/authority/defenderauthoritywrapper.cpp deleted file mode 100644 index 35bfdff..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/authority/defenderauthoritywrapper.cpp +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (C) 2022 ~ 2022 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "defenderauthoritywrapper.h" -#include "defenderauthority.h" - -DefenderAuthorityWrapper::DefenderAuthorityWrapper(QObject *parent) - : QObject(parent) -{ - m_authority = new DefenderAuthority; - - if (m_authority) { - initConnection(); - m_authority->moveToThread(&m_authThread); - m_authThread.start(); - } -} - -DefenderAuthorityWrapper::~DefenderAuthorityWrapper() -{ - if (m_authority) { - m_authority->deleteLater(); - m_authority = nullptr; - } - m_authThread.quit(); - m_authThread.wait(1000); -} - -// 只处理信号转发 -void DefenderAuthorityWrapper::initConnection() -{ - connect(m_authority, &DefenderAuthority::notifyAuthStarted, this, &DefenderAuthorityWrapper::notifyAuthStarted); - connect(m_authority, &DefenderAuthority::notifyAuthFinished, this, &DefenderAuthorityWrapper::notifyAuthFinished); - connect(m_authority, &DefenderAuthority::notifyAuthResult, this, &DefenderAuthorityWrapper::notifyAuthResult); - - connect(this, &DefenderAuthorityWrapper::onModulesActived, m_authority, &DefenderAuthority::onModulesActived); - connect(this, &DefenderAuthorityWrapper::onAuthRequest, m_authority, &DefenderAuthority::checkAuthorization); -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/authority/defenderauthoritywrapper.h b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/authority/defenderauthoritywrapper.h deleted file mode 100644 index 25d75c4..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/authority/defenderauthoritywrapper.h +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2022 ~ 2022 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef AUTHORITYWRAPPER_H -#define AUTHORITYWRAPPER_H - -#include "defenderauthority.h" - -#include -#include -#include -#include - -class DefenderAuthority; - -class DefenderAuthorityWrapper : public QObject -{ - Q_OBJECT - -public: - explicit DefenderAuthorityWrapper(QObject *parent); - ~DefenderAuthorityWrapper(); - - void initConnection(); - -Q_SIGNALS: - // 转发信号 - void notifyAuthStarted(); - void notifyAuthFinished(); - void notifyAuthResult(const QString &moduleName, int id, bool result); - void onAuthRequest(const QString &moduleName, int id); - - void onModulesActived(); - -private: - QThread m_authThread; - DefenderAuthority *m_authority; -}; - -#endif // AUTHORITYWRAPPER_H diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/aes/aes.c b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/aes/aes.c deleted file mode 100644 index ae4b503..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/aes/aes.c +++ /dev/null @@ -1,577 +0,0 @@ -// Copyright (C) 2020 ~ 2022 Uniontech Software Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -/* - -This is an implementation of the AES algorithm, specifically ECB, CTR and CBC mode. -Block size can be chosen in aes.h - available choices are AES128, AES192, AES256. - -The implementation is verified against the test vectors in: - National Institute of Standards and Technology Special Publication 800-38A 2001 ED - -ECB-AES128 ----------- - - plain-text: - 6bc1bee22e409f96e93d7e117393172a - ae2d8a571e03ac9c9eb76fac45af8e51 - 30c81c46a35ce411e5fbc1191a0a52ef - f69f2445df4f9b17ad2b417be66c3710 - - key: - 2b7e151628aed2a6abf7158809cf4f3c - - resulting cipher - 3ad77bb40d7a3660a89ecaf32466ef97 - f5d3d58503b9699de785895a96fdbaaf - 43b1cd7f598ece23881b00e3ed030688 - 7b0c785e27e8ad3f8223207104725dd4 - - -NOTE: String length must be evenly divisible by 16byte (str_len % 16 == 0) - You should pad the end of the string with zeros if this is not the case. - For AES192/256 the key size is proportionally larger. - -*/ - - -/*****************************************************************************/ -/* Includes: */ -/*****************************************************************************/ -#include // CBC mode, for memset -#include "aes.h" - -/*****************************************************************************/ -/* Defines: */ -/*****************************************************************************/ -// The number of columns comprising a state in AES. This is a constant in AES. Value=4 -#define Nb 4 - -#if defined(AES256) && (AES256 == 1) - #define Nk 8 - #define Nr 14 -#elif defined(AES192) && (AES192 == 1) - #define Nk 6 - #define Nr 12 -#else - #define Nk 4 // The number of 32 bit words in a key. - #define Nr 10 // The number of rounds in AES Cipher. -#endif - -// jcallan@github points out that declaring Multiply as a function -// reduces code size considerably with the Keil ARM compiler. -// See this link for more information: https://github.com/kokke/tiny-AES-C/pull/3 -#ifndef MULTIPLY_AS_A_FUNCTION - #define MULTIPLY_AS_A_FUNCTION 0 -#endif - - - - -/*****************************************************************************/ -/* Private variables: */ -/*****************************************************************************/ -// state - array holding the intermediate results during decryption. -typedef uint8_t state_t[4][4]; - - - -// The lookup-tables are marked const so they can be placed in read-only storage instead of RAM -// The numbers below can be computed dynamically trading ROM for RAM - -// This can be useful in (embedded) bootloader applications, where ROM is often limited. -static const uint8_t sbox[256] = { - //0 1 2 3 4 5 6 7 8 9 A B C D E F - 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, - 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, - 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, - 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, - 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, - 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, - 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, - 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, - 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, - 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, - 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, - 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, - 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, - 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, - 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, - 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 }; - -#if (defined(CBC) && CBC == 1) || (defined(ECB) && ECB == 1) -static const uint8_t rsbox[256] = { - 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, - 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, - 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, - 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, - 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, - 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, - 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, - 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, - 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, - 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, - 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, - 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, - 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, - 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, - 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, - 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d }; -#endif - -// The round constant word array, Rcon[i], contains the values given by -// x to the power (i-1) being powers of x (x is denoted as {02}) in the field GF(2^8) -static const uint8_t Rcon[11] = { - 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36 }; - -/* - * Jordan Goulder points out in PR #12 (https://github.com/kokke/tiny-AES-C/pull/12), - * that you can remove most of the elements in the Rcon array, because they are unused. - * - * From Wikipedia's article on the Rijndael key schedule @ https://en.wikipedia.org/wiki/Rijndael_key_schedule#Rcon - * - * "Only the first some of these constants are actually used – up to rcon[10] for AES-128 (as 11 round keys are needed), - * up to rcon[8] for AES-192, up to rcon[7] for AES-256. rcon[0] is not used in AES algorithm." - */ - - -/*****************************************************************************/ -/* Private functions: */ -/*****************************************************************************/ -/* -static uint8_t getSBoxValue(uint8_t num) -{ - return sbox[num]; -} -*/ -#define getSBoxValue(num) (sbox[(num)]) - -// This function produces Nb(Nr+1) round keys. The round keys are used in each round to decrypt the states. -static void KeyExpansion(uint8_t* RoundKey, const uint8_t* Key) -{ - unsigned i, j, k; - uint8_t tempa[4]; // Used for the column/row operations - - // The first round key is the key itself. - for (i = 0; i < Nk; ++i) - { - RoundKey[(i * 4) + 0] = Key[(i * 4) + 0]; - RoundKey[(i * 4) + 1] = Key[(i * 4) + 1]; - RoundKey[(i * 4) + 2] = Key[(i * 4) + 2]; - RoundKey[(i * 4) + 3] = Key[(i * 4) + 3]; - } - - // All other round keys are found from the previous round keys. - for (i = Nk; i < Nb * (Nr + 1); ++i) - { - { - k = (i - 1) * 4; - tempa[0]=RoundKey[k + 0]; - tempa[1]=RoundKey[k + 1]; - tempa[2]=RoundKey[k + 2]; - tempa[3]=RoundKey[k + 3]; - - } - - if (i % Nk == 0) - { - // This function shifts the 4 bytes in a word to the left once. - // [a0,a1,a2,a3] becomes [a1,a2,a3,a0] - - // Function RotWord() - { - const uint8_t u8tmp = tempa[0]; - tempa[0] = tempa[1]; - tempa[1] = tempa[2]; - tempa[2] = tempa[3]; - tempa[3] = u8tmp; - } - - // SubWord() is a function that takes a four-byte input word and - // applies the S-box to each of the four bytes to produce an output word. - - // Function Subword() - { - tempa[0] = getSBoxValue(tempa[0]); - tempa[1] = getSBoxValue(tempa[1]); - tempa[2] = getSBoxValue(tempa[2]); - tempa[3] = getSBoxValue(tempa[3]); - } - - tempa[0] = tempa[0] ^ Rcon[i/Nk]; - } -#if defined(AES256) && (AES256 == 1) - if (i % Nk == 4) - { - // Function Subword() - { - tempa[0] = getSBoxValue(tempa[0]); - tempa[1] = getSBoxValue(tempa[1]); - tempa[2] = getSBoxValue(tempa[2]); - tempa[3] = getSBoxValue(tempa[3]); - } - } -#endif - j = i * 4; k=(i - Nk) * 4; - RoundKey[j + 0] = RoundKey[k + 0] ^ tempa[0]; - RoundKey[j + 1] = RoundKey[k + 1] ^ tempa[1]; - RoundKey[j + 2] = RoundKey[k + 2] ^ tempa[2]; - RoundKey[j + 3] = RoundKey[k + 3] ^ tempa[3]; - } -} - -void AES_init_ctx(struct AES_ctx* ctx, const uint8_t* key) -{ - KeyExpansion(ctx->RoundKey, key); -} -#if (defined(CBC) && (CBC == 1)) || (defined(CTR) && (CTR == 1)) -void AES_init_ctx_iv(struct AES_ctx* ctx, const uint8_t* key, const uint8_t* iv) -{ - KeyExpansion(ctx->RoundKey, key); - memcpy (ctx->Iv, iv, AES_BLOCKLEN); -} -void AES_ctx_set_iv(struct AES_ctx* ctx, const uint8_t* iv) -{ - memcpy (ctx->Iv, iv, AES_BLOCKLEN); -} -#endif - -// This function adds the round key to state. -// The round key is added to the state by an XOR function. -static void AddRoundKey(uint8_t round, state_t* state, const uint8_t* RoundKey) -{ - uint8_t i,j; - for (i = 0; i < 4; ++i) - { - for (j = 0; j < 4; ++j) - { - (*state)[i][j] ^= RoundKey[(round * Nb * 4) + (i * Nb) + j]; - } - } -} - -// The SubBytes Function Substitutes the values in the -// state matrix with values in an S-box. -static void SubBytes(state_t* state) -{ - uint8_t i, j; - for (i = 0; i < 4; ++i) - { - for (j = 0; j < 4; ++j) - { - (*state)[j][i] = getSBoxValue((*state)[j][i]); - } - } -} - -// The ShiftRows() function shifts the rows in the state to the left. -// Each row is shifted with different offset. -// Offset = Row number. So the first row is not shifted. -static void ShiftRows(state_t* state) -{ - uint8_t temp; - - // Rotate first row 1 columns to left - temp = (*state)[0][1]; - (*state)[0][1] = (*state)[1][1]; - (*state)[1][1] = (*state)[2][1]; - (*state)[2][1] = (*state)[3][1]; - (*state)[3][1] = temp; - - // Rotate second row 2 columns to left - temp = (*state)[0][2]; - (*state)[0][2] = (*state)[2][2]; - (*state)[2][2] = temp; - - temp = (*state)[1][2]; - (*state)[1][2] = (*state)[3][2]; - (*state)[3][2] = temp; - - // Rotate third row 3 columns to left - temp = (*state)[0][3]; - (*state)[0][3] = (*state)[3][3]; - (*state)[3][3] = (*state)[2][3]; - (*state)[2][3] = (*state)[1][3]; - (*state)[1][3] = temp; -} - -static uint8_t xtime(uint8_t x) -{ - return ((x<<1) ^ (((x>>7) & 1) * 0x1b)); -} - -// MixColumns function mixes the columns of the state matrix -static void MixColumns(state_t* state) -{ - uint8_t i; - uint8_t Tmp, Tm, t; - for (i = 0; i < 4; ++i) - { - t = (*state)[i][0]; - Tmp = (*state)[i][0] ^ (*state)[i][1] ^ (*state)[i][2] ^ (*state)[i][3] ; - Tm = (*state)[i][0] ^ (*state)[i][1] ; Tm = xtime(Tm); (*state)[i][0] ^= Tm ^ Tmp ; - Tm = (*state)[i][1] ^ (*state)[i][2] ; Tm = xtime(Tm); (*state)[i][1] ^= Tm ^ Tmp ; - Tm = (*state)[i][2] ^ (*state)[i][3] ; Tm = xtime(Tm); (*state)[i][2] ^= Tm ^ Tmp ; - Tm = (*state)[i][3] ^ t ; Tm = xtime(Tm); (*state)[i][3] ^= Tm ^ Tmp ; - } -} - -// Multiply is used to multiply numbers in the field GF(2^8) -// Note: The last call to xtime() is unneeded, but often ends up generating a smaller binary -// The compiler seems to be able to vectorize the operation better this way. -// See https://github.com/kokke/tiny-AES-c/pull/34 -#if MULTIPLY_AS_A_FUNCTION -static uint8_t Multiply(uint8_t x, uint8_t y) -{ - return (((y & 1) * x) ^ - ((y>>1 & 1) * xtime(x)) ^ - ((y>>2 & 1) * xtime(xtime(x))) ^ - ((y>>3 & 1) * xtime(xtime(xtime(x)))) ^ - ((y>>4 & 1) * xtime(xtime(xtime(xtime(x)))))); /* this last call to xtime() can be omitted */ - } -#else -#define Multiply(x, y) \ - ( ((y & 1) * x) ^ \ - ((y>>1 & 1) * xtime(x)) ^ \ - ((y>>2 & 1) * xtime(xtime(x))) ^ \ - ((y>>3 & 1) * xtime(xtime(xtime(x)))) ^ \ - ((y>>4 & 1) * xtime(xtime(xtime(xtime(x)))))) \ - -#endif - -#if (defined(CBC) && CBC == 1) || (defined(ECB) && ECB == 1) -/* -static uint8_t getSBoxInvert(uint8_t num) -{ - return rsbox[num]; -} -*/ -#define getSBoxInvert(num) (rsbox[(num)]) - -// MixColumns function mixes the columns of the state matrix. -// The method used to multiply may be difficult to understand for the inexperienced. -// Please use the references to gain more information. -static void InvMixColumns(state_t* state) -{ - int i; - uint8_t a, b, c, d; - for (i = 0; i < 4; ++i) - { - a = (*state)[i][0]; - b = (*state)[i][1]; - c = (*state)[i][2]; - d = (*state)[i][3]; - - (*state)[i][0] = Multiply(a, 0x0e) ^ Multiply(b, 0x0b) ^ Multiply(c, 0x0d) ^ Multiply(d, 0x09); - (*state)[i][1] = Multiply(a, 0x09) ^ Multiply(b, 0x0e) ^ Multiply(c, 0x0b) ^ Multiply(d, 0x0d); - (*state)[i][2] = Multiply(a, 0x0d) ^ Multiply(b, 0x09) ^ Multiply(c, 0x0e) ^ Multiply(d, 0x0b); - (*state)[i][3] = Multiply(a, 0x0b) ^ Multiply(b, 0x0d) ^ Multiply(c, 0x09) ^ Multiply(d, 0x0e); - } -} - - -// The SubBytes Function Substitutes the values in the -// state matrix with values in an S-box. -static void InvSubBytes(state_t* state) -{ - uint8_t i, j; - for (i = 0; i < 4; ++i) - { - for (j = 0; j < 4; ++j) - { - (*state)[j][i] = getSBoxInvert((*state)[j][i]); - } - } -} - -static void InvShiftRows(state_t* state) -{ - uint8_t temp; - - // Rotate first row 1 columns to right - temp = (*state)[3][1]; - (*state)[3][1] = (*state)[2][1]; - (*state)[2][1] = (*state)[1][1]; - (*state)[1][1] = (*state)[0][1]; - (*state)[0][1] = temp; - - // Rotate second row 2 columns to right - temp = (*state)[0][2]; - (*state)[0][2] = (*state)[2][2]; - (*state)[2][2] = temp; - - temp = (*state)[1][2]; - (*state)[1][2] = (*state)[3][2]; - (*state)[3][2] = temp; - - // Rotate third row 3 columns to right - temp = (*state)[0][3]; - (*state)[0][3] = (*state)[1][3]; - (*state)[1][3] = (*state)[2][3]; - (*state)[2][3] = (*state)[3][3]; - (*state)[3][3] = temp; -} -#endif // #if (defined(CBC) && CBC == 1) || (defined(ECB) && ECB == 1) - -// Cipher is the main function that encrypts the PlainText. -static void Cipher(state_t* state, const uint8_t* RoundKey) -{ - uint8_t round = 0; - - // Add the First round key to the state before starting the rounds. - AddRoundKey(0, state, RoundKey); - - // There will be Nr rounds. - // The first Nr-1 rounds are identical. - // These Nr rounds are executed in the loop below. - // Last one without MixColumns() - for (round = 1; ; ++round) - { - SubBytes(state); - ShiftRows(state); - if (round == Nr) { - break; - } - MixColumns(state); - AddRoundKey(round, state, RoundKey); - } - // Add round key to last round - AddRoundKey(Nr, state, RoundKey); -} - -#if (defined(CBC) && CBC == 1) || (defined(ECB) && ECB == 1) -static void InvCipher(state_t* state, const uint8_t* RoundKey) -{ - uint8_t round = 0; - - // Add the First round key to the state before starting the rounds. - AddRoundKey(Nr, state, RoundKey); - - // There will be Nr rounds. - // The first Nr-1 rounds are identical. - // These Nr rounds are executed in the loop below. - // Last one without InvMixColumn() - for (round = (Nr - 1); ; --round) - { - InvShiftRows(state); - InvSubBytes(state); - AddRoundKey(round, state, RoundKey); - if (round == 0) { - break; - } - InvMixColumns(state); - } - -} -#endif // #if (defined(CBC) && CBC == 1) || (defined(ECB) && ECB == 1) - -/*****************************************************************************/ -/* Public functions: */ -/*****************************************************************************/ -#if defined(ECB) && (ECB == 1) - - -void AES_ECB_encrypt(const struct AES_ctx* ctx, uint8_t* buf) -{ - // The next function call encrypts the PlainText with the Key using AES algorithm. - Cipher((state_t*)buf, ctx->RoundKey); -} - -void AES_ECB_decrypt(const struct AES_ctx* ctx, uint8_t* buf) -{ - // The next function call decrypts the PlainText with the Key using AES algorithm. - InvCipher((state_t*)buf, ctx->RoundKey); -} - - -#endif // #if defined(ECB) && (ECB == 1) - - - - - -#if defined(CBC) && (CBC == 1) - - -static void XorWithIv(uint8_t* buf, const uint8_t* Iv) -{ - uint8_t i; - for (i = 0; i < AES_BLOCKLEN; ++i) // The block in AES is always 128bit no matter the key size - { - buf[i] ^= Iv[i]; - } -} - -void AES_CBC_encrypt_buffer(struct AES_ctx *ctx, uint8_t* buf, size_t length) -{ - size_t i; - uint8_t *Iv = ctx->Iv; - for (i = 0; i < length; i += AES_BLOCKLEN) - { - XorWithIv(buf, Iv); - Cipher((state_t*)buf, ctx->RoundKey); - Iv = buf; - buf += AES_BLOCKLEN; - } - /* store Iv in ctx for next call */ - memcpy(ctx->Iv, Iv, AES_BLOCKLEN); -} - -void AES_CBC_decrypt_buffer(struct AES_ctx* ctx, uint8_t* buf, size_t length) -{ - size_t i; - uint8_t storeNextIv[AES_BLOCKLEN]; - for (i = 0; i < length; i += AES_BLOCKLEN) - { - memcpy(storeNextIv, buf, AES_BLOCKLEN); - InvCipher((state_t*)buf, ctx->RoundKey); - XorWithIv(buf, ctx->Iv); - memcpy(ctx->Iv, storeNextIv, AES_BLOCKLEN); - buf += AES_BLOCKLEN; - } - -} - -#endif // #if defined(CBC) && (CBC == 1) - - - -#if defined(CTR) && (CTR == 1) - -/* Symmetrical operation: same function for encrypting as for decrypting. Note any IV/nonce should never be reused with the same key */ -void AES_CTR_xcrypt_buffer(struct AES_ctx* ctx, uint8_t* buf, size_t length) -{ - uint8_t buffer[AES_BLOCKLEN]; - - size_t i; - int bi; - for (i = 0, bi = AES_BLOCKLEN; i < length; ++i, ++bi) - { - if (bi == AES_BLOCKLEN) /* we need to regen xor compliment in buffer */ - { - - memcpy(buffer, ctx->Iv, AES_BLOCKLEN); - Cipher((state_t*)buffer,ctx->RoundKey); - - /* Increment Iv and handle overflow */ - for (bi = (AES_BLOCKLEN - 1); bi >= 0; --bi) - { - /* inc will overflow */ - if (ctx->Iv[bi] == 255) - { - ctx->Iv[bi] = 0; - continue; - } - ctx->Iv[bi] += 1; - break; - } - bi = 0; - } - - buf[i] = (buf[i] ^ buffer[bi]); - } -} - -#endif // #if defined(CTR) && (CTR == 1) - diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/aes/aes.h b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/aes/aes.h deleted file mode 100644 index 1e34987..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/aes/aes.h +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (C) 2020 ~ 2022 Uniontech Software Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef _AES_H_ -#define _AES_H_ - -#include -#include - -// #define the macros below to 1/0 to enable/disable the mode of operation. -// -// CBC enables AES encryption in CBC-mode of operation. -// CTR enables encryption in counter-mode. -// ECB enables the basic ECB 16-byte block algorithm. All can be enabled simultaneously. - -// The #ifndef-guard allows it to be configured before #include'ing or at compile time. -#ifndef CBC -#define CBC 1 -#endif - -#ifndef ECB -#define ECB 1 -#endif - -#ifndef CTR -#define CTR 1 -#endif - -#define AES128 1 -//#define AES192 1 -//#define AES256 1 - -#define AES_BLOCKLEN 16 // Block length in bytes - AES is 128b block only - -#if defined(AES256) && (AES256 == 1) -#define AES_KEYLEN 32 -#define AES_keyExpSize 240 -#elif defined(AES192) && (AES192 == 1) -#define AES_KEYLEN 24 -#define AES_keyExpSize 208 -#else -#define AES_KEYLEN 16 // Key length in bytes -#define AES_keyExpSize 176 -#endif - -struct AES_ctx { - uint8_t RoundKey[AES_keyExpSize]; -#if (defined(CBC) && (CBC == 1)) || (defined(CTR) && (CTR == 1)) - uint8_t Iv[AES_BLOCKLEN]; -#endif -}; - -void AES_init_ctx(struct AES_ctx *ctx, const uint8_t *key); -#if (defined(CBC) && (CBC == 1)) || (defined(CTR) && (CTR == 1)) -void AES_init_ctx_iv(struct AES_ctx *ctx, const uint8_t *key, const uint8_t *iv); -void AES_ctx_set_iv(struct AES_ctx *ctx, const uint8_t *iv); -#endif - -#if defined(ECB) && (ECB == 1) -// buffer size is exactly AES_BLOCKLEN bytes; -// you need only AES_init_ctx as IV is not used in ECB -// NB: ECB is considered insecure for most uses -void AES_ECB_encrypt(const struct AES_ctx *ctx, uint8_t *buf); -void AES_ECB_decrypt(const struct AES_ctx *ctx, uint8_t *buf); - -#endif // #if defined(ECB) && (ECB == !) - -#if defined(CBC) && (CBC == 1) -// buffer size MUST be mutile of AES_BLOCKLEN; -// Suggest https://en.wikipedia.org/wiki/Padding_(cryptography)#PKCS7 for padding scheme -// NOTES: you need to set IV in ctx via AES_init_ctx_iv() or AES_ctx_set_iv() -// no IV should ever be reused with the same key -void AES_CBC_encrypt_buffer(struct AES_ctx *ctx, uint8_t *buf, size_t length); -void AES_CBC_decrypt_buffer(struct AES_ctx *ctx, uint8_t *buf, size_t length); - -#endif // #if defined(CBC) && (CBC == 1) - -#if defined(CTR) && (CTR == 1) - -// Same function for encrypting as for decrypting. -// IV is incremented for every block, and used after encryption as XOR-compliment for output -// Suggesting https://en.wikipedia.org/wiki/Padding_(cryptography)#PKCS7 for padding scheme -// NOTES: you need to set IV in ctx with AES_init_ctx_iv() or AES_ctx_set_iv() -// no IV should ever be reused with the same key -void AES_CTR_xcrypt_buffer(struct AES_ctx *ctx, uint8_t *buf, size_t length); - -#endif // #if defined(CTR) && (CTR == 1) - -#endif // _AES_H_ diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/aes/aes.hpp b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/aes/aes.hpp deleted file mode 100644 index 7308d53..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/aes/aes.hpp +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (C) 2020 ~ 2022 Uniontech Software Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef _AES_HPP_ -#define _AES_HPP_ - -#ifndef __cplusplus -#error Do not include the hpp header in a c project! -#endif //__cplusplus - -extern "C" { -#include "aes.h" -} - -#endif //_AES_HPP_ diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/aes/aesencrpyobj.cpp b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/aes/aesencrpyobj.cpp deleted file mode 100644 index 33fd106..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/aes/aesencrpyobj.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (C) 2020 ~ 2022 Uniontech Software Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "aesencrpyobj.h" - -AesEncrpyObj::AesEncrpyObj(QObject *parent) - : QObject(parent) - , m_ctx() -{ -} - -void AesEncrpyObj::initKey() -{ - uint8_t key[] = {0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c}; - AES_init_ctx(&m_ctx, key); -} - -QByteArray AesEncrpyObj::encryptData(const QByteArray &strData) -{ - QByteArray byOrigData = strData; - QByteArrayList byList; - QByteArray byEncrypt; - - while (byOrigData.size() >= AES_BLOCKLEN) { - QByteArray byTemp = byOrigData.left(AES_BLOCKLEN); - byList.push_back(byTemp); - byOrigData = byOrigData.remove(0, AES_BLOCKLEN); - } - - //进行补足AES_BLOCKLEN的操作 - if (byOrigData.size() > 0) { - QByteArray byTemp = QByteArray::fromStdString(byOrigData.toStdString()); - int iCount = AES_BLOCKLEN - byTemp.size(); - byTemp += QByteArray(iCount, ' '); - byList.push_back(byTemp); - byOrigData.clear(); - } - - foreach (QByteArray byData, byList) { - u_int8_t buf[AES_BLOCKLEN] = {0}; - memcpy(buf, (u_int8_t *)byData.constData(), AES_BLOCKLEN); - AES_ECB_encrypt(&m_ctx, buf); - byEncrypt += QByteArray((char *)buf, AES_BLOCKLEN); - } - - return byEncrypt; -} - -QByteArray AesEncrpyObj::decryptData(const QByteArray &byData) -{ - QByteArrayList byList; - QByteArray byOrigData = byData; - QByteArray byDecrypt; - - while (byOrigData.size() >= AES_BLOCKLEN) { - QByteArray byTemp = byOrigData.left(AES_BLOCKLEN); - byList.push_back(byTemp); - byOrigData = byOrigData.remove(0, AES_BLOCKLEN); - } - - //进行补足AES_BLOCKLEN的操作 - if (byOrigData.size() > 0) { - QByteArray byTemp = QByteArray::fromStdString(byOrigData.toStdString()); - int iCount = AES_BLOCKLEN - byTemp.size(); - byTemp += QByteArray(iCount, ' '); - byList.push_back(byTemp); - byOrigData.clear(); - } - - foreach (QByteArray byData, byList) { - u_int8_t buf[AES_BLOCKLEN] = {0}; - memcpy(buf, (u_int8_t *)byData.constData(), AES_BLOCKLEN); - AES_ECB_decrypt(&m_ctx, buf); - byDecrypt += QByteArray((char *)buf, AES_BLOCKLEN); - } - - return byDecrypt.trimmed(); -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/aes/aesencrpyobj.h b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/aes/aesencrpyobj.h deleted file mode 100644 index 7120263..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/aes/aesencrpyobj.h +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (C) 2020 ~ 2022 Uniontech Software Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef AESENCRPYOBJ_H -#define AESENCRPYOBJ_H - -#include "aes.hpp" - -#include - -class AesEncrpyObj : public QObject -{ - Q_OBJECT -public: - explicit AesEncrpyObj(QObject *parent = nullptr); - -public: - void initKey(); - QByteArray encryptData(const QByteArray &strData); - QByteArray decryptData(const QByteArray &byData); - -private: - struct AES_ctx m_ctx; -}; - -#endif // AESENCRPYOBJ_H diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/defenderprocinfo.cpp b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/defenderprocinfo.cpp deleted file mode 100644 index 9a15420..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/defenderprocinfo.cpp +++ /dev/null @@ -1,40 +0,0 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "defenderprocinfo.h" - -bool DefenderProcInfo::operator!=(const DefenderProcInfo &procInfo) -{ - return !(this->nPid == procInfo.nPid); -} - -QDBusArgument &operator<<(QDBusArgument &argument, const DefenderProcInfo &procInfo) -{ - argument.beginStructure(); - argument << procInfo.nPid << procInfo.sExecPath << procInfo.isbSysApp << procInfo.sProcName - << procInfo.sDesktopPath << procInfo.sPkgName << procInfo.sAppName << procInfo.sThemeIcon - << procInfo.sID << procInfo.nCategoryID << procInfo.nTimeInstalled - << procInfo.sTimeyMdh << procInfo.dDownloadSpeed << procInfo.dUploadSpeed << procInfo.dDownloads << procInfo.dUploads - << procInfo.sStatus << procInfo.sDefaultStatus << procInfo.sOtherParam; - argument.endStructure(); - return argument; -} - -const QDBusArgument &operator>>(const QDBusArgument &argument, DefenderProcInfo &procInfo) -{ - argument.beginStructure(); - argument >> procInfo.nPid >> procInfo.sExecPath >> procInfo.isbSysApp >> procInfo.sProcName - >> procInfo.sDesktopPath >> procInfo.sPkgName >> procInfo.sAppName >> procInfo.sThemeIcon - >> procInfo.sID >> procInfo.nCategoryID >> procInfo.nTimeInstalled - >> procInfo.sTimeyMdh >> procInfo.dDownloadSpeed >> procInfo.dUploadSpeed >> procInfo.dDownloads >> procInfo.dUploads - >> procInfo.sStatus >> procInfo.sDefaultStatus >> procInfo.sOtherParam; - argument.endStructure(); - return argument; -} - -void registerDefenderProcInfoMetaType() -{ - qRegisterMetaType("DefenderProcInfo"); - qDBusRegisterMetaType(); -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/defenderprocinfo.h b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/defenderprocinfo.h deleted file mode 100644 index 6d4b695..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/defenderprocinfo.h +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef DEFENDERPROCINFO_H -#define DEFENDERPROCINFO_H - -#include -#include -#include -#include - -struct DefenderProcInfo { - int nPid; - QString sExecPath; // 执行路径 - bool isbSysApp; // 是否是系统应用 - QString sProcName; // 进程名 - // 启动器应用信息 - QString sDesktopPath; // 桌面文件路径 - QString sPkgName; // 包名 - QString sAppName; // 应用名 - QString sThemeIcon; // 图标路径 - QString sID; // 启动器中对应应用id - qint64 nCategoryID; // 启动器中分类id - qint64 nTimeInstalled; // 安装时间 - // 流量信息 - QString sTimeyMdh; // 流量信息时间 - double dDownloadSpeed; // 下载速度 - double dUploadSpeed; // 上传速度 - double dDownloads; // 下载量 - double dUploads; // 上传量 - - // 联网管控信息 - QString sStatus; // 状态 询问/允许/禁止 - QString sDefaultStatus; // 默认状态 - - // 其他参数 - QString sOtherParam; - bool operator!=(const DefenderProcInfo &procInfo); - // 初始化 - DefenderProcInfo() { - nPid = 0; - isbSysApp = false; - nCategoryID = 0; - nTimeInstalled = 0; - dDownloadSpeed = 0.0; - dUploadSpeed = 0.0; - dDownloads = 0.0; - dUploads = 0.0; - } -}; - -Q_DECLARE_METATYPE(DefenderProcInfo); - -QDBusArgument &operator<<(QDBusArgument &argument, const DefenderProcInfo &procInfo); -const QDBusArgument &operator>>(const QDBusArgument &argument, DefenderProcInfo &procInfo); - -void registerDefenderProcInfoMetaType(); -#endif diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/defenderprocinfolist.cpp b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/defenderprocinfolist.cpp deleted file mode 100644 index ceaf089..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/defenderprocinfolist.cpp +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "defenderprocinfolist.h" - -void registerDefenderProcInfoListMetaType() -{ - qRegisterMetaType("DefenderProcInfoList"); - qDBusRegisterMetaType(); -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/defenderprocinfolist.h b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/defenderprocinfolist.h deleted file mode 100644 index c8cb524..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/defenderprocinfolist.h +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef DEFENDERPROCINFOLIST_H -#define DEFENDERPROCINFOLIST_H - -#include "defenderprocinfo.h" - -typedef QList DefenderProcInfoList; -Q_DECLARE_METATYPE(DefenderProcInfoList); - -void registerDefenderProcInfoListMetaType(); -#endif diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/systemmessagehelper.cpp b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/systemmessagehelper.cpp deleted file mode 100644 index 07e3208..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/systemmessagehelper.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (C) 2019 ~ 2022 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "systemmessagehelper.h" - -#include -#include - -SystemMessageHelper::SystemMessageHelper(QObject *parent) - : QObject(parent) -{ -} - -void SystemMessageHelper::createMessageForAVEngineExpiredInDays(const QString &engineName, int days) -{ - // 提示时间为0-6天 - // 第0天是否过期在调用处判断 - if (engineName.isEmpty() || days < 0 || days >= 7) { - return; - } - - QString notifyInfo = tr("The %1 antivirus engine service will expire in %2 days. After the expiration, files in the quarantine list cannot be restored. Please restore them in time if you want."); - notifyInfo = notifyInfo.arg(engineName).arg(days); - - // 跳转到安全中心的dbus调用 - QString jumpToAVWidget = QString("qdbus,com.deepin.pc.manager," - "/com/deepin/pc/manager," - "com.deepin.pc.manager.ShowModule," - "virusscan"); - - QDBusMessage m = QDBusMessage::createMethodCall("com.deepin.dde.Notification", - "/com/deepin/dde/Notification", - "com.deepin.dde.Notification", - "Notify"); - QStringList action; - action << "_open1" << tr("View", "button"); //添加按钮 - QVariantMap inform; //按钮的点击操作 - inform.insert(QString("x-deepin-action-_open1"), jumpToAVWidget); - - m << QString("deepin-defender") - << uint(0) - << QString("deepin-defender") - << QString("") << notifyInfo - << action - << inform - << int(10 * 1000); // 停留10秒 - QDBusMessage respone = QDBusConnection::sessionBus().call(m); -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/systemmessagehelper.h b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/systemmessagehelper.h deleted file mode 100644 index 6192678..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/systemmessagehelper.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (C) 2019 ~ 2022 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef SYSTEMMESSAGEHELPER_H -#define SYSTEMMESSAGEHELPER_H - -#include - -class SystemMessageHelper : public QObject -{ - Q_OBJECT -public: - explicit SystemMessageHelper(QObject *parent = nullptr); - - static void createMessageForAVEngineExpiredInDays(const QString &, int days); -}; - -#endif // SYSTEMMESSAGEHELPER_H diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/trashcleanappinfo.cpp b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/trashcleanappinfo.cpp deleted file mode 100644 index a28c48d..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/trashcleanappinfo.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "trashcleanappinfo.h" - -QDBusArgument &operator<<(QDBusArgument &argument, const TrashCleanAppInfo &appInfo) -{ - argument.beginStructure(); - argument << appInfo.isUnistalled << appInfo.appPkgName << appInfo.appDisplayName - << appInfo.appConfigPaths << appInfo.appCachePaths; - argument.endStructure(); - return argument; -} - -const QDBusArgument &operator>>(const QDBusArgument &argument, TrashCleanAppInfo &appInfo) -{ - argument.beginStructure(); - argument >> appInfo.isUnistalled >> appInfo.appPkgName >> appInfo.appDisplayName - >> appInfo.appConfigPaths >> appInfo.appCachePaths; - argument.endStructure(); - return argument; -} - -void registerTrashCleanAppInfoMetaType() -{ - qRegisterMetaType("TrashCleanAppInfo"); - qDBusRegisterMetaType(); -} - -void registerTrashCleanAppInfoListMetaType() -{ - qRegisterMetaType("TrashCleanAppInfoList"); - qDBusRegisterMetaType(); -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/trashcleanappinfo.h b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/trashcleanappinfo.h deleted file mode 100644 index ab019d3..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/common/trashcleanappinfo.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef TRASHCLEANAPPINFO_H -#define TRASHCLEANAPPINFO_H - -#include -#include -#include -#include - -struct TrashCleanAppInfo { - bool isUnistalled; - QString appPkgName; - QString appDisplayName; - QString appConfigPaths; - QString appCachePaths; - TrashCleanAppInfo() - { - isUnistalled = false; - appPkgName = ""; - appDisplayName = ""; - appConfigPaths = ""; - appCachePaths = ""; - } - bool operator!=(TrashCleanAppInfo &other) - { - return this->appPkgName != other.appPkgName; - } -}; - -QDBusArgument &operator<<(QDBusArgument &argument, const TrashCleanAppInfo &procInfo); -const QDBusArgument &operator>>(const QDBusArgument &argument, TrashCleanAppInfo &procInfo); -Q_DECLARE_METATYPE(TrashCleanAppInfo); -void registerTrashCleanAppInfoMetaType(); - -typedef QList TrashCleanAppInfoList; -Q_DECLARE_METATYPE(TrashCleanAppInfoList); -void registerTrashCleanAppInfoListMetaType(); - -#endif // TRASHCLEANAPPINFO_H diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/config/securitytooldialog/com.deepin.pc.manager.securitytooldialog.service b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/config/securitytooldialog/com.deepin.pc.manager.securitytooldialog.service deleted file mode 100644 index 5aa44fd..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/config/securitytooldialog/com.deepin.pc.manager.securitytooldialog.service +++ /dev/null @@ -1,3 +0,0 @@ -[D-BUS Service] -Name=com.deepin.pc.manager.securitytooldialog -Exec=/usr/bin/deepin-pc-manager-session-daemon diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/hoverballs/hoverballsdlg.cpp b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/hoverballs/hoverballsdlg.cpp deleted file mode 100644 index af91a18..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/hoverballs/hoverballsdlg.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later -#include "hoverballsdlg.h" - -#include - -HoverBallsDlg::HoverBallsDlg(QWidget *parent) - : DAbstractDialog(parent) - , m_waterProgress(nullptr) -{ - setWindowFlags(Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint |Qt::FramelessWindowHint | Qt::Dialog); - setAttribute(Qt::WA_TranslucentBackground); - // 初始化界面 - initUI(); -} - - -void HoverBallsDlg::initUI() -{ - // 主布局 - QVBoxLayout *layout = new QVBoxLayout(this); - layout->setContentsMargins(0, 0, 0, 0); - layout->setSpacing(0); - - // 悬浮球 - m_waterProgress = new HoverBallsProgress(this); - m_waterProgress->start(); - m_waterProgress->setValue(50); - m_waterProgress->setFixedSize(QSize(50, 50)); - layout->addWidget(m_waterProgress); -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/hoverballs/hoverballsprogress.cpp b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/hoverballs/hoverballsprogress.cpp deleted file mode 100644 index 8698fd2..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/hoverballs/hoverballsprogress.cpp +++ /dev/null @@ -1,389 +0,0 @@ -// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: LGPL-3.0-or-later - -#include "hoverballsprogress.h" -#include "window/modules/common/compixmap.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -DCORE_USE_NAMESPACE -DGUI_USE_NAMESPACE -DWIDGET_BEGIN_NAMESPACE - -struct Pop { - Pop(double s, double xs, double ys): - size(s), xSpeed(xs), ySpeed(ys) {} - - double size; - double xSpeed; - double ySpeed; - double xOffset = 0.0; - double yOffset = 0.0; -}; - -class HoverBallsProgressPrivate: public DTK_CORE_NAMESPACE::DObjectPrivate -{ -public: - HoverBallsProgressPrivate(HoverBallsProgress *parent): DObjectPrivate(parent) - { - pops.append(Pop(7, -1.8, 0.6)); - pops.append(Pop(8, 1.2, 1.0)); - pops.append(Pop(11, 0.8, 1.6)); - } - - void resizePixmap(QSize sz); - void initUI(); - void setValue(int v); - void paint(QPainter *p); - - QImage waterFrontImage; - QImage waterBackImage; - QString progressText; - QTimer *timer = Q_NULLPTR; - QList pops; - - int interval = 33; - int value = -1; - - double frontXOffset = 0; - double backXOffset = 0; - - bool textVisible = true; - - D_DECLARE_PUBLIC(HoverBallsProgress) -}; - - -HoverBallsProgress::HoverBallsProgress(QWidget *parent) : - QWidget(parent), DObject(*new HoverBallsProgressPrivate(this)) -{ - D_D(HoverBallsProgress); - d->initUI(); - - // apply effect - auto effect = new QGraphicsDropShadowEffect(this); - effect->setOffset(0, 6); - effect->setColor(QColor(1, 153, 248, 255 * 5 / 20)); - effect->setBlurRadius(12); - this->setGraphicsEffect(effect); -} - -HoverBallsProgress::~HoverBallsProgress() -{ - -} - -/*! -@~english - @brief get the current progress value - */ -int HoverBallsProgress::value() const -{ - D_DC(HoverBallsProgress); - return d->value; -} - -/*! -@~english - @brief star water animation. - */ -void HoverBallsProgress::start() -{ - D_DC(HoverBallsProgress); - d->timer->start(); -} - -/*! -@~english - @brief stop water animation. - */ -void HoverBallsProgress::stop() -{ - D_DC(HoverBallsProgress); - d->timer->stop(); -} - -/*! -@~english - @brief set the current progress - @param[in] value (range: 0~100) - */ -void HoverBallsProgress::setValue(int value) -{ - D_D(HoverBallsProgress); - if (d->value == value) { - return; - } - d->setValue(value); - Q_EMIT valueChanged(); -} - -/*! -@~english - @brief set progress text is visible or not - @param[in] visible set the progress text value is visible or not(like 50% when value is 50) - */ -void HoverBallsProgress::setTextVisible(bool visible) -{ - D_D(HoverBallsProgress); - d->textVisible = visible; -} - -void HoverBallsProgress::paintEvent(QPaintEvent *) -{ - D_D(HoverBallsProgress); - QPainter p(this); - d->paint(&p); -} - -void HoverBallsProgress::changeEvent(QEvent *e) -{ - if (e->type() == QEvent::PaletteChange) { - D_D(HoverBallsProgress); - d->waterBackImage = QImage(); - d->waterFrontImage = QImage(); - } - - return QWidget::changeEvent(e); -} - -void HoverBallsProgressPrivate::resizePixmap(QSize sz) -{ - // resize water; - auto waterWidth = 500 * sz.width() / 100; - auto waterHeight = 110 * sz.height() / 100; - auto waterSize = QSizeF(waterWidth, waterHeight).toSize(); - - if (waterFrontImage.size() != waterSize) { - QIcon renderer = DIconTheme::findQIcon("water_blue_front"); - //QIcon renderer = QIcon::fromTheme("water_yellow_front"); - //QIcon renderer = QIcon::fromTheme("water_red_front"); - QImage image(waterWidth, waterHeight, QImage::Format_ARGB32); - image.fill(Qt::transparent); // partly transparent red-ish background - QPainter waterPainter(&image); - renderer.paint(&waterPainter, image.rect()); - waterFrontImage = image; - } - if (waterBackImage.size() != waterSize) { - QIcon renderer = DIconTheme::findQIcon("water_blue_back"); - //QIcon renderer = QIcon::fromTheme("water_yellow_back"); - //QIcon renderer = QIcon::fromTheme("water_red_back"); - QImage image(waterWidth, waterHeight, QImage::Format_ARGB32); - image.fill(Qt::transparent); // partly transparent red-ish background - QPainter waterPainter(&image); - renderer.paint(&waterPainter, image.rect()); - waterBackImage = image; - } -} - -void HoverBallsProgressPrivate::initUI() -{ - D_Q(HoverBallsProgress); - q->setMinimumSize(100, 100); - - timer = new QTimer(q); - timer->setInterval(interval); - resizePixmap(q->size()); - frontXOffset = q->width(); - backXOffset = 0; - - q->connect(timer, &QTimer::timeout, q, [ = ] { - // interval can not be zero, and limit to 1 - interval = (interval < 1) ? 1 : interval; - - // move 60% per second - double frontXDeta = 40.0 / (1000.0 / interval); - // move 90% per second - double backXDeta = 60.0 / (1000.0 / interval); - - int canvasWidth = static_cast(q->width() * q->devicePixelRatioF()); - frontXOffset -= frontXDeta *canvasWidth / 100; - backXOffset += backXDeta *canvasWidth / 100; - - if (frontXOffset > canvasWidth) - { - frontXOffset = canvasWidth; - } - if (frontXOffset < - (waterFrontImage.width() - canvasWidth)) - { - frontXOffset = canvasWidth; - } - - if (backXOffset > waterBackImage.width()) - { - backXOffset = 0; - } - - // update pop - // move 25% per second default - double speed = 25 / (1000.0 / interval) /** 100 / q->height()*/; - for (auto &pop : pops) - { - // yOffset 0 ~ 100; - pop.yOffset += speed * pop.ySpeed; - if (pop.yOffset < 0) { - } - if (pop.yOffset > value) { - pop.yOffset = 0; - } - pop.xOffset = qSin((pop.yOffset / 100) * 2 * 3.14) * 18 * pop.xSpeed + 50; - } - q->update(); - }); -} - -void HoverBallsProgressPrivate::setValue(int v) -{ - value = v; - progressText = QString("%1").arg(v); -} - -void HoverBallsProgressPrivate::paint(QPainter *p) -{ - D_Q(HoverBallsProgress); - p->setRenderHint(QPainter::Antialiasing); - - qreal pixelRatio = q->devicePixelRatioF(); - QRectF rect = QRectF(0, 0, q->width() * pixelRatio, q->height() * pixelRatio); - QSize sz = QSizeF(q->width() * pixelRatio, q->height() * pixelRatio).toSize(); - - resizePixmap(sz); - - int yOffset = rect.toRect().topLeft().y() + (100 - value - 10) * sz.height() / 100; - - // draw water - QImage waterImage = QImage(sz, QImage::Format_ARGB32_Premultiplied); - QPainter waterPinter(&waterImage); - waterPinter.setRenderHint(QPainter::Antialiasing); - waterPinter.setCompositionMode(QPainter::CompositionMode_Source); - - QPointF pointStart(sz.width() / 2, 0); - QPointF pointEnd(sz.width() / 2, sz.height()); - QLinearGradient linear(pointStart, pointEnd); - QColor startColor("#1F08FF"); - //QColor startColor("#DC4001"); - //QColor startColor("#FF0202"); - startColor.setAlphaF(1); - QColor endColor("#50FFF7"); - //QColor endColor("#FFFC6E"); - //QColor endColor("#E1A00D"); - endColor.setAlphaF(0.28); - linear.setColorAt(0, startColor); - linear.setColorAt(1, endColor); - linear.setSpread(QGradient::PadSpread); - waterPinter.setPen(Qt::NoPen); - waterPinter.setBrush(linear); - waterPinter.drawEllipse(waterImage.rect().center(), sz.width() / 2 + 1, sz.height() / 2 + 1); - - waterPinter.setCompositionMode(QPainter::CompositionMode_SourceOver); - waterPinter.drawImage(static_cast(backXOffset), yOffset, waterBackImage); - waterPinter.drawImage(static_cast(backXOffset) - waterBackImage.width(), yOffset, waterBackImage); - waterPinter.drawImage(static_cast(frontXOffset), yOffset, waterFrontImage); - waterPinter.drawImage(static_cast(frontXOffset) - waterFrontImage.width(), yOffset, waterFrontImage); - - //drwa pop - if (value > 30) { - for (auto &pop : pops) { - QPainterPath popPath; - popPath.addEllipse(pop.xOffset * sz.width() / 100, (100 - pop.yOffset) * sz.height() / 100, - pop.size * sz.width() / 100, pop.size * sz.height() / 100); - QColor color(255, 255, 255, 255 * 0.3); - waterPinter.fillPath(popPath, color); - } - } - - if (textVisible) { - auto font = waterPinter.font(); - - QRect rectValue; - QSize fontTextSize; - int actual_width; - int actual_height; - if (progressText == "100") { - font.setPixelSize(sz.height() * 35 / 100); - waterPinter.setFont(font); - - fontTextSize = QFontMetrics(font).size(Qt::TextSingleLine | Qt::AlignCenter, progressText); - int design_width = sz.width() * 60 / 100; - int design_height = sz.height() * 35 / 100; - actual_width = qMax(fontTextSize.width(), design_width); - actual_height = qMax(fontTextSize.height(), design_height); - - rectValue.setWidth(actual_width); - rectValue.setHeight(actual_height); - rectValue.moveCenter(rect.center().toPoint()); - waterPinter.setPen(Qt::white); - waterPinter.drawText(rectValue, Qt::AlignCenter, progressText); - - } else { - font.setPixelSize(sz.height() * 40 / 100); - waterPinter.setFont(font); - - QFontMetrics numberFontMetrics(font); - fontTextSize = numberFontMetrics.size(Qt::TextSingleLine | Qt::AlignCenter, progressText); - int design_width = sz.width() * 45 / 100; - int design_height = sz.height() * 40 / 100; - actual_width = qMax(fontTextSize.width(), design_width); - actual_height = qMax(fontTextSize.height(), design_height); - - rectValue.setWidth(actual_width); - rectValue.setHeight(actual_height); - rectValue.moveCenter(rect.center().toPoint()); - rectValue.moveLeft(rect.left() + rect.width() * 0.45 * 0.5); - - waterPinter.setPen(Qt::white); - waterPinter.drawText(rectValue, Qt::AlignCenter, progressText); - font.setPixelSize(font.pixelSize() / 2); - waterPinter.setFont(font); - - QFontMetrics ratioFontMetrics(font); - design_height = rect.height() * 20 / 100; - actual_height = qMax(ratioFontMetrics.height(), design_height); - int descent_diff = numberFontMetrics.descent() - ratioFontMetrics.descent(); - - QRect rectPerent(QPoint(rectValue.right(), rectValue.bottom() - descent_diff - actual_height), - QPoint(rectValue.right() + rect.width() * 20 / 100, rectValue.bottom() - descent_diff)); - - waterPinter.drawText(rectPerent, Qt::AlignCenter, "%"); - } - } - waterPinter.end(); - - QPixmap maskPixmap(sz); - maskPixmap.fill(Qt::transparent); - QPainterPath path; - path.addEllipse(QRectF(0, 0, sz.width(), sz.height())); - QPainter maskPainter(&maskPixmap); - maskPainter.setRenderHint(QPainter::Antialiasing); - maskPainter.setPen(QPen(Qt::white, 1)); - maskPainter.fillPath(path, QBrush(Qt::white)); - - QPainter::CompositionMode mode = QPainter::CompositionMode_SourceIn; - QImage contentImage = QImage(sz, QImage::Format_ARGB32_Premultiplied); - QPainter contentPainter(&contentImage); - contentPainter.setCompositionMode(QPainter::CompositionMode_Source); - contentPainter.fillRect(contentImage.rect(), Qt::transparent); - contentPainter.setCompositionMode(QPainter::CompositionMode_SourceOver); - contentPainter.drawImage(0, 0, maskPixmap.toImage()); - contentPainter.setCompositionMode(mode); - contentPainter.drawImage(0, 0, waterImage); - contentPainter.setCompositionMode(QPainter::CompositionMode_DestinationOver); - contentPainter.end(); - - contentImage.setDevicePixelRatio(pixelRatio); - p->drawImage(q->rect(), contentImage); -} - -DWIDGET_END_NAMESPACE diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/hoverballs/hoverballsprogress.h b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/hoverballs/hoverballsprogress.h deleted file mode 100644 index 5d748ee..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/hoverballs/hoverballsprogress.h +++ /dev/null @@ -1,47 +0,0 @@ -// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: LGPL-3.0-or-later - -#ifndef HOVERBALLSPROGRESS_H -#define HOVERBALLSPROGRESS_H - -#include -#include - -#include -#include - -DWIDGET_BEGIN_NAMESPACE - -class HoverBallsProgressPrivate; -class LIBDTKWIDGETSHARED_EXPORT HoverBallsProgress : public QWidget, public DTK_CORE_NAMESPACE::DObject -{ - Q_OBJECT - - Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged) -public: - explicit HoverBallsProgress(QWidget *parent = 0); - ~HoverBallsProgress(); - - int value() const; - -Q_SIGNALS: - void valueChanged(); - -public Q_SLOTS: - void start(); - void stop(); - void setValue(int value); - void setTextVisible(bool visible); - -protected: - void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE; - void changeEvent(QEvent *e) override; - -private: - D_DECLARE_PRIVATE(HoverBallsProgress) -}; - -DWIDGET_END_NAMESPACE - -#endif // HOVERBALLSPROGRESS_H diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/defsecuritytoolsmnd.cpp b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/defsecuritytoolsmnd.cpp deleted file mode 100644 index 74c803f..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/defsecuritytoolsmnd.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "defsecuritytoolsmnd.h" - -#include - -#include -#include -#include -#include - -DefSecurityToolsMnd::DefSecurityToolsMnd(QWidget *pWidget) - : DMainWindow(pWidget) -{ - initUI(); -} - -DefSecurityToolsMnd::~DefSecurityToolsMnd() { } - -void DefSecurityToolsMnd::addContent(QWidget *pWidget) -{ - QWidget *pCenterWidget = this->centralWidget(); - QHBoxLayout *pInnerLayout = qobject_cast(pCenterWidget->layout()); - pInnerLayout->addWidget(pWidget); -} - -void DefSecurityToolsMnd::initUI() -{ - DTitlebar *pToolBar = titlebar(); - pToolBar->setMenuVisible(false); - QHBoxLayout *pInnerLayout = new QHBoxLayout; - pInnerLayout->setContentsMargins(20, 20, 20, 20); - QWidget *pWidget = new QWidget(this); - pWidget->setAccessibleName("DefSecurityToolsMnd_centerWidget"); - pWidget->setLayout(pInnerLayout); - setCentralWidget(pWidget); - setWindowFlags(Qt::Dialog); -} - -void DefSecurityToolsMnd::moveToCenter() -{ - QScreen *pScreen = QGuiApplication::primaryScreen(); - QPoint ptCenter = pScreen->geometry().center(); - QRect rc = geometry(); - rc.moveCenter(ptCenter); - setGeometry(rc); -} - -void DefSecurityToolsMnd::showEvent(QShowEvent *event) -{ - DMainWindow::showEvent(event); - moveToCenter(); -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/defsecuritytoolsmnd.h b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/defsecuritytoolsmnd.h deleted file mode 100644 index 84f4984..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/defsecuritytoolsmnd.h +++ /dev/null @@ -1,30 +0,0 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef DEFSECURITYTOOLSMND_H -#define DEFSECURITYTOOLSMND_H - -#include - -DWIDGET_USE_NAMESPACE - -class DefSecurityToolsMnd : public DMainWindow -{ - Q_OBJECT -public: - explicit DefSecurityToolsMnd(QWidget *pWidget = nullptr); - virtual ~DefSecurityToolsMnd() override; - -protected: - void addContent(QWidget *pWidget); - void moveToCenter(); - -protected: - virtual void showEvent(QShowEvent *event) override; - -private: - void initUI(); -}; - -#endif // DEFSECURITYTOOLSMND_H diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytoolbackend/defsecuritytoolsbuslinemgr.cpp b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytoolbackend/defsecuritytoolsbuslinemgr.cpp deleted file mode 100644 index 41c3a85..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytoolbackend/defsecuritytoolsbuslinemgr.cpp +++ /dev/null @@ -1,522 +0,0 @@ -// Copyright (C) 2020 ~ 2022 Uniontech Software Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "defsecuritytoolsbuslinemgr.h" - -#include "../../deepin-pc-manager/src/window/modules/common/gsettingkey.h" -#include "../../deepin-pc-manager/src/window/modules/common/invokers/invokerfactory.h" -#include "window/modules/common/aes/aesencrpyobj.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#define DEFENDER_DATA_DIR_PATH "/usr/share/deepin-pc-manager/" // 数据库路径 - -DefToolAuthorityCheckObj::DefToolAuthorityCheckObj(QObject *pParent) - : QObject(pParent) -{ -} - -DefToolAuthorityCheckObj::~DefToolAuthorityCheckObj() { } - -DefSecurityToolsBusLineMgr::DefSecurityToolsBusLineMgr(QObject *pParent) - : QObject(pParent) - , m_pAuthorityCheckObj(nullptr) - , m_pManagerInter(nullptr) - , m_bLoad(false) - , m_gSettingsInvokerInter(nullptr) - , m_isSecEnhanceSrvValid(false) - , m_isResourceManagerValid(false) -{ - m_pManagerInter = - InvokerFactory::GetInstance().CreateInvoker("com.home.appstore.daemon", - "/appstore", - "com.home.appstore.daemon.interface", - ConnectType::SYSTEM, - this); - m_gSettingsInvokerInter = - InvokerFactory::GetInstance().CreateSettings(DEEPIN_PC_MANAGER_GSETTING_PATH, "", this); -} - -DefSecurityToolsBusLineMgr::~DefSecurityToolsBusLineMgr() -{ - if (!m_pAuthorityCheckObj) { - m_pAuthorityCheckObj->deleteLater(); - m_pAuthorityCheckObj = nullptr; - } -} - -void DefSecurityToolsBusLineMgr::setAutorityCheckObj(DefToolAuthorityCheckObj *pObj) -{ - m_pAuthorityCheckObj = pObj; -} - -void DefSecurityToolsBusLineMgr::installPackage(const QString &strPackageKey) -{ - if (!hasAutority()) { - return; - } - - if (!isInit()) { - init(); - } - - if (!isInit()) { - Q_EMIT notifyAppStatusChanged(strPackageKey, DEFSECURITYTOOLSTATUS::INSTALLFAILED); - return; - } - - if (!hasInstaller(strPackageKey)) { - Q_EMIT notifyAppStatusChanged(strPackageKey, DEFSECURITYTOOLSTATUS::INSTALLFAILED); - return; - } - - DefSecurityToolsBaseInstaller *pInstaller = getInstaller(strPackageKey); - - if (pInstaller) { - QObject::connect(pInstaller, - &DefSecurityToolsBaseInstaller::sAppStatusChanged, - this, - &DefSecurityToolsBusLineMgr::onAppStatusChanged); - pInstaller->installPackage(); - } else { - Q_EMIT notifyAppStatusChanged(strPackageKey, DEFSECURITYTOOLSTATUS::INSTALLFAILED); - } -} - -void DefSecurityToolsBusLineMgr::unInstallPackage(const QString &strPackageKey) -{ - if (!hasAutority()) { - return; - } - - if (!isInit()) { - init(); - } - - if (!isInit()) { - Q_EMIT notifyAppStatusChanged(strPackageKey, DEFSECURITYTOOLSTATUS::UNINSTALLFAILED); - return; - } - - if (!hasInstaller(strPackageKey)) { - Q_EMIT notifyAppStatusChanged(strPackageKey, DEFSECURITYTOOLSTATUS::UNINSTALLFAILED); - return; - } - - DefSecurityToolsBaseInstaller *pInstaller = getInstaller(strPackageKey); - - if (pInstaller) { - QObject::connect(pInstaller, - &DefSecurityToolsBaseInstaller::sAppStatusChanged, - this, - &DefSecurityToolsBusLineMgr::onAppStatusChanged); - pInstaller->unInstallPackage(); - } else { - Q_EMIT notifyAppStatusChanged(strPackageKey, DEFSECURITYTOOLSTATUS::UNINSTALLFAILED); - } -} - -void DefSecurityToolsBusLineMgr::updatePackage(const QString &strPackageKey) -{ - if (!hasAutority()) { - return; - } - - if (!isInit()) { - init(); - } - - if (!isInit()) { - Q_EMIT notifyAppStatusChanged(strPackageKey, DEFSECURITYTOOLSTATUS::UPDATEFAIL); - return; - } - - if (!hasInstaller(strPackageKey)) { - Q_EMIT notifyAppStatusChanged(strPackageKey, DEFSECURITYTOOLSTATUS::UPDATEFAIL); - return; - } - - DefSecurityToolsBaseInstaller *pInstaller = getInstaller(strPackageKey); - - if (pInstaller) { - QObject::connect(pInstaller, - &DefSecurityToolsBaseInstaller::sAppStatusChanged, - this, - &DefSecurityToolsBusLineMgr::onAppStatusChanged); - pInstaller->updatePackage(); - } else { - Q_EMIT notifyAppStatusChanged(strPackageKey, DEFSECURITYTOOLSTATUS::UPDATEFAIL); - } -} - -void DefSecurityToolsBusLineMgr::showTool(const QString &strPackageKey, - const QStringList &strParams) -{ - if (!hasAutority()) { - return; - } - - if (!isInit()) { - init(); - } - - if (!isInit()) { - Q_EMIT notifyAppStatusChanged(strPackageKey, DEFSECURITYTOOLSTATUS::UPDATEFAIL); - return; - } - - if (!hasInstaller(strPackageKey)) { - Q_EMIT notifyAppStatusChanged(strPackageKey, DEFSECURITYTOOLSTATUS::UPDATEFAIL); - return; - } - - DefSecurityToolsBaseInstaller *pInstaller = getInstaller(strPackageKey); - - if (pInstaller) { - pInstaller->showtool(strParams); - } -} - -void DefSecurityToolsBusLineMgr::loadAlltools() -{ - if (!hasAutority()) { - return; - } - - DEFSECURITYTOOLINFOLIST infolist; - QDir defenderDataDir(DEFENDER_DATA_DIR_PATH); - - if (!defenderDataDir.exists(DEFENDER_DATA_DIR_PATH)) { - m_bLoad = false; - Q_EMIT notifyToolsInfoUpdate(infolist); - return; - } - - QString strFileName = QString("%1toolinfo.json").arg(DEFENDER_DATA_DIR_PATH); - infolist = readFrom(strFileName); - - // 不可以直接对其进行卸载,需要判断其信息是否存在。存在则更新信息,否则挂载一个安装器。 - DEFSECURITYTOOLINFOLIST RTInfolist; - - foreach (DEFSECURITYTOOLINFO info, infolist) { - DefSecurityToolsBaseInstaller *pInstaller = nullptr; - QString strPackageKey = info.getPackageKey(); - - if (hasInstaller(strPackageKey)) { - pInstaller = getInstaller(strPackageKey); - - if (!pInstaller) { - unregistInstaller(strPackageKey); - qCritical() << "Installer can't be empty!"; - continue; - } - - pInstaller->setInfo(info); - } else { - pInstaller = DefSecurityToolsInstallerFactory::createInstaller(info); - - if (pInstaller) { - pInstaller->setInfo(info); - registerInstaller(strPackageKey, pInstaller); - } - } - - Q_ASSERT(pInstaller != nullptr); - - // 设置本地最新包信息 - if (m_latestLocalPackages.contains(info.strPackageName)) { - pInstaller->setLatestPackageInfo(m_latestLocalPackages.value(info.strPackageName)); - } - - // 系统工具默认总是安装,不用查。 - if (!info.bSystemTool) { - info.bHasInstalled = pInstaller->isPackageExist(); - } - - if (!info.bSystemTool) { - info.bCanUpdate = pInstaller->isUpdatable(); - } else { - info.bCanUpdate = false; - } - - // 当包不可安装时不挂载 - if (!info.bSystemTool) { - if (pInstaller->isPackageInstallable()) { - RTInfolist.push_back(info); - } else { - unregistInstaller(info.getPackageKey()); - } - } else { - // 判断工具是否可用,如不可用则隐藏 - if ("Execution Prevention" == info.strAppName && !isExecPreventValid()) { - continue; - } - - if ("Superior Protection" == info.strAppName && !isSuperiorProtectionValid()) { - continue; - } - - if ("Block Removal of Kernel Modules" == info.strAppName - && !isKernelModulesProtectionValid()) { - continue; - } - - if ("Internet Control" == info.strAppName && !isResourceManagerValid()) { - continue; - } - - RTInfolist.push_back(info); - } - } - - m_bLoad = true; - Q_EMIT notifyToolsInfoUpdate(RTInfolist); -} - -bool DefSecurityToolsBusLineMgr::isInit() const -{ - return m_bLoad; -} - -void DefSecurityToolsBusLineMgr::init() -{ - initLatestLocalPackages(); - loadAlltools(); -} - -bool DefSecurityToolsBusLineMgr::hasAutority() -{ - return true; -} - -void DefSecurityToolsBusLineMgr::registerInstaller(const QString &strPackageKey, - DefSecurityToolsBaseInstaller *pInstaller) -{ - Q_ASSERT(pInstaller != nullptr); - QString strKey = strPackageKey.trimmed(); - pInstaller->setStoreManagerInter(m_pManagerInter); - m_pToolInstallers[strKey] = pInstaller; -} - -void DefSecurityToolsBusLineMgr::unregistInstaller(const QString &strPackageKey) -{ - QString strKey = strPackageKey.trimmed(); - - if (m_pToolInstallers.contains(strKey)) { - DefSecurityToolsBaseInstaller *pInstaller = m_pToolInstallers[strKey]; - - if (pInstaller) { - pInstaller->deleteLater(); - pInstaller = nullptr; - } - - m_pToolInstallers.remove(strKey); - } -} - -bool DefSecurityToolsBusLineMgr::hasInstaller(const QString &strPackageKey) -{ - QString strKey = strPackageKey.trimmed(); - return m_pToolInstallers.contains(strKey); -} - -DEFSECURITYTOOLINFOLIST DefSecurityToolsBusLineMgr::defaultSecurityInfos() -{ - // 在此添加系统黙认工具信息 - DEFSECURITYTOOLINFOLIST infolist; - return infolist; -} - -DEFSECURITYTOOLINFOLIST DefSecurityToolsBusLineMgr::readFrom(const QString &strFileName) -{ - DEFSECURITYTOOLINFOLIST infolist; - infolist += defaultSecurityInfos(); - QFile rf(strFileName); - - if (!rf.open(QIODevice::ReadOnly)) { - return infolist; - } - - QByteArray byData = rf.readAll(); - rf.close(); - AesEncrpyObj aesObj; - aesObj.initKey(); - QByteArray byDecrypt = aesObj.decryptData(byData); - QJsonParseError jsonErr; - QJsonDocument jsonDoc = QJsonDocument::fromJson(byDecrypt, &jsonErr); - - if (QJsonParseError::NoError != jsonErr.error) { - qCritical() << jsonErr.errorString(); - return infolist; - } - - QJsonObject jsonAllInfos = jsonDoc.object(); - QJsonArray jsonClassifyTools = jsonAllInfos.value("Data").toArray(); - - for (int i = 0; i < jsonClassifyTools.size(); i++) { - QJsonValue value = jsonClassifyTools.at(i); - QJsonObject jsonInfoObj = value.toObject(); - DEFSECURITYTOOLINFO info; - info.strPackageName = jsonInfoObj.value("PackageName").toString(); - info.strAppName = jsonInfoObj.value("AppName").toString(); - info.strImagePath = jsonInfoObj.value("ImagePath").toString(); - info.strCompany = jsonInfoObj.value("CompanyName").toString(); - info.strDescription = jsonInfoObj.value("Description").toString(); - QString strInt = jsonInfoObj.value("Classify").toString(); - info.iClassify = strInt.toInt(); - info.strInallModel = jsonInfoObj.value("InstallModel").toString(); - info.strCallMethodName = jsonInfoObj.value("CallMethodName").toString(); - info.bSystemTool = jsonInfoObj.value("SystemTool").toBool(); - info.bHasInstalled = jsonInfoObj.value("HasInstalled").toBool(); - info.strReserve = jsonInfoObj.value("Reserve").toString(); - info.strReserve2 = jsonInfoObj.value("Reserve2").toString(); - info.strReserve3 = jsonInfoObj.value("Reserve3").toString(); - info.strReserve4 = jsonInfoObj.value("Reserve4").toString(); - infolist.push_back(info); - } - - return infolist; -} - -void DefSecurityToolsBusLineMgr::writeTo(const DEFSECURITYTOOLINFOLIST &infolist, - const QString &strFileName) -{ - QJsonArray jsonClassifyTools; - - foreach (DEFSECURITYTOOLINFO info, infolist) { - QJsonObject jsonToolInfo; - jsonToolInfo.insert("PackageName", info.strPackageName); - jsonToolInfo.insert("AppName", info.strAppName); - jsonToolInfo.insert("ImagePath", info.strImagePath); - jsonToolInfo.insert("CompanyName", info.strCompany); - jsonToolInfo.insert("Description", info.strDescription); - jsonToolInfo.insert("Classify", QString::number(info.iClassify)); - jsonToolInfo.insert("InstallModel", info.strInallModel); - jsonToolInfo.insert("CallMethodName", info.strCallMethodName); - jsonToolInfo.insert("SystemTool", info.bSystemTool); - jsonToolInfo.insert("HasInstalled", info.bHasInstalled); - jsonToolInfo.insert("Reserve", info.strReserve); - jsonToolInfo.insert("Reserve2", info.strReserve2); - jsonToolInfo.insert("Reserve3", info.strReserve3); - jsonToolInfo.insert("Reserve4", info.strReserve4); - jsonClassifyTools.push_back(jsonToolInfo); - } - - QJsonObject jsonAllInfos; - jsonAllInfos.insert("Data", jsonClassifyTools); - QJsonDocument document; - document.setObject(jsonAllInfos); - QByteArray byData = document.toJson(QJsonDocument::Indented); - - QFile wf(strFileName); - - if (wf.open(QIODevice::WriteOnly | QIODevice::Truncate)) { - AesEncrpyObj aesObj; - aesObj.initKey(); - QByteArray byEncrypt = aesObj.encryptData(byData); - wf.write(byEncrypt); - wf.close(); - } -} - -DefSecurityToolsBaseInstaller * -DefSecurityToolsBusLineMgr::getInstaller(const QString strPackageKey) const -{ - QString strKey = strPackageKey.trimmed(); - DefSecurityToolsBaseInstaller *pInstaller = nullptr; - - if (m_pToolInstallers.contains(strKey)) { - pInstaller = m_pToolInstallers.value(strKey); - } - - return pInstaller; -} - -void DefSecurityToolsBusLineMgr::initLatestLocalPackages() -{ - QDBusMessage msg = DBUS_BLOCK_INVOKE(m_pManagerInter, "GetLocalOnTheShelvesAppInfo"); - QStringList strReplys = msg.arguments().first().toStringList(); - - if (!strReplys.isEmpty()) { - foreach (QString strVal, strReplys) { - QByteArray replayData = QByteArray::fromStdString(strVal.toStdString()); - QJsonParseError error; - QJsonDocument doc = QJsonDocument::fromJson(replayData, &error); - - if (QJsonParseError::NoError == error.error) { - PACKAGEMSG packageMsg; - QJsonObject jsonObj = doc.object(); - - if (jsonObj.contains("package_name")) { - packageMsg.strPackageName = jsonObj.value("package_name").toString(); - } - - if (jsonObj.contains("package_version")) { - packageMsg.strVersion = jsonObj.value("package_version").toString(); - } - - m_latestLocalPackages.insert(packageMsg.strPackageName, packageMsg); - } else { - qWarning() << "get local package information failed!"; - } - } - } -} - -bool DefSecurityToolsBusLineMgr::isHideTools(const DEFSECURITYTOOLINFO &info, - const QString &strAppName, - const QString &strGsetting) -{ - bool m_isShow = true; - if (strAppName == info.strAppName) { - m_isShow = m_gSettingsInvokerInter->GetValue(strGsetting).toBool(); - } - - return m_isShow; -} - -bool DefSecurityToolsBusLineMgr::isExecPreventValid() -{ - // 目前尚未开发 - return false; -} - -bool DefSecurityToolsBusLineMgr::isSuperiorProtectionValid() -{ - return m_isSecEnhanceSrvValid; -} - -bool DefSecurityToolsBusLineMgr::isKernelModulesProtectionValid() -{ - // 目前尚未开发 - return false; -} - -bool DefSecurityToolsBusLineMgr::isResourceManagerValid() -{ - return m_isResourceManagerValid; -} - -void DefSecurityToolsBusLineMgr::onAppStatusChanged(const QString &strPackageKey, - DEFSECURITYTOOLSTATUS status) -{ - if (DEFSECURITYTOOLSTATUS::INSTALLING != status && DEFSECURITYTOOLSTATUS::UNINSTALLING != status - && DEFSECURITYTOOLSTATUS::UPDATING != status) { - DefSecurityToolsBaseInstaller *pInstaller = getInstaller(strPackageKey); - QObject::disconnect(pInstaller, - &DefSecurityToolsBaseInstaller::sAppStatusChanged, - this, - &DefSecurityToolsBusLineMgr::onAppStatusChanged); - } - - Q_EMIT notifyAppStatusChanged(strPackageKey, status); -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytoolbackend/defsecuritytoolsbuslinemgr.h b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytoolbackend/defsecuritytoolsbuslinemgr.h deleted file mode 100644 index 6e02037..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytoolbackend/defsecuritytoolsbuslinemgr.h +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (C) 2020 ~ 2022 Uniontech Software Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef DEFSECURITYTOOLSBUSLINEMGR_H -#define DEFSECURITYTOOLSBUSLINEMGR_H - -#include "../../deepin-pc-manager/src/window/modules/common/invokers/invokerinterface.h" -#include "../../deepin-pc-manager/src/window/modules/securitytools/defsecuritytoolinfo.h" -#include "installer/defsecuritytoolsbaseinstaller.h" - -#include -#include - -class DefToolAuthorityCheckObj : public QObject -{ - Q_OBJECT -public: - explicit DefToolAuthorityCheckObj(QObject *pParent = nullptr); - ~DefToolAuthorityCheckObj() override; - -private: -}; - -class DefSecurityToolsBusLineMgr : public QObject -{ - Q_OBJECT -public: - explicit DefSecurityToolsBusLineMgr(QObject *pParent = nullptr); - ~DefSecurityToolsBusLineMgr() override; - -public: - void setAutorityCheckObj(DefToolAuthorityCheckObj *pObj); - void installPackage(const QString &strPackageKey); - void unInstallPackage(const QString &strPackageKey); - void updatePackage(const QString &strPackageKey); - void showTool(const QString &strPackageKey, const QStringList &strParams); - bool isInit() const; - void init(); - -private: - bool hasAutority(); - void registerInstaller(const QString &strPackageKey, DefSecurityToolsBaseInstaller *pInstall); - void unregistInstaller(const QString &strPackageKey); - bool hasInstaller(const QString &strPackageKey); - DEFSECURITYTOOLINFOLIST defaultSecurityInfos(); - DEFSECURITYTOOLINFOLIST readFrom(const QString &strFileName); - void writeTo(const DEFSECURITYTOOLINFOLIST &infolist, const QString &strFileName); - DefSecurityToolsBaseInstaller *getInstaller(const QString strPackageKey) const; - void loadAlltools(); - // 请注意,此函数必需在loadAlltools之前调用 - void initLatestLocalPackages(); - // 隐藏工具 -- 例如:超级防护 - bool isHideTools(const DEFSECURITYTOOLINFO &info, - const QString &strAppName, - const QString &strGsetting); - // 判断工具是否可用 - bool isExecPreventValid(); - bool isSuperiorProtectionValid(); - bool isKernelModulesProtectionValid(); - bool isResourceManagerValid(); - -Q_SIGNALS: - // 所有的安全工具状态更新信号 - void notifyToolsInfoUpdate(const DEFSECURITYTOOLINFOLIST &infos); - // 某一个安全工具的状态发生变化的信号 - void notifyAppStatusChanged(const QString &strPackageKey, DEFSECURITYTOOLSTATUS status); - // 安全工具状态检测完成信号 - void notifyStatusCheckFinished(); - -private Q_SLOTS: - void onAppStatusChanged(const QString &strPackageKey, DEFSECURITYTOOLSTATUS status); - -private: - DefToolAuthorityCheckObj *m_pAuthorityCheckObj; - QMap m_pToolInstallers; - QMap m_latestLocalPackages; - DBusInvokerInterface *m_pManagerInter; - bool m_bLoad; - SettingsInvokerInterface *m_gSettingsInvokerInter; - bool m_isSecEnhanceSrvValid; - bool m_isResourceManagerValid; -}; - -#endif // DEFSECURITYTOOLSBUSLINEMGR_H diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytoolbackend/installer/defsecuritytoolsbaseinstaller.cpp b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytoolbackend/installer/defsecuritytoolsbaseinstaller.cpp deleted file mode 100644 index a724c81..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytoolbackend/installer/defsecuritytoolsbaseinstaller.cpp +++ /dev/null @@ -1,335 +0,0 @@ -// Copyright (C) 2020 ~ 2022 Uniontech Software Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "defsecuritytoolsbaseinstaller.h" - -#include "../../deepin-pc-manager/src/window/modules/common/invokers/invokerfactory.h" -#include "defsecuritytoolsdbusinstaller.h" -#include "defsecuritytoolswineinstaller.h" - -#include -#include -#include -#include -#include -#include -#include - -DefSecurityToolsBaseInstaller::DefSecurityToolsBaseInstaller(QObject *parent) - : QObject(parent) - , m_pManagerInvoker(nullptr) - , m_jobPath("") - , m_strType("") - , m_strStatus("") - , m_bUpdate(false) -{ -} - -DefSecurityToolsBaseInstaller::~DefSecurityToolsBaseInstaller() { } - -void DefSecurityToolsBaseInstaller::setInfo(const DEFSECURITYTOOLINFO &info) -{ - m_info = info; -} - -DEFSECURITYTOOLINFO DefSecurityToolsBaseInstaller::toolInfo() const -{ - return m_info; -} - -void DefSecurityToolsBaseInstaller::setLatestPackageInfo(const PACKAGEMSG &packagemsg) -{ - m_LatestPackageMsg = packagemsg; -} - -void DefSecurityToolsBaseInstaller::installPackage() -{ - if (!isPackageInstallable()) { - Q_EMIT sAppStatusChanged(m_info.getPackageKey(), DEFSECURITYTOOLSTATUS::INSTALLFAILED); - return; - } - - Q_EMIT sAppStatusChanged(m_info.getPackageKey(), DEFSECURITYTOOLSTATUS::INSTALLING); - qInfo() << "Begin Install Package"; - m_bUpdate = false; - DBUS_NOBLOCK_INVOKE(m_pManagerInvoker, - "IntallPackage", - "deepin-defender", - m_info.strPackageName); -} - -void DefSecurityToolsBaseInstaller::unInstallPackage() -{ - if (!isPackageExist()) { - Q_EMIT sAppStatusChanged(m_info.getPackageKey(), DEFSECURITYTOOLSTATUS::UNINSTALLFAILED); - } - - Q_EMIT sAppStatusChanged(m_info.getPackageKey(), DEFSECURITYTOOLSTATUS::UNINSTALLING); - DBUS_NOBLOCK_INVOKE(m_pManagerInvoker, - "RemovePackage", - "deepin-defender", - m_info.strPackageName); -} - -void DefSecurityToolsBaseInstaller::updatePackage() -{ - if (!isPackageExist()) { - Q_EMIT sAppStatusChanged(m_info.getPackageKey(), DEFSECURITYTOOLSTATUS::UPDATEFAIL); - } - - Q_EMIT sAppStatusChanged(m_info.getPackageKey(), DEFSECURITYTOOLSTATUS::UPDATING); - qInfo() << "Begin Update Package"; - m_bUpdate = true; - DBUS_NOBLOCK_INVOKE(m_pManagerInvoker, - "IntallPackage", - "deepin-defender", - m_info.strPackageName); -} - -void DefSecurityToolsBaseInstaller::setStoreManagerInter(DBusInvokerInterface *pInterface) -{ - if (m_pManagerInvoker) { - m_pManagerInvoker->Disconnect("sigStartInstall", - this, - SLOT(onInstallStart(const QString &, const QString &))); - m_pManagerInvoker->Disconnect("sigIntallProgress", - this, - SLOT(onSigIntallProgress(const QString &, - const QString &, - int, - int, - int, - const QString &))); - m_pManagerInvoker->Disconnect( - "sigRemoveProgress", - this, - SLOT(onSigRemoveProgress(const QString &, const QString &, bool))); - } - - m_pManagerInvoker = pInterface; - m_pManagerInvoker->Connect("sigStartInstall", - this, - SLOT(onInstallStart(const QString &, const QString &))); - m_pManagerInvoker->Connect( - "sigIntallProgress", - this, - SLOT( - onSigIntallProgress(const QString &, const QString &, int, int, int, const QString &))); - m_pManagerInvoker->Connect("sigRemoveProgress", - this, - SLOT(onSigRemoveProgress(const QString &, const QString &, bool))); -} - -bool DefSecurityToolsBaseInstaller::isPackageExist() -{ - QDBusMessage msg = - DBUS_BLOCK_INVOKE(m_pManagerInvoker, "GetLocalPackageInfo", m_info.strPackageName); - GET_MESSAGE_VALUE(QString, strMsg, msg); - return !strMsg.isEmpty(); -} - -bool DefSecurityToolsBaseInstaller::isUpdatable() -{ - QDBusMessage msg = - DBUS_BLOCK_INVOKE(m_pManagerInvoker, "GetLocalPackageInfo", m_info.strPackageName); - GET_MESSAGE_VALUE(QString, strLocal, msg); - - if (strLocal.trimmed().isEmpty()) { - return false; - } - - PACKAGEMSG localPackage = getLocalPackageInfo(strLocal); - return (localPackage < m_LatestPackageMsg); -} - -bool DefSecurityToolsBaseInstaller::isPackageInstallable() -{ - bool bInstallAble = false; - QProcess process; - process.start("apt", { "policy", m_info.strPackageName }); - - if (process.waitForStarted()) { - qDebug() << "process id" << process.processId(); - - if (process.waitForFinished()) { - QByteArray byArr = process.readAllStandardOutput(); - QString strMsg = QString::fromLocal8Bit(byArr); - - if (!strMsg.contains("N:") && strMsg.contains(m_info.strPackageName)) { - bInstallAble = true; - } - } - } - - return bInstallAble; -} - -PACKAGEMSG DefSecurityToolsBaseInstaller::getLocalPackageInfo(QString strMsg) -{ - PACKAGEMSG packageMsg; - int iIndex = strMsg.indexOf("["); - - if (iIndex < 0) { - qWarning() << "Error Package Message!"; - return packageMsg; - } - - strMsg = strMsg.left(iIndex).trimmed(); - QStringList strList = strMsg.split(" "); - - if (strList.count() != 3) { - qWarning() << "Error Package Message!"; - return packageMsg; - } - - packageMsg.strPackageName = strList.at(0); - packageMsg.strVersion = strList.at(1); - return packageMsg; -} - -void DefSecurityToolsBaseInstaller::showtool(const QStringList &strParams) -{ - Q_UNUSED(strParams); -} - -void DefSecurityToolsBaseInstaller::onInstallStart(const QString &strID, const QString &strPackage) -{ - Q_UNUSED(strID); - - if (strPackage.trimmed() == m_info.strPackageName) { - Q_EMIT sAppStatusChanged(m_info.getPackageKey(), DEFSECURITYTOOLSTATUS::INSTALLING); - } -} - -void DefSecurityToolsBaseInstaller::onSigIntallProgress(const QString &strID, - const QString &strPackage, - int iState, - int iTotal, - int iProcess, - const QString &strStatusMsg) -{ - Q_UNUSED(strID); - Q_UNUSED(strStatusMsg); - - if (strPackage.trimmed() == m_info.strPackageName) { - if (1 == iState) { - if (iTotal > 0) { - if (iProcess < 0) { // 安装失败 - if (m_bUpdate) { - Q_EMIT sAppStatusChanged(m_info.getPackageKey(), - DEFSECURITYTOOLSTATUS::UPDATEFAIL); - } else { - Q_EMIT sAppStatusChanged(m_info.getPackageKey(), - DEFSECURITYTOOLSTATUS::INSTALLFAILED); - } - } else if (iProcess < iTotal) { // 安装中 -#ifdef QT_DEBUG - if (m_bUpdate) { - Q_EMIT sAppStatusChanged(m_info.getPackageKey(), - DEFSECURITYTOOLSTATUS::UPDATING); - } else { - Q_EMIT sAppStatusChanged(m_info.getPackageKey(), - DEFSECURITYTOOLSTATUS::INSTALLING); - } -#endif - } else { // 安装成功 - if (m_bUpdate) { - Q_EMIT sAppStatusChanged(m_info.getPackageKey(), - DEFSECURITYTOOLSTATUS::UPDATASUCCESS); - } else { - Q_EMIT sAppStatusChanged(m_info.getPackageKey(), - DEFSECURITYTOOLSTATUS::INSTALLSUCCESS); - } - } - } else { // 表示安装进度输出,用于客户端显示进度 -#ifdef QT_DEBUG - if (m_bUpdate) { - Q_EMIT sAppStatusChanged(m_info.getPackageKey(), - DEFSECURITYTOOLSTATUS::UPDATING); - } else { - Q_EMIT sAppStatusChanged(m_info.getPackageKey(), - DEFSECURITYTOOLSTATUS::INSTALLING); - } -#endif - } - } else if (0 == iState) { - if (iTotal > 0) { - if (iProcess < 0) { // 下载失败 - if (m_bUpdate) { - Q_EMIT sAppStatusChanged(m_info.getPackageKey(), - DEFSECURITYTOOLSTATUS::UPDATEFAIL); - } else { - Q_EMIT sAppStatusChanged(m_info.getPackageKey(), - DEFSECURITYTOOLSTATUS::INSTALLFAILED); - } - } -#ifdef QT_DEBUG - else if (iProcess < iTotal) { // 下载中 - if (m_bUpdate) { - Q_EMIT sAppStatusChanged(m_info.getPackageKey(), - DEFSECURITYTOOLSTATUS::UPDATING); - } else { - Q_EMIT sAppStatusChanged(m_info.getPackageKey(), - DEFSECURITYTOOLSTATUS::INSTALLING); - } - } else { // 下载成功 - if (m_bUpdate) { - Q_EMIT sAppStatusChanged(m_info.getPackageKey(), - DEFSECURITYTOOLSTATUS::UPDATING); - } else { - Q_EMIT sAppStatusChanged(m_info.getPackageKey(), - DEFSECURITYTOOLSTATUS::INSTALLING); - } - } -#endif - } else { // 异常 - if (m_bUpdate) { - Q_EMIT sAppStatusChanged(m_info.getPackageKey(), - DEFSECURITYTOOLSTATUS::UPDATEFAIL); - } else { - Q_EMIT sAppStatusChanged(m_info.getPackageKey(), - DEFSECURITYTOOLSTATUS::INSTALLFAILED); - } - } - } - } -} - -void DefSecurityToolsBaseInstaller::onSigRemoveProgress(const QString &strID, - const QString &strPackage, - bool bSuccess) -{ - Q_UNUSED(strID); - - if (strPackage.trimmed() == m_info.strPackageName) { - if (bSuccess) { - Q_EMIT sAppStatusChanged(m_info.getPackageKey(), DEFSECURITYTOOLSTATUS::UNINSTALLED); - } else { - Q_EMIT sAppStatusChanged(m_info.getPackageKey(), - DEFSECURITYTOOLSTATUS::UNINSTALLFAILED); - } - } -} - -DefSecurityToolsInstallerFactory::DefSecurityToolsInstallerFactory(QObject *parent) - : QObject(parent) -{ -} - -DefSecurityToolsInstallerFactory::~DefSecurityToolsInstallerFactory() { } - -DefSecurityToolsBaseInstaller * -DefSecurityToolsInstallerFactory::createInstaller(const DEFSECURITYTOOLINFO &info) -{ - DefSecurityToolsBaseInstaller *pInstaller = nullptr; - - if (info.strInallModel == "dbus") { - pInstaller = new DefSecurityToolsDbusInstaller; - } else if (info.strInallModel == "wine") { - pInstaller = new DefSecurityToolsWineInstaller; - } - - return pInstaller; -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytoolbackend/installer/defsecuritytoolsbaseinstaller.h b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytoolbackend/installer/defsecuritytoolsbaseinstaller.h deleted file mode 100644 index ec22924..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytoolbackend/installer/defsecuritytoolsbaseinstaller.h +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (C) 2020 ~ 2022 Uniontech Software Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef DEFSECURITYTOOLSBASEINSTALLER_H -#define DEFSECURITYTOOLSBASEINSTALLER_H - -#include "../../deepin-pc-manager/src/window/modules/common/invokers/invokerinterface.h" -#include "../../deepin-pc-manager/src/window/modules/securitytools/defsecuritytoolinfo.h" - -#include -#include - -typedef struct PackageMsg -{ - explicit PackageMsg() - : strPackageName("") - , strVersion("") - { - } - - bool operator<(const PackageMsg &otherPackage) - { - if (this == &otherPackage) { - return true; - } - - if (strPackageName != otherPackage.strPackageName) { - qWarning() << "can't been compared!"; - return false; - } - - return strVersion < otherPackage.strVersion; - } - - QString strPackageName; - QString strVersion; -} PACKAGEMSG, *LPPACKAGEMSG; - -class DefSecurityToolsBaseInstaller : public QObject -{ - Q_OBJECT -public: - explicit DefSecurityToolsBaseInstaller(QObject *parent = nullptr); - virtual ~DefSecurityToolsBaseInstaller(); - -public: - void setInfo(const DEFSECURITYTOOLINFO &info); - DEFSECURITYTOOLINFO toolInfo() const; - void setLatestPackageInfo(const PACKAGEMSG &packagemsg); - void installPackage(); - void unInstallPackage(); - void updatePackage(); - void setStoreManagerInter(DBusInvokerInterface *pInterface); - bool isPackageExist(); - bool isUpdatable(); - bool isPackageInstallable(); - - // virtual -public: - virtual void showtool(const QStringList &strParams); - -Q_SIGNALS: - void sAppStatusChanged(const QString &strKey, DEFSECURITYTOOLSTATUS status); - -public Q_SLOTS: - void onInstallStart(const QString &strID, const QString &strPackage); - void onSigIntallProgress(const QString &strID, - const QString &strPackage, - int iState, - int iTotal, - int iProcess, - const QString &strStatusMsg); - void onSigRemoveProgress(const QString &strID, const QString &strPackage, bool bSuccess); - -private: - PACKAGEMSG getLocalPackageInfo(QString strMsg); - -protected: - DEFSECURITYTOOLINFO m_info; - PACKAGEMSG m_LatestPackageMsg; - -private: - DBusInvokerInterface *m_pManagerInvoker; - QString m_jobPath; - QString m_strType; - QString m_strStatus; - bool m_bUpdate; -}; - -class DefSecurityToolsInstallerFactory : public QObject -{ - explicit DefSecurityToolsInstallerFactory(QObject *parent = nullptr); - ~DefSecurityToolsInstallerFactory() override; - -public: - static DefSecurityToolsBaseInstaller *createInstaller(const DEFSECURITYTOOLINFO &info); -}; - -#endif // DEFSECURITYTOOLSBASEINSTALLER_H diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytoolbackend/installer/defsecuritytoolsdbusinstaller.cpp b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytoolbackend/installer/defsecuritytoolsdbusinstaller.cpp deleted file mode 100644 index 11beaf9..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytoolbackend/installer/defsecuritytoolsdbusinstaller.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (C) 2020 ~ 2022 Uniontech Software Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "defsecuritytoolsdbusinstaller.h" - -#include -#include - -DefSecurityToolsDbusInstaller::DefSecurityToolsDbusInstaller(QObject *parent) - : DefSecurityToolsBaseInstaller(parent) -{ -} - -DefSecurityToolsDbusInstaller::~DefSecurityToolsDbusInstaller() -{ -} - -void DefSecurityToolsDbusInstaller::showtool(const QStringList &strParams) -{ - if (m_info.strReserve4.trimmed() == "system") { - QDBusInterface interface(m_info.strReserve, m_info.strReserve2, m_info.strReserve3, QDBusConnection::systemBus()); - - if (!strParams.isEmpty()) { - QList varlist; - - foreach (QString strParam, strParams) { - varlist.push_back(strParam); - } - - interface.callWithArgumentList(QDBus::NoBlock, m_info.strCallMethodName, varlist); - } else { - interface.call(m_info.strCallMethodName); - } - } else { - QDBusInterface interface(m_info.strReserve, m_info.strReserve2, m_info.strReserve3, QDBusConnection::sessionBus()); - - if (!strParams.isEmpty()) { - QList varlist; - - foreach (QString strParam, strParams) { - varlist.push_back(strParam); - } - - interface.callWithArgumentList(QDBus::NoBlock, m_info.strCallMethodName, varlist); - } else { - interface.call(m_info.strCallMethodName); - } - } -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytoolbackend/installer/defsecuritytoolsdbusinstaller.h b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytoolbackend/installer/defsecuritytoolsdbusinstaller.h deleted file mode 100644 index 0376546..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytoolbackend/installer/defsecuritytoolsdbusinstaller.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2020 ~ 2022 Uniontech Software Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef DEFSECURITYTOOLSDBUSINSTALLER_H -#define DEFSECURITYTOOLSDBUSINSTALLER_H - -#include "defsecuritytoolsbaseinstaller.h" - -#include - -class DefSecurityToolsDbusInstaller : public DefSecurityToolsBaseInstaller -{ - Q_OBJECT -public: - explicit DefSecurityToolsDbusInstaller(QObject *parent = nullptr); - ~DefSecurityToolsDbusInstaller() override; - -public: - virtual void showtool(const QStringList &strParams) override; -}; - -#endif // DEFSECURITYTOOLSDBUSINSTALLER_H diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytoolbackend/installer/defsecuritytoolswineinstaller.cpp b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytoolbackend/installer/defsecuritytoolswineinstaller.cpp deleted file mode 100644 index ee8b390..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytoolbackend/installer/defsecuritytoolswineinstaller.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "defsecuritytoolswineinstaller.h" - -#include -#include -#include -#include - -DefSecurityToolsWineInstaller::DefSecurityToolsWineInstaller(QObject *parent) - : DefSecurityToolsBaseInstaller(parent) -{ -} - -DefSecurityToolsWineInstaller::~DefSecurityToolsWineInstaller() -{ -} - -void DefSecurityToolsWineInstaller::showtool(const QStringList &strParams) -{ - Q_UNUSED(strParams); - QDBusInterface inter("com.deepin.SessionManager", "/com/deepin/StartManager", "com.deepin.StartManager"); - inter.call(QDBus::NoBlock, "Launch", m_info.strReserve); -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytoolbackend/installer/defsecuritytoolswineinstaller.h b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytoolbackend/installer/defsecuritytoolswineinstaller.h deleted file mode 100644 index cdaed3f..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytoolbackend/installer/defsecuritytoolswineinstaller.h +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef DEFSECURITYTOOLSWINEINSTALLER_H -#define DEFSECURITYTOOLSWINEINSTALLER_H - -#include "defsecuritytoolsbaseinstaller.h" - -class DefSecurityToolsWineInstaller : public DefSecurityToolsBaseInstaller -{ - Q_OBJECT -public: - explicit DefSecurityToolsWineInstaller(QObject *parent = nullptr); - ~DefSecurityToolsWineInstaller() override; - -public: - virtual void showtool(const QStringList &strParams) override; -}; - -#endif // DEFSECURITYTOOLSWINEINSTALLER_H diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytooldialog_adaptor.cpp b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytooldialog_adaptor.cpp deleted file mode 100644 index eb654b4..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytooldialog_adaptor.cpp +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (C) 2020 The Qt Company Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "securitytooldialog_adaptor.h" -#include -#include -#include -#include -#include -#include -#include - -/* - * Implementation of adaptor class SecuritytooldialogAdaptor - */ - -SecuritytooldialogAdaptor::SecuritytooldialogAdaptor(QObject *parent) - : QDBusAbstractAdaptor(parent) -{ - // constructor - setAutoRelaySignals(true); -} - -SecuritytooldialogAdaptor::~SecuritytooldialogAdaptor() -{ - // destructor -} - -QStringList SecuritytooldialogAdaptor::GetInstallingApps() -{ - // handle method call com.deepin.pc.manager.securitytooldialog.GetInstallingApps - QStringList installingapps; - QMetaObject::invokeMethod(parent(), "GetInstallingApps", Q_RETURN_ARG(QStringList, installingapps)); - return installingapps; -} - -QStringList SecuritytooldialogAdaptor::GetUninstallingApps() -{ - // handle method call com.deepin.pc.manager.securitytooldialog.GetUninstallingApps - QStringList uninstallingapps; - QMetaObject::invokeMethod(parent(), "GetUninstallingApps", Q_RETURN_ARG(QStringList, uninstallingapps)); - return uninstallingapps; -} - -QStringList SecuritytooldialogAdaptor::GetUpdatingApps() -{ - // handle method call com.deepin.pc.manager.securitytooldialog.GetUpdatingApps - QStringList updatingapps; - QMetaObject::invokeMethod(parent(), "GetUpdatingApps", Q_RETURN_ARG(QStringList, updatingapps)); - return updatingapps; -} - -void SecuritytooldialogAdaptor::OnInstallPackage(const QString &strPackageKey) -{ - // handle method call com.deepin.pc.manager.securitytooldialog.OnInstallPackage - QMetaObject::invokeMethod(parent(), "OnInstallPackage", Q_ARG(QString, strPackageKey)); -} - -void SecuritytooldialogAdaptor::OnRequestUpdateToolsInfo() -{ - // handle method call com.deepin.pc.manager.securitytooldialog.OnRequestUpdateToolsInfo - QMetaObject::invokeMethod(parent(), "OnRequestUpdateToolsInfo"); -} - -void SecuritytooldialogAdaptor::OnShowTool(const QString &strPackageKey, const QStringList &strParams) -{ - // handle method call com.deepin.pc.manager.securitytooldialog.OnShowTool - QMetaObject::invokeMethod(parent(), "OnShowTool", Q_ARG(QString, strPackageKey), Q_ARG(QStringList, strParams)); -} - -void SecuritytooldialogAdaptor::OnUnInstallPackage(const QString &strPackageKey) -{ - // handle method call com.deepin.pc.manager.securitytooldialog.OnUnInstallPackage - QMetaObject::invokeMethod(parent(), "OnUnInstallPackage", Q_ARG(QString, strPackageKey)); -} - -void SecuritytooldialogAdaptor::OnUpdatePackage(const QString &strPackageKey) -{ - // handle method call com.deepin.pc.manager.securitytooldialog.OnUpdatePackage - QMetaObject::invokeMethod(parent(), "OnUpdatePackage", Q_ARG(QString, strPackageKey)); -} - -void SecuritytooldialogAdaptor::SetDefenderPaletteType(int type) -{ - // handle method call com.deepin.pc.manager.securitytooldialog.SetDefenderPaletteType - QMetaObject::invokeMethod(parent(), "SetDefenderPaletteType", Q_ARG(int, type)); -} - -void SecuritytooldialogAdaptor::ShowNetCheck() -{ - // handle method call com.deepin.pc.manager.securitytooldialog.ShowNetCheck - QMetaObject::invokeMethod(parent(), "ShowNetCheck"); -} - -void SecuritytooldialogAdaptor::ShowStartup() -{ - // handle method call com.deepin.pc.manager.securitytooldialog.ShowStartup - QMetaObject::invokeMethod(parent(), "ShowStartup"); -} - diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytooldialog_adaptor.h b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytooldialog_adaptor.h deleted file mode 100644 index 335377f..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytooldialog_adaptor.h +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (C) 2020 The Qt Company Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef SECURITYTOOLDIALOG_ADAPTOR_H -#define SECURITYTOOLDIALOG_ADAPTOR_H - -#include -#include -#include "window/modules/common/defenderprocinfolist.h" -#include "../../deepin-pc-manager/src/window/modules/securitytools/defsecuritytoolinfo.h" -QT_BEGIN_NAMESPACE -class QByteArray; -template class QList; -template class QMap; -class QString; -class QStringList; -class QVariant; -QT_END_NAMESPACE - -/* - * Adaptor class for interface com.deepin.pc.manager.securitytooldialog - */ -class SecuritytooldialogAdaptor: public QDBusAbstractAdaptor -{ - Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "com.deepin.pc.manager.securitytooldialog") - Q_CLASSINFO("D-Bus Introspection", "" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" - "") -public: - SecuritytooldialogAdaptor(QObject *parent); - virtual ~SecuritytooldialogAdaptor(); - -public: // PROPERTIES -public Q_SLOTS: // METHODS - QStringList GetInstallingApps(); - QStringList GetUninstallingApps(); - QStringList GetUpdatingApps(); - void OnInstallPackage(const QString &strPackageKey); - void OnRequestUpdateToolsInfo(); - void OnShowTool(const QString &strPackageKey, const QStringList &strParams); - void OnUnInstallPackage(const QString &strPackageKey); - void OnUpdatePackage(const QString &strPackageKey); - void SetDefenderPaletteType(int type); - void ShowNetCheck(); - void ShowStartup(); -Q_SIGNALS: // SIGNALS - void notifyAppStatusChanged(const QString &strPackageKey, int status); - void notifyStatusCheckFinished(); - void notifyToolsInfoUpdate(DEFSECURITYTOOLINFOLIST infos); -}; - -#endif diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytooldialoginter.cpp b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytooldialoginter.cpp deleted file mode 100755 index a3eefff..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytooldialoginter.cpp +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "securitytooldialoginter.h" - -#include "../../deepin-pc-manager/src/window/modules/common/gsettingkey.h" - -#include -#include - -const QString service = "com.deepin.pc.manager.securitytooldialog"; -const QString path = "/com/deepin/pc/manager/securitytooldialog"; - -// 自动化标签 -#define SET_ACCESS_NAME_T(control, className, name) \ - control->setAccessibleName(ACCNAMESTR(className##_##name)); -#define SET_ACC_NAME(control, name) SET_ACCESS_NAME_T(control, securityToolDialogInter, name) - -SecurityToolDialogInter::SecurityToolDialogInter(QObject *parent) - : QObject(parent) - , m_securityToolsAdaptor(nullptr) - , m_guiHelper(nullptr) - , m_gsetting(new QGSettings(DEEPIN_PC_MANAGER_GSETTING_PATH, QByteArray(), this)) - , m_autoStartupMwnd(nullptr) - , m_netCheckMwnd(nullptr) -{ - m_securityToolsAdaptor = new SecuritytooldialogAdaptor(this); - if (!QDBusConnection::sessionBus().registerService(service) - || !QDBusConnection::sessionBus().registerObject(path, this)) { - exit(0); - } - - m_pToolBusLineMgr = new DefSecurityToolsBusLineMgr; - DefToolAuthorityCheckObj *pCheckObj = new DefToolAuthorityCheckObj(m_pToolBusLineMgr); - m_pToolBusLineMgr->setAutorityCheckObj(pCheckObj); - - // 主题 - m_guiHelper = DGuiApplicationHelper::instance(); - getDefenderPaletteType(); - - // 安全工具信息 - registerDefSecurityToolInfo(); - registerDefSecurityToolInfoList(); - initConnections(); -} - -SecurityToolDialogInter::~SecurityToolDialogInter() -{ - if (m_autoStartupMwnd) { - m_autoStartupMwnd->deleteLater(); - m_autoStartupMwnd = nullptr; - } - if (m_netCheckMwnd) { - m_netCheckMwnd->deleteLater(); - m_netCheckMwnd = nullptr; - } - - if (m_pToolBusLineMgr) { - m_pToolBusLineMgr->deleteLater(); - m_pToolBusLineMgr = nullptr; - } -} - -void SecurityToolDialogInter::initConnections() -{ - QObject::connect(m_pToolBusLineMgr, - &DefSecurityToolsBusLineMgr::notifyToolsInfoUpdate, - this, - &SecurityToolDialogInter::notifyToolsInfoUpdate); - QObject::connect(m_pToolBusLineMgr, - &DefSecurityToolsBusLineMgr::notifyAppStatusChanged, - this, - &SecurityToolDialogInter::acceptAppStatusChanged); -} - -void SecurityToolDialogInter::getDefenderPaletteType() -{ - int type = m_gsetting->get(DEFENDER_PALETTE_TYPE).toInt(); - m_guiHelper->setPaletteType(DGuiApplicationHelper::ColorType(type)); -} - -void SecurityToolDialogInter::SetDefenderPaletteType(int type) -{ - m_gsetting->set(DEFENDER_PALETTE_TYPE, type); - m_guiHelper->setPaletteType(DGuiApplicationHelper::ColorType(type)); -} - -// 显示自启动管理弹框 -void SecurityToolDialogInter::ShowStartup() -{ - if (!m_autoStartupMwnd) { - m_autoStartupMwnd = new StartupMainWindow; - connect(m_autoStartupMwnd, &StartupMainWindow::sendWindowClose, this, [=] { - m_autoStartupMwnd->deleteLater(); - m_autoStartupMwnd = nullptr; - }); - } - - m_autoStartupMwnd->show(); - m_autoStartupMwnd->activateWindow(); -} - -// 显示网络检测弹框 -void SecurityToolDialogInter::ShowNetCheck() -{ - if (!m_netCheckMwnd) { - m_netCheckMwnd = new NetCheckMainWindow; - connect(m_netCheckMwnd, &NetCheckMainWindow::sendWindowClose, this, [=] { - m_netCheckMwnd->deleteLater(); - m_netCheckMwnd = nullptr; - }); - } - - m_netCheckMwnd->show(); - m_netCheckMwnd->activateWindow(); -} - -void SecurityToolDialogInter::OnRequestUpdateToolsInfo() -{ - m_pToolBusLineMgr->init(); -} - -void SecurityToolDialogInter::OnInstallPackage(const QString &strPackageKey) -{ - m_pToolBusLineMgr->installPackage(strPackageKey); -} - -void SecurityToolDialogInter::OnUnInstallPackage(const QString &strPackageKey) -{ - m_pToolBusLineMgr->unInstallPackage(strPackageKey); -} - -void SecurityToolDialogInter::OnUpdatePackage(const QString &strPackageKey) -{ - m_pToolBusLineMgr->updatePackage(strPackageKey); -} - -void SecurityToolDialogInter::OnShowTool(const QString &strPackageKey, const QStringList &strParams) -{ - m_pToolBusLineMgr->showTool(strPackageKey, strParams); -} - -// 接收app状态改变槽 -void SecurityToolDialogInter::acceptAppStatusChanged(const QString &strPackageKey, - DEFSECURITYTOOLSTATUS status) -{ - Q_EMIT notifyAppStatusChanged(strPackageKey, status); - - if (DEFSECURITYTOOLSTATUS::INSTALLING == status) { - if (!m_appInstalling.contains(strPackageKey)) { - m_appInstalling.append(strPackageKey); - } - } else if (DEFSECURITYTOOLSTATUS::UPDATING == status) { - if (!m_appUpdating.contains(strPackageKey)) { - m_appUpdating.append(strPackageKey); - } - } else if (DEFSECURITYTOOLSTATUS::UNINSTALLING == status) { - if (!m_appUninstalling.contains(strPackageKey)) { - m_appUninstalling.append(strPackageKey); - } - } else { - if (m_appInstalling.contains(strPackageKey)) { - m_appInstalling.removeOne(strPackageKey); - } - if (m_appUpdating.contains(strPackageKey)) { - m_appUpdating.removeOne(strPackageKey); - } - if (m_appUninstalling.contains(strPackageKey)) { - m_appUninstalling.removeOne(strPackageKey); - } - } -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytooldialoginter.h b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytooldialoginter.h deleted file mode 100644 index b72f19e..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/securitytooldialoginter.h +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (C) 2017 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include "../../deepin-pc-manager/src/window/modules/securitytools/defsecuritytoolinfo.h" -#include "securitytoolbackend/defsecuritytoolsbuslinemgr.h" -#include "window/modules/securitytooldialog/startupdialog/startupwidget.h" -#include "window/modules/securitytooldialog/netcheckdialog/netcheckwidget.h" -#include "securitytooldialog_adaptor.h" - -#include - -#include -#include - -class QGSettings; - -class SecurityToolDialogInter : public QObject -{ - Q_OBJECT -public: - explicit SecurityToolDialogInter(QObject *parent = nullptr); - virtual ~SecurityToolDialogInter() override; - -Q_SIGNALS: - // 所有的安全工具状态更新信号 - void notifyToolsInfoUpdate(const DEFSECURITYTOOLINFOLIST &infos); - // 某一个安全工具的状态发生变化的信号 - void notifyAppStatusChanged(const QString &strPackageKey, int status); - // 安全工具状态检测完成信号,在安全工具状态更新过程中可能会耗时较长,此时不应让使用者操作会禁用界面,最后使用此信号通知可以让用户进行操作了。 - // 此方法暂未使用,需要在实现依据具体情况判断是否需要使用。 - void notifyStatusCheckFinished(); - -public Q_SLOTS: - // 显示自启动管理弹框 - void ShowStartup(); - // 显示网络检测弹框 - void ShowNetCheck(); - - // 响应更新工具信息请求 - void OnRequestUpdateToolsInfo(); - // 响应工具包安装请求 - void OnInstallPackage(const QString &strPackageKey); - // 响应包安装请求 - void OnUnInstallPackage(const QString &strPackageKey); - // 响应包更新请求 - void OnUpdatePackage(const QString &strPackageKey); - // 响应显示工具请求 - void OnShowTool(const QString &strPackageKey, const QStringList &strParams); - - // 得到正在安装/更新/卸载的app - QStringList GetInstallingApps() { return m_appInstalling; } - - QStringList GetUpdatingApps() { return m_appUpdating; } - - QStringList GetUninstallingApps() { return m_appUninstalling; } - - void SetDefenderPaletteType(int type); - -private: - void initConnections(); - void getDefenderPaletteType(); - // 接收app状态改变槽 - void acceptAppStatusChanged(const QString &strPackageKey, DEFSECURITYTOOLSTATUS status); - -private: - SecuritytooldialogAdaptor *m_securityToolsAdaptor; - DGuiApplicationHelper *m_guiHelper; // 方便得到系统主题 - QGSettings *m_gsetting; // gsetting配置对象 - - StartupMainWindow *m_autoStartupMwnd; - NetCheckMainWindow *m_netCheckMwnd; - DefSecurityToolsBusLineMgr *m_pToolBusLineMgr; - - QStringList m_appInstalling; - QStringList m_appUpdating; - QStringList m_appUninstalling; -}; diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/startupdialog/autostartmodel.cpp b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/startupdialog/autostartmodel.cpp deleted file mode 100644 index 39b1083..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/startupdialog/autostartmodel.cpp +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (C) 2019 ~ 2021 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "autostartmodel.h" - -#include "../../deepin-pc-manager/src/window/modules/common/invokers/invokerfactory.h" - -#include - -AutoStartModel::AutoStartModel(QObject *parent) - : QObject(parent) - , m_dataInterfaceInvoker(nullptr) -{ - init(); - initSignalSLot(); -} - -AutoStartModel::~AutoStartModel() { } - -// 更新所有应用自启动状态 -bool AutoStartModel::updateAppsAutoStartStatus() const -{ - // 更新所有应用自动动状态 - QDBusMessage msg = DBUS_BLOCK_INVOKE(m_dataInterfaceInvoker, "startLauncherManage"); - GET_MESSAGE_VALUE(bool, succeed, msg); - return succeed; -} - -// 获取所有自启动应用的信息字符串 -QString AutoStartModel::getAllAutoStartAppsInfoStr() const -{ - QDBusMessage msg = DBUS_BLOCK_INVOKE(m_dataInterfaceInvoker, "getAppsInfoEnable"); - GET_MESSAGE_VALUE(QString, autoStartAppsInfoStr, msg); - return autoStartAppsInfoStr; -} - -// 获取所有非自启动应用的信息字符串 -QString AutoStartModel::getAllNonautoStartAppsInfoStr() const -{ - QDBusMessage msg = DBUS_BLOCK_INVOKE(m_dataInterfaceInvoker, "getAppsInfoDisable"); - GET_MESSAGE_VALUE(QString, nonautoStartAppsInfoStr, msg); - return nonautoStartAppsInfoStr; -} - -// 应用是否自启动 -bool AutoStartModel::isAppAutoStart(const QString &path) const -{ - // 判断该应用状态(是否是自启动) - QDBusMessage msg = DBUS_BLOCK_INVOKE(m_dataInterfaceInvoker, "isAutostart", path); - GET_MESSAGE_VALUE(bool, autoStart, msg); - return autoStart; -} - -// 设置应用自启动 -bool AutoStartModel::setAppAutoStart(int status, const QString &path) const -{ - // 执行自启动开启/关闭操作 - QDBusMessage msg = DBUS_BLOCK_INVOKE(m_dataInterfaceInvoker, "exeAutostart", status, path); - GET_MESSAGE_VALUE(bool, autoStart, msg); - return autoStart; -} - -// 添加日志 -void AutoStartModel::addSecurityLog(int type, const QString &log) const -{ - Q_UNUSED(type); - Q_UNUSED(log); -} - -void AutoStartModel::init() -{ - m_dataInterfaceInvoker = - InvokerFactory::GetInstance().CreateInvoker("com.deepin.pc.manager.session.daemon", - "/com/deepin/pc/manager/session/daemon", - "com.deepin.pc.manager.session.daemon", - ConnectType::SESSION, - this); -} - -void AutoStartModel::initSignalSLot() -{ - // 后台自启动数据刷新信号连接 - m_dataInterfaceInvoker->Connect("AccessRefreshData", - this, - SLOT(itemStatusChanged(bool, QString))); -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/startupdialog/autostartmodel.h b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/startupdialog/autostartmodel.h deleted file mode 100644 index c4e0f86..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/securitytooldialog/startupdialog/autostartmodel.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2019 ~ 2021 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include - -class DBusInvokerInterface; -class SettingsInvokerInterface; - -namespace def { -class SystemSettings; -} - -using namespace def; - -class AutoStartModel : public QObject -{ - Q_OBJECT -public: - explicit AutoStartModel(QObject *parent = nullptr); - ~AutoStartModel(); - - // 更新所有应用自启动状态 - bool updateAppsAutoStartStatus() const; - // 获取所有自启动应用的信息字符串 - QString getAllAutoStartAppsInfoStr() const; - // 获取所有非自启动应用的信息字符串 - QString getAllNonautoStartAppsInfoStr() const; - // 应用是否自启动 - bool isAppAutoStart(const QString &path) const; - // 设置应用自启动 - bool setAppAutoStart(int status, const QString &path) const; - // 添加日志 - void addSecurityLog(int type, const QString &log) const; - -Q_SIGNALS: - void itemStatusChanged(bool isAuto, const QString &id); - -private: - void init(); - // 初始化信号 - void initSignalSLot(); - -private: - DBusInvokerInterface *m_dataInterfaceInvoker; // 安全中心数据服务接口 -}; diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/trashclean/trashcleanappinfofilter.cpp b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/trashclean/trashcleanappinfofilter.cpp deleted file mode 100644 index 17e9857..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/trashclean/trashcleanappinfofilter.cpp +++ /dev/null @@ -1,304 +0,0 @@ -// Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "trashcleanappinfofilter.h" - -#include "../../deepin-pc-manager/src/window/modules/common/common.h" -#include "../../deepin-pc-manager/src/window/modules/common/invokers/invokerfactory.h" -#include "window/modules/common/defenderlauncherinfo.h" - -#include -#include - -#define LAUNCHER_PATH "/com/deepin/dde/daemon/Launcher" -#define LAUNCHER_SERVICE "com.deepin.dde.daemon.Launcher" -#define LAUNCHER_INTERFACE "com.deepin.dde.daemon.Launcher" - -TrashCleanAppInfoFilter::TrashCleanAppInfoFilter(QObject *parent) - : QObject(parent) -{ - // 向qt注册用于dbus返回解析的数据结构类型 - registerLauncherItemInfoMetaType(); - registerLauncherItemInfoListMetaType(); - m_monitorInterFaceServer = - InvokerFactory::GetInstance().CreateInvoker("com.deepin.pc.manager.system.daemon", - "/com/deepin/pc/manager/system/daemon", - "com.deepin.pc.manager.system.daemon", - ConnectType::SYSTEM, - this); -} - -TrashCleanAppInfoFilter::~TrashCleanAppInfoFilter() -{ - reset(); -} - -// 配置文件是不变的,即只需调用一次fromjson,可调用多次tolist更新结果 -TrashCleanAppList TrashCleanAppInfoFilter::ToList() -{ - MergeAppInfo(); - TrashCleanAppList appList; - - foreach (const auto &appInfo, m_appInfoList) { - if (isValidConfig(appInfo)) { - appList.append(appInfo); - } - } - - return appList; -} - -// 从配置文件中初步构建数据结构 -// 之后与其它信息检查冲突并合并 -bool TrashCleanAppInfoFilter::FromJson(QString jsonPath) -{ - reset(); - - m_appInfoList = InitAppData(jsonPath); - - if (m_appInfoList.size()) { - return true; - } - - return false; -} - -// 外部调用,确保写数据库的对象存在于配置中 -bool TrashCleanAppInfoFilter::isExistInConfig(const QString &appID) -{ - foreach (const auto &app, m_appInfoList) { - if (app.appPkgName == appID) { - return true; - } - } - - return false; -} - -// 注意此方法在单元测试中应事先mock -QMap TrashCleanAppInfoFilter::GetInstalledApps() -{ - // 从接口获取已安装应用 - // 注意,非成员变量或没有必要不使用指针 - // 使用局部变量或RAII封装 - QMap appInfoMap; - QDBusInterface launchInterface(LAUNCHER_SERVICE, - LAUNCHER_PATH, - LAUNCHER_INTERFACE, - QDBusConnection::sessionBus()); - - QDBusReply reply = launchInterface.call("GetAllItemInfos"); - if (!reply.isValid()) { - return appInfoMap; - } - - LauncherItemInfoList installedApps = reply.value(); - foreach (auto &installedApp, installedApps) { - appInfoMap.insert(installedApp.ID, installedApp.Name); - } - - return appInfoMap; -} - -// 注意此方法在单元测试中应事先mock -QList> TrashCleanAppInfoFilter::GetUnInstalledApps() -{ - QList> appInfoList; - QDBusMessage msgLog = DBUS_BLOCK_INVOKE(m_monitorInterFaceServer, "GetUnInstalledApps"); - GET_MESSAGE_VALUE(QVariantList, varList, msgLog); - QStringList line; - foreach (auto record, varList) { - line.clear(); - QSequentialIterable iterable = record.value(); - for (const QVariant &v : iterable) { - line.append(v.toString()); - } - // 每行只有两个元素 - if (line.size() != 2) { - continue; - } - appInfoList.append(QPair(line.at(0), line.at(1))); - } - - return appInfoList; -} - -// 公有化虚函数以提供子类对json的其它处理 -// 注意不要使用私有变量,否则将阻止子类重写 -TrashCleanAppList TrashCleanAppInfoFilter::InitAppData(QString jsonPath) -{ - TrashCleanAppList appList; - // 处理json信息 - // 需要从JSON中取出包名与配置 - QJsonDocument appInfoDoc; - QJsonParseError err; - // 读app.json获取名称和路径信息 - QFile appfile(jsonPath); - if (!appfile.open(QFile::ReadOnly)) { - qDebug() << "can not find app info file:" << jsonPath; - return appList; - } - - QJsonObject object = QJsonDocument::fromJson(appfile.readAll(), &err).object(); - appfile.close(); - - if (QJsonParseError::NoError != err.error) { - qDebug() << "incorrect json format:" << jsonPath; - return appList; - } - QJsonArray apps = object.value(CLEANER_APP_JSON_NAME).toArray(); - - foreach (const auto &it, apps) { - TrashCleanApp appData; - auto appObj = it.toObject(); - // 取出ID 路径配置 - QString appID = appObj.value(CLEANER_APP_ID).toString(); - if (appID.isEmpty()) { - continue; - } - - appData.appPkgName = appID; - - // 应用白名单 - foreach (const auto &whiteFile, appObj.value(CLEANER_APP_WHITE_LIST).toArray()) { - appData.whiteList.append(whiteFile.toString()); - } - - // 应用黑名单 - foreach (const auto &blackFile, appObj.value(CLEANER_APP_BLACK_LIST).toArray()) { - appData.blackList.append(blackFile.toString()); - } - - // 应用 config 路径配置 - foreach (const auto &configDir, appObj.value(CLEANER_APP_CONFIG_PATH).toArray()) { - appData.appConfigPaths.append(configDir.toString()); - } - - // 应用 cache 路径配置 - foreach (const auto &cacheDir, appObj.value(CLEANER_APP_CACHE_PATH).toArray()) { - appData.appCachePaths.append(cacheDir.toString()); - } - appList.append(appData); - } - - return appList; -} - -// 公有虚方法,以供子类重写 -void TrashCleanAppInfoFilter::MergeAppInfo() -{ - MergeInstalledAppInfo(GetInstalledApps()); - MergeUninstalledAppInfo(GetUnInstalledApps()); -} - -void TrashCleanAppInfoFilter::MergeInstalledAppInfo(const QMap &installedApps) -{ - for (auto it = m_appInfoList.begin(); it != m_appInfoList.end(); it++) { - auto installIt = installedApps.find(it->appPkgName); - if (installedApps.end() == installIt) { - continue; - } - it->appDisplayName = installIt.value(); - it->isInstalled = true; - - // 开始检查目录配置冲突 - // 已安装应用不处理config路径,但是需要记录以避免卸载项意外删除 - bool isMutipleVersionApp = false; - foreach (auto path, it->appCachePaths) { - if (m_installedAppPaths.contains(path)) { - it->appCachePaths.removeAll(path); - // 路径与已记载内容发生冲突,可以是多版本的应用 - isMutipleVersionApp = true; - } - } - - if (isMutipleVersionApp && it->appCachePaths.isEmpty()) { - // 多版本应用只显示其中一个的处理 - // 清空后,后续判断不会将其作为有效检查项 - it->appConfigPaths.clear(); - } - - m_installedAppPaths.append(it->appCachePaths); - m_installedAppPaths.append(it->appConfigPaths); // 避免config配置目录被删除 - // 存在性能问题,但当前场景下应当不会有大影响,数据量应该少于30 - m_installedAppPaths = - QSet(m_installedAppPaths.begin(), m_installedAppPaths.end()).values(); - } -} - -// uninstalledApps内容,应由数据库返回,ID从大到小排序列 -void TrashCleanAppInfoFilter::MergeUninstalledAppInfo( - const QList> &uninstalledApps) -{ - auto findItemInList = [&](const QString appID, QString &appName) { - foreach (auto it, uninstalledApps) { - if (it.first == appID) { - appName = it.second; - return true; - } - } - return false; - }; - - for (auto it = m_appInfoList.begin(); it != m_appInfoList.end(); it++) { - if (it->isInstalled) { - continue; - } - QString appName; - if (findItemInList(it->appPkgName, appName)) { - it->appDisplayName = appName; - } else { - continue; - } - - // 开始检查目录配置冲突 - // cache路径冲突检查 - foreach (auto path, it->appCachePaths) { - if (m_installedAppPaths.contains(path)) { - it->appCachePaths.removeAll(path); - } - - // 最后卸载的应用优先处理 - // 之前卸载的应用,冲突时不再处理 - if (m_uninstalledAppPaths.contains(path)) { - it->appCachePaths.removeAll(path); - } - } - // config路径冲突检查 - foreach (auto path, it->appConfigPaths) { - if (m_installedAppPaths.contains(path)) { - it->appConfigPaths.removeAll(path); - } - - if (m_uninstalledAppPaths.contains(path)) { - it->appConfigPaths.removeAll(path); - } - } - - m_uninstalledAppPaths.append(it->appCachePaths); - m_uninstalledAppPaths.append(it->appConfigPaths); - m_uninstalledAppPaths = - QSet(m_uninstalledAppPaths.begin(), m_uninstalledAppPaths.end()).values(); - } -} - -void TrashCleanAppInfoFilter::reset() -{ - m_installedAppPaths.clear(); - m_uninstalledAppPaths.clear(); - m_appInfoList.clear(); -} - -bool TrashCleanAppInfoFilter::isValidConfig(const TrashCleanApp &app) -{ - if (app.appDisplayName.isEmpty()) { - return false; - } - - if (app.appCachePaths.size() || app.appConfigPaths.size()) { - return true; - } - return false; -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/trashclean/trashcleanappinfofilter.h b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/trashclean/trashcleanappinfofilter.h deleted file mode 100644 index f84c26e..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/trashclean/trashcleanappinfofilter.h +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef TRASHCLEANAPPINFOFILTER_H -#define TRASHCLEANAPPINFOFILTER_H - -#include "../../deepin-pc-manager/src/window/modules/common/invokers/invokerinterface.h" -#include - -// 使用该结构体保存记录,由于不打算修改trashcleanwidget逻辑,所以后端处理后依旧使用json传递结果 -struct TrashCleanApp { - bool isInstalled; // 本应用属于已安装应用还是卸载应用 - QString appPkgName; // 应用的包名 - QString appDisplayName; // 应用在系统桌面的显示名称 - QStringList appConfigPaths; // 从配置中获取的应用config路径 - QStringList appCachePaths; // 从配置中获取的应用cache路径 - QStringList browserCookiesPaths; // 浏览器cookies路径 - QStringList whiteList; // 白名单 - QStringList blackList; // 黑名单 - TrashCleanApp() - : isInstalled(false) - , appPkgName("") - , appDisplayName("") - { - } -}; -typedef QList TrashCleanAppList; - -// 接口声明暂放在这里,等待之后统一建立接口文件目录再移动 -class TrashCleanAppInfoFilterInterface -{ -public: - virtual ~TrashCleanAppInfoFilterInterface() = default; - virtual bool FromJson(QString) = 0; - virtual TrashCleanAppList ToList() = 0; -}; - -class TrashCleanAppInfoFilter : public QObject - , public TrashCleanAppInfoFilterInterface -{ - Q_OBJECT -public: - explicit TrashCleanAppInfoFilter(QObject *parent = nullptr); - virtual ~TrashCleanAppInfoFilter() override; - // 返回结果窗口,由于是同工程类内调用,避免再次做JSON解析 - virtual TrashCleanAppList ToList() override; - // 从配置文件开始构建过滤器内容 - virtual bool FromJson(QString) override; - // 检查包名是否存在于配置中 - virtual bool isExistInConfig(const QString &); - - // 通过dbus接口获取已安装应用信息:包名 应用名, - // 因单元测试需要作为public virtual方法 - virtual QMap GetInstalledApps(); - - // 通过数据库获取已卸载应用信息:包名 应用名 - // 注意写数据库时也将应用名写和表 - // 不要对用map存储,会被重新排序 - virtual QList> GetUnInstalledApps(); - - virtual TrashCleanAppList InitAppData(QString); - - virtual void MergeAppInfo(); - - // 因单元测试需要作为public方法 - void MergeInstalledAppInfo(const QMap &); - void MergeUninstalledAppInfo(const QList> &); - -private: - void reset(); - // 检查应用元素的config和cache目录配置是否均为空 - // 两项配置为空时认为该元素无效 - virtual bool isValidConfig(const TrashCleanApp &); - - QStringList m_installedAppPaths; - QStringList m_uninstalledAppPaths; - // 由dbus接口查询获取已安装app - // 由数据库查询获取已卸载app - // 对比配置文件,如果有配置,即加入该list - TrashCleanAppList m_appInfoList; - DBusInvokerInterface *m_monitorInterFaceServer; // 系统服务日志添加对象 -}; - -#endif // TRASHCLEANAPPINFOFILTER_H diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/trashclean/trashcleanbrowserinfofilter.cpp b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/trashclean/trashcleanbrowserinfofilter.cpp deleted file mode 100644 index 43805c0..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/trashclean/trashcleanbrowserinfofilter.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "trashcleanbrowserinfofilter.h" -#include "../../deepin-pc-manager/src/window/modules/common/common.h" - -#include -#include -#include -#include -#include - -TrashCleanBrowserInfoFilter::TrashCleanBrowserInfoFilter(QObject *parent) - : TrashCleanAppInfoFilter(parent) -{ -} - -// 重写父类 -// 解析JSON并仅取出cookies内容 -TrashCleanAppList TrashCleanBrowserInfoFilter::InitAppData(QString jsonPath) -{ - TrashCleanAppList appList; - // 处理json信息 - // 需要从JSON中取出包名与配置 - QJsonDocument appInfoDoc; - QJsonParseError err; - // 读app.json获取名称和路径信息 - QFile appfile(jsonPath); - if (!appfile.open(QFile::ReadOnly)) { - qDebug() << "can not find app info file:" << jsonPath; - return appList; - } - - QJsonObject object = QJsonDocument::fromJson(appfile.readAll(), &err).object(); - appfile.close(); - - if (QJsonParseError::NoError != err.error) { - qDebug() << "incorrect json format:" << jsonPath; - return appList; - } - QJsonArray apps = object.value(CLEANER_BROWSER_JSON_NAME).toArray(); - - foreach (const auto &it, apps) { - TrashCleanApp appData; - auto appObj = it.toObject(); - // 取出ID 路径配置 - QString appID = appObj.value(CLEANER_APP_ID).toString(); - if (appID.isEmpty()) { - continue; - } - - appData.appPkgName = appID; - - // 浏览器cookies路径 - foreach (const auto &cookiesPath, appObj.value(CLEANER_BROWSER_COOKIES_PATH).toArray()) { - appData.browserCookiesPaths.append(cookiesPath.toString()); - } - - appList.append(appData); - } - - return appList; -} - -// 重写父类 -// 不需要处理卸载应用 -void TrashCleanBrowserInfoFilter::MergeAppInfo() -{ - MergeInstalledAppInfo(GetInstalledApps()); -} - -bool TrashCleanBrowserInfoFilter::isValidConfig(const TrashCleanApp &app) -{ - if (!app.appDisplayName.isEmpty() && app.browserCookiesPaths.size()) { - return true; - } - - return false; -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/trashclean/trashcleanbrowserinfofilter.h b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/trashclean/trashcleanbrowserinfofilter.h deleted file mode 100644 index 341a067..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/modules/trashclean/trashcleanbrowserinfofilter.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef TRASHCLEANBROWSERINFOFILTER_H -#define TRASHCLEANBROWSERINFOFILTER_H - -#include "trashcleanappinfofilter.h" - -class TrashCleanBrowserInfoFilter : public TrashCleanAppInfoFilter -{ - Q_OBJECT -public: - explicit TrashCleanBrowserInfoFilter(QObject *parent = nullptr); - virtual ~TrashCleanBrowserInfoFilter() override = default; - // 针对浏览器cookies获取 - // 重写以下方法 - virtual TrashCleanAppList InitAppData(QString) override; - virtual void MergeAppInfo() override; - -private: - virtual bool isValidConfig(const TrashCleanApp &) override; -}; - -#endif // TRASHCLEANBROWSERINFOFILTER_H diff --git a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/namespace.h b/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/namespace.h deleted file mode 100644 index 5bd7d1b..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-session-daemon/window/namespace.h +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#define DEF_NAMESPACE_BEGIN - -#define DEF_NAMESPACE_END - -#define DEF_USING_NAMESPACE - -#define DEF_ANTIVIRUS_NAMESPACE_BEGIN - -#define DEF_ANTIVIRUS_NAMESPACE_END - -#define DEF_USING_ANTIVIRUS_NAMESPACE - -#define DEF_NETPROTECTION_NAMESPACE_BEGIN - -#define DEF_NETPROTECTION_NAMESPACE_END - -#define DEF_USING_NETPROTECTION_NAMESPACE diff --git a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/CMakeLists.txt b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/CMakeLists.txt index 8c929eb..94d8c5b 100644 --- a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/CMakeLists.txt +++ b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/CMakeLists.txt @@ -1,7 +1,3 @@ -# SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -# -# SPDX-License-Identifier: GPL-3.0-or-later - set(BIN_NAME deepin-pc-manager-system-daemon) # 设置包含当前目录,建议头文件的包含写全路径 @@ -19,19 +15,13 @@ find_package(Dtk REQUIRED COMPONENTS Core Widget) # 建议对不同的模块进行分类,可使用通配符,可指定具名文件 file(GLOB_RECURSE SRCS - "disk/*.h" - "disk/*.cpp" - "localcache/*.h" - "localcache/*.cpp" + "*.xml" + "src/*.h" + "src/*.cpp" "netcheck/*.h" "netcheck/*.cpp" - "main.cpp" - "writedbusdata.cpp" - "writedbusdata.h" - "daemon_adaptor.cpp" - "daemon_adaptor.h" - "../../deepin-pc-manager/src/window/modules/common/*.cpp" - "../../deepin-pc-manager/src/window/modules/common/*.h" + "../../deepin-pc-manager/src/window/common/*.cpp" + "../../deepin-pc-manager/src/window/common/*.h" ) # 生成可执行文件 @@ -58,8 +48,7 @@ target_include_directories(${BIN_NAME} PUBLIC Dtk::Widget PkgConfig::GSettings PkgConfig::LibParted - ../../deepin-pc-manager/ - ../../deepin-pc-manager/src/ + ../../deepin-pc-manager/src/window/common/ ) target_link_libraries(${BIN_NAME} PRIVATE @@ -82,4 +71,3 @@ install(FILES com.deepin.pc.manager.system.daemon.conf DESTINATION ${CMAKE_INSTA install(FILES com.deepin.pc.manager.system.daemon.service DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/dbus-1/system-services) install(FILES config/netcheck/com.deepin.pc.manager.netcheck.conf DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/dbus-1/system.d) install(FILES config/netcheck/com.deepin.pc.manager.netcheck.service DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/dbus-1/system-services) -install(FILES deepin-pc-manager-system-daemon.service DESTINATION /lib/systemd/system) diff --git a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/com.deepin.pc.manager.system.daemon.xml b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/com.deepin.pc.manager.system.daemon.xml new file mode 100644 index 0000000..de503e4 --- /dev/null +++ b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/com.deepin.pc.manager.system.daemon.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/config/netcheck/com.deepin.pc.manager.netcheck.xml b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/config/netcheck/com.deepin.pc.manager.netcheck.xml index 93f8ddc..b1026d5 100644 --- a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/config/netcheck/com.deepin.pc.manager.netcheck.xml +++ b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/config/netcheck/com.deepin.pc.manager.netcheck.xml @@ -1,9 +1,3 @@ - - diff --git a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/daemon_adaptor.cpp b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/daemon_adaptor.cpp deleted file mode 100644 index 8b9b141..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/daemon_adaptor.cpp +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (C) 2020 The Qt Company Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "daemon_adaptor.h" -#include -#include -#include -#include -#include -#include -#include - -/* - * Implementation of adaptor class DaemonAdaptor - */ - -DaemonAdaptor::DaemonAdaptor(QObject *parent) - : QDBusAbstractAdaptor(parent) -{ - // constructor - setAutoRelaySignals(true); -} - -DaemonAdaptor::~DaemonAdaptor() -{ - // destructor -} - -void DaemonAdaptor::CleanJournal() -{ - // handle method call com.deepin.pc.manager.system.daemon.CleanJournal - QMetaObject::invokeMethod(parent(), "CleanJournal"); -} - -void DaemonAdaptor::CleanSelectFile(const QStringList &pathList) -{ - // handle method call com.deepin.pc.manager.system.daemon.CleanSelectFile - QMetaObject::invokeMethod(parent(), "CleanSelectFile", Q_ARG(QStringList, pathList)); -} - -void DaemonAdaptor::DeleteUninstalledAppRecord(const QString &sAppID) -{ - // handle method call com.deepin.pc.manager.system.daemon.DeleteUninstalledAppRecord - QMetaObject::invokeMethod(parent(), "DeleteUninstalledAppRecord", Q_ARG(QString, sAppID)); -} - -void DaemonAdaptor::ExitApp() -{ - // handle method call com.deepin.pc.manager.system.daemon.ExitApp - QMetaObject::invokeMethod(parent(), "ExitApp"); -} - -QStringList DaemonAdaptor::GetDiskDevicePathList() -{ - // handle method call com.deepin.pc.manager.system.daemon.GetDiskDevicePathList - QStringList pathList; - QMetaObject::invokeMethod(parent(), "GetDiskDevicePathList", Q_RETURN_ARG(QStringList, pathList)); - return pathList; -} - -QDBusVariant DaemonAdaptor::GetSysSettingValue(const QString &key) -{ - // handle method call com.deepin.pc.manager.system.daemon.GetSysSettingValue - QDBusVariant value; - QMetaObject::invokeMethod(parent(), "GetSysSettingValue", Q_RETURN_ARG(QDBusVariant, value), Q_ARG(QString, key)); - return value; -} - -QVariantList DaemonAdaptor::GetUnInstalledApps() -{ - // handle method call com.deepin.pc.manager.system.daemon.GetUnInstalledApps - QVariantList out0; - QMetaObject::invokeMethod(parent(), "GetUnInstalledApps", Q_RETURN_ARG(QVariantList, out0)); - return out0; -} - -void DaemonAdaptor::InsertUninstalledAppRecord(const QString &sAppID, const QString &sAppName) -{ - // handle method call com.deepin.pc.manager.system.daemon.InsertUninstalledAppRecord - QMetaObject::invokeMethod(parent(), "InsertUninstalledAppRecord", Q_ARG(QString, sAppID), Q_ARG(QString, sAppName)); -} - -QString DaemonAdaptor::QueryPackageName(const QString &sBinaryFile) -{ - // handle method call com.deepin.pc.manager.system.daemon.QueryPackageName - QString sPkgName; - QMetaObject::invokeMethod(parent(), "QueryPackageName", Q_RETURN_ARG(QString, sPkgName), Q_ARG(QString, sBinaryFile)); - return sPkgName; -} - -void DaemonAdaptor::RefreshPackageTable() -{ - // handle method call com.deepin.pc.manager.system.daemon.RefreshPackageTable - QMetaObject::invokeMethod(parent(), "RefreshPackageTable"); -} - -bool DaemonAdaptor::SetSysSettingValue(const QString &key, const QDBusVariant &value) -{ - // handle method call com.deepin.pc.manager.system.daemon.SetSysSettingValue - bool succeed; - QMetaObject::invokeMethod(parent(), "SetSysSettingValue", Q_RETURN_ARG(bool, succeed), Q_ARG(QString, key), Q_ARG(QDBusVariant, value)); - return succeed; -} - -void DaemonAdaptor::StartApp() -{ - // handle method call com.deepin.pc.manager.system.daemon.StartApp - QMetaObject::invokeMethod(parent(), "StartApp"); -} - -QString DaemonAdaptor::getProExePath(const QString &sId) -{ - // handle method call com.deepin.pc.manager.system.daemon.getProExePath - QString value; - QMetaObject::invokeMethod(parent(), "getProExePath", Q_RETURN_ARG(QString, value), Q_ARG(QString, sId)); - return value; -} - diff --git a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/daemon_adaptor.h b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/daemon_adaptor.h deleted file mode 100644 index 1692db4..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/daemon_adaptor.h +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (C) 2020 The Qt Company Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef DAEMON_ADAPTOR_H -#define DAEMON_ADAPTOR_H - -#include -#include -#include "../deepin-pc-manager-session-daemon/window/modules/common/defenderprocinfolist.h" -#include "../../deepin-pc-manager/src/window/modules/common/common.h" -QT_BEGIN_NAMESPACE -class QByteArray; -template class QList; -template class QMap; -class QString; -class QStringList; -class QVariant; -QT_END_NAMESPACE - -/* - * Adaptor class for interface com.deepin.pc.manager.system.daemon - */ -class DaemonAdaptor: public QDBusAbstractAdaptor -{ - Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "com.deepin.pc.manager.system.daemon") - Q_CLASSINFO("D-Bus Introspection", "" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" - "") -public: - DaemonAdaptor(QObject *parent); - virtual ~DaemonAdaptor(); - -public: // PROPERTIES -public Q_SLOTS: // METHODS - void CleanJournal(); - void CleanSelectFile(const QStringList &pathList); - void DeleteUninstalledAppRecord(const QString &sAppID); - void ExitApp(); - QStringList GetDiskDevicePathList(); - QDBusVariant GetSysSettingValue(const QString &key); - QVariantList GetUnInstalledApps(); - void InsertUninstalledAppRecord(const QString &sAppID, const QString &sAppName); - QString QueryPackageName(const QString &sBinaryFile); - void RefreshPackageTable(); - bool SetSysSettingValue(const QString &key, const QDBusVariant &value); - void StartApp(); - QString getProExePath(const QString &sId); -Q_SIGNALS: // SIGNALS - void NotifySqlInsertFinish(); - void SysSettingValueChanged(const QString &key, const QDBusVariant &value); -}; - -#endif diff --git a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/deepin-pc-manager-system-daemon.service b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/deepin-pc-manager-system-daemon.service deleted file mode 100644 index fd1db0b..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/deepin-pc-manager-system-daemon.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=deepin pc manager -#Before= -After=systemd-remount-fs.service systemd-sysusers.service network.target -Conflicts=shutdown.target - -[Service] -ExecStart=/usr/bin/deepin-pc-manager-system-daemon -Restart=always -RestartSec=3 - -[Install] -WantedBy=sysinit.target diff --git a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/disk/disk.cpp b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/disk/disk.cpp deleted file mode 100644 index 74a4391..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/disk/disk.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2019 ~ 2020 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "disk.h" - -#include "parted/parted.h" - -#include -#include - -// 检查是否为可用设备 -bool useableDevice(const PedDevice *lpDevice) -{ - Q_ASSERT(nullptr != lpDevice); - char *buf = static_cast(malloc(size_t(lpDevice->sector_size))); - if (!buf) - return false; - - // Must be able to read from the first sector before the disk device is considered - // useable in GParted. - bool success = false; - int fd = open(lpDevice->path, O_RDONLY | O_NONBLOCK); - if (fd >= 0) { - ssize_t bytesRead = read(fd, buf, size_t(lpDevice->sector_size)); - success = (bytesRead == lpDevice->sector_size); - close(fd); - } - free(buf); - return success; -} - -// 获取磁盘设备路径列表 -QList getDiskDevicePathList() -{ - QList devicepaths{}; - - ped_device_probe_all(); - PedDevice *lpDevice = ped_device_get_next(nullptr); - while (lpDevice) { - if (useableDevice(lpDevice)) { - devicepaths.append(lpDevice->path); - } - lpDevice = ped_device_get_next(lpDevice); - } - - return devicepaths; -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/disk/disk.h b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/disk/disk.h deleted file mode 100644 index 1270e24..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/disk/disk.h +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (C) 2019 ~ 2020 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include - -#include -#include - -// 获取磁盘设备路径列表 -QList getDiskDevicePathList(); diff --git a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/localcache/securitypkgnamesql.cpp b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/localcache/securitypkgnamesql.cpp deleted file mode 100644 index e93a7c3..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/localcache/securitypkgnamesql.cpp +++ /dev/null @@ -1,227 +0,0 @@ -// Copyright (C) 2019 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "securitypkgnamesql.h" - -#include -#include -#include - -SecurityPkgNameSql::SecurityPkgNameSql(QSqlDatabase db, QObject *parent) - : QObject(parent) - , m_db(db) -{ -} - -SecurityPkgNameSql::~SecurityPkgNameSql() { } - -void SecurityPkgNameSql::quit() { } - -// 新建(可执行文件->包名)映射数据表 -void SecurityPkgNameSql::createPackageLinkTable() -{ - if (!m_db.open()) { - qDebug() << "pkgName db open error!"; - return; - } - - // 服务第一次启动启动时,创建包名解析表 package_binary_file - QSqlQuery query(m_db); - bool bRet = query.exec("create table if not exists package_binary_file " - "(binaryPath VARCHAR NOT NULL, " - "packageName VARCHAR NOT NULL)"); - if (!bRet) { - qDebug() << "pkgName localcachedb exec error" << query.lastError(); - } - - // 查询package_binary_file表中已有的包名 - queryPackageList(); - return; -} - -// 查询package_binary_file表中已有的包名 -void SecurityPkgNameSql::queryPackageList() -{ - // 清空容器并判断数据库是否打开 - m_sPkgNameList.clear(); - if (!m_db.open()) { - qDebug() << "pkgName localcachedb open error!"; - return; - } - - // 查询packageName字段所有数据 - QSqlQuery query(m_db); - QString sCmd; - sCmd = QString("select packageName from package_binary_file"); - if (!query.exec(sCmd)) { - qDebug() << "query localcachedb error : " << query.lastError(); - } else { - // 将已有的所有包名插入到QStringList容器当中 - while (query.next()) { - m_sPkgNameList.append(query.value(0).toString()); - } - // 容器去重 - m_sPkgNameList = QSet(m_sPkgNameList.begin(), m_sPkgNameList.end()).values(); - } - - // 获取包名及相关联文件 - getPkgNameLinkFile(); -} - -// 获取包名及相关联文件 -void SecurityPkgNameSql::getPkgNameLinkFile() -{ - getDesktopPackage(); -} - -// 建立desktop file -> package 映射 -void SecurityPkgNameSql::getDesktopPackage() -{ - // 清理包名及相关联文件容器 - m_sPkgNameMap.clear(); - - // 使用dpkg查询桌面应用包名 - auto shellCmd = "dpkg --search '*.desktop'"; - - // 使用管道获取命令执行数据 - FILE *pp = nullptr; - if ((pp = popen(shellCmd, "r")) == nullptr) { - perror("popen() error!"); - return; - } - - // 解析出所有的桌面应用包名 - char buf[1024] = { 0 }; - std::string szTmp{ "" }, szResult{ "" }, szPackageName{ "" }, szDesktopName{ "" }; - int nInsertCount = 0; - while (fgets(buf, sizeof buf, pp)) { - szTmp = buf; - szTmp.erase(std::remove(szTmp.begin(), szTmp.end(), '\n'), szTmp.end()); - size_t nIndex = szTmp.find_last_of(':'); - szPackageName = szTmp.substr(0, nIndex); - if (szPackageName.find(":") != std::string::npos) { - size_t nIdx = szPackageName.find_last_of(':'); - szPackageName = szTmp.substr(0, nIdx); - } - szDesktopName = szTmp.substr(nIndex + 2, szTmp.length() - nIndex - 2); - - // 去重 - QString sPkgName = QString::fromStdString(szPackageName); - if (!m_sPkgNameList.contains(sPkgName)) { - nInsertCount += 1; - m_sPkgNameList.append(sPkgName); - queryPackageInfo(sPkgName); - } - memset(buf, '\0', sizeof buf); - } - - // 关闭管道 - pclose(pp); - - // 如果没有可插入的项,直接返回完成信号 - if (nInsertCount <= 0) { - Q_EMIT notifySqlInsertFinish(); - return; - } - - insertPackageLinkInfo(m_sPkgNameMap); - return; -} - -// 根据已安装的包名来获取可执行文件路径 -void SecurityPkgNameSql::queryPackageInfo(const QString szPackageName) -{ - if (szPackageName == "") - return; - - QProcess *processSSH = new QProcess(this); - processSSH->start( - "dpkg", - { "-L", - szPackageName, - " | grep \"/usr/bin\\|/usr/local/bin\\|/usr/share\\|/usr/sbin\\|/opt/apps\"" }); - processSSH->waitForStarted(); - processSSH->waitForFinished(); - QString sProcessResultPath = - QString::fromLocal8Bit(processSSH->readAllStandardOutput()).trimmed(); - processSSH->close(); - processSSH->deleteLater(); - - QStringList sPkgInfoList; - sPkgInfoList = sProcessResultPath.split('\n'); - // 将包名以及相关联文件插入数据库 - for (int i = 0; i < sPkgInfoList.count(); ++i) { - QString sPkgInfo = sPkgInfoList.at(i); - QFileInfo temDir(sPkgInfo); - QString sSuffix = temDir.completeSuffix(); - // 过滤无关文件 - if (sSuffix == "svg" || sSuffix == "png" || sSuffix == "qm" || sSuffix == "htm" - || sSuffix == "gif" || sSuffix == "jpg" || sSuffix == "kuip" || sSuffix == "mo" - || sSuffix == "qss" || sSuffix == "xml" || sSuffix == "js" || sSuffix == "md" - || sSuffix == "docbook" || sSuffix == "bz2" || sSuffix == "gz" || sSuffix == "pak" - || sSuffix == "so" || sSuffix == "db" || sSuffix == "kui" || sSuffix == "data" - || sSuffix == "css" || sSuffix == "doc" || sSuffix == "dps" || sSuffix == "et" - || sSuffix == "pp" || sSuffix == "woff" || sSuffix == "xl" || sSuffix == "cfg" - || sSuffix == "ico" || sSuffix == "ini" || sSuffix == "lex" || sSuffix == "dat" - || sSuffix == "thmx" || sSuffix == "eftx" || sSuffix == "bmp" || sSuffix == "wmf" - || sSuffix == "wav" || sSuffix == "conf" || sSuffix == "qph" || sSuffix == "ent") { - continue; - } - m_sPkgNameMap[sPkgInfo] = szPackageName; - } - - return; -} - -// 插入包名及相关联文件数据 -void SecurityPkgNameSql::insertPackageLinkInfo(QMap sPkgNameMap) -{ - if (!m_db.open()) { - qDebug() << "pkgName localcachedb open error!"; - return; - } - - m_db.transaction(); - QSqlQuery query(m_db); - - QMapIterator i(sPkgNameMap); - while (i.hasNext()) { - i.next(); - QString sCmd; - sCmd = - QString("insert into package_binary_file (binaryPath, packageName) values ('%1','%2')") - .arg(i.key()) - .arg(i.value()); - if (!query.exec(sCmd)) { - qDebug() << "insert localcachedb error : " << query.lastError(); - } - } - - m_db.commit(); - Q_EMIT notifySqlInsertFinish(); -} - -// 删除数据库某个包名数据 -- 备用DBus -void SecurityPkgNameSql::deletePackageLinkInfo(const QString sPkgName) -{ - if (!m_db.open()) { - qDebug() << "pkgName localcachedb open error!"; - return; - } - - QSqlQuery query(m_db); - - QString sCmd; - sCmd = QString("delete from package_binary_file where packageName='%1'").arg(sPkgName); - if (!query.exec(sCmd)) { - qDebug() << "delete localcachedb error : " << query.lastError(); - } -} - -// 应用程序安装卸载刷新数据库 --DBus -void SecurityPkgNameSql::refreshPackageLinkTable() -{ - getPkgNameLinkFile(); -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/localcache/securitypkgnamesql.h b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/localcache/securitypkgnamesql.h deleted file mode 100644 index 2459b88..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/localcache/securitypkgnamesql.h +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2019 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include -#include -#include -#include - -#include "qmap.h" - -class SecurityPkgNameSql : public QObject -{ - Q_OBJECT - -public: - explicit SecurityPkgNameSql(QSqlDatabase db, QObject *parent = nullptr); - ~SecurityPkgNameSql(); - -public: - // 查询package_binary_file表中已有的包名 - void queryPackageList(); - - // 获取包名及相关联文件 - void getPkgNameLinkFile(); - // 建立desktop file -> package 映射 - void getDesktopPackage(); - // 根据已安装的包名来获取可执行文件路径 - void queryPackageInfo(const QString szPackageName); - - // 插入包名及相关联文件数据 - void insertPackageLinkInfo(QMap sPkgNameMap); - -public Q_SLOTS: - // 新建(可执行文件->包名)映射数据表 - void createPackageLinkTable(); - // 删除数据库某个包名数据 -- 备用 - void deletePackageLinkInfo(const QString sPkgName); - // 应用程序安装卸载刷新数据库 - void refreshPackageLinkTable(); - - // 预留接口,应付Asan内存泄露检查 - void quit(); - -Q_SIGNALS: - void notifyPackageLinkInfo(const QString sBinary, const QString sPkgName); - void notifySqlInsertFinish(); - -private: - QSqlDatabase m_db; - - QStringList m_sPkgNameList; - QMap m_sPkgNameMap; -}; diff --git a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/localcache/settingssql.cpp b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/localcache/settingssql.cpp deleted file mode 100644 index 7c7b50d..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/localcache/settingssql.cpp +++ /dev/null @@ -1,236 +0,0 @@ -// Copyright (C) 2019 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "settingssql.h" - -#include "../../deepin-pc-manager/src/window/modules/common/gsettingkey.h" - -#include -#include -#include -#include -#include -#include -#include - -#define DEFENDER_DATA_DIR_PATH "/usr/share/deepin-pc-manager/" // 数据库路径 -#define LOCAL_CACHE_DB_NAME "localcache.db" // 数据库路径 -#define TABLE_NAME_SETTINGS "Settings" -#define GSETTING_SCHEMA_XML_PATH \ - "/usr/share/glib-2.0/schemas/com.deepin.dde.deepin-pc-manager.gschema.xml" - -SettingsSql::SettingsSql(const QString &connName, QObject *parent) - : QObject(parent) - , m_connName(connName) - , m_sqlQuery(nullptr) -{ - initDb(); - - setDefaultKeyValues(); -} - -SettingsSql::~SettingsSql() { } - -bool SettingsSql::setValue(const QString &key, const QVariant &value, const bool isDefault) -{ - // 确认是否存在配置 - QVariant oldValue = getValue(key); - - // 将设置数据转换成json文本 - QJsonObject obj; - obj.insert("value", value.toJsonValue()); - QJsonDocument doc(obj); - QString jsonValue = doc.toJson(); - - // 区分设置值还是默认值 - QString valueTypeStr; - if (isDefault) { - valueTypeStr = "defaultValue"; - } else { - valueTypeStr = "value"; - } - - QString cmd; - if (oldValue.isNull()) { - // 新加配置 - cmd = QString("INSERT INTO %1 (key, %2) VALUES ('%3','%4');") - .arg(TABLE_NAME_SETTINGS) - .arg(valueTypeStr) - .arg(key) - .arg(jsonValue); - } else { - // 更新配置 - cmd = QString("UPDATE %1 SET %2='%3' WHERE key='%4';") - .arg(TABLE_NAME_SETTINGS) - .arg(valueTypeStr) - .arg(jsonValue) - .arg(key); - } - - if (!m_sqlQuery.exec(cmd)) { - qDebug() << Q_FUNC_INFO << m_sqlQuery.lastError(); - return false; - } - - return true; -} - -QVariant SettingsSql::getValue(const QString &key) -{ - QVariant retValue; - - QString cmd = QString("SELECT * FROM %1 WHERE key='%2';").arg(TABLE_NAME_SETTINGS).arg(key); - if (!m_sqlQuery.exec(cmd)) { - qDebug() << Q_FUNC_INFO << m_sqlQuery.lastError(); - return false; - } - - int count = 0; - QByteArray valueByteArray; - while (m_sqlQuery.next()) { - // 第一个数值为id - valueByteArray = m_sqlQuery.value(2).toByteArray(); - // 如果该配置未设置过值,则取默认值 - if (valueByteArray.isEmpty()) { - valueByteArray = m_sqlQuery.value(3).toByteArray(); - } - count++; - } - if (1 < count) { - // 正常情况下一个查询,数据库中只存在一个数据 - qDebug() << Q_FUNC_INFO << "queried more than 1 result!"; - } - - // 解析数据 - QJsonParseError error; - QJsonDocument doc = QJsonDocument::fromJson(valueByteArray, &error); - if (doc.object().contains("value")) { - retValue = doc.object().value("value").toVariant(); - } - return retValue; -} - -void SettingsSql::initDb() -{ - // 初始化数据库 - // 必须先判断待创建数据库所处目录是否存在,否则如果不存在,会导致数据库打开失败 - QDir defenderDataDir; - if (!defenderDataDir.exists(DEFENDER_DATA_DIR_PATH)) { - defenderDataDir.mkdir(DEFENDER_DATA_DIR_PATH); - } - m_db = QSqlDatabase::addDatabase("QSQLITE", m_connName); - m_localCacheDbPath = QString("%1%2").arg(DEFENDER_DATA_DIR_PATH).arg(LOCAL_CACHE_DB_NAME); - m_db.setDatabaseName(m_localCacheDbPath); - - if (!m_db.open()) { - qDebug() << Q_FUNC_INFO << "local db open error!"; - return; - } - - // 如果 localcache.db数据库已经存在,则服务启动时不需要刷新数据 - QStringList tableStrList = m_db.tables(); - m_sqlQuery = QSqlQuery(m_db); - if (!tableStrList.contains(TABLE_NAME_SETTINGS)) { - // 服务第一次启动启动时,创建包名解析表 flowDetail - QString cmd = - QString( - "CREATE TABLE %1 (id Long primary key, key text, value text, defaultValue text);") - .arg(TABLE_NAME_SETTINGS); - bool bRet = m_sqlQuery.exec(cmd); - if (!bRet) { - qDebug() << Q_FUNC_INFO << m_sqlQuery.lastError(); - return; - } - } -} - -// 解析gsetting xml文件,并根据文件内容设置默认值 -void SettingsSql::setDefaultKeyValues() -{ - QFile file(GSETTING_SCHEMA_XML_PATH); - if (!file.open(QIODevice::OpenModeFlag::ReadOnly)) { - qDebug() << Q_FUNC_INFO << GSETTING_SCHEMA_XML_PATH << "open failed!"; - return; - } - - // gsettings路径 - QString schemaPath; - // gsettings id - QString schemaId; - bool isSchemaDataNeed = false; - QString keyName; - QString keyType; - QXmlStreamReader xmlReader(&file); - - while (!xmlReader.atEnd()) { - if (xmlReader.isStartElement() && "schema" == xmlReader.name()) { - QXmlStreamAttributes attrs = xmlReader.attributes(); - if (attrs.hasAttribute("path")) { - schemaPath = attrs.value("path").toString(); - } - if (attrs.hasAttribute("id")) { - schemaId = attrs.value("id").toString(); - } - - if ("/com/deepin/dde/deepin-pc-manager/" == schemaPath - && DEEPIN_PC_MANAGER_GSETTING_PATH == schemaId) { - isSchemaDataNeed = true; - } - - xmlReader.readNext(); - continue; - } - - if (!isSchemaDataNeed) { - xmlReader.readNext(); - continue; - } - - // 获取配置 - readAndSetKeyDefaultValueFromXml(&xmlReader, keyName, keyType); - if (xmlReader.isEndElement() && "schema" == xmlReader.name()) { - isSchemaDataNeed = false; - xmlReader.readNext(); - continue; - } - xmlReader.readNext(); - } - - file.close(); -} - -// 从xml中读取默认值,并向数据库中写入 -void SettingsSql::readAndSetKeyDefaultValueFromXml(QXmlStreamReader *xmlReader, - QString &keyName, - QString &keyType) -{ - if (xmlReader->isStartElement() && "key" == xmlReader->name()) { - QXmlStreamAttributes attrs = xmlReader->attributes(); - if (attrs.hasAttribute("name")) { - keyName = attrs.value("name").toString(); - } - if (attrs.hasAttribute("type")) { - keyType = attrs.value("type").toString(); - } - } - - if (xmlReader->isStartElement() && "default" == xmlReader->name()) { - if ("b" == keyType) { - QString value = xmlReader->readElementText(); - bool bValue = "true" == value ? true : false; - setValue(keyName, bValue, true); - } else if ("i" == keyType) { - setValue(keyName, xmlReader->readElementText().remove("\'").remove("\"").toInt(), true); - } else if ("d" == keyType) { - setValue(keyName, - xmlReader->readElementText().remove("\'").remove("\"").toDouble(), - true); - } else if ("s" == keyType) { - setValue(keyName, xmlReader->readElementText().remove("\'").remove("\""), true); - } else { - qDebug() << Q_FUNC_INFO << "unknown gsettings key type: " << keyType; - } - } -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/localcache/settingssql.h b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/localcache/settingssql.h deleted file mode 100644 index b187d85..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/localcache/settingssql.h +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (C) 2019 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include -#include -#include -#include - -class QXmlStreamReader; - -class SettingsSql : public QObject -{ - Q_OBJECT - -public: - explicit SettingsSql(const QString &connName, QObject *parent = nullptr); - ~SettingsSql(); - - bool setValue(const QString &key, const QVariant &value, const bool isDefault = false); - QVariant getValue(const QString &key); - -public Q_SLOTS: - void initDb(); - -Q_SIGNALS: - -private: - // 解析gsetting xml文件,并根据文件内容设置默认值 - void setDefaultKeyValues(); - // 从xml中读取默认值,并向数据库中写入 - void readAndSetKeyDefaultValueFromXml(QXmlStreamReader *xmlReader, - QString &keyName, - QString &keyType); - -private: - QString m_connName; - QString m_localCacheDbPath; - QSqlDatabase m_db; - QSqlQuery m_sqlQuery; -}; diff --git a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/netcheck/netcheck_adaptor.cpp b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/netcheck/netcheck_adaptor.cpp index cc36903..b6b3421 100644 --- a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/netcheck/netcheck_adaptor.cpp +++ b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/netcheck/netcheck_adaptor.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2020 The Qt Company Ltd. +// Copyright (C) 2017 The Qt Company Ltd. // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/netcheck/netcheck_adaptor.h b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/netcheck/netcheck_adaptor.h index 9da7ab7..43a4237 100644 --- a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/netcheck/netcheck_adaptor.h +++ b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/netcheck/netcheck_adaptor.h @@ -1,4 +1,4 @@ -// Copyright (C) 2020 The Qt Company Ltd. +// Copyright (C) 2017 The Qt Company Ltd. // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -8,8 +8,6 @@ #include #include -#include "../deepin-pc-manager-session-daemon/window/modules/common/defenderprocinfolist.h" -#include "../../deepin-pc-manager/src/window/modules/common/common.h" QT_BEGIN_NAMESPACE class QByteArray; template class QList; diff --git a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/netcheck/netcheckdbusinter.cpp b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/netcheck/netcheckdbusinter.cpp index 2549ea2..b3cb101 100644 --- a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/netcheck/netcheckdbusinter.cpp +++ b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/netcheck/netcheckdbusinter.cpp @@ -1,4 +1,3 @@ -// Copyright (C) 2019 ~ 2023 Deepin Technology Co., Ltd. // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/netcheck/netcheckdbusinter.h b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/netcheck/netcheckdbusinter.h index 46c64fd..7d2c424 100644 --- a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/netcheck/netcheckdbusinter.h +++ b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/netcheck/netcheckdbusinter.h @@ -1,4 +1,3 @@ -// Copyright (C) 2019 ~ 2023 Deepin Technology Co., Ltd. // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/netcheck/netchecksyssrvmodel.cpp b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/netcheck/netchecksyssrvmodel.cpp index 13c5f30..0dd3eb2 100644 --- a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/netcheck/netchecksyssrvmodel.cpp +++ b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/netcheck/netchecksyssrvmodel.cpp @@ -4,8 +4,8 @@ // SPDX-License-Identifier: GPL-3.0-or-later #include "netchecksyssrvmodel.h" -#include "window/modules/common/invokers/invokerfactory.h" -#include "window/modules/common/common.h" +#include "invokers/invokerfactory.h" +#include "common.h" #include #include @@ -51,9 +51,9 @@ NetCheckSysSrvModel::NetCheckSysSrvModel(QObject *parent) "org.freedesktop.NetworkManager", ConnectType::SYSTEM, this); - m_netWorkDBusInter = InvokerFactory::GetInstance().CreateInvoker("org.deepin.dde.Network1", - "/org/deepin/dde/Network1", - "org.deepin.dde.Network1", + m_netWorkDBusInter = InvokerFactory::GetInstance().CreateInvoker("com.deepin.system.Network", + "/com/deepin/system/Network", + "com.deepin.system.Network", ConnectType::SYSTEM, this); // startCheckNetDevice(); diff --git a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/netcheck/netchecksyssrvmodel.h b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/netcheck/netchecksyssrvmodel.h index d43323a..01120f9 100644 --- a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/netcheck/netchecksyssrvmodel.h +++ b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/netcheck/netchecksyssrvmodel.h @@ -1,4 +1,3 @@ -// Copyright (C) 2019 ~ 2023 Deepin Technology Co., Ltd. // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/src/daemon_adaptor.cpp b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/src/daemon_adaptor.cpp new file mode 100644 index 0000000..7b1fa63 --- /dev/null +++ b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/src/daemon_adaptor.cpp @@ -0,0 +1,80 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "daemon_adaptor.h" +#include +#include +#include +#include +#include +#include +#include + +/* + * Implementation of adaptor class DaemonAdaptor + */ + +DaemonAdaptor::DaemonAdaptor(QObject *parent) + : QDBusAbstractAdaptor(parent) +{ + // constructor + setAutoRelaySignals(true); +} + +DaemonAdaptor::~DaemonAdaptor() +{ + // destructor +} + +void DaemonAdaptor::CleanTrashFiles(const QStringList &path) +{ + // handle method call com.deepin.pc.manager.system.daemon.CleanTrashFiles + QMetaObject::invokeMethod(parent(), "CleanTrashFiles", Q_ARG(QStringList, path)); +} + +void DaemonAdaptor::ExitApp() +{ + // handle method call com.deepin.pc.manager.system.daemon.ExitApp + QMetaObject::invokeMethod(parent(), "ExitApp"); +} + +double DaemonAdaptor::GetCacheFileCount() +{ + // handle method call com.deepin.pc.manager.system.daemon.GetCacheFileCount + double count; + QMetaObject::invokeMethod(parent(), "GetCacheFileCount", Q_RETURN_ARG(double, count)); + return count; +} + +double DaemonAdaptor::GetHistoryFileCount(const QString &homepath) +{ + // handle method call com.deepin.pc.manager.system.daemon.GetHistoryFileCount + double count; + QMetaObject::invokeMethod(parent(), "GetHistoryFileCount", Q_RETURN_ARG(double, count), Q_ARG(QString, homepath)); + return count; +} + +double DaemonAdaptor::GetLogFileCount() +{ + // handle method call com.deepin.pc.manager.system.daemon.GetLogFileCount + double count; + QMetaObject::invokeMethod(parent(), "GetLogFileCount", Q_RETURN_ARG(double, count)); + return count; +} + +double DaemonAdaptor::GetTrashFileCount(const QString &homepath) +{ + // handle method call com.deepin.pc.manager.system.daemon.GetTrashFileCount + double count; + QMetaObject::invokeMethod(parent(), "GetTrashFileCount", Q_RETURN_ARG(double, count), Q_ARG(QString, homepath)); + return count; +} + +void DaemonAdaptor::StartApp() +{ + // handle method call com.deepin.pc.manager.system.daemon.StartApp + QMetaObject::invokeMethod(parent(), "StartApp"); +} + diff --git a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/src/daemon_adaptor.h b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/src/daemon_adaptor.h new file mode 100644 index 0000000..867d1e5 --- /dev/null +++ b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/src/daemon_adaptor.h @@ -0,0 +1,67 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef DAEMON_ADAPTOR_H +#define DAEMON_ADAPTOR_H + +#include +#include +QT_BEGIN_NAMESPACE +class QByteArray; +template class QList; +template class QMap; +class QString; +class QStringList; +class QVariant; +QT_END_NAMESPACE + +/* + * Adaptor class for interface com.deepin.pc.manager.system.daemon + */ +class DaemonAdaptor: public QDBusAbstractAdaptor +{ + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "com.deepin.pc.manager.system.daemon") + Q_CLASSINFO("D-Bus Introspection", "" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" + "") +public: + DaemonAdaptor(QObject *parent); + virtual ~DaemonAdaptor(); + +public: // PROPERTIES +public Q_SLOTS: // METHODS + void CleanTrashFiles(const QStringList &path); + void ExitApp(); + double GetCacheFileCount(); + double GetHistoryFileCount(const QString &homepath); + double GetLogFileCount(); + double GetTrashFileCount(const QString &homepath); + void StartApp(); +Q_SIGNALS: // SIGNALS +}; + +#endif diff --git a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/main.cpp b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/src/main.cpp similarity index 92% rename from deepin-pc-manager-server/deepin-pc-manager-system-daemon/main.cpp rename to deepin-pc-manager-server/deepin-pc-manager-system-daemon/src/main.cpp index 76f5ea2..5702eba 100644 --- a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/main.cpp +++ b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/src/main.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -#include "writedbusdata.h" +#include "operatedbusdata.h" #include "netcheck/netcheckdbusinter.h" #include @@ -25,7 +25,7 @@ int main(int argc, char *argv[]) DLogManager::registerConsoleAppender(); DLogManager::registerFileAppender(); - WriteDBusData dbusData; + OperateDbusData dbusData; NetCheckDBusInter netCheckDBusInter; return a.exec(); } diff --git a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/src/operatedbusdata.cpp b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/src/operatedbusdata.cpp new file mode 100644 index 0000000..43e40b4 --- /dev/null +++ b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/src/operatedbusdata.cpp @@ -0,0 +1,166 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "operatedbusdata.h" +#include "common.h" + +#include + +#include + +// 合法调用进程路径列表 +const QStringList ValidInvokerExePathList = {"/usr/bin/deepin-pc-manager", + "/usr/bin/deepin-pc-manager-system-daemon"}; + +#define HOST_FILE_PATH "/etc/hosts" +OperateDbusData::OperateDbusData(QObject *parent) + : QObject(parent) + , m_daemonAdaptor(nullptr) + , m_trashCleanModel(nullptr) +{ + m_daemonAdaptor = new DaemonAdaptor(this); + if (!QDBusConnection::systemBus().registerService(service) + || !QDBusConnection::systemBus().registerObject(path, this)) { + exit(0); + } + m_trashCleanModel = new TrashCleanModel(this); +} + +OperateDbusData::~OperateDbusData() +{ +} + +void OperateDbusData::StartApp() +{ +} + +void OperateDbusData::ExitApp() +{ + if (!isValidInvoker()) { + qDebug() << Q_FUNC_INFO << "invalid invoker!"; + return; + } + qApp->quit(); +} + +double OperateDbusData::GetTrashFileCount(QString homepath) +{ + if (!isValidInvoker()) { + qDebug() << Q_FUNC_INFO << "invalid invoker!"; + return 0.00; + } + QFileInfo info(homepath); + if (!info.isDir()) { + return 0.00; + } + + return m_trashCleanModel->getTrashFileCount(homepath); +} +double OperateDbusData::GetCacheFileCount() +{ + if (!isValidInvoker()) { + qDebug() << Q_FUNC_INFO << "invalid invoker!"; + return 0.00; + } + return m_trashCleanModel->getCacheFileCount(); +} +double OperateDbusData::GetLogFileCount() +{ + if (!isValidInvoker()) { + qDebug() << Q_FUNC_INFO << "invalid invoker!"; + return 0.00; + } + return m_trashCleanModel->getLogFileCount(); +} +double OperateDbusData::GetHistoryFileCount(QString homepath) +{ + if (!isValidInvoker()) { + qDebug() << Q_FUNC_INFO << "invalid invoker!"; + return 0.00; + } + QFileInfo info(homepath); + if (!info.isDir()) { + return 0.00; + } + return m_trashCleanModel->getHistoryFileCount(homepath); +} + +void OperateDbusData::CleanTrashFiles(QStringList items) +{ + if (!isValidInvoker()) { + qDebug() << Q_FUNC_INFO << "invalid invoker!"; + return; + } + for (int i = 0; i < items.count(); ++i) { + QString itemType = items.at(i); + if (TRASH_CLEAN_ITEM_TYPE_CACHE == itemType) { + m_trashCleanModel->cleanCacheFiles(); + } else if (TRASH_CLEAN_ITEM_TYPE_LOG == itemType) { + m_trashCleanModel->cleanLogFiles(); + } else if (TRASH_CLEAN_ITEM_TYPE_HISTORY == itemType) { + m_trashCleanModel->cleanHistoryFiles(); + } + } +} + +void OperateDbusData::ReplaceHostFile(QString host) +{ + if (!isValidInvoker()) { + qDebug() << Q_FUNC_INFO << "invalid invoker!"; + return; + } + QFile file(HOST_FILE_PATH); + if (file.open(QIODevice::ReadWrite)) { + QTextStream stream(&file); + file.seek(0); + stream << host; + file.close(); + } +} + +// 校验调用者 +bool OperateDbusData::isValidInvoker() +{ +#ifdef QT_DEBUG + return true; +#else + // 判断是否位自身调用 + if (!calledFromDBus()) { + return true; + } + + bool valid = false; + QDBusConnection conn = connection(); + QDBusMessage msg = message(); + + // 判断是否存在执行路径且是否存在于可调用者名单中 + uint pid = conn.interface()->servicePid(msg.service()).value(); + QFileInfo f(QString("/proc/%1/exe").arg(pid)); + QString invokerPath = f.canonicalFilePath(); + + // 防止读取的执行路径为空,为空时取cmdline内容 + if (invokerPath.isEmpty()) { + QFile cmdlineFile(QString("/proc/%1/cmdline").arg(pid)); + if (cmdlineFile.open(QIODevice::OpenModeFlag::ReadOnly)) { + QString sCmdline = cmdlineFile.readAll(); + invokerPath = sCmdline.split(" ").first(); + } + cmdlineFile.close(); + } + + if (ValidInvokerExePathList.contains(invokerPath)) { + valid = true; + } + + // 如果是非法调用者,则输出错误 + if (!valid) { + sendErrorReply(QDBusError::ErrorType::Failed, + QString("(pid: %1)[%2] is not allowed to transfer antiav inter") + .arg(pid) + .arg(invokerPath)); + } + + return valid; +#endif +} diff --git a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/src/operatedbusdata.h b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/src/operatedbusdata.h new file mode 100644 index 0000000..da6c64f --- /dev/null +++ b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/src/operatedbusdata.h @@ -0,0 +1,50 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "daemon_adaptor.h" +#include "trashclean/trashcleanmodel.h" + +#include +#include +#include +#include +#include +#include + +// 检测ssh登陆端口启动标志 +#define REM_SSH_STATUS "running" +const QString service = "com.deepin.pc.manager.system.daemon"; +const QString path = "/com/deepin/pc/manager/system/daemon"; + +class QDBusContext; +class OperateDbusData : public QObject + , protected QDBusContext +{ + Q_OBJECT +public: + explicit OperateDbusData(QObject *parent = nullptr); + ~OperateDbusData(); + +public Q_SLOTS: + void StartApp(); + void ExitApp(); + + double GetTrashFileCount(QString homepath); + double GetCacheFileCount(); + double GetLogFileCount(); + double GetHistoryFileCount(QString homepath); + void CleanTrashFiles(QStringList items); + + void ReplaceHostFile(QString host); + +private: + // 校验调用者 + bool isValidInvoker(); + +private: + DaemonAdaptor *m_daemonAdaptor; + TrashCleanModel *m_trashCleanModel; +}; diff --git a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/src/trashclean/trashcleanmodel.cpp b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/src/trashclean/trashcleanmodel.cpp new file mode 100644 index 0000000..cfefaa7 --- /dev/null +++ b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/src/trashclean/trashcleanmodel.cpp @@ -0,0 +1,301 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "trashcleanmodel.h" +#include "invokers/invokerfactory.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#define CLEANER_SYSTEM_CACHE_ARRAY_NAME "files" +#define CLEANER_SYSTEM_CACHE_APT_PATH "/var/cache/apt/archives" // 系统缓存 +#define CLEANER_SYSTEM_CACHE_DEB_NAME "name" +#define CLEANER_SYSTEM_CACHE_LASTORE_PATH "/var/cache/lastore/archives" // 系统缓存 +#define CLEANER_SYSTEM_LOG_PATH "/var/log" // 系统日志 +#define CLEANER_SYSTEM_HISTORY_PATH "/.bash_history" + +#define MB_COUNT (1 << 20) +#define MIN_SYSTEM_LOG_SIZE_TO_CLEAN 100 * MB_COUNT + +const QString WhitePathsFile = "/usr/share/deepin-pc-manager/cleanerwhite.json"; + +TrashCleanModel::TrashCleanModel(QObject *parent) + : QObject(parent) + , m_managerInter(nullptr) +{ + initData(); +} + +TrashCleanModel::~TrashCleanModel() +{ +} + +void TrashCleanModel::initData() +{ + m_managerInter = InvokerFactory::GetInstance().CreateInvoker("org.deepin.lastore1", + "/org/deepin/lastore1", + "org.deepin.lastore1.Manager", + ConnectType::SYSTEM, + this); +} + +double TrashCleanModel::getTrashFileCount(const QString &homepath) +{ + m_fileList.clear(); + m_trashFileList.clear(); + m_trashFileCount = 0.00; + + // 获取回收站目录下所有文件 + QEventLoop loop; + QtConcurrent::run([&] { + QThread::msleep(50); + scanFile(homepath + CLEANER_SYSTEM_TRASH_PATH); + loop.exit(); + }); + loop.exec(); + + foreach (const QString &file, m_fileList) { + QFileInfo info(file); + m_trashFileCount += info.size(); + m_trashFileList.append(file); + } + + return m_trashFileCount; +} + +double TrashCleanModel::getCacheFileCount() +{ + m_cacheFileList.clear(); + m_cacheFileCount = 0.00; + + QStringList debFileList; + QString debJsonStr; + QEventLoop loop; + QtConcurrent::run([&] { + QThread::msleep(50); + QDBusMessage msg = DBUS_BLOCK_INVOKE(m_managerInter, "GetArchivesInfo"); + debJsonStr = QDBusReply(msg).value(); + loop.exit(); + }); + loop.exec(); + + QJsonParseError err; + QJsonObject object = QJsonDocument::fromJson(debJsonStr.toUtf8(), &err).object(); + if (QJsonParseError::NoError != err.error) { + qDebug() << "incorrect json format:" << debJsonStr; + } + + // 获取/var/cache/apt/archives 可清理deb缓存 + QJsonArray debObjArrayApt = object.value(CLEANER_SYSTEM_CACHE_ARRAY_NAME) + .toObject() + .value(CLEANER_SYSTEM_CACHE_APT_PATH) + .toArray(); + foreach (const auto &it, debObjArrayApt) { + QString debName = it.toObject().value(CLEANER_SYSTEM_CACHE_DEB_NAME).toString(); + + if (debName.isEmpty()) { + continue; + } + + // 设置文件完整路径 + QString debFilePath = QString("%1%2%3") + .arg(CLEANER_SYSTEM_CACHE_APT_PATH) + .arg(QDir::separator()) + .arg(debName); + QFileInfo info(debFilePath); + if (info.exists()) { + debFileList.append(debFilePath); + m_cacheFileList.append(debFilePath); + m_cacheFileCount += info.size(); + } + } + + // 获取/var/cache/lastore/archives 可清理deb缓存 + QJsonArray debObjArray = object.value(CLEANER_SYSTEM_CACHE_ARRAY_NAME) + .toObject() + .value(CLEANER_SYSTEM_CACHE_LASTORE_PATH) + .toArray(); + foreach (const auto &it, debObjArray) { + QString debName = it.toObject().value(CLEANER_SYSTEM_CACHE_DEB_NAME).toString(); + + if (debName.isEmpty()) { + continue; + } + + // 设置文件完整路径 + QString debFilePath = QString("%1%2%3") + .arg(CLEANER_SYSTEM_CACHE_LASTORE_PATH) + .arg(QDir::separator()) + .arg(debName); + QFileInfo info(debFilePath); + if (info.exists()) { + debFileList.append(debFilePath); + m_cacheFileList.append(debFilePath); + m_cacheFileCount += info.size(); + } + } + return m_cacheFileCount; +} + +double TrashCleanModel::getLogFileCount() +{ + m_fileList.clear(); + m_logFileList.clear(); + m_logFileCount = 0.00; + + QEventLoop loop; + QtConcurrent::run([&] { + QThread::msleep(50); + scanFile(CLEANER_SYSTEM_LOG_PATH); + loop.exit(); + }); + loop.exec(); + + // 系统日志过滤掉白名单 + double sizeCounter = 0.0; + QStringList sPathList; + QFile whiteFile(WhitePathsFile); + if (!whiteFile.open(QFile::ReadOnly)) { + qDebug() << "can not find white file:" << WhitePathsFile; + } + + // 获取白名单数据 + QJsonParseError err; + const QJsonObject &object = QJsonDocument::fromJson(whiteFile.readAll(), &err).object(); + whiteFile.close(); + + if (QJsonParseError::NoError != err.error) { + return 0; + } + const QJsonArray &apps = object.value("whitepaths").toArray(); + + // 判断是否该目录下文件是否加入到白名单,如果加入,直接跳过 + foreach (const QString &file, m_fileList) { + if (file.isEmpty()) { + break; + } + + bool bAddList = false; + // 是否是/var/log/journal目录下的文件 + if (file.contains("/var/log/journal")) { + QFileInfo info(file); + sizeCounter += info.size(); + sPathList.append(file); + } else { + // 黑名单 - 只清除黑名单内带后缀的文件 + for (auto itApp = apps.begin(); itApp != apps.end(); ++itApp) { + QString sPath = itApp->toObject().value("white_path").toString(); + if (file.contains(sPath) && file != sPath) { + bAddList = true; + } + } + } + + // 添加符合规则的文件到清理项 + if (bAddList) { + QFileInfo info(file); + sizeCounter += info.size(); + sPathList.append(file); + } + } + + // 仅超过100M时对系统日志提供清理 + if (sizeCounter > MIN_SYSTEM_LOG_SIZE_TO_CLEAN) { + m_logFileList.append(sPathList); + m_logFileCount += sizeCounter; + } else { + sPathList.clear(); + } + + return m_logFileCount; +} + +double TrashCleanModel::getHistoryFileCount(const QString &homepath) +{ + m_historyFileList.clear(); + m_historyFileCount = 0.00; + // 统计清理文件大小和路径 + QFileInfo info(homepath + CLEANER_SYSTEM_HISTORY_PATH); + m_historyFileCount += info.size(); + m_historyFileList.append(info.absoluteFilePath()); + + return m_historyFileCount; +} + +// 获取单个文件的大小,同时记录文件总数 +void TrashCleanModel::scanFile(const QString &path) +{ + QFileInfo info(path); + if (info.exists()) { + if (info.isFile()) { + // 用户显示在主界面的标题内容,由于文件路径是同检查项层次决定的,所以不需要该文件的路径信息 + QString abpath = info.absoluteFilePath(); + m_fileList.append(abpath); + } else if (info.isDir()) { + QDir dir(path); + for (const QFileInfo &i : + dir.entryInfoList(QDir::NoDotAndDotDot | QDir::Files | QDir::Dirs | QDir::Hidden + | QDir::NoSymLinks)) { + // 递归扫描目录内容 + scanFile(i.absoluteFilePath()); + } + } + } +} + +void TrashCleanModel::cleanCacheFiles() +{ + foreach (const auto &file, m_cacheFileList) { + QFileInfo fileInfo(file); + if (fileInfo.isFile() || fileInfo.isSymLink()) { + if (!QFile::remove(fileInfo.absoluteFilePath())) { + qWarning() << "remove failed : " << file; + } + } + } +} + +void TrashCleanModel::cleanLogFiles() +{ + bool isCleanJournal = false; + foreach (const auto &file, m_logFileList) { + if (file.contains("/var/log/journal")) { + isCleanJournal = true; + continue; + } + + QFileInfo fileInfo(file); + if (fileInfo.isFile() || fileInfo.isSymLink()) { + if (!QFile::remove(fileInfo.absoluteFilePath())) { + qWarning() << "remove failed : " << file; + } + } + } + + if (isCleanJournal) { + QProcess proc; + proc.start(QString("journalctl --rotate --vacuum-size=1M")); + proc.waitForFinished(); + proc.close(); + proc.deleteLater(); + } +} + +void TrashCleanModel::cleanHistoryFiles() +{ + foreach (const auto &file, m_historyFileList) { + QFileInfo fileInfo(file); + if (fileInfo.isFile() || fileInfo.isSymLink()) { + if (!QFile::remove(fileInfo.absoluteFilePath())) { + qWarning() << "remove failed : " << file; + } + } + } +} diff --git a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/src/trashclean/trashcleanmodel.h b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/src/trashclean/trashcleanmodel.h new file mode 100644 index 0000000..9e3175c --- /dev/null +++ b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/src/trashclean/trashcleanmodel.h @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include +#include + +#define CLEANER_SYSTEM_TRASH_PATH "/.local/share/Trash/files" // 回收站路径 +class DBusInvokerInterface; +class TrashCleanModel : public QObject +{ + Q_OBJECT +public: + explicit TrashCleanModel(QObject *parent = nullptr); + ~TrashCleanModel(); + + double getTrashFileCount(const QString &homepath); + double getCacheFileCount(); + double getLogFileCount(); + double getHistoryFileCount(const QString &homepath); + void cleanCacheFiles(); + void cleanLogFiles(); + void cleanHistoryFiles(); + +private: + void initData(); + // 递归函数-获取目录下所有文件 + void scanFile(const QString &path); + +private: + DBusInvokerInterface *m_managerInter; + + QStringList m_fileList; + QStringList m_trashFileList; + double m_trashFileCount; + QStringList m_cacheFileList; + double m_cacheFileCount; + QStringList m_logFileList; + double m_logFileCount; + QStringList m_historyFileList; + int m_historyFileCount; +}; diff --git a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/writedbusdata.cpp b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/writedbusdata.cpp deleted file mode 100644 index 0db86ca..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/writedbusdata.cpp +++ /dev/null @@ -1,442 +0,0 @@ -// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "writedbusdata.h" - -#include "../../deepin-pc-manager/src/window/modules/common/common.h" -#include "../../deepin-pc-manager/src/window/modules/common/database/trashcleanuninstallappsql.h" -#include "disk/disk.h" -#include "localcache/securitypkgnamesql.h" -#include "localcache/settingssql.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// 合法调用进程路径列表 -const QStringList ValidInvokerExePathList = {"/usr/bin/deepin-pc-manager", - "/usr/bin/deepin-pc-manager-session-daemon", - "/usr/bin/deepin-pc-manager-system-daemon"}; - -WriteDBusData::WriteDBusData(QObject *parent) - : QObject(parent) - , m_daemonAdaptor(nullptr) - , m_settingsSql(new SettingsSql("WriteDBusData_Settings", this)) - , m_isInitSqlDatabase(false) -{ - m_daemonAdaptor = new DaemonAdaptor(this); - if (!QDBusConnection::systemBus().registerService(service) - || !QDBusConnection::systemBus().registerObject(path, this)) { - exit(0); - } - - // 初始化localcache.db数据库 - initLocalCache(); - - RefreshPackageTable(); - - // 扫描冗余文件并删除 - scanFile("/usr/share/deepin-pc-manager/config/"); -} - -WriteDBusData::~WriteDBusData() -{ - // 数据库 - m_securityPkgNameSql->quit(); - m_securityPkgNameSqlThread->quit(); - m_securityPkgNameSqlThread->wait(); - m_securityPkgNameSqlThread->deleteLater(); - m_securityPkgNameSql->deleteLater(); -} - -void WriteDBusData::StartApp() -{ -} - -void WriteDBusData::ExitApp() -{ - if (!isValidInvoker()) { - qDebug() << Q_FUNC_INFO << "invalid invoker!"; - return; - } - qApp->quit(); -} - -bool WriteDBusData::SetSysSettingValue(const QString &key, const QDBusVariant &value) -{ - if (!isValidInvoker()) { - qDebug() << Q_FUNC_INFO << "invalid invoker!"; - return false; - } - QVariant lastValueOfKey = m_settingsSql->getValue(key); - QVariant settingValueOfKey = value.variant(); - bool success = m_settingsSql->setValue(key, settingValueOfKey); - if (lastValueOfKey != settingValueOfKey) { - Q_EMIT SysSettingValueChanged(key, value); - qInfo() << "[WriteDBusData] [SetSysSettingValue] key:" << key - << " value:" << value.variant(); - } - - return success; -} - -QDBusVariant WriteDBusData::GetSysSettingValue(const QString &key) -{ - QDBusVariant dbusVariant; - if (!isValidInvoker()) { - qDebug() << Q_FUNC_INFO << "invalid invoker!"; - return dbusVariant; - } - - QVariant var = m_settingsSql->getValue(key); - // 未找到值 - if (var.isNull()) { - qDebug() << Q_FUNC_INFO << "not found value of key:" << key; - var = 0; - qWarning() << "[WriteDBusData] [SetSysSettingValue] not found key:" << key; - } - - qInfo() << "[WriteDBusData] [SetSysSettingValue] var:" << var; - dbusVariant.setVariant(var); - return dbusVariant; -} - -// 初始化localcache.db数据库 -void WriteDBusData::initLocalCache() -{ - // 初始化数据库 - QDir defenderDataDir; - if (!defenderDataDir.exists(DEFENDER_DATA_DIR_PATH)) { - defenderDataDir.mkdir(DEFENDER_DATA_DIR_PATH); - } - - // 在打开之前判断数据库文件是否已存在,若不存在创建并修改其文件属性,存在则进行判断和修改 - QString strDbFileName = QString("%1%2").arg(DEFENDER_DATA_DIR_PATH).arg(LOCAL_CACHE_DB_NAME); - QFile dbFile(strDbFileName); - - if (dbFile.exists()) { - if (dbFile.isOpen()) { - dbFile.close(); - } - - QFile::Permissions permissons = dbFile.permissions(); - - if (permissons != (QFile::Permission::WriteUser | QFile::Permission::ReadOwner)) { - if (!dbFile.setPermissions(QFile::Permission::WriteUser - | QFile::Permission::ReadOwner)) { - qCritical() - << "[WriteDBusData] [initLocalCache] change database permission failed!"; - } - } - } else { - if (!openLocalDb()) { - ExitApp(); - } - - m_localCacheDb.close(); - - // 修改数据库文件权限 - if (!dbFile.setPermissions(QFile::Permission::WriteUser | QFile::Permission::ReadOwner)) { - qCritical() << "[WriteDBusData] [initLocalCache] modify database permission failed!"; - } - } - - if (!openLocalDb()) { - ExitApp(); - } - - // 1.包名及相关联文件数据库表 - m_securityPkgNameSql = new SecurityPkgNameSql(m_localCacheDb); - connect(this, - &WriteDBusData::requestRefreshPackageTable, - m_securityPkgNameSql, - &SecurityPkgNameSql::refreshPackageLinkTable); - connect(m_securityPkgNameSql, - &SecurityPkgNameSql::notifySqlInsertFinish, - this, - &WriteDBusData::acceptSqlInsertFinish); - - m_securityPkgNameSqlThread = new QThread; - m_securityPkgNameSql->moveToThread(m_securityPkgNameSqlThread); - connect(m_securityPkgNameSqlThread, - &QThread::started, - m_securityPkgNameSql, - &SecurityPkgNameSql::createPackageLinkTable); -} - -// 接受数据库插入完成信号 -void WriteDBusData::acceptSqlInsertFinish() -{ - if (!m_localCacheDb.isOpen()) { - qCritical() << "[WriteDBusData] [acceptSqlInsertFinish] pkgName localcachedb open error!"; - return; - } - - // 查询packageName字段所有数据 - QSqlQuery query(m_localCacheDb); - QString sCmd; - sCmd = QString("select * from package_binary_file"); - if (!query.exec(sCmd)) { - qCritical() << "[WriteDBusData] [acceptSqlInsertFinish] query localcachedb error :" - << query.lastError(); - } else { - // 将已有的所有包名插入到QStringList容器当中 - while (query.next()) { - m_sPkgNameMap[query.value(0).toString()] = query.value(1).toString(); - } - } - - Q_EMIT NotifySqlInsertFinish(); -} - -// 查询相关联文件对应的包名信息 -QString WriteDBusData::QueryPackageName(const QString sBinaryFile) -{ - if (!isValidInvoker()) { - return ""; - } - return m_sPkgNameMap.value(sBinaryFile); -} - -// 应用程序安装卸载刷新数据库 -void WriteDBusData::RefreshPackageTable() -{ - if (!isValidInvoker()) { - qDebug() << Q_FUNC_INFO << "invalid invoker!"; - return; - } - if (!m_isInitSqlDatabase) { - m_securityPkgNameSqlThread->start(); - m_isInitSqlDatabase = true; - } else { - Q_EMIT requestRefreshPackageTable(); - } -} - -// 获取磁盘设备路径列表 -QStringList WriteDBusData::GetDiskDevicePathList() -{ - return getDiskDevicePathList(); -} - -// 清理选中的垃圾文件 -void WriteDBusData::CleanSelectFile(QStringList filePaths) -{ - if (!isValidInvoker()) { - qDebug() << Q_FUNC_INFO << "invalid invoker!"; - return; - } - bool isCleanJournal = false; - foreach (const auto &file, filePaths) { - if (file.contains("/var/log/journal")) { - isCleanJournal = true; - continue; - } - - if (file.contains("/.local/share/Trash")) { - // isCleanTrashBox = true; - // do not remove trashBox here - continue; - } - - QFileInfo fileInfo(file); - if (fileInfo.isFile() || fileInfo.isSymLink()) { - // QFile::setPermissions(file, QFile::WriteOwner); - if (!QFile::remove(fileInfo.absoluteFilePath())) { - qCritical() << "[WriteDBusData] [CleanSelectFile] remove failed :" << file; - } - } - } - - if (isCleanJournal) { - CleanJournal(); - } -} - -// 清理journal目录下的日志文件 -void WriteDBusData::CleanJournal() -{ - if (!isValidInvoker()) { - qDebug() << Q_FUNC_INFO << "invalid invoker!"; - return; - } - - // 先停止sshd服务运行 - QProcess procSSHD; - procSSHD.start("journalctl", {"--rotate", "--vacuum-size=1M"}); - procSSHD.waitForFinished(); - procSSHD.close(); - procSSHD.deleteLater(); -} - -// 递归函数-获取/usr/share/deepin-pc-manager/config/目录下所有的lock文件 -void WriteDBusData::scanFile(const QString &path) -{ - QStringList sFileList; - QFileInfo info(path); - if (info.exists()) { - if (info.isFile()) { - QString sPath = info.absoluteFilePath(); - if (sPath.contains("lock")) { - sFileList.append(sPath); - } - } else if (info.isDir()) { - QDir dir(path); - for (const QFileInfo &i : - dir.entryInfoList(QDir::NoDotAndDotDot | QDir::Files | QDir::Dirs | QDir::Hidden - | QDir::NoSymLinks)) { - // 递归扫描目录内容 - scanFile(i.absoluteFilePath()); - } - } - } - - CleanSelectFile(sFileList); -} - -// 垃圾清理数据库插入记录 -void WriteDBusData::InsertUninstalledAppRecord(const QString &appID, const QString &appName) -{ - if (!isValidInvoker()) { - qDebug() << Q_FUNC_INFO << "invalid invoker!"; - return; - } - // m_uninstallAppSql->executeCmd(); - TrashCleanUninstallAppSql db; - if (db.init()) { - db.executeCmd(TrashCleanUninstallAppSql::UninstalledAppSqlCmdType::INSERT_A_RECORD, - {appID, appName}); - } -} - -// 垃圾清理数据库删除记录 -void WriteDBusData::DeleteUninstalledAppRecord(const QString &appID) -{ - if (!isValidInvoker()) { - qDebug() << Q_FUNC_INFO << "invalid invoker!"; - return; - } - // m_uninstallAppSql->executeCmd(TrashCleanUninstallAppSql::UninstalledAppSqlCmdType::DELETE_A_RECORD, - // {appID}); - TrashCleanUninstallAppSql db; - if (db.init()) { - db.executeCmd(TrashCleanUninstallAppSql::UninstalledAppSqlCmdType::DELETE_A_RECORD, - {appID}); - } -} - -QVariantList WriteDBusData::GetUnInstalledApps() -{ - TrashCleanUninstallAppSql db; - QVariantList varList; - - if (db.init()) { - bool queryFinished = false; - - connect(&db, - &TrashCleanUninstallAppSql::sendQueryResultSignal, - this, - [&](QVariantList rst) { - varList = rst; - disconnect(&db); - queryFinished = true; - }); - - db.executeCmd(TrashCleanUninstallAppSql::GET_ALL_RECORDS); - QTime timer = QTime::currentTime().addMSecs(3000); - - while (QTime::currentTime() < timer && !queryFinished) { - QCoreApplication::processEvents(QEventLoop::AllEvents, 50); - } - - if (!queryFinished) { - varList.clear(); - disconnect(&db); - qCritical() << "query uninstalled app failed!"; - } - } - - return varList; -} - -// 校验调用者 -bool WriteDBusData::isValidInvoker() -{ -#ifdef QT_DEBUG - return true; -#else - // 判断是否位自身调用 - if (!calledFromDBus()) { - return true; - } - - bool valid = false; - QDBusConnection conn = connection(); - QDBusMessage msg = message(); - - // 判断是否存在执行路径且是否存在于可调用者名单中 - uint pid = conn.interface()->servicePid(msg.service()).value(); - QFileInfo f(QString("/proc/%1/exe").arg(pid)); - QString invokerPath = f.canonicalFilePath(); - - // 防止读取的执行路径为空,为空时取cmdline内容 - if (invokerPath.isEmpty()) { - QFile cmdlineFile(QString("/proc/%1/cmdline").arg(pid)); - if (cmdlineFile.open(QIODevice::OpenModeFlag::ReadOnly)) { - QString sCmdline = cmdlineFile.readAll(); - invokerPath = sCmdline.split(" ").first(); - } - cmdlineFile.close(); - } - - if (ValidInvokerExePathList.contains(invokerPath)) { - valid = true; - } - - // 如果是非法调用者,则输出错误 - if (!valid) { - sendErrorReply(QDBusError::ErrorType::Failed, - QString("(pid: %1)[%2] is not allowed to transfer antiav inter") - .arg(pid) - .arg(invokerPath)); - } - - return valid; -#endif -} - -bool WriteDBusData::openLocalDb() -{ - bool bSuccess = false; - - // 建立长连接 - if (QSqlDatabase::contains("localcache")) { - m_localCacheDb = QSqlDatabase::database("localcache"); - } else { - m_localCacheDb = QSqlDatabase::addDatabase("QSQLITE", "localcache"); - } - - m_localCacheDb.setDatabaseName("/usr/share/deepin-pc-manager/localcache.db"); - m_localCacheDb.setUserName("root"); - m_localCacheDb.setPassword("deepin-pc-manager"); - - // 打开数据库 - if (!m_localCacheDb.open()) { - qCritical() << "localcache.db open error!"; - bSuccess = false; - } else { - bSuccess = true; - } - - return bSuccess; -} diff --git a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/writedbusdata.h b/deepin-pc-manager-server/deepin-pc-manager-system-daemon/writedbusdata.h deleted file mode 100644 index 0ffcad4..0000000 --- a/deepin-pc-manager-server/deepin-pc-manager-system-daemon/writedbusdata.h +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include "daemon_adaptor.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -class QDBusContext; -class NetManagerModel; -class SecurityLogSql; -class ScanWhiteListSql; -class VirusLibImport; -class FirewallSrvModel; -class SettingsSql; -class DBusInvokerInterface; - -#define HEART_BEAT_TIME_OUT 3 // 心跳间隔,s -// 检测ssh登陆端口启动标志 -#define REM_SSH_STATUS "running" -const QString service = "com.deepin.pc.manager.system.daemon"; -const QString path = "/com/deepin/pc/manager/system/daemon"; - -class SecurityPkgNameSql; - -class WriteDBusData : public QObject - , protected QDBusContext -{ - Q_OBJECT -public: - explicit WriteDBusData(QObject *parent = nullptr); - ~WriteDBusData(); - -Q_SIGNALS: - void SysSettingValueChanged(const QString &key, const QDBusVariant &value); - - // usb设备接入的信号,入参bflag 为false,表示限制状态 - void NotifyUsbConnectionInfo(bool bFlag, QString sUsbInfo); - void SendUsbConnectionInfo(QString sUsbInfos); - // 通知显示限制所有usb设备的系统通知 - void requestShowBlockAllSysNotify(); - // 通知显示限制非白名单usb设备的系统通知 - void requestShowOnlyWhiteListSysNotify(); - - // 应用程序安装卸载刷新数据库信号 - void requestRefreshPackageTable(); - // 包名解析数据库插入完成信号 - void NotifySqlInsertFinish(); - - // 同步界面状态到所有用户UI,需要同步的UI功能接收该信号并处理同步状态 - // true : enabled - // false : disabled - // moduleIndex 定义见common.h中 "系统工具各模块索引" - // 比如 TRUSTED_PROTECTION_INDEX - void RequestUIStatusSynchronization(int moduleIndex, bool status); - -public Q_SLOTS: - void StartApp(); - void ExitApp(); - // 系统设置 - bool SetSysSettingValue(const QString &key, const QDBusVariant &value); - QDBusVariant GetSysSettingValue(const QString &key); - - // 获取磁盘设备路径列表 - QStringList GetDiskDevicePathList(); - - // 清理选中的垃圾文件 - void CleanSelectFile(QStringList filePaths); - - // 清理journal目录下的日志文件 - void CleanJournal(); - - // 查询相关联文件对应的包名信息 - QString QueryPackageName(const QString sBinaryFile); - // 应用程序安装卸载刷新数据库 - void RefreshPackageTable(); - - // 插入卸载记录 - void InsertUninstalledAppRecord(const QString &, const QString &); - // 删除卸载记录 - void DeleteUninstalledAppRecord(const QString &); - // 获取卸载应用程序名称 - QVariantList GetUnInstalledApps(); - -private: - // 校验调用者 - bool isValidInvoker(); - bool openLocalDb(); - // 递归函数-获取/usr/share/deepin-pc-manager/config/目录下所有的lock文件 - void scanFile(const QString &path); - - // 初始化localcache.db数据库 - void initLocalCache(); - // 接受数据库插入完成信号 - void acceptSqlInsertFinish(); - -private: - DaemonAdaptor *m_daemonAdaptor; - SettingsSql *m_settingsSql; // 系统设置查询 - - QString m_device; - - QSqlDatabase m_localCacheDb; - SecurityPkgNameSql *m_securityPkgNameSql; - QThread *m_securityPkgNameSqlThread; - QMap m_sPkgNameMap; - - bool m_isInitSqlDatabase; -}; diff --git a/deepin-pc-manager/CMakeLists.txt b/deepin-pc-manager/CMakeLists.txt index 3cd2f1c..3220dcb 100644 --- a/deepin-pc-manager/CMakeLists.txt +++ b/deepin-pc-manager/CMakeLists.txt @@ -1,17 +1,13 @@ -# SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -# -# SPDX-License-Identifier: GPL-3.0-or-later - set(BIN_NAME deepin-pc-manager) - # 设置包含当前目录,建议头文件的包含写全路径 set(CMAKE_INCLUDE_CURRENT_DIR ON) + # 若目标库安装了.cmake文件,则可以直接使用find_package find_package(PkgConfig REQUIRED) -# 若目标库未安装.cmake文件,但是安装了.pc文件,则可以使用pkgconfig -# pkg_check_modules(GSettings REQUIRED IMPORTED_TARGET gsettings-qt) +pkg_check_modules(GSettings REQUIRED IMPORTED_TARGET gsettings-qt) pkg_check_modules(PolkitQt REQUIRED IMPORTED_TARGET polkit-qt5-1) +pkg_check_modules(LibParted REQUIRED IMPORTED_TARGET libparted) find_package(QT NAMES Qt5 REQUIRED COMPONENTS Core) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Sql Gui Widgets DBus Concurrent) @@ -28,22 +24,18 @@ endif() # 建议对不同的模块进行分类,可使用通配符,可指定具名文件 file(GLOB_RECURSE SRCS + "*.xml" "src/*.h" "src/*.cpp" + "configs/*.json" + "include/*.h" ) - # 生成可执行文件 add_executable(${BIN_NAME} ${SRCS} defender.qrc src/window/icons/defender_icons.qrc ) -# 这里针对当前二进制定义了一个宏,保存着版本号,方便程序代码中调用,若程序中需要自定义宏变量并且在代码中使用,可参考此方法。 -# 注意CMAKE_PROJECT_XXX系列变量,某些属性是cmake帮助提供,但某些属性是project方法设置的,所以这里需要注意变量是否可用。 -# 至于是使用add_compile_xxx还是target_compile_xxx,视情况而定,一个是指定所有对象,一个是指定具体的二进制 -# target_compile_definitions(${BIN_NAME} PRIVATE -# VERSION="${CMAKE_PROJECT_VERSION}" -# ) # Qt 从5.15版本开始,可以直接使用Qt::Core,而不需要加版本号,但为了兼容性,把版本号加上为好 target_include_directories(${BIN_NAME} PUBLIC @@ -53,11 +45,12 @@ target_include_directories(${BIN_NAME} PUBLIC Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Concurrent Dtk::Widget - # PkgConfig::GSettings + PkgConfig::GSettings PkgConfig::PolkitQt + PkgConfig::LibParted + /usr/include/deepin-pc-manager/ src/ ) - target_link_libraries(${BIN_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Sql @@ -65,24 +58,22 @@ target_link_libraries(${BIN_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Concurrent Dtk::Widget - # PkgConfig::GSettings + PkgConfig::GSettings PkgConfig::PolkitQt + PkgConfig::LibParted ) # 指定安装目录,一般常用有3个: TARGETS(编译出来的目标二进制)、FILES(指定路径的文件,通常是配置文件或服务文件)、DIRECTORY(一般是配置文件较多时使用)。 install(TARGETS ${BIN_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) -install(FILES deepin-pc-manager.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications) -install(FILES com.deepin.pc.manager.service DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/dbus-1/services) -install(FILES src/window/icons/icons/deepin-pc-manager.svg DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps) -install(FILES src/window/icons/icons/water_blue_back.svg DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps) -install(FILES src/window/icons/icons/water_blue_front.svg DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps) -install(FILES src/window/icons/icons/water_yellow_back.svg DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps) -install(FILES src/window/icons/icons/water_yellow_front.svg DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps) -install(FILES src/window/icons/icons/water_red_back.svg DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps) -install(FILES src/window/icons/icons/water_red_front.svg DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps) -install(FILES cleanerwhite.json DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${BIN_NAME}) -install(FILES appInfomation.json DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${BIN_NAME}) -install(DIRECTORY assets/deepin-pc-manager DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/deepin-manual/manual-assets/application) -install(FILES toolinfo.json DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${BIN_NAME}) -install(FILES ./schemas/com.deepin.dde.deepin-pc-manager.gschema.xml DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/glib-2.0/schemas) +install(FILES ./deepin-pc-manager.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications) +install(FILES ./com.deepin.deepin-pc-manager.policy DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/polkit-1/actions) +install(FILES ./com.deepin.pc.manager.service DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/dbus-1/services) +install(FILES ./src/window/icons/icons/deepin-pc-manager.svg DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps) +install(FILES ./configs/org.deepin.dde.deepin-pc-manager.json DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/dsg/configs/org.deepin.dde.deepin-pc-manager/) +install(FILES ./cleanerwhite.json DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/deepin-pc-manager/) + +file(GLOB HEADERS "include/*") +# dev files +set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}/deepin-pc-manager) +install(DIRECTORY ${HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}) diff --git a/deepin-pc-manager/README.md b/deepin-pc-manager/README.md deleted file mode 100644 index 531bb40..0000000 --- a/deepin-pc-manager/README.md +++ /dev/null @@ -1,13 +0,0 @@ - - -## Installation - -### About GSetting -+ 第一次编译时和每次修改./schemas目录下的gsetting配置文件后,都需要执行下面命令 -``` -$ sudo qmake -``` \ No newline at end of file diff --git a/deepin-pc-manager/appInfomation.json b/deepin-pc-manager/appInfomation.json deleted file mode 100644 index fbf1f13..0000000 --- a/deepin-pc-manager/appInfomation.json +++ /dev/null @@ -1,151 +0,0 @@ -{ - "browserCookiesArray": [{ - "cookiesPath": ["/.config/com.360.browser/Default/Cookies", "/.config/com.360.browser/Default/Cookies-journal"], - "appID": "com.360.browser-stable" - }, { - "cookiesPath": ["/.config/uosbrowser/Default/Cookies", "/.config/uosbrowser/Default/Cookies-journal"], - "appID": "uos-browser" - }, { - "cookiesPath": ["/.config/qqbrowser/Default/Cookies", "/.config/qqbrowser/Default/Cookies-journal"], - "appID": "com.qq.browser" - }], - "appArray": [{ - "appCachePath": ["/.cache/com.360.browser"], - "appConfigPath": ["/.config/com.360.browser"], - "appWhiteList": [], - "appBlackList": [], - "appID": "com.360.browser-stable" - }, { - "appCachePath": ["/.cache/uosbrowser/Default"], - "appConfigPath": ["/.config/uosbrowser/"], - "appWhiteList": [], - "appBlackList": [], - "appID": "uos-browser" - }, { - "appCachePath": ["/.cache/browser"], - "appConfigPath": ["/.config/browser"], - "appWhiteList": [], - "appBlackList": [], - "appID": "org.deepin.browser" - }, { - "appCachePath": ["/.cache/qqbrowser"], - "appConfigPath": ["/.config/qqbrowser"], - "appWhiteList": [], - "appBlackList": [], - "appID": "com.qq.browser" - }, { - "appCachePath": ["/.cache/mozilla/firefox"], - "appConfigPath": ["/.mozilla"], - "appWhiteList": [], - "appBlackList": [], - "appID": "firefox-zh" - }, { - "appCachePath": ["/.cache/mozilla/firefox"], - "appConfigPath": ["/.mozilla"], - "appWhiteList": [], - "appBlackList": [], - "appID": "com.mozilla.firefox-zh" - }, { - "appCachePath": ["/.cache/mozilla/firefox"], - "appConfigPath": ["/.mozilla"], - "appWhiteList": [], - "appBlackList": [], - "appID": "firefox-nal" - }, { - "appCachePath": ["/.cache/mozilla/firefox"], - "appConfigPath": ["/.mozilla"], - "appWhiteList": [], - "appBlackList": [], - "appID": "firefox-esr" - }, { - "appCachePath": ["/.cache/mozilla/firefox"], - "appConfigPath": ["/.mozilla"], - "appWhiteList": [], - "appBlackList": [], - "appID": "org.mozilla.firefox" - }, { - "appCachePath": [], - "appConfigPath": ["/.config/360zip.db"], - "appWhiteList": [], - "appBlackList": [], - "appID": "com.qihoo.360zip" - }, { - "appCachePath": ["/.cache/netease-cloud-music"], - "appConfigPath": ["/.config/netease-cloud-music"], - "appWhiteList": ["netease-cloud-music/Cef"], - "appBlackList": [], - "appID": "com.163.music" - }, { - "appCachePath": [], - "appConfigPath": ["/.config/tencent-qq"], - "appWhiteList": [], - "appBlackList": [], - "appID": "qq" - }, { - "appCachePath": ["/.cache/sunloginclient"], - "appConfigPath": ["/.sunlogin"], - "appWhiteList": [], - "appBlackList": [], - "appID": "com.oray.sunlogin.client" - }, { - "appCachePath": [], - "appConfigPath": ["/.sunlogin"], - "appWhiteList": [], - "appBlackList": [], - "appID": "com.oray.sunlogin.enterprise" - }, { - "appCachePath": [], - "appConfigPath": ["/.sunlogin"], - "appWhiteList": [], - "appBlackList": [], - "appID": "com.oray.sunlogin.remote" - }, { - "appCachePath": ["/.config/baidunetdisk/Cache"], - "appConfigPath": ["/.config/baidunetdisk"], - "appWhiteList": [], - "appBlackList": [], - "appID": "com.baidu.baidunetdisk" - }, { - "appCachePath": [], - "appConfigPath": ["/.local/share/ThunderNetwork", "/.config/com.xunlei.download"], - "appWhiteList": [], - "appBlackList": [], - "appID": "com.xunlei.download" - }, { - "appCachePath": ["/.cache/filezilla"], - "appConfigPath": ["/.config/filezilla"], - "appWhiteList": [], - "appBlackList": [], - "appID": "filezilla" - }, { - "appCachePath": ["/.cache/filezilla"], - "appConfigPath": ["/.config/filezilla"], - "appWhiteList": [], - "appBlackList": [], - "appID": "org.filezilla" - }, { - "appCachePath": ["/.cache/filezilla"], - "appConfigPath": ["/.config/filezilla"], - "appWhiteList": [], - "appBlackList": [], - "appID": "org.filezilla-project.filezilla" - },{ - "appCachePath": ["/.cache/filezilla"], - "appConfigPath": ["/.config/filezilla"], - "appWhiteList": [], - "appBlackList": [], - "appID": "org.filezilla.filezilla.klu" - }, { - "appCachePath": ["/.cache/youdao-dict", "/.cache/Youdao/Youdao Dict"], - "appConfigPath": ["/.config/youdao-dict", "/.local/share/Youdao/Youdao Dict", "/.local/share/Youdao Dict"], - "appWhiteList": [], - "appBlackList": [], - "appID": "com.youdao.cidian" - }, { - "appCachePath": [], - "appConfigPath": ["/.local/share/Kingsoft", "/.config/Kingsoft"], - "appWhiteList": [], - "appBlackList": [], - "appID": "wps-office-prometheus" - }] -} \ No newline at end of file diff --git a/deepin-pc-manager/appInfomation.json.license b/deepin-pc-manager/appInfomation.json.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/appInfomation.json.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/attention.svg b/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/attention.svg deleted file mode 100755 index 23149c0..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/attention.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - attention - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/attention.svg.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/attention.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/attention.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/close.svg b/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/close.svg deleted file mode 100755 index e846c83..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/close.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/close.svg.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/close.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/close.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/deepin_defender.svg b/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/deepin_defender.svg deleted file mode 100755 index 233063f..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/deepin_defender.svg +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/deepin_defender.svg.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/deepin_defender.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/deepin_defender.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/deepin_launcher.svg b/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/deepin_launcher.svg deleted file mode 100755 index 5793b38..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/deepin_launcher.svg +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/deepin_launcher.svg.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/deepin_launcher.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/deepin_launcher.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/icon_details.svg b/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/icon_details.svg deleted file mode 100755 index 0724288..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/icon_details.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - icon_details - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/icon_details.svg.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/icon_details.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/icon_details.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/icon_menu.svg b/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/icon_menu.svg deleted file mode 100755 index 35dd6ea..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/icon_menu.svg +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - image/svg+xml - - img_upload - - - - - - img_upload - Created with Sketch. - - - - - - - - - - - - - diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/icon_menu.svg.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/icon_menu.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/icon_menu.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/isolation.svg b/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/isolation.svg deleted file mode 100755 index ec7e257..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/isolation.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - 形状 - Created with Sketch. - - - - \ No newline at end of file diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/isolation.svg.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/isolation.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/isolation.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/notes.svg b/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/notes.svg deleted file mode 100755 index e9a3aa6..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/notes.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - notes - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/notes.svg.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/notes.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/notes.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/repair.svg b/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/repair.svg deleted file mode 100755 index f06e818..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/repair.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - 形状结合 - Created with Sketch. - - - - \ No newline at end of file diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/repair.svg.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/repair.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/repair.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/search.svg b/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/search.svg deleted file mode 100755 index 1a84db4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/search.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/search.svg.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/search.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/search.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/tips.svg b/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/tips.svg deleted file mode 100755 index 011c05f..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/tips.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - tips - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/tips.svg.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/tips.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/tips.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/trust.svg b/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/trust.svg deleted file mode 100755 index 65fd7a0..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/trust.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - 形状结合 - Created with Sketch. - - - - \ No newline at end of file diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/trust.svg.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/trust.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/trust.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/userswitch.svg b/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/userswitch.svg deleted file mode 100755 index aa727f3..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/userswitch.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - userswitch_normal - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/userswitch.svg.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/userswitch.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/common/userswitch.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/adm.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/adm.png deleted file mode 100644 index 60405b4..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/adm.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/adm.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/adm.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/adm.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/certification.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/certification.png deleted file mode 100644 index 6b37c47..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/certification.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/certification.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/certification.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/certification.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/choice.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/choice.png deleted file mode 100644 index ce57bad..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/choice.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/choice.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/choice.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/choice.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/cleanup.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/cleanup.png deleted file mode 100644 index 83ae01b..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/cleanup.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/cleanup.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/cleanup.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/cleanup.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/datausage.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/datausage.png deleted file mode 100644 index c5a181c..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/datausage.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/datausage.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/datausage.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/datausage.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_password.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_password.png deleted file mode 100644 index 50e7869..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_password.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_password.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_password.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_password.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_result.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_result.png deleted file mode 100644 index 4ff2b8c..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_result.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_result.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_result.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_result.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_security.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_security.png deleted file mode 100644 index 5bccdae..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_security.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_security.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_security.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_security.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_security_tool.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_security_tool.png deleted file mode 100644 index 0004d56..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_security_tool.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_security_tool.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_security_tool.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_security_tool.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_startup.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_startup.png deleted file mode 100644 index b7c9790..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_startup.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_startup.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_startup.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/e_startup.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/examination.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/examination.png deleted file mode 100644 index 062e072..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/examination.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/examination.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/examination.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/examination.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/firewall.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/firewall.png deleted file mode 100644 index 1f3ef80..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/firewall.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/firewall.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/firewall.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/firewall.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/homepage.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/homepage.png deleted file mode 100644 index faf3cc4..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/homepage.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/homepage.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/homepage.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/homepage.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/internetcontrol.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/internetcontrol.png deleted file mode 100644 index 4790266..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/internetcontrol.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/internetcontrol.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/internetcontrol.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/internetcontrol.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/log.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/log.png deleted file mode 100644 index 05b121c..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/log.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/log.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/log.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/log.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/login.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/login.png deleted file mode 100644 index a063870..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/login.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/login.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/login.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/login.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/loginsafety.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/loginsafety.png deleted file mode 100644 index 60379f9..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/loginsafety.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/loginsafety.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/loginsafety.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/loginsafety.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/networkcontrol.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/networkcontrol.png deleted file mode 100644 index c69d4c5..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/networkcontrol.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/networkcontrol.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/networkcontrol.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/networkcontrol.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/protection.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/protection.png deleted file mode 100644 index 9809e0c..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/protection.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/protection.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/protection.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/protection.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/quarantinearea.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/quarantinearea.png deleted file mode 100644 index 2a52981..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/quarantinearea.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/quarantinearea.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/quarantinearea.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/quarantinearea.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/rankings.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/rankings.png deleted file mode 100644 index 6c4755e..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/rankings.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/rankings.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/rankings.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/rankings.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/remoteaccesscontrol.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/remoteaccesscontrol.png deleted file mode 100644 index c128e12..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/remoteaccesscontrol.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/remoteaccesscontrol.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/remoteaccesscontrol.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/remoteaccesscontrol.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/result.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/result.png deleted file mode 100644 index 2d363f1..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/result.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/result.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/result.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/result.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/rule1.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/rule1.png deleted file mode 100644 index 9dd3d34..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/rule1.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/rule1.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/rule1.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/rule1.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/rule2.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/rule2.png deleted file mode 100644 index 59451db..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/rule2.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/rule2.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/rule2.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/rule2.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/security_logs.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/security_logs.png deleted file mode 100644 index 3f76372..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/security_logs.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/security_logs.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/security_logs.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/security_logs.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/security_tool.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/security_tool.png deleted file mode 100644 index 2b9dd7a..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/security_tool.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/security_tool.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/security_tool.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/security_tool.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/startup.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/startup.png deleted file mode 100644 index 754fe50..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/startup.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/startup.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/startup.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/startup.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/timed_scan.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/timed_scan.png deleted file mode 100644 index 15bcb03..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/timed_scan.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/timed_scan.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/timed_scan.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/timed_scan.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/trustarea.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/trustarea.png deleted file mode 100644 index 36a3715..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/trustarea.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/trustarea.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/trustarea.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/trustarea.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/trusted_protection.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/trusted_protection.png deleted file mode 100644 index 2ffb668..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/trusted_protection.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/trusted_protection.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/trusted_protection.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/trusted_protection.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/usb_connecting.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/usb_connecting.png deleted file mode 100644 index dc3a0c3..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/usb_connecting.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/usb_connecting.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/usb_connecting.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/usb_connecting.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/usb_whitelist.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/usb_whitelist.png deleted file mode 100644 index 59d2a4f..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/usb_whitelist.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/usb_whitelist.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/usb_whitelist.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/usb_whitelist.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/usbconnection.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/usbconnection.png deleted file mode 100644 index ad6351c..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/usbconnection.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/usbconnection.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/usbconnection.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/usbconnection.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/usbwhitelist.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/usbwhitelist.png deleted file mode 100644 index cfdf9be..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/usbwhitelist.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/usbwhitelist.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/usbwhitelist.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/usbwhitelist.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/virusresult.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/virusresult.png deleted file mode 100644 index 8b63431..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/virusresult.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/virusresult.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/virusresult.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/virusresult.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/virusscan.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/virusscan.png deleted file mode 100644 index d31a361..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/virusscan.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/virusscan.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/virusscan.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/fig/virusscan.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/security-center.md b/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/security-center.md deleted file mode 100644 index b48c7b1..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/en_US/security-center.md +++ /dev/null @@ -1,410 +0,0 @@ - - -# Security Center|deepin-defender| - -## Overview - -Security Center is an application that provides functions such as full check, virus scan, firewall, cleanup, security tools and so on. - -## Guide - -You can run, close and create a shortcut for Security Center by the following ways. - -### Run Security Center - -1. Click ![Launcher](../common/deepin_launcher.svg) on dock to enter Launcher interface. -2. Locate ![deepin_defender](../common/deepin_defender.svg) by scrolling mouse wheel or searching by "Security Center" in Launcher interface. -3. Right-click ![deepin_defender](../common/deepin_defender.svg), you can - - - Click **Send to desktop** to create a desktop shortcut. - - Click **Send to dock** to fix the application on dock. - - Click **Add to startup** to add it to startup, it will automatically run when the system starts up. - - - -### Exit Security Center - -- Right-click ![deepin_defender](../common/deepin_defender.svg) on the Dock, select **Exit** to exit. -- Click ![Settings](../common/icon_menu.svg) in the main interface and select **Exit**. - -## Operations - -### Full Check - -1. Open Security Center, click **Full Check** in the left panel, you can click **Check Now** to examine the system. -2. After the system examination is finished, if there is any abnormality, you can operate on each problem item separately, or, you can click **Fix All** to fix many problems. - -![0|result](fig/result.png) - -3. When the process completes, click **Done** to return to "Full Check" screen. - -### Virus Scan - -#### Scanning - -Security Center supports full scanning, quick scanning, and custom scanning. - -1. On the homepage, click **Virus Scan** in the left panel, and select a scanning method. After scanning finishes, you will see the result. - -![0|virusscan](fig/virusscan.png) - -2. According to the result, you can choose corresponding operations to one or multiple results. - - **Singularly Operation:** - - - Repair: click ![repair](../common/repair.svg), this risk will be fixed, and it won't be diagnosed as a risk for the next time. - - - Quarantine: click ![isolation](../common/isolation.svg), this risk will be quarantined, other files would not be affected. It won't be diagnosed as a risk for the next time. You can click **Quarantine** icon below to view it. - - - Trust: click ![trust](../common/trust.svg), this risk will be trusted. It won't be diagnosed as a risk for the next time. You can view it in "Exclusion". - - **Batch Operation:** - - Check all risks you want to deal with, select **Repair Now**, **Quarantine Now** or **Add to Whitelist** from the drop-down box, and then click **Start**. - -![0|virusresult](fig/virusresult.png) - -#### Schedule Scan - -For quick scan and full scan, you can also set up a schedule scan. This function is turned off by default, when it is turned on, you can perform virus scanning tasks according to the settings. - -- Scan type: quick scan and full scan are supported. -- Scan time: select or customize the scan time. -- When viruses are found: - - Ask me: After a virus is found, a confirmation box will pop up. You can select **Ignore** to not remove it, or select **Remove Now**. If you don't carry out any operation, “Ignore” is selected by default. - - Auto remove: Automatically remove the virus after it is found. - -![0|timed_scan](fig/timed_scan.png) - -#### USB Device Scan - -For USB storage devices, you can set whether to automatically scan and how to handle viruses found. - - Ask me: After a virus is found, a confirmation box will pop up. You can select **Remove Now**, or select **Cancel** to exit scanning. - - Auto remove: Automatically remove the virus after it is found. - - - - -#### Quarantine - -On the interface of Virus Scan, you can click **Quarantine** icon below to view the list of quarantined files, and click **Restore** to move them out of it. - -![0|quarantinearea](fig/quarantinearea.png) - -#### Exclusions - -On the interface of Virus Scan, you can click **Exclusions** to view the list of trusted files, and click **Remove** to move them out of it. - -![0|trustarea](fig/trustarea.png) - -#### Whitelist - -On the interface of Virus Scan, you can click **Whitelist** icon below to view the list of quarantined files, and click **Remove** to move them out of it. - -#### Scan Logs -On the interface of Virus Scan, you can click **Scan Logs** icon below to view scanning time, scan type, results and action. Click ![icon-details](../common/icon_details.svg) to view details and you can also delete logs. - -![0|log](fig/log.png) - -#### Virus database update - -New virus keep coming out everyday. So your virus database should be regularly updated to satisfy the security needs of your computer. Currently online update and offline update are supported. - -**Update Online** - -When a new virus database is detected, click **Update** on the "Virus Scan" screen to update the virus database. If no new database is detected, you can click **Check for Updates**. - -**Update Offline** - -If you are unable to update your virus database online due to network disconnection or other reasons, you can choose to update offline. - -1. Click ![icon_menu](../common/icon_menu.svg) on the interface. -2. Select **Update virus databases offline**. File Manager pops up. Import the corresponding .zip format virus database file. If the antivirus engine you are currently using is Rising, you must import the Rising virus database file. -3. After successful import, the virus database version in the bottom right corner of the Virus Scan interface is updated accordingly. - -### Firewall - -Open Security Center, click **Firewall** in the left panel. In the "Firewall" screen, you need to enter the system login password for authentication to turn on or off the firewall. - -The firewall switch is turned off by default and the network protection policy cannot take effect. "Private network" is selected when you switch it on. You can also switch to public network policy or customize network protection rules. - ->![notes](../common/notes.svg) Notes: When the system security level is switched to High or Medium, the firewall switch is turned on. - -- Public network: mainly for public network signals such as stations, shopping malls, cafes, and so on, executing the default policy under public network scenarios. - -- Private network: mainly for office and home network scenarios, executing the default policy under private network scenarios. - -- Customize: After selecting this option, you can configure advanced firewall rules by yourself. - -![0|firewall](fig/firewall.png) - -#### Customize - -1. In the Firewall interface, check "Customize" and click the icon > to enter the configuration screen. - -2. Click **Add** and then input or check firewall rules, including rule name, program, policy, direction, protocol and so on. - - - Rule name: The rule name cannot be repeated, you can use the default name or custom name. - - - Program: "All" is selected by default. Or you can check the drop-down box or fuzzy search for the corresponding service in the input box. - - - Policy: "Allow" is selected by default, which means packet transmission is allowed. Select "Deny" to prohibit packet transmission. - - - Direction: "Both" is selected by default. "Outbound" means the local host accesses external data, while "Inbound" means external data enters the local host. - - - Protocol: Refers to the communication protocol supported by the system. "tcp" is selected by default, or the corresponding protocol can be checked in the drop-down box or fuzzy searched in the input box. - - - Local Port/IP: (Optional) indicating the port number and IP of the local host, the filling rules can refer to the example. - - - Remote Port/IP: (Optional) indicating the port number and IP of the remote host, please refer to the example for the filling rules. - - - Status: Unchecked by default, indicating that the rule is disabled. When checked, the rule is enabled. - - ![0|rule1](fig/rule1.png) - -3. When you have completed all the settings, click **Save**. After that, you can view the list of rules in the configuration page. - - ![0|rule2](fig/rule2.png) - -4. If multiple rules are added, by default, enabled rules are displayed first and in descending order of creation time, while disabled rules are displayed later and in descending order of creation time. When there is a conflict between the rules created in succession, the enabled rule created last takes precedence. - -#### Context menu - -For the added rules, you can perform related operations according to the enabled status. - -Singularly operation - -- One enabled rule: In the context menu, only "Disable" is available. -- One disabled rule: In the context menu, you can select "Modify", "Enable" or "Delete". - -Batch operation - -- All enabled rules: In the context menu, only "Disable" is available. -- All disabled rules: In the context menu, you can select "Enable" or "Delete". -- Rules containing both enabled and disabled: In the context menu, you can select "Enable", "Disable" or "Delete". - -### Cleanup - -Operating system will produce all kinds of junks in the daily operation. When more and more junks are generated, the efficiency of the system will be affected, and disk resources are wasted. It is suggested to clean up the garbage regularly to ensure the smooth operation of the system and improve the utilization rate of resources. - -1. Open Security Center and select **Cleanup** in the left panel to enter the garbage cleaning interface. - -2. Check the corresponding garbage type. Currently, you can choose to clean up system junk, application junk, traces and cookies. - -![cleanup](fig/cleanup.png) - -3. Click **Scan Now** to enter the scanning interface. - -4. After scanning, the junks found in scanning can be viewed and disposed accordingly. - - - Clean up: clean up all the selected junks. You can also cancel or check more options. - - Back: return to the cleaning interface without any processing. - -5. Click **Done** after cleaning. You can also click **Cancel** during cleaning up. - -### Tools - -Open Security Center and select **Tools** in the left panel. You can see "System Tools" and "Network Tools" here. Click the small icons to use the tools accordingly. - -![0|security_tool](fig/security_tool.png) - -#### System Tools - -**USB Connection** - -On **USB Connection** interface, you can view all history about USB devices with storage function connecting to your computer. - -![0|usbconneting](fig/usb_connecting.png) - -You can also add the USB device used very often into whitelist, and select **Only Whitelist** in **Connection limitation** to avoid data breach. - - - -**Login Safety** - -On **Login Safety** interface, you can set password security levels and notifying period before password expired and change password regularly. -- **High** or **Medium**: If you have chosen either one of them, when you modify password in Control Center or setup password when creating new ID, the password you set will not be saved successfully if it doesn't comply with the requirement of the corresponding level. You can go to Control Center to reset your password or modify security level in Security Center. -- **Low**: If you have chosen this option, when you modify password in Control Center or setup password when creating new ID, the new password will be saved directly. - -![0|loginsecurity](fig/loginsafety.png) - -**Startup Programs** - -In this interface, only applications in the Launcher are displayed and detailed by "Name", "Auto Startup" and "Action". You can choose "Enabled" or "Disabled" for each application. - -![0|selflaunchmanagement](fig/startup.png) - -**Security Level** - -The security level configuration function portal is hidden by default, and when enabled, it will strengthen the control of system permissions. If you need to use it, you can contact our technical support to get the way to open it. - -According to the usage scenario, choose the appropriate system security level configuration, the default system security level is low. - -- **High**: Turn on the security protection of Equal Protection Level 3, turn on the security protection of identification, autonomous access control, tagging and mandatory access control, security audit, data integrity verification, data confidentiality, network security, operation security, and resource monitoring. Also configure passwords for system admin, audit admin, and security admin account. -- **Medium**: Turn on the basic security protection, and also open the firewall network security protection, and adjust password security level to medium, to protect the system security. -- **Low**: Applicable to trusted usage environment, providing basic security protection. - -(1) Switch from low or medium to high - -1. In the Security Level screen, check "High". The authentication box pops up, enter the system login password for authentication. - - ![0|certification](fig/certification.png) - -2. Click **Confirm** in the pop-up window. Configure the passwords for system admin, audit admin, and security admin account, and assign different permissions to each administrator. - - - System admin (sysadm): to create, delete users, install software, and other system-related settings. - - Audit admin (audadm): to add audit rules, view audit logs. - - Security admin (secadm): to manage security context, inquiry and set security configurations. - - ![0|adm](fig/adm.png) - -4. After successful configuration, reboot the system to make all settings effective, some privileges of normal users will be restricted. The system login screen will show three administrator accounts, which can be switched. - - ![0|login](fig/login.png) - -(2) Switch from high to medium or low - -The system security level can be switched from high to medium or low only under the security admin account. Neither the system admin nor the audit admin can switch the system security level. - -1. If you are not currently a security administrator account, click the switch user icon ![userswitch](../common/userswitch.svg) on the system login screen, select the secadm and log in. - -2. Enter the system security level screen and check "Medium" or "Low". The authentication box pops up, enter the system login password for authentication. - -3. After the second confirmation and successful configuration, the three-privilege account is deleted and the normal user privileges are restored, and the level switch takes effect immediately. Configuration related to system security is restored after system reboot. - -(3) Switch from low to medium or from medium to low - -1. When switching from low to medium or from medium to low, the authentication box pops up, enter the system login password for authentication. -2. Click **Confirm** in the pop-up window. The level switch takes effect immediately after successful configuration. - -**Trusted Protection** - -This function mainly checks the integrity of key components of the system, and it is turned off by default. - -When the system security level is switched to high, the integrity check switch is turned on at the same time; when the system security level is switched to medium or low, the integrity check switch is turned off at the same time, and it can be turned off or on by itself. - -1. In the Trusted Protection interface, some of the protected system files are provided by default and cannot be modified or removed, and the protection policy is disabled by default. For the new component files, you can modify, remove protection, set protection policy and carry out other operations. - -2. Click **Add**. The File Manager window pops up and you can manually add the component files to be protected. - - ![0|trusted_protection](fig/trusted_protection.png) - -3. The new component file protection policy defaults to "Warning" and can also be set to "Prohibit". - - - Warning: When integrity is broken and execution is detected, a system notification is issued "if the integrity is damaged, show warnings when executed", you can choose **Ignore** or **Prohibit**. - - Prohibit: When integrity is broken and execution is detected, the system notification "if the integrity is damaged, prohibit the execution" is issued. - -4. If the component file has been modified, the status bar changes from "Normal" to "Tampered". - -5. Check the corresponding component file(s) and click **Unprotect** to remove it (them) from protection. - - - - -#### Network Tools - -**Internet Control** - -Internet Control is turned off by default. Turn on it to set the networking status of a single application in the Launcher. Each application or service has three options in the drop-down box. - -- Ask: when an application or service starts up port listening, a prompt saying “xxx wants to connect to the Internet” pops up. And you can select **Allow Once**, **Allow always** or **Disable**. - -- Allow: whenever the application starts up remote connection, it is allowed by default, and no prompt will pop up. - -- Disable: when an application or service starts up port listening, a prompt saying “The firewall has blocked xxx from connecting to the Internet” pops up. And you can select **Go to Settings** or **OK**. - ->![notes](../common/notes.svg) Notes: If no network connection is initiated there will be no pop-up message, for example, even if **Ask** or **Disable** is selected for the applications that are not networked, there will be no pop-up message at startup. - -![internetcontrol](fig/internetcontrol.png) - - -**Data Usage** - -The data usage function is turned off by default. When it is turned on, you can monitor the traffic used by applications in the system to access the Internet. - -- Apps and Services: view all applications started, and display the current downloading speed and uploading speed of each application. Click the drop-down box to select **Ask**, **Allow** or **Disable**. Refer to [Internet Control](#Network Tools) under Chapter "Tools" to see if the application can connect to the Internet. - -![0|datausage](fig/datausage.png) - -- Rankings: view the traffic ranking of all applications in the Launcher, including downloading traffic, uploading traffic, total traffic and data used details. Click the drop-down box in the upper right corner of the list to switch time span: today, yesterday, this month and last month. - -![0|ramkings](fig/rankings.png) - - -## Main Menu - -You can switch themes, view manual and version information in Main Menu. - -### Settings - -Click ![icon_menu](../common/icon_menu.svg) on the interface. Select **Settings**. - -#### Basic - -**Virus Scan** - -- Add "Virus scan" to the context menu: after you check this option, when you right-click a folder, you can select **Virus scan**. -- Do not scan archives larger than xxxMB(20-5120): after you check this option, if a package is larger than the size you set here, it won't be scanned. -- Virus database server address: after you check this option, you can set the address for virus database updating. - -**Antivirus Engine** - -You can choose "Rising" or "DAS-security". - -**Close Main Window** - - - you can click **Minimize to system tray**. When you close the main window, it will be minimized to system tray. - - you can click **Exit**. When you close the main window, you will exit Security Center directly. - - you can click **Ask me always**. When you close the main window, the system will pop up a query to get your confirmation. - -#### Restore Defaults - -Click **Restore Defaults** button to restore the current page to defaults. - -### Report issues - -1. Click ![icon_menu](../common/icon_menu.svg)on the interface. -2. Select **Report issues** to go to **Consults** interface of **Support** application where you can give your feedback. - -### Logs - -1. Click ![icon_menu](../common/icon_menu.svg)on the interface. -2. Select **Logs**, you can view operation logs of Security Center according to "Date and Time" and "Category". You can also select to **Clear below logs**. - -![logs](fig/security_logs.png) - - -### Theme - -The window theme includes Light Theme, Dark Theme and System Theme. - -1. Click ![icon_menu](../common/icon_menu.svg)on the interface. -2. Click **Theme** to select one. - - - -### Help - -View the manual to help you further know and use Security Center. - -1. Click ![icon_menu](../common/icon_menu.svg)on the interface. -2. Click **Help** to view the manual. - - - -### About - -1. Click ![icon_menu](../common/icon_menu.svg)on the interface. -2. Click **About** to view version information and introduction about Security Center. - - - -### Exit - -1. Click ![icon_menu](../common/icon_menu.svg)on the interface. -2. Click **Exit**. - diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/adm.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/adm.png deleted file mode 100755 index 9818d8b..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/adm.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/adm.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/adm.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/adm.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/certification.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/certification.png deleted file mode 100755 index cff0a64..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/certification.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/certification.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/certification.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/certification.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/current_network.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/current_network.png deleted file mode 100755 index bb6fda2..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/current_network.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/current_network.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/current_network.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/current_network.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/firewall.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/firewall.png deleted file mode 100755 index 4e94b6c..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/firewall.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/firewall.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/firewall.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/firewall.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/garbage_cleaning.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/garbage_cleaning.png deleted file mode 100755 index 724f477..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/garbage_cleaning.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/garbage_cleaning.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/garbage_cleaning.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/garbage_cleaning.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/login-security.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/login-security.png deleted file mode 100755 index 8b9c0a4..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/login-security.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/login-security.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/login-security.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/login-security.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/login.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/login.png deleted file mode 100755 index 14640eb..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/login.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/login.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/login.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/login.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/network_control.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/network_control.png deleted file mode 100755 index d3040ff..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/network_control.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/network_control.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/network_control.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/network_control.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/quarantine_area.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/quarantine_area.png deleted file mode 100755 index dd8c4f9..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/quarantine_area.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/quarantine_area.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/quarantine_area.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/quarantine_area.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/result.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/result.png deleted file mode 100755 index 44d8f1d..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/result.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/result.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/result.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/result.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/rule1.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/rule1.png deleted file mode 100755 index 2fd607f..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/rule1.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/rule1.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/rule1.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/rule1.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/rule2.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/rule2.png deleted file mode 100755 index 57a4e07..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/rule2.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/rule2.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/rule2.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/rule2.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/security.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/security.png deleted file mode 100755 index e2d78d2..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/security.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/security.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/security.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/security.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/security_log.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/security_log.png deleted file mode 100755 index b05c177..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/security_log.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/security_log.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/security_log.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/security_log.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/security_tool.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/security_tool.png deleted file mode 100755 index 2b2cb87..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/security_tool.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/security_tool.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/security_tool.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/security_tool.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/self_launch_management.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/self_launch_management.png deleted file mode 100755 index e793a8f..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/self_launch_management.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/self_launch_management.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/self_launch_management.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/self_launch_management.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/timed_scan.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/timed_scan.png deleted file mode 100755 index 989cfc0..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/timed_scan.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/timed_scan.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/timed_scan.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/timed_scan.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/traffic_ranking.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/traffic_ranking.png deleted file mode 100755 index 78feae6..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/traffic_ranking.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/traffic_ranking.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/traffic_ranking.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/traffic_ranking.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/trust_area.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/trust_area.png deleted file mode 100755 index 8e95726..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/trust_area.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/trust_area.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/trust_area.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/trust_area.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/trusted_protection.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/trusted_protection.png deleted file mode 100755 index 8d64be8..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/trusted_protection.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/trusted_protection.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/trusted_protection.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/trusted_protection.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/usb_conneting.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/usb_conneting.png deleted file mode 100755 index 0efc082..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/usb_conneting.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/usb_conneting.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/usb_conneting.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/usb_conneting.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/virus_killing_log.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/virus_killing_log.png deleted file mode 100755 index 500e1c5..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/virus_killing_log.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/virus_killing_log.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/virus_killing_log.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/virus_killing_log.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/virus_result.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/virus_result.png deleted file mode 100755 index 71a2f96..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/virus_result.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/virus_result.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/virus_result.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/virus_result.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/virus_scan.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/virus_scan.png deleted file mode 100755 index 2e258dd..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/virus_scan.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/virus_scan.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/virus_scan.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/fig/virus_scan.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/security-center.md b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/security-center.md deleted file mode 100755 index 5354870..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_CN/security-center.md +++ /dev/null @@ -1,400 +0,0 @@ - - -# 安全中心|deepin-defender| - -## 概述 - -安全中心是一款提供系统安全检测、病毒查杀、防火墙、垃圾清理以及安全工具等功能的应用软件。 - -## 使用入门 - -您可以通过以下方式运行或关闭安全中心,或者创建快捷方式。 - -### 运行安全中心 - -1. 单击任务栏上的启动器图标 ![deepin_launcher](../common/deepin_launcher.svg),进入启动器界面。 -2. 上下滚动鼠标滚轮浏览或通过搜索,找到安全中心图标 ![deepin_defender](../common/deepin_defender.svg) ,单击运行 。 -3. 右键单击 ![deepin_defender](../common/deepin_defender.svg),您可以: - - 单击 **发送到桌面**,在桌面创建快捷方式。 - - - 单击 **发送到任务栏**,将应用程序固定到任务栏。 - - - 单击 **开机自动启动**,将应用程序添加到开机启动项,在电脑开机时自动运行该应用程序。 - -### 关闭安全中心 - -- 右键单击托盘上的安全中心图标 ![deepin_defender](../common/deepin_defender.svg) ,选择 **退出** 来退出安全中心。 -- 在安全中心界面单击 ![icon_menu](../common/icon_menu.svg) ,选择 **退出** 来退出安全中心。 - -## 操作介绍 - -### 系统体检 - -1. 打开安全中心,选择左侧导航栏的 **系统体检**,单击 **立即体检** 后进行系统体检。 - -2. 体检完后,若有异常则可以对每个问题项单独操作,还可以单击 **一键修复** 快速修复多项问题。 - - ![0|result](fig/result.png) - -3. 处理完成后,单击 **完成** 返回到系统体检首页。 - - -### 病毒查杀 -#### 病毒扫描 - -安全中心支持三种病毒扫描方式,分别为全盘扫描、快速扫描和自定义扫描。 - -1. 打开安全中心,选择左侧导航栏的 **病毒查杀**。在病毒查杀界面,选择病毒扫描方式,扫描完成后会显示扫描结果。 - - ![0|virus_scan](fig/virus_scan.png) - -2. 根据扫描结果,可以对每个风险项单独操作,也可以选择批量操作。 - - **单项操作**: - - - 修复:单击修复按钮 ![repair](../common/repair.svg) 后,风险项被修复,下次扫描不会被判定为异常。 - - - 隔离:单击隔离按钮 ![isolation](../common/isolation.svg) 后,风险项被隔离,隔离后不会影响其他文件,下次扫描不会被判定为异常,可在隔离区查看。 - - - 信任:单击信任按钮 ![trust](../common/trust.svg) 后,风险项被信任,下次扫描不会被判定为异常,可在信任区查看。 - - **批量操作**: - - 勾选需要处理的风险项后,在页面底部的下拉框中选择 **立即修复**、**立即隔离** 或 **添加信任** 选项后,单击 **执行**,则可以批量处理风险项。 - - ![0|virus_result](fig/virus_result.png) - -#### 定时扫描 - -针对快速扫描和全盘扫描,还可以设置定时扫描。定时扫描功能默认关闭,开启后,可以根据设置的内容执行病毒扫描任务。 - -- 扫描类型:支持选择快速扫描或全盘扫描。 -- 扫描时间:选择或自定义扫描时间。 -- 发现病毒处理方式: - - 询问:发现病毒后弹出处理提示,可以选择 **忽略** 不处理,还可以选择 **立即处理**。若不做任何处理,则默认取消不处理。 - - 自动处理:扫描完成后自动处理异常病毒。 - -![0|timed_scan](fig/timed_scan.png) - -#### USB扫描 - -对于USB存储设备,可以设置是否自动扫描及发现病毒处理方式。 - -- 询问:发现病毒后,可以选择 **立即处理** 将病毒隔离或选择 **取消** 退出扫描。 -- 自动处理:扫描完成后自动处理异常病毒。 - -#### 隔离区 - -在病毒查杀界面,单击 **隔离区**,可查看隔离文件列表,还可以选择将文件移出隔离。 - -![0|quarantine_area](fig/quarantine_area.png) - -#### 信任区 - -在病毒查杀界面,单击 **信任区**,可查看信任文件列表,还可以选择将文件移出信任。 - -![0|trust_area](fig/trust_area.png) - -#### 白名单 - -在病毒查杀界面,单击 **白名单**,将文件加入白名单后,病毒扫描时则会被跳过。若文件发生变化,将导致信任失效,并自动从白名单目录中移除。 - -#### 查杀日志 - -在病毒查杀界面,单击 **查杀日志**,可查看每次病毒扫描的时间、扫描类型及结果。单击详情按钮 ![icon_details](../common/icon_details.svg),可查看日志详情,还可以选择删除日志。 - -![0|virus_killing_log](fig/virus_killing_log.png) - -#### 病毒库更新 - -每天都有新病毒产生,所以要定期更新病毒库,以满足计算机的安全需求,当前支持病毒库在线更新和离线更新。 - -**在线更新** - -当检测到新的病毒库时,在病毒查杀界面,单击 **更新** 进行病毒库更新。如果没有检测到新的病毒库,可以单击 **检查更新** 进行检查。 - -**离线更新** - -如果因为断网等情况无法在线更新病毒库,则可以选择离线更新。 - -1. 在安全中心界面,单击 ![icon_menu](../common/icon_menu.svg)。 -2. 选择 **病毒库离线更新**,弹出文件管理器,导入对应的.zip格式病毒库文件。如果当前使用的杀毒引擎是瑞星网安,则必须导入瑞星网安病毒库文件。 -3. 导入成功后,病毒查杀界面右下角的病毒库版本更新为导入后的版本号。 - -### 防火墙 - -打开安全中心,选择左侧导航栏的 **防火墙**。在防火墙界面,开启或关闭防火墙需要输入系统登录密码进行认证。 - -防火墙开关默认关闭,网络防护策略无法生效。开启后默认选中专用网络策略,也可以切换为公共网络策略或自定义网络防护规则。 - -> ![notes](../common/notes.svg) 说明:当系统安全等级切换为高或中时,防火墙开关则会开启。 - -- 公共网络防护:主要为车站、商场、咖啡厅等公共网络信号,执行公网场景下的默认策略。 - -- 专用网络防护:主要为办公、家庭网络场景,执行专网场景下的默认策略。 - -- 自定义网络防护规则:选择此项后,可以自行配置高级防火墙规则。 - -![0|firewall](fig/firewall.png) - -#### 自定义规则 - -1. 在防火墙界面,勾选“自定义”,单击更多图标 >,进入配置界面。 - -2. 单击 **添加** 按钮,填写或勾选防火墙规则信息,包括规则名称、程序服务、策略、方向。协议等。 - - - 规则名称:规则名称不可重复,可以使用默认名称或自定义名称。 - - - 程序服务:默认选择全部服务,也可以在下拉框中勾选或在输入框模糊搜索对应的服务。 - - - 策略:默认选择允许,表示允许数据包传输。选择拒绝,表示不允许数据包传输。 - - - 方向:默认选择出入站,出站表示本地主机访问外部数据,入站表示外部数据进入本地主机。 - - - 协议:系统支持的通信协议,默认选择TCP,也可以在下拉框中勾选或在输入框模糊搜索对应的协议。 - - - 本地端口/IP:非必填项,表示本地主机的端口号和IP,填写规则可以参考示例。 - - - 远程端口/IP:非必填项,表示远程主机的端口号和IP,填写规则可以参考示例。 - - - 状态:默认不勾选,表示该规则已停用。勾选后,启用该规则。 - - ![0|rule1](fig/rule1.png) - -3. 完成所有的信息后,单击 **保存** 按钮。添加成功后,在配置页面查看规则列表。 - - ![0|rule2](fig/rule2.png) - -4. 如果添加了多个规则,默认已启用的规则优先显示在前面并按照创建时间降序排列,已停用的规则在后面显示且按照创建规则时间的降序排列。当先后创建的规则有冲突时,以最后创建的启用规则为准。 - -#### 右键菜单 - -对于已添加的规则,根据启用状态可以进行相关操作。 - -单项操作: - -- 已启用的规则:在右键菜单中,只能执行停用操作。 -- 已停用的规则:在右键菜单中,可以执行修改、启用或删除操作。 - -多项操作: - -- 全为已启用的规则:在右键菜单中,只能执行停用操作。 -- 全为已停用的规则:在右键菜单中,可以执行启用或删除操作。 -- 包含已启用和已停用的规则:在右键菜单中,可以执行启用、停用或删除操作。 - -### 垃圾清理 - -操作系统在日常运行中会产生各种垃圾,当垃圾越来越多,会影响系统的运行效率,浪费磁盘资源。建议定期清理垃圾,保障系统运行流畅,提升资源利用率。 - -1. 打开安全中心,选择左侧导航栏的 **垃圾清理**,进入垃圾清理界面。 - -2. 勾选对应的垃圾类型,当前可以选择清理系统垃圾、应用垃圾、痕迹信息和Cookies。 - - ![0|garbage_cleaning](fig/garbage_cleaning.png) - -3. 单击 **立即扫描**,进入扫描界面。 - -4. 扫描完成后,可查看扫描发现的垃圾,并进行相应的处理。 - - 立即清理:清理所有选中的垃圾,您还可以自行取消勾选或者增加勾选。 - - - 返回:不做任何处理,返回到垃圾清理界面。 - -5. 清理完成后单击 **完成** 即可,清理过程中还可以单击 **取消清理。** - -### 安全工具 - -打开安全中心,选择左侧导航栏的 **安全工具**。安全工具包括系统工具和网络工具,单击对应图标则可以使用小工具。 - -![0|security_tool](fig/security_tool.png) - -#### 系统工具 - -**USB安全** - -在USB安全界面,可以查看带存储功能的 USB 设备连接电脑的记录。 - -![0|usb_conneting](fig/usb_conneting.png) - -还可以将常用的USB设备加入白名单,设置只允许白名单设备连接电脑,防止电脑数据泄露。 - -**登录安全** - -在登录安全界面,可以设置密码安全等级,还可以设置密码到期提醒时间,定期更换密码。 - -- 安全等级为 **高** 或 **中** :在控制中心修改密码,或创建新用户设置密码时,若设置的密码不符合级别要求,会保存失败,您可以前往安全中心修改等级或重新设置密码。 -- 安全等级为 **低** :在控制中心修改密码,或创建新用户设置密码的时候,直接保存新设置的密码。 - -![0|login-security](fig/login-security.png) - -**自启动应用** - -开机自启动管理界面仅显示启动器里的应用,包括应用名称、自启动状态和操作按钮。每个应用可选择允许或禁止开机自启动。 - -![0|self_launch_management](fig/self_launch_management.png) - -**系统安全等级** - -系统安全等级配置功能入口默认隐藏,启用后会加强对系统权限的控制。如果需要使用,可以联系统信技术支持获取开启方式。 - -根据使用场景,选择适合系统安全等级配置,默认系统安全等级为低。 - -- **系统安全等级-高**:开启等保三级的安全防护,开启身份鉴别、自主访问控制、标记和强制访问控制、安全审计、数据完整性校验、数据保密性、网络安全、运行安全、资源监控等安全保护。同时开启三权分立,配置系统管理员、系统审计管理员、系统安全管理员帐号密码。 -- **系统安全等级-中**:开启系统基础安全保护,同时开启防火墙网络安全保护、密码安全等级调整为中,保护系统安全。 -- **系统安全等级-低**:适用于可信任的使用环境,提供基础安全防护。 - -(1)系统安全等级由低或中切换为高 - -1. 在系统安全等级界面,勾选“高”。弹出授权框,输入系统登录密码进行认证。 - - ![0|certification](fig/certification.png) - -2. 弹出二次确认窗口,单击 **确定**。配置系统管理员、审计管理员、安全管理员帐号密码,每个管理员分配不同的权限。 - - - 系统管理员(sysadm):创建、删除用户,安装软件,系统相关设置; - - - 审计管理员(audadm):添加审计规则,查看审计日志; - - - 安全管理员(secadm):管理用户安全上下文,查询、设置安全配置; - - ![0|adm](fig/adm.png) - -4. 配置成功后,重启系统生效,普通用户部分权限会受限。在系统登录界面会显示三个管理员帐户,可以进行切换。 - - ![0|login](fig/login.png) - -(2)系统安全等级由高切换为中或低 - -只有在安全管理员帐户下,系统安全等级可以从高切换为中或低。系统管理员和审计管理员帐户都无法切换系统安全等级。 - -1. 如果当前不是安全管理员帐户,在系统登录界面单击切换用户图标 ![userswitch](../common/userswitch.svg),选择secadm用户并登录。 - -2. 进入系统安全等级界面,勾选“中”或“低”。弹出授权框,输入系统登录密码进行认证。 - -3. 二次确认,配置成功后,删除三权帐户、恢复普通用户权限,等级切换立即生效。系统重启后恢复系统安全相关配置。 - -(3)系统安全等级由低切换为中或由中切换为低 - -1. 在系统安全等级界面,由低切换为中或由中切换为低时,需要系统登录密码进行认证。 -2. 二次确认,配置成功后,等级切换立即生效。 - -**可信保护** - -主要对系统关键组件进行完整性校验,可信保护功能默认关闭。 - -当系统安全等级切换为高时,同步开启完整性检查开关;当系统安全等级切换为中或低时,同步关闭完整性检查开关,可以自行关闭或开启。 - -1. 在可信保护界面,默认提供部分受保护的系统文件,不可修改,不可移除,保护策略默认禁止。对于新增的组件文件,则可以进行修改、移除保护,设置保护策略等操作。 - -2. 单击 **添加** 按钮,弹出文件管理器窗口,可以手动添加需保护的组件文件。 - - ![0|trusted_protection](fig/trusted_protection.png) - -3. 新增的组件文件保护策略默认为“警告”,也可以设置为“禁止”。 - - - 警告:当完整性被破坏且被检测到执行时,发出系统通知“xxx组件完整性被破坏,是否允许执行”,您可以选择 **忽略** 或 **禁止**。 - - 禁止:当完整性被破坏且被检测到执行时,发出系统通知“xxx组件完整性被破坏,禁止执行”。 - -4. 如果组件文件被修改了,状态栏从“正常”变为“已篡改”。 - -5. 勾选对应的组件文件,单击 **移除保护**,移除后则不再受保护。 - -#### 网络工具 - -**联网控制** - -在联网控制界面,联网控制功能默认关闭。开启后,可以设置列表中单个应用联网的状态,每个应用或服务下拉框有三种选项。 - -- 询问:应用联网时给出提示“xxx需要连接网络”,您可以选择 **仅允许本次**、**始终允许** 或 **禁止**。 - -- 允许:应用联网时默认允许,不会有提示信息。 - -- 禁止:应用联网时给出提示“防火墙已禁止xxx连接网络”,您可以选择 **前往设置** 或 **确定**。 - -> ![notes](../common/notes.svg) 说明:如果不发起网络连接则不会有提示信息,比如本身就不会联网的应用,即使选择 **询问** 或 **禁止** 也不会在启动时弹出提示。 - - ![0|network_control](fig/network_control.png) - -**流量监控** - -在流量监控界面,流量监控功能默认关闭。开启后,可以对系统里应用上网所使用的流量情况进行监控。 - -- 当前联网:查看列表中应用当前的下行网速、上行网速。单击管控下拉框,可以选择 **询问**、**允许** 或 **禁止** 选项,控制应用是否能联网,详细操作请参考安全工具中的 [联网控制](#网络工具)。 - - ![0|current_network](fig/current_network.png) - -- 流量排名:查看启动器里所有应用的流量排名,包括下行流量、上行流量、总流量、流量时间分布详情。列表右上角支持切换时间跨度:当天、昨天、当月、上月。 - - ![0|traffic_ranking](fig/traffic_ranking.png) - -## 主菜单 - -在主菜单中,可以进行相关参数设置、问题反馈、切换窗口主题,查看帮助手册等操作。 - -### 设置 - -在安全中心界面,单击 ![icon_menu](../common/icon_menu.svg),选择 **设置** 后进行基础设置。 - -#### 基础设置 - -**病毒查杀** - -- 加入“病毒查杀”到文件右键菜单:勾选后,单击文件(夹)右键可直接选择 **病毒查杀**。 -- 不扫描超过此大小的压缩包:勾选后,若压缩包超过设定的大小,则不会进行扫描。 -- 病毒库升级地址:勾选后,可设置病毒库升级地址。 - -**杀毒引擎** - -可以选择瑞星网安或安恒信息杀毒引擎。 - -**关闭主窗口** - -- 选择 **最小化到系统托盘**,关闭主窗口时,应用将隐藏到系统托盘。 -- 选择 **退出**,关闭主窗口时直接退出应用。 -- 选择 **每次询问**,每次关闭主窗口时会弹出确认弹框。 - - -#### 恢复默认 - -单击 **恢复默认** ,恢复默认设置。 - -### 用户反馈 - -1. 在安全中心界面,单击 ![icon_menu](../common/icon_menu.svg)。 -2. 选择 **用户反馈**,跳转到“服务与支持”应用的留言咨询界面,您可以反馈相关问题。 - -### 安全日志 - -1. 在安全中心界面,单击 ![icon_menu](../common/icon_menu.svg)。 - -2. 选择 **安全日志**,可以根据日志类型和日期查看安全中心的操作日志,还可以选择清除日志。 - - ![0|security_log](fig/security_log.png) - -### 主题 - -窗口主题包含浅色主题、深色主题和系统主题。 - -1. 在安全中心界面,单击![icon_menu](../common/icon_menu.svg)。 -2. 选择 **主题**,选择一个主题颜色。 - -### 帮助 - -1. 在安全中心界面,单击 ![icon_menu](../common/icon_menu.svg)。 -2. 选择 **帮助**,查看关于安全中心的帮助手册,进一步了解和使用安全中心。 - - -### 关于 - -1. 在安全中心界面,单击 ![icon_menu](../common/icon_menu.svg)。 -2. 选择 **关于**,查看安全中心的版本和介绍。 - -### 退出 - -1. 在安全中心界面,单击 ![icon_menu](../common/icon_menu.svg)。 -2. 选择 **退出**。 - - \ No newline at end of file diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/adm.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/adm.png deleted file mode 100755 index 2a4e354..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/adm.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/adm.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/adm.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/adm.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/certification.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/certification.png deleted file mode 100755 index 23b0912..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/certification.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/certification.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/certification.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/certification.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/current_network.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/current_network.png deleted file mode 100755 index 9a8866b..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/current_network.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/current_network.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/current_network.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/current_network.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/firewall.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/firewall.png deleted file mode 100755 index 2ea56e3..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/firewall.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/firewall.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/firewall.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/firewall.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/garbage_cleaning.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/garbage_cleaning.png deleted file mode 100755 index 4791473..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/garbage_cleaning.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/garbage_cleaning.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/garbage_cleaning.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/garbage_cleaning.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/login-security.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/login-security.png deleted file mode 100755 index 8da32c4..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/login-security.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/login-security.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/login-security.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/login-security.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/login.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/login.png deleted file mode 100755 index 14640eb..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/login.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/login.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/login.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/login.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/network_control.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/network_control.png deleted file mode 100755 index b7d34f0..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/network_control.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/network_control.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/network_control.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/network_control.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/quarantine_area.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/quarantine_area.png deleted file mode 100755 index 195061f..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/quarantine_area.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/quarantine_area.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/quarantine_area.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/quarantine_area.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/result.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/result.png deleted file mode 100755 index bd05a15..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/result.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/result.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/result.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/result.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/rule1.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/rule1.png deleted file mode 100755 index b1c5dca..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/rule1.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/rule1.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/rule1.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/rule1.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/rule2.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/rule2.png deleted file mode 100755 index aef2ea1..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/rule2.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/rule2.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/rule2.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/rule2.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/security_log.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/security_log.png deleted file mode 100755 index 298ccf4..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/security_log.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/security_log.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/security_log.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/security_log.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/security_tool.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/security_tool.png deleted file mode 100755 index b2e129e..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/security_tool.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/security_tool.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/security_tool.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/security_tool.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/self_launch_management.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/self_launch_management.png deleted file mode 100755 index e7457f3..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/self_launch_management.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/self_launch_management.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/self_launch_management.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/self_launch_management.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/timed_scan.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/timed_scan.png deleted file mode 100755 index 24780f7..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/timed_scan.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/timed_scan.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/timed_scan.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/timed_scan.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/traffic_ranking.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/traffic_ranking.png deleted file mode 100755 index e98b2cc..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/traffic_ranking.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/traffic_ranking.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/traffic_ranking.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/traffic_ranking.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/trust_area.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/trust_area.png deleted file mode 100755 index 32158e0..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/trust_area.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/trust_area.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/trust_area.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/trust_area.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/trusted_protection.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/trusted_protection.png deleted file mode 100755 index 5e34941..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/trusted_protection.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/trusted_protection.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/trusted_protection.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/trusted_protection.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/usb_conneting.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/usb_conneting.png deleted file mode 100755 index ced326e..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/usb_conneting.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/usb_conneting.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/usb_conneting.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/usb_conneting.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/virus_killing_log.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/virus_killing_log.png deleted file mode 100755 index a3eb3e0..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/virus_killing_log.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/virus_killing_log.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/virus_killing_log.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/virus_killing_log.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/virus_result.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/virus_result.png deleted file mode 100755 index 3ac9ed9..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/virus_result.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/virus_result.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/virus_result.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/virus_result.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/virus_scan.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/virus_scan.png deleted file mode 100755 index 5b4adab..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/virus_scan.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/virus_scan.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/virus_scan.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/fig/virus_scan.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/security-center.md b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/security-center.md deleted file mode 100755 index 58aac4c..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_HK/security-center.md +++ /dev/null @@ -1,399 +0,0 @@ - - -# 安全中心|deepin-defender| - -## 概述 - -安全中心是一款提供系統安全檢測、病毒查殺、防火牆、垃圾清理以及安全工具等功能的應用軟件。 - -## 使用入門 - -您可以通過以下方式運行或關閉安全中心,或者創建快捷方式。 - -### 運行安全中心 - -1. 單擊任務欄上的啟動器圖標 ![deepin_launcher](../common/deepin_launcher.svg),進入啟動器界面。 -2. 上下滾動鼠標滾輪瀏覽或通過搜索,找到安全中心圖標 ![deepin_defender](../common/deepin_defender.svg),單擊運行。 -3. 右鍵單擊 ![deepin_defender](../common/deepin_defender.svg),您可以: - - 單擊 **傳送到桌面**,在桌面創建快捷方式。 - - - 單擊 **傳送到任務欄**,將應用程序固定到任務欄。 - - - 單擊 **加至開機啟動**,將應用程序添加到開機啟動項,在電腦開機時自動運行該應用程序。 - -### 關閉安全中心 - -- 右鍵單擊托盤上的安全中心圖標 ![deepin_defender](../common/deepin_defender.svg) ,選擇 **退出** 來退出安全中心。 - -- 在安全中心界面單擊 ![icon_menu](../common/icon_menu.svg),選擇 **退出** 來退出安全中心。 - -## 操作介绍 - -### 系統體檢 - -1. 打開安全中心,選擇左側導航欄的 **系統體檢**,單擊 **立即體檢** 后進行系統體檢。 - -2. 體檢完後,若有異常則可以對每個問題項單獨操作,還可以單擊 **一鍵修復** 快速修復多項問題。 - - ![0|result](fig/result.png) - -3. 處理完成後,單擊 **完成** 返回到系統體檢首頁。 - -### 病毒查殺 -#### 病毒掃描 - -安全中心支持三種病毒掃描方式,分別為全盤掃描、快速掃描和自定義掃描。 - -1. 打開安全中心,選擇左側導航欄的 **病毒查殺**。在病毒查殺界面,選擇病毒掃描方式,掃描完成後會顯示掃描結果。 - - ![0|virus_scan](fig/virus_scan.png) - -2. 根據掃描結果,可以對每個風險項單獨操作,也可以選擇批量操作。 - - **單項操作**: - - - 修復:單擊修復按鈕 ![repair](../common/repair.svg) 後,風險項被修復,下次掃描不會被判定為異常。 - - - 隔離:單擊隔離按鈕 ![isolation](../common/isolation.svg) 後,風險項被隔離,隔離後不會影響其他文件,下次掃描不會被判定為異常,可在隔離區查看。 - - - 信任:單擊信任按鈕 ![trust](../common/trust.svg) 後,風險項被信任,下次掃描不會被判定為異常,可在信任區查看。 - - **批量操作**: - - 勾選需要處理的風險項後,在頁面底部的下拉框中選擇 **立即修復**、**立即隔離** 或 **添加信任** 選項後,單擊 **執行**,則可以批量處理風險項。 - - ![0|virus_result](fig/virus_result.png) - -#### 定時掃描 - -針對快速掃描和全盤掃描,還可以設置定時掃描。定時掃描功能默認關閉,開啟後,可以根據設置的內容執行病毒掃描任務。 - -- 掃描類型:支持選擇快速掃描或全盤掃描。 -- 掃描時間:選擇或自定義掃描時間。 -- 發現病毒處理方式: - - 詢問:發現病毒後彈出處理提示,可以選擇 **忽略** 不處理,還可以選擇 **立即處理**。若不做任何處理,則默認取消不處理。 - - 自動處理:掃描完成後自動處理異常病毒。 - -![0|timed_scan](fig/timed_scan.png) - -#### USB掃描 - -對於USB存儲設備,可以設置是否自動掃描及發現病毒處理方式。 - -- 詢問:發現病毒後,可以選擇 **立即處理** 將病毒隔離或選擇 **取消** 退出掃描。 -- 自動處理:掃描完成後自動處理異常病毒。 - -#### 隔離區 - -在病毒查殺界面,單擊 **隔離區**,可查看隔離文件列表,還可以選擇將文件移出隔離。 - -![0|quarantine_area](fig/quarantine_area.png) - -#### 信任區 - -在病毒查殺界面,單擊 **信任區**,可查看信任文件列表,還可以選擇將文件移出信任。 - -![0|trust_area](fig/trust_area.png) - -#### 白名單 - -在病毒查殺界面,單擊 **白名單**,將文件加入白名單後,病毒掃描時則會被跳過。若文件發生變化,將導致信任失效,並自動從白名單目錄中移除。 - -#### 查殺日誌 - -在病毒查殺界面,單擊 **查殺日誌**,可查看每次病毒掃描的時間、掃描類型及結果。單擊詳情按鈕 ![icon_details](../common/icon_details.svg),可查看日誌詳情,還可以選擇刪除日誌。 - -![0|virus_killing_log](fig/virus_killing_log.png) - -#### 病毒庫更新 - -每天都有新病毒產生,所以要定期更新病毒庫,以滿足計算機的安全需求,當前支持病毒庫在線更新和離線更新。 - -**在線更新** - -當檢測到新的病毒庫時,在病毒查殺界面,單擊 **更新** 進行病毒庫更新。如果沒有檢測到新的病毒庫,可以單擊 **檢查更新** 進行檢查。 - -**離線更新** - -如果因為斷網等情況無法在線更新病毒庫,則可以選擇離線更新。 - -1. 在安全中心界面,單擊 ![icon_menu](../common/icon_menu.svg)。 -2. 選擇 **病毒庫離線更新**,彈出文件管理器,導入對應的.zip格式病毒庫文件。如果當前使用的殺毒引擎是瑞星網安,則必須導入瑞星網安病毒庫文件。 -3. 導入成功後,病毒查殺界面右下角的病毒庫版本更新為導入後的版本號。 - -### 防火牆 - -打開安全中心,選擇左側導航欄的 **防火牆**。在防火牆界面,開啟或關閉防火牆需要輸入系統登錄密碼進行認證。 - -防火牆開關默認關閉,網絡防護策略無法生效。開啟後默認選中專用網絡策略,也可以切換為公共網絡策略或自定義網絡防護規則。 - -> ![notes](../common/notes.svg) 說明:當系統安全等級切換為高或中時,防火牆開關則會開啟。 - -- 公共網絡防護:主要為車站、商場、咖啡廳等公共網絡信號,執行公網場景下的默認策略。 - -- 專用網絡防護:主要為辦公、家庭網絡場景,執行專網場景下的默認策略。 - -- 自定義網絡防護規則:選擇此項後,您可以自行配置高級防火牆規則。 - -![0|firewall](fig/firewall.png) - -#### 自定義規則 - -1. 在防火牆界面,勾選「自定義」,單擊更多圖標 >,進入配置界面。 - -2. 單擊 **添加** 按鈕,填寫或勾選防火牆規則訊息,包括規則名稱、程序服務、策略、方向。協議等。 - - - 規則名稱:規則名稱不可重複,可以使用默認名稱或自定義名稱。 - - - 程序服務:默認選擇全部服務,也可以在下拉框中勾選或在輸入框模糊搜索對應的服務。 - - - 策略:默認選擇允許,表示允許數據包傳輸。選擇拒絕,表示不允許數據包傳輸。 - - - 方向:默認選擇出入站,出站表示本地主機訪問外部數據,入站表示外部數據進入本地主機。 - - - 協議:系統支持的通信協議,默認選擇TCP,也可以在下拉框中勾選或在輸入框模糊搜索對應的協議。 - - - 本地端口/IP:非必填項,表示本地主機的端口號和IP,填寫規則可以參考示例。 - - - 遠程端口/IP:非必填項,表示遠程主機的端口號和IP,填寫規則可以參考示例。 - - - 狀態:默認不勾選,表示該規則已停用。勾選後,啟用該規則。 - - ![0|rule1](fig/rule1.png) - -3. 完成所有的訊息後,單擊 **保存** 按鈕。添加成功後,在配置頁面查看規則列表。 - - ![0|rule2](fig/rule2.png) - -4. 如果添加了多個規則,默認已啟用的規則優先顯示在前面並按照創建時間降序排列,已停用的規則在後面顯示且按照創建規則時間的降序排列。當先後創建的規則有衝突時,以最後創建的啟用規則為準。 - -#### 右鍵菜單 - -對於已添加的規則,根據啟用狀態可以進行相關操作。 - -單項操作: - -- 已啟用的規則:在右鍵菜單中,只能執行停用操作。 -- 已停用的規則:在右鍵菜單中,可以執行修改、啟用或刪除操作。 - -多項操作: - -- 全為已啟用的規則:在右鍵菜單中,只能執行停用操作。 -- 全為已停用的規則:在右鍵菜單中,可以執行啟用或刪除操作。 -- 包含已啟用和已停用的規則:在右鍵菜單中,可以執行啟用、停用或刪除操作。 - -### 垃圾清理 - -操作系統在日常運行中會產生各種垃圾,當垃圾越來越多,會影響系統的運行效率,浪費磁盤資源。建議定期清理垃圾,保障系統運行流暢,提升資源利用率。 - -1. 打開安全中心,選擇左側導航欄的 **垃圾清理**,進入垃圾清理界面。 - -2. 勾選對應的垃圾類型,當前可以選擇清理系統垃圾、應用垃圾、痕跡訊息和Cookies。 - - ![0|garbage_cleaning](fig/garbage_cleaning.png) - -3. 單擊 **立即掃描**,進入掃描界面。 - -4. 掃描完成後,可查看掃描發現的垃圾,並進行相應的處理。 - - 立即清理:清理所有選中的垃圾,您還可以自行取消勾選或者增加勾選。 - - - 返回:不做任何處理,返回到垃圾清理界面。 - -5. 清理完成後單擊 **完成** 即可,清理過程中還可以單擊 **取消清理**。 - -### 安全工具 - -打開安全中心,選擇左側導航欄的 **安全工具**。安全工具包括系統工具和網絡工具,單擊對應圖標則可以使用小工具。 - -![0|security_tool](fig/security_tool.png) - -#### 系統工具 - -**USB安全** - -在USB安全界面,可以查看帶存儲功能的 USB 設備連接電腦的紀錄。 - -![0|usb_conneting](fig/usb_conneting.png) - -還可以將常用的USB設備加入白名單,設置只允許白名單設備連接電腦,防止電腦數據洩露。 - -**登錄安全** - -在登錄安全界面,可以設置密碼安全等級,還可以設置密碼到期提醒時間,定期更換密碼。 - -- 安全等級為 **高** 或 **中** :在控制中心修改密碼,或創建新用戶設置密碼時,若設置的密碼不符合級別要求,會保存失敗,您可以前往安全中心修改等級或重新設置密碼。 - -- 安全等級為 **低** :在控制中心修改密碼,或創建新用戶設置密碼的時候,直接保存新設置的密碼。 - -![0|login-security](fig/login-security.png) - -**自啟動應用** - -開機自啟動管理界面僅顯示啟動器裏的應用,包括應用名稱、自啟動狀態和操作按鈕。每個應用可選擇允許或禁止開機自啟動。 - -![0|self_launch_management](fig/self_launch_management.png) - -**系統安全等級** - -系統安全等級配置功能入口默認隱藏,啟用後會加強對系統權限的控制。如果需要使用,可以聯系統信技術支持獲取開啟方式。 - -根據使用場景,選擇適合系統安全等級配置,默認系統安全等級為低。 - -- **系統安全等級-高**:開啟等保三級的安全防護,開啟身份鑑別、自主訪問控制、標記和強制訪問控制、安全審計、數據完整性校驗、數據保密性、網絡安全、運行安全、資源監控等安全保護。同時開啟三權分立,配置系統管理員、系統審計管理員、系統安全管理員帳號密碼。 -- **系統安全等級-中**:開啟系統基礎安全保護,同時開啟防火牆網絡安全保護、密碼安全等級調整為中,保護系統安全。 -- **系統安全等級-低**:適用於可信任的使用環境,提供基礎安全防護。 - -(1)系統安全等級由低或中切換為高 - -1. 在系統安全等級界面,勾選「高」。彈出授權框,輸入系統登錄密碼進行認證。 - - ![0|certification](fig/certification.png) - -2. 彈出二次確認窗口,單擊 **確定**。配置系統管理員、審計管理員、安全管理員帳號密碼,每個管理員分配不同的權限。 - - - 系統管理員(sysadm):創建、刪除用戶,安裝軟件,系統相關設置; - - - 審計管理員(audadm):添加審計規則,查看審計日誌; - - - 安全管理員(secadm):管理用戶安全上下文,查詢、設置安全配置; - - ![0|adm](fig/adm.png) - -3. 配置成功後,重啟系統生效,普通用戶部分權限會受限。在系統登錄界面會顯示三個管理員帳戶,可以進行切換。 - - ![0|login](fig/login.png) - -(2)系統安全等級由高切換為中或低 - -只有在安全管理員帳戶下,系統安全等級可以從高切換為中或低。系統管理員和審計管理員帳戶都無法切換系統安全等級。 - -1. 如果當前不是安全管理員帳戶,在系統登錄界面單擊切換用戶圖標 ![userswitch](../common/userswitch.svg),選擇secadm用戶並登錄。 - -2. 進入系統安全等級界面,勾選「中」或「低」。彈出授權框,輸入系統登錄密碼進行認證。 - -3. 二次確認,配置成功後,刪除三權帳戶、恢復普通用戶權限,等級切換立即生效。系統重啟後恢復系統安全相關配置。 - -(3)系統安全等級由低切換為中或由中切換為低 - -1. 在系統安全等級界面,由低切換為中或由中切換為低時,需要系統登錄密碼進行認證。 -2. 二次確認,配置成功後,等級切換立即生效。 - -**可信保護** - -主要對系統關鍵組件進行完整性校驗,可信保護功能默認關閉。 - -當系統安全等級切換為高時,同步開啟完整性檢查開關;當系統安全等級切換為中或低時,同步關閉完整性檢查開關,可以自行關閉或開啟。 - -1. 在可信保護界面,默認提供部分受保護的系統文件,不可修改,不可移除,保護策略默認禁止。對於新增的組件文件,則可以進行修改、移除保護,設置保護策略等操作。 - -2. 單擊 **添加** 按鈕,彈出文件管理器窗口,可以手動添加需保護的組件文件。 - - ![0|trusted_protection](fig/trusted_protection.png) - -3. 新增的組件文件保護策略默認為「警告」,也可以設置為「禁止」。 - - - 警告:當完整性被破壞且被檢測到執行時,發出系統通知「xxx組件完整性被破壞,是否允許執行」,您可以選擇 **忽略** 或 **禁止**。 - - 禁止:當完整性被破壞且被檢測到執行時,發出系統通知「xxx組件完整性被破壞,禁止執行」。 - -4. 如果組件文件被修改了,狀態欄從「正常」變為「已篡改」。 - -5. 勾選對應的組件文件,單擊 **移除保護**,移除後則不再受保護。 - -#### 網絡工具 - -**聯網控制** - -在聯網控制界面,聯網控制功能默認關閉。開啟後,可以設置列表中單個應用聯網的狀態,每個應用或服務下拉框有三種選項。 - -- 詢問:應用聯網時給出提示「xxx需要連接網路」,您可以選擇 **僅允許本次**、**始終允許** 或 **禁止**。 - -- 允許:應用聯網時默認允許,不會有提示訊息。 - -- 禁止:應用聯網時給出提示 「 防火牆已禁止xxx連接網路」,您可以選擇 **前往設置** 或 **確定**。 - -> ![notes](../common/notes.svg) 說明:如果不發起網絡連接則不會有提示訊息,比如本身就不會聯網的應用,即使選擇 **詢問** 或 **禁止** 也不會在啟動時彈出提示。 - - ![0|network_control](fig/network_control.png) - -**流量監控** - -在流量監控界面,流量監控功能默認關閉。開啟後,可以對系統裏應用上網所使用的流量情況進行監控。 - -- 當前聯網:查看所有啟動中的應用,並展示每個應用當前的下行網速、上行網速。單擊管控下拉框,可以選擇 **詢問**、**允許** 或 **禁止** 選項,控制應用是否能聯網,詳細操作請參考安全工具中 [聯網控制](#網絡工具)。 - - ![0|current_network](fig/current_network.png) - -- 流量排名:查看啟動器裏所有應用的流量排名,包括下行流量、上行流量、總流量、流量時間分佈詳情。列表右上角支持切換時間跨度:當天、昨天、當月、上月。 - - ![0|traffic_ranking](fig/traffic_ranking.png) - -## 主菜單 - -在主菜單中,您可以進行相關參數設置、問題反饋、切換窗口主題,查看幫助手冊等操作。 - -### 設置 - -在安全中心界面,單擊 ![icon_menu](../common/icon_menu.svg),選擇 **設置** 後進行基礎設置。 - -#### 基礎設置 - -**病毒查殺** - -- 加入 “病毒查殺” 到文件右鍵菜單:勾選後,單擊文件(夾)右鍵可直接選擇 **病毒查殺**。 -- 不掃描超過此大小的壓縮包:勾選後,若壓縮包超過設定的大小,則不會進行掃描。 -- 病毒庫升級地址:勾選後,可設置病毒庫升級地址。 - -**殺毒引擎** - -可以選擇瑞星網安或安恆訊息殺毒引擎。 - -**關閉主窗口** - -- 選擇 **最小化到系統托盤**,關閉主窗口時,應用將隱藏到系統托盤。 -- 選擇 **退出**,關閉主窗口時直接退出應用。 -- 選擇 **每次詢問**,每次關閉主窗口時會彈出確認彈框。 - -#### 恢復默認 - -單擊 **恢復默認** ,恢復默認設置。 - -### 用戶反饋 - -1. 在安全中心界面,單擊 ![icon_menu](../common/icon_menu.svg)。 -2. 選擇 **用戶反饋**,跳轉到「服務與支持」應用的留言諮詢界面,您可以反饋相關問題。 - -### 安全日誌 - -1. 在安全中心界面,單擊 ![icon_menu](../common/icon_menu.svg)。 - -2. 選擇 **安全日誌**,可以根據日誌類型和日期查看安全中心的操作日誌,還可以選擇清除日誌。 - - ![0|security_log](fig/security_log.png) - -### 主題 - -窗口主題包含淺色主題、深色主題和跟隨系統主題。 - -1. 在安全中心界面,單擊 ![icon_menu](../common/icon_menu.svg)。 -2. 選擇 **主題**,選擇一個主題顏色。 - -### 幫助 - -1. 在安全中心界面,單擊 ![icon_menu](../common/icon_menu.svg)。 -2. 選擇 **幫助**,查看幫助手冊,進一步了解和使用安全中心。 - -### 關於 - -1. 在安全中心界面,單擊 ![icon_menu](../common/icon_menu.svg)。 -2. 選擇 **關於**,查看安全中心的版本和介紹。 - -### 退出 - -1. 在安全中心界面,單擊 ![icon_menu](../common/icon_menu.svg)。 -2. 選擇 **退出**。 - - \ No newline at end of file diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/adm.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/adm.png deleted file mode 100644 index f90e4c7..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/adm.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/adm.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/adm.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/adm.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/certification.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/certification.png deleted file mode 100644 index 23b0912..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/certification.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/certification.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/certification.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/certification.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/choice.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/choice.png deleted file mode 100644 index fb04f0b..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/choice.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/choice.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/choice.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/choice.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/cleanup.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/cleanup.png deleted file mode 100644 index 6a33773..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/cleanup.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/cleanup.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/cleanup.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/cleanup.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/datausage.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/datausage.png deleted file mode 100644 index e594714..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/datausage.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/datausage.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/datausage.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/datausage.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_internetcontrol.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_internetcontrol.png deleted file mode 100644 index 571017a..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_internetcontrol.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_internetcontrol.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_internetcontrol.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_internetcontrol.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_password.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_password.png deleted file mode 100644 index b2d3cc7..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_password.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_password.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_password.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_password.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_result.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_result.png deleted file mode 100644 index 5c761e2..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_result.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_result.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_result.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_result.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_security.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_security.png deleted file mode 100644 index f0dc0b1..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_security.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_security.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_security.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_security.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_security_tool.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_security_tool.png deleted file mode 100644 index 038fdf7..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_security_tool.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_security_tool.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_security_tool.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_security_tool.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_startup.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_startup.png deleted file mode 100644 index 8fa27c4..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_startup.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_startup.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_startup.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/e_startup.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/firewall.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/firewall.png deleted file mode 100644 index f3ef293..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/firewall.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/firewall.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/firewall.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/firewall.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/homepage.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/homepage.png deleted file mode 100644 index 276b683..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/homepage.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/homepage.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/homepage.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/homepage.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/internetcontrol.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/internetcontrol.png deleted file mode 100644 index b8f41fa..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/internetcontrol.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/internetcontrol.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/internetcontrol.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/internetcontrol.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/log.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/log.png deleted file mode 100644 index daa6976..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/log.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/log.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/log.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/log.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/login.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/login.png deleted file mode 100644 index 5c3aec7..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/login.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/login.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/login.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/login.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/login_safety.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/login_safety.png deleted file mode 100644 index a071313..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/login_safety.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/login_safety.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/login_safety.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/login_safety.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/networkcontrol.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/networkcontrol.png deleted file mode 100644 index a3e9e7b..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/networkcontrol.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/networkcontrol.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/networkcontrol.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/networkcontrol.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/protection.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/protection.png deleted file mode 100644 index 4de14cb..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/protection.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/protection.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/protection.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/protection.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/quarantinearea.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/quarantinearea.png deleted file mode 100644 index 927bc30..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/quarantinearea.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/quarantinearea.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/quarantinearea.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/quarantinearea.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/rankings.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/rankings.png deleted file mode 100644 index eb15334..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/rankings.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/rankings.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/rankings.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/rankings.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/result.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/result.png deleted file mode 100644 index 28cc4e4..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/result.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/result.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/result.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/result.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/rule1.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/rule1.png deleted file mode 100644 index fd61317..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/rule1.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/rule1.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/rule1.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/rule1.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/rule2.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/rule2.png deleted file mode 100644 index 4a7a928..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/rule2.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/rule2.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/rule2.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/rule2.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/security_logs.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/security_logs.png deleted file mode 100644 index 7772361..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/security_logs.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/security_logs.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/security_logs.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/security_logs.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/security_tool.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/security_tool.png deleted file mode 100644 index a0e100d..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/security_tool.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/security_tool.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/security_tool.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/security_tool.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/startup.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/startup.png deleted file mode 100644 index dc30dd9..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/startup.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/startup.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/startup.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/startup.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/timed_scan.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/timed_scan.png deleted file mode 100644 index 20da3bf..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/timed_scan.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/timed_scan.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/timed_scan.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/timed_scan.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/trustarea.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/trustarea.png deleted file mode 100644 index 5b0c72f..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/trustarea.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/trustarea.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/trustarea.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/trustarea.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/trusted_protection.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/trusted_protection.png deleted file mode 100644 index 35793fc..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/trusted_protection.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/trusted_protection.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/trusted_protection.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/trusted_protection.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/usbconnection.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/usbconnection.png deleted file mode 100644 index 1982019..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/usbconnection.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/usbconnection.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/usbconnection.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/usbconnection.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/usbwhitelist.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/usbwhitelist.png deleted file mode 100644 index 0e4f71d..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/usbwhitelist.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/usbwhitelist.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/usbwhitelist.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/usbwhitelist.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/virus_scan.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/virus_scan.png deleted file mode 100644 index bee3a30..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/virus_scan.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/virus_scan.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/virus_scan.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/virus_scan.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/virusresult.png b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/virusresult.png deleted file mode 100644 index a1f52a5..0000000 Binary files a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/virusresult.png and /dev/null differ diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/virusresult.png.license b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/virusresult.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/fig/virusresult.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/security-center.md b/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/security-center.md deleted file mode 100644 index 5c54933..0000000 --- a/deepin-pc-manager/assets/deepin-pc-manager/security-center/zh_TW/security-center.md +++ /dev/null @@ -1,411 +0,0 @@ - - -# 安全中心|deepin-defender| - -## 概述 - -安全中心是一款提供系統安全檢測、病毒查殺、防火牆、垃圾清理以及安全工具等功能的應用工具。 - - - -## 使用入門 - -您可以透過以下方式執行或關閉安全中心,或者建立捷徑。 - -### 執行安全中心 - -1. 單擊任務欄上的啟動器 ![deepin-launcher](../common/deepin_launcher.svg),進入啟動器介面。 -2. 上下滾動滑鼠滾輪瀏覽或透過搜尋,找到「安全中心」按鈕 ![deepin_defender](../common/deepin_defender.svg),單擊開啟。 -3. 右鍵單擊 ![deepin_defender](../common/deepin_defender.svg),您可以: - - 單擊 **建立桌面捷徑**,在桌面建立捷徑。 - - 單擊 **釘選到Dock**,將應用程式固定到Dock。 - - 單擊 **開機啟動**,將應用程式添加到開機啟動項,在電腦開機時自動執行該應用程式。 - -### 關閉安全中心 - -- 右鍵單擊工具列上的 ![deepin_defender](../common/deepin_defender.svg) 圖示,選擇 **退出** 來關閉安全中心。 -- 在安全中心介面單擊 ![icon_menu](../common/icon_menu.svg),選擇 **退出** 來關閉安全中心。 - -## 操作介紹 - -### 系統體檢 - -1. 打開安全中心,選擇左側導航欄的 **系統體檢**,在首頁可以單擊 **立即體檢**,進行系統體檢。 - -2. 體檢完後,若有異常則可以對每個問題項單獨操作,還可以單擊 **一鍵修復** 快速修復多項問題。 - -![0|result](fig/result.png) - -3. 處理完成後,單擊 **完成** 返回到系統體檢首頁。 - -### 病毒查殺 - -#### 病毒掃描 - -安全中心支援三種病毒掃描方式,分別為全盤掃描、快速掃描和自訂掃描。 - -1. 打開安全中心,選擇左側導航欄的 **病毒查殺**。在病毒查殺介面,選擇病毒掃描方式,掃描完成後會顯示掃描結果。 - - ![0|virus-scan](fig/virus_scan.png) - -2. 根據掃描結果,可以對每個風險項單獨操作,也可以選擇批量操作。有以下幾個操作項: - - **單項操作**: - - - 修復:單擊修復按鈕 ![repair](../common/repair.svg) 後,風險項被修復,下次掃描不會被判定為異常。 - - - 隔離:單擊隔離按鈕 ![isolation](../common/isolation.svg) 後,風險項被隔離,隔離後不會影響其他文件,下次掃描不會被判定為異常,可在隔離區查看。 - - - 信任:單擊信任按鈕 ![trust](../common/trust.svg) 後,風險項被信任,下次掃描不會被判定為異常,可在信任區查看。 - - **批次操作**: - - 勾選需要處理的風險項後,在頁面底部的下拉框中選擇 **立即修復**、**立即隔離** 或 **添加信任** 選項後,單擊 **執行**,則可以批次處理風險項。 - - ![0|virus-result](fig/virusresult.png) - - - -#### 定時掃描 - -針對快速掃描和全盤掃描,還可以設定定時掃描。定時掃描功能預設關閉,開啟後,可以根據設置的內容執行病毒掃描任務。 - -- 掃描類型:支援選擇快速掃描或全盤掃描。 -- 掃描時間:選擇或自訂掃描時間。 -- 發現病毒處理方式: - - 詢問:發現病毒後彈出處理提示,可以選擇 **忽略**,不進行處理,還可以選擇 **立即處理**。若不做任何處理,則預設不處理。 - - 自動處理:掃描完成後自動處理異常病毒。 - -![0|timed_scan](fig/timed_scan.png) - -#### USB掃描 - -對於USB儲存裝置,可以設定是否自動掃描及發現病毒處理方式。 - -- 詢問:發現病毒後,可以選擇 **立即處理** 將病毒隔離或選擇 **取消** 退出掃描。 -- 自動處理:掃描完成後自動處理異常病毒。 - - - -#### 隔離區 - -在病毒查殺界面,單擊 **隔離區**,可查看隔離文件列表,還可以選擇將文件移出隔離。 - -![0|quarantine-area](fig/quarantinearea.png) - -#### 信任區 - -在病毒查殺界面,單擊 **信任區**,可查看信任文件列表,還可以選擇將文件移出信任。 - -![0|trust-area](fig/trustarea.png) - - - -#### 白名單 - -在病毒查殺介面,單擊 **白名單**,將文件加入白名單後,病毒掃描時則會被跳過。若文件發生變化,將導致信任失效,並自動從白名單目錄中移除。 - -#### 查殺日誌 - -在病毒查殺界面,單擊 **查殺日誌**,可查看每次病毒掃描的時間、掃描類型及結果。單擊詳情按鈕 ![icon-details](../common/icon_details.svg),可查看日誌詳情,還可以選擇刪除日誌。 - -![0|log](fig/log.png) - -#### 病毒庫更新 - -每天都有新病毒產生,所以要定期更新病毒庫,以滿足電腦的安全需求,目前支援病毒庫線上更新和離線更新。 - -**線上更新** - -當檢測到新的病毒庫時,在病毒查殺介面,單擊 **更新** 進行病毒庫更新。如果沒有檢測到新的病毒庫,可以單擊 **檢查更新** 進行檢查。 - -**離線更新** - -如果因為斷網等情況無法線上更新病毒庫,則可以選擇離線更新。 - -1. 在安全中心介面,單擊 ![icon_menu](../common/icon_menu.svg)。 -2. 選擇 **病毒庫離線更新**,彈出檔案管理器,匯入對應的.zip格式病毒庫文件。如果目前使用的殺毒引擎是瑞星網安,則必須匯入瑞星網安病毒庫文件。 -3. 匯入成功後,病毒查殺介面右下角的病毒庫版本更新為匯入後的版本號。 - -### 防火牆 - -打開安全中心,選擇左側導航欄的 **防火牆**。在防火牆介面,開啟或關閉防火牆需要輸入系統登入密碼進行認證。 - -防火牆開關預設關閉,網路防護策略無法生效。開啟後預設選中專用網路策略,也可以切換為公共網路策略或自訂網路防護規則。 - -> ![notes](../common/notes.svg) 說明:當系統安全等級切換為高或中時,防火牆開關則會開啟。 - -- 公共網路防護:主要為車站、商場、咖啡廳等公共網路訊號,執行公網場景下的預設策略。 - -- 專用網路防護:主要為辦公、家庭網路場景,執行專網場景下的預設策略。 - -- 自訂網路防護規則:選擇此項後,您可以自行配置進階防火牆規則。 - -![0|firewall](fig/firewall.png) - -#### 自訂規則 - -1. 在防火牆介面,勾選 **自訂**,單擊更多圖示 >,進入配置介面。 - -2. 單擊 **添加** 按鈕,填寫或勾選防火牆規則訊息,包括規則名稱、程式服務、策略、方向。協議等。 - - - 規則名稱:規則名稱不可重複,可以使用預設名稱或自訂名稱。 - - - 程式服務:預設選擇全部服務,也可以在下拉框中勾選或在輸入框模糊搜尋對應的服務。 - - - 策略:預設選擇允許,表示允許封包傳輸。選擇拒絕,表示不允許封包傳輸。 - - - 方向:預設選擇出入站,出站表示本機主機訪問外部資料,入站表示外部資料進入本機主機。 - - - 協議:系統支援的通信協議,預設選擇TCP,也可以在下拉框中勾選或在輸入框模糊搜尋對應的協議。 - - - 本機埠/IP:非必填項,表示本機主機的埠號和IP,填寫規則可以參考範例。 - - - 遠端埠/IP:非必填項,表示遠端主機的埠號和IP,填寫規則可以參考範例。 - - - 狀態:預設不勾選,表示該規則已停用。勾選後,啟用該規則。 - - ![0|rule1](fig/rule1.png) - -3. 完成所有的訊息後,單擊 **保存** 按鈕。添加成功後,在配置頁面查看規則列表。 - - ![0|rule2](fig/rule2.png) - -4. 如果添加了多個規則,預設已啟用的規則優先顯示在前面並按照建立時間降序排列,已停用的規則在後面顯示且按照建立規則時間的降序排列。當先後建立的規則有衝突時,以最後建立的啟用規則為準。 - -#### 右鍵選單 - -對於已添加的規則,根據啟用狀態可以進行相關操作。 - -單項操作: - -- 已啟用的規則:在右鍵選單中,只能執行停用操作。 -- 已停用的規則:在右鍵選單中,可以執行修改、啟用或刪除操作。 - -多項操作: - -- 全為已啟用的規則:在右鍵選單中,只能執行停用操作。 -- 全為已停用的規則:在右鍵選單中,可以執行啟用或刪除操作。 -- 包含已啟用和已停用的規則:在右鍵選單中,可以執行啟用、停用或刪除操作。 - -### 垃圾清理 - -作業系統在日常執行中會產生各種垃圾,當垃圾越來越多,會影響系統的執行效率,浪費磁碟資源。建議定期清理垃圾,保障系統執行流暢,提升資源利用率。 - -1. 打開安全中心,選擇左側導航欄的 **垃圾清理**,進入垃圾清理介面。 -2. 勾選對應的垃圾類型,目前可以選擇清理系統垃圾、應用垃圾、痕跡訊息和Cookies。 - -![0|garbage_cleaning](fig/cleanup.png) - -3. 單擊 **立即掃描**,進入掃描介面。 -4. 掃描完成後,可查看掃描發現的垃圾,並進行相應的處理。 - - - 立即清理:清理所有選中的垃圾,您還可以自行取消勾選或者增加勾選。 - - 返回:不做任何處理,返回到垃圾清理介面。 - -5. 清理完成後單擊 **完成** 即可,清理過程中還可以單擊 **取消清理**。 - - -### 安全工具 - -打開安全中心,選擇左側導航欄的 **安全工具**。安全工具包括系統工具和網路工具,單擊對應圖示則可以使用小工具。 - -![0|security_tool](fig/security_tool.png) - -#### 系統工具 - -**USB安全** - -在USB安全介面,可以查看帶儲存功能的 USB 裝置連接電腦的紀錄。 - -![0|usb_conneting](fig/usbconnection.png) - -還可以將常用的USB裝置加入白名單,設定只允許白名單裝置連接電腦,防止電腦資料洩露。 - - - -**登入安全** - -在登入安全介面,可以設定密碼安全等級,還可以設定密碼到期提醒時間,定期更換密碼。 - -- 安全等級為 **高** 或 **中** :在控制中心修改密碼,或建立新使用者設定密碼時,若設定的密碼不符合級別要求,會儲存失敗,您可以前往安全中心修改等級或重新設定密碼。 -- 安全等級為 **低** :在控制中心修改密碼,或建立新使用者設定密碼的時候,直接儲存新設定的密碼。 - -![0|login-security](fig/login_safety.png) - -**自啟動應用** - -開機自啟動管理介面僅顯示啟動器裡的應用,包括應用名稱、自啟動狀態和操作按鈕。每個應用可選擇允許或禁止開機自啟動。 - -![0|self_launch_management](fig/startup.png) - -**系統安全等級** - -系統安全等級配置功能入口預設隱藏,啟用後會加強對系統權限的控制。如果需要使用,可以聯系統信技術支援獲取開啟方式。 - -根據使用場景,選擇適合系統安全等級配置,預設系統安全等級為低。 - -- **系統安全等級-高**:開啟等保三級的安全防護,開啟身份鑑別、自主訪問控制、標記和強制訪問控制、安全審計、資料完整性校驗、資料保密性、網路安全、執行安全、資源監控等安全保護。同時開啟三權分立,配置系統管理員、系統審計管理員、系統安全管理員帳號密碼。 -- **系統安全等級-中**:開啟系統基礎安全保護,同時開啟防火牆網路安全保護、密碼安全等級調整為中,保護系統安全。 -- **系統安全等級-低**:適用於可信任的使用環境,提供基礎安全防護。 - -(1)系統安全等級由低或中切換為高 - -1. 在系統安全等級介面,勾選 **高**。彈出授權框,輸入系統登入密碼進行認證。 - - ![0|certification](fig/certification.png) - -2. 彈出二次確認視窗,單擊 **確定**。配置系統管理員、審計管理員、安全管理員帳號密碼,每個管理員分配不同的權限。 - - - 系統管理員(sysadm):建立、刪除使用者,安裝軟體,系統相關設定; - - - 審計管理員(audadm):添加審計規則,查看審計日誌; - - - 安全管理員(secadm):管理使用者安全上下文,查詢、設定安全配置; - - ![0|adm](fig/adm.png) - -4. 配置成功後,重啟系統生效,普通使用者部分權限會受限。在系統登入介面會顯示三個管理員帳戶,可以進行切換。 - - ![0|login](fig/login.png) - -(2)系統安全等級由高切換為中或低 - -只有在安全管理員帳戶下,系統安全等級可以從高切換為中或低。系統管理員和審計管理員帳戶都無法切換系統安全等級。 - -1. 如果目前不是安全管理員帳戶,在系統登入介面單擊切換使用者圖示![userswitch](../common/userswitch.svg),選擇secadm使用者並登入。 - -2. 進入系統安全等級介面,勾選 **中** 或 **低**。彈出授權框,輸入系統登入密碼進行認證。 - -3. 二次確認,配置成功後,刪除三權帳戶、復原普通使用者權限,等級切換立即生效。系統重啟後復原系統安全相關配置。 - -(3)系統安全等級由低切換為中或由中切換為低 - -1. 在系統安全等級介面,由低切換為中或由中切換為低時,需要系統登入密碼進行認證。 -2. 二次確認,配置成功後,等級切換立即生效。 - -**可信保護** - -主要對系統關鍵元件進行完整性校驗,可信保護功能預設關閉。 - -當系統安全等級切換為高時,同步開啟完整性檢查開關;當系統安全等級切換為中或低時,同步關閉完整性檢查開關,可以自行關閉或開啟。 - -1. 在可信保護介面,預設提供部分受保護的系統檔案,不可修改,不可移除,保護策略預設禁止。對於新增的元件文件,則可以進行修改、移除保護,設定保護策略等操作。 - -2. 單擊 **添加** 按鈕,彈出檔案管理器視窗,可以手動添加需保護的元件文件。 - - ![0|trusted_protection](fig/trusted_protection.png) - -3. 新增的元件文件保護策略預設為「警告」,也可以設定為「禁止」。 - - - 警告:當完整性被破壞且被檢測到執行時,發出系統通知「xxx元件完整性被破壞,是否允許執行」,您可以選擇 **忽略** 或 **禁止**。 - - 禁止:當完整性被破壞且被檢測到執行時,發出系統通知「xxx元件完整性被破壞,禁止執行」。 - -4. 如果元件文件被修改了,狀態欄從「正常」變為「已篡改」。 - -5. 勾選對應的元件文件,單擊 **移除保護**,移除後則不再受保護。 - - - -#### 網路工具 - -**聯網控制** - -在聯網控制介面,聯網控制功能預設關閉。開啟後,可以設定列表中單個應用聯網的狀態,每個應用或服務下拉框有三種選項。 - -- 詢問:應用聯網時給出提示「xxx需要連接網路」,您可以選擇 **僅允許本次**、**始終允許** 或 **禁止**。 - -- 允許:應用聯網時預設允許,不會有提示訊息。 - -- 禁止:應用聯網時給出提示「防火牆已禁止xxx連接網路」,您可以選擇 **前往設定** 或 **確定**。 - -> ![notes](../common/notes.svg) 說明:如果不發起網路連接則不會有提示訊息,比如本身就不會聯網的應用,即使選擇 **詢問** 或 **禁止** 也不會在啟動時彈出提示。 - - ![0|network_control](fig/internetcontrol.png) - -**流量監控** - -在流量監控介面,流量監控功能預設關閉。開啟後,可以對系統裡應用上網所使用的流量情況進行監控。 - -- 目前聯網:查看列表中應用目前的下行網速、上行網速。單擊管控下拉框,可以選擇 **詢問**、**允許** 或 **禁止** 選項,控制應用是否能聯網,詳細操作請參考安全工具中的 [聯網控制](#網路工具)。 - - ![0|current_network](fig/datausage.png) - -- 流量排名:查看啟動器裡所有應用的流量排名,包括下行流量、上行流量、總流量、流量時間分布詳情。列表右上角支援切換時間跨度:當天、昨天、當月、上月。 - - ![rankings](fig/rankings.png) - - -## 主選單 - -在主選單中,您可以進行相關參數設定、問題回饋、切換視窗主題,查看說明手冊等操作。 - -### 設定 - -在安全中心介面,單擊 ![icon_menu](../common/icon_menu.svg),選擇 **設定** ,您可以進行基礎設定及安全設定。 - -#### 基礎設定 - -**病毒查殺** - -- 加入「病毒查殺」到文件右鍵選單:勾選後,單擊文件(夾)右鍵可直接選擇 **病毒查殺**。 -- 不掃描超過此大小的壓縮包:勾選後,若壓縮包超過設定的大小,則不會進行掃描。 -- 病毒庫升級地址:勾選後,可設定病毒庫升級地址。 - - - -**殺毒引擎** - -可以選擇瑞星網安或安恆訊息殺毒引擎。 - -**關閉主視窗** - -- 選擇 **最小化至系統列**,關閉主視窗時,應用將隱藏到系統工具列。 -- 選擇 **退出**,關閉主視窗時直接退出應用。 -- 選擇**每次詢問**,每次關閉主視窗時會彈出確認彈框。 - -#### 還原預設值 - -單擊 **還原預設值** ,可復原目前頁面為預設設定值。 - -### 使用者回饋 - -1. 在安全中心介面,單擊 ![icon_menu](../common/icon_menu.svg)。 -2. 選擇 **使用者回饋**,跳轉到「服務與支持」應用的「留言諮詢」介面,您可以回饋相關問題。 - -### 安全日誌 - -1. 在安全中心介面,單擊 ![icon_menu](../common/icon_menu.svg)。 - -2. 選擇 **安全日誌**,可以根據日誌類型和日期查看安全中心的操作日誌,還可以選擇清除日誌。 - - ![0|security_log](fig/security_logs.png) - -### 主題 - -視窗主題包含亮色主題、暗色主題和系統主題。 - -1. 在安全中心介面,單擊 ![icon_menu](../common/icon_menu.svg)。 -2. 選擇 **主題**,選擇一個主題顏色。 - -### 說明 - -查看說明手冊,透過幫助進一步了解和使用安全中心。 - -1. 在安全中心介面,單擊 ![icon_menu](../common/icon_menu.svg)。 -2. 選擇 **說明**,查看安全中心的說明手冊,進一步了解和使用安全中心。 - - -### 關於 - -1. 在安全中心介面,單擊 ![icon_menu](../common/icon_menu.svg)。 -2. 選擇 **關於**,查看安全中心的版本和介紹。 - -### 退出 - -1. 在安全中心介面,單擊 ![icon_menu](../common/icon_menu.svg)。 -2. 選擇 **退出**。 \ No newline at end of file diff --git a/deepin-pc-manager/cleanerwhite.json.license b/deepin-pc-manager/cleanerwhite.json.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/cleanerwhite.json.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/com.deepin.deepin-pc-manager.policy b/deepin-pc-manager/com.deepin.deepin-pc-manager.policy new file mode 100644 index 0000000..03f6b62 --- /dev/null +++ b/deepin-pc-manager/com.deepin.deepin-pc-manager.policy @@ -0,0 +1,69 @@ + + + + + + stock_person + + Check Authentication + Authentication is required to perform this action + + no + no + auth_self + + ཞིབ་བཤེར་ངོས་འཛིན། + མིག་སྔའི་བཀོལ་སྤྱོད་ལ་གསང་ཨང་གིས་ར་སྤྲོད་བྱ་དགོས། + Verificar autenticación + Se requiere autenticación para realizar esta acción + Kontrolloni Mirëfilltësimin + Për të kryer këtë veprim lypset mirëfilltësim + Vérification de l'authentication + L'authentification est requise pour effectuer cette action + Provjeri ovjeru + Potreban je ovjera za izvođenje ove radnje + Провера идентификације + Идентификација је неопходана за вршење ове радње + Periksa Pengesahihan + Pengesahihan diperlukan untuk membuat tindakan ini + Check Authentication + A autenticação é necessária para executar esta ação + Check Authentication + K provedení této akce je zapotřebí ověření se + دەلىللەشنى تەكشۈرۈش + بۇ مەشغۇلات دەلىللەش تەلەپ قىلىنىدۇ + Check Authentication + 當前操作需要密碼認證 + Authentifizierung prüfen + Zum Ausführen dieser Aktion ist eine Authentifizierung erforderlich + Перевірка справжності + Для виконання цієї дії потрібна аутентифікація + Duğrulamayı Kontrol Et + Bu işlemi gerçekleştirmek için doğrulama gerekiyor + Verifique a autenticação + É necessária a autenticação para realizar esta ação + Check Authentication + Tämän toiminnon suorittaminen edellyttää todennusta + Comprova l'autenticació + Cal autenticació per dur a terme aquesta acció + Check Authentication + Autenticazione richiesta per eseguire questa operazione + Hitelesítés ellenőrzése + Hitelesítés szükséges a művelet végrehajtásához + Check Authentication + Voer je wachtwoord in om deze actie uit te voeren + Check Authentication + 当前操作需要密码认证 + Preverjanje istovetnosti + Za izvedbo tega dejanja je potrebna overitev + Check Authentication + Authentication is required to perform this action + Kimlik yoxlaması + Bu əməli yerinə yetirmək üçün kimlik yoxlaması tələb olunur + Check Authentication + 目前操作需要密碼認證 + Sprawdź Autoryzację + Wymagana jest autoryzacja w celu zrealizowania tej czynności + + diff --git a/deepin-pc-manager/com.deepin.pc.manager.xml b/deepin-pc-manager/com.deepin.pc.manager.xml index aa87a6b..14d3eae 100644 --- a/deepin-pc-manager/com.deepin.pc.manager.xml +++ b/deepin-pc-manager/com.deepin.pc.manager.xml @@ -1,9 +1,3 @@ - - diff --git a/deepin-pc-manager/configs/org.deepin.dde.deepin-pc-manager.json b/deepin-pc-manager/configs/org.deepin.dde.deepin-pc-manager.json new file mode 100644 index 0000000..8a714a3 --- /dev/null +++ b/deepin-pc-manager/configs/org.deepin.dde.deepin-pc-manager.json @@ -0,0 +1,66 @@ +{ + "magic": "dsg.config.meta", + "version": "1.0", + "contents": { + "closeType": { + "value": 0, + "serial": 0, + "flags": ["global"], + "name": "closeType", + "description[zh_CN]": "程序退出类型", + "description": "", + "permissions": "readwrite", + "visibility": "private" + }, + "askType": { + "value": 0, + "serial": 0, + "flags": ["global"], + "name": "askType", + "description[zh_CN]": "程序退出询问类型", + "description": "", + "permissions": "readwrite", + "visibility": "private" + }, + "safetyScore": { + "value": -1, + "serial": 0, + "flags": ["global"], + "name": "safetyScore", + "description[zh_CN]": "上次体检得分", + "description": "", + "permissions": "readwrite", + "visibility": "private" + }, + "lastCheckTime": { + "value": "2020-11-03-16-11-30", + "serial": 0, + "flags": ["global"], + "name": "lastCheckTime", + "description[zh_CN]": "上次体检得分", + "description": "", + "permissions": "readwrite", + "visibility": "private" + }, + "ignoreDevModeChecking": { + "value": false, + "serial": 0, + "flags": ["global"], + "name": "ignoreDevModeChecking", + "description[zh_CN]": "是否忽略开发者模式", + "description": "", + "permissions": "readwrite", + "visibility": "public" + }, + "ignoreAutoStartChecking": { + "value": false, + "serial": 0, + "flags": ["global"], + "name": "ignoreAutoStartChecking", + "description[zh_CN]": "自启动应用检测", + "description": "", + "permissions": "readwrite", + "visibility": "public" + } + } + } diff --git a/deepin-pc-manager/deepin-pc-manager.desktop b/deepin-pc-manager/deepin-pc-manager.desktop index 7264072..90c78cd 100644 --- a/deepin-pc-manager/deepin-pc-manager.desktop +++ b/deepin-pc-manager/deepin-pc-manager.desktop @@ -6,6 +6,7 @@ Exec=dbus-send --print-reply --dest=com.deepin.pc.manager /com/deepin/pc/manager GenericName=PC Manager Icon=deepin-pc-manager Name=Deepin PC Manager +OnlyShowIn=Deepin StartupNotify=false Terminal=false Type=Application @@ -13,7 +14,6 @@ X-Deepin-TurboType=dtkwidget X-Deepin-Vendor=deepin X-MultipleArgs=false - Comment[en_US]=Deepin PC Manager is an application tool designed to help users quickly manage, maintain, and optimize computer systems. Comment[zh_CN]=电脑管家是一款帮助用户快速管理、维护和优化计算机系统的应用工具。 GenericName[zh_CN]=电脑管家 diff --git a/deepin-pc-manager/dt-settings.json b/deepin-pc-manager/dt-settings.json index 62d2716..53f0e7f 100644 --- a/deepin-pc-manager/dt-settings.json +++ b/deepin-pc-manager/dt-settings.json @@ -1,27 +1,23 @@ { - "groups": [ - { - "key": "base", - "name": "Basic", - "groups": [ + "groups": [ { - "key": "close_window", - "name": "Close Main Window", - "options": [ - { - "key": "close_window_type", - "name": "", - "type": "radiogroup", - "items": [ - "Minimize to system tray", - "Exit", - "Ask me always" - ], - "default": 0 - } - ] + "key": "base", + "name": "Basic", + "groups": [ + { + "key": "close_window", + "name": "Close Main Window", + "options": [ + { + "key": "close_window_type", + "name": "", + "type": "radiogroup", + "items": ["Minimize to system tray","Exit","Ask me always"], + "default": 0 + } + ] + } + ] } - ] - } - ] + ] } diff --git a/deepin-pc-manager/dt-settings.json.license b/deepin-pc-manager/dt-settings.json.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/dt-settings.json.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/include/interface/namespace.h b/deepin-pc-manager/include/interface/namespace.h new file mode 100755 index 0000000..b40b8e2 --- /dev/null +++ b/deepin-pc-manager/include/interface/namespace.h @@ -0,0 +1,5 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#define PCC_NAMESPACE pccV20 diff --git a/deepin-pc-manager/include/interface/toolboxinterface.h b/deepin-pc-manager/include/interface/toolboxinterface.h new file mode 100755 index 0000000..1d7a61f --- /dev/null +++ b/deepin-pc-manager/include/interface/toolboxinterface.h @@ -0,0 +1,50 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "toolboxproxyinterface.h" +#include "namespace.h" + +#include +#include +#include + +namespace PCC_NAMESPACE { + +// ModuleInterface作为每个规范每个Module的接口,每个Module实现必须实现其所有虚函数。 +class ToolBoxInterface +{ +public: + ToolBoxInterface() = default; + ToolBoxInterface(ToolBoxProxyInterface *frameProxy) + : m_frameProxy(frameProxy) + { + } + virtual ~ToolBoxInterface() {} + + void setFrameProxy(ToolBoxProxyInterface *frameProxy) { m_frameProxy = frameProxy; } + + virtual const QString name() const = 0; + virtual const QString apptitle() const = 0; + virtual const QString apptip() const = 0; + virtual const QString appsupporter() const = 0; + virtual const QString icon() const = 0; + virtual int apptype() const = 0; + virtual bool enable() const = 0; + virtual bool checkauth() const = 0; + + /// \brief active + /// 当模块第一次被点击进入时,active会被调用,如果是插件,重载的时候必须声明为slots,否则加载不了 + virtual void active() {} + virtual void deactive() {} + +protected: + ToolBoxProxyInterface *m_frameProxy {nullptr}; +}; + +} // namespace PCC_NAMESPACE + +#define ToolBoxInterface_iid "com.deepin.dde.pcmanager.module/1.0" +Q_DECLARE_INTERFACE(PCC_NAMESPACE::ToolBoxInterface, ToolBoxInterface_iid) diff --git a/deepin-pc-manager/include/interface/toolboxproxyinterface.h b/deepin-pc-manager/include/interface/toolboxproxyinterface.h new file mode 100755 index 0000000..d0f6d3c --- /dev/null +++ b/deepin-pc-manager/include/interface/toolboxproxyinterface.h @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "namespace.h" +#include + +class QWidget; +class QString; + +namespace PCC_NAMESPACE { +class ToolBoxInterface; +class ToolBoxProxyInterface +{ +public: + enum AppType { + All, + System, + Network, + Repair, + Apps, + Devices + }; + +public: + // Module request to into next page + virtual void pushWidget(ToolBoxInterface *const inter, QWidget *const w) = 0; + virtual void popWidget(ToolBoxInterface *const inter) = 0; +}; +} // namespace PCC_NAMESPACE diff --git a/deepin-pc-manager/schemas/com.deepin.dde.deepin-pc-manager.gschema.xml b/deepin-pc-manager/schemas/com.deepin.dde.deepin-pc-manager.gschema.xml deleted file mode 100644 index 63393e5..0000000 --- a/deepin-pc-manager/schemas/com.deepin.dde.deepin-pc-manager.gschema.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - 0 - - Auto scan USB storage devices - - - 0 - - ask close reminder - - - 0 - - ask close reminder - - - '-1' - 安装时间 - - - '-1' - 安装日期 - - - -1 - - 上次体检得分 - - - "2020-11-03-16-11-30" - 上次体检时间 - - - false - 首页是否忽略检查自启动项 - - - false - 首页是否忽略检查开发者模式项 - - - '' - 上次垃圾清理内容大小 - - - 0 - - 主题类型,0未知类型,1浅色类型,2深色类型 - - - - 0 - - 0公网,1内网 - - - - '' - 内网域名/ip - - - diff --git a/deepin-pc-manager/settings_translation.cpp b/deepin-pc-manager/settings_translation.cpp new file mode 100644 index 0000000..a32e612 --- /dev/null +++ b/deepin-pc-manager/settings_translation.cpp @@ -0,0 +1,16 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +// This file was generated by dtk-settings-tools version 0.1.2 + +#include + +void GenerateSettingTranslate() +{ + auto base_close_window_radiogroupText0 = QObject::tr("Minimize to system tray"); + auto base_close_window_radiogroupText1 = QObject::tr("Exit"); + auto base_close_window_radiogroupText2 = QObject::tr("Ask me always"); + auto group_baseName = QObject::tr("Basic"); + auto group_base_close_windowName = QObject::tr("Close Main Window"); +} diff --git a/deepin-pc-manager/src/accessible/appaccessible.h b/deepin-pc-manager/src/accessible/appaccessible.h deleted file mode 100644 index da2f25a..0000000 --- a/deepin-pc-manager/src/accessible/appaccessible.h +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (C) 2020 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef APPACCESSIBLE_H -#define APPACCESSIBLE_H - -#include "appaccessiblebutton.h" -#include "appaccessiblelabel.h" -#include "appaccessibleqabstrractbutton.h" - -#endif // APPACCESSIBLE_H diff --git a/deepin-pc-manager/src/accessible/appaccessiblebase.cpp b/deepin-pc-manager/src/accessible/appaccessiblebase.cpp deleted file mode 100644 index e64b117..0000000 --- a/deepin-pc-manager/src/accessible/appaccessiblebase.cpp +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (C) 2020 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "appaccessiblebase.h" - -AppAccessibleBase::AppAccessibleBase(QWidget *widget) - : QAccessibleWidget(widget) - , m_widget(widget) -{ -} - -void *AppAccessibleBase::interface_cast(QAccessible::InterfaceType t) -{ - switch (t) { - case QAccessible::ActionInterface: - return static_cast(this); - case QAccessible::TextInterface: - return static_cast(this); - default: - return nullptr; - } -} - -QString AppAccessibleBase::text(QAccessible::Text text) const -{ - if (!m_widget) { - return QString(); - } - - switch (text) { - case QAccessible::Name: - return m_widget->accessibleName(); - case QAccessible::Description: - return m_widget->accessibleDescription(); - default: - return QString(); - } -} - -QString AppAccessibleBase::text(int startOffset, int endOffset) const -{ - Q_UNUSED(startOffset); - Q_UNUSED(endOffset); - - return QString(); -} - -void AppAccessibleBase::selection(int selectionIndex, int *startOffset, int *endOffset) const -{ - Q_UNUSED(selectionIndex) - Q_UNUSED(startOffset) - Q_UNUSED(endOffset) - - return; -} - -int AppAccessibleBase::selectionCount() const -{ - return 0; -} - -void AppAccessibleBase::addSelection(int startOffset, int endOffset) -{ - Q_UNUSED(startOffset) - Q_UNUSED(endOffset) - - return; -} - -void AppAccessibleBase::removeSelection(int selectionIndex) -{ - Q_UNUSED(selectionIndex) - - return; -} - -void AppAccessibleBase::setSelection(int selectionIndex, int startOffset, int endOffset) -{ - Q_UNUSED(selectionIndex) - Q_UNUSED(startOffset) - Q_UNUSED(endOffset) - - return; -} - -int AppAccessibleBase::cursorPosition() const -{ - return 0; -} - -void AppAccessibleBase::setCursorPosition(int position) -{ - Q_UNUSED(position) -} - -int AppAccessibleBase::characterCount() const -{ - return 0; -} - -QRect AppAccessibleBase::characterRect(int offset) const -{ - Q_UNUSED(offset) - - return QRect(); -} - -int AppAccessibleBase::offsetAtPoint(const QPoint &point) const -{ - Q_UNUSED(point) - - return 0; -} - -void AppAccessibleBase::scrollToSubstring(int startIndex, int endIndex) -{ - Q_UNUSED(startIndex) - Q_UNUSED(endIndex) - - return; -} - -QString AppAccessibleBase::attributes(int offset, int *startOffset, int *endOffset) const -{ - Q_UNUSED(offset) - Q_UNUSED(startOffset) - Q_UNUSED(endOffset) - - return QString(); -} diff --git a/deepin-pc-manager/src/accessible/appaccessiblebase.h b/deepin-pc-manager/src/accessible/appaccessiblebase.h deleted file mode 100644 index 7766a86..0000000 --- a/deepin-pc-manager/src/accessible/appaccessiblebase.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (C) 2020 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef APPACCESSIBLEBASE_H -#define APPACCESSIBLEBASE_H - -#include -#include -#include - -class AppAccessibleBase : public QAccessibleWidget - , public QAccessibleTextInterface -{ -public: - explicit AppAccessibleBase(QWidget *); - virtual ~AppAccessibleBase() Q_DECL_OVERRIDE {} - - // 满足接口需要实现的无关方法 - void *interface_cast(QAccessible::InterfaceType t) Q_DECL_OVERRIDE; - QString text(QAccessible::Text t) const Q_DECL_OVERRIDE; - void selection(int selectionIndex, int *startOffset, int *endOffset) const Q_DECL_OVERRIDE; - int selectionCount() const Q_DECL_OVERRIDE; - void addSelection(int startOffset, int endOffset) Q_DECL_OVERRIDE; - void removeSelection(int selectionIndex) Q_DECL_OVERRIDE; - void setSelection(int selectionIndex, int startOffset, int endOffset) Q_DECL_OVERRIDE; - int cursorPosition() const Q_DECL_OVERRIDE; - void setCursorPosition(int position) Q_DECL_OVERRIDE; - int characterCount() const Q_DECL_OVERRIDE; - QRect characterRect(int offset) const Q_DECL_OVERRIDE; - int offsetAtPoint(const QPoint &point) const Q_DECL_OVERRIDE; - void scrollToSubstring(int startIndex, int endIndex) Q_DECL_OVERRIDE; - QString attributes(int offset, int *startOffset, int *endOffset) const Q_DECL_OVERRIDE; - - // 与自动化测试实现相关处 - // 此处依旧是虚方法以方便继承 - // 因为QWidget没有text()方法,必须在子类中使用控件的text()方法 - virtual QString text(int startOffset, int endOffset) const Q_DECL_OVERRIDE; - -private: - QWidget *m_widget; -}; - -#endif // APPACCESSIBLEBASE_H diff --git a/deepin-pc-manager/src/accessible/appaccessiblebutton.cpp b/deepin-pc-manager/src/accessible/appaccessiblebutton.cpp deleted file mode 100644 index 3960a35..0000000 --- a/deepin-pc-manager/src/accessible/appaccessiblebutton.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2020 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "appaccessiblebutton.h" - -AppAccessibleButton::AppAccessibleButton(QPushButton *btn) - : AppAccessibleBase(btn) - , m_widget(btn) -{ -} - -QString AppAccessibleButton::text(int startOffset, int endOffset) const -{ - Q_UNUSED(startOffset); - Q_UNUSED(endOffset); - - if (m_widget) { - return m_widget->text(); - } - - return QString(); -} diff --git a/deepin-pc-manager/src/accessible/appaccessiblebutton.h b/deepin-pc-manager/src/accessible/appaccessiblebutton.h deleted file mode 100644 index 5bdaabf..0000000 --- a/deepin-pc-manager/src/accessible/appaccessiblebutton.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2020 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef APPACCESSIBLEBUTTON_H -#define APPACCESSIBLEBUTTON_H - -#include "appaccessiblebase.h" - -// 不要使用前置声明,被构造时需要做类型转换 -#include - -class AppAccessibleButton : public AppAccessibleBase -{ -public: - explicit AppAccessibleButton(QPushButton *); - virtual QString text(int startOffset, int endOffset) const Q_DECL_OVERRIDE; - -private: - QPushButton *m_widget; -}; - -#endif // APPACCESSIBLEBUTTON_H diff --git a/deepin-pc-manager/src/accessible/appaccessiblelabel.cpp b/deepin-pc-manager/src/accessible/appaccessiblelabel.cpp deleted file mode 100644 index af6137f..0000000 --- a/deepin-pc-manager/src/accessible/appaccessiblelabel.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2020 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "appaccessiblelabel.h" - -AppAccessibleLabel::AppAccessibleLabel(QLabel *label) - : AppAccessibleBase(label) - , m_widget(label) -{ -} - -QString AppAccessibleLabel::text(int startOffset, int endOffset) const -{ - Q_UNUSED(startOffset); - Q_UNUSED(endOffset); - - if (m_widget) { - return m_widget->text(); - } - - return QString(); -} diff --git a/deepin-pc-manager/src/accessible/appaccessiblelabel.h b/deepin-pc-manager/src/accessible/appaccessiblelabel.h deleted file mode 100644 index 3055baa..0000000 --- a/deepin-pc-manager/src/accessible/appaccessiblelabel.h +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2020 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef APPACCESSIBLELABEL_H -#define APPACCESSIBLELABEL_H - -#include "appaccessiblebase.h" - -#include - -class AppAccessibleLabel : public AppAccessibleBase -{ -public: - explicit AppAccessibleLabel(QLabel *); - virtual QString text(int startOffset, int endOffset) const Q_DECL_OVERRIDE; - -private: - QLabel *m_widget; -}; - -#endif // APPACCESSIBLELABEL_H diff --git a/deepin-pc-manager/src/accessible/appaccessibleqabstractbutton.cpp b/deepin-pc-manager/src/accessible/appaccessibleqabstractbutton.cpp deleted file mode 100644 index 7730686..0000000 --- a/deepin-pc-manager/src/accessible/appaccessibleqabstractbutton.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2020 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "appaccessibleqabstrractbutton.h" - -AppAccessibleQAbstractButton::AppAccessibleQAbstractButton(QAbstractButton *btn) - : AppAccessibleBase(btn) - , m_widget(btn) -{ -} - -QString AppAccessibleQAbstractButton::text(int startOffset, int endOffset) const -{ - Q_UNUSED(startOffset); - Q_UNUSED(endOffset); - - if (m_widget) { - return m_widget->text(); - } - - return QString(); -} diff --git a/deepin-pc-manager/src/accessible/appaccessibleqabstrractbutton.h b/deepin-pc-manager/src/accessible/appaccessibleqabstrractbutton.h deleted file mode 100644 index 5bbb2ca..0000000 --- a/deepin-pc-manager/src/accessible/appaccessibleqabstrractbutton.h +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2020 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef APPACCESSIBLEDCOMMANDLINKBUTTON_H -#define APPACCESSIBLEDCOMMANDLINKBUTTON_H - -#include "appaccessiblebase.h" -#include - -class AppAccessibleQAbstractButton : public AppAccessibleBase -{ -public: - explicit AppAccessibleQAbstractButton(QAbstractButton *); - virtual QString text(int startOffset, int endOffset) const Q_DECL_OVERRIDE; - -private: - QAbstractButton *m_widget; -}; - -#endif // APPACCESSIBLEDCOMMANDLINKBUTTON_H diff --git a/deepin-pc-manager/src/main.cpp b/deepin-pc-manager/src/main.cpp index 85c0193..4733bb9 100644 --- a/deepin-pc-manager/src/main.cpp +++ b/deepin-pc-manager/src/main.cpp @@ -1,28 +1,15 @@ -// Copyright (C) 2017 ~ 2019 Deepin Technology Co., Ltd. // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later -#include "defenderdbusservice.h" #include "window/mainwindow.h" - -#include +#include "defenderdbusservice.h" #include -#include -#include #include -#include -#include -#include -#include - -DEF_USING_NAMESPACE DWIDGET_USE_NAMESPACE DCORE_USE_NAMESPACE -using namespace PolkitQt1; - int main(int argc, char *argv[]) { DApplication a(argc, argv); @@ -41,9 +28,6 @@ int main(int argc, char *argv[]) "quickly manage, maintain, and optimize computer systems.")); a.setQuitOnLastWindowClosed(false); - DLogManager::registerConsoleAppender(); - DLogManager::registerFileAppender(); - MainWindow w; Dtk::Widget::moveToCenter(&w); diff --git a/deepin-pc-manager/src/manager_adaptor.cpp b/deepin-pc-manager/src/manager_adaptor.cpp index 78bf536..dac0956 100644 --- a/deepin-pc-manager/src/manager_adaptor.cpp +++ b/deepin-pc-manager/src/manager_adaptor.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2020 The Qt Company Ltd. +// Copyright (C) 2017 The Qt Company Ltd. // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/manager_adaptor.h b/deepin-pc-manager/src/manager_adaptor.h index 19cb62d..e48fc64 100644 --- a/deepin-pc-manager/src/manager_adaptor.h +++ b/deepin-pc-manager/src/manager_adaptor.h @@ -1,4 +1,4 @@ -// Copyright (C) 2020 The Qt Company Ltd. +// Copyright (C) 2017 The Qt Company Ltd. // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/widgets/avcpulimitation.cpp b/deepin-pc-manager/src/widgets/avcpulimitation.cpp deleted file mode 100644 index 5b70bf8..0000000 --- a/deepin-pc-manager/src/widgets/avcpulimitation.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (C) 2022 ~ 2022 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "avcpulimitation.h" - -#include -#include - -AVCPULimitation::AVCPULimitation(QWidget *parent) - : QWidget(parent) - , m_context(new DTK_WIDGET_NAMESPACE::DLabel(this)) - , m_tips(new DTK_WIDGET_NAMESPACE::DLabel(this)) - , m_check(new QCheckBox(this)) -{ - this->setContentsMargins(0, 0, 0, 0); - this->setAccessibleName("AVCPULimitation"); - // 布局 - QHBoxLayout *layout = new QHBoxLayout(this); - layout->setContentsMargins(0, 0, 0, 0); - layout->setSpacing(5); - m_context->setText(tr("Energy-saving mode")); - m_tips->setText("(" + tr("Virus scan takes a longer time in this mode") + ")"); - m_context->setElideMode(Qt::ElideMiddle); - m_tips->setElideMode(Qt::ElideMiddle); - - layout->addWidget(m_check); - layout->addWidget(m_context); - layout->addWidget(m_tips); - layout->addStretch(0); - this->setLayout(layout); - - m_check->setTristate(false); - m_check->setAccessibleName("mode_switch"); - - connect(m_check, &QCheckBox::clicked, this, &AVCPULimitation::checkBoxChange); -} - -AVCPULimitation::~AVCPULimitation() { } - -void AVCPULimitation::setcheckbox(bool status) -{ - if (m_check->isChecked() == status) { - return; - } - if (status) { - m_check->setCheckState(Qt::Checked); - } else { - m_check->setCheckState(Qt::Unchecked); - } -} - -// 选择框的改变 -void AVCPULimitation::checkBoxChange(bool ischecked) -{ - Q_EMIT notifyCheckBoxChange(ischecked); -} diff --git a/deepin-pc-manager/src/widgets/avcpulimitation.h b/deepin-pc-manager/src/widgets/avcpulimitation.h deleted file mode 100644 index 3ea6313..0000000 --- a/deepin-pc-manager/src/widgets/avcpulimitation.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (C) 2022 ~ 2022 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef AVCPULIMITATION_H -#define AVCPULIMITATION_H - -#include - -#include - -class QCheckBox; - -class AVCPULimitation : public QWidget -{ - Q_OBJECT -public: - explicit AVCPULimitation(QWidget *parent = nullptr); - virtual ~AVCPULimitation(); - - // 设置选择框 - void setcheckbox(bool status); - - // 选择框的改变 - void checkBoxChange(bool); - -Q_SIGNALS: - // 选择框的状态信号 - void notifyCheckBoxChange(bool); - -private: - DTK_WIDGET_NAMESPACE::DLabel *m_context; // 内容 - DTK_WIDGET_NAMESPACE::DLabel *m_tips; // 单位 - QCheckBox *m_check; // 选择框 -}; - -#endif // AVCPULIMITATION_H diff --git a/deepin-pc-manager/src/widgets/basiclistdelegate.cpp b/deepin-pc-manager/src/widgets/basiclistdelegate.cpp deleted file mode 100644 index c45cd91..0000000 --- a/deepin-pc-manager/src/widgets/basiclistdelegate.cpp +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "basiclistdelegate.h" - -#include "basiclistmodel.h" - -#include -#include - -QPixmap def::widgets::loadPixmap(const QString &path) -{ - qreal ratio = 1.0; - QPixmap pixmap; - - const qreal devicePixelRatio = qApp->devicePixelRatio(); - - if (!qFuzzyCompare(ratio, devicePixelRatio)) { - QImageReader reader; - reader.setFileName(qt_findAtNxFile(path, devicePixelRatio, &ratio)); - if (reader.canRead()) { - reader.setScaledSize(reader.size() * (devicePixelRatio / ratio)); - pixmap = QPixmap::fromImage(reader.read()); - pixmap.setDevicePixelRatio(devicePixelRatio); - } - } else { - pixmap.load(path); - } - - return pixmap; -} - -namespace def { - -namespace widgets { - -BasicListDelegate::BasicListDelegate(QObject *parent) - : QAbstractItemDelegate(parent) -{ -} - -void BasicListDelegate::paint(QPainter *painter, - const QStyleOptionViewItem &option, - const QModelIndex &index) const -{ - const bool isHover = index.data(BasicListModel::ItemHoverRole).toBool(); - - painter->setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing - | QPainter::SmoothPixmapTransform); - painter->setBrush(Qt::red); - painter->setPen(Qt::black); - - if (isHover) { - QPainterPath path; - path.addRoundedRect(option.rect.marginsRemoved(QMargins(15, 0, 5, 0)), 6, 6); - painter->fillPath(path, QColor(0, 0, 0, 0.05 * 255)); - } - - painter->drawText(option.rect.marginsRemoved(QMargins(30, 0, 0, 0)), - Qt::AlignVCenter | Qt::AlignLeft, - index.data(Qt::DisplayRole).toString()); - - if (index.data(BasicListModel::ItemSelectedRole).toBool()) { - const int x = option.rect.right() - 16 - 14; - const int y = option.rect.top() + (option.rect.height() - 16) / 2; - - painter->drawPixmap(x, y, loadPixmap(":/widgets/themes/dark/icons/list_select.png")); - } -} - -QSize BasicListDelegate::sizeHint(const QStyleOptionViewItem &option, - const QModelIndex &index) const -{ - Q_UNUSED(option); - - return index.data(Qt::SizeHintRole).toSize(); -} - -} // namespace widgets - -} // namespace def diff --git a/deepin-pc-manager/src/widgets/basiclistdelegate.h b/deepin-pc-manager/src/widgets/basiclistdelegate.h deleted file mode 100644 index 236cecc..0000000 --- a/deepin-pc-manager/src/widgets/basiclistdelegate.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef BASICLISTDELEGATE_H -#define BASICLISTDELEGATE_H - -#include -#include -#include -#include - -namespace def { - -namespace widgets { - -QPixmap loadPixmap(const QString &path); - -class BasicListDelegate : public QAbstractItemDelegate -{ - Q_OBJECT - -public: - explicit BasicListDelegate(QObject *parent = nullptr); - - void paint(QPainter *painter, - const QStyleOptionViewItem &option, - const QModelIndex &index) const; - QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; -}; - -} // namespace widgets - -} // namespace def - -#endif // BASICLISTDELEGATE_H diff --git a/deepin-pc-manager/src/widgets/basiclistmodel.cpp b/deepin-pc-manager/src/widgets/basiclistmodel.cpp deleted file mode 100644 index 57c3c09..0000000 --- a/deepin-pc-manager/src/widgets/basiclistmodel.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "basiclistmodel.h" - -#include -#include - -namespace def { - -namespace widgets { - -BasicListModel::BasicListModel(QObject *parent) - : QAbstractListModel(parent) -{ -} - -int BasicListModel::rowCount(const QModelIndex &parent) const -{ - Q_UNUSED(parent); - - return m_options.size(); -} - -QVariant BasicListModel::data(const QModelIndex &index, int role) const -{ - if (!index.isValid()) - return QVariant(); - - switch (role) { - case ItemTextRole: - return m_options[index.row()]; - case ItemSizeRole: - return QSize(0, 36); - case ItemSelectedRole: - return m_selectedIndex == index; - case ItemHoverRole: - return m_hoveredIndex == index; - default:; - } - - return QVariant(); -} - -void BasicListModel::clear() -{ - beginRemoveRows(QModelIndex(), 0, m_options.size()); - m_options.clear(); - m_values.clear(); - endRemoveRows(); -} - -void BasicListModel::appendOption(const QString &text, const QVariant &data) -{ - beginInsertRows(QModelIndex(), m_options.size(), m_options.size()); - m_options.append(text); - m_values.append(data); - endInsertRows(); - - // Q_EMIT layoutChanged(); -} - -void BasicListModel::setSelectedIndex(const QModelIndex &index) -{ - const QModelIndex oldIndex = m_selectedIndex; - - m_selectedIndex = index; - - Q_EMIT dataChanged(oldIndex, oldIndex); - Q_EMIT dataChanged(index, index); -} - -void BasicListModel::setHoveredIndex(const QModelIndex &index) -{ - m_hoveredIndex = index; - - Q_EMIT dataChanged(index, index); -} - -} // namespace widgets - -} // namespace def diff --git a/deepin-pc-manager/src/widgets/basiclistmodel.h b/deepin-pc-manager/src/widgets/basiclistmodel.h deleted file mode 100644 index 6c4d9da..0000000 --- a/deepin-pc-manager/src/widgets/basiclistmodel.h +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef BASICLISTMODEL_H -#define BASICLISTMODEL_H - -#include - -namespace def { - -namespace widgets { - -class BasicListModel : public QAbstractListModel -{ - Q_OBJECT - -public: - enum ItemRole { - ItemSizeRole = Qt::SizeHintRole, - ItemTextRole = Qt::DisplayRole, - ReservedRole = Qt::UserRole, - ItemIsFirstRole, - ItemIsLastRole, - ItemSelectedRole, - ItemHoverRole - }; - - explicit BasicListModel(QObject *parent = nullptr); - - int rowCount(const QModelIndex &parent) const; - QVariant data(const QModelIndex &index, int role) const; - -public Q_SLOTS: - void clear(); - void appendOption(const QString &text, const QVariant &data = QVariant()); - void setSelectedIndex(const QModelIndex &index); - void setHoveredIndex(const QModelIndex &index); - -private: - QList m_options; - QList m_values; - - QModelIndex m_selectedIndex; - QModelIndex m_hoveredIndex; -}; - -} // namespace widgets - -} // namespace def - -#endif // BASICLISTMODEL_H diff --git a/deepin-pc-manager/src/widgets/cleaneritem.cpp b/deepin-pc-manager/src/widgets/cleaneritem.cpp deleted file mode 100644 index d747426..0000000 --- a/deepin-pc-manager/src/widgets/cleaneritem.cpp +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (C) 2020 ~ 2020 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "cleaneritem.h" - -#include -#include -#include - -#include -#include -#include -#include -#include - -DWIDGET_USE_NAMESPACE - -#define MAX_WIDTH 300 - -CleanerItem::CleanerItem(QWidget *parent) - : DFrame(parent) - , m_firstLayerWidgt(new QWidget(this)) - , m_checkBox(new DCheckBox(this)) - , m_levelLabel(new DLabel(this)) - , m_tipLabel(new DTipLabel("", this)) -{ - QHBoxLayout *mainLayout = new QHBoxLayout; - mainLayout->setContentsMargins(0, 0, 0, 0); - setLayout(mainLayout); - - mainLayout->addWidget(m_firstLayerWidgt); - - QHBoxLayout *firstLayerLayout = new QHBoxLayout; - firstLayerLayout->setContentsMargins(5, 0, 10, 0); - firstLayerLayout->setSpacing(10); - m_firstLayerWidgt->setLayout(firstLayerLayout); - - m_checkBox->setFixedSize(QSize(25, 25)); - firstLayerLayout->addWidget(m_checkBox); - - QVBoxLayout *rightLayout = new QVBoxLayout; - rightLayout->setContentsMargins(5, 5, 5, 0); - rightLayout->setSpacing(5); - firstLayerLayout->addLayout(rightLayout, Qt::AlignLeft); - - m_levelLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); - m_tipLabel->adjustSize(); - m_levelLabel->setContentsMargins(0, 0, 0, 0); - QFont font = m_levelLabel->font(); - font.setWeight(QFont::Medium); - font.setPixelSize(14); - m_levelLabel->setFont(font); - - QPalette pal; - pal.setColor(QPalette::Text, QColor("#414D68")); - m_levelLabel->setPalette(pal); - rightLayout->addWidget(m_levelLabel, 0, Qt::AlignLeft); - - m_tipLabel->setAlignment(Qt::AlignLeft); - m_tipLabel->adjustSize(); - m_tipLabel->setContentsMargins(0, 0, 0, 0); - rightLayout->addWidget(m_tipLabel); - - QFont fontTip = m_tipLabel->font(); - fontTip.setPixelSize(12); - m_tipLabel->setFont(fontTip); - DFontSizeManager::instance()->unbind(m_tipLabel); - - QPalette pal1; - pal1.setColor(QPalette::Text, QColor("#526A7F")); - m_levelLabel->setPalette(pal1); - setBackgroundRole(DPalette::ItemBackground); - // 设置边框的宽度 - setLineWidth(0); - - connect(m_checkBox, &QCheckBox::clicked, this, &CleanerItem::setCheckBoxStatus); -} - -CleanerItem::~CleanerItem() { } - -// 设置相关标签名称 -void CleanerItem::setAccessibleParentText(const QString &sAccessibleName) -{ - m_firstLayerWidgt->setAccessibleName(sAccessibleName + "_backGroundWidget"); - m_checkBox->setAccessibleName(sAccessibleName + "_backGroundWidget_checkBox"); - m_levelLabel->setAccessibleName(sAccessibleName + "_backGroundWidget_levelLable"); - m_tipLabel->setAccessibleName(sAccessibleName + "_backGroundWidget_tipLable"); -} - -// 设置标题和提示 -void CleanerItem::setLevelText(QString text) -{ - m_levelLabel->setText(text); -} - -void CleanerItem::setTipText(QString text) -{ - m_tipLabel->setText(text); - m_tipStr = text; -} - -// 设置/获取 勾选框状态 -void CleanerItem::setCheckBoxStatus(bool isbStatus) -{ - m_checkBox->setChecked(isbStatus); - Q_EMIT itemClicked(); -} - -bool CleanerItem::getCheckBoxStatus() const -{ - return m_checkBox->isChecked(); -} - -void CleanerItem::paintEvent(QPaintEvent *event) -{ - QFontMetrics fontmet(m_tipLabel->font()); - QString elidedStr = fontmet.elidedText(m_tipStr, Qt::TextElideMode::ElideRight, MAX_WIDTH - 30); - m_tipLabel->setText(elidedStr); - DFrame::paintEvent(event); -} diff --git a/deepin-pc-manager/src/widgets/cleaneritem.h b/deepin-pc-manager/src/widgets/cleaneritem.h deleted file mode 100644 index df03700..0000000 --- a/deepin-pc-manager/src/widgets/cleaneritem.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include "dtkwidget_global.h" -#include "window/namespace.h" - -#include -#include -#include - -#include -#include -#include - -DWIDGET_USE_NAMESPACE - -class CleanerItem : public DFrame -{ - Q_OBJECT -public: - explicit CleanerItem(QWidget *parent = nullptr); - ~CleanerItem(); - - // 设置标题和提示 - void setLevelText(QString text); - void setTipText(QString text); - - // 设置/获取 勾选框状态 - void setCheckBoxStatus(bool isbStatus); - bool getCheckBoxStatus() const; - - // 设置相关标签名称 - void setAccessibleParentText(const QString &sAccessibleName); - -protected: - void paintEvent(QPaintEvent *event); - -Q_SIGNALS: - void itemClicked(); - -private: - QWidget *m_firstLayerWidgt; - DCheckBox *m_checkBox; - DLabel *m_levelLabel; - DTipLabel *m_tipLabel; - - QString m_tipStr; -}; diff --git a/deepin-pc-manager/src/widgets/custompushbutton.cpp b/deepin-pc-manager/src/widgets/custompushbutton.cpp deleted file mode 100644 index 7223936..0000000 --- a/deepin-pc-manager/src/widgets/custompushbutton.cpp +++ /dev/null @@ -1,62 +0,0 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "custompushbutton.h" - -#include - -#include -#include - -CustomPushbutton::CustomPushbutton(QWidget *parent) - : QWidget(parent) - , m_button(nullptr) -{ - // 布局 - QHBoxLayout *hlayout = new QHBoxLayout; - hlayout->setContentsMargins(0, 0, 0, 0); - m_button = new DPushButton(this); - QString buttonAccName = this->accessibleName().append("_button"); - m_button->setAccessibleName(buttonAccName); - m_button->setIconSize(QSize(16, 16)); - m_button->setText("ssssss"); - m_button->setFlat(true); - QFont ft = m_button->font(); - ft.setPixelSize(12); - m_button->setFont(ft); - hlayout->addWidget(m_button); - this->setLayout(hlayout); - - // 字体样式 - QPalette pal; - pal.setColor(QPalette::Text, QColor("#001A2E")); - m_button->setPalette(pal); - // 点击信号 - connect(m_button, &DPushButton::clicked, this, &CustomPushbutton::clicked); -} - -void CustomPushbutton::setIcon(QIcon icon) -{ - m_button->setIcon(icon); -} - -void CustomPushbutton::setText(QString string) -{ - m_button->setText(string); -} - -QFont CustomPushbutton::getButtonFont() -{ - return m_button->font(); -} - -void CustomPushbutton::enterEvent(QEvent *) -{ - m_button->setFlat(false); -} - -void CustomPushbutton::leaveEvent(QEvent *) -{ - m_button->setFlat(true); -} diff --git a/deepin-pc-manager/src/widgets/custompushbutton.h b/deepin-pc-manager/src/widgets/custompushbutton.h deleted file mode 100644 index 20dbd0e..0000000 --- a/deepin-pc-manager/src/widgets/custompushbutton.h +++ /dev/null @@ -1,39 +0,0 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef CUSTOMPUSHBUTTON_H -#define CUSTOMPUSHBUTTON_H - -#include - -#include - -DWIDGET_USE_NAMESPACE - -/** - * @brief 自定义按钮 正常没有背景悬停有背景 - */ -class CustomPushbutton : public QWidget -{ - Q_OBJECT -public: - explicit CustomPushbutton(QWidget *parent = nullptr); - - // 设置图标 - void setIcon(QIcon icon); - void setText(QString string); - QFont getButtonFont(); - - // 鼠标事件 - void enterEvent(QEvent *); - void leaveEvent(QEvent *); - -signals: - void clicked(); - -private: - DPushButton *m_button; -}; - -#endif // CUSTOMPUSHBUTTON_H diff --git a/deepin-pc-manager/src/widgets/dccslider.cpp b/deepin-pc-manager/src/widgets/dccslider.cpp deleted file mode 100644 index 9558e7c..0000000 --- a/deepin-pc-manager/src/widgets/dccslider.cpp +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "dccslider.h" - -#include -#include - -namespace def { -namespace widgets { - -DCCSlider::DCCSlider(DCCSlider::SliderType type, QWidget *parent) - : DSlider(Qt::Horizontal, parent) -{ - setType(type); - DSlider::slider()->setTracking(false); -} - -DCCSlider::DCCSlider(Qt::Orientation orientation, QWidget *parent) - : DSlider(orientation, parent) -{ - DSlider::slider()->setTracking(false); -} - -void DCCSlider::setType(DCCSlider::SliderType type) -{ - switch (type) { - case Vernier: - setProperty("handleType", "Vernier"); - break; - case Progress: - setProperty("handleType", "None"); - break; - default: - setProperty("handleType", "Normal"); - break; - } -} - -QSlider *DCCSlider::qtSlider() -{ - return DSlider::slider(); -} - -void DCCSlider::setRange(int min, int max) -{ - setMinimum(min); - setMaximum(max); -} - -void DCCSlider::setTickPosition(QSlider::TickPosition tick) -{ - tickPosition = tick; -} - -void DCCSlider::setTickInterval(int ti) -{ - DSlider::slider()->setTickInterval(ti); -} - -void DCCSlider::setSliderPosition(int Position) -{ - DSlider::slider()->setSliderPosition(Position); -} - -void DCCSlider::setAnnotations(const QStringList &annotations) -{ - switch (tickPosition) { - case QSlider::TicksLeft: - setLeftTicks(annotations); - break; - case QSlider::TicksRight: - setRightTicks(annotations); - break; - default: - break; - } -} - -void DCCSlider::setOrientation(Qt::Orientation orientation) -{ - Q_UNUSED(orientation) -} - -void DCCSlider::wheelEvent(QWheelEvent *e) -{ - e->ignore(); -} - -} // namespace widgets -} // namespace def diff --git a/deepin-pc-manager/src/widgets/dccslider.h b/deepin-pc-manager/src/widgets/dccslider.h deleted file mode 100644 index f4dfd63..0000000 --- a/deepin-pc-manager/src/widgets/dccslider.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef DEFSLIDER_H -#define DEFSLIDER_H - -#include - -namespace def { -namespace widgets { - -class DCCSlider : public DTK_WIDGET_NAMESPACE::DSlider -{ - Q_OBJECT -public: - enum SliderType { Normal, Vernier, Progress }; - -public: - explicit DCCSlider(SliderType type = Normal, QWidget *parent = nullptr); - explicit DCCSlider(Qt::Orientation orientation, QWidget *parent = nullptr); - - inline DCCSlider *slider() const { return const_cast(this); } - - QSlider *qtSlider(); - - void setType(SliderType type); - void setRange(int min, int max); - void setTickPosition(QSlider::TickPosition tick); - void setTickInterval(int ti); - void setSliderPosition(int Position); - void setAnnotations(const QStringList &annotations); - void setOrientation(Qt::Orientation orientation); - -protected: - void wheelEvent(QWheelEvent *e); - -private: - QSlider::TickPosition tickPosition = QSlider::TicksBelow; -}; - -} // namespace widgets -} // namespace def - -#endif // DEFSLIDER_H diff --git a/deepin-pc-manager/src/widgets/dccsliderannotated.cpp b/deepin-pc-manager/src/widgets/dccsliderannotated.cpp deleted file mode 100644 index 5c9005b..0000000 --- a/deepin-pc-manager/src/widgets/dccsliderannotated.cpp +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "dccsliderannotated.h" - -#include "basiclistdelegate.h" -#include "dccslider.h" - -#include -#include -#include -#include -#include -#include - -namespace def { -namespace widgets { - -DCCSliderAnnotated::DCCSliderAnnotated(QWidget *parent) - : QFrame(parent) - , m_slider(new DCCSlider(DCCSlider::SliderType::Normal, this)) - , m_annotation(new SliderAnnotation(this)) - , m_leftIconLabel(new QLabel(this)) - , m_rightIconLabel(new QLabel(this)) -{ - m_annotation->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - - m_leftIconLabel->setObjectName("SliderLeftIcon"); - m_rightIconLabel->setObjectName("SliderRightIcon"); - m_leftIconLabel->setVisible(false); - m_rightIconLabel->setVisible(false); - - QVBoxLayout *layout = new QVBoxLayout(this); - layout->setContentsMargins(24, 0, 24, 0); - - layout->addWidget(m_slider); - - m_annotation->setVisible(false); - layout->addWidget(m_annotation); -} - -void DCCSliderAnnotated::setAnnotations(const QStringList &annotations) -{ - m_annotation->setVisible(!annotations.size()); - m_annotation->setContents(annotations); -} - -DCCSlider *DCCSliderAnnotated::slider() const -{ - return m_slider; -} - -void DCCSliderAnnotated::setSlider(DCCSlider *slider) -{ - if (slider == m_slider) - return; - - if (!m_slider) { - QVBoxLayout *la = qobject_cast(layout()); - if (la) { - la->removeWidget(m_slider); - } - m_slider->deleteLater(); - } - - m_slider = slider; -} - -SliderAnnotation::SliderAnnotation(QWidget *parent) - : QWidget(parent) -{ - QFont font; - QFontMetrics fm(font); - setFixedHeight(fm.height()); -} - -void SliderAnnotation::setContents(const QStringList &contents) -{ - setProperty("tickmarkLabels", contents); - - update(); -} - -QString DCCSliderAnnotated::leftIcon() const -{ - return m_leftIcon; -} - -void DCCSliderAnnotated::setLeftIcon(const QString &leftIcon) -{ -#ifdef WINDOW_MODE - Q_UNUSED(leftIcon) -#else - if (leftIcon != m_leftIcon) { - m_leftIcon = leftIcon; - - QPixmap pix = loadPixmap(m_leftIcon); - m_leftIconLabel->setPixmap(pix); - m_leftIconLabel->setVisible(!pix.isNull()); - - Q_EMIT leftIconChanged(); - } -#endif -} - -void DCCSliderAnnotated::setLeftIcon(const QIcon &leftIcon, const QSize &iconSize) -{ - auto pix = leftIcon.pixmap(iconSize); - m_leftIconLabel->setPixmap(pix); - m_leftIconLabel->setVisible(!pix.isNull()); - - Q_EMIT leftIconChanged(); -} - -QString DCCSliderAnnotated::rightIcon() const -{ - return m_rightIcon; -} - -void DCCSliderAnnotated::setRightIcon(const QString &rightIcon) -{ -#ifdef WINDOW_MODE - Q_UNUSED(rightIcon) -#else - if (rightIcon != m_rightIcon) { - m_rightIcon = rightIcon; - - QPixmap pix = loadPixmap(m_rightIcon); - m_rightIconLabel->setPixmap(pix); - m_rightIconLabel->setVisible(!pix.isNull()); - - Q_EMIT rightIconChanged(); - } -#endif -} - -void DCCSliderAnnotated::setRightIcon(const QIcon &rightIcon, const QSize &iconSize) -{ - auto pix = rightIcon.pixmap(iconSize); - m_rightIconLabel->setPixmap(pix); - m_rightIconLabel->setVisible(!pix.isNull()); - - Q_EMIT rightIconChanged(); -} - -bool DCCSliderAnnotated::event(QEvent *evnet) -{ - if (evnet->type() == QEvent::Resize && (m_leftIconLabel || m_rightIconLabel)) { - QStyleOptionSlider styleoption; - // slider()->initStyleOption(&styleoption); - - auto ts = slider()->style(); - auto rect = - ts->subControlRect(QStyle::CC_Slider, &styleoption, QStyle::SC_SliderGroove, slider()); - - if (m_leftIconLabel) { - m_leftIconLabel->adjustSize(); - auto leftRect = m_leftIconLabel->rect(); - leftRect.moveCenter(QPoint(leftRect.width() / 2, rect.center().y())); - m_leftIconLabel->setGeometry(leftRect); - } - - if (m_rightIconLabel) { - m_rightIconLabel->adjustSize(); - auto rightRect = m_rightIconLabel->rect(); - rightRect.moveCenter( - QPoint(this->rect().right() - rightRect.width() / 2, rect.center().y())); - m_rightIconLabel->setGeometry(rightRect); - } - } - - return QWidget::event(evnet); -} - -void SliderAnnotation::paintEvent(QPaintEvent *) -{ - QStylePainter painter(this); - - QStyleOption opt; - opt.initFrom(this); - - painter.drawControl(QStyle::ControlElement(QStyle::CE_CustomBase + 1024), opt); - - painter.end(); -} - -} // namespace widgets -} // namespace def diff --git a/deepin-pc-manager/src/widgets/dccsliderannotated.h b/deepin-pc-manager/src/widgets/dccsliderannotated.h deleted file mode 100644 index 6237d99..0000000 --- a/deepin-pc-manager/src/widgets/dccsliderannotated.h +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef DEFSLIDERANNOTATED_H -#define DEFSLIDERANNOTATED_H - -#include -#include - -QT_BEGIN_NAMESPACE -class QLabel; -QT_END_NAMESPACE - -namespace def { -namespace widgets { - -class DCCSlider; - -class SliderAnnotation : public QWidget -{ - Q_OBJECT -public: - explicit SliderAnnotation(QWidget *parent = nullptr); - - virtual ~SliderAnnotation() override { } - - void setContents(const QStringList &contents); - -protected: - void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; -}; - -class DCCSliderAnnotated : public QFrame -{ - Q_OBJECT -public: - explicit DCCSliderAnnotated(QWidget *parent = nullptr); - - virtual ~DCCSliderAnnotated() override { } - - void setAnnotations(const QStringList &annotations); - -#ifdef WINDOW_MODE - DCCSlider *slider() const; - void setSlider(DCCSlider *slider); -#else - DCCSlider *slider() const; - void setSlider(DCCSlider *slider); -#endif - QString leftIcon() const; - void setLeftIcon(const QString &leftIcon); - void setLeftIcon(const QIcon &leftIcon, const QSize &iconSize); - - QString rightIcon() const; - void setRightIcon(const QString &rightIcon); - void setRightIcon(const QIcon &leftIcon, const QSize &iconSize); - -Q_SIGNALS: - void leftIconChanged(); - void rightIconChanged(); - -protected: - bool event(QEvent *evnet) override; - -private: - DCCSlider *m_slider; - SliderAnnotation *m_annotation; - - QLabel *m_leftIconLabel; - QLabel *m_rightIconLabel; - - QString m_leftIcon; - QString m_rightIcon; -}; - -} // namespace widgets -} // namespace def - -#endif // DEFSLIDERANNOTATED_H diff --git a/deepin-pc-manager/src/widgets/ddropdown.cpp b/deepin-pc-manager/src/widgets/ddropdown.cpp deleted file mode 100644 index f6de7f4..0000000 --- a/deepin-pc-manager/src/widgets/ddropdown.cpp +++ /dev/null @@ -1,223 +0,0 @@ -// Copyright (C) 2020 ~ 2022 Uniontech Software Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "ddropdown.h" - -#include -#include -#include - -#include -#include -#include - -class DDropdownPrivate : public QObject -{ -public: - explicit DDropdownPrivate(DDropdown *parent); - ~DDropdownPrivate() override; - -private: - DMenu *menu = nullptr; - DLabel *text = nullptr; - DIconButton *dropdown = nullptr; - QString status; - DDropdown *q_ptr; - Q_DECLARE_PUBLIC(DDropdown) -}; - -DDropdown::DDropdown(QWidget *parent) - : DWidget(parent) - , d_ptr(new DDropdownPrivate(this)) -{ - Q_D(DDropdown); - setObjectName("DDropdown"); - auto layout = new QHBoxLayout(this); - d->menu = new DMenu(this); - m_pAllAction = d->menu->addAction(m_strAllText); - m_pInstalledAction = d->menu->addAction(m_strInstallText); - m_pUnInstalledAction = d->menu->addAction(m_strUnInstallText); - d->text = new DLabel(m_strAllText); - d->text->installEventFilter(this); - auto font = d->text->font(); - font.setFamily("SourceHanSansSC"); - font.setWeight(QFont::Normal); - font.setPixelSize(14); - d->text->setFont(font); - d->text->setObjectName("DDropdownText"); - d->text->setForegroundRole(DPalette::TextTitle); - d->dropdown = new DIconButton(DStyle::SP_ArrowDown, this); - d->dropdown->setFocusPolicy(Qt::NoFocus); - d->dropdown->setIconSize(QSize(9, 9)); - d->dropdown->setObjectName("DDropdownIcon"); - d->dropdown->setFixedSize(9, 9); - d->dropdown->setWindowModality(Qt::WindowModal); - DPalette pl = d->dropdown->palette(); - pl.setColor(DPalette::Light, QColor(Qt::transparent)); - pl.setColor(DPalette::Dark, QColor(Qt::transparent)); - QColor sbcolor("#000000"); - sbcolor.setAlphaF(0); - pl.setColor(DPalette::Shadow, sbcolor); - d->dropdown->setPalette(pl); - - layout->addStretch(); - layout->addStretch(); - layout->addWidget(d->text, 0, Qt::AlignCenter); - layout->setSpacing(10); - layout->addWidget(d->dropdown, 0, Qt::AlignCenter); - layout->setContentsMargins(0, 0, 0, 0); - - connect(d->menu, &DMenu::triggered, this, [=](QAction *action) { - if (m_pAllAction == action) { - Q_EMIT triggeredAll(); - } else if (m_pInstalledAction == action) { - Q_EMIT triggeredInstalled(); - } else { - Q_EMIT triggeredUnInstalled(); - } - - d->text->setText(action->text()); - }); - - connect(this, &DDropdown::requestContextMenu, this, [=]() { - auto center = this->mapToGlobal(this->rect().topLeft()); - center.setY(center.y() + this->height()); - d->menu->move(center); - d->menu->exec(); - }); - - connect(d->dropdown, &DIconButton::clicked, this, [=](bool checked) { - Q_UNUSED(checked) - Q_EMIT requestContextMenu(); - }); -} - -DDropdown::~DDropdown() { } - -QString DDropdown::status() const -{ - Q_D(const DDropdown); - return d->status; -} - -QList DDropdown::actions() const -{ - Q_D(const DDropdown); - return d->menu->actions(); -} - -bool DDropdown::eventFilter(QObject *watched, QEvent *event) -{ - Q_D(DDropdown); - - if (d->text == watched) { - if (event->type() == QEvent::MouseButtonPress) { - QMouseEvent *pEv = static_cast(event); - - if (pEv->button() == Qt::LeftButton) { - Q_EMIT requestContextMenu(); - } - } - } - - return DWidget::eventFilter(watched, event); -} - -void DDropdown::setText(const QString &text) -{ - Q_D(DDropdown); - d->text->setText(text); -} - -void DDropdown::setCurrentAction(QAction *action) -{ - Q_D(DDropdown); - if (action) { - for (auto action : d->menu->actions()) { - action->setChecked(false); - } - d->text->setText(action->text()); - action->setChecked(true); - } else { - for (auto action : d->menu->actions()) { - action->setChecked(false); - } - } -} - -void DDropdown::setCurrentAction(int index) -{ - Q_D(DDropdown); - if (!d->menu->actions().isEmpty()) { - setCurrentAction(d->menu->actions().at(index)); - } -} - -QAction *DDropdown::addAction(const QString &item, const QVariant &var) -{ - Q_D(DDropdown); - auto action = d->menu->addAction(item); - /*d->menu->addSeparator();*/ - auto font = action->font(); - font.setFamily("SourceHanSansSC"); - font.setWeight(QFont::Medium); - action->setData(var); - action->setCheckable(true); - return action; -} - -void DDropdown::setStatus(QString status) -{ - Q_D(DDropdown); - d->status = status; -} - -void DDropdown::enterEvent(QEvent *event) -{ - setStatus("hover"); - DWidget::enterEvent(event); - - update(); -} - -void DDropdown::leaveEvent(QEvent *event) -{ - setStatus(""); - DWidget::leaveEvent(event); - - update(); -} - -void DDropdown::mouseReleaseEvent(QMouseEvent *event) -{ - if (event->button() == Qt::LeftButton) { - Q_EMIT requestContextMenu(); - } - DWidget::mouseReleaseEvent(event); -} - -DDropdownPrivate::DDropdownPrivate(DDropdown *parent) - : QObject(parent) - , q_ptr(parent) -{ -} - -DDropdownPrivate::~DDropdownPrivate() -{ - if (menu) { - menu->deleteLater(); - menu = nullptr; - } - - if (text) { - text->deleteLater(); - text = nullptr; - } - - if (dropdown) { - dropdown->deleteLater(); - dropdown = nullptr; - } -} diff --git a/deepin-pc-manager/src/widgets/ddropdown.h b/deepin-pc-manager/src/widgets/ddropdown.h deleted file mode 100644 index 34e3d81..0000000 --- a/deepin-pc-manager/src/widgets/ddropdown.h +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2020 ~ 2022 Uniontech Software Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include - -#include - -DWIDGET_USE_NAMESPACE - -class DDropdownPrivate; - -class DDropdown : public DWidget -{ - Q_OBJECT - Q_PROPERTY(QString status READ status WRITE setStatus NOTIFY statusChanged) -public: - explicit DDropdown(QWidget *parent = Q_NULLPTR); - ~DDropdown() override; - -public: - QString status() const; - QList actions() const; - virtual bool eventFilter(QObject *watched, QEvent *event) override; - -signals: - void statusChanged(QString status); - void requestContextMenu(); - void triggeredAll(); - void triggeredInstalled(); - void triggeredUnInstalled(); - -public slots: - void setText(const QString &text); - void setCurrentAction(QAction *action); - void setCurrentAction(int index = 0); - QAction *addAction(const QString &item, const QVariant &var); - void setStatus(QString status); - -protected: - virtual void enterEvent(QEvent *event) override; - virtual void leaveEvent(QEvent *event) override; - virtual void mouseReleaseEvent(QMouseEvent *event) override; - -private: - const QString m_strAllText = tr("All"); - const QString m_strInstallText = tr("Installed"); - const QString m_strUnInstallText = tr("Not installed"); - QAction *m_pAllAction; - QAction *m_pInstalledAction; - QAction *m_pUnInstalledAction; - QScopedPointer d_ptr; - Q_DECLARE_PRIVATE_D(qGetPtrHelper(d_ptr), DDropdown) -}; diff --git a/deepin-pc-manager/src/widgets/dlistviewmulticol/dlistviewmulticol.cpp b/deepin-pc-manager/src/widgets/dlistviewmulticol/dlistviewmulticol.cpp deleted file mode 100644 index 0c55982..0000000 --- a/deepin-pc-manager/src/widgets/dlistviewmulticol/dlistviewmulticol.cpp +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright (C) 2019 ~ 2021 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "dlistviewmulticol.h" - -#include "dlistviewmulticolcommon.h" -#include "dlistviewmulticoldelegate.h" - -#include -#include -#include -#include -#include -#include - -DListViewMultiCol::DListViewMultiCol(QStandardItemModel *model, QWidget *parent) - : DListView(parent) - , m_model(model) - , m_headerWidget(new QWidget(this)) - , m_headerView(new DefenderTableHeaderView(Qt::Orientation::Horizontal, m_headerWidget)) -{ - initUi(); - initConnection(); -} - -DListViewMultiCol::~DListViewMultiCol() { } - -void DListViewMultiCol::setRowHeight(int height) -{ - m_model->setProperty(PROPERTY_KEY_ROW_HEIGHT, height); -} - -void DListViewMultiCol::setItemIconSize(const QSize &size) -{ - m_model->setProperty(PROPERTY_KEY_ITEM_ICON_SIZE, size); -} - -// 设置某列表头下标是否可见 -void DListViewMultiCol::setHeadSortingIndicatorVisible(int col, bool visible) -{ - m_headerView->setSortingIndicatorVisible(col, visible); -} - -// 调整表头各列宽度 -void DListViewMultiCol::resizeHeaderSection(int logicalIndex, int size) -{ - // 使用定时触发,确保所有控件信号已经连接完成 - QTimer::singleShot(1, this, [this, logicalIndex, size] { - m_headerView->resizeSection(logicalIndex, size); - }); -} - -void DListViewMultiCol::resizeEvent(QResizeEvent *event) -{ - Q_UNUSED(event); - // 调整表头位置 - m_headerView->move(m_headerWidget->pos().x() - horizontalScrollBar()->value(), - m_headerWidget->pos().y()); - - // 调整表头高度 - m_headerView->setFixedHeight(m_headerView->sizeHint().height()); - - // 更新表头各列宽度 - updateHeaderWidth(); - - // 使滚动条适应界面 - updateGeometries(); -} - -void DListViewMultiCol::updateGeometries() -{ - // 使滚动条适应界面 - resizeContents(m_headerView->length(), contentsSize().height()); - DListView::updateGeometries(); - - update(); -} - -// 当表头各列宽度改变 -void DListViewMultiCol::updateHeaderWidth() -{ - // 更新表头各列宽度列表 - m_headerWidthList.clear(); - for (int i = 0; i < m_model->columnCount(); ++i) { - m_headerWidthList.append(m_headerView->sectionSize(i)); - } - - // 调整表头宽度 - if (m_headerView->length() != m_headerView->width()) { - m_headerView->setFixedWidth(m_headerView->length()); - } - - // 填充最后一列 - if (m_headerView->stretchLastSection()) { - stretchLastSectionToRightest(); - } - - m_headerWidget->setFixedHeight(m_headerView->sizeHint().height()); - m_headerWidget->setFixedWidth(m_headerView->width()); - - // 设置参数 - m_model->setProperty(PROPERTY_KEY_HEADER_SECTION_WIDTH_LIST, - QVariant::fromValue>(m_headerWidthList)); - - // 使滚动条适应界面 - updateGeometries(); -} - -// 当水平滑动条变动 -void DListViewMultiCol::onHorizontalScrollBarValueChanged(int value) -{ - m_headerView->move(-value, 0); - m_model->setProperty(PROPERTY_KEY_HEADER_X_OFFSET, -value); -} - -// 当排序改变 -void DListViewMultiCol::onHeadViewSortIndicatorChanged(int index, Qt::SortOrder order) -{ - Q_EMIT headViewSortIndicatorChanged(index, order); - // 使滚动条适应界面 - updateGeometries(); -} - -void DListViewMultiCol::initUi() -{ - setModel(m_model); - // ListMode - setViewMode(ViewMode::ListMode); - setItemDelegate(new DListViewMultiColDelegate(this)); - setOrientation(QListView::TopToBottom, false); - setTextElideMode(Qt::ElideMiddle); - setSelectionRectVisible(true); - setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); - setUniformItemSizes(true); - setResizeMode(Fixed); - setSelectionMode(QAbstractItemView::SelectionMode::ExtendedSelection); - setEditTriggers(DListView::EditTrigger::NoEditTriggers); - setFrameShape(QFrame::NoFrame); - setAutoFillBackground(false); - - // headerView - // DListView顶部控件水平和数值位移固定,不受滑动条控制 - // 因此需要在顶部添加一个空控件,来适应实际表头的高 - addHeaderWidget(m_headerWidget); - - // set header view properties - m_headerView->setParent(m_headerWidget); // 为响应表头拖动事件,需设置表头父对象为顶部空控件 - m_headerView->setModel(Q_NULLPTR); - m_headerView->setModel(m_model); - - m_headerView->setStretchLastSection(true); - m_headerView->setHighlightSections(false); - m_headerView->setSectionsClickable(true); - m_headerView->setSortIndicatorShown(true); - m_headerView->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter); - // 表头各部分不可移动 - m_headerView->setSectionsMovable(false); - m_headerView->setSectionResizeMode(QHeaderView::Interactive); - - updateHeaderWidth(); - setRowHeight(48); - setItemIconSize(QSize(18, 18)); -} - -void DListViewMultiCol::initConnection() -{ - // header view connection - // 表头尺寸改变 - connect(m_headerView, &QHeaderView::geometriesChanged, this, [this]() { - m_headerWidget->setFixedHeight(m_headerView->sizeHint().height()); - m_headerWidget->setFixedWidth(m_headerView->length()); - }); - // 表头各列宽度改变 - connect(m_headerView, &QHeaderView::sectionResized, this, [this] { - updateHeaderWidth(); - }); - connect(m_headerView, &QHeaderView::sectionCountChanged, this, [this] { - updateHeaderWidth(); - }); - // 水平滑动条变动 - connect(horizontalScrollBar(), - &QScrollBar::valueChanged, - this, - &DListViewMultiCol::onHorizontalScrollBarValueChanged); - // 排序改变 - connect(m_headerView, - &QHeaderView::sortIndicatorChanged, - this, - &DListViewMultiCol::onHeadViewSortIndicatorChanged); -} - -void DListViewMultiCol::stretchLastSectionToRightest() -{ - // 当表头内容宽度小于界面宽度时,拓展表头控件 - if (m_headerView->length() < width()) { - m_headerView->setFixedWidth(width()); - - // 更新表头各列宽度列表 - m_headerWidthList.clear(); - int rightestSectionWidth = m_headerView->width(); - for (int i = 0; i < m_model->columnCount() - 1; i++) { - rightestSectionWidth -= m_headerView->sectionSize(i); - m_headerWidthList.append(m_headerView->sectionSize(i)); - } - if (rightestSectionWidth > 0) { - m_headerWidthList.append(rightestSectionWidth); - } - } -} diff --git a/deepin-pc-manager/src/widgets/dlistviewmulticol/dlistviewmulticol.h b/deepin-pc-manager/src/widgets/dlistviewmulticol/dlistviewmulticol.h deleted file mode 100644 index 3b80258..0000000 --- a/deepin-pc-manager/src/widgets/dlistviewmulticol/dlistviewmulticol.h +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (C) 2019 ~ 2021 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include "../defendertableheaderview.h" - -#include - -DWIDGET_USE_NAMESPACE - -// class DFrame; -class QHeaderView; - -class DListViewMultiCol : public DListView -{ - Q_OBJECT -public: - explicit DListViewMultiCol(QStandardItemModel *model, QWidget *parent = nullptr); - ~DListViewMultiCol() override; - - void setRowHeight(int height); - void setItemIconSize(const QSize &size); - // 设置某列表头下标是否可见 - void setHeadSortingIndicatorVisible(int col, bool visible); - // 调整表头各列宽度 - void resizeHeaderSection(int logicalIndex, int size); - -protected: - void resizeEvent(QResizeEvent *event) override; - void updateGeometries() override; - -Q_SIGNALS: - void headViewSortIndicatorChanged(int index, Qt::SortOrder order); - -public slots: - // 当表头各列宽度改变 - void updateHeaderWidth(); - // 当水平滑动条变动 - void onHorizontalScrollBarValueChanged(int value); - // 当排序改变 - void onHeadViewSortIndicatorChanged(int index, Qt::SortOrder order); - -private: - void initUi(); - void initConnection(); - void stretchLastSectionToRightest(); - -private: - QStandardItemModel *m_model; - QWidget *m_headerWidget; - DefenderTableHeaderView *m_headerView; - QList m_headerWidthList; // 表头各列宽度列表 -}; diff --git a/deepin-pc-manager/src/widgets/dlistviewmulticol/dlistviewmulticolcommon.h b/deepin-pc-manager/src/widgets/dlistviewmulticol/dlistviewmulticolcommon.h deleted file mode 100644 index ce0776b..0000000 --- a/deepin-pc-manager/src/widgets/dlistviewmulticol/dlistviewmulticolcommon.h +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (C) UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#define PROPERTY_KEY_HEADER_SECTION_WIDTH_LIST \ - "header-section-width-list" // 参数键-表头个列宽度列表 -#define PROPERTY_KEY_ROW_HEIGHT "row-height" // 参数键-每行高度 -#define PROPERTY_KEY_ITEM_ICON_SIZE "item-icon-size" // 参数键-图标尺寸 -#define PROPERTY_KEY_HEADER_X_OFFSET "header-x-offset" // 表头水平偏移 diff --git a/deepin-pc-manager/src/widgets/dlistviewmulticol/dlistviewmulticoldelegate.cpp b/deepin-pc-manager/src/widgets/dlistviewmulticol/dlistviewmulticoldelegate.cpp deleted file mode 100644 index 2dc95b7..0000000 --- a/deepin-pc-manager/src/widgets/dlistviewmulticol/dlistviewmulticoldelegate.cpp +++ /dev/null @@ -1,240 +0,0 @@ -// Copyright (C) 2019 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "dlistviewmulticoldelegate.h" - -#include "dlistviewmulticolcommon.h" - -#include - -#include -#include -#include -#include -#include -#include -#include - -DWIDGET_USE_NAMESPACE - -DListViewMultiColDelegate::DListViewMultiColDelegate(QObject *parent) - : QStyledItemDelegate(parent) -{ -} - -void DListViewMultiColDelegate::paint(QPainter *painter, - const QStyleOptionViewItem &option, - const QModelIndex &index) const -{ - const QAbstractItemModel *ItemModel = index.model(); - - QStyleOptionViewItem styleOption = option; - int left = styleOption.rect.left(); - int top = styleOption.rect.top(); - int width = styleOption.rect.width(); - int height = styleOption.rect.height(); - - // 画背景 - QRect backgroundRect = QRect(left + 5, top, width - 10, height); - // 判断奇偶 - bool drawBackground = ((index.row() & 1) == 1); - if (drawBackground) { - QPainterPath path; - path.addRoundedRect(backgroundRect, 8, 8); - painter->save(); - painter->setOpacity(1); - painter->setRenderHint(QPainter::Antialiasing); - - DPalette pa = DPaletteHelper::instance()->palette(styleOption.widget); - QBrush backgroundBrush = pa.brush(DPalette::ColorType::ItemBackground); - - painter->fillPath(path, backgroundBrush); - painter->restore(); - } - - // 画当鼠标悬浮此处时的背景 - bool isHovering = (QStyle::StateFlag::State_MouseOver & option.state); - if (isHovering) { - QPainterPath path; - path.addRoundedRect(backgroundRect, 8, 8); - painter->save(); - painter->setOpacity(1); - painter->setRenderHint(QPainter::Antialiasing); - - DPalette pa = DPaletteHelper::instance()->palette(styleOption.widget); - QBrush backgroundBrush = pa.brush(DPalette::ColorType::ObviousBackground); - - painter->fillPath(path, backgroundBrush); - painter->restore(); - } - - // 画当被选中时的背景 - bool isSelection = (QStyle::StateFlag::State_Selected & option.state); - if (isSelection) { - QPainterPath path; - path.addRoundedRect(backgroundRect, 8, 8); - painter->save(); - painter->setOpacity(1); - painter->setRenderHint(QPainter::Antialiasing); - - DPalette pa = DPaletteHelper::instance()->palette(styleOption.widget); - QBrush backgroundBrush = pa.brush(DPalette::ColorRole::Highlight); - - painter->fillPath(path, backgroundBrush); - painter->restore(); - } - - // 画本行各列内容 - int leftColWidth = 0; - QFontMetrics fontMetrics = styleOption.fontMetrics; - QList headerWidthList = - ItemModel->property(PROPERTY_KEY_HEADER_SECTION_WIDTH_LIST).value>(); - for (int i = 0; i < headerWidthList.size(); ++i) { - int thisColWidth = headerWidthList[i]; - - // 获取列数据 - QModelIndex colIndex = ItemModel->index(index.row(), i); - - // icon - painter->save(); - int iconSectionWidth = 0; - QVariant decorationVar = ItemModel->data(colIndex, Qt::ItemDataRole::DecorationRole); - bool haveIcon = (QVariant::Type::Icon == decorationVar.type()); - if (haveIcon) { - QIcon icon = ItemModel->data(colIndex, Qt::ItemDataRole::DecorationRole).value(); - QSize iconSize = ItemModel->property(PROPERTY_KEY_ITEM_ICON_SIZE).value(); - int iconYOffset = (height - iconSize.height()) / 2; // 为垂直居中画图标 - int iconLeftSpace = 10; - QRect iconRect(iconLeftSpace + left + leftColWidth, - top + iconYOffset, - iconSize.width(), - iconSize.height()); - iconSectionWidth = iconLeftSpace + iconSize.width(); - icon.paint(painter, iconRect); - } - painter->restore(); - - // 画文字 - // 文字颜色 - painter->save(); - QVariant colorVar = ItemModel->data(colIndex, Qt::ForegroundRole); - if (QVariant::Type::Color == colorVar.type()) { - painter->setPen(colorVar.value()); - } - - // 文字左侧空隙 - int textLeftSpace = 10; - // 判断是否为首列 - if (0 == i) { - textLeftSpace = 18; - } - // 随选中状态设置画笔颜色 - if (isSelection) { - painter->setPen(option.palette.color(QPalette::ColorRole::HighlightedText)); - } - int textYOffset = (height - fontMetrics.height()) / 2; // 为垂直居中画文字 - QRect textRect(left + leftColWidth + iconSectionWidth + textLeftSpace, - top + textYOffset, - thisColWidth - iconSectionWidth - textLeftSpace, - height); - QString displayText = ItemModel->data(colIndex, Qt::ItemDataRole::DisplayRole).toString(); - QString elidedDisplayText = - fontMetrics.elidedText(displayText, - Qt::TextElideMode::ElideMiddle, - thisColWidth - iconSectionWidth - textLeftSpace); - // 为防止文本换行,设置Qt::TextFlag::TextSingleLine属性 - painter->drawText(textRect, Qt::TextFlag::TextSingleLine, elidedDisplayText); - leftColWidth += thisColWidth; - painter->restore(); - } -} - -bool DListViewMultiColDelegate::helpEvent(QHelpEvent *event, - QAbstractItemView *view, - const QStyleOptionViewItem &option, - const QModelIndex &index) -{ - const QAbstractItemModel *ItemModel = index.model(); - if (!ItemModel) { - return QStyledItemDelegate::helpEvent(event, view, option, index); - } - QList headerWidthList = - ItemModel->property(PROPERTY_KEY_HEADER_SECTION_WIDTH_LIST).value>(); - if (event->type() == QEvent::ToolTip) { - int cursorPosX = event->pos().x(); - // 获取表头水平偏移,定表头初始x坐标 - int selectionLeftX = ItemModel->property(PROPERTY_KEY_HEADER_X_OFFSET).toInt(); - int colCurrentPos = 0; - // 判断当前处于的列数 - for (int i = 0; i < headerWidthList.size(); ++i) { - selectionLeftX += headerWidthList[i]; - if (cursorPosX < selectionLeftX) { - colCurrentPos = i; - break; - } - } - // 关闭提示标签 - QWidgetList qwl = QApplication::topLevelWidgets(); - for (QWidget *qw : qwl) { - if (QStringLiteral("QTipLabel") == qw->metaObject()->className()) { - qw->close(); - } - } - - // 重新显示标签 - QModelIndex currentIndex = ItemModel->index(index.row(), colCurrentPos); - const QString tooltip = currentIndex.data(Qt::ToolTipRole).toString(); - if (!tooltip.isEmpty()) { - int tooltipsize = tooltip.size(); - const int nlong = 32; - int lines = tooltipsize / nlong + 1; - QString strtooltip; - for (int i = 0; i < lines; ++i) { - strtooltip.append(tooltip.mid(i * nlong, nlong)); - strtooltip.append("\n"); - } - strtooltip.chop(1); - QToolTip::showText(event->globalPos(), strtooltip, view); - } - - return false; - } - return QStyledItemDelegate::helpEvent(event, view, option, index); -} - -QSize DListViewMultiColDelegate::sizeHint(const QStyleOptionViewItem &option, - const QModelIndex &index) const -{ - // 原始尺寸 - QSize originSize = QStyledItemDelegate::sizeHint(option, index); - // 设定的高度 - int rowHeight = index.model()->property(PROPERTY_KEY_ROW_HEIGHT).toInt(); - - // 为自适应,最小设定高度为原始高度 - if (originSize.height() > rowHeight) { - rowHeight = originSize.height(); - } - - return QSize(originSize.width(), rowHeight); -} - -QWidget *DListViewMultiColDelegate::createEditor(QWidget *parent, - const QStyleOptionViewItem &option, - const QModelIndex &index) const -{ - return QStyledItemDelegate::createEditor(parent, option, index); -} - -void DListViewMultiColDelegate::updateEditorGeometry(QWidget *editor, - const QStyleOptionViewItem &option, - const QModelIndex &index) const -{ - QStyledItemDelegate::updateEditorGeometry(editor, option, index); -} - -void DListViewMultiColDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const -{ - QStyledItemDelegate::setEditorData(editor, index); -} diff --git a/deepin-pc-manager/src/widgets/dlistviewmulticol/dlistviewmulticoldelegate.h b/deepin-pc-manager/src/widgets/dlistviewmulticol/dlistviewmulticoldelegate.h deleted file mode 100644 index 9009001..0000000 --- a/deepin-pc-manager/src/widgets/dlistviewmulticol/dlistviewmulticoldelegate.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once -#include - -class DListViewMultiColDelegate : public QStyledItemDelegate -{ - Q_OBJECT -public: - explicit DListViewMultiColDelegate(QObject *parent = nullptr); - - void paint(QPainter *painter, - const QStyleOptionViewItem &option, - const QModelIndex &index) const Q_DECL_OVERRIDE; - - bool helpEvent(QHelpEvent *event, - QAbstractItemView *view, - const QStyleOptionViewItem &option, - const QModelIndex &index) override; - - QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &) const Q_DECL_OVERRIDE; - QWidget *createEditor(QWidget *parent, - const QStyleOptionViewItem &option, - const QModelIndex &index) const Q_DECL_OVERRIDE; - - void updateEditorGeometry(QWidget *editor, - const QStyleOptionViewItem &option, - const QModelIndex &index) const Q_DECL_OVERRIDE; - void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE; -}; diff --git a/deepin-pc-manager/src/widgets/dlistviewmulticol/dlistviewmulticolframe.cpp b/deepin-pc-manager/src/widgets/dlistviewmulticol/dlistviewmulticolframe.cpp deleted file mode 100644 index 41d9bd6..0000000 --- a/deepin-pc-manager/src/widgets/dlistviewmulticol/dlistviewmulticolframe.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (C) 2019 ~ 2021 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "dlistviewmulticolframe.h" - -#include - -#include -#include - -DListViewMultiColFrame::DListViewMultiColFrame(QStandardItemModel *model, QWidget *parent) - : DFrame(parent) - , m_model(model) - , m_listView(nullptr) -{ - initUi(); - initConnection(); -} - -DListViewMultiColFrame::~DListViewMultiColFrame() { } - -DListViewMultiCol *DListViewMultiColFrame::listViewMultiCol() -{ - return m_listView; -} - -void DListViewMultiColFrame::initUi() -{ - setContentsMargins(1, 1, 1, 1); - setLineWidth(0); - - setBackgroundRole(DPalette::ColorType::ItemBackground); - - QVBoxLayout *mainLayout = new QVBoxLayout(this); - mainLayout->setContentsMargins(0, 0, 0, 0); - setLayout(mainLayout); - - m_listView = new DListViewMultiCol(m_model, this); - QFont f = m_listView->font(); - f.setPixelSize(14); - m_listView->setFont(f); - m_listView->setAccessibleName("listViewFrame_listView"); - mainLayout->addWidget(m_listView); -} - -void DListViewMultiColFrame::initConnection() -{ - connect(m_listView, - &DListViewMultiCol::headViewSortIndicatorChanged, - this, - &DListViewMultiColFrame::headViewSortIndicatorChanged); -} diff --git a/deepin-pc-manager/src/widgets/dlistviewmulticol/dlistviewmulticolframe.h b/deepin-pc-manager/src/widgets/dlistviewmulticol/dlistviewmulticolframe.h deleted file mode 100644 index 1d99bab..0000000 --- a/deepin-pc-manager/src/widgets/dlistviewmulticol/dlistviewmulticolframe.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2019 ~ 2021 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include "dlistviewmulticol.h" - -#include - -DWIDGET_USE_NAMESPACE - -class DListViewMultiColFrame : public DFrame -{ - Q_OBJECT -public: - explicit DListViewMultiColFrame(QStandardItemModel *model, QWidget *parent = nullptr); - ~DListViewMultiColFrame() override; - - DListViewMultiCol *listViewMultiCol(); - -Q_SIGNALS: - void headViewSortIndicatorChanged(int index, Qt::SortOrder order); - -private: - void initUi(); - void initConnection(); - -private: - QStandardItemModel *m_model; - DListViewMultiCol *m_listView; -}; diff --git a/deepin-pc-manager/src/widgets/fixitemwindow.cpp b/deepin-pc-manager/src/widgets/fixitemwindow.cpp deleted file mode 100644 index 3e951c8..0000000 --- a/deepin-pc-manager/src/widgets/fixitemwindow.cpp +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "fixitemwindow.h" - -#include -#include - -#include -#include -#include - -DWIDGET_USE_NAMESPACE - -FixItemWindow::FixItemWindow(bool flag, QWidget *parent) - : QFrame(parent) - , m_bgGroup(nullptr) - , m_leftIcon(nullptr) - , m_leftLabel(nullptr) - , m_rightBtn(nullptr) - , m_isFlag(flag) -{ - QMargins mg(0, 0, 0, 0); - // 因为需要SettingsItem 整体为一个圆角,所有用一个 widget 当背景 - auto bgWidget = new QWidget(this); - - // 将 widget 加入到一个新建的 DBackgroundGroup中 - auto bglayout = new QVBoxLayout; - bglayout->setContentsMargins(mg); - m_bgGroup = new DBackgroundGroup(bglayout, this); - m_bgGroup->setBackgroundRole(QPalette::Window); - - bglayout->addWidget(bgWidget); - - // 将 m_bgGroup 沉底 - m_bgGroup->lower(); - - // 设置m_bgGroup 的大小 - m_bgGroup->setFixedSize(size()); - - QHBoxLayout *mainLayout = new QHBoxLayout; - mainLayout->setSpacing(0); - setLayout(mainLayout); - - m_leftIcon = new QLabel(this); - mainLayout->addWidget(m_leftIcon, 0, Qt::AlignLeft | Qt::AlignCenter); - - m_leftLabel = new QLabel(this); - m_leftLabel->setWordWrap(true); - m_leftLabel->adjustSize(); - // 设置左对齐 - m_leftLabel->setAlignment(Qt::AlignLeft); - mainLayout->addWidget(m_leftLabel, 1); - - m_rightBtn = new DCommandLinkButton("", this); - mainLayout->addWidget(m_rightBtn, 0, Qt::AlignRight); -} - -void FixItemWindow::setIcon(QIcon icon) -{ - m_leftIcon->setPixmap(icon.pixmap(20, 20)); - // m_leftIcon->setAlignment(Qt::AlignLeft); -} - -void FixItemWindow::setText(QString text) -{ - m_leftLabel->setText(text); -} - -void FixItemWindow::setButtonText(QString text, bool flag) -{ - if (flag) { - m_rightBtn->setEnabled(false); - QPalette pal; - pal.setColor(QPalette::ButtonText, Qt::green); - // pal.setColor(QPalette::Background, Qt::transparent); - m_rightBtn->setText(text); - m_rightBtn->setPalette(pal); - } else { - QPalette pal; - pal.setColor(QPalette::ButtonText, QColor(0, 130, 250, 255)); - // pal.setColor(QPalette::Background, Qt::transparent); - m_rightBtn->setText(text); - m_rightBtn->setPalette(pal); - } -} - -DCommandLinkButton *FixItemWindow::getButton() -{ - return m_rightBtn; -} - -// 获得按钮的名字 -QString FixItemWindow::getButtonText() -{ - return m_rightBtn->text(); -} - -void FixItemWindow::resizeEvent(QResizeEvent *event) -{ - QFrame::resizeEvent(event); - - // 设置m_bgGroup 的大小 - if (m_bgGroup) { - m_bgGroup->setFixedSize(size()); - } -} diff --git a/deepin-pc-manager/src/widgets/fixitemwindow.h b/deepin-pc-manager/src/widgets/fixitemwindow.h deleted file mode 100644 index 384891d..0000000 --- a/deepin-pc-manager/src/widgets/fixitemwindow.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once -#include "window/namespace.h" - -#include -#include -#include - -#include -#include -#include -#include - -DWIDGET_USE_NAMESPACE - -class FixItemWindow : public QFrame -{ - Q_OBJECT -public: - FixItemWindow(bool flag, QWidget *parent = nullptr); - void setIcon(QIcon icon); - void setText(QString text); - void setButtonText(QString text, bool flag); - DCommandLinkButton *getButton(); - // 获得按钮的名字 - QString getButtonText(); - -protected: - void resizeEvent(QResizeEvent *event); - -private: - DBackgroundGroup *m_bgGroup; - QLabel *m_leftIcon; - QLabel *m_leftLabel; - DCommandLinkButton *m_rightBtn; - bool m_isFlag; - // DPushButton *m_rightBtn; - // DPushButton *m_rightBtn; -}; diff --git a/deepin-pc-manager/src/widgets/labels/largelabel.h b/deepin-pc-manager/src/widgets/labels/largelabel.h deleted file mode 100644 index 70b620b..0000000 --- a/deepin-pc-manager/src/widgets/labels/largelabel.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef LARGELABEL_H -#define LARGELABEL_H - -#include - -namespace def { -namespace widgets { - -class LargeLabel : public QLabel -{ - Q_OBJECT - -public: - using QLabel::QLabel; // using default inheritance constructor -}; - -} // namespace widgets -} // namespace def - -#endif // LARGELABEL_H diff --git a/deepin-pc-manager/src/widgets/labels/normallabel.h b/deepin-pc-manager/src/widgets/labels/normallabel.h deleted file mode 100644 index 13874fa..0000000 --- a/deepin-pc-manager/src/widgets/labels/normallabel.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef NORMALLABEL_H -#define NORMALLABEL_H - -#include - -namespace def { -namespace widgets { - -class NormalLabel : public QLabel -{ - Q_OBJECT - -public: - using QLabel::QLabel; // using default inheritance constructor -}; - -} // namespace widgets -} // namespace def - -#endif // NORMALLABEL_H diff --git a/deepin-pc-manager/src/widgets/labels/smalllabel.h b/deepin-pc-manager/src/widgets/labels/smalllabel.h deleted file mode 100644 index 55c85fa..0000000 --- a/deepin-pc-manager/src/widgets/labels/smalllabel.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef SMALLLABEL_H -#define SMALLLABEL_H - -#include - -namespace def { -namespace widgets { - -class SmallLabel : public QLabel -{ - Q_OBJECT - -public: - using QLabel::QLabel; // using default inheritance constructor -}; - -} // namespace widgets -} // namespace def - -#endif // SMALLLABEL_H diff --git a/deepin-pc-manager/src/widgets/labels/tipslabel.h b/deepin-pc-manager/src/widgets/labels/tipslabel.h deleted file mode 100644 index 6b30fc0..0000000 --- a/deepin-pc-manager/src/widgets/labels/tipslabel.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef TIPSLABEL_H -#define TIPSLABEL_H - -#include "smalllabel.h" - -namespace def { -namespace widgets { - -class TipsLabel : public SmallLabel -{ - Q_OBJECT -public: - using SmallLabel::SmallLabel; // using default inheritance constructor -}; - -} // namespace widgets -} // namespace def - -#endif // TIPSLABEL_H diff --git a/deepin-pc-manager/src/widgets/menuitem.cpp b/deepin-pc-manager/src/widgets/menuitem.cpp deleted file mode 100644 index f776121..0000000 --- a/deepin-pc-manager/src/widgets/menuitem.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2021 ~ 2021 Uniontech Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "menuitem.h" - -MenuItem::MenuItem(int iMenuId, const QString &strMenuName, bool bIsChecked /* = false */) - : m_iMenuId(iMenuId) - , m_strMenuName(strMenuName) - , m_bIsChecked(bIsChecked) -{ -} - -MenuItem::MenuItem() -{ - m_iMenuId = -1; - m_strMenuName = QString(""); - m_bIsChecked = false; -} - -MenuItem::MenuItem(const MenuItem &menuItem) -{ - m_iMenuId = menuItem.GetMenuId(); - m_strMenuName = menuItem.GetMenuName(); - m_bIsChecked = menuItem.GetIsChecked(); -} - -MenuItem::~MenuItem() { } - -int MenuItem::GetMenuId() const -{ - return m_iMenuId; -} - -void MenuItem::SetMenuId(int iValue) -{ - m_iMenuId = iValue; -} - -QString MenuItem::GetMenuName() const -{ - return m_strMenuName; -} - -void MenuItem::SetMenuName(const QString &strValue) -{ - m_strMenuName = strValue; -} - -// 返回当前控件是否被选中 -bool MenuItem::GetIsChecked() const -{ - return m_bIsChecked; -} - -void MenuItem::SetIsChecked(bool bValue) -{ - m_bIsChecked = bValue; -} diff --git a/deepin-pc-manager/src/widgets/menuitem.h b/deepin-pc-manager/src/widgets/menuitem.h deleted file mode 100644 index 91dc88a..0000000 --- a/deepin-pc-manager/src/widgets/menuitem.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (C) 2021 ~ 2021 Uniontech Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef MENUITEM_H -#define MENUITEM_H - -#include - -class MenuItem -{ -public: - MenuItem(int iMenuId, const QString &strMenuName, bool bIsChecked = false); - MenuItem(); - ~MenuItem(); - - MenuItem(const MenuItem &menuItem); - int GetMenuId() const; - void SetMenuId(int iValue); - - QString GetMenuName() const; - void SetMenuName(const QString &strValue); - - bool GetIsChecked() const; - void SetIsChecked(bool bValue); - -private: - int m_iMenuId; - QString m_strMenuName; - bool m_bIsChecked; -}; - -#endif // MENUITEM_H diff --git a/deepin-pc-manager/src/widgets/multicombox.cpp b/deepin-pc-manager/src/widgets/multicombox.cpp deleted file mode 100644 index e15fd26..0000000 --- a/deepin-pc-manager/src/widgets/multicombox.cpp +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright (C) 2021 ~ 2021 Uniontech Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "multicombox.h" - -#include "menuitem.h" - -#include -#include -#include -#include -#include - -MultiComBox::MultiComBox(QWidget *parent) - : QComboBox(parent) -{ - this->setStyleSheet("QComboBox {combobox-popup: 0;}"); - this->view()->setMaximumHeight(200); - - // 为 ComBox 设置编辑框 - m_pLineEdit = new QLineEdit(this); - m_pLineEdit->setReadOnly(true); - this->setLineEdit(m_pLineEdit); - - // 设置 ComBox 下拉界面 - m_pListView = new QListView(this); - QFont f = m_pListView->font(); - f.setPixelSize(14); - m_pListView->setFont(f); - m_pListView->installEventFilter(this); - this->setView(m_pListView); - - // 设置 ComBox 数据模型 - m_pItemModel = new QStandardItemModel(this); - this->setModel(m_pItemModel); - - connect(m_pListView, &QListView::pressed, this, &MultiComBox::sltActivated); -} - -MultiComBox::~MultiComBox() { } - -//************************************************* -// Function: AddItems -// Description: 添加下拉菜单内容 -// Input: menus:菜单内容列表 -// Return: 若中途执行失败,则返回false,中断操作;否则,返回真,继续后续操作 -//************************************************* -void MultiComBox::addItems(QList menus) -{ - QStandardItem *pNewItem; - foreach (MenuItem *pMenuItem, menus) { - if (pMenuItem == nullptr) { - // 释放内存 - delete pMenuItem; - pMenuItem = nullptr; - continue; - } - pNewItem = new QStandardItem(pMenuItem->GetMenuName()); - pNewItem->setCheckState(pMenuItem->GetIsChecked() ? Qt::Checked : Qt::Unchecked); - pNewItem->setData(pMenuItem->GetMenuId()); - m_pItemModel->appendRow(pNewItem); - - // 释放内存 - delete pMenuItem; - pMenuItem = nullptr; - } -} - -QStringList MultiComBox::getItemsText() -{ - QStringList strs; - QString str = m_pLineEdit->text(); - if (!str.isEmpty()) { - strs = str.split(";"); - } - return strs; -} - -QList MultiComBox::getItemsId() -{ - QList ids; - for (int i = 0; i < m_pItemModel->rowCount(); i++) { - QStandardItem *item = m_pItemModel->item(i); - if (item->checkState() == Qt::Checked) { - ids << item->data().toInt(); - } - } - return ids; -} - -//************************************************* -// Function: hidePopup -// Description: 根据鼠标相应位置,判断是否隐藏下拉菜单 -//************************************************* -void MultiComBox::hidePopup() -{ - int width = this->view()->width(); - int height = this->view()->height(); - int x = QCursor::pos().x() - mapToGlobal(geometry().topLeft()).x() + geometry().x(); - int y = QCursor::pos().y() - mapToGlobal(geometry().topLeft()).y() + geometry().y(); - - QRect rectView(0, this->height(), width, height); - if (!rectView.contains(x, y) && this->view()->isVisible()) { - QComboBox::hidePopup(); - updateText(); - - // 发送全部已选选项的index 用于日志 - QList listIndex; - for (int i = 0; i < m_pItemModel->rowCount(); i++) { - QStandardItem *item = m_pItemModel->item(i); - if (item->checkState() == Qt::Checked) { - listIndex.append(i); - } - } - Q_EMIT sendSelected(listIndex); - } -} - -//************************************************* -// Function: UpdateText -// Description: 更新lineedit文本 -//************************************************* -void MultiComBox::updateText() -{ - QStringList strs; - for (int i = 0; i < m_pItemModel->rowCount(); i++) { - QStandardItem *item = m_pItemModel->item(i); - if (item->checkState() == Qt::Checked) { - strs << item->text(); - } - } - m_pLineEdit->setText(strs.join(";")); - m_pLineEdit->setToolTip(strs.join("\n")); -} - -void MultiComBox::sltActivated(const QModelIndex &index) -{ - QStandardItem *item = m_pItemModel->item(index.row()); - Qt::CheckState checkState = item->checkState() == Qt::Checked ? Qt::Unchecked : Qt::Checked; - item->setCheckState(checkState); -} - -void MultiComBox::setActivated(int row) -{ - QStandardItem *item = m_pItemModel->item(row); - Qt::CheckState checkState = Qt::Checked; - item->setCheckState(checkState); - - // 每次初始化显示全部日期 - updateText(); -} - -QString MultiComBox::getSelectedRows() -{ - QStringList strs; - for (int i = 0; i < m_pItemModel->rowCount(); i++) { - QStandardItem *item = m_pItemModel->item(i); - if (item->checkState() == Qt::Checked) { - strs << QString::number(i); - } - } - - return strs.join(";"); -} - -QString MultiComBox::getSelectedIndexs() -{ - QStringList strs; - for (int i = 0; i < m_pItemModel->rowCount(); i++) { - QStandardItem *item = m_pItemModel->item(i); - if (item->checkState() == Qt::Checked) { - strs << QString::number(i); - } else if (item->checkState() == Qt::Unchecked) { - strs.removeOne(QString::number(i)); - } - } - return strs.join(";"); -} diff --git a/deepin-pc-manager/src/widgets/multicombox.h b/deepin-pc-manager/src/widgets/multicombox.h deleted file mode 100644 index adb87b0..0000000 --- a/deepin-pc-manager/src/widgets/multicombox.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (C) 2021 ~ 2021 Uniontech Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef MULTICOMBOX_H -#define MULTICOMBOX_H - -#include -#include - -class MenuItem; -class QLineEdit; -class QListView; -class QStandardItemModel; - -class MultiComBox : public QComboBox -{ - Q_OBJECT - -public: - explicit MultiComBox(QWidget *parent = nullptr); - ~MultiComBox() override; - - // 添加Iiem - void addItems(QList menus); - - QStringList getItemsText(); - QList getItemsId(); - - void setActivated(int row); - QString getSelectedRows(); - QString getSelectedIndexs(); - -Q_SIGNALS: - void sendSelected(QList list); - -private: - void updateText(); - -public Q_SLOTS: - void sltActivated(const QModelIndex &index); - -protected: - void hidePopup() override; - -private: - QList m_Menus; - QLineEdit *m_pLineEdit; - QListView *m_pListView; - QStandardItemModel *m_pItemModel; -}; - -#endif // MULTICOMBOX_H diff --git a/deepin-pc-manager/src/widgets/passwordedit.cpp b/deepin-pc-manager/src/widgets/passwordedit.cpp deleted file mode 100644 index bc6c4b0..0000000 --- a/deepin-pc-manager/src/widgets/passwordedit.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) 2019 ~ 2021 Uniontech Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "widgets/passwordedit.h" - -#include - -DWIDGET_USE_NAMESPACE - -PasswordEdit::PasswordEdit(QWidget *parent) - : DPasswordEdit(parent) -{ - lineEdit()->setAcceptDrops(false); - lineEdit()->setContextMenuPolicy(Qt::NoContextMenu); - lineEdit()->installEventFilter(this); -} - -bool PasswordEdit::eventFilter(QObject *obj, QEvent *event) -{ - if (obj == lineEdit() && event->type() == QEvent::KeyPress) { - QKeyEvent *e = dynamic_cast(event); - if (e - && (e->matches(QKeySequence::Copy) || e->matches(QKeySequence::Cut) - || e->matches(QKeySequence::Paste))) { - return true; - } - } - - return DPasswordEdit::eventFilter(obj, event); -} diff --git a/deepin-pc-manager/src/widgets/passwordedit.h b/deepin-pc-manager/src/widgets/passwordedit.h deleted file mode 100644 index a712095..0000000 --- a/deepin-pc-manager/src/widgets/passwordedit.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (C) 2019 ~ 2021 Uniontech Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef DCC_PASSWORDEDIT_H -#define DCC_PASSWORDEDIT_H - -#include - -class PasswordEdit : public DTK_WIDGET_NAMESPACE::DPasswordEdit -{ - Q_OBJECT -public: - explicit PasswordEdit(QWidget *parent = 0); - -protected: - bool eventFilter(QObject *, QEvent *) override; -}; -#endif // DCC_TRANSLUCENTFRAME_H diff --git a/deepin-pc-manager/src/widgets/safetyprotectionitem.cpp b/deepin-pc-manager/src/widgets/safetyprotectionitem.cpp deleted file mode 100644 index 9c908ee..0000000 --- a/deepin-pc-manager/src/widgets/safetyprotectionitem.cpp +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (C) 2020 ~ 2020 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "safetyprotectionitem.h" - -#include -#include -#include - -#include -#include -#include -#include - -SafetyProtectionItem::SafetyProtectionItem(QWidget *parent) - : DFrame(parent) - , m_lbText(new DLabel(this)) - , m_lbTextNull(new DLabel(this)) - , m_switchButton(new DSwitchButton(this)) - , m_bTestClick(false) -{ - // DFrame - QHBoxLayout *mainLayout = new QHBoxLayout; - mainLayout->setContentsMargins(0, 0, 0, 0); - setLayout(mainLayout); - - // QWidget and layout - m_firstLayerWidgt = new QWidget(this); - mainLayout->addWidget(m_firstLayerWidgt); - QHBoxLayout *firstLayerLayout = new QHBoxLayout; - firstLayerLayout->setContentsMargins(10, 0, 10, 0); - - // 设置文本属性 - m_lbText->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - DFontSizeManager::instance()->bind(m_lbText, DFontSizeManager::T8); - m_lbTextNull->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); - - // 加入文本和开关 - firstLayerLayout->addWidget(m_lbText); - firstLayerLayout->addWidget(m_lbTextNull); - firstLayerLayout->addWidget(m_switchButton); - - connect(m_switchButton, &DSwitchButton::pressed, this, &SafetyProtectionItem::switchPressed); - connect(m_switchButton, &DSwitchButton::toggled, this, &SafetyProtectionItem::switchChanged); - - m_firstLayerWidgt->setLayout(firstLayerLayout); - - setBackgroundRole(DPalette::ItemBackground); - // 设置边框的宽度 - setLineWidth(0); - setFixedHeight(36); - - this->setMouseTracking(true); - m_firstLayerWidgt->setMouseTracking(true); - m_lbText->setMouseTracking(true); -} - -SafetyProtectionItem::~SafetyProtectionItem() { } - -// 设置相关标签名称 -void SafetyProtectionItem::setAccessibleParentText(QString sAccessibleName) -{ - m_firstLayerWidgt->setAccessibleName(sAccessibleName + "_backGroundWidget"); - m_switchButton->setAccessibleName(sAccessibleName + "_backGroundWidget_switchButton"); - m_lbText->setAccessibleName(sAccessibleName + "_backGroundWidget_textLable"); - m_lbTextNull->setAccessibleName(sAccessibleName + "_backGroundWidget_textNullLable"); -} - -DSwitchButton *SafetyProtectionItem::getSwitchBtn() -{ - return m_switchButton; -} - -// 子类重写 -void SafetyProtectionItem::resetUI() -{ - // 子类重写该方法以调整UI形式 - // 不要在这里加入代码 -} - -// 设置标题 -void SafetyProtectionItem::setText(QString text) -{ - m_lbText->setText(text); -} - -// 设置标题可以点击 -void SafetyProtectionItem::setTextClick() -{ - m_bTestClick = true; - - // 字体样式 - QPalette pal; - pal.setColor(QPalette::Text, QColor("#0082FA")); - m_lbText->setPalette(pal); -} - -// button status -void SafetyProtectionItem::setSwitchStatus(bool isbStatus) -{ - m_switchButton->setChecked(isbStatus); -} - -void SafetyProtectionItem::enableSwitch(bool enable) -{ - m_switchButton->setEnabled(enable); -} - -void SafetyProtectionItem::mouseMoveEvent(QMouseEvent *event) -{ - Q_UNUSED(event); - if (m_lbText->geometry().contains(this->mapFromGlobal(QCursor::pos())) && m_bTestClick) { - setCursor(Qt::PointingHandCursor); - } else { - setCursor(Qt::ArrowCursor); - } -} - -void SafetyProtectionItem::mousePressEvent(QMouseEvent *event) -{ - Q_UNUSED(event); - if (m_lbText->geometry().contains(this->mapFromGlobal(QCursor::pos())) && m_bTestClick) { - Q_EMIT sendTextClickedChange(); - } -} diff --git a/deepin-pc-manager/src/widgets/safetyprotectionitem.h b/deepin-pc-manager/src/widgets/safetyprotectionitem.h deleted file mode 100644 index 5912479..0000000 --- a/deepin-pc-manager/src/widgets/safetyprotectionitem.h +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include "dtkwidget_global.h" -#include "window/namespace.h" - -#include -#include -#include -#include - -#include -#include -#include -#include - -DWIDGET_USE_NAMESPACE - -class SafetyProtectionItem : public DFrame -{ - Q_OBJECT -public: - explicit SafetyProtectionItem(QWidget *parent = nullptr); - virtual ~SafetyProtectionItem(); - - // 设置标题 - void setText(QString text); - - // 设置标题可以点击 - void setTextClick(); - - // 设置开关状态 - virtual void setSwitchStatus(bool isbStatus); - void enableSwitch(bool enable); - - // 设置相关标签名称 - void setAccessibleParentText(QString sAccessibleName); - - DSwitchButton *getSwitchBtn(); - // 复用 - // 不修改本类的情况下,改变layout与字体 - // 子类自行实现 - virtual void resetUI(); - -Q_SIGNALS: - // 标题点击信号 - void sendTextClickedChange(); - - // 点击 - void switchPressed(); - - // 按钮状态转换 - void switchChanged(bool gStatus); - -protected: - void mouseMoveEvent(QMouseEvent *event); - void mousePressEvent(QMouseEvent *event); - -private: - QWidget *m_firstLayerWidgt; - DLabel *m_lbText; - DLabel *m_lbTextNull; - DSwitchButton *m_switchButton; - bool m_bTestClick; -}; diff --git a/deepin-pc-manager/src/widgets/scansize.cpp b/deepin-pc-manager/src/widgets/scansize.cpp deleted file mode 100644 index bca27ba..0000000 --- a/deepin-pc-manager/src/widgets/scansize.cpp +++ /dev/null @@ -1,98 +0,0 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "scansize.h" - -#include "../window/modules/common/common.h" - -#include -#include -#include -#include -#include -#include -#include - -ScanSize::ScanSize(QWidget *parent) - : QWidget(parent) - , m_context(new QLabel(this)) - , m_unit(new QLabel(this)) - , m_pLineEdit(new DLineEdit(this)) - , m_check(new QCheckBox(this)) -{ - this->setContentsMargins(0, 0, 0, 0); - // 布局 - QHBoxLayout *layout = new QHBoxLayout(this); - layout->setContentsMargins(0, 0, 0, 0); - layout->setSpacing(5); - m_context->setText(tr("Do not scan archives larger than")); - m_unit->setText("MB(20-5120)"); - m_pLineEdit->setText("20"); - m_pLineEdit->lineEdit()->setValidator( - new QRegularExpressionValidator(QRegularExpression("0|[1-9]\\d{0,3}"), m_pLineEdit)); - // 不可以编辑 - m_pLineEdit->setEnabled(false); - layout->addWidget(m_check); - layout->addWidget(m_context); - layout->addSpacing(5); - layout->addWidget(m_pLineEdit); - layout->addWidget(m_unit); - layout->addStretch(0); - this->setLayout(layout); - // 信号绑定 - connect(m_pLineEdit, &DLineEdit::textChanged, this, &ScanSize::lineEditChange); - connect(m_pLineEdit, &DLineEdit::focusChanged, this, &ScanSize::focusChanged); - connect(m_check, &QCheckBox::stateChanged, this, &ScanSize::checkBoxChange); -} - -// 设置大小 -void ScanSize::setSize(int val) -{ - m_pLineEdit->setText(QString("%1").arg(val)); -} - -// 设置选择框 -void ScanSize::setcheckbox(bool status) -{ - m_check->setChecked(status); - // 勾选了输入框可以编辑 不够选不可以编辑 - m_pLineEdit->setEnabled(status); -} - -// 选择框的改变 -void ScanSize::checkBoxChange(int status) -{ - m_pLineEdit->setEnabled(m_check->isChecked()); - emit notifyCheckBoxChange(status); -} - -// 编辑改变 -void ScanSize::lineEditChange(QString str) -{ - if ((str == "") || (m_pLineEdit->text().toInt() < MIN_SCAN) - || (m_pLineEdit->text().toInt() > MAX_SCAN)) { - // 该注释下一版需要,暂时不删 - // m_pLineEdit->showAlertMessage(tr("Limited between 20-5120"), this->parentWidget(), -1); - m_pLineEdit->setAlert(true); - m_pLineEdit->setAlertMessageAlignment(Qt::AlignLeft); - } else { - m_pLineEdit->setAlert(false); - m_pLineEdit->hideAlertMessage(); - } -} - -// 焦点改变 -void ScanSize::focusChanged(bool change) -{ - // 失去焦点 代表输入完成 - if (!change) { - // 判断输入范围 默认都是在范围中 - if ((m_pLineEdit->text().toInt() <= MIN_SCAN) || (m_pLineEdit->text() == "")) { - setSize(MIN_SCAN); - } else if (m_pLineEdit->text().toInt() >= MAX_SCAN) { - setSize(MAX_SCAN); - } - emit notifyInputFinised(m_pLineEdit->text().toInt()); - } -} diff --git a/deepin-pc-manager/src/widgets/scansize.h b/deepin-pc-manager/src/widgets/scansize.h deleted file mode 100644 index 07b41d4..0000000 --- a/deepin-pc-manager/src/widgets/scansize.h +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (C) 2020 ~ 2020 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef SCANSIZE_H -#define SCANSIZE_H - -#include - -#include - -class QLabel; -class QLineEdit; -class QCheckBox; - -DWIDGET_USE_NAMESPACE - -/** - * @brief 自定义设置窗口中大小设置 - */ -class ScanSize : public QWidget -{ - Q_OBJECT -public: - explicit ScanSize(QWidget *parent = nullptr); - - // 设置大小 - void setSize(int val); - // 设置选择框 - void setcheckbox(bool status); - // 选择框的改变 - void checkBoxChange(int status); - - // 编辑改变 - void lineEditChange(QString str); - - // 焦点改变 - void focusChanged(bool change); - -signals: - // 发送结束完成的信号 - void notifyInputFinised(int val); - - // 选择框的状态信号 - void notifyCheckBoxChange(int status); - -private: - QLabel *m_context; // 内容 - QLabel *m_unit; // 单位 - DLineEdit *m_pLineEdit; // 编辑器 - QCheckBox *m_check; // 选择框 -}; - -#endif // SCANSIZE_H diff --git a/deepin-pc-manager/src/widgets/scorebar.cpp b/deepin-pc-manager/src/widgets/scorebar.cpp deleted file mode 100644 index b8c5050..0000000 --- a/deepin-pc-manager/src/widgets/scorebar.cpp +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "scorebar.h" - -#include - -#include -#include -#include -#include - -DWIDGET_USE_NAMESPACE - -ScoreBar::ScoreBar(QWidget *parent) - : QWidget(parent) -{ - m_minValue = 0; - m_maxValue = 100; - m_value = 50; - - m_nullPosition = 90; - m_lineWidth = 7; - - m_showFree = false; - m_showSmallCircle = false; - m_clockWise = true; - - m_usedColor = QColor(100, 184, 255); - m_freeColor = QColor(100, 100, 100); - m_circleColor = QColor(70, 70, 70); - - QHBoxLayout *centralLayout = new QHBoxLayout; - centralLayout->setAlignment(Qt::AlignCenter); - setLayout(centralLayout); -} - -ScoreBar::~ScoreBar() { } - -void ScoreBar::paintEvent(QPaintEvent *) -{ - int width = this->width(); - int height = this->height(); - int side = qMin(width, height); - int radius = 99; - - // 绘制准备 - QPainter painter(this); - painter.setRenderHints(QPainter::Antialiasing - | QPainter::TextAntialiasing); // 设置渲染特性:反锯齿 - painter.translate(width / 2.0, height / 2.0); - painter.scale(side / 200.0, side / 200.0); - - // 绘制中心圆 - drawCircle(&painter, radius); - - // 绘制圆弧边框 - drawArc(&painter, radius); - - // 绘制水池进度 - drawPolo(&painter, radius); -} - -void ScoreBar::drawCircle(QPainter *painter, int radius) -{ - radius = radius - m_lineWidth * 3 / 2; - - painter->save(); - painter->setPen(Qt::NoPen); - painter->setBrush(m_circleColor); - painter->drawEllipse(-radius, -radius, radius * 2, radius * 2); // 原点为左上角 - painter->restore(); -} - -void ScoreBar::drawArc(QPainter *painter, int radius) -{ - radius = radius - m_lineWidth; - painter->save(); - painter->setBrush(Qt::NoBrush); - - QPen pen = painter->pen(); - pen.setWidthF(m_lineWidth); - - // 设置线条风格 - pen.setCapStyle(Qt::RoundCap); - - double arcLength = 360.0 / (m_maxValue - m_minValue) * m_value; // ° - QRect rect(-radius, -radius, radius * 2, radius * 2); - - // 圆弧进度框增长方向(顺时针或逆时针) - if (!m_clockWise) - arcLength = -arcLength; - - // 绘制剩余圆弧进度 - if (m_showFree) { - pen.setColor(m_freeColor); - painter->setPen(pen); - painter->drawArc(rect, (m_nullPosition - arcLength) * 16, -(360 - arcLength) * 16); - } - - // 绘制当前进度 - pen.setColor(m_usedColor); - painter->setPen(pen); - painter->drawArc(rect, m_nullPosition * 16, -arcLength * 16); - - // 绘制当前进度圆弧两端小圆 - if (m_showSmallCircle) { - int offset = radius - m_lineWidth + 1; - radius = m_lineWidth / 2 - 1; - painter->rotate(-m_nullPosition - 90); - - QRect circleRect(-radius, radius + offset, radius * 2, radius * 2); - painter->rotate(arcLength); - painter->drawEllipse(circleRect); - } - - painter->restore(); -} - -void ScoreBar::drawPolo(QPainter *painter, int radius) -{ - radius = radius - m_lineWidth * 5 / 2; - painter->save(); - - // 计算当前值所占百分比对应高度 - double poloHeight = (double)radius / (m_maxValue - m_minValue) * m_value; - - // 大圆路径 - QPainterPath bigPath; - bigPath.addEllipse(-radius, -radius, radius * 2, radius * 2); - - // 底部水池所占矩形区域 - QPainterPath smallPath; - smallPath.addRect(-radius, radius - poloHeight * 2, radius * 2, poloHeight * 2); - - // 提取两个路径重合部分 - QPainterPath path; - path = bigPath.intersected(smallPath); - - painter->setPen(m_usedColor); - painter->setBrush(m_usedColor); - painter->drawPath(path); - - painter->restore(); -} - -QSize ScoreBar::sizeHint() const -{ - return QSize(200, 200); -} - -QSize ScoreBar::minimumSizeHint() const -{ - return QSize(10, 10); -} - -void ScoreBar::setValue(int value) -{ - // 值小于最小值或者值大于最大值或者值和当前值一致则无需处理 - if (value < m_minValue || value > m_maxValue || value == m_value) { - return; - } - - m_value = value; - update(); -} - -void ScoreBar::setUsedColor(const QColor &usedColor) -{ - if (m_usedColor != usedColor) { - m_usedColor = usedColor; - update(); - } -} - -void ScoreBar::setFreeColor(const QColor &freeColor) -{ - if (m_freeColor != freeColor) { - m_freeColor = freeColor; - update(); - } -} - -void ScoreBar::setCircleColor(const QColor &circleColor) -{ - if (m_circleColor != circleColor) { - m_circleColor = circleColor; - update(); - } -} diff --git a/deepin-pc-manager/src/widgets/scorebar.h b/deepin-pc-manager/src/widgets/scorebar.h deleted file mode 100644 index 863a2b6..0000000 --- a/deepin-pc-manager/src/widgets/scorebar.h +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef SCOREBAR_H -#define SCOREBAR_H - -#include "window/namespace.h" - -#include - -DEF_NAMESPACE_BEGIN -DEF_ANTIVIRUS_NAMESPACE_BEGIN - -class ScoreBar : public QWidget -{ - Q_OBJECT -public: - explicit ScoreBar(QWidget *parent = nullptr); - ~ScoreBar(); - -protected: - void paintEvent(QPaintEvent *); - void drawCircle(QPainter *painter, int radius); - void drawArc(QPainter *painter, int radius); - void drawPolo(QPainter *painter, int radius); - -private: - int m_maxValue; // 最大值 - int m_minValue; // 最小值 - int m_value; - - int m_nullPosition; // 起始角度 - int m_lineWidth; // 线条宽度 - - bool m_showFree; // 是否显示未使用进度 - bool m_showSmallCircle; // 是否显示小圆 - bool m_clockWise; // 顺时针 - - QColor m_usedColor; // 已使用百分比颜色 - QColor m_freeColor; // 未使用百分比颜色 - QColor m_circleColor; // 圆颜色 - -public: - QSize sizeHint() const; - QSize minimumSizeHint() const; - -public Q_SLOTS: - // 设置目标值 - void setValue(int value); - - // 设置已使用百分比颜色 - void setUsedColor(const QColor &usedColor); - // 设置未使用百分比颜色 - void setFreeColor(const QColor &freeColor); - // 设置圆颜色 - void setCircleColor(const QColor &circleColor); -}; - -DEF_ANTIVIRUS_NAMESPACE_END -DEF_NAMESPACE_END - -#endif // SCOREBAR_H diff --git a/deepin-pc-manager/src/widgets/scoreprogressbar.cpp b/deepin-pc-manager/src/widgets/scoreprogressbar.cpp deleted file mode 100644 index 97c5311..0000000 --- a/deepin-pc-manager/src/widgets/scoreprogressbar.cpp +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "scoreprogressbar.h" - -#include -#include -#include -#include - -// 单个矩形条宽 -const int SingleRectangleWidth = 60; -// 单个矩形条高 -const qreal SingleRectangleHeight = 11.0; -// 整体最小宽 -const qreal MiniWidth = SingleRectangleWidth * 3 + 20.0; -// 背景颜色 -const QColor BackgroundColor(229, 229, 229); - -ScoreProgressBar::ScoreProgressBar(QWidget *parent) - : QWidget(parent) - , m_valueAnimation(nullptr) -{ - setContentsMargins(0, 0, 0, 0); - setBackgroundRole(QPalette::Window); - - m_currentValue = 0; - m_value = 100; - m_color = BackgroundColor; - - // 进度条数值动画 - m_valueAnimation = new QPropertyAnimation(this, "currentValue", this); -} - -ScoreProgressBar::~ScoreProgressBar() { } - -// 设置当前显示值 -void ScoreProgressBar::setCurrentValue(int value) -{ - m_currentValue = value; - update(); -} - -// 获取当前显示值 -int ScoreProgressBar::currentValue() const -{ - return m_currentValue; -} - -void ScoreProgressBar::setValue(int value) -{ - m_value = value; - // 计算动画间隔 - int duration = VALUE_CHANGE_INTERVAL_MS * qAbs(m_value - m_currentValue); - m_valueAnimation->setDuration(duration); - // 起始值 - m_valueAnimation->setStartValue(m_currentValue); - // 终止值 - m_valueAnimation->setEndValue(m_value); - m_valueAnimation->start(); -} - -void ScoreProgressBar::resizeEvent(QResizeEvent *event) -{ - QWidget::resizeEvent(event); - setFixedSize(size()); -} - -QSize ScoreProgressBar::minimumSizeHint() const -{ - return QSize(MiniWidth, SingleRectangleHeight); -} - -void ScoreProgressBar::paintEvent(QPaintEvent *) -{ - int scaleWidth = this->width(); - int scaleHeight = this->height(); - if (MiniWidth > scaleWidth) - scaleWidth = MiniWidth; // 放大比例不能小于1 - if (SingleRectangleHeight > scaleHeight) - scaleHeight = SingleRectangleHeight; - - QPainter painter(this); - painter.setRenderHints(QPainter::Antialiasing - | QPainter::TextAntialiasing); // 设置渲染特性:反锯齿 - painter.scale(scaleWidth / MiniWidth, scaleHeight / SingleRectangleHeight); - painter.save(); - - // 三个圆角矩形尺寸 - QRect rect1(1, 1, SingleRectangleWidth - 1, SingleRectangleHeight - 1); - QRect rect2(1 + SingleRectangleWidth + 10, - 1, - SingleRectangleWidth - 1, - SingleRectangleHeight - 1); - - // 绘制当前进度 - painter.setBrush(m_color); - painter.setPen(Qt::NoPen); - - double percent = m_currentValue / 100.0; - if (0.33 >= percent) { - int width = int(SingleRectangleWidth * 3 * percent); - QRect rect(1, 1, width, SingleRectangleHeight - 1); - painter.drawRoundedRect(rect, 2, 2); - } else if (0.67 >= percent) { - painter.drawRoundedRect(rect1, 2, 2); - int width = int(SingleRectangleWidth * 3 * (percent - 0.33) - 1); - QRect rect(1 + SingleRectangleWidth + 10, 1, width, SingleRectangleHeight - 1); - painter.drawRoundedRect(rect, 2, 2); - } else { - painter.drawRoundedRect(rect1, 2, 2); - painter.drawRoundedRect(rect2, 2, 2); - int width = int(SingleRectangleWidth * 3 * (percent - 0.66) - 1); - QRect rect(1 + SingleRectangleWidth * 2 + 10 * 2, 1, width, SingleRectangleHeight - 1); - painter.drawRoundedRect(rect, 2, 2); - } - - painter.restore(); -} diff --git a/deepin-pc-manager/src/widgets/scoreprogressbar.h b/deepin-pc-manager/src/widgets/scoreprogressbar.h deleted file mode 100644 index df6ce62..0000000 --- a/deepin-pc-manager/src/widgets/scoreprogressbar.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include "window/namespace.h" - -#include - -class QPropertyAnimation; - -#define VALUE_CHANGE_INTERVAL_MS 20 - -DEF_NAMESPACE_BEGIN -DEF_ANTIVIRUS_NAMESPACE_BEGIN - -class ScoreProgressBar : public QWidget -{ - Q_OBJECT - Q_PROPERTY(int currentValue READ currentValue WRITE setCurrentValue USER true) -public: - explicit ScoreProgressBar(QWidget *parent = nullptr); - ~ScoreProgressBar(); - - QSize minimumSizeHint() const; - // 设置当前显示值 - void setCurrentValue(int value); - // 获取当前显示值 - int currentValue() const; - void setValue(int value); - - inline void setColor(QColor color) { m_color = color; } - -protected: - void paintEvent(QPaintEvent *); - void resizeEvent(QResizeEvent *event); - -private: - // 当前显示值 - int m_currentValue; - // 设定值 - int m_value; - // 进度条颜色 - QColor m_color; - // 进度条数值动画 - QPropertyAnimation *m_valueAnimation; -}; - -DEF_ANTIVIRUS_NAMESPACE_END -DEF_NAMESPACE_END diff --git a/deepin-pc-manager/src/widgets/searchlineedit/animatedlineedit.cpp b/deepin-pc-manager/src/widgets/searchlineedit/animatedlineedit.cpp deleted file mode 100644 index d9374a3..0000000 --- a/deepin-pc-manager/src/widgets/searchlineedit/animatedlineedit.cpp +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (C) 2019 ~ 2021 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "animatedlineedit.h" - -#include "window/modules/common/compixmap.h" - -#include - -#include -#include -#include -#include -#include -#include - -DGUI_USE_NAMESPACE - -#define GLOWING_IMG_WIDTH 100 // 动图宽(此设定值需要<=实际图片的宽) - -AnimatedLineEdit::AnimatedLineEdit(QWidget *parent) - : QLineEdit(parent) - , m_animation(nullptr) -{ - initUi(); - initConnection(); -} - -AnimatedLineEdit::~AnimatedLineEdit() { } - -void AnimatedLineEdit::startAnimation() -{ - m_animation->stop(); - m_animation->start(); -} - -void AnimatedLineEdit::resizeEvent(QResizeEvent *e) -{ - updateIcon(); - QLineEdit::resizeEvent(e); -} - -void AnimatedLineEdit::paintEvent(QPaintEvent *event) -{ - QLineEdit::paintEvent(event); - - // Draw growing animation - QPainter painter(this); - int imgWidth = GLOWING_IMG_WIDTH; - if (m_animation && m_animation->state() != QAbstractAnimation::Stopped) { - float curValue = m_animation->currentValue().toFloat(); - // 计算动效水平偏移 - int xOffset = int((this->width() / 2 + imgWidth) * curValue); - // 画向左动效 - float toLeftXPos = this->width() / 2 - xOffset; - painter.drawPixmap(int(toLeftXPos), 0, m_toLeftGlowingImg); - // 画向右动效 - float toRightXPos = this->width() / 2 - imgWidth + xOffset; - painter.drawPixmap(int(toRightXPos), 0, m_toRightGlowingImg); - } -} - -void AnimatedLineEdit::updateIcon() -{ - QIcon icon = QIcon::fromTheme(ICON_ANIMATED_LINE_EDIT_GLOWING); - if (icon.availableSizes().isEmpty()) { - return; - } - m_toLeftGlowingImg = icon.pixmap(GLOWING_IMG_WIDTH, height()); - // 图片水平镜像 - QImage img = m_toLeftGlowingImg.toImage().mirrored(true, false); - - m_toRightGlowingImg = QPixmap::fromImage(img); -} - -void AnimatedLineEdit::initUi() -{ - setFocusPolicy(Qt::FocusPolicy::ClickFocus); - - // Animation - m_animation = new QVariantAnimation(this); - m_animation->setDuration(616); - m_animation->setEasingCurve(QEasingCurve::OutQuad); - m_animation->setStartValue(QVariant(0.0f)); - m_animation->setEndValue(QVariant(1.0f)); - - // 图片 - updateIcon(); -} - -void AnimatedLineEdit::initConnection() -{ - // 主题切换时 - connect(DGuiApplicationHelper::instance(), - &DGuiApplicationHelper::themeTypeChanged, - this, - [this](DGuiApplicationHelper::ColorType type) { - Q_UNUSED(type); - this->updateIcon(); - }); - connect(m_animation, &QVariantAnimation::valueChanged, this, [this] { - this->update(); - }); -} diff --git a/deepin-pc-manager/src/widgets/searchlineedit/animatedlineedit.h b/deepin-pc-manager/src/widgets/searchlineedit/animatedlineedit.h deleted file mode 100644 index 1971a5e..0000000 --- a/deepin-pc-manager/src/widgets/searchlineedit/animatedlineedit.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (C) 2019 ~ 2021 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include - -class QVariantAnimation; - -class AnimatedLineEdit : public QLineEdit -{ - Q_OBJECT -public: - explicit AnimatedLineEdit(QWidget *parent = nullptr); - virtual ~AnimatedLineEdit() override; - - void startAnimation(); - -protected: - virtual void resizeEvent(QResizeEvent *e) override; - virtual void paintEvent(QPaintEvent *e) override; - -Q_SIGNALS: - -public Q_SLOTS: - void updateIcon(); - -private: - void initUi(); - void initConnection(); - -private: - QVariantAnimation *m_animation; - QPixmap m_toLeftGlowingImg; - QPixmap m_toRightGlowingImg; -}; diff --git a/deepin-pc-manager/src/widgets/searchlineedit/searchlineedit.cpp b/deepin-pc-manager/src/widgets/searchlineedit/searchlineedit.cpp deleted file mode 100644 index 73d14b3..0000000 --- a/deepin-pc-manager/src/widgets/searchlineedit/searchlineedit.cpp +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (C) 2019 ~ 2021 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "searchlineedit.h" - -#include "animatedlineedit.h" -#include "window/modules/common/common.h" -#include "window/modules/common/compixmap.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -DGUI_USE_NAMESPACE - -#define TOP_LABEL_ICON_SIZE QSize(30, 30) // 顶层标签图标尺寸 - -SearchLineEdit::SearchLineEdit(QWidget *parent) - : DFrame(parent) - , m_topWidget(nullptr) - , m_searchIconLable(nullptr) - , m_lineEdit(nullptr) - , m_searchIconAction(nullptr) -{ - initUi(); - initConnection(); -} - -SearchLineEdit::~SearchLineEdit() { } - -void SearchLineEdit::resizeEvent(QResizeEvent *event) -{ - m_lineEdit->resize(size()); - - DFrame::resizeEvent(event); -} - -bool SearchLineEdit::eventFilter(QObject *obj, QEvent *event) -{ - if (m_topWidget == obj && QEvent::Type::MouseButtonPress == event->type()) { - // 当点击顶层控件后,隐藏顶层,显示编辑框 - m_topWidget->hide(); - m_lineEdit->setFocus(Qt::FocusReason::MouseFocusReason); - m_lineEdit->addAction(m_searchIconAction, - AnimatedLineEdit::ActionPosition::LeadingPosition); - m_lineEdit->startAnimation(); - } else if (m_lineEdit == obj && QEvent::Type::FocusOut == event->type()) { - if (m_lineEdit->text().isEmpty()) { - // 当失去焦点并且编辑框内容为空时,显示顶层 - m_topWidget->show(); - m_lineEdit->removeAction(m_searchIconAction); - m_lineEdit->clearFocus(); - } - } - - return QWidget::eventFilter(obj, event); -} - -void SearchLineEdit::updateIcon() -{ - m_searchIconLable->setPixmap(QIcon::fromTheme(ICON_SEARCH).pixmap(TOP_LABEL_ICON_SIZE)); - m_searchIconAction->setIcon(QIcon::fromTheme(ICON_SEARCH)); -} - -void SearchLineEdit::initUi() -{ - setFocusPolicy(Qt::FocusPolicy::ClickFocus); - setMinimumHeight(36); - - QVBoxLayout *mainLayout = new QVBoxLayout(this); - mainLayout->setContentsMargins(0, 0, 0, 0); - mainLayout->setSpacing(0); - setLayout(mainLayout); - - m_topWidget = new QWidget(this); - m_topWidget->installEventFilter(this); - m_topWidget->setContentsMargins(0, 0, 0, 0); - - QHBoxLayout *topLayout = new QHBoxLayout(m_topWidget); - topLayout->setContentsMargins(0, 0, 0, 0); - topLayout->setSpacing(0); - m_topWidget->setLayout(topLayout); - mainLayout->addWidget(m_topWidget); - - m_searchIconLable = new QLabel(this); - m_searchIconLable->setFont(Utils::getFixFontSize(14)); - m_searchIconLable->setContentsMargins(0, 0, 0, 0); - m_searchIconLable->setPixmap(QIcon::fromTheme(ICON_SEARCH).pixmap(TOP_LABEL_ICON_SIZE)); - topLayout->addWidget(m_searchIconLable, 0, Qt::AlignRight); - - topLayout->addSpacing(5); - QLabel *topTextLable = new QLabel(this); - topTextLable->setFont(Utils::getFixFontSize(14)); - topTextLable->setContentsMargins(0, 0, 0, 0); - topTextLable->setText(tr("Search")); - topLayout->addWidget(topTextLable, 0, Qt::AlignLeft); - topLayout->addSpacing(20); - - m_lineEdit = new AnimatedLineEdit(this); - m_lineEdit->setClearButtonEnabled(true); - m_lineEdit->installEventFilter(this); - m_searchIconAction = new QAction(this); - m_searchIconAction->setIcon(QIcon::fromTheme(ICON_SEARCH)); - m_lineEdit->removeAction(m_searchIconAction); - - m_lineEdit->lower(); -} - -void SearchLineEdit::initConnection() -{ - connect(DGuiApplicationHelper::instance(), - &DGuiApplicationHelper::themeTypeChanged, - this, - [this](DGuiApplicationHelper::ColorType themeType) { - Q_UNUSED(themeType); - this->updateIcon(); - }); - connect(m_lineEdit, &AnimatedLineEdit::textChanged, this, &SearchLineEdit::textChanged); -} diff --git a/deepin-pc-manager/src/widgets/searchlineedit/searchlineedit.h b/deepin-pc-manager/src/widgets/searchlineedit/searchlineedit.h deleted file mode 100644 index f284778..0000000 --- a/deepin-pc-manager/src/widgets/searchlineedit/searchlineedit.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (C) 2019 ~ 2021 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include - -DWIDGET_USE_NAMESPACE - -class AnimatedLineEdit; - -class QVariantAnimation; -class QLabel; - -class SearchLineEdit : public DFrame -{ - Q_OBJECT -public: - explicit SearchLineEdit(QWidget *parent = nullptr); - virtual ~SearchLineEdit() override; - -protected: - virtual void resizeEvent(QResizeEvent *event) override; - virtual bool eventFilter(QObject *obj, QEvent *event) override; - -Q_SIGNALS: - void textChanged(const QString &); - -public Q_SLOTS: - void updateIcon(); - -private: - void initUi(); - void initConnection(); - -private: - QWidget *m_topWidget; - QLabel *m_searchIconLable; - AnimatedLineEdit *m_lineEdit; - QAction *m_searchIconAction; -}; diff --git a/deepin-pc-manager/src/widgets/securitylevelitem.cpp b/deepin-pc-manager/src/widgets/securitylevelitem.cpp deleted file mode 100644 index e5b180d..0000000 --- a/deepin-pc-manager/src/widgets/securitylevelitem.cpp +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "securitylevelitem.h" - -#include -#include - -#include -#include -#include -#include -#include - -DWIDGET_USE_NAMESPACE - -SecurityLevelItem::SecurityLevelItem(QWidget *parent) - : DFrame(parent) -{ - QHBoxLayout *mainLayout = new QHBoxLayout; - mainLayout->setContentsMargins(0, 0, 0, 0); - - setLayout(mainLayout); - - QWidget *firstLayerWidgt = new QWidget(this); - mainLayout->addWidget(firstLayerWidgt); - - QHBoxLayout *firstLayerLayout = new QHBoxLayout; - firstLayerLayout->setContentsMargins(10, 0, 10, 0); - firstLayerWidgt->setLayout(firstLayerLayout); - - m_icon = new DLabel(this); - firstLayerLayout->addWidget(m_icon); - - QVBoxLayout *rightLayout = new QVBoxLayout; - rightLayout->setContentsMargins(5, 9, 0, 9); - firstLayerLayout->addLayout(rightLayout, Qt::AlignLeft); - - m_levelLabel = new DLabel(this); - m_levelLabel->setAlignment(Qt::AlignLeft); - m_levelLabel->setWordWrap(true); - m_levelLabel->setContentsMargins(0, 0, 0, 0); - QFont font = m_levelLabel->font(); - font.setBold(true); - m_levelLabel->setFont(font); - rightLayout->addWidget(m_levelLabel, 0, Qt::AlignLeft); - rightLayout->setSpacing(0); - - m_tipLabel = new DTipLabel("", this); - m_tipLabel->setAlignment(Qt::AlignLeft); - m_tipLabel->setWordWrap(true); - m_tipLabel->adjustSize(); - rightLayout->addWidget(m_tipLabel); - - m_statusIcon = new DLabel(this); - firstLayerLayout->addWidget(m_statusIcon); - - setDisableStyle(false); - setBackgroundRole(DPalette::ItemBackground); - // 设置边框的宽度 - setLineWidth(0); -} - -SecurityLevelItem::~SecurityLevelItem() { } - -void SecurityLevelItem::mousePressEvent(QMouseEvent *event) -{ - Q_UNUSED(event); - Q_EMIT clicked(); -} - -void SecurityLevelItem::setIcon(QIcon icon) -{ - m_icon->setPixmap(icon.pixmap(16, 20)); -} - -void SecurityLevelItem::setLevelText(QString text) -{ - m_levelLabel->setText(text); -} - -void SecurityLevelItem::setTipText(QString text) -{ - m_tipLabel->setText(text); -} - -void SecurityLevelItem::setDisableStyle(bool disable) -{ - if (disable) { - QGraphicsOpacityEffect *opacityEffect[3]; - for (int i = 0; i < 3; i++) { - opacityEffect[i] = new QGraphicsOpacityEffect(this); - opacityEffect[i]->setOpacity(0.5); - } - - m_icon->setGraphicsEffect(opacityEffect[0]); - m_levelLabel->setGraphicsEffect(opacityEffect[1]); - m_tipLabel->setGraphicsEffect(opacityEffect[2]); - m_statusIcon->hide(); - } else { - QGraphicsOpacityEffect *opacityEffect[3]; - for (int i = 0; i < 3; i++) { - opacityEffect[i] = new QGraphicsOpacityEffect(this); - opacityEffect[i]->setOpacity(1); - } - - m_icon->setGraphicsEffect(opacityEffect[0]); - m_levelLabel->setGraphicsEffect(opacityEffect[1]); - m_tipLabel->setGraphicsEffect(opacityEffect[2]); - m_statusIcon->show(); - } -} - -void SecurityLevelItem::setStatusIcon(QIcon icon) -{ - m_statusIcon->setPixmap(icon.pixmap(16, 16)); -} diff --git a/deepin-pc-manager/src/widgets/securitylevelitem.h b/deepin-pc-manager/src/widgets/securitylevelitem.h deleted file mode 100644 index 6e06949..0000000 --- a/deepin-pc-manager/src/widgets/securitylevelitem.h +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include "dtkwidget_global.h" -#include "window/namespace.h" - -#include -#include - -#include -#include -#include - -DEF_NAMESPACE_BEGIN -DEF_ANTIVIRUS_NAMESPACE_BEGIN - -DWIDGET_USE_NAMESPACE - -class SecurityLevelItem : public DFrame -{ - Q_OBJECT -public: - SecurityLevelItem(QWidget *parent = nullptr); - ~SecurityLevelItem(); - - void setIcon(QIcon icon); - void setLevelText(QString text); - void setTipText(QString text); - void setDisableStyle(bool disable); - void setStatusIcon(QIcon icon); - -protected: - void mousePressEvent(QMouseEvent *event); - -Q_SIGNALS: - void clicked(); - -private: - DLabel *m_icon; - DLabel *m_levelLabel; - DTipLabel *m_tipLabel; - DLabel *m_statusIcon; -}; - -DEF_ANTIVIRUS_NAMESPACE_END -DEF_NAMESPACE_END diff --git a/deepin-pc-manager/src/widgets/selectediconwidget.cpp b/deepin-pc-manager/src/widgets/selectediconwidget.cpp deleted file mode 100644 index 3c9ca7f..0000000 --- a/deepin-pc-manager/src/widgets/selectediconwidget.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (C) 2019 ~ 2022 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "selectediconwidget.h" - -#include - -#include -#include -#include -#include - -DWIDGET_USE_NAMESPACE - -namespace def { -namespace widgets { -SelectedIconWidget::SelectedIconWidget(QWidget *parent) - : QWidget(parent) -{ - QStyleOption option; - option.initFrom(this); - m_icon = DStyleHelper(style()).standardIcon(DStyle::SP_IndicatorChecked, &option, this); -} - -SelectedIconWidget::~SelectedIconWidget() { } - -void SelectedIconWidget::paintEvent(QPaintEvent *event) -{ - Q_UNUSED(event); - - QPainter painter(this); - QPalette pa = this->palette(); - QColor color = pa.color(QPalette::ColorGroup::Normal, QPalette::ColorRole::Highlight); - painter.setPen(color); - - QRect iconRect(QPoint(0, 0), size()); - - iconRect.moveCenter(rect().center()); - iconRect.moveLeft(rect().left()); - - m_icon.paint(&painter, iconRect); -} - -} // namespace widgets -} // namespace def diff --git a/deepin-pc-manager/src/widgets/selectediconwidget.h b/deepin-pc-manager/src/widgets/selectediconwidget.h deleted file mode 100644 index 8f326da..0000000 --- a/deepin-pc-manager/src/widgets/selectediconwidget.h +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (C) 2019 ~ 2022 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include -#include - -namespace def { -namespace widgets { -class SelectedIconWidget : public QWidget -{ - Q_OBJECT -public: - explicit SelectedIconWidget(QWidget *parent = nullptr); - virtual ~SelectedIconWidget() override; - -protected: - virtual void paintEvent(QPaintEvent *event) override; - -private: - QIcon m_icon; -}; -} // namespace widgets - -} // namespace def diff --git a/deepin-pc-manager/src/widgets/settingsgroup.cpp b/deepin-pc-manager/src/widgets/settingsgroup.cpp deleted file mode 100644 index 2600652..0000000 --- a/deepin-pc-manager/src/widgets/settingsgroup.cpp +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "settingsgroup.h" - -#include "settingsheaderitem.h" -#include "settingsitem.h" - -#include - -#include -#include -#include - -DWIDGET_USE_NAMESPACE - -namespace def { -namespace widgets { - -SettingsGroup::SettingsGroup(QFrame *parent, BackgroundStyle bgStyle) - : TranslucentFrame(parent) - , m_layout(new QVBoxLayout) - , m_headerItem(nullptr) -{ - m_layout->setMargin(0); - m_layout->setSpacing(10); - - QVBoxLayout *vLayout = m_layout; - if (GroupBackground == bgStyle) { - m_bggroup = new DBackgroundGroup(m_layout, this); - m_bggroup->setBackgroundRole(QPalette::Window); - m_bggroup->setItemSpacing(1); - vLayout = new QVBoxLayout; - vLayout->addWidget(m_bggroup); - m_bggroup->setUseWidgetBackground(false); - } - - m_bgStyle = bgStyle; - setLayout(vLayout); -} - -SettingsGroup::SettingsGroup(const QString &title, QFrame *parent) - : SettingsGroup(parent) -{ - setHeaderVisible(!title.isEmpty()); - setAccessibleName(title); - - m_headerItem->setTitle(title); -} - -SettingsGroup::~SettingsGroup() -{ - if (m_headerItem) - m_headerItem->deleteLater(); -} - -void SettingsGroup::setHeaderVisible(const bool visible) -{ - if (visible) { - if (!m_headerItem) - m_headerItem = new SettingsHeaderItem(this); - insertItem(0, m_headerItem); - } else { - if (m_headerItem) { - m_headerItem->deleteLater(); - m_headerItem = nullptr; - } - } -} - -void SettingsGroup::insertItem(const int index, SettingsItem *item) -{ - if (ItemBackground == m_bgStyle) { - // 当SettingsItem 被加入 SettingsGroup 时,为其加入背景 - item->addBackground(); - } - - m_layout->insertWidget(index, item); - item->installEventFilter(this); -} - -void SettingsGroup::appendItem(SettingsItem *item) -{ - insertItem(m_layout->count(), item); -} - -void SettingsGroup::appendItem(SettingsItem *item, BackgroundStyle bgStyle) -{ - if ((ItemBackground == bgStyle) && (m_bgStyle == ItemBackground)) { - // 当SettingsItem 被加入 SettingsGroup 时,为其加入背景 - item->addBackground(); - } - - m_layout->insertWidget(m_layout->count(), item); - item->installEventFilter(this); -} - -void SettingsGroup::removeItem(SettingsItem *item) -{ - m_layout->removeWidget(item); - item->removeEventFilter(this); -} - -void SettingsGroup::moveItem(SettingsItem *item, const int index) -{ - const int oldIndex = m_layout->indexOf(item); - if (oldIndex == index) - return; - - m_layout->removeWidget(item); - m_layout->insertWidget(index, item); -} - -void SettingsGroup::setSpacing(const int spaceing) -{ - m_layout->setSpacing(spaceing); - if (m_bggroup) - m_bggroup->setItemSpacing(spaceing); -} - -int SettingsGroup::itemCount() const -{ - return m_layout->count(); -} - -void SettingsGroup::clear() -{ - const int index = m_headerItem ? 1 : 0; - const int count = m_layout->count(); - - for (int i(index); i != count; ++i) { - QLayoutItem *item = m_layout->takeAt(index); - QWidget *w = item->widget(); - w->removeEventFilter(this); - w->setParent(nullptr); - delete item; - w->deleteLater(); - } -} - -SettingsItem *SettingsGroup::getItem(int index) -{ - if (index < 0) - return nullptr; - - if (index < itemCount()) { - return qobject_cast(m_layout->itemAt(index)->widget()); - } - - return nullptr; -} -} // namespace widgets -} // namespace def diff --git a/deepin-pc-manager/src/widgets/settingsgroup.h b/deepin-pc-manager/src/widgets/settingsgroup.h deleted file mode 100644 index 987efa8..0000000 --- a/deepin-pc-manager/src/widgets/settingsgroup.h +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef SETTINGSGROUP_H -#define SETTINGSGROUP_H - -#include "translucentframe.h" - -#include - -#include -#include - -class QVBoxLayout; - -DWIDGET_USE_NAMESPACE - -namespace def { -namespace widgets { - -class SettingsItem; -class SettingsHeaderItem; - -class SettingsGroup : public TranslucentFrame -{ - Q_OBJECT - -public: - enum BackgroundStyle { ItemBackground = 0, GroupBackground, NoneBackground }; - - explicit SettingsGroup(QFrame *parent = nullptr, BackgroundStyle bgStyle = ItemBackground); - explicit SettingsGroup(const QString &title, QFrame *parent = nullptr); - ~SettingsGroup(); - - SettingsHeaderItem *headerItem() const { return m_headerItem; } - - void setHeaderVisible(const bool visible); - - SettingsItem *getItem(int index); - void insertItem(const int index, SettingsItem *item); - void appendItem(SettingsItem *item); - void appendItem(SettingsItem *item, BackgroundStyle bgStyle); - void removeItem(SettingsItem *item); - void moveItem(SettingsItem *item, const int index); - void setSpacing(const int spaceing); - - int itemCount() const; - void clear(); - - QVBoxLayout *getLayout() const { return m_layout; } - -private: - BackgroundStyle m_bgStyle{ ItemBackground }; - QVBoxLayout *m_layout; - SettingsHeaderItem *m_headerItem; - DTK_WIDGET_NAMESPACE::DBackgroundGroup *m_bggroup{ nullptr }; -}; - -} // namespace widgets -} // namespace def - -#endif // SETTINGSGROUP_H diff --git a/deepin-pc-manager/src/widgets/settingsheaderitem.cpp b/deepin-pc-manager/src/widgets/settingsheaderitem.cpp deleted file mode 100644 index e31743f..0000000 --- a/deepin-pc-manager/src/widgets/settingsheaderitem.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "settingsheaderitem.h" - -namespace def { -namespace widgets { - -SettingsHeaderItem::SettingsHeaderItem(QWidget *parent) - : SettingsItem(parent) - , m_mainLayout(new QHBoxLayout) - , m_headerText(new TitleLabel(this)) -{ - m_headerText->setObjectName("SettingsHeaderItemTitle"); - - // m_mainLayout->addSpacing(20); - m_mainLayout->addWidget(m_headerText); - m_mainLayout->addStretch(); - - setFixedHeight(24); - m_mainLayout->setSpacing(0); - m_mainLayout->setMargin(0); - - setLayout(m_mainLayout); -} - -void SettingsHeaderItem::setTitle(const QString &title) -{ - m_headerText->setText(title); -} - -void SettingsHeaderItem::setRightWidget(QWidget *widget) -{ - Q_ASSERT(widget); - - m_mainLayout->addWidget(widget, 0, Qt::AlignRight); -} - -} // namespace widgets -} // namespace def diff --git a/deepin-pc-manager/src/widgets/settingsheaderitem.h b/deepin-pc-manager/src/widgets/settingsheaderitem.h deleted file mode 100644 index dc8b823..0000000 --- a/deepin-pc-manager/src/widgets/settingsheaderitem.h +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef SETTINGSHEADERITEM_H -#define SETTINGSHEADERITEM_H - -#include "settingsitem.h" -#include "titlelabel.h" - -#include -#include - -namespace def { -namespace widgets { - -class SettingsHeaderItem : public SettingsItem -{ - Q_OBJECT - -public: - explicit SettingsHeaderItem(QWidget *parent = nullptr); - - TitleLabel *textLabel() const { return m_headerText; } - - QHBoxLayout *layout() const { return m_mainLayout; } - - void setTitle(const QString &title); - void setRightWidget(QWidget *widget); - -private: - QHBoxLayout *m_mainLayout; - TitleLabel *m_headerText; -}; - -} // namespace widgets -} // namespace def - -#endif // SETTINGSHEADERITEM_H diff --git a/deepin-pc-manager/src/widgets/settingsitem.cpp b/deepin-pc-manager/src/widgets/settingsitem.cpp deleted file mode 100644 index 2a800a1..0000000 --- a/deepin-pc-manager/src/widgets/settingsitem.cpp +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "settingsitem.h" - -#include - -#include -#include -#include - -DWIDGET_USE_NAMESPACE -DGUI_USE_NAMESPACE - -namespace def { -namespace widgets { - -SettingsItem::SettingsItem(QWidget *parent) - : QFrame(parent) - , m_isErr(false) -{ -} - -bool SettingsItem::isErr() const -{ - return m_isErr; -} - -void SettingsItem::setIsErr(const bool err) -{ - if (m_isErr == err) - return; - m_isErr = err; - - style()->unpolish(this); - style()->polish(this); -} - -void SettingsItem::addBackground() -{ - // 加入一个 DFrame 作为圆角背景 - if (m_bgGroup) - m_bgGroup->deleteLater(); - m_bgGroup = new DFrame(this); - // m_bgGroup->setContentsMargins(0, 0, 0, 0); - m_bgGroup->setBackgroundRole(DPalette::ItemBackground); - m_bgGroup->setLineWidth(0); - - // 将 m_bgGroup 沉底 - m_bgGroup->lower(); - // 设置m_bgGroup 的大小 - m_bgGroup->setFixedSize(size()); -} - -void SettingsItem::resizeEvent(QResizeEvent *event) -{ - QFrame::resizeEvent(event); - - // 设置m_bgGroup 的大小 - if (m_bgGroup) - m_bgGroup->setFixedSize(size()); -} -} // namespace widgets -} // namespace def diff --git a/deepin-pc-manager/src/widgets/settingsitem.h b/deepin-pc-manager/src/widgets/settingsitem.h deleted file mode 100644 index 2f4b25c..0000000 --- a/deepin-pc-manager/src/widgets/settingsitem.h +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef SETTINGSITEM_H -#define SETTINGSITEM_H - -#include -#include - -#include - -DWIDGET_USE_NAMESPACE - -namespace def { -namespace widgets { - -class SettingsItem : public QFrame -{ - Q_OBJECT - Q_PROPERTY(bool isErr READ isErr DESIGNABLE true SCRIPTABLE true) - -public: - explicit SettingsItem(QWidget *parent = nullptr); - - bool isErr() const; - void setIsErr(const bool err = true); - - void addBackground(); - -protected: - void resizeEvent(QResizeEvent *event) override; - -private: - bool m_isErr; - - DTK_WIDGET_NAMESPACE::DFrame *m_bgGroup{ nullptr }; -}; - -} // namespace widgets -} // namespace def - -#endif // SETTINGSITEM_H diff --git a/deepin-pc-manager/src/widgets/switchwidget.cpp b/deepin-pc-manager/src/widgets/switchwidget.cpp deleted file mode 100644 index 0e632fd..0000000 --- a/deepin-pc-manager/src/widgets/switchwidget.cpp +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "widgets/switchwidget.h" - -#include "widgets/labels/normallabel.h" - -#include -#include -#include - -DWIDGET_USE_NAMESPACE - -namespace def { -namespace widgets { - -SwitchWidget::SwitchWidget(const QString &title, QWidget *parent) - : SwitchWidget(parent, new NormalLabel(title, this)) -{ -} - -SwitchWidget::SwitchWidget(QWidget *parent, QWidget *widget) - : SettingsItem(parent) - , m_leftWidget(widget) - , m_switchBtn(new DSwitchButton(this)) -{ - if (!m_leftWidget) - m_leftWidget = new QLabel(this); - - QHBoxLayout *mainLayout = new QHBoxLayout(this); - mainLayout->setSpacing(0); - - mainLayout->addWidget(m_leftWidget, 1, Qt::AlignVCenter); - mainLayout->addWidget(m_switchBtn, 0, Qt::AlignVCenter); - - m_leftWidget->setAccessibleName("switchItem_leftLable"); - m_switchBtn->setAccessibleName("switchItem_switchButton"); - - m_leftWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - - setLayout(mainLayout); - - connect(m_switchBtn, &DSwitchButton::toggled, this, &SwitchWidget::checkedChanged); -} - -void SwitchWidget::setChecked(const bool checked) -{ - m_switchBtn->blockSignals(true); - m_switchBtn->setChecked(checked); - m_switchBtn->blockSignals(false); -} - -void SwitchWidget::setTitle(const QString &title) -{ - QLabel *label = qobject_cast(m_leftWidget); - if (label) { - label->setWordWrap(true); - label->setText(title); - label->setWordWrap(true); - } - - setAccessibleName(title); -} - -bool SwitchWidget::checked() const -{ - return m_switchBtn->isChecked(); -} - -void SwitchWidget::mouseReleaseEvent(QMouseEvent *event) -{ - if (!m_switchBtn->geometry().contains(event->pos())) { - Q_EMIT clicked(); - } - - return SettingsItem::mouseReleaseEvent(event); -} - -} // namespace widgets -} // namespace def diff --git a/deepin-pc-manager/src/widgets/switchwidget.h b/deepin-pc-manager/src/widgets/switchwidget.h deleted file mode 100644 index f84b5fe..0000000 --- a/deepin-pc-manager/src/widgets/switchwidget.h +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef SWITCHWIDGET_H -#define SWITCHWIDGET_H - -#include "widgets/settingsitem.h" - -#include - -QT_BEGIN_NAMESPACE -class QLabel; -QT_END_NAMESPACE - -namespace def { -namespace widgets { - -class SwitchWidget : public SettingsItem -{ - Q_OBJECT - -public: - // explicit SwitchWidget(QWidget *parent = nullptr); - explicit SwitchWidget(const QString &title, QWidget *parent = nullptr); - explicit SwitchWidget(QWidget *parent = nullptr, QWidget *widget = nullptr); - - void setChecked(const bool checked = true); - void setTitle(const QString &title); - bool checked() const; - - QWidget *leftWidget() const { return m_leftWidget; } - -public: - inline DTK_WIDGET_NAMESPACE::DSwitchButton *switchButton() const { return m_switchBtn; } - -Q_SIGNALS: - void checkedChanged(bool checked) const; - void clicked(); - -protected: - void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; - -private: - QWidget *m_leftWidget; - Dtk::Widget::DSwitchButton *m_switchBtn; -}; - -} // namespace widgets -} // namespace def - -#endif // SWITCHWIDGET_H diff --git a/deepin-pc-manager/src/widgets/tipwidget.cpp b/deepin-pc-manager/src/widgets/tipwidget.cpp deleted file mode 100644 index 27b07ee..0000000 --- a/deepin-pc-manager/src/widgets/tipwidget.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "tipwidget.h" - -#include - -#include -#include -#include - -DWIDGET_USE_NAMESPACE - -TipWidget::TipWidget(QWidget *parent) - : DFrame(parent) -{ - QHBoxLayout *m_layout = new QHBoxLayout; - setLineWidth(0); - m_layout->setContentsMargins(10, 2, 10, 2); - setMinimumSize(336, 48); - - m_leftIcon = new QLabel(this); - - m_tipTitle = new QLabel(this); - m_tipTitle->setWordWrap(true); - m_tipTitle->adjustSize(); - - m_layout->addWidget(m_leftIcon, 0, Qt::AlignLeft | Qt::AlignVCenter); - m_layout->addWidget(m_tipTitle, 0, Qt::AlignLeft | Qt::AlignVCenter); - m_layout->addStretch(1); - setLayout(m_layout); -} - -void TipWidget::setTitle(QString title) -{ - m_tipTitle->setText(title); -} - -void TipWidget::setIcon(QIcon icon) -{ - m_leftIcon->setPixmap(icon.pixmap(20, 20)); -} diff --git a/deepin-pc-manager/src/widgets/tipwidget.h b/deepin-pc-manager/src/widgets/tipwidget.h deleted file mode 100644 index e8c3439..0000000 --- a/deepin-pc-manager/src/widgets/tipwidget.h +++ /dev/null @@ -1,43 +0,0 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -// #ifndef TIPWIDGET_H -// #define TIPWIDGET_H - -#pragma once - -#include "window/namespace.h" - -#include -#include - -#include -#include - -QT_BEGIN_NAMESPACE -class QLabel; -class QComboBox; -class QHBoxLayout; -QT_END_NAMESPACE - -DWIDGET_USE_NAMESPACE - -class TipWidget : public DTK_WIDGET_NAMESPACE::DFrame -{ - Q_OBJECT -public: - explicit TipWidget(QWidget *parent = nullptr); - - void setTitle(QString title = ""); - void setIcon(QIcon icon); -signals: - -public slots: - -private: - QLabel *m_tipTitle = nullptr; - QLabel *m_leftIcon = nullptr; -}; - -// #endif // TIPWIDGET_H diff --git a/deepin-pc-manager/src/widgets/titlebuttonitem.cpp b/deepin-pc-manager/src/widgets/titlebuttonitem.cpp deleted file mode 100644 index b9baab3..0000000 --- a/deepin-pc-manager/src/widgets/titlebuttonitem.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (C) 2019 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "titlebuttonitem.h" - -#include - -namespace def { -namespace widgets { - -TitleButtonItem::TitleButtonItem(QWidget *parent) - : SettingsItem(parent) - , m_titleLabel(new TipsLabel(this)) - , m_button(new QPushButton(this)) -{ - addBackground(); - - QHBoxLayout *layout = new QHBoxLayout; - layout->setContentsMargins(10, 5, 10, 5); - setLayout(layout); - - layout->addWidget(m_titleLabel, 0, Qt::AlignLeft); - - layout->addWidget(m_button, 0, Qt::AlignRight); -} - -// 设置相关标签名称 -void TitleButtonItem::setAccessibleParentText(QString sAccessibleName) -{ - m_titleLabel->setAccessibleName(sAccessibleName + "_titleLable"); - m_button->setAccessibleName(sAccessibleName + "_settingButton"); -} - -void TitleButtonItem::setTitle(QString str) -{ - m_titleLabel->setText(str); -} - -void TitleButtonItem::setButtonText(QString str) -{ - m_button->setText(str); -} - -} // namespace widgets -} // namespace def diff --git a/deepin-pc-manager/src/widgets/titlebuttonitem.h b/deepin-pc-manager/src/widgets/titlebuttonitem.h deleted file mode 100644 index 2c461e5..0000000 --- a/deepin-pc-manager/src/widgets/titlebuttonitem.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (C) 2019 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include "labels/tipslabel.h" -#include "settingsitem.h" - -#include - -namespace def { -namespace widgets { - -class TitleButtonItem : public SettingsItem -{ - Q_OBJECT -public: - explicit TitleButtonItem(QWidget *parent = nullptr); - - inline QPushButton *button() { return m_button; } - - void setTitle(QString str); - void setButtonText(QString str); - - // 设置相关标签名称 - void setAccessibleParentText(QString sAccessibleName); - -Q_SIGNALS: - -private: - TipsLabel *m_titleLabel; - QPushButton *m_button; -}; - -} // namespace widgets -} // namespace def diff --git a/deepin-pc-manager/src/widgets/titledslideritem.cpp b/deepin-pc-manager/src/widgets/titledslideritem.cpp deleted file mode 100644 index a608ed8..0000000 --- a/deepin-pc-manager/src/widgets/titledslideritem.cpp +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "titledslideritem.h" - -#include "dccslider.h" -#include "dccsliderannotated.h" -#include "labels/normallabel.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace def { -namespace widgets { - -TitledSliderItem::TitledSliderItem(QString title, QWidget *parent) - : SettingsItem(parent) - , m_titleLabel(new NormalLabel(title, this)) - , m_valueLabel(new NormalLabel(this)) - , m_slider(new DCCSlider(DCCSlider::SliderType::Normal, this)) -{ - m_titleLabel->setAccessibleName("pwdChangeLimitFrame_titleLable"); - m_valueLabel->setAccessibleName("pwdChangeLimitFrame_valueLable"); - m_slider->slider()->setAccessibleName("pwdChangeLimitFrame_slider"); - - QMargins zeroMg(8, 8, 8, 8); - - QHBoxLayout *topLayout = new QHBoxLayout; - topLayout->setContentsMargins(zeroMg); - topLayout->addWidget(m_titleLabel); - topLayout->addStretch(); - topLayout->addWidget(m_valueLabel); - topLayout->setMargin(0); - topLayout->setSpacing(0); - - QHBoxLayout *bottomLayout = new QHBoxLayout; - bottomLayout->setContentsMargins(zeroMg); - bottomLayout->addWidget(m_slider, 0); - bottomLayout->setMargin(0); - bottomLayout->setSpacing(0); - - QVBoxLayout *mainLayout = new QVBoxLayout(this); - mainLayout->setMargin(0); - mainLayout->setSpacing(0); - mainLayout->setContentsMargins(8, 8, 8, 8); - mainLayout->addLayout(topLayout); - mainLayout->addSpacing(10); - mainLayout->addLayout(bottomLayout); - - addBackground(); - // 设置布局大小改变策略 - setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); -} - -DCCSlider *TitledSliderItem::slider() const -{ - return m_slider->slider(); -} - -void TitledSliderItem::setAnnotations(const QStringList &annotations) -{ - m_slider->setAnnotations(annotations); -} - -QString TitledSliderItem::valueLiteral() const -{ - return m_valueLiteral; -} - -void TitledSliderItem::setValueLiteral(const QString &valueLiteral) -{ - if (valueLiteral != m_valueLiteral) { - m_valueLiteral = valueLiteral; - m_valueLabel->setText(m_valueLiteral); - } -} - -void TitledSliderItem::setLeftIcon(const QIcon &leftIcon) -{ - m_slider->setLeftIcon(leftIcon); -} - -void TitledSliderItem::setRightIcon(const QIcon &rightIcon) -{ - m_slider->setRightIcon(rightIcon); -} - -void TitledSliderItem::setIconSize(const QSize &size) -{ - m_slider->setIconSize(size); -} - -void TitledSliderItem::setTitle(QString str) -{ - m_titleLabel->setText(str); -} - -} // namespace widgets -} // namespace def diff --git a/deepin-pc-manager/src/widgets/titledslideritem.h b/deepin-pc-manager/src/widgets/titledslideritem.h deleted file mode 100644 index a5042d8..0000000 --- a/deepin-pc-manager/src/widgets/titledslideritem.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef DEF_WIDGETS_TITLEDSLIDERITEM_H -#define DEF_WIDGETS_TITLEDSLIDERITEM_H - -#include "settingsitem.h" - -class QLabel; -class QSlider; - -namespace def { -namespace widgets { - -class NormalLabel; -class DCCSlider; - -class TitledSliderItem : public SettingsItem -{ - Q_OBJECT -public: - TitledSliderItem(QString title, QWidget *parent = nullptr); - - DCCSlider *slider() const; - void setAnnotations(const QStringList &annotations); - - QString valueLiteral() const; - void setValueLiteral(const QString &valueLiteral); - - void setLeftIcon(const QIcon &leftIcon); - void setRightIcon(const QIcon &rightIcon); - void setIconSize(const QSize &size); - void setTitle(QString str); - -private: - NormalLabel *m_titleLabel; - NormalLabel *m_valueLabel; - DCCSlider *m_slider; - QString m_valueLiteral; -}; - -} // namespace widgets -} // namespace def - -#endif // DEF_WIDGETS_TITLEDSLIDERITEM_H diff --git a/deepin-pc-manager/src/widgets/titlelabel.cpp b/deepin-pc-manager/src/widgets/titlelabel.cpp deleted file mode 100644 index e244a9c..0000000 --- a/deepin-pc-manager/src/widgets/titlelabel.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (C) 2011 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "titlelabel.h" - -#include - -#include -#include - -DWIDGET_USE_NAMESPACE - -TitleLabel::TitleLabel(QWidget *parent, Qt::WindowFlags f) - : QLabel(parent, f) -{ - auto tf = this->font(); - tf.setWeight(QFont::Medium); - tf.setPixelSize(17); - setFont(tf); -} - -TitleLabel::TitleLabel(const QString &text, QWidget *parent, Qt::WindowFlags f) - : TitleLabel(parent, f) -{ - setText(text); -} - -bool TitleLabel::event(QEvent *e) -{ - if (e->type() == QEvent::ApplicationFontChange) { - auto tf = this->font(); - tf.setWeight(QFont::Medium); - setFont(tf); - } - - return QLabel::event(e); -} diff --git a/deepin-pc-manager/src/widgets/titlelabel.h b/deepin-pc-manager/src/widgets/titlelabel.h deleted file mode 100644 index 85e205b..0000000 --- a/deepin-pc-manager/src/widgets/titlelabel.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2011 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef TITLELABEL_H -#define TITLELABEL_H - -#include - -class TitleLabel : public QLabel -{ - Q_OBJECT -public: - TitleLabel(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags()); - TitleLabel(const QString &text, - QWidget *parent = nullptr, - Qt::WindowFlags f = Qt::WindowFlags()); - -protected: - bool event(QEvent *e) override; -}; - -#endif // TITLELABEL_H diff --git a/deepin-pc-manager/src/widgets/translucentframe.cpp b/deepin-pc-manager/src/widgets/translucentframe.cpp deleted file mode 100644 index 28448a5..0000000 --- a/deepin-pc-manager/src/widgets/translucentframe.cpp +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "translucentframe.h" - -namespace def { -namespace widgets { - -TranslucentFrame::TranslucentFrame(QWidget *parent) - : QFrame(parent) -{ -} - -} // namespace widgets -} // namespace def diff --git a/deepin-pc-manager/src/widgets/translucentframe.h b/deepin-pc-manager/src/widgets/translucentframe.h deleted file mode 100644 index 2b4da0a..0000000 --- a/deepin-pc-manager/src/widgets/translucentframe.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef DCC_TRANSLUCENTFRAME_H -#define DCC_TRANSLUCENTFRAME_H - -#include - -namespace def { -namespace widgets { - -class TranslucentFrame : public QFrame -{ - Q_OBJECT -public: - explicit TranslucentFrame(QWidget *parent = nullptr); -}; - -} // namespace widgets -} // namespace def - -#endif // DCC_TRANSLUCENTFRAME_H diff --git a/deepin-pc-manager/src/widgets/updateaddressitem.cpp b/deepin-pc-manager/src/widgets/updateaddressitem.cpp deleted file mode 100644 index 18853f0..0000000 --- a/deepin-pc-manager/src/widgets/updateaddressitem.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "updateaddressitem.h" - -#include -#include - -UpdateAddressItem::UpdateAddressItem(QWidget *parent) - : QWidget(parent) - , m_context(new QLabel(this)) - , m_address(new DLineEdit(this)) - , m_checkbox(new QCheckBox(this)) -{ - this->setContentsMargins(0, 0, 0, 0); - // 布局 - QHBoxLayout *layout = new QHBoxLayout(this); - layout->setContentsMargins(0, 0, 0, 0); - m_context->setText(tr("Virus database server address")); - // 不可以编辑 - m_address->setEnabled(false); - layout->addWidget(m_checkbox); - layout->addWidget(m_context); - layout->addWidget(m_address); - this->setLayout(layout); - // 信号绑定 - connect(m_address, &DLineEdit::textChanged, this, &UpdateAddressItem::lineEditChange); - connect(m_address, &DLineEdit::focusChanged, this, &UpdateAddressItem::focusChanged); - connect(m_checkbox, &QCheckBox::stateChanged, this, [=](int status) { - m_address->setEnabled(m_checkbox->isChecked()); - Q_EMIT sendCheckBoxChange(status); - }); -} - -// 设置升级地址 -void UpdateAddressItem::setUpdateAddres(QString address) -{ - m_address->setText(address); -} - -// 设置勾选状态 -void UpdateAddressItem::setCheckboxStatus(bool status) -{ - m_checkbox->setChecked(status); - m_address->setEnabled(status); - // 根据勾选状态显示 占位提示 - if (status && m_address->text().isEmpty()) { - m_address->setAlert(true); - } else { - m_address->setAlert(false); - } -} - -// 编辑改变 -void UpdateAddressItem::lineEditChange(QString str) -{ - // 输入框每次改变内容 判定是不是要显示红色提示 - if ((str.isEmpty() && getCheckBoxStatus())) { - m_address->setAlert(true); - } else { - m_address->setAlert(false); - } -} - -// 焦点改变 -void UpdateAddressItem::focusChanged(bool change) -{ - // 失去焦点 代表输入完成 - if (!change) { - Q_EMIT sendInputFinised(m_address->text()); - } -} - -bool UpdateAddressItem::getCheckBoxStatus() const -{ - return m_checkbox->isChecked(); -} diff --git a/deepin-pc-manager/src/widgets/updateaddressitem.h b/deepin-pc-manager/src/widgets/updateaddressitem.h deleted file mode 100644 index acd715e..0000000 --- a/deepin-pc-manager/src/widgets/updateaddressitem.h +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef UPDATEADDRESSITEM_H -#define UPDATEADDRESSITEM_H - -#include - -#include - -DWIDGET_BEGIN_NAMESPACE -class DLineEdit; -DWIDGET_END_NAMESPACE - -class QLabel; -class QCheckBox; -DWIDGET_USE_NAMESPACE - -/** - * @brief 设置中升级病毒地址的Item - */ -class UpdateAddressItem : public QWidget -{ - Q_OBJECT -public: - explicit UpdateAddressItem(QWidget *parent = nullptr); - - // 设置地址 - void setUpdateAddres(QString address); - // 设置选择框状态 - void setCheckboxStatus(bool status); - // 编辑改变 - void lineEditChange(QString str); - // 焦点改变 - void focusChanged(bool change); - - // 获得地址 - inline QString getAddress() const { return m_address->text(); } - - bool getCheckBoxStatus() const; - -signals: - // 发送结束完成的信号 - void sendInputFinised(QString address); - // 选择框的状态信号 - void sendCheckBoxChange(int status); - -private: - QLabel *m_context; // 内容 - DLineEdit *m_address; // 地址输入框 - QCheckBox *m_checkbox; // 选择框 -}; - -#endif // UPDATEADDRESSITEM_H diff --git a/deepin-pc-manager/src/widgets/viruswhitelistscan.cpp b/deepin-pc-manager/src/widgets/viruswhitelistscan.cpp deleted file mode 100644 index 0a0ed65..0000000 --- a/deepin-pc-manager/src/widgets/viruswhitelistscan.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (C) 2021 ~ 2021 Uniontech Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "viruswhitelistscan.h" - -#include -#include - -#include -#include - -VirusWhitelistScanItem::VirusWhitelistScanItem(QWidget *parent) - : QWidget(parent) - , m_lbText(new QLabel(this)) - , m_lbTip(new QLabel(this)) - , m_dialogBtn(new DIconButton(this)) -{ - this->setContentsMargins(0, 0, 0, 0); - // 布局 - QHBoxLayout *layout = new QHBoxLayout(this); - layout->setContentsMargins(0, 0, 0, 0); - this->setLayout(layout); - - // 设置文本属性 - m_lbText->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - - // 设置提示文本属性 - m_lbTip->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - DFontSizeManager::instance()->bind(m_lbTip, DFontSizeManager::T9); // 字体设置 - m_lbTip->setText(tr("(Files in the whitelist will be excluded from virus scan)")); - m_lbTip->setAlignment(Qt::AlignBottom); - - // 设置弹窗按钮 - m_dialogBtn->setAccessibleName("forwardButton"); - m_dialogBtn->setIcon(QStyle::SP_ArrowForward); - m_dialogBtn->setFixedSize(QSize(30, 30)); - m_dialogBtn->setFlat(true); - - // 加入文本和弹窗按钮 - layout->addWidget(m_lbText); - layout->addSpacing(10); - layout->addWidget(m_lbTip); - layout->addStretch(0); // 加入弹簧 - layout->addWidget(m_dialogBtn); - - // 信号绑定 - connect(m_dialogBtn, &DIconButton::clicked, this, &VirusWhitelistScanItem::pushButtonTrigger); -} - -VirusWhitelistScanItem::~VirusWhitelistScanItem() { } - -// 设置label显示内容 -void VirusWhitelistScanItem::setText(const QString &text) -{ - m_lbText->setText(text); -} - -// 按钮触发 -void VirusWhitelistScanItem::pushButtonTrigger(bool status) -{ - emit buttonTrigger(status); -} diff --git a/deepin-pc-manager/src/widgets/viruswhitelistscan.h b/deepin-pc-manager/src/widgets/viruswhitelistscan.h deleted file mode 100644 index d1578d3..0000000 --- a/deepin-pc-manager/src/widgets/viruswhitelistscan.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (C) 2021 ~ 2021 Uniontech Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef VIRUSWHITELISTSCAN_H -#define VIRUSWHITELISTSCAN_H - -#include - -#include -#include - -class QLabel; -class QCheckBox; - -DWIDGET_USE_NAMESPACE - -/** - * @brief 设置中白名单扫描 - */ - -class VirusWhitelistScanItem : public QWidget -{ - Q_OBJECT -public: - explicit VirusWhitelistScanItem(QWidget *parent = nullptr); - ~VirusWhitelistScanItem(); - - // 设置显示内容 - void setText(const QString &text); - // 按钮触发弹窗 - void pushButtonTrigger(bool status); - -signals: - // 按钮点击发射信号 - void buttonTrigger(bool val); - -private: - QLabel *m_lbText; // 内容 - QLabel *m_lbTip; // 提示 - DIconButton *m_dialogBtn; // 前进按钮 -}; - -#endif // VIRUSWHITELISTSCAN_H diff --git a/deepin-pc-manager/src/window/common/common.cpp b/deepin-pc-manager/src/window/common/common.cpp new file mode 100644 index 0000000..bc4b00c --- /dev/null +++ b/deepin-pc-manager/src/window/common/common.cpp @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "common.h" +#include + +// 检查并转换QDbusVariant为QVariant +QVariant Utils::checkAndTransQDbusVarIntoQVar(const QVariant &var) +{ + QDBusVariant qdbusVar = var.value(); + QVariant retVar = qdbusVar.variant(); + if (!retVar.isNull()) { + return retVar; + } + return var; +} diff --git a/deepin-pc-manager/src/window/common/common.h b/deepin-pc-manager/src/window/common/common.h new file mode 100644 index 0000000..c674ab6 --- /dev/null +++ b/deepin-pc-manager/src/window/common/common.h @@ -0,0 +1,144 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include +#include + +Q_DECLARE_METATYPE(QMargins) + +// 公共dbus接口类 +#define DBUS_PROPERTY_INVOKER_NAME "dbusPropertyInvoker" // 公共dbus接口属性获取识别 + +// 基础设置 +#define SETTING_BASE_CLOSE_WINDOW "base.close_window.close_window_type" // 关闭主窗口设置 +#define SETTING_CLOSE_WINDOW_TYPE "close_window_type" // 关闭窗口类型 + +// 各模块名称 +#define MODULE_SYSTEM_CHECK_NAME "systemcheck" // 系统体检 +#define MODULE_TRASH_CLEAN_NAME "trashclean" // 垃圾清理 +#define MODULE_TOOL_BOX_NAME "toolbox" // 工具箱 + +/********************导航栏*****************************/ +#define SYSTEM_CHECK_MODEL_LIGHT "dcc_system_check" // 系统体检模块--浅色 +#define SYSTEM_CHECK_MODEL_DARK "dcc_system_check_dark" // 系统体检模块--深色 +#define TRASH_CLEAN_MODEL_LIGHT "dcc_trash_clean" // 垃圾清理模块--浅色 +#define TRASH_CLEAN_MODEL_DARK "dcc_trash_clean_dark" // 垃圾清理模块--深色 +#define TOOL_BOX_LIGHT "dcc_tool_box" // 工具箱--浅色 +#define TOOL_BOX_DARK "dcc_tool_box_dark" // 工具箱--深色 + +// 图片icon +#define SYSTEM_CHECK_HOME_PAGE_LOGO "dcc_syscheck_main_logo" // 系统体检logo +#define SYSTEM_CHECK_CANCEL_LOGO "dcc_syscheck_progress_cancel" // 系统体检取消 + +// 垃圾清理项 +#define TRASH_CLEAN_ITEM_TYPE_TRASH "SystemTrash" // 垃圾清理item -回收站 +#define TRASH_CLEAN_ITEM_TYPE_CACHE "SystemCache" // 垃圾清理item -系统缓存 +#define TRASH_CLEAN_ITEM_TYPE_LOG "SystemLog" // 垃圾清理item -系统日志 +#define TRASH_CLEAN_ITEM_TYPE_HISTORY "HisInfoApp" // 垃圾清理item -痕迹和应用痕迹 + +// 枚举 - 程序退出配置 +enum closeType { Tray, + Exit, + Ask, + Count }; + +// 主题类型 +enum ColorType { UnknownType, + LightType, + DarkType }; + +// 系统体检 +enum SysCheckItemID { + AutoStartApp, + SystemUpdate, + Trash, + Disk, + DevMode, + MaxLimit +}; +// 错误数据模型角色 +enum CheckResultModelRole { + ID = Qt::UserRole + 1, // 检查项ID + CheckProgressFlag, // 检查项是完成还是超时还是被屏蔽(异常状态为系统版本检查超时, 病毒查杀冲突, SSH被隐藏) + IsIssueHappen, // 检查项是否存在问题 + IsIgnored, // 检查项是否被设置为忽略状态 + Details // 检查项问题详细数据(不要记录复杂数据,仅检查项UI需要显示的数据,如 int bool等,具体数据放在本model中处理) +}; +enum CheckProgressStatus { + Success, + TimeOut, + Masked +}; + +// 硬件检测结果 +enum ServiceResult { + ServiceBlock = 0, + NoFound, + CheckSucessed +}; + +// 网络设置检测结果 +enum NetSettingResult { + NoNetConn = 0, + NetSettingSkip, + NetSettingCheckFailed, + NetSettingCheckSucessed +}; + +// DHCP检测结果 +enum DHCPResult { + DHCPCheckFailed = 0, + DHCPCheckSucessed +}; + +// DNS检测结果 +enum DNSResult { + DNSCheckError = 0, + DNSCheckAbnormal, + DNSCheckSucessed +}; + +// host检测结果 +enum HostResult { + HostCheckFailed = 0, + HostCheckSucessed +}; + +// 网络连接访问结果 +enum NetConnResult { + NetConnFailed = 0, + NetConnSucessed +}; + +namespace Utils { +// 检查并转换QDbusVariant为QVariant +QVariant checkAndTransQDbusVarIntoQVar(const QVariant &var); + +inline bool compareVersion(const QString &targetVersion, const QString &baseVersion) +{ + QStringList version1 = baseVersion.split("."); + QStringList version2 = targetVersion.split("."); + + if (version1.size() != version2.size()) { + return false; + } + + for (int i = 0; i < version1.size(); ++i) { + // 相等判断下一个子版本号 + if (version1[i] == version2[i]) + continue; + + // 转成整形比较 + if (version1[i].toInt() > version2[i].toInt()) { + return false; + } else { + return true; + } + } + + return true; +} +} // namespace Utils diff --git a/deepin-pc-manager/src/window/common/gsettingkey.h b/deepin-pc-manager/src/window/common/gsettingkey.h new file mode 100644 index 0000000..9d785e2 --- /dev/null +++ b/deepin-pc-manager/src/window/common/gsettingkey.h @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#define CLOSE_TYPE "closeType" // 主界面关闭方式配置项 +#define ASK_TYPE "askType" // 主界面退出询问弹框配置项 + +// 系统体检 +#define SAFETY_SCORE "safetyScore" // 上次体检得分 +#define LAST_CHECK_TIME "lastCheckTime" // 上次体检时间 +#define IGNORE_DEV_MODE_CHECKING "ignoreDevModeChecking" // 是否忽略检测开发者模式项 +#define IGNORE_AUTO_START_CHECKING "ignoreAutoStartChecking" // 是否忽略检测自启动项 diff --git a/deepin-pc-manager/src/window/modules/common/invokers/dbusinvoker.cpp b/deepin-pc-manager/src/window/common/invokers/dbusinvoker.cpp similarity index 100% rename from deepin-pc-manager/src/window/modules/common/invokers/dbusinvoker.cpp rename to deepin-pc-manager/src/window/common/invokers/dbusinvoker.cpp diff --git a/deepin-pc-manager/src/window/modules/common/invokers/dbusinvoker.h b/deepin-pc-manager/src/window/common/invokers/dbusinvoker.h similarity index 95% rename from deepin-pc-manager/src/window/modules/common/invokers/dbusinvoker.h rename to deepin-pc-manager/src/window/common/invokers/dbusinvoker.h index 7d52aa9..421ea49 100644 --- a/deepin-pc-manager/src/window/modules/common/invokers/dbusinvoker.h +++ b/deepin-pc-manager/src/window/common/invokers/dbusinvoker.h @@ -12,7 +12,8 @@ #include // interface -class DBusInvoker : public QObject, public DBusInvokerInterface +class DBusInvoker : public QObject + , public DBusInvokerInterface { Q_OBJECT public: diff --git a/deepin-pc-manager/src/window/common/invokers/invokerfactory.cpp b/deepin-pc-manager/src/window/common/invokers/invokerfactory.cpp new file mode 100644 index 0000000..f0c0634 --- /dev/null +++ b/deepin-pc-manager/src/window/common/invokers/invokerfactory.cpp @@ -0,0 +1,38 @@ +// Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "invokerfactory.h" + +#include "dbusinvoker.h" + +InvokerFactory::InvokerFactory() +{ +} + +InvokerFactory::~InvokerFactory() +{ +} + +DBusInvokerInterface *InvokerFactory::CreateInvoker(const QString &service, + const QString &path, + const QString &interface, + ConnectType type, + QObject *parent) +{ + return new DBusInvoker(service, path, interface, type, parent); +} + +// 单元测试扩展处理 +void InvokerFactory::setInvokerInteface(const QString &interfaceName, + DBusInvokerInterface *interface) +{ +#ifdef DEEPIN_DEFENDER_UNITTEST + // 不关心是否重复 + m_intefaceMap.insert(interfaceName, interface); +#else + Q_UNUSED(interfaceName); + Q_UNUSED(interface); +#endif +} diff --git a/deepin-pc-manager/src/window/common/invokers/invokerfactory.h b/deepin-pc-manager/src/window/common/invokers/invokerfactory.h new file mode 100644 index 0000000..2f25e78 --- /dev/null +++ b/deepin-pc-manager/src/window/common/invokers/invokerfactory.h @@ -0,0 +1,52 @@ +// Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef DBUS_INVOKER_FACTORY +#define DBUS_INVOKER_FACTORY + +#include "invokerinterface.h" + +#include + +// 简化DBUS调用方法的写法 +#define DBUS_BLOCK_INVOKE(interface, funName, ...) \ + interface->Invoke(funName, {__VA_ARGS__}, BlockMode::BLOCK) +#define DBUS_INVOKE(interface, funName, ...) \ + interface->Invoke(funName, {__VA_ARGS__}, BlockMode::BLOCKWITHGUI) +#define DBUS_NOBLOCK_INVOKE(interface, funName, ...) \ + interface->Invoke(funName, {__VA_ARGS__}, BlockMode::NOBLOCK) +#define GET_MESSAGE_VALUE(type, output, message) type output = QDBusReply(message).value() + +// implement +class InvokerFactory : public QObject + , public InvokerFactoryInterface +{ + Q_OBJECT +public: + static InvokerFactory &GetInstance() + { + static InvokerFactory instance; + return instance; + } + + virtual DBusInvokerInterface *CreateInvoker(const QString &service, + const QString &path, + const QString &interface, + ConnectType type = ConnectType::SESSION, + QObject *parent = nullptr) override; + +public: + void setInvokerInteface(const QString &, DBusInvokerInterface *); + +private: + InvokerFactory(); + InvokerFactory(InvokerFactory &); + InvokerFactory &operator=(const InvokerFactory &); + ~InvokerFactory() override; + + QMap m_intefaceMap; +}; + +#endif diff --git a/deepin-pc-manager/src/window/common/invokers/invokerinterface.h b/deepin-pc-manager/src/window/common/invokers/invokerinterface.h new file mode 100644 index 0000000..4702801 --- /dev/null +++ b/deepin-pc-manager/src/window/common/invokers/invokerinterface.h @@ -0,0 +1,50 @@ +// Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef DBUS_INVOKE_INTERFACE_H +#define DBUS_INVOKE_INTERFACE_H + +#include +#include +#include + +enum ConnectType { SYSTEM, + SESSION }; + +enum InvokeType { CALL, + SIGNAL }; + +enum BlockMode { NOBLOCK, + BLOCK, + BLOCKWITHGUI, + AUTODETECT }; + +// interface +class DBusInvokerInterface +{ +public: + virtual QDBusMessage Invoke(const QString &name, + const QList &functionParams = QList(), + BlockMode mode = BlockMode::BLOCKWITHGUI) = 0; + virtual bool EmitSignal(const QString &name, + const QList &arguments = QList()) = 0; + virtual bool Connect(const QString &signal, QObject *reciver, const char *slot) = 0; + virtual bool Disconnect(const QString &signal, QObject *reciver, const char *slot) = 0; + + virtual ~DBusInvokerInterface() {} +}; + +class InvokerFactoryInterface +{ +public: + virtual DBusInvokerInterface *CreateInvoker(const QString &service, + const QString &path, + const QString &interface, + ConnectType type = ConnectType::SESSION, + QObject *parent = nullptr) = 0; + virtual ~InvokerFactoryInterface() {} +}; + +#endif diff --git a/deepin-pc-manager/src/window/dialogmanage.cpp b/deepin-pc-manager/src/window/dialogmanage.cpp deleted file mode 100644 index f1cbc64..0000000 --- a/deepin-pc-manager/src/window/dialogmanage.cpp +++ /dev/null @@ -1,218 +0,0 @@ -// Copyright (C) 2019 ~ 2020 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "dialogmanage.h" - -#include "modules/common/common.h" -#include "modules/common/compixmap.h" - -#include -#include - -#include -#include -#include -#include -#include -#include - -DWIDGET_USE_NAMESPACE - -DialogManage::DialogManage(QObject *parent) - : QObject(parent) -{ -} - -// 更新提示框 -void DialogManage::showUpdateWhenScanningDialog() -{ - DDialog *dialog = new DDialog; - dialog->setFont(Utils::getFixFontSize(14)); - dialog->setAccessibleName("updateWhenScanningDialog"); - dialog->setFixedSize(QSize(TIP_DIALOG_WIDTH, TIP_DIALOG_HEIGHT)); - dialog->setIcon(QIcon::fromTheme("dcc_login_tip")); - // 当前正在查杀中,请结束查杀后再更新 - dialog->setMessage(tr("A task is in process, please update later")); - dialog->setWordWrapMessage(true); - // 设置属性当关闭时候删除自己 - dialog->setAttribute(Qt::WA_DeleteOnClose); - // 确定 推荐 - DSuggestButton *okBtn = new DSuggestButton(dialog); - okBtn->setFont(Utils::getFixFontSize(14)); - okBtn->setText(tr("OK", "button")); - okBtn->setObjectName("OK"); - okBtn->setAccessibleName("updateWhenScanningDialog_okButton"); - okBtn->setAttribute(Qt::WA_NoMousePropagation); - dialog->insertButton(0, okBtn, false); - connect(dialog, &DDialog::buttonClicked, dialog, [dialog](int index, QString) { - switch (index) { - case 0: - dialog->close(); - break; - default: - break; - } - }); - dialog->exec(); -} - -void DialogManage::showNormalTipDialog(TipIcon icontype, TipTextInfo textInfo) -{ - DDialog *dialog = new DDialog; - dialog->setFont(Utils::getFixFontSize(14)); - dialog->setAccessibleName("normalTtipDialog"); - dialog->setFixedSize(QSize(TIP_DIALOG_WIDTH, TIP_DIALOG_HEIGHT)); - // 根据图标类型设置左上角图标 - if (IconNormal == icontype) { - dialog->setIcon(QIcon::fromTheme(DIALOG_PC_MANAGER)); - } else if (IconTip == icontype) { - dialog->setIcon(QIcon::fromTheme(DIALOG_TIP_YELLOW)); - } else { - dialog->setIcon(QIcon::fromTheme(DIALOG_TIP_RED)); - } - - QString strTips; - - // 根据信息类型提示不同信息 - switch (textInfo) { - case TipHomeChecking: - // 提示语 首页体检正在执行快速查杀,请稍候 - strTips = tr("Quick scanning on the Full Check page, please try later"); - break; - case TipHomeThreats: - // 提示语:首页体检有病毒异常未处理,请前往处理 - strTips = tr("Threats are found on the Full Check page, please go to remove them first"); - break; - case TipHomeFixing: - // 提示语:首页体检正在执行修复任务,请稍候 - strTips = tr("Fixing issues on the Full Check page, please try later"); - break; - case TipThreatScaning: - // 提示语:病毒查杀正在执行查杀任务,请稍候 - strTips = tr("Scanning virus, please try later"); - break; - case TipUsbScaning: - // 提示语:正在执行U盘查杀,请稍候 - strTips = tr("Scanning USB devices, please try later"); - break; - case TipUpdate: - // 提示语:病毒库更新中,请稍候操作 - strTips = tr("Updating the virus database, please try later"); - break; - case TipNetWorkEroor: - // 提示语:网络异常,请检测网络后重新更新 - strTips = tr("Please check your network and update again"); - break; - default: - // 如果输入类型错误 - strTips = tr("Scanning virus, please try later"); - break; - } - - QScrollArea *mainScrollArea = new QScrollArea(dialog); - mainScrollArea->setContentsMargins(0, 0, 0, 0); - mainScrollArea->setWidgetResizable(true); - mainScrollArea->setFrameShape(QFrame::Shape::NoFrame); - mainScrollArea->setWidgetResizable(true); - mainScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOff); - - // 设置滑动条区域背景颜色为透明 - QPalette pa = mainScrollArea->palette(); - pa.setBrush(QPalette::Window, Qt::transparent); - mainScrollArea->setPalette(pa); - - QLabel *txtLabel = new QLabel(mainScrollArea); - txtLabel->setFont(Utils::getFixFontSize(14)); - txtLabel->setText(strTips); - txtLabel->setWordWrap(true); - txtLabel->setAlignment(Qt::AlignCenter); - - mainScrollArea->setWidget(txtLabel); - - dialog->addContent(mainScrollArea); - - dialog->setWordWrapMessage(true); - dialog->setAttribute(Qt::WA_DeleteOnClose); - - // 按钮提示信息是确认 - // 因自动化测试需要,修改dialog按钮的创建过程 - DSuggestButton *confirmBtn = new DSuggestButton(dialog); - confirmBtn->setFont(Utils::getFixFontSize(14)); - confirmBtn->setText(tr("OK")); - confirmBtn->setObjectName("ConfirmBtn"); - confirmBtn->setAccessibleName("normalTtipDialog_confirmBtn"); - confirmBtn->setAttribute(Qt::WA_NoMousePropagation); - dialog->insertButton(0, confirmBtn, true); - QLabel *dialogMessageLabel = dialog->findChild("MessageLabel"); - dialogMessageLabel->setAccessibleName("normalTtipDialog_messageLable"); - connect(dialog, &DDialog::buttonClicked, this, [=](int index, QString) { - switch (index) { - case 0: - emit buttonClicked(); - dialog->close(); - break; - default: - break; - } - }); - connect(dialog, &DDialog::closed, this, &DialogManage::closed); - - dialog->exec(); -} - -// 更新服务地址提示窗 -DDialog *DialogManage::creatChangeAddressTipDialog() -{ - DDialog *dialog = new DDialog; - dialog->setFont(Utils::getFixFontSize(14)); - dialog->setAccessibleName("addressChangeDialog"); - dialog->setFixedSize(QSize(TIP_DIALOG_WIDTH, TIP_DIALOG_HEIGHT)); - dialog->setIcon(QIcon::fromTheme(DIALOG_TIP_YELLOW)); - - // 创建滑动区----请检查你的病毒服务地址是否正常 - QScrollArea *mainScrollArea = new QScrollArea(dialog); - mainScrollArea->setContentsMargins(0, 0, 0, 0); - mainScrollArea->setWidgetResizable(true); - mainScrollArea->setFrameShape(QFrame::Shape::NoFrame); - mainScrollArea->setWidgetResizable(true); - mainScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOff); - - // 设置滑动条区域背景颜色为透明 - QPalette pa = mainScrollArea->palette(); - pa.setBrush(QPalette::Window, Qt::transparent); - mainScrollArea->setPalette(pa); - - QLabel *txtLabel = new QLabel(mainScrollArea); - txtLabel->setFont(Utils::getFixFontSize(14)); - txtLabel->setText( - tr("Trying to update the virus database, please make sure its server address is correct")); - txtLabel->setWordWrap(true); - txtLabel->setAlignment(Qt::AlignCenter); - - mainScrollArea->setWidget(txtLabel); - - dialog->addContent(mainScrollArea); - - dialog->setWordWrapMessage(true); - dialog->setAttribute(Qt::WA_DeleteOnClose); - // 确定推荐 - QPushButton *okBtn = new QPushButton(dialog); - okBtn->setFont(Utils::getFixFontSize(14)); - okBtn->setText(tr("OK")); - okBtn->setObjectName("OK"); - okBtn->setAccessibleName("addressChangeDialog_okButton"); - okBtn->setAttribute(Qt::WA_NoMousePropagation); - dialog->insertButton(0, okBtn, false); - connect(dialog, &DDialog::buttonClicked, this, [=](int index, QString) { - switch (index) { - case 0: - dialog->close(); - break; - default: - break; - } - }); - return dialog; -} diff --git a/deepin-pc-manager/src/window/dialogmanage.h b/deepin-pc-manager/src/window/dialogmanage.h deleted file mode 100644 index 9c58cf6..0000000 --- a/deepin-pc-manager/src/window/dialogmanage.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (C) 2019 ~ 2020 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include "modules/common/comdata.h" - -#include - -#include - -DWIDGET_USE_NAMESPACE - -/// -/// \brief 安全中心弹窗管理类 -/// -class DialogManage : public QObject -{ - Q_OBJECT -public: - explicit DialogManage(QObject *parent = nullptr); - -public: - // 扫描时更新提示框 - static void showUpdateWhenScanningDialog(); - - // 常规的提示框 左上角图标和文本信息 底下的按钮都是确定 - /** - * @brief showNormalTipDialog - * @param icontype 图标类型 - * @param textInfo 提示信息 - */ - void showNormalTipDialog(TipIcon icontype, TipTextInfo textInfo); - - // 更新服务地址提示窗 - DDialog *creatChangeAddressTipDialog(); - -signals: - // 关闭信号 - void closed(); - // 按钮点击 - void buttonClicked(); -}; diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_Ahprotector_log_26px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_Ahprotector_log_26px.svg deleted file mode 100644 index b8cea45..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_Ahprotector_log_26px.svg +++ /dev/null @@ -1,22 +0,0 @@ - - - - 安恒信息Logo-单独龙标_画板 1 - Created with Sketch. - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_Ahprotector_log_26px.svg.license b/deepin-pc-manager/src/window/icons/actions/dcc_Ahprotector_log_26px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_Ahprotector_log_26px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_Virus_Scan_dark_32px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_Virus_Scan_dark_32px.svg deleted file mode 100644 index 2a0c4ba..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_Virus_Scan_dark_32px.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - dcc_Virus Scan_32px_dark - Created with Sketch. - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_Virus_Scan_dark_32px.svg.license b/deepin-pc-manager/src/window/icons/actions/dcc_Virus_Scan_dark_32px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_Virus_Scan_dark_32px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_all1_96px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_antiav_all1_96px.svg deleted file mode 100644 index e0f6d62..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_all1_96px.svg +++ /dev/null @@ -1,160 +0,0 @@ - - - Illustration/Anti_Virus/Total_antivirus - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_all1_96px.svg.license b/deepin-pc-manager/src/window/icons/actions/dcc_antiav_all1_96px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_all1_96px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_customer1_96px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_antiav_customer1_96px.svg deleted file mode 100644 index f64f377..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_customer1_96px.svg +++ /dev/null @@ -1,118 +0,0 @@ - - - Illustration/Anti_Virus/Custom_killing - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_customer1_96px.svg.license b/deepin-pc-manager/src/window/icons/actions/dcc_antiav_customer1_96px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_customer1_96px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_quarantine_16px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_antiav_quarantine_16px.svg deleted file mode 100644 index 180c469..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_quarantine_16px.svg +++ /dev/null @@ -1,24 +0,0 @@ - - - - Icon/Quarantine - Created with Sketch. - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_quarantine_16px.svg.license b/deepin-pc-manager/src/window/icons/actions/dcc_antiav_quarantine_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_quarantine_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_quarantine_dark_16px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_antiav_quarantine_dark_16px.svg deleted file mode 100644 index 390ea22..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_quarantine_dark_16px.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - Icon_Quarantine_dark - Created with Sketch. - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_quarantine_dark_16px.svg.license b/deepin-pc-manager/src/window/icons/actions/dcc_antiav_quarantine_dark_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_quarantine_dark_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_quick1_96px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_antiav_quick1_96px.svg deleted file mode 100644 index 2cd0f2f..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_quick1_96px.svg +++ /dev/null @@ -1,100 +0,0 @@ - - - Illustration/Anti_Virus/Quick_killing - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_quick1_96px.svg.license b/deepin-pc-manager/src/window/icons/actions/dcc_antiav_quick1_96px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_quick1_96px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_scanLogs_16px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_antiav_scanLogs_16px.svg deleted file mode 100644 index e5b81b5..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_scanLogs_16px.svg +++ /dev/null @@ -1,22 +0,0 @@ - - - - Icon/Scan Logs - Created with Sketch. - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_scanLogs_16px.svg.license b/deepin-pc-manager/src/window/icons/actions/dcc_antiav_scanLogs_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_scanLogs_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_scanLogs_dark_16px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_antiav_scanLogs_dark_16px.svg deleted file mode 100644 index 5212308..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_scanLogs_dark_16px.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - Icon/Scan Logs _dark - Created with Sketch. - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_scanLogs_dark_16px.svg.license b/deepin-pc-manager/src/window/icons/actions/dcc_antiav_scanLogs_dark_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_scanLogs_dark_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_thread_96px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_antiav_thread_96px.svg deleted file mode 100644 index c98af12..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_thread_96px.svg +++ /dev/null @@ -1,56 +0,0 @@ - - - Illustration/Repair_Trojan - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_thread_96px.svg.license b/deepin-pc-manager/src/window/icons/actions/dcc_antiav_thread_96px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_thread_96px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_thread_repaired_96px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_antiav_thread_repaired_96px.svg deleted file mode 100644 index 4bfcd2d..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_thread_repaired_96px.svg +++ /dev/null @@ -1,86 +0,0 @@ - - - Illustration/Successfully_repaired_the_Trojan_horse - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_thread_repaired_96px.svg.license b/deepin-pc-manager/src/window/icons/actions/dcc_antiav_thread_repaired_96px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_thread_repaired_96px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_whitelist_16px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_antiav_whitelist_16px.svg deleted file mode 100644 index 6a40438..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_whitelist_16px.svg +++ /dev/null @@ -1,24 +0,0 @@ - - - - Icon/Whitelist - Created with Sketch. - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_whitelist_16px.svg.license b/deepin-pc-manager/src/window/icons/actions/dcc_antiav_whitelist_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_whitelist_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_whitelist_dark_16px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_antiav_whitelist_dark_16px.svg deleted file mode 100644 index 6ffe59f..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_whitelist_dark_16px.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - Icon/Whitelist_dark - Created with Sketch. - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_whitelist_dark_16px.svg.license b/deepin-pc-manager/src/window/icons/actions/dcc_antiav_whitelist_dark_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_antiav_whitelist_dark_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_application_security_32px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_application_security_32px.svg deleted file mode 100644 index 3bd385a..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_application_security_32px.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - dcc_Application Security_32px - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_application_security_32px.svg.license b/deepin-pc-manager/src/window/icons/actions/dcc_application_security_32px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_application_security_32px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_application_security_dark_32px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_application_security_dark_32px.svg deleted file mode 100644 index 378eb4e..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_application_security_dark_32px.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - dcc_Application Security_32px_dark - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_application_security_dark_32px.svg.license b/deepin-pc-manager/src/window/icons/actions/dcc_application_security_dark_32px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_application_security_dark_32px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_cleanup_32px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_cleanup_32px.svg deleted file mode 100644 index c960e31..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_cleanup_32px.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - dcc_Cleanup_32px - Created with Sketch. - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_cleanup_32px.svg.license b/deepin-pc-manager/src/window/icons/actions/dcc_cleanup_32px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_cleanup_32px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_cleanup_dark_32px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_cleanup_dark_32px.svg deleted file mode 100644 index 23bf7aa..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_cleanup_dark_32px.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - dcc_Cleanup_32px_dark - Created with Sketch. - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_cleanup_dark_32px.svg.license b/deepin-pc-manager/src/window/icons/actions/dcc_cleanup_dark_32px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_cleanup_dark_32px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_home_32px.svg.license b/deepin-pc-manager/src/window/icons/actions/dcc_home_32px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_home_32px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_home_dark_32px.svg.license b/deepin-pc-manager/src/window/icons/actions/dcc_home_dark_32px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_home_dark_32px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_natiav_log_details_16px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_natiav_log_details_16px.svg deleted file mode 100644 index 3f05b98..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_natiav_log_details_16px.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - icon_details - Created with Sketch. - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_natiav_log_details_16px.svg.license b/deepin-pc-manager/src/window/icons/actions/dcc_natiav_log_details_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_natiav_log_details_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_network_protection_32px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_network_protection_32px.svg deleted file mode 100644 index 5fa9aa8..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_network_protection_32px.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - dcc_Network Protection_32px - Created with Sketch. - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_network_protection_32px.svg.license b/deepin-pc-manager/src/window/icons/actions/dcc_network_protection_32px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_network_protection_32px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_network_protection_dark_32px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_network_protection_dark_32px.svg deleted file mode 100644 index 8307075..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_network_protection_dark_32px.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - dcc_Network Protection_32px_dark - Created with Sketch. - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_network_protection_dark_32px.svg.license b/deepin-pc-manager/src/window/icons/actions/dcc_network_protection_dark_32px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_network_protection_dark_32px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_rising_logo_26px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_rising_logo_26px.svg deleted file mode 100644 index bdb4719..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_rising_logo_26px.svg +++ /dev/null @@ -1,27 +0,0 @@ - - - - 瑞星-logo - Created with Sketch. - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_rising_logo_26px.svg.license b/deepin-pc-manager/src/window/icons/actions/dcc_rising_logo_26px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_rising_logo_26px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_home_32px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_system_check_32px.svg similarity index 94% rename from deepin-pc-manager/src/window/icons/actions/dcc_home_32px.svg rename to deepin-pc-manager/src/window/icons/actions/dcc_system_check_32px.svg index 5f8def1..16d7d9c 100644 --- a/deepin-pc-manager/src/window/icons/actions/dcc_home_32px.svg +++ b/deepin-pc-manager/src/window/icons/actions/dcc_system_check_32px.svg @@ -1,11 +1,9 @@ - dcc_Home_32px - Created with Sketch. - + diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_home_dark_32px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_system_check_dark_32px.svg similarity index 94% rename from deepin-pc-manager/src/window/icons/actions/dcc_home_dark_32px.svg rename to deepin-pc-manager/src/window/icons/actions/dcc_system_check_dark_32px.svg index e387a9c..630628b 100644 --- a/deepin-pc-manager/src/window/icons/actions/dcc_home_dark_32px.svg +++ b/deepin-pc-manager/src/window/icons/actions/dcc_system_check_dark_32px.svg @@ -1,11 +1,9 @@ - dcc_Home_32px_dark - Created with Sketch. - + diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_system_security_32px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_system_security_32px.svg deleted file mode 100644 index 41d1007..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_system_security_32px.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - dcc_System Security_32px - Created with Sketch. - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_system_security_32px.svg.license b/deepin-pc-manager/src/window/icons/actions/dcc_system_security_32px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_system_security_32px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_system_security_dark_32px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_system_security_dark_32px.svg deleted file mode 100644 index 30d7c90..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_system_security_dark_32px.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - dcc_System Security_32px_dark - Created with Sketch. - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_system_security_dark_32px.svg.license b/deepin-pc-manager/src/window/icons/actions/dcc_system_security_dark_32px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_system_security_dark_32px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_tools_32px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_tool_box_32px.svg similarity index 100% rename from deepin-pc-manager/src/window/icons/actions/dcc_tools_32px.svg rename to deepin-pc-manager/src/window/icons/actions/dcc_tool_box_32px.svg diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_tools_dark_32px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_tool_box_dark_32px.svg similarity index 100% rename from deepin-pc-manager/src/window/icons/actions/dcc_tools_dark_32px.svg rename to deepin-pc-manager/src/window/icons/actions/dcc_tool_box_dark_32px.svg diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_tools_32px.svg.license b/deepin-pc-manager/src/window/icons/actions/dcc_tools_32px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_tools_32px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_tools_dark_32px.svg.license b/deepin-pc-manager/src/window/icons/actions/dcc_tools_dark_32px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_tools_dark_32px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_trash_clean_32px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_trash_clean_32px.svg new file mode 100644 index 0000000..6112ea9 --- /dev/null +++ b/deepin-pc-manager/src/window/icons/actions/dcc_trash_clean_32px.svg @@ -0,0 +1,8 @@ + + + dcc_Cleanup_32px + + + + + \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_trash_clean_dark_32px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_trash_clean_dark_32px.svg new file mode 100644 index 0000000..4408e3b --- /dev/null +++ b/deepin-pc-manager/src/window/icons/actions/dcc_trash_clean_dark_32px.svg @@ -0,0 +1,8 @@ + + + dcc_Cleanup_32px_dark + + + + + \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_virus_scan_32px.svg b/deepin-pc-manager/src/window/icons/actions/dcc_virus_scan_32px.svg deleted file mode 100644 index e5a9908..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_virus_scan_32px.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - dcc_Virus Scan_32px - Created with Sketch. - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/dcc_virus_scan_32px.svg.license b/deepin-pc-manager/src/window/icons/actions/dcc_virus_scan_32px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/dcc_virus_scan_32px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/ddc_cleaner_app_cache_64px.svg b/deepin-pc-manager/src/window/icons/actions/ddc_cleaner_app_cache_64px.svg deleted file mode 100644 index 90ea214..0000000 --- a/deepin-pc-manager/src/window/icons/actions/ddc_cleaner_app_cache_64px.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/ddc_cleaner_app_cache_64px.svg.license b/deepin-pc-manager/src/window/icons/actions/ddc_cleaner_app_cache_64px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/ddc_cleaner_app_cache_64px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/ddc_cleaner_app_logs_64px.svg b/deepin-pc-manager/src/window/icons/actions/ddc_cleaner_app_logs_64px.svg deleted file mode 100644 index 71b9fa3..0000000 --- a/deepin-pc-manager/src/window/icons/actions/ddc_cleaner_app_logs_64px.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/ddc_cleaner_app_logs_64px.svg.license b/deepin-pc-manager/src/window/icons/actions/ddc_cleaner_app_logs_64px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/ddc_cleaner_app_logs_64px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/ddc_cleaner_crash_64px.svg b/deepin-pc-manager/src/window/icons/actions/ddc_cleaner_crash_64px.svg deleted file mode 100644 index 73ecd0b..0000000 --- a/deepin-pc-manager/src/window/icons/actions/ddc_cleaner_crash_64px.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/ddc_cleaner_crash_64px.svg.license b/deepin-pc-manager/src/window/icons/actions/ddc_cleaner_crash_64px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/ddc_cleaner_crash_64px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/ddc_cleaner_packages_64px.svg b/deepin-pc-manager/src/window/icons/actions/ddc_cleaner_packages_64px.svg deleted file mode 100644 index 463bddf..0000000 --- a/deepin-pc-manager/src/window/icons/actions/ddc_cleaner_packages_64px.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/ddc_cleaner_packages_64px.svg.license b/deepin-pc-manager/src/window/icons/actions/ddc_cleaner_packages_64px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/ddc_cleaner_packages_64px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/def_arrow_right_20px.svg b/deepin-pc-manager/src/window/icons/actions/def_arrow_right_20px.svg deleted file mode 100644 index 04d121e..0000000 --- a/deepin-pc-manager/src/window/icons/actions/def_arrow_right_20px.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/deepin-pc-manager/src/window/icons/actions/def_arrow_right_20px.svg.license b/deepin-pc-manager/src/window/icons/actions/def_arrow_right_20px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/def_arrow_right_20px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/def_usb_storage_add_whitelist_16px.svg b/deepin-pc-manager/src/window/icons/actions/def_usb_storage_add_whitelist_16px.svg deleted file mode 100644 index 5adcc94..0000000 --- a/deepin-pc-manager/src/window/icons/actions/def_usb_storage_add_whitelist_16px.svg +++ /dev/null @@ -1,19 +0,0 @@ - - - Icon/Whitelist - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/def_usb_storage_add_whitelist_16px.svg.license b/deepin-pc-manager/src/window/icons/actions/def_usb_storage_add_whitelist_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/def_usb_storage_add_whitelist_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/def_usb_storage_detail_16px.svg b/deepin-pc-manager/src/window/icons/actions/def_usb_storage_detail_16px.svg deleted file mode 100644 index 9961dcd..0000000 --- a/deepin-pc-manager/src/window/icons/actions/def_usb_storage_detail_16px.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - Icon_check the details - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/def_usb_storage_detail_16px.svg.license b/deepin-pc-manager/src/window/icons/actions/def_usb_storage_detail_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/def_usb_storage_detail_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/def_usb_storage_remove_whitelist_16px.svg b/deepin-pc-manager/src/window/icons/actions/def_usb_storage_remove_whitelist_16px.svg deleted file mode 100644 index 2c4b790..0000000 --- a/deepin-pc-manager/src/window/icons/actions/def_usb_storage_remove_whitelist_16px.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - Icon/Whitelist - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/def_usb_storage_remove_whitelist_16px.svg.license b/deepin-pc-manager/src/window/icons/actions/def_usb_storage_remove_whitelist_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/def_usb_storage_remove_whitelist_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/icon_isolation_20px.svg b/deepin-pc-manager/src/window/icons/actions/icon_isolation_20px.svg deleted file mode 100644 index 5fe7180..0000000 --- a/deepin-pc-manager/src/window/icons/actions/icon_isolation_20px.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - icon_isolation - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/icon_isolation_20px.svg.license b/deepin-pc-manager/src/window/icons/actions/icon_isolation_20px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/icon_isolation_20px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/icon_isolation_dark_20px.svg b/deepin-pc-manager/src/window/icons/actions/icon_isolation_dark_20px.svg deleted file mode 100644 index 9e397df..0000000 --- a/deepin-pc-manager/src/window/icons/actions/icon_isolation_dark_20px.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - icon_isolation_dark - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/icon_isolation_dark_20px.svg.license b/deepin-pc-manager/src/window/icons/actions/icon_isolation_dark_20px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/icon_isolation_dark_20px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/icon_log_details_dark_16px.svg b/deepin-pc-manager/src/window/icons/actions/icon_log_details_dark_16px.svg deleted file mode 100644 index 6891609..0000000 --- a/deepin-pc-manager/src/window/icons/actions/icon_log_details_dark_16px.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - icon_details_dark - Created with Sketch. - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/icon_log_details_dark_16px.svg.license b/deepin-pc-manager/src/window/icons/actions/icon_log_details_dark_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/icon_log_details_dark_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/icon_repair_20px.svg b/deepin-pc-manager/src/window/icons/actions/icon_repair_20px.svg deleted file mode 100644 index 7d38bbb..0000000 --- a/deepin-pc-manager/src/window/icons/actions/icon_repair_20px.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - icon_repair - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/icon_repair_20px.svg.license b/deepin-pc-manager/src/window/icons/actions/icon_repair_20px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/icon_repair_20px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/icon_repair_dark_20px.svg b/deepin-pc-manager/src/window/icons/actions/icon_repair_dark_20px.svg deleted file mode 100644 index cc6c9bd..0000000 --- a/deepin-pc-manager/src/window/icons/actions/icon_repair_dark_20px.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - icon_repair_dark - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/icon_repair_dark_20px.svg.license b/deepin-pc-manager/src/window/icons/actions/icon_repair_dark_20px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/icon_repair_dark_20px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/icon_scansetting_32px.svg b/deepin-pc-manager/src/window/icons/actions/icon_scansetting_32px.svg deleted file mode 100644 index 33b6f3f..0000000 --- a/deepin-pc-manager/src/window/icons/actions/icon_scansetting_32px.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - 设置备份 - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/icon_scansetting_32px.svg.license b/deepin-pc-manager/src/window/icons/actions/icon_scansetting_32px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/icon_scansetting_32px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/icon_scansetting_dark_32px.svg b/deepin-pc-manager/src/window/icons/actions/icon_scansetting_dark_32px.svg deleted file mode 100644 index 6a5a355..0000000 --- a/deepin-pc-manager/src/window/icons/actions/icon_scansetting_dark_32px.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - 设置-浅色 - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/icon_scansetting_dark_32px.svg.license b/deepin-pc-manager/src/window/icons/actions/icon_scansetting_dark_32px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/icon_scansetting_dark_32px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/icon_scansetting_light_32px.svg b/deepin-pc-manager/src/window/icons/actions/icon_scansetting_light_32px.svg deleted file mode 100644 index 5ac2d11..0000000 --- a/deepin-pc-manager/src/window/icons/actions/icon_scansetting_light_32px.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - 设置-深色 - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/icon_scansetting_light_32px.svg.license b/deepin-pc-manager/src/window/icons/actions/icon_scansetting_light_32px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/icon_scansetting_light_32px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/icon_schedulescan_16px.svg b/deepin-pc-manager/src/window/icons/actions/icon_schedulescan_16px.svg deleted file mode 100644 index 34c7de1..0000000 --- a/deepin-pc-manager/src/window/icons/actions/icon_schedulescan_16px.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - Icon_信任区 - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/icon_schedulescan_16px.svg.license b/deepin-pc-manager/src/window/icons/actions/icon_schedulescan_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/icon_schedulescan_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/icon_trust_20px.svg b/deepin-pc-manager/src/window/icons/actions/icon_trust_20px.svg deleted file mode 100644 index 81ae511..0000000 --- a/deepin-pc-manager/src/window/icons/actions/icon_trust_20px.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - icon_trust - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/icon_trust_20px.svg.license b/deepin-pc-manager/src/window/icons/actions/icon_trust_20px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/icon_trust_20px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/icon_trust_dark_20px.svg b/deepin-pc-manager/src/window/icons/actions/icon_trust_dark_20px.svg deleted file mode 100644 index 60f0671..0000000 --- a/deepin-pc-manager/src/window/icons/actions/icon_trust_dark_20px.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - icon_trust_dark - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/icon_trust_dark_20px.svg.license b/deepin-pc-manager/src/window/icons/actions/icon_trust_dark_20px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/icon_trust_dark_20px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/actions/icon_usbscan_16px.svg b/deepin-pc-manager/src/window/icons/actions/icon_usbscan_16px.svg deleted file mode 100644 index 6e4d998..0000000 --- a/deepin-pc-manager/src/window/icons/actions/icon_usbscan_16px.svg +++ /dev/null @@ -1,19 +0,0 @@ - - - Icon/Whitelist - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/actions/icon_usbscan_16px.svg.license b/deepin-pc-manager/src/window/icons/actions/icon_usbscan_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/actions/icon_usbscan_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/dark/actions/def_animated_line_edit_glowing_128px.svg b/deepin-pc-manager/src/window/icons/dark/actions/def_animated_line_edit_glowing_128px.svg deleted file mode 100644 index df2a268..0000000 --- a/deepin-pc-manager/src/window/icons/dark/actions/def_animated_line_edit_glowing_128px.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - glowing_dark - Created with Sketch. - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/dark/actions/def_animated_line_edit_glowing_128px.svg.license b/deepin-pc-manager/src/window/icons/dark/actions/def_animated_line_edit_glowing_128px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/dark/actions/def_animated_line_edit_glowing_128px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/dark/actions/def_arrow_right_20px.svg b/deepin-pc-manager/src/window/icons/dark/actions/def_arrow_right_20px.svg deleted file mode 100644 index c4f4b01..0000000 --- a/deepin-pc-manager/src/window/icons/dark/actions/def_arrow_right_20px.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/deepin-pc-manager/src/window/icons/dark/actions/def_arrow_right_20px.svg.license b/deepin-pc-manager/src/window/icons/dark/actions/def_arrow_right_20px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/dark/actions/def_arrow_right_20px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/dark/actions/def_rdp_port_28px.svg b/deepin-pc-manager/src/window/icons/dark/actions/def_rdp_port_28px.svg deleted file mode 100644 index 8bf05bd..0000000 --- a/deepin-pc-manager/src/window/icons/dark/actions/def_rdp_port_28px.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - ICon/rdp port_dark - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/dark/actions/def_rdp_port_28px.svg.license b/deepin-pc-manager/src/window/icons/dark/actions/def_rdp_port_28px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/dark/actions/def_rdp_port_28px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/dark/actions/def_select_16px.svg b/deepin-pc-manager/src/window/icons/dark/actions/def_select_16px.svg deleted file mode 100644 index d6b4e95..0000000 --- a/deepin-pc-manager/src/window/icons/dark/actions/def_select_16px.svg +++ /dev/null @@ -1,23 +0,0 @@ - - - - select_dark - Created with Sketch. - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/dark/actions/def_select_16px.svg.license b/deepin-pc-manager/src/window/icons/dark/actions/def_select_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/dark/actions/def_select_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/dark/icons/def_data_usage_96px.svg b/deepin-pc-manager/src/window/icons/dark/icons/def_data_usage_96px.svg deleted file mode 100644 index 82d38f5..0000000 --- a/deepin-pc-manager/src/window/icons/dark/icons/def_data_usage_96px.svg +++ /dev/null @@ -1,123 +0,0 @@ - - - - ICON/Data Usage_dark - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/dark/icons/def_data_usage_96px.svg.license b/deepin-pc-manager/src/window/icons/dark/icons/def_data_usage_96px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/dark/icons/def_data_usage_96px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/dark/icons/def_developers_28px.svg b/deepin-pc-manager/src/window/icons/dark/icons/def_developers_28px.svg deleted file mode 100644 index 5de6827..0000000 --- a/deepin-pc-manager/src/window/icons/dark/icons/def_developers_28px.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - ICon/developers_dark - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/dark/icons/def_developers_28px.svg.license b/deepin-pc-manager/src/window/icons/dark/icons/def_developers_28px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/dark/icons/def_developers_28px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/dark/icons/def_disk_28px.svg b/deepin-pc-manager/src/window/icons/dark/icons/def_disk_28px.svg deleted file mode 100644 index e7b31c9..0000000 --- a/deepin-pc-manager/src/window/icons/dark/icons/def_disk_28px.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - ICon/disk_dark - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/dark/icons/def_disk_28px.svg.license b/deepin-pc-manager/src/window/icons/dark/icons/def_disk_28px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/dark/icons/def_disk_28px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/dark/icons/def_garbage_28px.svg b/deepin-pc-manager/src/window/icons/dark/icons/def_garbage_28px.svg deleted file mode 100644 index e5a2b01..0000000 --- a/deepin-pc-manager/src/window/icons/dark/icons/def_garbage_28px.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - ICon/garbage_dark - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/dark/icons/def_garbage_28px.svg.license b/deepin-pc-manager/src/window/icons/dark/icons/def_garbage_28px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/dark/icons/def_garbage_28px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/dark/icons/def_internet_control_96px.svg b/deepin-pc-manager/src/window/icons/dark/icons/def_internet_control_96px.svg deleted file mode 100644 index 631f22e..0000000 --- a/deepin-pc-manager/src/window/icons/dark/icons/def_internet_control_96px.svg +++ /dev/null @@ -1,171 +0,0 @@ - - - - ICON/Internet Control_dark - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/dark/icons/def_internet_control_96px.svg.license b/deepin-pc-manager/src/window/icons/dark/icons/def_internet_control_96px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/dark/icons/def_internet_control_96px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/dark/icons/def_self_starting_28px.svg b/deepin-pc-manager/src/window/icons/dark/icons/def_self_starting_28px.svg deleted file mode 100644 index 7649667..0000000 --- a/deepin-pc-manager/src/window/icons/dark/icons/def_self_starting_28px.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - ICon/self-starting_dark - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/dark/icons/def_self_starting_28px.svg.license b/deepin-pc-manager/src/window/icons/dark/icons/def_self_starting_28px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/dark/icons/def_self_starting_28px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/dark/icons/def_startup_programs_96px.svg b/deepin-pc-manager/src/window/icons/dark/icons/def_startup_programs_96px.svg deleted file mode 100644 index 07f9981..0000000 --- a/deepin-pc-manager/src/window/icons/dark/icons/def_startup_programs_96px.svg +++ /dev/null @@ -1,169 +0,0 @@ - - - - ICON/Startup Programs_dark - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/dark/icons/def_startup_programs_96px.svg.license b/deepin-pc-manager/src/window/icons/dark/icons/def_startup_programs_96px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/dark/icons/def_startup_programs_96px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/dark/icons/def_system_upgrade_28px.svg b/deepin-pc-manager/src/window/icons/dark/icons/def_system_upgrade_28px.svg deleted file mode 100644 index 6dd7234..0000000 --- a/deepin-pc-manager/src/window/icons/dark/icons/def_system_upgrade_28px.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - ICon/System upgrade_dark - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/dark/icons/def_system_upgrade_28px.svg.license b/deepin-pc-manager/src/window/icons/dark/icons/def_system_upgrade_28px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/dark/icons/def_system_upgrade_28px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/dark/icons/def_trojan_virus_28px.svg b/deepin-pc-manager/src/window/icons/dark/icons/def_trojan_virus_28px.svg deleted file mode 100644 index c8cc4cf..0000000 --- a/deepin-pc-manager/src/window/icons/dark/icons/def_trojan_virus_28px.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - ICon/Trojan virus_dark - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/dark/icons/def_trojan_virus_28px.svg.license b/deepin-pc-manager/src/window/icons/dark/icons/def_trojan_virus_28px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/dark/icons/def_trojan_virus_28px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/dark/icons/def_virus_reservoir_28px.svg b/deepin-pc-manager/src/window/icons/dark/icons/def_virus_reservoir_28px.svg deleted file mode 100644 index a101505..0000000 --- a/deepin-pc-manager/src/window/icons/dark/icons/def_virus_reservoir_28px.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - ICon/virus reservoir_dark - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/dark/icons/def_virus_reservoir_28px.svg.license b/deepin-pc-manager/src/window/icons/dark/icons/def_virus_reservoir_28px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/dark/icons/def_virus_reservoir_28px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/defender_icons.qrc b/deepin-pc-manager/src/window/icons/defender_icons.qrc index 77d80db..1f811fc 100644 --- a/deepin-pc-manager/src/window/icons/defender_icons.qrc +++ b/deepin-pc-manager/src/window/icons/defender_icons.qrc @@ -1,77 +1,10 @@ - actions/dcc_application_security_32px.svg - actions/dcc_home_32px.svg - actions/dcc_network_protection_32px.svg - actions/dcc_system_security_32px.svg - actions/dcc_virus_scan_32px.svg - icons/dcc_full_marks_empty_150px.svg - icons/dcc_home_image_300px.svg - icons/deepin-defender.svg icons/deepin-pc-manager.svg - icons/water_blue_back.svg - icons/water_blue_front.svg - icons/water_yellow_back.svg - icons/water_yellow_front.svg - icons/water_red_back.svg - icons/water_red_front.svg - icons/dcc_network_protection_detection_image_300px.svg - icons/dcc_startup_disable_29px.svg - icons/dcc_startup_enable_29px.svg - icons/dcc_login_tip_32px.svg - icons/dcc_home_restore_20px.svg - icons/dcc_home_normal_20px.svg - icons/dcc_magnifier_60px.svg - actions/icon_isolation_20px.svg - actions/icon_repair_20px.svg - actions/dcc_antiav_all1_96px.svg - actions/dcc_antiav_customer1_96px.svg - actions/dcc_antiav_quick1_96px.svg - actions/dcc_antiav_thread_96px.svg - actions/dcc_antiav_thread_repaired_96px.svg - icons/dcc_antiav_warning_20px.svg - actions/dcc_natiav_log_details_16px.svg - icons/dcc_antiav_normal_20px.svg - icons/dcc_antiav_empty_100px.svg - icons/dcc_virus_home_page_146px.svg - icons/dcc_virus_check_update_14px.svg - icons/dcc_virus_update_14px.svg - icons/dcc_control_button_12px.svg - icons/dcc_control_button_disable_12px.svg - icons/dcc_application_executable_128px.svg - actions/icon_isolation_dark_20px.svg - actions/icon_repair_dark_20px.svg - actions/icon_trust_20px.svg - actions/icon_trust_dark_20px.svg - actions/icon_usbscan_16px.svg - actions/icon_schedulescan_16px.svg - actions/icon_scansetting_32px.svg - actions/icon_scansetting_light_32px.svg - actions/icon_scansetting_dark_32px.svg - icons/dcc_home_image_dark_300px.svg - icons/dcc_home_image_oem_300px.svg - icons/dcc_home_image_oem_dark_300px.svg - icons/dcc_home_detection_image_dark_300px.svg - icons/dcc_home_detection_image_300px.svg - actions/dcc_application_security_dark_32px.svg - actions/dcc_home_dark_32px.svg - actions/dcc_network_protection_dark_32px.svg - actions/dcc_system_security_dark_32px.svg - actions/dcc_Virus_Scan_dark_32px.svg - icons/dcc_warning_20px.svg - icons/dcc_warning_tip_20px.svg - icons/dcc_care_tip_20px.svg icons/dcc_ok_tip_20px.svg - actions/icon_log_details_dark_16px.svg - actions/ddc_cleaner_packages_64px.svg - actions/ddc_cleaner_app_cache_64px.svg - actions/ddc_cleaner_app_logs_64px.svg - actions/ddc_cleaner_crash_64px.svg - icons/ddc_cleaner_512px.svg - icons/dcc_Home_deepin_image_300px.svg - icons/dcc_Home_deepin_image_dark_300px.svg - icons/dcc_Home_detection_deepin_image_dark_300px.svg - icons/dcc_Home_detection-deepin_image_300px.svg + icons/dcc_service_support_128px.svg + icons/dcc_syscheck_main_logo_300px.svg + icons/dcc_syscheck_progress_cancel_16px.svg icons/dcc_syscheck_main_logo_300px.svg icons/dcc_syscheck_item_normal_16px.svg icons/dcc_syscheck_item_abnormal_16px.svg @@ -90,85 +23,6 @@ icons/dcc_syscheck_item_sysupdate_16px.svg icons/dcc_syscheck_progress_cancel_16px.svg icons/dcc_syscheck_progressing_320px.png - actions/dcc_antiav_quarantine_dark_16px.svg - actions/dcc_antiav_whitelist_dark_16px.svg - actions/dcc_antiav_quarantine_16px.svg - actions/dcc_antiav_scanLogs_16px.svg - actions/dcc_antiav_whitelist_16px.svg - actions/dcc_antiav_scanLogs_dark_16px.svg - icons/dcc_antiav_no_engine_160px.png - actions/dcc_rising_logo_26px.svg - actions/dcc_Ahprotector_log_26px.svg - actions/dcc_cleanup_32px.svg - actions/dcc_cleanup_dark_32px.svg - actions/dcc_tools_32px.svg - actions/dcc_tools_dark_32px.svg - light/icons/def_developers_28px.svg - light/icons/def_disk_28px.svg - light/icons/def_garbage_28px.svg - light/icons/def_self_starting_28px.svg - light/icons/def_system_upgrade_28px.svg - light/icons/def_trojan_virus_28px.svg - light/icons/def_virus_reservoir_28px.svg - dark/icons/def_developers_28px.svg - dark/icons/def_disk_28px.svg - dark/icons/def_garbage_28px.svg - dark/icons/def_self_starting_28px.svg - dark/icons/def_system_upgrade_28px.svg - dark/icons/def_trojan_virus_28px.svg - dark/icons/def_virus_reservoir_28px.svg - icons/dcc_cleaner_big_logo_dark_300px.svg - icons/dcc_cleaner_header_logo_100px.svg - icons/dcc_cleaner_big_logo_300px.svg - icons/dcc_cleaner_greeting_320px.svg - icons/dcc_cleaner_cleaned_146px.svg - icons/dcc_cleaner_scanned_146px.svg - icons/dcc_cleaner_scanning_146px.svg - light/icons/def_startup_programs_96px.svg - light/icons/def_internet_control_96px.svg - light/icons/def_data_usage_96px.svg - dark/icons/def_data_usage_96px.svg - dark/icons/def_internet_control_96px.svg - dark/icons/def_startup_programs_96px.svg - icons/dcc_security_level_high_20px.svg - icons/dcc_security_level_low_20px.svg - icons/dcc_security_level_medium_20px.svg - icons/dcc_system_level_high_20px.svg - icons/dcc_system_level_low_20px.svg - icons/dcc_system_level_medium_20px.svg - dark/actions/def_select_16px.svg - light/actions/def_select_16px.svg - dark/actions/def_rdp_port_28px.svg - light/actions/def_rdp_port_28px.svg - icons/def_usb_connection_96px.svg - icons/def_usb_storage_detail_dlg_96px.svg - actions/def_usb_storage_detail_16px.svg - actions/def_usb_storage_add_whitelist_16px.svg - actions/def_usb_storage_remove_whitelist_16px.svg - icons/def_login_safety_96px.svg - icons/def_system_safe_level_96px.svg - icons/def_file_trust_protection_96px.svg - icons/dcc_update_version_16px.svg - icons/def_delete_16px.svg - light/actions/def_arrow_right_20px.svg - dark/actions/def_arrow_right_20px.svg - icons/def_firewall_mode_public_14px.svg - icons/def_firewall_mode_private_14px.svg - icons/def_firewall_mode_customized_14px.svg - icons/def_firewall_policy_enable_18px.svg - icons/def_firewall_policy_disable_18px.svg - icons/dcc_trustedprotection_warning_icon20.svg - light/actions/def_animated_line_edit_glowing_128px.svg - dark/actions/def_animated_line_edit_glowing_128px.svg - icons/def_securitylevel_privilege_18px.svg - icons/dcc_trustedprotection_forbid_icon_20px.svg - icons/def_warning_18px.svg - icons/dcc_stop_hover_25px.png - icons/def_Icon_Whitelist_16px.svg - icons/def_under_udcp_manage_128px.svg - icons/dcc_loginsafety_level_high_30px.svg - icons/dcc_loginsafety_level_low_30px.svg - icons/dcc_loginsafety_level_medium_30px.svg icons/dcc_cleaner_app_icon_16px.svg icons/dcc_cleaner_cookies_icon_16px.svg icons/dcc_cleaner_history_icon_16px.svg @@ -177,19 +31,14 @@ icons/dcc_cleaner_cookies_dark_icon_16px.svg icons/dcc_cleaner_history_dark_icon_16px.svg icons/dcc_cleaner_sys_dark_icon_16px.svg - icons/Document_shredder_48px.svg - icons/firewall_48px.svg - icons/Internet_Control_48px.svg - icons/Login_security_48px.svg - icons/Network_in_the_diagnosis of_48px.svg - icons/Reliable_protection_48px.svg - icons/Startup_Programs_48px.svg - icons/Super_protection_48px.svg - icons/System_security_level_48px.svg - icons/The_kernel_module_is_uninstalled_48px.svg - icons/usb_controls_48px.svg - icons/Data Usage_48px.svg - icons/def_superior_protection_350px.svg - icons/No_related_tool_is_found_96px.svg + icons/dcc_cleaner_greeting_320px.svg + icons/dcc_cleaner_scanned_146px.svg + icons/dcc_cleaner_cleaned_146px.svg + actions/dcc_system_check_32px.svg + actions/dcc_system_check_dark_32px.svg + actions/dcc_trash_clean_32px.svg + actions/dcc_trash_clean_dark_32px.svg + actions/dcc_tool_box_32px.svg + actions/dcc_tool_box_dark_32px.svg diff --git a/deepin-pc-manager/src/window/icons/icons/Data Usage_48px.svg b/deepin-pc-manager/src/window/icons/icons/Data Usage_48px.svg deleted file mode 100644 index a040d8a..0000000 --- a/deepin-pc-manager/src/window/icons/icons/Data Usage_48px.svg +++ /dev/null @@ -1,50 +0,0 @@ - - - ICON/Data Usage - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/Data Usage_48px.svg.license b/deepin-pc-manager/src/window/icons/icons/Data Usage_48px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/Data Usage_48px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/Document_shredder_48px.svg b/deepin-pc-manager/src/window/icons/icons/Document_shredder_48px.svg deleted file mode 100644 index 5dccc9d..0000000 --- a/deepin-pc-manager/src/window/icons/icons/Document_shredder_48px.svg +++ /dev/null @@ -1,64 +0,0 @@ - - - ICON/Security_tools/Document_shredder - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/Document_shredder_48px.svg.license b/deepin-pc-manager/src/window/icons/icons/Document_shredder_48px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/Document_shredder_48px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/Internet_Control_48px.svg b/deepin-pc-manager/src/window/icons/icons/Internet_Control_48px.svg deleted file mode 100644 index af509ed..0000000 --- a/deepin-pc-manager/src/window/icons/icons/Internet_Control_48px.svg +++ /dev/null @@ -1,31 +0,0 @@ - - - ICON/Security_tools/Internet_Control - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/Internet_Control_48px.svg.license b/deepin-pc-manager/src/window/icons/icons/Internet_Control_48px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/Internet_Control_48px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/Login_security_48px.svg b/deepin-pc-manager/src/window/icons/icons/Login_security_48px.svg deleted file mode 100644 index 997f7ae..0000000 --- a/deepin-pc-manager/src/window/icons/icons/Login_security_48px.svg +++ /dev/null @@ -1,43 +0,0 @@ - - - ICON/Security_tools/Data_Usage - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/Login_security_48px.svg.license b/deepin-pc-manager/src/window/icons/icons/Login_security_48px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/Login_security_48px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/Network_in_the_diagnosis of_48px.svg.license b/deepin-pc-manager/src/window/icons/icons/Network_in_the_diagnosis of_48px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/Network_in_the_diagnosis of_48px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/No_related_tool_is_found_96px.svg b/deepin-pc-manager/src/window/icons/icons/No_related_tool_is_found_96px.svg deleted file mode 100644 index 32e6faf..0000000 --- a/deepin-pc-manager/src/window/icons/icons/No_related_tool_is_found_96px.svg +++ /dev/null @@ -1,55 +0,0 @@ - - - illustrations/No_related_tool_is_found - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/No_related_tool_is_found_96px.svg.license b/deepin-pc-manager/src/window/icons/icons/No_related_tool_is_found_96px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/No_related_tool_is_found_96px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/Reliable_protection_48px.svg b/deepin-pc-manager/src/window/icons/icons/Reliable_protection_48px.svg deleted file mode 100644 index 858fde5..0000000 --- a/deepin-pc-manager/src/window/icons/icons/Reliable_protection_48px.svg +++ /dev/null @@ -1,34 +0,0 @@ - - - ICON/Security_tools/Reliable_protection - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/Reliable_protection_48px.svg.license b/deepin-pc-manager/src/window/icons/icons/Reliable_protection_48px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/Reliable_protection_48px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/Startup_Programs_48px.svg.license b/deepin-pc-manager/src/window/icons/icons/Startup_Programs_48px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/Startup_Programs_48px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/Super_protection_48px.svg b/deepin-pc-manager/src/window/icons/icons/Super_protection_48px.svg deleted file mode 100644 index 583d75c..0000000 --- a/deepin-pc-manager/src/window/icons/icons/Super_protection_48px.svg +++ /dev/null @@ -1,46 +0,0 @@ - - - ICON/Security_tools/Super_protection - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/Super_protection_48px.svg.license b/deepin-pc-manager/src/window/icons/icons/Super_protection_48px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/Super_protection_48px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/System_security_level_48px.svg b/deepin-pc-manager/src/window/icons/icons/System_security_level_48px.svg deleted file mode 100644 index fa9d6e3..0000000 --- a/deepin-pc-manager/src/window/icons/icons/System_security_level_48px.svg +++ /dev/null @@ -1,103 +0,0 @@ - - - ICON/Security_tools/System_security_level - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/System_security_level_48px.svg.license b/deepin-pc-manager/src/window/icons/icons/System_security_level_48px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/System_security_level_48px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/The_kernel_module_is_uninstalled_48px.svg b/deepin-pc-manager/src/window/icons/icons/The_kernel_module_is_uninstalled_48px.svg deleted file mode 100644 index 89bdbbd..0000000 --- a/deepin-pc-manager/src/window/icons/icons/The_kernel_module_is_uninstalled_48px.svg +++ /dev/null @@ -1,72 +0,0 @@ - - - ICON/Security_tools/The_kernel_module_is_uninstalled - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/The_kernel_module_is_uninstalled_48px.svg.license b/deepin-pc-manager/src/window/icons/icons/The_kernel_module_is_uninstalled_48px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/The_kernel_module_is_uninstalled_48px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_Home_deepin_image_300px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_Home_deepin_image_300px.svg deleted file mode 100644 index 13d0d23..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_Home_deepin_image_300px.svg +++ /dev/null @@ -1,357 +0,0 @@ - - - - dcc_Home-deepin image_300px - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_Home_deepin_image_300px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_Home_deepin_image_300px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_Home_deepin_image_300px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_Home_deepin_image_dark_300px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_Home_deepin_image_dark_300px.svg deleted file mode 100644 index 154914a..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_Home_deepin_image_dark_300px.svg +++ /dev/null @@ -1,353 +0,0 @@ - - - - dcc_Home-deepin image_300px_dark - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_Home_deepin_image_dark_300px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_Home_deepin_image_dark_300px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_Home_deepin_image_dark_300px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_Home_detection-deepin_image_300px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_Home_detection-deepin_image_300px.svg deleted file mode 100644 index 29ddcbf..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_Home_detection-deepin_image_300px.svg +++ /dev/null @@ -1,361 +0,0 @@ - - - - dcc_Home detection image_300px - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_Home_detection-deepin_image_300px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_Home_detection-deepin_image_300px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_Home_detection-deepin_image_300px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_Home_detection_deepin_image_dark_300px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_Home_detection_deepin_image_dark_300px.svg deleted file mode 100644 index 6d428ba..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_Home_detection_deepin_image_dark_300px.svg +++ /dev/null @@ -1,357 +0,0 @@ - - - - dcc_Home detection image_dark-300px - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_Home_detection_deepin_image_dark_300px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_Home_detection_deepin_image_dark_300px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_Home_detection_deepin_image_dark_300px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_antiav_empty_100px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_antiav_empty_100px.svg deleted file mode 100644 index 793cd1b..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_antiav_empty_100px.svg +++ /dev/null @@ -1,108 +0,0 @@ - - - Illustration/Successfully_repaired_the_Trojan_horse-no_abnormal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_antiav_empty_100px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_antiav_empty_100px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_antiav_empty_100px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_antiav_no_engine_160px.png b/deepin-pc-manager/src/window/icons/icons/dcc_antiav_no_engine_160px.png deleted file mode 100644 index a051fef..0000000 Binary files a/deepin-pc-manager/src/window/icons/icons/dcc_antiav_no_engine_160px.png and /dev/null differ diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_antiav_no_engine_160px.png.license b/deepin-pc-manager/src/window/icons/icons/dcc_antiav_no_engine_160px.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_antiav_no_engine_160px.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_antiav_normal_20px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_antiav_normal_20px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_antiav_normal_20px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_antiav_warning_20px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_antiav_warning_20px.svg deleted file mode 100644 index 702bf08..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_antiav_warning_20px.svg +++ /dev/null @@ -1,28 +0,0 @@ - - - - icon/warning - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_antiav_warning_20px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_antiav_warning_20px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_antiav_warning_20px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_application_executable_128px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_application_executable_128px.svg deleted file mode 100644 index 33ff1a7..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_application_executable_128px.svg +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_application_executable_128px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_application_executable_128px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_application_executable_128px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_care_tip_20px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_care_tip_20px.svg deleted file mode 100644 index 5c4d7f9..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_care_tip_20px.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - 注意 - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_care_tip_20px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_care_tip_20px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_care_tip_20px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_app_dark_icon_16px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_app_dark_icon_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_app_dark_icon_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_app_icon_16px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_app_icon_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_app_icon_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_big_logo_300px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_big_logo_300px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_big_logo_300px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_big_logo_dark_300px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_big_logo_dark_300px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_big_logo_dark_300px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_cleaned_146px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_cleaned_146px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_cleaned_146px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_cookies_dark_icon_16px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_cookies_dark_icon_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_cookies_dark_icon_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_cookies_icon_16px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_cookies_icon_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_cookies_icon_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_greeting_320px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_greeting_320px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_greeting_320px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_header_logo_100px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_header_logo_100px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_header_logo_100px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_history_dark_icon_16px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_history_dark_icon_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_history_dark_icon_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_history_icon_16px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_history_icon_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_history_icon_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_scanned_146px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_scanned_146px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_scanned_146px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_scanning_146px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_scanning_146px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_scanning_146px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_sys_dark_icon_16px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_sys_dark_icon_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_sys_dark_icon_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_sys_icon_16px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_sys_icon_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_cleaner_sys_icon_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_control_button_12px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_control_button_12px.svg deleted file mode 100644 index 3e2ebad..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_control_button_12px.svg +++ /dev/null @@ -1,28 +0,0 @@ - - - - Icon_调节 - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_control_button_12px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_control_button_12px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_control_button_12px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_control_button_disable_12px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_control_button_disable_12px.svg deleted file mode 100644 index c47662a..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_control_button_disable_12px.svg +++ /dev/null @@ -1,28 +0,0 @@ - - - - Icon_调节 - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_control_button_disable_12px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_control_button_disable_12px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_control_button_disable_12px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_full_marks_empty_150px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_full_marks_empty_150px.svg deleted file mode 100644 index 8c3d739..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_full_marks_empty_150px.svg +++ /dev/null @@ -1,47 +0,0 @@ - - - - dcc_Full marks empty_150px - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_full_marks_empty_150px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_full_marks_empty_150px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_full_marks_empty_150px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_home_detection_image_300px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_home_detection_image_300px.svg deleted file mode 100644 index 56a1fc6..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_home_detection_image_300px.svg +++ /dev/null @@ -1,330 +0,0 @@ - - - - dcc_Home detection image_300px - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_home_detection_image_300px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_home_detection_image_300px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_home_detection_image_300px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_home_detection_image_dark_300px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_home_detection_image_dark_300px.svg deleted file mode 100644 index 538217f..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_home_detection_image_dark_300px.svg +++ /dev/null @@ -1,330 +0,0 @@ - - - - dcc_Home detection image_dark-300px - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_home_detection_image_dark_300px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_home_detection_image_dark_300px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_home_detection_image_dark_300px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_home_image_300px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_home_image_300px.svg deleted file mode 100644 index 8981f65..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_home_image_300px.svg +++ /dev/null @@ -1,328 +0,0 @@ - - - - dcc_Home image_300px - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_home_image_300px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_home_image_300px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_home_image_300px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_home_image_dark_300px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_home_image_dark_300px.svg deleted file mode 100644 index 3a9ec10..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_home_image_dark_300px.svg +++ /dev/null @@ -1,324 +0,0 @@ - - - - dcc_Home image_300px_dark - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_home_image_dark_300px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_home_image_dark_300px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_home_image_dark_300px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_home_image_oem_300px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_home_image_oem_300px.svg deleted file mode 100644 index f5e4cc6..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_home_image_oem_300px.svg +++ /dev/null @@ -1,256 +0,0 @@ - - - dcc_Home image_300px - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_home_image_oem_300px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_home_image_oem_300px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_home_image_oem_300px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_home_image_oem_dark_300px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_home_image_oem_dark_300px.svg deleted file mode 100644 index 200d16f..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_home_image_oem_dark_300px.svg +++ /dev/null @@ -1,229 +0,0 @@ - - - dcc_Home image _300px_dark - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_home_image_oem_dark_300px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_home_image_oem_dark_300px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_home_image_oem_dark_300px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_home_normal_20px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_home_normal_20px.svg deleted file mode 100644 index ca38be4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_home_normal_20px.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - ok_12px - Created with Sketch. - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_home_normal_20px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_home_normal_20px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_home_normal_20px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_home_restore_20px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_home_restore_20px.svg deleted file mode 100644 index e10f101..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_home_restore_20px.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - warning_12px - Created with Sketch. - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_home_restore_20px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_home_restore_20px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_home_restore_20px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_login_tip_32px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_login_tip_32px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_login_tip_32px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_loginsafety_level_high_30px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_loginsafety_level_high_30px.svg deleted file mode 100644 index 7700156..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_loginsafety_level_high_30px.svg +++ /dev/null @@ -1,30 +0,0 @@ - - - 防护等级/高备份 - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_loginsafety_level_high_30px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_loginsafety_level_high_30px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_loginsafety_level_high_30px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_loginsafety_level_low_30px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_loginsafety_level_low_30px.svg deleted file mode 100644 index 6c69389..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_loginsafety_level_low_30px.svg +++ /dev/null @@ -1,30 +0,0 @@ - - - 登录安全/低备份 - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_loginsafety_level_low_30px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_loginsafety_level_low_30px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_loginsafety_level_low_30px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_loginsafety_level_medium_30px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_loginsafety_level_medium_30px.svg deleted file mode 100644 index 994ec56..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_loginsafety_level_medium_30px.svg +++ /dev/null @@ -1,30 +0,0 @@ - - - 登录安全/中备份 - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_loginsafety_level_medium_30px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_loginsafety_level_medium_30px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_loginsafety_level_medium_30px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_magnifier_60px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_magnifier_60px.svg deleted file mode 100755 index cab72f9..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_magnifier_60px.svg +++ /dev/null @@ -1,84 +0,0 @@ - - - - 放大镜 - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_magnifier_60px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_magnifier_60px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_magnifier_60px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_network_protection_detection_image_300px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_network_protection_detection_image_300px.svg deleted file mode 100644 index 49bed41..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_network_protection_detection_image_300px.svg +++ /dev/null @@ -1,171 +0,0 @@ - - - - dcc_firewall_300px - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_network_protection_detection_image_300px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_network_protection_detection_image_300px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_network_protection_detection_image_300px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_ok_tip_20px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_ok_tip_20px.svg index c336ead..2d4b932 100644 --- a/deepin-pc-manager/src/window/icons/icons/dcc_ok_tip_20px.svg +++ b/deepin-pc-manager/src/window/icons/icons/dcc_ok_tip_20px.svg @@ -1,16 +1,26 @@ - - icon/ok - - - - - - - - - - + + + icon/limit + Created with Sketch. + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_ok_tip_20px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_ok_tip_20px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_ok_tip_20px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_security_level_high_20px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_security_level_high_20px.svg deleted file mode 100644 index 083aec8..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_security_level_high_20px.svg +++ /dev/null @@ -1,23 +0,0 @@ - - - - dcc_High_20px - Created with Sketch. - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_security_level_high_20px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_security_level_high_20px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_security_level_high_20px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_security_level_low_20px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_security_level_low_20px.svg deleted file mode 100644 index c7044b3..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_security_level_low_20px.svg +++ /dev/null @@ -1,23 +0,0 @@ - - - - dcc_Low_20px - Created with Sketch. - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_security_level_low_20px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_security_level_low_20px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_security_level_low_20px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_security_level_medium_20px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_security_level_medium_20px.svg deleted file mode 100644 index 349b351..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_security_level_medium_20px.svg +++ /dev/null @@ -1,23 +0,0 @@ - - - - dcc_Medium_20px - Created with Sketch. - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_security_level_medium_20px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_security_level_medium_20px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_security_level_medium_20px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_service_support_128px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_service_support_128px.svg new file mode 100644 index 0000000..4319876 --- /dev/null +++ b/deepin-pc-manager/src/window/icons/icons/dcc_service_support_128px.svg @@ -0,0 +1,12 @@ + + + 服务热线 + + + + + + + + + \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_startup_disable_29px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_startup_disable_29px.svg deleted file mode 100644 index eb8e3d5..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_startup_disable_29px.svg +++ /dev/null @@ -1,33 +0,0 @@ - - - - list_delete - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_startup_disable_29px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_startup_disable_29px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_startup_disable_29px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_startup_enable_29px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_startup_enable_29px.svg deleted file mode 100644 index 0548618..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_startup_enable_29px.svg +++ /dev/null @@ -1,33 +0,0 @@ - - - - 编组 8 - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_startup_enable_29px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_startup_enable_29px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_startup_enable_29px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_stop_hover_25px.png b/deepin-pc-manager/src/window/icons/icons/dcc_stop_hover_25px.png deleted file mode 100644 index 9ce34bc..0000000 Binary files a/deepin-pc-manager/src/window/icons/icons/dcc_stop_hover_25px.png and /dev/null differ diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_stop_hover_25px.png.license b/deepin-pc-manager/src/window/icons/icons/dcc_stop_hover_25px.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_stop_hover_25px.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_abnormal_16px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_abnormal_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_abnormal_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_antivirus_16px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_antivirus_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_antivirus_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_autostart_16px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_autostart_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_autostart_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_avupdate_16px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_avupdate_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_avupdate_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_dev_16px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_dev_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_dev_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_disk_16px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_disk_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_disk_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_garbage_16px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_garbage_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_garbage_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_ignore_16px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_ignore_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_ignore_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_noignore_16px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_noignore_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_noignore_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_normal_16px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_normal_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_normal_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_ssh_16px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_ssh_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_ssh_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_sysupdate_16px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_sysupdate_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_item_sysupdate_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_main_logo_300px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_main_logo_300px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_main_logo_300px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_progress_cancel_16px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_progress_cancel_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_progress_cancel_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_progressing_320px.png.license b/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_progressing_320px.png.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_progressing_320px.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_result_100point_146px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_result_100point_146px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_result_100point_146px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_result_abnormal_146px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_result_abnormal_146px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_result_abnormal_146px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_result_repair_146px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_result_repair_146px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_syscheck_result_repair_146px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_system_level_high_20px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_system_level_high_20px.svg deleted file mode 100644 index 130b07f..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_system_level_high_20px.svg +++ /dev/null @@ -1,39 +0,0 @@ - - - 防护等级/高 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_system_level_high_20px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_system_level_high_20px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_system_level_high_20px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_system_level_low_20px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_system_level_low_20px.svg deleted file mode 100644 index f810379..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_system_level_low_20px.svg +++ /dev/null @@ -1,39 +0,0 @@ - - - 防护等级/低 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_system_level_low_20px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_system_level_low_20px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_system_level_low_20px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_system_level_medium_20px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_system_level_medium_20px.svg deleted file mode 100644 index 5ca8643..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_system_level_medium_20px.svg +++ /dev/null @@ -1,39 +0,0 @@ - - - 防护等级/中 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_system_level_medium_20px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_system_level_medium_20px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_system_level_medium_20px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_trustedprotection_forbid_icon_20px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_trustedprotection_forbid_icon_20px.svg deleted file mode 100644 index 29d4df5..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_trustedprotection_forbid_icon_20px.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - 禁止 - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_trustedprotection_forbid_icon_20px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_trustedprotection_forbid_icon_20px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_trustedprotection_forbid_icon_20px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_trustedprotection_warning_icon20.svg b/deepin-pc-manager/src/window/icons/icons/dcc_trustedprotection_warning_icon20.svg deleted file mode 100644 index 2ec57c6..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_trustedprotection_warning_icon20.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - 警告 - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_trustedprotection_warning_icon20.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_trustedprotection_warning_icon20.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_trustedprotection_warning_icon20.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_update_version_16px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_update_version_16px.svg deleted file mode 100644 index 8d2ec5f..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_update_version_16px.svg +++ /dev/null @@ -1,33 +0,0 @@ - - - icon/ok - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_update_version_16px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_update_version_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_update_version_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_virus_check_update_14px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_virus_check_update_14px.svg deleted file mode 100644 index 77c638c..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_virus_check_update_14px.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - 更新 - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_virus_check_update_14px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_virus_check_update_14px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_virus_check_update_14px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_virus_home_page_146px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_virus_home_page_146px.svg deleted file mode 100644 index b20cea9..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_virus_home_page_146px.svg +++ /dev/null @@ -1,126 +0,0 @@ - - - Illustration/Anti_Virus/home - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_virus_home_page_146px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_virus_home_page_146px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_virus_home_page_146px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_virus_update_14px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_virus_update_14px.svg deleted file mode 100644 index cef43ac..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_virus_update_14px.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - 检查更新 - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_virus_update_14px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_virus_update_14px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_virus_update_14px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_warning_20px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_warning_20px.svg deleted file mode 100644 index 246e9b5..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_warning_20px.svg +++ /dev/null @@ -1,27 +0,0 @@ - - - - icon/warning - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_warning_20px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_warning_20px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_warning_20px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_warning_tip_20px.svg b/deepin-pc-manager/src/window/icons/icons/dcc_warning_tip_20px.svg deleted file mode 100644 index 0b0391b..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_warning_tip_20px.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - icon/warning - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/dcc_warning_tip_20px.svg.license b/deepin-pc-manager/src/window/icons/icons/dcc_warning_tip_20px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/dcc_warning_tip_20px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/ddc_cleaner_512px.svg b/deepin-pc-manager/src/window/icons/icons/ddc_cleaner_512px.svg deleted file mode 100644 index a27c023..0000000 --- a/deepin-pc-manager/src/window/icons/icons/ddc_cleaner_512px.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/ddc_cleaner_512px.svg.license b/deepin-pc-manager/src/window/icons/icons/ddc_cleaner_512px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/ddc_cleaner_512px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/deepin-defender.svg b/deepin-pc-manager/src/window/icons/icons/deepin-defender.svg deleted file mode 100644 index d12f136..0000000 --- a/deepin-pc-manager/src/window/icons/icons/deepin-defender.svg +++ /dev/null @@ -1,69 +0,0 @@ - - - - Security Center-24px - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/deepin-defender.svg.license b/deepin-pc-manager/src/window/icons/icons/deepin-defender.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/deepin-defender.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/deepin-pc-manager.svg.license b/deepin-pc-manager/src/window/icons/icons/deepin-pc-manager.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/deepin-pc-manager.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/def_Icon_Whitelist_16px.svg b/deepin-pc-manager/src/window/icons/icons/def_Icon_Whitelist_16px.svg deleted file mode 100644 index 5baba07..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_Icon_Whitelist_16px.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - Icon/Whitelist - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/def_Icon_Whitelist_16px.svg.license b/deepin-pc-manager/src/window/icons/icons/def_Icon_Whitelist_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_Icon_Whitelist_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/def_delete_16px.svg b/deepin-pc-manager/src/window/icons/icons/def_delete_16px.svg deleted file mode 100644 index 705b4b9..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_delete_16px.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - 移除 - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/def_delete_16px.svg.license b/deepin-pc-manager/src/window/icons/icons/def_delete_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_delete_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/def_file_trust_protection_96px.svg b/deepin-pc-manager/src/window/icons/icons/def_file_trust_protection_96px.svg deleted file mode 100644 index b3f1a77..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_file_trust_protection_96px.svg +++ /dev/null @@ -1,62 +0,0 @@ - - - ICON/可信保护 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/def_file_trust_protection_96px.svg.license b/deepin-pc-manager/src/window/icons/icons/def_file_trust_protection_96px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_file_trust_protection_96px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/def_firewall_mode_customized_14px.svg b/deepin-pc-manager/src/window/icons/icons/def_firewall_mode_customized_14px.svg deleted file mode 100644 index 54ec890..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_firewall_mode_customized_14px.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - 编组 7备份 - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/def_firewall_mode_customized_14px.svg.license b/deepin-pc-manager/src/window/icons/icons/def_firewall_mode_customized_14px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_firewall_mode_customized_14px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/def_firewall_mode_private_14px.svg b/deepin-pc-manager/src/window/icons/icons/def_firewall_mode_private_14px.svg deleted file mode 100644 index 02466eb..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_firewall_mode_private_14px.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - 编组 6 - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/def_firewall_mode_private_14px.svg.license b/deepin-pc-manager/src/window/icons/icons/def_firewall_mode_private_14px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_firewall_mode_private_14px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/def_firewall_mode_public_14px.svg b/deepin-pc-manager/src/window/icons/icons/def_firewall_mode_public_14px.svg deleted file mode 100644 index ff1a191..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_firewall_mode_public_14px.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - 编组 4 - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/def_firewall_mode_public_14px.svg.license b/deepin-pc-manager/src/window/icons/icons/def_firewall_mode_public_14px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_firewall_mode_public_14px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/def_firewall_policy_disable_18px.svg b/deepin-pc-manager/src/window/icons/icons/def_firewall_policy_disable_18px.svg deleted file mode 100644 index a9dfb57..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_firewall_policy_disable_18px.svg +++ /dev/null @@ -1,26 +0,0 @@ - - - -mockplus- - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/def_firewall_policy_disable_18px.svg.license b/deepin-pc-manager/src/window/icons/icons/def_firewall_policy_disable_18px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_firewall_policy_disable_18px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/def_firewall_policy_enable_18px.svg b/deepin-pc-manager/src/window/icons/icons/def_firewall_policy_enable_18px.svg deleted file mode 100644 index 83f285d..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_firewall_policy_enable_18px.svg +++ /dev/null @@ -1,35 +0,0 @@ - - - -mockplus- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/def_firewall_policy_enable_18px.svg.license b/deepin-pc-manager/src/window/icons/icons/def_firewall_policy_enable_18px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_firewall_policy_enable_18px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/def_login_safety_96px.svg b/deepin-pc-manager/src/window/icons/icons/def_login_safety_96px.svg deleted file mode 100644 index 7063081..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_login_safety_96px.svg +++ /dev/null @@ -1,122 +0,0 @@ - - - ICON/登录安全 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/def_login_safety_96px.svg.license b/deepin-pc-manager/src/window/icons/icons/def_login_safety_96px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_login_safety_96px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/def_securitylevel_privilege_18px.svg b/deepin-pc-manager/src/window/icons/icons/def_securitylevel_privilege_18px.svg deleted file mode 100644 index 80e1220..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_securitylevel_privilege_18px.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - 注意 - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/def_securitylevel_privilege_18px.svg.license b/deepin-pc-manager/src/window/icons/icons/def_securitylevel_privilege_18px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_securitylevel_privilege_18px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/def_superior_protection_350px.svg b/deepin-pc-manager/src/window/icons/icons/def_superior_protection_350px.svg deleted file mode 100644 index ea6c175..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_superior_protection_350px.svg +++ /dev/null @@ -1,54 +0,0 @@ - - - Illustratio/Super_protection - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/def_superior_protection_350px.svg.license b/deepin-pc-manager/src/window/icons/icons/def_superior_protection_350px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_superior_protection_350px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/def_system_safe_level_96px.svg b/deepin-pc-manager/src/window/icons/icons/def_system_safe_level_96px.svg deleted file mode 100644 index 2c82135..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_system_safe_level_96px.svg +++ /dev/null @@ -1,143 +0,0 @@ - - - ICON/系统安全等级 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/def_system_safe_level_96px.svg.license b/deepin-pc-manager/src/window/icons/icons/def_system_safe_level_96px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_system_safe_level_96px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/def_under_udcp_manage_128px.svg b/deepin-pc-manager/src/window/icons/icons/def_under_udcp_manage_128px.svg deleted file mode 100644 index 03a91a5..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_under_udcp_manage_128px.svg +++ /dev/null @@ -1,204 +0,0 @@ - - - -mockplus- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/def_under_udcp_manage_128px.svg.license b/deepin-pc-manager/src/window/icons/icons/def_under_udcp_manage_128px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_under_udcp_manage_128px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/def_usb_connection_96px.svg b/deepin-pc-manager/src/window/icons/icons/def_usb_connection_96px.svg deleted file mode 100644 index eef1e9a..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_usb_connection_96px.svg +++ /dev/null @@ -1,106 +0,0 @@ - - - ICON/USB管控 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/def_usb_connection_96px.svg.license b/deepin-pc-manager/src/window/icons/icons/def_usb_connection_96px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_usb_connection_96px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/def_usb_storage_detail_dlg_96px.svg b/deepin-pc-manager/src/window/icons/icons/def_usb_storage_detail_dlg_96px.svg deleted file mode 100644 index 43b325d..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_usb_storage_detail_dlg_96px.svg +++ /dev/null @@ -1,112 +0,0 @@ - - - ICON/Data Usage - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/def_usb_storage_detail_dlg_96px.svg.license b/deepin-pc-manager/src/window/icons/icons/def_usb_storage_detail_dlg_96px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_usb_storage_detail_dlg_96px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/def_warning_18px.svg b/deepin-pc-manager/src/window/icons/icons/def_warning_18px.svg deleted file mode 100644 index 65e06a6..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_warning_18px.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - 提示 - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/def_warning_18px.svg.license b/deepin-pc-manager/src/window/icons/icons/def_warning_18px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/def_warning_18px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/firewall_48px.svg b/deepin-pc-manager/src/window/icons/icons/firewall_48px.svg deleted file mode 100644 index 14dbb6c..0000000 --- a/deepin-pc-manager/src/window/icons/icons/firewall_48px.svg +++ /dev/null @@ -1,53 +0,0 @@ - - - ICON/Security_tools/firewall - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/firewall_48px.svg.license b/deepin-pc-manager/src/window/icons/icons/firewall_48px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/firewall_48px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/usb_controls_48px.svg b/deepin-pc-manager/src/window/icons/icons/usb_controls_48px.svg deleted file mode 100644 index 4714168..0000000 --- a/deepin-pc-manager/src/window/icons/icons/usb_controls_48px.svg +++ /dev/null @@ -1,44 +0,0 @@ - - - ICON/Security_tools/usb_controls - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/usb_controls_48px.svg.license b/deepin-pc-manager/src/window/icons/icons/usb_controls_48px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/icons/usb_controls_48px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/icons/water_blue_back.svg b/deepin-pc-manager/src/window/icons/icons/water_blue_back.svg deleted file mode 100644 index a56ca84..0000000 --- a/deepin-pc-manager/src/window/icons/icons/water_blue_back.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/deepin-pc-manager/src/window/icons/icons/water_blue_front.svg b/deepin-pc-manager/src/window/icons/icons/water_blue_front.svg deleted file mode 100644 index 86fdff3..0000000 --- a/deepin-pc-manager/src/window/icons/icons/water_blue_front.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/deepin-pc-manager/src/window/icons/icons/water_red_back.svg b/deepin-pc-manager/src/window/icons/icons/water_red_back.svg deleted file mode 100644 index 94c0551..0000000 --- a/deepin-pc-manager/src/window/icons/icons/water_red_back.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - red_water_back - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/water_red_front.svg b/deepin-pc-manager/src/window/icons/icons/water_red_front.svg deleted file mode 100644 index bfe7c99..0000000 --- a/deepin-pc-manager/src/window/icons/icons/water_red_front.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - red_water_front - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/water_yellow_back.svg b/deepin-pc-manager/src/window/icons/icons/water_yellow_back.svg deleted file mode 100644 index 37389c3..0000000 --- a/deepin-pc-manager/src/window/icons/icons/water_yellow_back.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - orange_water_back - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/icons/water_yellow_front.svg b/deepin-pc-manager/src/window/icons/icons/water_yellow_front.svg deleted file mode 100644 index 09a081a..0000000 --- a/deepin-pc-manager/src/window/icons/icons/water_yellow_front.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - orange_water_front - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/light/actions/def_animated_line_edit_glowing_128px.svg b/deepin-pc-manager/src/window/icons/light/actions/def_animated_line_edit_glowing_128px.svg deleted file mode 100644 index 643a968..0000000 --- a/deepin-pc-manager/src/window/icons/light/actions/def_animated_line_edit_glowing_128px.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - glowing_light - Created with Sketch. - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/light/actions/def_animated_line_edit_glowing_128px.svg.license b/deepin-pc-manager/src/window/icons/light/actions/def_animated_line_edit_glowing_128px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/light/actions/def_animated_line_edit_glowing_128px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/light/actions/def_arrow_right_20px.svg b/deepin-pc-manager/src/window/icons/light/actions/def_arrow_right_20px.svg deleted file mode 100644 index 04d121e..0000000 --- a/deepin-pc-manager/src/window/icons/light/actions/def_arrow_right_20px.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/deepin-pc-manager/src/window/icons/light/actions/def_arrow_right_20px.svg.license b/deepin-pc-manager/src/window/icons/light/actions/def_arrow_right_20px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/light/actions/def_arrow_right_20px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/light/actions/def_rdp_port_28px.svg b/deepin-pc-manager/src/window/icons/light/actions/def_rdp_port_28px.svg deleted file mode 100644 index 576ce93..0000000 --- a/deepin-pc-manager/src/window/icons/light/actions/def_rdp_port_28px.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - ICon/rdp port - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/light/actions/def_rdp_port_28px.svg.license b/deepin-pc-manager/src/window/icons/light/actions/def_rdp_port_28px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/light/actions/def_rdp_port_28px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/light/actions/def_select_16px.svg b/deepin-pc-manager/src/window/icons/light/actions/def_select_16px.svg deleted file mode 100644 index 29e864d..0000000 --- a/deepin-pc-manager/src/window/icons/light/actions/def_select_16px.svg +++ /dev/null @@ -1,23 +0,0 @@ - - - - select - Created with Sketch. - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/light/actions/def_select_16px.svg.license b/deepin-pc-manager/src/window/icons/light/actions/def_select_16px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/light/actions/def_select_16px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/light/icons/def_data_usage_96px.svg b/deepin-pc-manager/src/window/icons/light/icons/def_data_usage_96px.svg deleted file mode 100644 index 274d48d..0000000 --- a/deepin-pc-manager/src/window/icons/light/icons/def_data_usage_96px.svg +++ /dev/null @@ -1,115 +0,0 @@ - - - ICON/Data Usage - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/light/icons/def_data_usage_96px.svg.license b/deepin-pc-manager/src/window/icons/light/icons/def_data_usage_96px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/light/icons/def_data_usage_96px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/light/icons/def_developers_28px.svg b/deepin-pc-manager/src/window/icons/light/icons/def_developers_28px.svg deleted file mode 100644 index c4473a1..0000000 --- a/deepin-pc-manager/src/window/icons/light/icons/def_developers_28px.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - ICon/developers - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/light/icons/def_developers_28px.svg.license b/deepin-pc-manager/src/window/icons/light/icons/def_developers_28px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/light/icons/def_developers_28px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/light/icons/def_disk_28px.svg b/deepin-pc-manager/src/window/icons/light/icons/def_disk_28px.svg deleted file mode 100644 index 6d144f5..0000000 --- a/deepin-pc-manager/src/window/icons/light/icons/def_disk_28px.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - ICon/disk - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/light/icons/def_disk_28px.svg.license b/deepin-pc-manager/src/window/icons/light/icons/def_disk_28px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/light/icons/def_disk_28px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/light/icons/def_garbage_28px.svg b/deepin-pc-manager/src/window/icons/light/icons/def_garbage_28px.svg deleted file mode 100644 index 5a9401d..0000000 --- a/deepin-pc-manager/src/window/icons/light/icons/def_garbage_28px.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - ICon/garbage - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/light/icons/def_garbage_28px.svg.license b/deepin-pc-manager/src/window/icons/light/icons/def_garbage_28px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/light/icons/def_garbage_28px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/light/icons/def_internet_control_96px.svg b/deepin-pc-manager/src/window/icons/light/icons/def_internet_control_96px.svg deleted file mode 100644 index 7454547..0000000 --- a/deepin-pc-manager/src/window/icons/light/icons/def_internet_control_96px.svg +++ /dev/null @@ -1,168 +0,0 @@ - - - - ICON/Internet Control - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/light/icons/def_internet_control_96px.svg.license b/deepin-pc-manager/src/window/icons/light/icons/def_internet_control_96px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/light/icons/def_internet_control_96px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/light/icons/def_self_starting_28px.svg b/deepin-pc-manager/src/window/icons/light/icons/def_self_starting_28px.svg deleted file mode 100644 index 25a3109..0000000 --- a/deepin-pc-manager/src/window/icons/light/icons/def_self_starting_28px.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - ICon/self-starting - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/light/icons/def_self_starting_28px.svg.license b/deepin-pc-manager/src/window/icons/light/icons/def_self_starting_28px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/light/icons/def_self_starting_28px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/light/icons/def_startup_programs_96px.svg b/deepin-pc-manager/src/window/icons/light/icons/def_startup_programs_96px.svg deleted file mode 100644 index 9991e20..0000000 --- a/deepin-pc-manager/src/window/icons/light/icons/def_startup_programs_96px.svg +++ /dev/null @@ -1,107 +0,0 @@ - - - ICON/Startup Programs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/light/icons/def_startup_programs_96px.svg.license b/deepin-pc-manager/src/window/icons/light/icons/def_startup_programs_96px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/light/icons/def_startup_programs_96px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/light/icons/def_system_upgrade_28px.svg b/deepin-pc-manager/src/window/icons/light/icons/def_system_upgrade_28px.svg deleted file mode 100644 index 1404760..0000000 --- a/deepin-pc-manager/src/window/icons/light/icons/def_system_upgrade_28px.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - ICon/System upgrade - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/light/icons/def_system_upgrade_28px.svg.license b/deepin-pc-manager/src/window/icons/light/icons/def_system_upgrade_28px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/light/icons/def_system_upgrade_28px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/light/icons/def_trojan_virus_28px.svg b/deepin-pc-manager/src/window/icons/light/icons/def_trojan_virus_28px.svg deleted file mode 100644 index 30c1554..0000000 --- a/deepin-pc-manager/src/window/icons/light/icons/def_trojan_virus_28px.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - ICon/Trojan virus - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/light/icons/def_trojan_virus_28px.svg.license b/deepin-pc-manager/src/window/icons/light/icons/def_trojan_virus_28px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/light/icons/def_trojan_virus_28px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/icons/light/icons/def_virus_reservoir_28px.svg b/deepin-pc-manager/src/window/icons/light/icons/def_virus_reservoir_28px.svg deleted file mode 100644 index 0343ddf..0000000 --- a/deepin-pc-manager/src/window/icons/light/icons/def_virus_reservoir_28px.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - ICon/virus reservoir - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/deepin-pc-manager/src/window/icons/light/icons/def_virus_reservoir_28px.svg.license b/deepin-pc-manager/src/window/icons/light/icons/def_virus_reservoir_28px.svg.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/src/window/icons/light/icons/def_virus_reservoir_28px.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/interface/frameproxyinterface.h b/deepin-pc-manager/src/window/interface/frameproxyinterface.h index b80a72c..52e3ef3 100644 --- a/deepin-pc-manager/src/window/interface/frameproxyinterface.h +++ b/deepin-pc-manager/src/window/interface/frameproxyinterface.h @@ -4,12 +4,9 @@ #pragma once -#include "../namespace.h" - class QWidget; class QString; -DEF_NAMESPACE_BEGIN class ModuleInterface; class FrameProxyInterface @@ -33,5 +30,3 @@ class FrameProxyInterface // 其它模块设置后退按钮状状态 virtual void setBackForwardButtonStatus(bool status) = 0; }; - -DEF_NAMESPACE_END diff --git a/deepin-pc-manager/src/window/interface/moduleinterface.cpp b/deepin-pc-manager/src/window/interface/moduleinterface.cpp index 1ca26ca..e10974c 100644 --- a/deepin-pc-manager/src/window/interface/moduleinterface.cpp +++ b/deepin-pc-manager/src/window/interface/moduleinterface.cpp @@ -1,12 +1,9 @@ -// Copyright (C) 2011 ~ 2019 Deepin Technology Co., Ltd. // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later #include "moduleinterface.h" -DEF_USING_NAMESPACE - void ModuleInterface::active(int index) { Q_UNUSED(index); @@ -14,5 +11,4 @@ void ModuleInterface::active(int index) void ModuleInterface::deactive() { - } diff --git a/deepin-pc-manager/src/window/interface/moduleinterface.h b/deepin-pc-manager/src/window/interface/moduleinterface.h index 2515153..d4fb16b 100644 --- a/deepin-pc-manager/src/window/interface/moduleinterface.h +++ b/deepin-pc-manager/src/window/interface/moduleinterface.h @@ -1,17 +1,13 @@ -// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later #pragma once -#include "../namespace.h" #include "frameproxyinterface.h" #include -DEF_NAMESPACE_BEGIN - // ModuleInterface作为每个规范每个Module的接口,每个Module实现必须实现其所有虚函数。 class ModuleInterface { @@ -21,11 +17,11 @@ class ModuleInterface { } - virtual ~ModuleInterface() { } + virtual ~ModuleInterface() {} // preInitialize会在模块初始化时被调用,用于模块在准备阶段进行资源的初始化; // preInitialize不允许进行高资源的操作; - virtual void preInitialize() { } + virtual void preInitialize() {} // initialize初始化相应的模块,参数proxy用于Moudle向Frame信息查询和主动调用; // 返回Module的id; @@ -52,5 +48,3 @@ class ModuleInterface protected: FrameProxyInterface *m_frameProxy = nullptr; }; - -DEF_NAMESPACE_END diff --git a/deepin-pc-manager/src/window/mainwindow.cpp b/deepin-pc-manager/src/window/mainwindow.cpp index f72b8f8..1fabc88 100644 --- a/deepin-pc-manager/src/window/mainwindow.cpp +++ b/deepin-pc-manager/src/window/mainwindow.cpp @@ -1,114 +1,60 @@ -// Copyright (C) 2017 ~ 2019 Deepin Technology Co., Ltd. // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later #include "mainwindow.h" - -#include "modules/common/invokers/invokerfactory.h" -#include "src/window/modules/common/common.h" -#include "src/window/modules/common/compixmap.h" -#include "src/window/modules/common/gsettingkey.h" - -// 首页模块 -#include "modules/homepagecheck/homepagemodel.h" -#include "modules/homepagecheck/homepagemodule.h" -// 垃圾清理模块 -#include "modules/cleaner/cleanermodule.h" -// 安全工具模块 -#include "modules/securitytools/securitytoolsmodule.h" - -// 重启安全中心弹框 -#include "../widgets/multiselectlistview.h" - +#include "window/widgets/multiselectlistview.h" +#include "window/common/gsettingkey.h" +#include "window/common/invokers/invokerfactory.h" #include -#include -#include -#include -#include -#include -#include +#include "modules/systemcheck/systemcheckmodule.h" +#include "modules/trashclean/trashcleanmodule.h" +#include "modules/toolbox/toolboxmodule.h" + #include -#include -#include +#include +#include #include #include #include -#include -#include -#include -#include +#include +#include +#include -#include -#include -#include -#include #include -#include -#include -#include -#include #include -#include -#include -#include - -DEF_USING_NAMESPACE -DTK_USE_NAMESPACE -DCORE_USE_NAMESPACE +#include const int WidgetMinimumWidget = 950; const int WidgetMinimumHeight = 640; - -// 此处为带边距的宽度 const int first_widget_min_width = 179; +#define SETTING_JSON ":/dt-settings.json" // 获取文件配置 + const QMargins navItemMargin(5, 3, 5, 3); const QVariant NavItemMargin = QVariant::fromValue(navItemMargin); -const QString dmanInterface = "com.deepin.Manual.Open"; - -#define DIALOG_WIDTH 380 // dialog 宽度 -#define DIALOG_HEIGHT 145 // dialog 高度 -#define DIALOG_PB_WIDTH 140 // dialog 按钮宽度 -#define DIALOG_PB_HEIGHT 36 // dialog 按钮高度 - -#define INSTALL_TIME "defender-install-time" // 安装时间 - -/******************安全中心主界面初始化******************/ MainWindow::MainWindow(QWidget *parent) : DMainWindow(parent) - , m_contentLayout(nullptr) - , m_splitLine(nullptr) - , m_rightContentLayout(nullptr) - , m_navView(nullptr) - , m_rightView(nullptr) - , m_navModel(nullptr) - , m_homePageModule(nullptr) - , m_homePageModel(nullptr) - , m_securityToolsModule(nullptr) - , m_backwardBtn(nullptr) - , m_pSystemTray(nullptr) - , m_trayMenu(nullptr) - , m_trayDialag(nullptr) - , m_gsetting(nullptr) - , m_dsd(nullptr) - , m_guiHelper(nullptr) - , m_pSecurityToolDBusInter(nullptr) -{ - this->setAccessibleName("mainWindow"); - setObjectName(MAIN_WINDOW_OBJ_NAME); + , m_dconfig(nullptr) +{ + m_dconfig = DConfig::create("org.deepin.dde.deepin-pc-manager", "org.deepin.dde.deepin-pc-manager"); + m_serSupportInvokerInter = InvokerFactory::GetInstance().CreateInvoker("com.deepin.dde.ServiceAndSupport", + "/com/deepin/dde/ServiceAndSupport", + "com.deepin.dde.ServiceAndSupport", + ConnectType::SESSION, + this); + + QTranslator *translator = new QTranslator(this); + translator->load(QString("/usr/share/deepin-pc-manager/translations/deepin-pc-manager_%1.qm").arg(QLocale::system().name())); + QCoreApplication::installTranslator(translator); // 设置主窗口属性 setFixedSize(QSize(WidgetMinimumWidget, WidgetMinimumHeight)); setWindowFlags(Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint); - // 初始化UI + // 初始化 initUI(); - // 初始化数据 initData(); - // 初始化信号槽 - initSignalSlots(); - // 初始化托盘 initTray(); QTimer::singleShot(0, this, &MainWindow::initAllModule); // 初始化所有模块 @@ -117,35 +63,23 @@ MainWindow::MainWindow(QWidget *parent) MainWindow::~MainWindow() { - if (m_dsd) { - m_dsd->deleteLater(); - m_dsd = nullptr; - } - - if (m_navModel) { - m_navModel->clear(); - m_navModel->deleteLater(); - m_navModel = nullptr; - } } -/********************安全中心模块加载**********************/ // 初始化UI void MainWindow::initUI() { // Initialize view and layout structure QWidget *content = new QWidget(this); - content->setAccessibleName("mainWindow_contentWidget"); setCentralWidget(content); m_contentLayout = new QHBoxLayout(content); m_contentLayout->setContentsMargins(0, 0, 0, 0); m_contentLayout->setMargin(0); m_contentLayout->setSpacing(0); + // 左边list m_navView = new MultiSelectListView(this); m_navView->setLineWidth(0); - m_navView->setAccessibleName("contentWidget_selectListView"); m_navView->setUniformItemSizes(true); m_navView->setItemSize(QSize(159, 48)); m_navView->setIconSize(QSize(48, 48)); @@ -162,11 +96,31 @@ void MainWindow::initUI() DStyledItemDelegate::BackgroundType(DStyledItemDelegate::BackgroundType::RoundedBackground | DStyledItemDelegate::BackgroundType::NoNormalState)); m_navView->setItemSpacing(0); + + // 服务支持 -挂到导航栏 + DFrame *supportFrame = new DFrame(this); + supportFrame->setLineWidth(0); + QHBoxLayout *supportLayout = new QHBoxLayout(supportFrame); + supportLayout->setContentsMargins(26, 0, 0, 20); + supportLayout->setSpacing(10); + supportFrame->setLayout(supportLayout); + QLabel *imageLabel = new QLabel; + imageLabel->setFixedSize(QSize(26, 26)); + imageLabel->setPixmap(QIcon::fromTheme("dcc_service_support").pixmap(26, 26)); + supportLayout->addWidget(imageLabel); + m_supportLabel = new DLabel; + m_supportLabel->setText(tr("Service Support")); + m_supportLabel->setAlignment(Qt::AlignLeft); + m_supportLabel->setCursor(QCursor(Qt::PointingHandCursor)); + m_supportLabel->installEventFilter(this); + supportLayout->addWidget(m_supportLabel); + m_navView->addFooterWidget(supportFrame); + + // 加载导航栏 m_contentLayout->addWidget(m_navView); // 分割线 m_splitLine = new DFrame(this); - m_splitLine->setAccessibleName("splitLineFrame"); m_splitLine->setFrameShape(QFrame::VLine); m_splitLine->setFrameShadow(QFrame::Plain); m_splitLine->setFixedHeight(600); @@ -178,7 +132,6 @@ void MainWindow::initUI() m_rightContentLayout->setContentsMargins(0, 0, 0, 0); m_rightView = new DBackgroundGroup(m_rightContentLayout); - m_rightView->setAccessibleName("contentWidget_rightWidget"); m_rightView->setItemSpacing(2); m_rightView->setItemMargins(QMargins(0, 0, 0, 0)); m_rightView->setContentsMargins(0, 0, 0, 0); @@ -186,169 +139,72 @@ void MainWindow::initUI() m_contentLayout->addWidget(m_rightView); } -// 初始化数据 void MainWindow::initData() { - m_pSecurityToolDBusInter = - InvokerFactory::GetInstance().CreateInvoker("com.deepin.pc.manager.securitytooldialog", - "/com/deepin/pc/manager/securitytooldialog", - "com.deepin.pc.manager.securitytooldialog", - ConnectType::SESSION, - this); - - // 初始化安全中心gsetting配置 - m_gsetting = InvokerFactory::GetInstance().CreateSettings(DEEPIN_PC_MANAGER_GSETTING_PATH, - QByteArray(), - this); - - // 设置安装时间 - setInstallTime(); - - // 主题变换 - m_guiHelper = DGuiApplicationHelper::instance(); - connect(m_guiHelper, - SIGNAL(themeTypeChanged(ColorType)), - this, - SLOT(themeTypeChange(ColorType))); - // 标题栏 DTitlebar *titlebar = this->titlebar(); - titlebar->setIcon(QIcon::fromTheme(DIALOG_PC_MANAGER)); - + titlebar->setIcon(QIcon::fromTheme("deepin-pc-manager")); auto menu = titlebar->menu(); - menu->setFont(Utils::getFixFontSize(14)); if (!menu) { menu = new QMenu(this); } titlebar->setMenu(menu); - // 设置 + // 设置弹框 auto action = new QAction(tr("Settings"), this); menu->addAction(action); connect(action, &QAction::triggered, this, &MainWindow::showDefaultSettingDialog); - // 只有桌面专业版才需要用户反馈 - if (DSysInfo::uosEditionType() == DSysInfo::UosEdition::UosProfessional - && DSysInfo::UosType::UosDesktop == SystemType) { - // 用户反馈 - auto userReplyAction = new QAction(tr("Report issues"), this); - menu->addAction(userReplyAction); - connect(userReplyAction, &QAction::triggered, this, &MainWindow::showUserReplyDialog); - } - - m_backwardBtn = new DIconButton(this); // 上一步按钮 - m_backwardBtn->setAccessibleName("backwardButton"); - m_backwardBtn->setIcon(QStyle::SP_ArrowBack); - titlebar->addWidget(m_backwardBtn, Qt::AlignLeft | Qt::AlignVCenter); - connect(m_backwardBtn, &DIconButton::clicked, this, &MainWindow::onBackWardClick); + // 主题变换 + m_guiHelper = DGuiApplicationHelper::instance(); + connect(m_guiHelper, SIGNAL(themeTypeChanged(ColorType)), this, SLOT(themeTypeChange(ColorType))); - // Initialize top page view and model m_navModel = new QStandardItemModel(m_navView); m_navView->setModel(m_navModel); // 连接按下信号与窗口切换槽函数 connect(m_navView, &DListView::pressed, this, &MainWindow::onFirstItemClick); } -// 初始化信号槽 -void MainWindow::initSignalSlots() -{ -} - -void MainWindow::popWidget(ModuleInterface *const inter) -{ - // 外部模块调用时,判断是否当前模块界面处于首页 - if (m_contentStack.size()) { - if (inter == m_contentStack.top().first) { - // 将最后一层窗口出栈 - popWidget(); - } - } -} - -void MainWindow::popAndDelWidget(ModuleInterface *const inter) -{ - Q_UNUSED(inter) - // 由外部模块发起的pop需要过滤 - if (m_contentStack.top().first != inter) { - return; - } - - // 将最后一层窗口出栈并删除 - popAndDelWidget(); - updateBackwardBtn(); -} - -void MainWindow::pushWidget(ModuleInterface *const inter, QWidget *const w) -{ - if (!inter) { - qWarning() << Q_FUNC_INFO << " inter is nullptr"; - return; - } - - if (!w) { - qWarning() << Q_FUNC_INFO << " widget is nullptr"; - return; - } - - pushNormalWidget(inter, w); - - // 退回按钮状态 - updateBackwardBtn(); -} - -void MainWindow::setModuleVisible(ModuleInterface *const inter, const bool visible) -{ - auto find_it = std::find_if(m_modules.cbegin(), - m_modules.cend(), - [=](const QPair &pair) { - return pair.first == inter; - }); - - if (find_it != m_modules.cend()) { - m_navView->setRowHidden(find_it - m_modules.cbegin(), !visible); - Q_EMIT moduleVisibleChanged(find_it->first->name(), visible); - } -} - -void MainWindow::setCurrentModule(int iModuleIdx, int iPageIdx) +void MainWindow::initTray() { - // 获取QModelIndex - QModelIndex modelIndex = m_navModel->index(iModuleIdx, 0); - m_navView->setCurrentIndex(m_navModel->index(iModuleIdx, 0)); - // 将显示栈清空 - popAllWidgets(0); - this->setFocus(); + m_pSystemTray = new QSystemTrayIcon(this); + m_trayMenu = new QMenu(this); - // 激活模块 - ModuleInterface *inter = m_modules[modelIndex.row()].first; - inter->active(iPageIdx); -} + // 电脑管家 + QAction *show = new QAction(this); + show->setText(tr("Deepin PC Manager")); + show->setToolTip(tr("Deepin PC Manager")); + m_trayMenu->addAction(show); + // 点击托盘中的安全中心 激活该窗口并且展现出来 + connect(show, &QAction::triggered, this, [this] { + this->show(); + this->setWindowState(Qt::WindowState::WindowActive); + }); -ModuleInterface *MainWindow::getCurrentModule() -{ - if (m_contentStack.isEmpty()) { - return nullptr; - } + // 托盘退出 + QAction *exit = new QAction(this); + exit->setText(tr("Exit")); + m_trayMenu->addAction(exit); + connect(exit, &QAction::triggered, this, [=] { + closeWindow(); + }); - return m_contentStack.top().first; -} + // 设置系统托盘的上下文菜单 + m_pSystemTray->setContextMenu(m_trayMenu); + // 设置系统托盘提示信息、托盘图标 + m_pSystemTray->setToolTip(tr("Deepin PC Manager")); + m_pSystemTray->setIcon(QIcon::fromTheme("deepin-pc-manager")); + connect(m_pSystemTray, &QSystemTrayIcon::activated, this, &MainWindow::onTrayActivated); -int MainWindow::getModuleIndex(const QString &name) -{ - int index = 0; - for (QPair p : m_modules) { - if (p.first->name() == name) - return index; - index++; - } - return -1; + m_pSystemTray->show(); } -void MainWindow::setBackForwardButtonStatus(bool status) +// 寻找子页面索引 +int MainWindow::getPageIndex(QString pageName) { - if (m_backwardBtn) { - m_backwardBtn->setEnabled(status); - } + Q_UNUSED(pageName); + int retIndex = 0; + return retIndex; } void MainWindow::showModulePage(const QString &module, const QString &page) @@ -381,26 +237,19 @@ int MainWindow::getModuleCount() // 初始化模块 void MainWindow::initAllModule() { - // 首页体检模块 - if (!m_homePageModule) { - m_homePageModule = new HomePageModule(this, this); - } - if (!m_securityToolsModule) { - m_securityToolsModule = new SecurityToolsModule(this, this); - } m_modules = { - {m_homePageModule, tr("Full Check")}, - {new CleanerModule(this, this), tr("Cleanup")}, - {m_securityToolsModule, tr("Tools")}, + {new SystemCheckModule(this, this), tr("Full Check")}, + {new TrashCleanModule(this, this), tr("Cleanup")}, + {new ToolBoxModule(this, this), tr("Toolbox")}, }; // 浅色主题图标 m_modulesLightIconList.clear(); - m_modulesLightIconList << HOMEPAGE_MODEL_LIGHT << HOMEPAGE_CLEAR_LIGHT << HOMEPAGE_TOOL_LIGHT; + m_modulesLightIconList << SYSTEM_CHECK_MODEL_LIGHT << TRASH_CLEAN_MODEL_LIGHT << TOOL_BOX_LIGHT; // 深色主题图标 m_modulesDarakIconList.clear(); - m_modulesDarakIconList << HOMEPAGE_MODEL_DARK << HOMEPAGE_CLEAR_DARK << HOMEPAGE_TOOL_DARK; + m_modulesDarakIconList << SYSTEM_CHECK_MODEL_DARK << TRASH_CLEAN_MODEL_DARK << TOOL_BOX_DARK; // 获得主题类型 int type = m_guiHelper->themeType(); @@ -419,8 +268,6 @@ void MainWindow::initAllModule() item->setData(NavItemMargin, Dtk::MarginsRole); item->setData(QVariant(it->first->name()), Qt::AccessibleTextRole); - - item->setData(Utils::getFixFontSize(14), Qt::FontRole); m_navModel->appendRow(item); } } @@ -457,17 +304,18 @@ void MainWindow::onFirstItemClick(const QModelIndex &index) m_navView->setFocus(); } -// 模块入栈 -void MainWindow::pushNormalWidget(ModuleInterface *const inter, QWidget *const w) +// 模块出栈 +void MainWindow::popAndDelWidget() { - // Set the newly added page to fill the blank area - w->setParent(this); - w->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - w->show(); + if (!m_contentStack.size()) + return; - m_contentStack.push({inter, w}); - m_rightContentLayout->addWidget(w, m_contentStack.size() == 1 ? 3 : 7); - qInfo() << "[MainWindow] [pushNormalWidget] widget name " << w; + QWidget *w = m_contentStack.pop().second; // 栈的顶栈的widget + if (w) { + m_rightContentLayout->removeWidget(w); + w->hide(); + w->deleteLater(); + } } // 功能模块切换出栈 @@ -493,20 +341,6 @@ void MainWindow::popAllWidgets(int place) m_contentStack.clear(); } -// 模块出栈 -void MainWindow::popAndDelWidget() -{ - if (!m_contentStack.size()) - return; - - QWidget *w = m_contentStack.pop().second; // 栈的顶栈的widget - if (w) { - m_rightContentLayout->removeWidget(w); - w->hide(); - w->deleteLater(); - } -} - // 模块出栈 void MainWindow::popWidget() { @@ -525,26 +359,113 @@ void MainWindow::popWidget() } } -/********************安全中心菜单配置**************************/ -// 显示默认设置弹框 -void MainWindow::showDefaultSettingDialog() +// 模块入栈 +void MainWindow::pushNormalWidget(ModuleInterface *const inter, QWidget *const w) { - showSettingDialog(""); + // Set the newly added page to fill the blank area + w->setParent(this); + w->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + w->show(); + + m_contentStack.push({inter, w}); + m_rightContentLayout->addWidget(w, m_contentStack.size() == 1 ? 3 : 7); + qInfo() << "[MainWindow] [pushNormalWidget] widget name " << w; } -// 显示用户反馈弹框 -void MainWindow::showUserReplyDialog() +/*********模块功能操作(纯虚函数实现)*********/ +// 弹栈 +void MainWindow::popWidget(ModuleInterface *const inter) { - // 创建(或new)对象连接服务 - QDBusInterface interFace("com.deepin.dde.ServiceAndSupport", - "/com/deepin/dde/ServiceAndSupport", - "com.deepin.dde.ServiceAndSupport", - QDBusConnection::sessionBus()); - interFace.call("ServiceSession", 1); + // 外部模块调用时,判断是否当前模块界面处于首页 + if (m_contentStack.size()) { + if (inter == m_contentStack.top().first) { + // 将最后一层窗口出栈 + popWidget(); + } + } } +void MainWindow::popAndDelWidget(ModuleInterface *const inter) +{ + Q_UNUSED(inter) + // 由外部模块发起的pop需要过滤 + if (m_contentStack.top().first != inter) { + return; + } -// 显示设置弹窗,并跳转到相应组位置 -void MainWindow::showSettingDialog(const QString &groupKey) + // 将最后一层窗口出栈并删除 + popAndDelWidget(); +} +// 压栈 +void MainWindow::pushWidget(ModuleInterface *const inter, QWidget *const w) +{ + if (!inter) { + qWarning() << Q_FUNC_INFO << " inter is nullptr"; + return; + } + + if (!w) { + qWarning() << Q_FUNC_INFO << " widget is nullptr"; + return; + } + + pushNormalWidget(inter, w); +} +// 模块可视化 +void MainWindow::setModuleVisible(ModuleInterface *const inter, const bool visible) +{ + auto find_it = std::find_if(m_modules.cbegin(), + m_modules.cend(), + [=](const QPair &pair) { + return pair.first == inter; + }); + + if (find_it != m_modules.cend()) { + m_navView->setRowHidden(find_it - m_modules.cbegin(), !visible); + Q_EMIT moduleVisibleChanged(find_it->first->name(), visible); + } +} +// 设置当前模块 +void MainWindow::setCurrentModule(int iModuleIdx, int iPageIdx) +{ + // 获取QModelIndex + QModelIndex modelIndex = m_navModel->index(iModuleIdx, 0); + m_navView->setCurrentIndex(m_navModel->index(iModuleIdx, 0)); + // 将显示栈清空 + popAllWidgets(0); + this->setFocus(); + + // 激活模块 + ModuleInterface *inter = m_modules[modelIndex.row()].first; + inter->active(iPageIdx); +} +ModuleInterface *MainWindow::getCurrentModule() +{ + if (m_contentStack.isEmpty()) { + return nullptr; + } + + return m_contentStack.top().first; +} +// 获得模块下标 +int MainWindow::getModuleIndex(const QString &name) +{ + int index = 0; + for (QPair p : m_modules) { + if (p.first->name() == name) + return index; + index++; + } + return -1; +} +// 设置后退按钮可用状态 +void MainWindow::setBackForwardButtonStatus(bool status) +{ + Q_UNUSED(status); +} + +/*********应用基础操作*********/ +// 显示默认设置弹框 +void MainWindow::showDefaultSettingDialog() { QTemporaryFile *tmpFile = new QTemporaryFile; tmpFile->open(); @@ -569,67 +490,62 @@ void MainWindow::showSettingDialog(const QString &groupKey) // 连接设置信号 // 脚本直接设置的部分 - connect(settings, - &Dtk::Core::DSettings::valueChanged, - this, - [=](const QString &key, const QVariant &value) { - if (key.contains(SETTING_CLOSE_WINDOW_TYPE)) { - int type = value.toInt(); - if (type >= Tray && type <= Exit) { - this->setCloseType(type); // 设置关闭类型 托盘还是推出 - this->setAskType(0); // 设置访问类型 - } else if (type == Ask) { - this->setAskType(1); // 设置访问类型是每次访问 - } - } - }); + connect(settings, &Dtk::Core::DSettings::valueChanged, this, [=](const QString &key, const QVariant &value) { + if (key.contains(SETTING_CLOSE_WINDOW_TYPE)) { + int type = value.toInt(); + if (type >= Tray && type <= Exit) { + this->setCloseType(type); // 设置关闭类型 托盘还是推出 + this->setAskType(0); // 设置访问类型 + } else if (type == Ask) { + this->setAskType(1); // 设置访问类型是每次访问 + } + } + }); // 设置弹窗 m_dsd = new DSettingsDialog(this); - m_dsd->setFont(Utils::getFixFontSize(14)); m_dsd->updateSettings(settings); m_dsd->setModal(true); this->setWindowState(Qt::WindowState::WindowActive); this->show(); m_dsd->show(); - m_dsd->scrollToGroup(groupKey); + m_dsd->scrollToGroup(""); } -void MainWindow::toggle() +// 获得关闭类型 0托盘最小化 1推出 +int MainWindow::getCloseType() { - raise(); - if (isMinimized() || !isVisible()) { - // 显示并恢复窗口为正常状态 - showNormal(); + int type = 0; + if (m_dconfig->isValid()) { + type = m_dconfig->value(CLOSE_TYPE).toInt(); } - - activateWindow(); + return type; } - -/******************安全中心窗口设置操作******************/ -// 关闭窗口事件 -void MainWindow::closeEvent(QCloseEvent *event) +// 0 : Not Ask 1 : Ask 0 托盘最小化 1 退出 +void MainWindow::setCloseType(int value) { - // 获得访问类型 0 不访问 1是展现访问关闭窗口 - if (!getAskType()) { - // 不访问 获得关闭类型 0最小化 1退出 - if (getCloseType()) { - closeWindow(); - event->ignore(); - } else { - hide(); - event->ignore(); - } - } else { - initCloseDialog(event); + if (m_dconfig->isValid()) { + m_dconfig->setValue(CLOSE_TYPE, value); } } - -void MainWindow::hideEvent(QHideEvent *event) +// 获得访问类型 0不访问 1访问 +int MainWindow::getAskType() +{ + int type = 0; + if (m_dconfig->isValid()) { + type = m_dconfig->value(ASK_TYPE).toInt(); + } + return type; +} +// 设置访问 0 不访问 1访问 +void MainWindow::setAskType(int value) { - Q_UNUSED(event); + if (m_dconfig->isValid()) { + m_dconfig->setValue(ASK_TYPE, value); + } } +// 托盘处理 void MainWindow::onTrayActivated(QSystemTrayIcon::ActivationReason state) { if (state == QSystemTrayIcon::ActivationReason::Trigger) { @@ -647,90 +563,21 @@ void MainWindow::onTrayActivated(QSystemTrayIcon::ActivationReason state) } } -void MainWindow::setSystemsafety(const QModelIndex &index, int sonindex) -{ - ModuleInterface *inter = m_modules[index.row()].first; - - popAllWidgets(); - inter->active(sonindex); -} - -// 背景主题变化 -void MainWindow::themeTypeChange(ColorType themeType) -{ - // 设置后台服务弹框主题 - int type = int(themeType); - DBUS_NOBLOCK_INVOKE(m_pSecurityToolDBusInter, "SetDefenderPaletteType", type); - - // 获得所有行 - int count = m_navModel->rowCount(); - for (int i = 0; i < count; i++) { - // 每行的item - QStandardItem *item = m_navModel->item(i, 0); - QString iconPath; - if (m_guiHelper->themeType() == DGuiApplicationHelper::ColorType::LightType) { - iconPath = m_modulesLightIconList.at(i); - } else { - iconPath = m_modulesDarakIconList.at(i); - } - // 每行item的图标设置 - QIcon icon = QIcon::fromTheme(iconPath); - item->setIcon(icon); - item->setData(NavItemMargin, Dtk::MarginsRole); - m_navModel->setItem(i, 0, item); - } -} - -// 初始化托盘 -void MainWindow::initTray() +// 应用退出 +void MainWindow::closeWindow() { - m_pSystemTray = new QSystemTrayIcon(this); - m_trayMenu = new QMenu(this); - m_trayMenu->setAccessibleName("systemTrayMenu"); - - // 安全中心 - QAction *show = new QAction(this); - show->setText(tr("Security Center")); - show->setToolTip("SecurityCenter"); - m_trayMenu->addAction(show); - // 点击托盘中的安全中心 激活该窗口并且展现出来 - connect(show, &QAction::triggered, this, [this] { - this->show(); - this->setWindowState(Qt::WindowState::WindowActive); - }); - - // 托盘退出 - QAction *exit = new QAction(this); - exit->setText(tr("Exit")); - m_trayMenu->addAction(exit); - connect(exit, &QAction::triggered, this, [=] { - closeWindow(); - }); - - // 设置系统托盘的上下文菜单 - m_pSystemTray->setContextMenu(m_trayMenu); - // 设置系统托盘提示信息、托盘图标 - QString name = tr("Security Center"); - m_pSystemTray->setToolTip(name); - m_pSystemTray->setIcon(QIcon::fromTheme(DIALOG_PC_MANAGER)); - connect(m_pSystemTray, &QSystemTrayIcon::activated, this, &MainWindow::onTrayActivated); - - m_pSystemTray->show(); + qApp->quit(); } // 关闭弹窗 只有在设置是访问才有这个 void MainWindow::initCloseDialog(QCloseEvent *event) { m_trayDialag = new DDialog(this); - m_trayDialag->setAccessibleName("trayDialog"); m_trayDialag->setModal(true); - m_trayDialag->setIcon(QIcon::fromTheme(DIALOG_PC_MANAGER)); + m_trayDialag->setIcon(QIcon::fromTheme("deepin-pc-manager")); DRadioButton *radioExit = new DRadioButton(tr("Exit"), this); - radioExit->setAccessibleName("trayDialog_exitButton"); DRadioButton *radioMin = new DRadioButton(tr("Minimize to system tray"), this); - radioMin->setAccessibleName("trayDialog_minimizeButton"); DCheckBox *radioAsk = new DCheckBox(tr("Do not ask again"), this); - radioAsk->setAccessibleName("trayDialog_askButton"); closeType nChoose = static_cast(getCloseType()); // 根据GSettings设置settings页面的默认值 @@ -756,7 +603,6 @@ void MainWindow::initCloseDialog(QCloseEvent *event) QPushButton *cancelBtn = new QPushButton(m_trayDialag); cancelBtn->setText(tr("Cancel", "button")); cancelBtn->setObjectName("cancelBtn"); - cancelBtn->setAccessibleName("trayDialog_cancelButton"); cancelBtn->setAttribute(Qt::WA_NoMousePropagation); m_trayDialag->insertButton(0, cancelBtn, false); @@ -764,7 +610,6 @@ void MainWindow::initCloseDialog(QCloseEvent *event) confirmBtn->setText(tr("Confirm", "button")); confirmBtn->setObjectName("ConfirmBtn"); - confirmBtn->setAccessibleName("trayDialog_confirmButton"); confirmBtn->setAttribute(Qt::WA_NoMousePropagation); m_trayDialag->insertButton(1, confirmBtn, false); @@ -799,129 +644,63 @@ void MainWindow::initCloseDialog(QCloseEvent *event) } } -// 获得关闭类型 0托盘最小化 1推出 -int MainWindow::getCloseType() -{ - return m_gsetting ? m_gsetting->GetValue(CLOSE_TYPE).toInt() : 0; -} - -// 0 : Not Ask 1 : Ask 0 托盘最小化 1 退出 -void MainWindow::setCloseType(int value) -{ - if (m_gsetting) { - m_gsetting->SetValue(CLOSE_TYPE, value); - } -} - -// 获得访问类型 0不访问 1访问 -int MainWindow::getAskType() -{ - return m_gsetting ? m_gsetting->GetValue(ASK_TYPE).toInt() : 0; -} - -// 设置访问 0 不访问 1访问 -void MainWindow::setAskType(int value) -{ - if (m_gsetting) { - m_gsetting->SetValue(ASK_TYPE, value); - } -} - -// 寻找子页面索引 -int MainWindow::getPageIndex(QString pageName) +// 显示用户反馈弹框 +void MainWindow::showUserReplyDialog() { - int retIndex = 0; - // 安全工具 - // 如果是流量详情 - if (DATA_USAGE_NAME == pageName) { - retIndex = DATA_USAGE_INDEX; - } else if (STARTUP_CONTROL_NAME == pageName) { - // 如果是自启动管理 - retIndex = STARTUP_CONTROL_INDEX; - } else if (NET_CONTROL_NAME == pageName) { - // 如果是网络权限管控 - retIndex = NET_CONTROL_INDEX; - } else if (USB_CONN_NAME == pageName) { - // 如果是usb管控 - retIndex = USB_CONN_INDEX; - } else if (LOGIN_SAFETY_NAME == pageName) { - // 如果是登录安全 - retIndex = LOGIN_SAFETY_INDEX; - } else if (TRUSTED_PROTECTION_NAME == pageName) { - // 如果是登录安全 - retIndex = TRUSTED_PROTECTION_INDEX; - } - return retIndex; + DBUS_NOBLOCK_INVOKE(m_serSupportInvokerInter, "ServiceSession", 1); } -// 点击退回按钮槽 -void MainWindow::onBackWardClick(bool checked) +// 背景主题变化 +void MainWindow::themeTypeChange(ColorType themeType) { - Q_UNUSED(checked); - - if (m_contentStack.isEmpty()) { - return; - } - - // 针对病毒查杀页 进行后退判断和处理 - QString sModuleName = m_contentStack.top().first->name(); - if (MODULE_HOMEPAGE_NAME == sModuleName) { - m_homePageModule->requestStopExaming(); - m_homePageModule->onBackForward(); - popAndDelWidget(); - } else if (MODULE_SECURITY_TOOLS_NAME == sModuleName - || MODULE_DISK_CLEANER_NAME == sModuleName) { - // MainWindow统一管理子模块窗口的删除释放 - popAndDelWidget(); - } - - // 这里需要保证m_contentStack.size()>0,避免崩溃 - QWidget *topWidget = this->m_contentStack.top().second; - if (topWidget) { - topWidget->show(); + Q_UNUSED(themeType); + // 获得所有行 + int count = m_navModel->rowCount(); + for (int i = 0; i < count; i++) { + // 每行的item + QStandardItem *item = m_navModel->item(i, 0); + QString iconPath; + if (m_guiHelper->themeType() == DGuiApplicationHelper::ColorType::LightType) { + iconPath = m_modulesLightIconList.at(i); + } else { + iconPath = m_modulesDarakIconList.at(i); + } + // 每行item的图标设置 + QIcon icon = QIcon::fromTheme(iconPath); + item->setIcon(icon); + item->setData(NavItemMargin, Dtk::MarginsRole); + m_navModel->setItem(i, 0, item); } - - // 退回按钮状态 - updateBackwardBtn(); } -// 更新后退按钮 -void MainWindow::updateBackwardBtn() +/*********界面事件*********/ +// 关闭窗口事件 +void MainWindow::closeEvent(QCloseEvent *event) { - if (m_contentStack.isEmpty()) { - return; - } - - m_backwardBtn->setVisible(false); - - // 只对 病毒查杀页、安全工具、防火墙页 作后退按钮判断 - QString sModuleName = m_contentStack.top().first->name(); - if (MODULE_SECURITY_TOOLS_NAME == sModuleName || MODULE_DISK_CLEANER_NAME == sModuleName - || MODULE_HOMEPAGE_NAME == sModuleName) { - if (1 < m_contentStack.count()) { - m_backwardBtn->setVisible(true); - m_backwardBtn->setDisabled(false); + // 获得访问类型 0 不访问 1是展现访问关闭窗口 + if (!getAskType()) { + // 不访问 获得关闭类型 0最小化 1退出 + if (getCloseType()) { + closeWindow(); + event->ignore(); } else { - m_backwardBtn->setVisible(false); + hide(); + event->ignore(); } + } else { + initCloseDialog(event); } } - -void MainWindow::closeWindow() +// 事件过滤 +bool MainWindow::eventFilter(QObject *obj, QEvent *event) { - qApp->quit(); -} - -// 设置安装时间 -void MainWindow::setInstallTime() -{ - // 获得安装时间 如果是默认值-1 设置当前时间为安装时间 - QString lasttime = m_gsetting->GetValue(INSTALL_TIME).toString(); - QString defaultTime = "-1"; - if (lasttime == defaultTime) { - // 当前时间 - QDateTime date = QDateTime::currentDateTime(); - QString installTime = date.toString("yyyy-MM-dd hh:mm:ss"); - m_gsetting->SetValue(INSTALL_TIME, installTime); + // 判断是否鼠标点击 + if (event->type() == QEvent::MouseButtonRelease) { + // 判断是否在那个对象上面 + if (m_supportLabel == obj) { + // 跳转到服务与支持 + showUserReplyDialog(); + } } + return QWidget::eventFilter(obj, event); } diff --git a/deepin-pc-manager/src/window/mainwindow.h b/deepin-pc-manager/src/window/mainwindow.h index 7cf5c3e..d05b27d 100644 --- a/deepin-pc-manager/src/window/mainwindow.h +++ b/deepin-pc-manager/src/window/mainwindow.h @@ -1,178 +1,139 @@ -// Copyright (C) 2017 ~ 2019 Deepin Technology Co., Ltd. // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later -#pragma once +#ifndef MAINWINDOW_H +#define MAINWINDOW_H #include "interface/frameproxyinterface.h" #include "interface/moduleinterface.h" -#include "modules/common/common.h" -#include "utils.h" +#include "window/common/common.h" -#include #include -#include #include +#include +#include +#include +#include +#include -#include -#include #include +#include +#include +#include #include #include #include -#include +#include +#include DWIDGET_BEGIN_NAMESPACE class DListView; class DBackgroundGroup; -class DDialog; class DSettingsDialog; -class DFrame; DWIDGET_END_NAMESPACE QT_BEGIN_NAMESPACE class QHBoxLayout; -class QStandardItemModel; -class QGSettings; QT_END_NAMESPACE -namespace def { -class SystemSettings; -} - -DEF_NAMESPACE_BEGIN -class HomePageModule; -// 首页体检数据交互类 -class HomePageModel; -class NatiavModule; -class SecurityToolsModule; -class AntiVirusWork; -class NetControlWidget; class MultiSelectListView; -class RestartDefenderDialog; -class DBusInvokerInterface; -class SettingsInvokerInterface; -DEF_NAMESPACE_END +DCORE_USE_NAMESPACE DWIDGET_USE_NAMESPACE - -enum closeType { Tray, Exit, Ask, Count }; - -DEF_NAMESPACE_BEGIN - -class MainWindow : public DTK_WIDGET_NAMESPACE::DMainWindow, - public FrameProxyInterface, - protected QDBusContext +class DBusInvokerInterface; +class MainWindow : public DTK_WIDGET_NAMESPACE::DMainWindow + , public FrameProxyInterface + , protected QDBusContext { Q_OBJECT public: - explicit MainWindow(QWidget *parent = nullptr); + MainWindow(QWidget *parent = nullptr); ~MainWindow() override; // 模板函数,供各模块调用 void popWidget(ModuleInterface *const inter) override; // 弹栈 void popAndDelWidget(ModuleInterface *const inter) override; - void pushWidget(ModuleInterface *const inter, QWidget *const w) override; // 压栈 + void pushWidget(ModuleInterface *const inter, QWidget *const w) override; // 压栈 void setModuleVisible(ModuleInterface *const inter, const bool visible) override; // 模块可视化 void setCurrentModule(int iModuleIdx, int iPageIdx = 0) override; // 设置当前模块 ModuleInterface *getCurrentModule() override; - int getModuleIndex(const QString &name) override; // 获得模块下标 + int getModuleIndex(const QString &name) override; // 获得模块下标 void setBackForwardButtonStatus(bool status) override; // 设置后退按钮可用状态 - // 显示默认设置弹框 - void showDefaultSettingDialog(); - // 显示用户反馈弹框 - void showUserReplyDialog(); - // 显示谈设置弹窗,并跳转到相应组位置 - void showSettingDialog(const QString &groupKey); - void toggle(); +private: + // 初始化 + void initUI(); + void initData(); + void initTray(); - // 将窗口出显示栈, 并删除 + // 出栈/入栈 void popAndDelWidget(); - // 将窗口出显示栈 + void popAllWidgets(int place = 0); void popWidget(); - void initAllModule(); - void showModulePage(const QString &module, const QString &page); - int getModuleCount(); + void pushNormalWidget(ModuleInterface *const inter, QWidget *const w); + + // 主界面关闭方式配置项 获取/设置 + int getCloseType(); + void setCloseType(int value); + // 主界面退出询问弹框配置项 获取/设置 + int getAskType(); + void setAskType(int value); + // 程序退出 void closeWindow(); - // 设置安装时间 - void setInstallTime(); + void initCloseDialog(QCloseEvent *event); -protected: - void closeEvent(QCloseEvent *event) override; - void hideEvent(QHideEvent *event) override; + // 显示用户反馈弹框 + void showUserReplyDialog(); -Q_SIGNALS: - void moduleVisibleChanged(const QString &module, bool visible); - // 校验病毒库版本 - void notifyCheckVdbVersion(); +public Q_SLOTS: + int getModuleCount(); + void showModulePage(const QString &module, const QString &page); + // 寻找子页面索引 + int getPageIndex(QString pageName); -private Q_SLOTS: + void initAllModule(); + void modulePreInitialize(); void onFirstItemClick(const QModelIndex &index); - void onTrayActivated(QSystemTrayIcon::ActivationReason state); - void setSystemsafety(const QModelIndex &index, int sonindex); - // 点击退回按钮槽 - void onBackWardClick(bool checked); - // 更新后退按钮 - void updateBackwardBtn(); + void onTrayActivated(QSystemTrayIcon::ActivationReason state); + void showDefaultSettingDialog(); // 主题类型改变 void themeTypeChange(ColorType themeType); -private: - // 初始化UI - void initUI(); - // 初始化数据 - void initData(); - // 初始化信号槽 - void initSignalSlots(); - - void initTray(); - void initCloseDialog(QCloseEvent *event); - void modulePreInitialize(); - void popAllWidgets(int place = 0); // place is Remain count - void pushNormalWidget(ModuleInterface *const inter, - QWidget *const w); // exchange third widget : push new widget - - // 主界面关闭方式配置项 获取/设置 - int getCloseType(); - void setCloseType(int value); - - // 主界面退出询问弹框配置项 获取/设置 - int getAskType(); - void setAskType(int value); +Q_SIGNALS: + void moduleVisibleChanged(const QString &module, bool visible); - // 寻找子页面索引 - int getPageIndex(QString pageName); +protected: + void closeEvent(QCloseEvent *event) override; + // 事件过滤 + bool eventFilter(QObject *obj, QEvent *event) override; private: + DConfig *m_dconfig; + DBusInvokerInterface *m_serSupportInvokerInter; + QHBoxLayout *m_contentLayout; DFrame *m_splitLine; - QHBoxLayout *m_rightContentLayout; MultiSelectListView *m_navView; + QHBoxLayout *m_rightContentLayout; DTK_WIDGET_NAMESPACE::DBackgroundGroup *m_rightView; QStandardItemModel *m_navModel; - QStack> m_contentStack; - HomePageModule *m_homePageModule; // 首页体检模块 - HomePageModel *m_homePageModel; // 首页体检数据处理对象 - SecurityToolsModule *m_securityToolsModule; - QList> m_modules; - DIconButton *m_backwardBtn; // 上一步 - QSystemTrayIcon *m_pSystemTray; // 系统托盘图标 - QMenu *m_trayMenu; // 托盘目录 - DDialog *m_trayDialag; - SettingsInvokerInterface *m_gsetting; // 安全中心gsetting配置 - DSettingsDialog *m_dsd; // 设置弹框 + DLabel *m_supportLabel; + QList> m_modules; + QStack> m_contentStack; DGuiApplicationHelper *m_guiHelper; // 方便得到系统主题 QStringList m_modulesDarakIconList; // 深色主题图标列表 QStringList m_modulesLightIconList; // 浅色主题图标列表 - // 安全工具 - DBusInvokerInterface *m_pSecurityToolDBusInter; // 安全工具 + QSystemTrayIcon *m_pSystemTray; // 系统托盘图标 + QMenu *m_trayMenu; // 托盘目录 + DDialog *m_trayDialag; + + DSettingsDialog *m_dsd; // 设置弹框 }; -DEF_NAMESPACE_END +#endif // MAINWINDOW_H diff --git a/deepin-pc-manager/src/window/modules/authority/defendermoduleauthorizebase.cpp b/deepin-pc-manager/src/window/modules/authority/defendermoduleauthorizebase.cpp deleted file mode 100644 index 43c4089..0000000 --- a/deepin-pc-manager/src/window/modules/authority/defendermoduleauthorizebase.cpp +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (C) 2022 ~ 2022 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "defendermoduleauthorizebase.h" - -#include "../common/invokers/invokerfactory.h" - -#include - -#define SERVER_NAME "com.deepin.pc.manager.session.daemon" -#define SERVER_PATH "/com/deepin/pc/manager/session/daemon" - -DefenderModuleAuthorizeBase::DefenderModuleAuthorizeBase(const QString &moduleName, QObject *parent) - : QObject(parent) - , m_authService(nullptr) - , m_moduleName(moduleName) -{ - m_authService = InvokerFactory::GetInstance().CreateInvoker(SERVER_NAME, - SERVER_PATH, - SERVER_NAME, - ConnectType::SESSION, - this); - initServiceConnection(); - init(); -} - -DefenderModuleAuthorizeBase::~DefenderModuleAuthorizeBase() { } - -void DefenderModuleAuthorizeBase::init() -{ - onModulesActived(); -} - -const QString &DefenderModuleAuthorizeBase::getModuleName() -{ - return m_moduleName; -} - -// 转发信号与结果处理 -void DefenderModuleAuthorizeBase::initServiceConnection() -{ - bool connSuccess = false; - connSuccess = m_authService->Connect("NotifyAuthStarted", this, SIGNAL(onAuthorizeStarted())); - if (!connSuccess) { - qWarning() << Q_FUNC_INFO << "[NotifyAuthStarted] connecte failed!"; - } - connSuccess = m_authService->Connect("NotifyAuthFinished", this, SIGNAL(onAuthorizeFinished())); - if (!connSuccess) { - qWarning() << Q_FUNC_INFO << "[NotifyAuthFinished] connecte failed!"; - } - connSuccess = m_authService->Connect("NotifyAuthResult", - this, - SLOT(onAuthResultRecived(const QString &, int, bool))); - if (!connSuccess) { - qWarning() << Q_FUNC_INFO << "[NotifyAuthResult] connecte failed!"; - } -} - -// 授权模块初始化时需要注册自己的模块名称 -void DefenderModuleAuthorizeBase::onModulesActived() -{ - DBUS_NOBLOCK_INVOKE(m_authService, "ModulesRequestAuthorityActived"); -} - -// 请求授权 -void DefenderModuleAuthorizeBase::requestAuthWithID(int id) -{ - DBUS_NOBLOCK_INVOKE(m_authService, "RequestAuthWithID", m_moduleName, id); -} - -// 转发结果 -// 连接到这个信号以处理授权结果 -void DefenderModuleAuthorizeBase::onAuthResultRecived(const QString &moduleName, - int id, - bool result) -{ - if (moduleName == m_moduleName) { - Q_EMIT onAuthorized(id, result); - } -} diff --git a/deepin-pc-manager/src/window/modules/authority/defendermoduleauthorizebase.h b/deepin-pc-manager/src/window/modules/authority/defendermoduleauthorizebase.h deleted file mode 100644 index 6297819..0000000 --- a/deepin-pc-manager/src/window/modules/authority/defendermoduleauthorizebase.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2022 ~ 2022 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef DEFENDERMODULEAUTHORIZEBASE_H -#define DEFENDERMODULEAUTHORIZEBASE_H - -#include "../common/invokers/invokerfactory.h" - -#include - -class DefenderModuleAuthorizeBase : public QObject -{ - Q_OBJECT - -public: - explicit DefenderModuleAuthorizeBase(const QString &moduleName, QObject *parent = nullptr); - virtual ~DefenderModuleAuthorizeBase(); - - void init(); - void initServiceConnection(); - - // signals - // 模块启动时向上注册 - // 调用授权接口方法,将模块 - void onModulesActived(); - // 请求授权 - void requestAuthWithID(int id); - // 注册模块名称 - const QString &getModuleName(); - -public Q_SLOTS: - // slots - // 收到提权结果 - // 对应ID处理自己的流程,为了调试方便,调用者自行固定操作ID - void onAuthResultRecived(const QString &moduleName, int id, bool result); - -Q_SIGNALS: - // 界面状态通知,实现该方法以处理界面变化 - // 调用者处理以下信号 - void onAuthorizeStarted(); - void onAuthorizeFinished(); - // 授权结果通知 - void onAuthorized(int id, bool result); - -private: - DBusInvokerInterface *m_authService; - QString m_moduleName; -}; - -#endif // DEFENDERMODULEAUTHORIZEBASE_H diff --git a/deepin-pc-manager/src/window/modules/cleaner/cleanerdbusadaptorimpl.cpp b/deepin-pc-manager/src/window/modules/cleaner/cleanerdbusadaptorimpl.cpp deleted file mode 100644 index 6d13102..0000000 --- a/deepin-pc-manager/src/window/modules/cleaner/cleanerdbusadaptorimpl.cpp +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "cleanerdbusadaptorimpl.h" - -#include "window/modules/common/gsettingkey.h" -#include "window/modules/common/invokers/invokerfactory.h" - -CleanerDBusAdaptorImpl::CleanerDBusAdaptorImpl(QObject *parent) - : QObject(parent) - , m_dataInterFaceServer(nullptr) - , m_monitorInterFaceServer(nullptr) -{ - m_dataInterFaceServer = - InvokerFactory::GetInstance().CreateInvoker("com.deepin.pc.manager.session.daemon", - "/com/deepin/pc/manager/session/daemon", - "com.deepin.pc.manager.session.daemon", - ConnectType::SESSION, - this); - m_monitorInterFaceServer = - InvokerFactory::GetInstance().CreateInvoker("com.deepin.pc.manager.MonitorNetFlow", - "/com/deepin/pc/manager/MonitorNetFlow", - "com.deepin.pc.manager.MonitorNetFlow", - ConnectType::SYSTEM, - this); - - m_gsettings = InvokerFactory::GetInstance().CreateSettings(DEEPIN_PC_MANAGER_GSETTING_PATH, - QByteArray(), - this); -} - -QStringList CleanerDBusAdaptorImpl::GetTrashInfoList() -{ - QStringList rst; - if (m_dataInterFaceServer) { - QDBusMessage msg = DBUS_BLOCK_INVOKE(m_dataInterFaceServer, "GetTrashInfoList"); - GET_MESSAGE_VALUE(QStringList, tmp, msg); - rst = tmp; - } - return rst; -} - -QStringList CleanerDBusAdaptorImpl::GetCacheInfoList() -{ - QStringList rst; - if (m_dataInterFaceServer) { - QDBusMessage msg = DBUS_BLOCK_INVOKE(m_dataInterFaceServer, "GetCacheInfoList"); - GET_MESSAGE_VALUE(QStringList, tmp, msg); - rst = tmp; - } - return rst; -} - -QStringList CleanerDBusAdaptorImpl::GetLogInfoList() -{ - QStringList rst; - if (m_dataInterFaceServer) { - QDBusMessage msg = DBUS_BLOCK_INVOKE(m_dataInterFaceServer, "GetLogInfoList"); - GET_MESSAGE_VALUE(QStringList, tmp, msg); - rst = tmp; - } - return rst; -} - -QStringList CleanerDBusAdaptorImpl::GetHistoryInfoList() -{ - QStringList rst; - if (m_dataInterFaceServer) { - QDBusMessage msg = DBUS_BLOCK_INVOKE(m_dataInterFaceServer, "GetHistoryInfoList"); - GET_MESSAGE_VALUE(QStringList, tmp, msg); - rst = tmp; - } - return rst; -} - -QString CleanerDBusAdaptorImpl::GetAppTrashInfoList() -{ - QString rst; - if (m_dataInterFaceServer) { - QDBusMessage msg = DBUS_BLOCK_INVOKE(m_dataInterFaceServer, "GetAppTrashInfoList"); - GET_MESSAGE_VALUE(QString, tmp, msg); - rst = tmp; - } - return rst; -} - -QString CleanerDBusAdaptorImpl::GetBrowserCookiesInfoList() -{ - QString rst; - if (m_dataInterFaceServer) { - QDBusMessage msg = DBUS_BLOCK_INVOKE(m_dataInterFaceServer, "GetBrowserCookiesInfoList"); - GET_MESSAGE_VALUE(QString, tmp, msg); - rst = tmp; - } - return rst; -} - -void CleanerDBusAdaptorImpl::DeleteSpecifiedFiles(QStringList paths) -{ - if (m_dataInterFaceServer) { - DBUS_NOBLOCK_INVOKE(m_dataInterFaceServer, "DeleteSpecifiedFiles", paths); - } -} - -void CleanerDBusAdaptorImpl::AddSecurityLog(int nType, const QString &sInfo) -{ - if (m_monitorInterFaceServer) { - DBUS_NOBLOCK_INVOKE(m_monitorInterFaceServer, "AddSecurityLog", nType, sInfo); - } -} - -QString CleanerDBusAdaptorImpl::GetValueFromeGSettings(const QString &key) -{ - QString rst; - if (m_gsettings) { - rst = m_gsettings->GetValue(key).toString(); - } - return rst; -} - -void CleanerDBusAdaptorImpl::SetValueToGSettings(const QString &key, const QString &value) -{ - if (m_gsettings) { - m_gsettings->SetValue(key, value); - } -} - -void CleanerDBusAdaptorImpl::DeleteSpecifiedAppUninstallInfo(const QString &pkgName) -{ - if (m_monitorInterFaceServer) { - DBUS_NOBLOCK_INVOKE(m_monitorInterFaceServer, "DeleteUninstalledAppRecord", pkgName); - } -} diff --git a/deepin-pc-manager/src/window/modules/cleaner/cleanerdbusadaptorimpl.h b/deepin-pc-manager/src/window/modules/cleaner/cleanerdbusadaptorimpl.h deleted file mode 100644 index 057394a..0000000 --- a/deepin-pc-manager/src/window/modules/cleaner/cleanerdbusadaptorimpl.h +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef CLEANERDBUSADAPTORIMPL_H -#define CLEANERDBUSADAPTORIMPL_H - -#include "cleanerdbusadaptorinterface.h" - -#include - -class DBusInvokerInterface; -class SettingsInvokerInterface; - -class CleanerDBusAdaptorImpl : public QObject, public CleanerDBusAdaptorInterface -{ - Q_OBJECT -public: - explicit CleanerDBusAdaptorImpl(QObject *parent = nullptr); - - virtual ~CleanerDBusAdaptorImpl() { } - - // 后台服务:deepin-pc-manager-session-daemon - virtual QStringList GetTrashInfoList(); - virtual QStringList GetCacheInfoList(); - virtual QStringList GetLogInfoList(); - virtual QStringList GetHistoryInfoList(); - virtual QString GetAppTrashInfoList(); - virtual QString GetBrowserCookiesInfoList(); - virtual void DeleteSpecifiedFiles(QStringList); - // 安全日志内容写入 - virtual void AddSecurityLog(int nType, const QString &sInfo); - // Gsetting读写,单元测试不用使用gsetting,所以加到这里做mock - virtual QString GetValueFromeGSettings(const QString &key); - virtual void SetValueToGSettings(const QString &key, const QString &value); - virtual void DeleteSpecifiedAppUninstallInfo(const QString &pkgName); - -private: - // 后台服务接口 - DBusInvokerInterface *m_dataInterFaceServer; - DBusInvokerInterface *m_monitorInterFaceServer; - SettingsInvokerInterface *m_gsettings; - -private: - // 禁用拷贝构造与赋值 - CleanerDBusAdaptorImpl(const CleanerDBusAdaptorImpl &); - CleanerDBusAdaptorImpl &operator=(const CleanerDBusAdaptorImpl &); -}; - -#endif // CLEANERDBUSADAPTORIMPL_H diff --git a/deepin-pc-manager/src/window/modules/cleaner/cleanerdbusadaptorinterface.h b/deepin-pc-manager/src/window/modules/cleaner/cleanerdbusadaptorinterface.h deleted file mode 100644 index 854b3f2..0000000 --- a/deepin-pc-manager/src/window/modules/cleaner/cleanerdbusadaptorinterface.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -/* - * 因为unit test的需求,将后端分离以完成mock工作,提供虚函数使得gmock框架可以模拟dbus的输入与输出 - */ - -#ifndef CLEANERDBUSADAPTORINTERFACE_H -#define CLEANERDBUSADAPTORINTERFACE_H - -#include - -class CleanerDBusAdaptorInterface -{ -public: - virtual QStringList GetTrashInfoList() = 0; - virtual QStringList GetCacheInfoList() = 0; - virtual QStringList GetLogInfoList() = 0; - virtual QStringList GetHistoryInfoList() = 0; - virtual QString GetAppTrashInfoList() = 0; - virtual QString GetBrowserCookiesInfoList() = 0; - virtual void DeleteSpecifiedFiles(QStringList) = 0; - virtual void AddSecurityLog(int nType, const QString &sInfo) = 0; - virtual QString GetValueFromeGSettings(const QString &key) = 0; - virtual void SetValueToGSettings(const QString &key, const QString &value) = 0; - virtual void DeleteSpecifiedAppUninstallInfo(const QString &pkgName) = 0; - - virtual ~CleanerDBusAdaptorInterface() { } -}; - -#endif // CLEANERDBUSADAPTORINTERFACE_H diff --git a/deepin-pc-manager/src/window/modules/cleaner/cleanermodule.cpp b/deepin-pc-manager/src/window/modules/cleaner/cleanermodule.cpp deleted file mode 100644 index 65f59b7..0000000 --- a/deepin-pc-manager/src/window/modules/cleaner/cleanermodule.cpp +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "cleanermodule.h" - -#include "cleanerdbusadaptorimpl.h" -#include "widgets/trashcleangreetingwidget.h" -#include "widgets/trashcleanresultwidget.h" -#include "window/modules/common/gsettingkey.h" - -#include -#include - -CleanerModule::CleanerModule(FrameProxyInterface *frameProxy, QObject *parent) - : QObject(parent) - , ModuleInterface(frameProxy) - , m_dbusAdaptorImpl(nullptr) - , m_widget(nullptr) - , m_greetingWidget(nullptr) - , m_resutlWidget(nullptr) - , m_framProxy(frameProxy) -{ -} - -CleanerModule::~CleanerModule() -{ - // 在m_frameProxy->pushWidget方法调用中,已经将显示页的父指针指向MainWindow对象,各显示页是否释放由MainWindow对象决定 - // 所以此处不能手动删除各显示页 - // if (m_resutlWidget) { - // m_resutlWidget->haltScan(); - // m_resutlWidget->deleteLater(); - // m_resutlWidget = nullptr; - // } - - // if (m_greetingWidget) { - // m_greetingWidget->deleteLater(); - // m_greetingWidget = nullptr; - // } -} - -void CleanerModule::initialize() { } - -void CleanerModule::preInitialize() { } - -const QString CleanerModule::name() const -{ - return MODULE_DISK_CLEANER_NAME; -} - -void CleanerModule::active(int index) -{ - Q_UNUSED(index); - if (!m_dbusAdaptorImpl) { - m_dbusAdaptorImpl = new CleanerDBusAdaptorImpl(this); - } - - QString lastScanSize = m_dbusAdaptorImpl->GetValueFromeGSettings(CLEANER_LAST_TIME_CLEANED); - - if (!m_greetingWidget) { - m_greetingWidget = new TrashCleanGreetingWidget(nullptr); - connect(m_greetingWidget, - &TrashCleanGreetingWidget::notifyStartScan, - this, - &CleanerModule::showResultWidget); - connect(m_greetingWidget, &QWidget::destroyed, this, [&] { - m_greetingWidget = nullptr; - }); - } - m_greetingWidget->setGreeing(lastScanSize); - - m_frameProxy->pushWidget(this, m_greetingWidget); - if (m_resutlWidget) { - TrashCleanResultWidget::ScanStages stage = m_resutlWidget->GetCurrentStage(); - - if (stage > TrashCleanResultWidget::ScanStages::PREPARING) { - m_greetingWidget->hide(); - m_frameProxy->pushWidget(this, m_resutlWidget); - - if (stage == TrashCleanResultWidget::ScanStages::SCAN_STARTED) { - m_framProxy->setBackForwardButtonStatus(false); - } - } - } -} - -void CleanerModule::deactive() { } - -void CleanerModule::showResultWidget() -{ - // 为避免资源问题不要使用旧窗口 - // 重新new一个出来 - if (!m_resutlWidget) { - m_resutlWidget = new TrashCleanResultWidget(m_dbusAdaptorImpl); - connect(m_resutlWidget, &TrashCleanResultWidget::destroyed, this, [this] { - m_resutlWidget = nullptr; - }); - - connect(m_resutlWidget, &TrashCleanResultWidget::notifyBackToGreetingWidget, this, [this] { - m_framProxy->popAndDelWidget(this); - m_resutlWidget = nullptr; - m_greetingWidget->show(); - }); - - connect(m_resutlWidget, - &TrashCleanResultWidget::notifyUpdateLastCleaned, - this, - [this](const QString &lastScanSize) { - if (m_greetingWidget) { - m_greetingWidget->setGreeing(lastScanSize); - } - }); - - connect(m_resutlWidget, - &TrashCleanResultWidget::notifySetBackForwardBtnStatus, - this, - [this](bool status) { - m_framProxy->setBackForwardButtonStatus(status); - }); - } - - m_greetingWidget->hide(); - m_frameProxy->pushWidget(this, m_resutlWidget); - m_resutlWidget->setScanConfigList(m_greetingWidget->getScanConfig()); - m_resutlWidget->processScan(); -} diff --git a/deepin-pc-manager/src/window/modules/cleaner/cleanermodule.h b/deepin-pc-manager/src/window/modules/cleaner/cleanermodule.h deleted file mode 100644 index 03e153e..0000000 --- a/deepin-pc-manager/src/window/modules/cleaner/cleanermodule.h +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include "window/interface/frameproxyinterface.h" -#include "window/interface/moduleinterface.h" -#include "window/modules/common/common.h" - -DEF_NAMESPACE_BEGIN -DEF_ANTIVIRUS_NAMESPACE_BEGIN - -class TrashCleanWidget; -class ModuleInterface; -class FrameProxyInterface; -class CleanerDBusAdaptorImpl; -class TrashCleanGreetingWidget; -class TrashCleanResultWidget; - -class CleanerModule : public QObject, public ModuleInterface -{ - Q_OBJECT -public: - explicit CleanerModule(FrameProxyInterface *frame, QObject *parent = nullptr); - ~CleanerModule() override; - -public: - void initialize() override; - void preInitialize() override; - const QString name() const override; - void active(int index) override; - void deactive() override; - -private: - void showResultWidget(); - -public Q_SLOTS: - -private: - CleanerDBusAdaptorImpl *m_dbusAdaptorImpl; - TrashCleanWidget *m_widget; - TrashCleanGreetingWidget *m_greetingWidget; - TrashCleanResultWidget *m_resutlWidget; - FrameProxyInterface *m_framProxy; -}; - -DEF_ANTIVIRUS_NAMESPACE_END -DEF_NAMESPACE_END diff --git a/deepin-pc-manager/src/window/modules/cleaner/trashcleandefinition.h b/deepin-pc-manager/src/window/modules/cleaner/trashcleandefinition.h deleted file mode 100644 index ff80491..0000000 --- a/deepin-pc-manager/src/window/modules/cleaner/trashcleandefinition.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (C) 2019 ~ 2022 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef TRASHCLEANDEFINITION_H -#define TRASHCLEANDEFINITION_H - -#include - -#define SYS_CONFIG_INDEX 0 -#define APP_CONFIG_INDEX 1 -#define HISTORY_CONFIG_INDEX 2 -#define COOKIES_CONFIG_INDEX 3 - -const QString kScanMoviePath = ""; -const QString kScanFinishedIconPath = ""; -const QString kCleanFinishedIconPath = ""; - -const QString kGreetingLogoPath = "dcc_cleaner_greeting"; - -const QString kHeaderScanningIconPath = "dcc_cleaner_scanning"; -const QString kHeaderScanedIconPath = "dcc_cleaner_scanned"; -const QString kHeaderCleanedIconPath = "dcc_cleaner_cleaned"; -const QString kSysIconPath = "dcc_cleaner_sys_icon"; -const QString kAppIconPath = "dcc_cleaner_app_icon"; -const QString kHisIconPath = "dcc_cleaner_history_icon"; -const QString kCookiesIconPath = "dcc_cleaner_cookies_icon"; -const QString kSysIconPathDark = "dcc_cleaner_sys_dark_icon"; -const QString kAppIconPathDark = "dcc_cleaner_app_dark_icon"; -const QString kHisIconPathDark = "dcc_cleaner_history_dark_icon"; -const QString kCookiesIconPathDark = "dcc_cleaner_cookies_dark_icon"; - -#endif // TRASHCLEANDEFINITION_H diff --git a/deepin-pc-manager/src/window/modules/cleaner/trashcleanitem.cpp b/deepin-pc-manager/src/window/modules/cleaner/trashcleanitem.cpp deleted file mode 100644 index e37b11c..0000000 --- a/deepin-pc-manager/src/window/modules/cleaner/trashcleanitem.cpp +++ /dev/null @@ -1,709 +0,0 @@ -// Copyright (C) 2020 ~ 2020 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "trashcleanitem.h" - -#include "widgets/cleanerresultitemwidget.h" - -#include -#include -#include -#include - -#define KILOBYTE 1024 -#define SHOWDELAY 5 - -TrashCleanItem::TrashCleanItem(TrashCleanItem *parentItem) - : QObject(parentItem) - , m_isToStop(false) - , m_isShown(false) - , m_totalSize(0) - , m_totalAmount(0) - , m_itemsize(0) - , m_itemAmount(0) - , m_cleanedSize(0) - , m_cleanedAmount(0) - , m_parent(parentItem) - , m_itemWidget(nullptr) - , m_root(nullptr) - , m_isChecked(true) - , m_isAnyChildSelected(false) - , m_unCheckable(false) -{ - initItemWidget(); -} - -TrashCleanItem::~TrashCleanItem() { } - -// 将文件大小由字节数转换为对应单位 -// 最大单位在需求文档上没有明确,暂时定义为GB -// 保留两位小数 -QString TrashCleanItem::fileSizeToString(quint64 filesize) -{ - QStringList unit; - unit << "Byte" - << "KB" - << "MB" - << "GB"; - - double quotient = 0; - - // 以1024为单位换算 - int i = 0; - while (KILOBYTE <= filesize && i < unit.size() - 1) { - quotient = filesize % KILOBYTE; - filesize /= KILOBYTE; - i++; - } - - double size = quotient / KILOBYTE + filesize; - // 输出时,如果有小数,保留两位 - return QString("%1 %2").arg(QString::number(size, 'f', 2)).arg(unit[i]); -} - -// 作为根项目被选中时,将所有子项目设为选中状态 -void TrashCleanItem::setChildSelected(bool status) -{ - if (m_unCheckable) { - return; - } - - m_isChecked = status; - // 向下递归, 将选中状态与根项目同步 - foreach (auto item, m_childItems) { - if (!item) { - continue; - } - item->setSelected(status); - item->setChildSelected(status); - } - - findRootItem()->recount(); -} - -// 获取根节点位置 -TrashCleanItem *TrashCleanItem::findRootItem() -{ - if (m_root != nullptr) { - return m_root; - } - - // 自身根结点 - if (m_parent == nullptr) { - m_root = this; - return m_root; - } - - // 递归向上查找 - m_root = m_parent; - while (m_root->m_parent != nullptr) { - m_root = m_root->m_parent; - } - - return m_root; -} - -// 依赖窗口上的checkbox产生的勾选或取消勾选,在此处响应 -void TrashCleanItem::stageChanged(bool isItemSelected) -{ - if (m_unCheckable) { - return; - } - - m_isChecked = isItemSelected; - // 子项被选中,将所有父项设为选中 - if (isItemSelected) { - TrashCleanItem *tmp = m_parent; - while (tmp != nullptr) { - tmp->setSelected(true); - tmp = tmp->m_parent; - } - } else { - // bug - // https://pms.uniontech.com/zentao/bug-view-60687.html,如果所有子项目被取消,父项目也应取消 - // 子项被取消时,在此同步父项目的标志 - TrashCleanItem *tmp = m_parent; - // 更新父结点的状态,需要遍历父结点下所有结点 - // 存在选中的子项时置为true - // 否则置为false - while (tmp) { - tmp->m_isAnyChildSelected = false; - foreach (auto item, tmp->m_childItems) { - if (!item) { - continue; - } - if (item->isSelected()) { - tmp->m_isAnyChildSelected = true; - break; - } - } - if (!m_isAnyChildSelected) { - tmp->setSelected(tmp->m_isAnyChildSelected); - } - - tmp = tmp->m_parent; - } - } - - foreach (auto child, m_childItems) { - if (!child) { - continue; - } - child->setSelected(isItemSelected); - } - - // 由于已经产生了勾选行为,因此需要重新统计总大小并显示 - findRootItem()->recount(); -} - -// 作为子结点,由根项或者父项设置选中状态 -void TrashCleanItem::setSelected(bool status) -{ - if (m_unCheckable) { - return; - } - - m_isChecked = status; - Q_EMIT setWidgetItemSelected(status); -} - -void TrashCleanItem::setConfigToScan() -{ - if (nullptr == m_parent) { - m_isChecked = true; - Q_EMIT setWidgetItemSelected(true); - } -} - -// title 作为本项说明,只在必要的项目上设置 -void TrashCleanItem::setTitle(const QString &title) -{ - m_itemWidget->setHeadText(title); - m_title = title; -} - -// tip 作为本项说明,只在必要的项目上设置 -void TrashCleanItem::setTip(const QString &tip) -{ - m_itemWidget->setHeadTipText(tip); -} - -// 扫描文件的路径列表,由主界面通过后台服务接口产生,并设置 -void TrashCleanItem::setFilePaths(const QList &paths) -{ - m_scanPaths = paths; - // 路径内容去掉重复项 - QSet set(m_scanPaths.begin(), m_scanPaths.end()); - m_scanPaths = set.values(); -} - -void TrashCleanItem::setPkgName(const QString &pkgName) -{ - m_pkgName = pkgName; -} - -// 有子项检查添加 -void TrashCleanItem::addChild(TrashCleanItem *child) -{ - m_childItems.push_back(child); -} - -void TrashCleanItem::removeChildren() -{ - foreach (auto child, m_childItems) { - if (!child) { - continue; - } - child->removeChildren(); - // 可能有消息在处理,不要直接delete - removeChild(child); - } - - resetData(); -} - -void TrashCleanItem::removeChild(TrashCleanItem *child) -{ - // 检查是否存在,removeat需要一个有效参数 - int index = m_childItems.indexOf(child); - if (-1 == index) { - return; - } - // 删除该子结点 - m_childItems.removeAt(index); - child->itemWidget()->deleteLater(); - child->deleteLater(); -} - -void TrashCleanItem::scan() -{ - // 深度递归 - // 对于根结点,widget设为扫描状态 - if (m_isToStop || !m_isChecked) { - return; - } - - resetData(); - - foreach (auto item, m_childItems) { - if (!item) { - continue; - } - item->scan(); - m_totalSize += item->totalFileSize(); - m_totalAmount += item->totalFileAmount(); - } - - foreach (const auto &path, m_scanPaths) { - if (m_isToStop || !m_isChecked) { - break; - } - scanFile(path); - } - - m_totalSize += m_itemsize; - m_totalAmount += m_itemAmount; -} - -// 重新扫描时,清空内容,避免控件上有残留的文字 -void TrashCleanItem::resetData() -{ - m_totalSize = 0; - m_totalAmount = 0; - m_itemsize = 0; - m_itemAmount = 0; - m_isShown = false; - m_isToStop = false; - m_fileList.clear(); - m_deletePaths.clear(); -} - -void TrashCleanItem::increaseCleanedItemInfo(quint64 cleanedSize, int cleanedAmount) -{ - m_cleanedSize += cleanedSize; - m_cleanedAmount += cleanedAmount; -} - -// 获取单个文件的大小,同时记录文件总数 -void TrashCleanItem::scanFile(const QString &path) -{ - QFileInfo info(path); - if (info.exists()) { - if (info.isFile()) { - m_itemAmount++; // 记录文件数 - m_itemsize += quint64(info.size()); - // 用户显示在主界面的标题内容,由于文件路径是同检查项层次决定的,所以不需要该文件的路径信息 - m_fileList.append(info.fileName()); - m_deletePaths.append(info.absoluteFilePath()); - } else if (info.isDir()) { - QDir dir(path); - for (const QFileInfo &i : - dir.entryInfoList(QDir::NoDotAndDotDot | QDir::Files | QDir::Dirs | QDir::Hidden - | QDir::NoSymLinks)) { - // 递归扫描目录内容 - scanFile(i.absoluteFilePath()); - } - } - } -} - -// 清理的临时实现,后续优化中,将此逻辑移入后台服务 -void TrashCleanItem::clean() -{ - // 仅删除选中项 - if (!m_isChecked || !m_isShown) { - // 根结点可能被选中,但是没有被show,此时也应当发送信号 - // 对应的,未被选中的根结点不需要发送信号 - if (nullptr == m_parent && m_isChecked) { - Q_EMIT cleanFinished(); - } - return; - } - - foreach (const auto child, m_childItems) { - if (!child) { - continue; - } - child->clean(); - } - - quint64 cleanndSize = m_itemsize; - // 目前不再验证是否有残留 - // 直接将值置为0 - m_totalSize = 0; - m_totalAmount = 0; - m_itemsize = 0; - m_itemAmount = 0; - m_isShown = true; - - // 只对底层项目设置清理信息 - // 删除操作移到后台,不再显示未成功情形 - if (!m_childItems.size() && m_parent != nullptr) { - setSelected(false); - Q_EMIT setCleanDone(); - } - - // 根项目通知主界面清理完成 - if (m_parent == nullptr) { - recount(); - Q_EMIT cleanFinished(); - } else { - findRootItem()->increaseCleanedItemInfo(cleanndSize, m_deletePaths.size()); - } - - if (!m_deletePaths.empty()) { - findRootItem()->NoticeUIRemoveFiles(m_deletePaths); - findRootItem()->NoticeUICleanedApp(m_pkgName); - m_deletePaths.clear(); - } - - // 如果存在子项目,统计所有子项大小 - // 如果所有大小均为0,将父项或根项设置为不可选中 - quint64 remainSize = 0; - uint remainAmount = 0; - if (m_childItems.size()) { - recountRemainItems(&remainSize, &remainAmount); - if (!remainSize) { - m_unCheckable = true; - Q_EMIT setUncheckable(); - } - } -} - -// 注意,重算大小和数目时不要重新扫描 -// 目录如果有变化应体现在“重新扫描”功能中 -void TrashCleanItem::recountItems(quint64 *size, uint *amount) -{ - if (m_isChecked && m_isShown) { - findRootItem()->m_isAnyChildSelected = true; - findRootItem()->m_isShown = true; - foreach (auto item, m_childItems) { - if (!item) { - continue; - } - item->recountItems(size, amount); - } - *size += m_itemsize; - *amount += m_itemAmount; - } -} - -// 根结点对于重新计算选中项目累计大小的响应 -void TrashCleanItem::recount() -{ - // 重新统计根节点 - if (m_parent == nullptr) { - quint64 size = 0; - uint amount = 0; - m_isAnyChildSelected = false; - - // 仅计算被选中且已经被展示的项目 - foreach (auto item, m_childItems) { - if (!item) { - continue; - } - item->recountItems(&size, &amount); - } - - // 将结果写入控件并记录总大小 - QString filesize = fileSizeToString(size); - m_totalSize = size; - m_totalAmount = amount; - - Q_EMIT setScanResult(m_totalAmount, filesize); - - // 通知主界面,本项目计数完成 - Q_EMIT recounted(); - } -} - -void TrashCleanItem::recountRemainItems(quint64 *size, uint *amount) -{ - // 仅处理根项与父项,不处理子项或无子项的父项 - if (0 == m_childItems.size()) { - return; - } - - // 统计项目下所有项目大小,如果为0,将本项目设置为 已选中-且不可勾选 - // 无论是否选中,都加入统计 - foreach (auto const child, m_childItems) { - if (!child) { - continue; - } - *size += child->totalFileSize(); - *amount += child->totalFileAmount(); - } -} - -// 由根结点通知主界面,更新主界面上,当前正在扫描的文件名 -// 触发主界面进度条重新设值 -void TrashCleanItem::noticeUIFileName(const QString &filePath) -{ - if (m_parent == nullptr) { - Q_EMIT noticeFileName(filePath); - } -} - -void TrashCleanItem::NoticeUICleanedApp(const QString &pkgName) -{ - if (m_parent == nullptr && !pkgName.isEmpty()) { - Q_EMIT noticeAppName(pkgName); - } -} - -void TrashCleanItem::NoticeUIRemoveFiles(const QStringList &paths) -{ - // 只在根项目上进行信号发送 - if (m_parent == nullptr) { - Q_EMIT deleteUserFiles(paths); - } -} - -void TrashCleanItem::setZeroSizeForStoppedItem() -{ - m_totalSize = 0; - m_totalAmount = 0; - m_itemsize = 0; - m_itemAmount = 0; - Q_EMIT setScanResult(0, fileSizeToString(0)); - foreach (auto &child, m_childItems) { - if (child) { - child->setZeroSizeForStoppedItem(); - } - } -} - -void TrashCleanItem::setItemUncheckable() -{ - setSelected(false); - m_unCheckable = true; - Q_EMIT setUncheckable(); - - foreach (auto item, m_childItems) { - if (item) { - item->setSelected(false); - item->setItemUncheckable(); - } - } -} - -// 主界面通知,将扫描的内容展示在主界面上 -void TrashCleanItem::showScanResult() -{ - if (m_isToStop || !m_isChecked) { - if (m_isToStop) { - // 被中止的项目现在给一个"0"大小 - setZeroSizeForStoppedItem(); - setItemUncheckable(); - } - - resetData(); - return; - } - - // 通知检查项界面开始显示检查结果 - Q_EMIT scanStarted(true); - - // 该项目已经展示在主界面上,将被计入累计文件大小 - m_isShown = true; - m_totalSize = 0; - m_totalAmount = 0; - m_itemsize = 0; - m_itemAmount = 0; - - m_cleanedSize = 0; - m_cleanedAmount = 0; - // 取得检查项路径名称 - // 递归到根结点,取得完整检查路径 - QString path = m_title; - TrashCleanItem *parent = m_parent; - while (parent != nullptr) { - path = parent->title() + "/" + path; - parent = parent->m_parent; - } - - foreach (const auto &file, m_deletePaths) { - // 通知界面当前扫描文件的名称 - // 没有必要频繁刷新,降低标题内容刷新频率 - // 控制结果展示时长 - m_itemAmount++; - // 重新统计文件大小,在扫描中止时提供实时的大小 - QFileInfo info(file); - if (info.exists()) { - if (info.isFile()) { - m_itemsize += static_cast(info.size()); - } - } - - if (m_itemAmount % PROGRESS_NOTICE_INTERVAL == 0) { - // 用户体验相关,延长进度条显示时间 - // 如果有性能优化需要,可以减少此处延时或取消 - // 延时值为5时,展示9000个文件花费约2秒 - QThread::msleep(SHOWDELAY); - QApplication::processEvents(); - if (m_isToStop || !m_isChecked) { - // 检查项扫描中被结束,不做特别处理 - break; - } - findRootItem()->noticeUIFileName(path + QString("/") + info.fileName()); - } - } - - // 控制每一个子项展示结果 - foreach (auto item, m_childItems) { - QApplication::processEvents(); - if (!item) { - continue; - } - - if (m_isToStop) { - Q_EMIT scanStarted(false); - item->setZeroSizeForStoppedItem(); - item->setItemUncheckable(); - continue; - } - - item->showScanResult(); - m_totalSize += item->itemFileSize(); - m_totalAmount += item->itemFileAmount(); - } - - // 展示完成,通知界面隐藏spinner,改变说明标签内容 - Q_EMIT scanStarted(false); - - m_totalSize += m_itemsize; - m_totalAmount += m_itemAmount; - - // 这里重设本次清理删除的文件列表,仅被扫描的文件可以清理 - m_deletePaths = m_deletePaths.mid(0, static_cast(m_itemAmount)); - findRootItem()->recount(); - - QString filesize = fileSizeToString(m_totalSize); - if (0 == m_totalSize) { - setItemUncheckable(); - } - - // 根结点的信息在recount时设置 - if (nullptr != m_parent) { - Q_EMIT setScanResult(m_totalAmount, filesize); - } - - // 根结点,且被选中时,发送展示完成信号 - if (nullptr == m_parent) { - if (m_isChecked || m_unCheckable) { - Q_EMIT showScanResultFinished(); - } - } -} - -// 扫描指定的文件列表,获取总数量与大小 -// 此处的统计将提供总文件数以设置主界面进度条 -void TrashCleanItem::startScan() -{ - if (!m_isChecked) { - return; - } - - foreach (auto item, m_childItems) { - if (!item) { - continue; - } - item->startScan(); - } - - if (m_parent == nullptr) { - m_unCheckable = false; - scan(); - Q_EMIT scanFinished(); - } -} - -// 主界面要求停止展示扫描结果 -void TrashCleanItem::stopShowResult() -{ - m_isToStop = true; - foreach (auto item, m_childItems) { - if (!item) { - continue; - } - item->stopShowResult(); - } -} - -// 准备开始扫描,清空上一次扫描结果 -// 重置标志位 -void TrashCleanItem::prepare() -{ - // 避免上一次扫描数据的遗留 - resetData(); - - foreach (auto item, m_childItems) { - if (!item) { - continue; - } - item->prepare(); - } - - Q_EMIT prepareWidget(); -} - -// 实例化本结点依赖的窗口 -void TrashCleanItem::initItemWidget() -{ - m_itemWidget = new CleanerResultItemWidget(); - if (m_parent != nullptr) { - // 跟随根项目的窗口变化选中或未选中状态 - m_itemWidget->setRoot(findRootItem()->itemWidget()); - m_parent->addChild(this); - } else { - // 如果父窗口为空,设置本窗口为根检查项的样式 - m_itemWidget->setAsRoot(); - } - - // UI整改,右侧对齐,子项目减少长度 - if (m_parent != nullptr && m_parent->m_parent != nullptr) { - m_itemWidget->setAsChild(); - } - - // 通知窗口清空内容,隐藏控件以准备新的扫描 - connect(this, &TrashCleanItem::prepareWidget, m_itemWidget, &CleanerResultItemWidget::prepare); - // 通知窗口开始或停止展示 - connect(this, - &TrashCleanItem::scanStarted, - m_itemWidget, - &CleanerResultItemWidget::setWorkStarted); - // 将结果显示在依赖窗口下 - connect(this, - &TrashCleanItem::setScanResult, - m_itemWidget, - &CleanerResultItemWidget::setScanResult); - // 同步是否选中 - connect(this, - &TrashCleanItem::setWidgetItemSelected, - m_itemWidget, - &CleanerResultItemWidget::setCheckBoxStatus); - // 设置检查项已经被清理 - connect(this, - &TrashCleanItem::setCleanDone, - m_itemWidget, - &CleanerResultItemWidget::setCleanDone); - // 子项已完成清理或没有被扫描时,设置为不可选中的状态 - connect(this, - &TrashCleanItem::setUncheckable, - m_itemWidget, - &CleanerResultItemWidget::setUncheckable); - - // 涉及到根选项的状态变化 - // 子项被选中时,让根项被选中 - // 根项被点击时,让所有子项选中、反选 - connect(m_itemWidget, - &CleanerResultItemWidget::rootClicked, - this, - &TrashCleanItem::setChildSelected); - connect(m_itemWidget, - &CleanerResultItemWidget::childClicked, - this, - &TrashCleanItem::stageChanged); -} diff --git a/deepin-pc-manager/src/window/modules/cleaner/trashcleanitem.h b/deepin-pc-manager/src/window/modules/cleaner/trashcleanitem.h deleted file mode 100644 index cfd47f2..0000000 --- a/deepin-pc-manager/src/window/modules/cleaner/trashcleanitem.h +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (C) 2019 ~ 2020 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include "src/window/namespace.h" - -#include -#include - -// 控制向主界面通知文件扫描的间隔,同步主界面上的进度条与文件名 -// 每50个文件同步一次 -#define PROGRESS_NOTICE_INTERVAL 50 - -class CleanerResultItemWidget; - -// 一组被归类的,待扫描和清理的文件 -class TrashCleanItem : public QObject -{ - Q_OBJECT - -public: - // 将文件大小由BYTE转换为KB MB GB,最多保留两位小数 - static QString fileSizeToString(quint64 filesize); - -public: - // parent为空时作为根结点 - explicit TrashCleanItem(TrashCleanItem *parentItem = nullptr); - ~TrashCleanItem(); - - void setSelected(bool); - void setConfigToScan(); - - // 检查项名称与提示 - void setTitle(const QString &); - void setTip(const QString &); - // 本项检查需要扫描的文件路径 - void setFilePaths(const QList &); - - void setPkgName(const QString &); - - // 子检查项操作 - // 增加一个子项 - void addChild(TrashCleanItem *); - // 删除指定子项 - void removeChild(TrashCleanItem *); - // 删除所有子项 - void removeChildren(); - - // 接受界面信号,重新计算大小与数目 - void recountItems(quint64 *size, uint *account); - void recount(); - void recountRemainItems(quint64 *size, uint *amount); - - void setZeroSizeForStoppedItem(); - void setItemUncheckable(); - - // 由根结点通知主界面,触发主界面刷新显示扫描的文件名和进度条 - void noticeUIFileName(const QString &); - // 由根结点通知主界面,后台服务删除指定文件 - void NoticeUIRemoveFiles(const QStringList &); - // 由根结点通知主界面,删除已清理的卸载应用数据库信息 - void NoticeUICleanedApp(const QString &); - - // 用于展示结果和控制的界面 - inline CleanerResultItemWidget *itemWidget() const { return m_itemWidget; } - - inline TrashCleanItem *parent() const { return m_parent; } - - // 本项下,包括所有子项的文件数量与大小 - inline quint64 totalFileSize() const { return m_totalSize; } - - inline uint totalFileAmount() const { return m_totalAmount; } - - // 本项下,不包括子项的文件数量与大小 - inline quint64 itemFileSize() const { return m_itemsize; } - - inline uint itemFileAmount() const { return m_itemAmount; } - - // 检查项标题,用于拼凑显示检查文件路径 - inline QString title() const { return m_title; } - - // 不保存成员变量,直接由方法调用获得状态 - inline bool isSelected() { return m_isChecked; } - - inline uint isShown() const { return m_isShown; } - - inline quint64 cleanedSize() const { return m_cleanedSize; } - - inline int cleanedAmount() const { return m_cleanedAmount; } - -public slots: - // 主界面通知,准备开始扫描,清空所有已经存储的数据 - void prepare(); - // 主界面通知, 开始实际的扫描工作并记录相关数据 - void startScan(); - // 主界面通知,各根扫描项开始展示扫描结果 - void showScanResult(); - // 主界面通知,中止扫描结果展示 - void stopShowResult(); - void setChildSelected(bool); - void stageChanged(bool); - // 清理文件 - void clean(); - -signals: - // 根结点被选中,将所有子结点设置为选中状态 - void rootSelected(bool); - void scanFinished(); - void showScanResultFinished(); - void noticeFileName(const QString &); - void noticeAppName(const QString &); - void recounted(); - // 控制展示界面变化状态 - void scanStarted(bool); - void prepareWidget(); - // 将扫描结果写到展示界面上 - void setScanResult(uint, QString); - void cleanFinished(); - void deleteSystemFiles(QStringList); - void deleteUserFiles(const QStringList &); - void setWidgetItemSelected(bool); - void setCleanDone(); - void setUncheckable(); - -private: - void initItemWidget(); - void scanFile(const QString &path); - TrashCleanItem *findRootItem(); - void recountItems(qint64 size, uint account); - void scan(); - void resetData(); - void increaseCleanedItemInfo(quint64, int); - -private: - QString m_title; // 显示在树上的检查标题 - QString m_tip; // 显示在树上的提示信息 - QString m_pkgName; // 应用包名,清理卸载时删除数据库记录 - bool m_isToStop; // 停止检查信号 - bool m_isShown; // 该项已经在界面上显示 - quint64 m_totalSize; // 本项检查记录的总文件大小 - uint m_totalAmount; // 本项检查记录的总数,包括子项检查 - quint64 m_itemsize; // 本项检查记录的单项文件大小 - uint m_itemAmount; // 不包括子项检查的文件数 - quint64 m_cleanedSize; // 已清理文件的大小 - int m_cleanedAmount; // 已清理的文件数理 - QString m_itemName; // 本项检查的名称 - QStringList m_scanPaths; // 依照类型分类检查,不需要记录具体文件 - TrashCleanItem *m_parent; // 父检查项,没有设为nullPtr - QList m_childItems; // 下一级检查项 - CleanerResultItemWidget *m_itemWidget; // 对应的UI - QStringList m_fileList; // 记录扫描过的文件名 - QStringList m_deletePaths; // 记录待删除和文件名 - TrashCleanItem *m_root; // 根结点位置 - bool m_isChecked; // 本项是否被选中 - bool m_isAnyChildSelected; // 检查根项下,是否某个子项被选中 - bool m_unCheckable; // 某些项因为大小为0或已被清理,不再响应选中 -}; diff --git a/deepin-pc-manager/src/window/modules/cleaner/trashcleanwidget.cpp b/deepin-pc-manager/src/window/modules/cleaner/trashcleanwidget.cpp deleted file mode 100644 index 0dd5ee1..0000000 --- a/deepin-pc-manager/src/window/modules/cleaner/trashcleanwidget.cpp +++ /dev/null @@ -1,1239 +0,0 @@ -// Copyright (C) 2019 ~ 2020 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "trashcleanwidget.h" - -#include "cleanerdbusadaptorinterface.h" -#include "dtkwidget_global.h" -#include "src/widgets/cleaneritem.h" -#include "src/widgets/titlelabel.h" -#include "src/window/modules/common/common.h" -#include "src/window/modules/common/compixmap.h" -#include "src/window/modules/common/gsettingkey.h" -#include "trashcleanitem.h" -#include "trashcleanwidget.h" -#include "widgets/cleanerresultitemwidget.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define SYS_CHECK_INDEX 0 -#define APP_CHECK_INDEX 1 -#define HISTORY_CHECK_INDEX 2 -#define BROWSER_CACHE_CHECK_INDEX 3 - -#define APP_UNINSTALL_REMAIN_PATH_INDEX 0 -#define APP_CONFIG_PATH_INDEX 0 -#define APP_CACHE_PATH_INDEX 1 - -#define CONTENT_FRAME_LEFT_MARGINS 35 - -#define MAX_HEAD_TITLE_WIDTH 520 - -DWIDGET_USE_NAMESPACE - -TrashCleanWidget::TrashCleanWidget(QWidget *parent, CleanerDBusAdaptorInterface *interface) - : QWidget(parent) - , m_headerFrame(nullptr) - , m_configFrame(nullptr) - , m_resultFrame(nullptr) - , m_bottomFrame(nullptr) - , m_bottomLine(nullptr) - , m_leftButton(nullptr) - , m_rightButton(nullptr) - , m_configLogo(nullptr) - , m_headerTitle(nullptr) - , m_scanProgressBar(nullptr) - , m_tipTitle(nullptr) - , m_headerLogo(nullptr) - , m_treeWidget(nullptr) - , m_delegate(nullptr) - , m_isbScan(false) - , m_scanTime(nullptr) - , m_dataInterface(interface) - , m_isFirstShow(false) -{ - this->setAccessibleName("rightWidget_trashCleanWidget"); - - // 主题变换 改变部分图标颜色 - connect(DGuiApplicationHelper::instance(), - &DGuiApplicationHelper::themeTypeChanged, - this, - &TrashCleanWidget::setPixmapByTheme); - - // 固定窗口 - setFixedSize(QSize(732, 570)); - QVBoxLayout *mainLayout = new QVBoxLayout; - mainLayout->setContentsMargins(10, 0, 10, 10); - - // 上部分标题视图绘制 - m_headerFrame = new DFrame(this); - m_headerFrame->setAccessibleName("trashCleanWidget_topFrame"); - m_headerFrame->setLineWidth(0); - m_headerFrame->setFixedSize(QSize(710, 135)); - initHeaderFrame(); - - // 中部配置视图绘制 - m_configFrame = new DFrame(this); - m_configFrame->setAccessibleName("trashCleanWidget_centerConfigFrame"); - m_configFrame->setLineWidth(0); - m_configFrame->setFixedSize(QSize(710, 422)); - initConfigFrame(); - - // 中部结果展示绘制 - m_resultFrame = new DFrame(this); - m_resultFrame->setAccessibleName("trashCleanWidget_centerResultFrame"); - m_resultFrame->setLineWidth(0); - m_resultFrame->setFixedSize(QSize(710, 380)); - initResultFrame(); - - // 底部按键 - m_bottomFrame = new DFrame(this); - m_bottomFrame->setAccessibleName("trashCleanWidget_bottomFrame"); - m_bottomFrame->setLineWidth(0); - m_bottomFrame->setFixedSize(710, 52); - initBottomFrame(); - - // 加入主框架 - // m_configFrame 与 m_resultFrame 不会同时显示 - mainLayout->addWidget(m_headerFrame); - mainLayout->addWidget(m_configFrame); - mainLayout->addWidget(m_resultFrame); - mainLayout->addWidget(m_bottomFrame); - mainLayout->setAlignment(Qt::AlignmentFlag::AlignCenter); - setLayout(mainLayout); - - // 由onStageChanged统一处理窗口状态变化 - connect(this, &TrashCleanWidget::stageChanged, this, &TrashCleanWidget::onStageChanged); - - // 在树中插入根检查项 - addRootCheckItems(); - - foreach (auto item, m_rootItems) { - connect(this, - &TrashCleanWidget::prepare, - item, - &TrashCleanItem::prepare); // 移除上一次扫描数据 - connect(this, &TrashCleanWidget::startWork, item, &TrashCleanItem::startScan); // 开始扫描 - connect(this, - &TrashCleanWidget::showScanResult, - item, - &TrashCleanItem::showScanResult); // 扫描完成后展示结果 - connect(this, - &TrashCleanWidget::stopShowResult, - item, - &TrashCleanItem::stopShowResult); // 停止展示,响应“中止扫描” - connect(this, &TrashCleanWidget::startClean, item, &TrashCleanItem::clean); // 开始清理 - - connect(item, - &TrashCleanItem::showScanResultFinished, - this, - &TrashCleanWidget::showScanResultFinished); // 开始展示扫描结果 - connect(item, - &TrashCleanItem::scanFinished, - this, - &TrashCleanWidget::scanDone); // 根项扫描结束 - connect(item, - &TrashCleanItem::noticeFileName, - this, - &TrashCleanWidget::setScanTitleName); // 根项通知主界面当前展示的文件名称 - connect(item, &TrashCleanItem::recounted, this, &TrashCleanWidget::recount); - connect(item, &TrashCleanItem::cleanFinished, this, &TrashCleanWidget::onCleanFinished); - - // 后台服务文件删除功能 - connect(item, - &TrashCleanItem::deleteUserFiles, - this, - &TrashCleanWidget::DeleteSpecifiedFiles); - // 后台卸载应用数据库删除 - connect(item, - &TrashCleanItem::noticeAppName, - this, - &TrashCleanWidget::DeleteSpecifiedAppRecord); - } - - // 全没有选中时需要置灰左按键 - foreach (const CleanerItem *ci, m_configItem) { - connect(ci, &CleanerItem::itemClicked, this, &TrashCleanWidget::onConfigItemClicked); - } - - // 由于提供了公有查询方法,变量应当初始化 - m_totalSize = 0; - m_totalScannedFiles = 0; - m_cleanedSize = 0; - m_cleanedAmount = 0; - - // 初始化后,将主界面设为PREPARING状态 - onStageChanged(PREPARING); -} - -TrashCleanWidget::~TrashCleanWidget() -{ - foreach (auto root, m_rootItems) { - if (root) { - root->removeChildren(); - } - root->itemWidget()->deleteLater(); - } - // 注意,指针在list中以值保存,foreach操作时,会以值的形式复制给局部变量 - // 不要在foreach遍历中进行指针删除 - qDeleteAll(m_rootItems.begin(), m_rootItems.end()); - m_rootItems.clear(); -} - -void TrashCleanWidget::setServerInterface(CleanerDBusAdaptorInterface *interface) -{ - m_dataInterface = interface; -} - -void TrashCleanWidget::initHeaderFrame() -{ - QVBoxLayout *mainLayout = new QVBoxLayout; - mainLayout->setAlignment(Qt::AlignmentFlag::AlignLeft | Qt::AlignmentFlag::AlignTop); - mainLayout->setContentsMargins(CONTENT_FRAME_LEFT_MARGINS, 25, 30, 0); - mainLayout->setSpacing(5); - mainLayout->setGeometry(QRect(0, 0, 730, 135)); - - QWidget *wid = new QWidget(this); - wid->setAccessibleName("topFrame_backGroundWidget"); - wid->setFixedHeight(96); - QHBoxLayout *hlayout1 = new QHBoxLayout; - hlayout1->setContentsMargins(0, 0, 0, 0); - hlayout1->setSpacing(0); - hlayout1->setGeometry(QRect(0, 0, 640, 96)); - - // logo 图片 - m_headerLogo = new DLabel(m_headerFrame); - m_headerLogo->setAccessibleName("backGroundWidget_headerLogoLable"); - QIcon icon = QIcon::fromTheme(TRASH_CLEAN_HEADER_LOGO); - m_headerLogo->setPixmap(icon.pixmap(96, 96)); - m_headerLogo->setFixedWidth(125); - m_headerLogo->setAlignment(Qt::AlignmentFlag::AlignLeft); - m_headerLogo->setVisible(false); - hlayout1->addWidget(m_headerLogo); - - // 右侧标题 - QVBoxLayout *vLayout = new QVBoxLayout; - vLayout->setContentsMargins(0, 10, 0, 0); - vLayout->setSpacing(0); - - // 标题 - m_headerTitle = new TitleLabel(m_headerFrame); - m_headerTitle->setAccessibleName("backGroundWidget_headerTitleLable"); - m_headerTitle->setText(tr("Clean out junk files and free up disk space")); - m_headerTitle->setObjectName("headerTitle"); - QFont ft = m_headerTitle->font(); - ft.setBold(true); - m_headerTitle->setFont(ft); - - // 次标题 - m_tipTitle = new DLabel(m_headerFrame); - m_tipTitle->setAccessibleName("backGroundWidget_tipTitleLable"); - m_tipTitle->setText(tr("Start cleaning now to refresh your computer")); - m_tipTitle->setObjectName("tipTitle"); - m_tipTitle->setAlignment(Qt::AlignmentFlag::AlignLeft | Qt::AlignmentFlag::AlignVCenter); - - // 字体样式 - QPalette pal; - pal.setColor(QPalette::Text, QColor("#526A7F")); - m_tipTitle->setPalette(pal); - QFont tipFont = m_tipTitle->font(); - tipFont.setWeight(QFont::Medium); - tipFont.setPixelSize(12); - m_tipTitle->setFont(tipFont); - - // 扫描时间提示 - m_scanTime = new DLabel(m_headerFrame); - m_scanTime->setAccessibleName("backGroundWidget_scanTimeLable"); - m_scanTime->setFont(Utils::getFixFontSize(12)); - m_scanTime->setAlignment(Qt::AlignmentFlag::AlignRight | Qt::AlignmentFlag::AlignVCenter); - // 仅扫描开始后可见 - m_scanTime->setVisible(false); - - // 扫描进度条 - m_scanProgressBar = new DProgressBar(m_headerFrame); - m_scanProgressBar->setAccessibleName("backGroundWidget_scanProgressBar"); - m_scanProgressBar->setContentsMargins(0, 0, 0, 0); - m_scanProgressBar->setMinimumSize(QSize(0, 8)); - m_scanProgressBar->setMaximumSize(QSize(1000, 8)); - m_scanProgressBar->setVisible(false); - - QGridLayout *titlesLayout = new QGridLayout; - - titlesLayout->setSpacing(10); - titlesLayout->addWidget(m_headerTitle, 0, 0); - titlesLayout->addWidget(m_scanTime, 0, 1); - titlesLayout->addWidget(m_scanProgressBar, 1, 0, 1, -1); - titlesLayout->addWidget(m_tipTitle, 2, 0, 1, -1); - - vLayout->addLayout(titlesLayout); - vLayout->addStretch(); - hlayout1->addLayout(vLayout); - wid->setLayout(hlayout1); - - mainLayout->addWidget(wid); - // 添加分割线 - QFrame *line = new QFrame(this); - line->setAccessibleName("topFrame_lineFrame"); - line->setFrameShape(QFrame::HLine); - line->setFrameShadow(QFrame::Sunken); - line->setFixedWidth(640); - - mainLayout->addSpacing(15); - mainLayout->addWidget(line); - m_headerFrame->setLayout(mainLayout); - m_lastScannedSize = ""; - m_lastCleanedSize = ""; -} - -// 配置界面,包含四个配置项 -void TrashCleanWidget::initConfigFrame() -{ - // 清理的配置项 - QVBoxLayout *configLayout = new QVBoxLayout; - configLayout->setAlignment(Qt::AlignmentFlag::AlignLeft | Qt::AlignmentFlag::AlignTop); - configLayout->setContentsMargins(26, 0, 0, 0); - configLayout->setSpacing(10); - - QStringList itemNames = { - tr("System junk"), tr("Useless files created by the system"), - tr("Application junk"), tr("Unneeded files created by applications"), - tr("Traces"), tr("Activity traces of the system and applications"), - tr("Cookies"), tr("Cookies from Internet browsers") - }; - QStringList itemAccessibleNames = { "systemJunkFrame", - "appJunkFrame", - "tracesFrame", - "cookiesFrame" }; - - for (int i = 0; i < itemNames.length(); i += 2) { - CleanerItem *ci = new CleanerItem(this); - ci->setAccessibleName("centerConfigFrame_" + itemAccessibleNames.at(i / 2)); - ci->setAccessibleParentText(itemAccessibleNames.at(i / 2)); - ci->setFixedSize(QSize(330, 64)); - ci->setLevelText(itemNames.at(i)); - ci->setTipText(itemNames.at(i + 1)); - configLayout->addWidget(ci); - m_configItem.push_back(ci); - } - - for (int i = 0; i < m_configItem.size(); i++) { - m_configItem[i]->setObjectName(QString("cleanerItem%1").arg(i)); - } - - m_configItem[SYS_CHECK_INDEX]->setCheckBoxStatus(true); - m_configItem[APP_CHECK_INDEX]->setCheckBoxStatus(true); - // 因为用户信息的敏感性和便利性 - // 历史痕迹和浏览器cookies用户决定是否清理 - m_configItem[HISTORY_CHECK_INDEX]->setCheckBoxStatus(false); - m_configItem[BROWSER_CACHE_CHECK_INDEX]->setCheckBoxStatus(false); - - // 右侧大图标 - QVBoxLayout *vLayout = new QVBoxLayout; - vLayout->setAlignment(Qt::AlignmentFlag::AlignRight); - m_configLogo = new DLabel(m_configFrame); - m_configLogo->setAccessibleName("centerConfigFrame_configLogoLable"); - m_configLogo->setAlignment(Qt::AlignmentFlag::AlignRight); - m_configLogo->setGeometry(405, 0, 300, 300); - - // 跟随系统主题设置 - if (DGuiApplicationHelper::instance()->themeType() - == DGuiApplicationHelper::ColorType::LightType) { - m_configLogo->setPixmap( - QIcon::fromTheme(TRASH_CLEAN_CONFIG_BIG_LOGO_LIGHT).pixmap(300, 300)); - } else { - m_configLogo->setPixmap( - QIcon::fromTheme(TRASH_CLEAN_CONFIG_BIG_LOGO_DARK).pixmap(300, 300)); - } - - vLayout->addWidget(m_configLogo); - - QHBoxLayout *mainLayout = new QHBoxLayout; - mainLayout->insertLayout(0, configLayout); - mainLayout->insertLayout(1, vLayout); - m_configFrame->setLayout(mainLayout); -} - -void TrashCleanWidget::initResultFrame() -{ - QVBoxLayout *mainLayout = new QVBoxLayout; - mainLayout->setContentsMargins(CONTENT_FRAME_LEFT_MARGINS, 0, 0, 5); - - m_treeWidget = new DTreeWidget(this); - m_treeWidget->setAccessibleName("centerResultFrame_treeWidget"); - m_treeWidget->setFixedWidth(640); - m_treeWidget->setFrameShape(QFrame::NoFrame); - m_treeWidget->setIndentation(16); - m_treeWidget->setSelectionMode(QAbstractItemView::SelectionMode::NoSelection); - m_treeWidget->setBackgroundRole(QPalette::Window); - m_treeWidget->setHeaderHidden(true); - m_treeWidget->setColumnCount(1); - m_treeWidget->setFocusPolicy(Qt::NoFocus); - m_delegate = new MyItemDelegateTree(this); - m_treeWidget->setItemDelegate(m_delegate); - - QStringList strList; - strList << "treeWidget_headerLable"; - m_treeWidget->setHeaderLabels(strList); - m_treeWidget->setContentsMargins(0, 0, 0, 0); - mainLayout->addWidget(m_treeWidget); - - m_resultFrame->setLayout(mainLayout); - m_resultFrame->setBackgroundRole(DPalette::NoType); -} - -void TrashCleanWidget::initBottomFrame() -{ - QVBoxLayout *mainLayout = new QVBoxLayout; - mainLayout->setContentsMargins(CONTENT_FRAME_LEFT_MARGINS, 0, 0, 0); - - // 添加下部分割线 - m_bottomLine = new DFrame(this); - m_bottomLine->setAccessibleName("bottomFrame_lineFrame"); - m_bottomLine->setFrameShape(QFrame::HLine); - m_bottomLine->setFrameShadow(QFrame::Sunken); - m_bottomLine->setFixedWidth(640); - m_bottomLine->setVisible(false); - mainLayout->addWidget(m_bottomLine); - - QHBoxLayout *layout = new QHBoxLayout; - layout->setAlignment(Qt::AlignmentFlag::AlignLeft | Qt::AlignmentFlag::AlignBottom); - layout->setSpacing(20); - layout->setContentsMargins(0, 0, 0, 5); - - m_leftButton = new DPushButton(this); - m_leftButton->setFont(Utils::getFixFontSize(14)); - m_leftButton->setAccessibleName("bottomFrame_leftButton"); - m_leftButton->setObjectName("leftButton"); - m_leftButton->setFixedSize(QSize(160, 40)); - m_leftButton->setText(tr("Scan Now")); - - // 右按键背景色 - m_rightButton = new DSuggestButton(this); - m_rightButton->setFont(Utils::getFixFontSize(14)); - m_rightButton->setAccessibleName("bottomFrame_rightButton"); - m_rightButton->setObjectName("rightButton"); - m_rightButton->setFixedSize(QSize(160, 40)); - m_rightButton->setText(tr("Scan Now")); - m_rightButton->setVisible(false); - - layout->addWidget(m_leftButton); - layout->addWidget(m_rightButton); - - mainLayout->addLayout(layout); - - m_bottomFrame->setLayout(mainLayout); - - // 下部左按键和右按键分开处理 - // 左按键为扫描功能相关,右按键为清理相关 - connect(m_leftButton, &QPushButton::clicked, this, &TrashCleanWidget::changeStageByLeftButton); - connect(m_rightButton, - &QPushButton::clicked, - this, - &TrashCleanWidget::changeStageByRightButton); -} - -// 在界面上添加固定的根检查项 -void TrashCleanWidget::addRootCheckItems() -{ - // 添加根项检查点 - // 根项只有标题,没有说明 - QStringList itemlist = { tr("System junk"), - tr("Application junk"), - tr("Traces"), - tr("Cookies") }; - foreach (auto item, itemlist) { - TrashCleanItem *trash = new TrashCleanItem(nullptr); - trash->setTitle(item); - m_rootItems.push_back(trash); - QTreeWidgetItem *treeItem = new QTreeWidgetItem(m_treeWidget); - treeItem->setData(0, Qt::DisplayRole, "treeWidget_rootItem"); - treeItem->setHidden(true); - m_treeWidget->setItemWidget(treeItem, 0, trash->itemWidget()); - } -} - -// 为所有根检查项添加子项检查 -void TrashCleanWidget::addChildrenCheckItems() -{ - if (!m_dataInterface) { - return; - } - getScanPathsFromDataInterface(); - - // 系统扫描项为固定目录 - // 垃圾箱 - addChildItem(SYS_CHECK_INDEX, - tr("Trash"), - tr("Make sure all files in the trash can be deleted"), - m_trashInfoList); - // 系统缓存 - addChildItem(SYS_CHECK_INDEX, - tr("System caches"), - tr("Caches created by the system"), - m_cacheInfoLIst); - // 系统日志 - addChildItem(SYS_CHECK_INDEX, - tr("System logs"), - tr("Log files created by the system"), - m_logInfoList); - - // 痕迹扫描项为固定目录 - addChildItem(HISTORY_CHECK_INDEX, - tr("System and Application traces"), - tr(""), - m_historyInfoList); - - // 根据服务返回清单,建立应用扫描项 - addAppCheckItems(); - - // 浏览器cookies扫描项 - addBrowserCookies(); -} - -// 服务返回JSON文件在这里处理,收集文件信息 -// 待重构 -// 服务返回改为结构体,更有效率 -void TrashCleanWidget::addAppCheckItems() -{ - if (!m_dataInterface) { - return; - } - - QJsonParseError err; - // 读app.json获取名称和路径信息 - QJsonObject object = QJsonDocument::fromJson(m_appJsonStr.toUtf8(), &err).object(); - // 文件错误检查 - if (QJsonParseError::NoError != err.error) { - qDebug() << "failed to parse JSON content when addAppCheckItems"; - return; - } - - QJsonArray appArr = object[CLEANER_APP_JSON_NAME].toArray(); - // 从后台服务传递的JSON中取出对应路径并设置给子检查项 - foreach (auto app, appArr) { - QStringList configPaths; - QStringList cachePaths; - QList paths; - foreach (auto item, app[CLEANER_APP_CONFIG_PATH].toArray()) { - configPaths.append(item.toString()); - } - foreach (auto item, app[CLEANER_APP_CACHE_PATH].toArray()) { - cachePaths.append(item.toString()); - } - paths.append(configPaths); - paths.append(cachePaths); - - // 应用的缷载标志 - bool isInstalled = app[CLEANER_APP_INSTALL_FLAG].toBool(); - QString pkgName = app[CLEANER_APP_COM_NAME].toString(); - addChildItem(APP_CHECK_INDEX, - app[CLEANER_APP_NAME].toString(), - pkgName, - QString(""), - paths, - isInstalled); - } -} - -void TrashCleanWidget::addBrowserCookies() -{ - if (!m_dataInterface) { - return; - } - - QJsonParseError err; - // 读app.json获取名称和路径信息 - QJsonObject object = QJsonDocument::fromJson(m_cookiesJsonStr.toUtf8(), &err).object(); - // 文件错误检查 - if (QJsonParseError::NoError != err.error) { - qDebug() << "failed to parse JSON content when addBrowserCookies"; - return; - } - - QJsonArray appArr = object[CLEANER_BROWSER_JSON_NAME].toArray(); - foreach (auto app, appArr) { - QStringList paths; - foreach (auto item, app[CLEANER_BROWSER_COOKIES_PATH].toArray()) { - paths.append(item.toString()); - } - addChildItem(BROWSER_CACHE_CHECK_INDEX, app[CLEANER_APP_NAME].toString(), tr(""), paths); - } -} - -// 将子项检查内容添加到根项 -// 根据需求如果子项大小为0则不显示子项 -// 这里根据文件数实现,如果文件数为0,即大小为0 -void TrashCleanWidget::addChildItem(int rootIndex, - const QString &title, - const QString &pkgName, - const QString &tip, - const QList &paths, - bool isInstalled) -{ - if (rootIndex >= m_rootItems.size() || rootIndex < 0) - return; - - // 构建应用上级检查项 - // 上级结点是逻辑结点,不要设置扫描路径 - TrashCleanItem *item = new TrashCleanItem(m_rootItems[rootIndex]); - - TrashCleanItem *childItem = nullptr; - // 构建次级检查项 - // 判断是否应用已经卸载 - if (isInstalled) { - if (!paths[APP_CACHE_PATH_INDEX].isEmpty()) { - childItem = new TrashCleanItem(item); - childItem->setTitle(tr("Cache and log files")); - childItem->setFilePaths(paths[APP_CACHE_PATH_INDEX]); - } - } else { - // 构建卸载应用残留 - QStringList filePath(paths[APP_CACHE_PATH_INDEX]); - filePath.append(paths[APP_CONFIG_PATH_INDEX]); - if (!filePath.isEmpty()) { - childItem = new TrashCleanItem(item); - childItem->setPkgName(pkgName); - childItem->setTitle(tr("Residual files")); - childItem->setFilePaths(filePath); - } - } - - // TrashCleanItem类中,UI在构造时产生,因此只能从上至下的形式构造树 - // 如果是卸载项目,在子项目为空的情况下,不需要构建上级扫描项,此处将父项从根项中删除 - if (!childItem && !isInstalled) { - m_rootItems[rootIndex]->removeChild(item); - if (item) { - delete item; - item = nullptr; - } - return; - } - - // 父项达成存在条件时设置父项属性并建立界面 - // 1.应用没有被缷载 - // 2.应用被缷载,且存在残留内容 - item->setObjectName(title); - item->setTitle(title); - item->setTip(tip.toUtf8()); - QTreeWidgetItem *itemWidget = new QTreeWidgetItem(); - itemWidget->setData(0, Qt::DisplayRole, "treeWidget_childItem"); - m_treeWidget->topLevelItem(rootIndex)->addChild(itemWidget); - m_treeWidget->setItemWidget(itemWidget, 0, item->itemWidget()); - - // 次级项存在内容时建立界面 - if (childItem) { - QTreeWidgetItem *childWidget = new QTreeWidgetItem; - childWidget->setData(0, Qt::DisplayRole, "treeWidget_childItem"); - itemWidget->addChild(childWidget); - m_treeWidget->setItemWidget(childWidget, 0, childItem->itemWidget()); - } else { - // 次级不存在时,插入一个空的对象以标识父项的身份 - item->addChild(nullptr); - } -} - -void TrashCleanWidget::addChildItem(int rootIndex, - const QString &title, - const QString &tip, - const QStringList &paths) -{ - if (rootIndex >= m_rootItems.size() || rootIndex < 0) - return; - TrashCleanItem *item = new TrashCleanItem(m_rootItems[rootIndex]); - item->setObjectName(title); - item->setTitle(title); - item->setTip(tip.toUtf8()); - item->setFilePaths(paths); - QTreeWidgetItem *itemWidget = new QTreeWidgetItem(); - itemWidget->setData(0, Qt::DisplayRole, "treeWidget_childItem"); - m_treeWidget->topLevelItem(rootIndex)->addChild(itemWidget); - m_treeWidget->setItemWidget(itemWidget, 0, item->itemWidget()); -} - -// 待重构 -// 控制内容重写为函数 -void TrashCleanWidget::onStageChanged(ScanStages stage) -{ - m_stage = stage; - switch (m_stage) { - case SCAN_STARTED: - setWidgetScanStart(); - break; - case SCAN_FINISHED: - setWidgetScanFinish(); - break; - case PREPARING: - m_isbScan = true; - setWidgetPrepare(); - break; - case CLEAN_STARTED: - setWidgetCleanStart(); - break; - case CLEAN_FINISHED: - setWidgetCleanFinish(); - break; - } -} - -// 左按键引发的状态变化 -void TrashCleanWidget::changeStageByLeftButton() -{ - m_scanTime->setVisible(false); - // m_state为当前状态 - // 开始进入下一状态 - switch (m_stage) { - // 由配置界面,开始扫描 - case PREPARING: - m_isbScan = true; - Q_EMIT stageChanged(SCAN_STARTED); - break; - // 扫描过程中要求中止 - case SCAN_STARTED: - Q_EMIT stopShowResult(); - Q_EMIT stageChanged(SCAN_FINISHED); - break; - // 扫描完成要求返回到配置页 - case SCAN_FINISHED: - Q_EMIT stageChanged(PREPARING); - break; - // 清理过程中要求中止 - case CLEAN_STARTED: - Q_EMIT stageChanged(CLEAN_FINISHED); - break; - // 清理结束后返回配置界面 - case CLEAN_FINISHED: - m_isbScan = true; - Q_EMIT stageChanged(SCAN_STARTED); - break; - } -} - -// 右按键引发的状态变化 -void TrashCleanWidget::changeStageByRightButton() -{ - m_scanTime->setVisible(false); - // m_state为当前状态 - // 开始进入下一状态 - switch (m_stage) { - // 扫描结束时,按下开始进行清理 - case SCAN_FINISHED: - if (m_rootItems[0]->isSelected() || m_rootItems[1]->isSelected() - || m_rootItems[2]->isSelected() || m_rootItems[3]->isSelected()) { - Q_EMIT stageChanged(CLEAN_STARTED); - } - break; - // 清理结束时,按下返回到配置界面 - case CLEAN_FINISHED: - Q_EMIT stageChanged(PREPARING); - break; - default: - break; - } -} - -// 需要顺序执行 -void TrashCleanWidget::startScan() -{ - // 启动扫描 - // 获取所有项目的文件列表和大小数据 - - // 待重构 - // 将扫描功能移动到后端服务 - - Q_EMIT startWork(); -} - -void TrashCleanWidget::scanDone() -{ - // 扫描并获得全部文件数量 - m_doneItems--; - if (m_doneItems == 0) { - int totalAmount = 0; - foreach (auto item, m_rootItems) { - if (item->isSelected()) { - totalAmount += item->totalFileAmount(); - } - } - m_scanProgressBar->setRange(0, totalAmount); - - // 开始延时显示扫描结果 - m_totalSize = 0; - Q_EMIT showScanResult(); - } -} - -QString TrashCleanWidget::getElidedScanTitle(const QString &fileName) const -{ - QString info = tr("Scanning: %1").arg(fileName); - QFontMetrics tipFontmet(m_tipTitle->font()); - - return tipFontmet.elidedText(info, Qt::TextElideMode::ElideMiddle, 480); -} - -// 接收工作线程发送的信号,以同步标题上的扫描文件名 -// 展示当前扫描进度 -void TrashCleanWidget::setScanTitleName(QString fileName) -{ - if (!m_leftButton->isEnabled()) { - m_leftButton->setDisabled(false); - } - m_tipTitle->setText(getElidedScanTitle(fileName)); - - m_currentScanProgressValue += PROGRESS_NOTICE_INTERVAL; - m_scanProgressBar->setValue(m_currentScanProgressValue); -} - -// 根检查项通知过程结束 -void TrashCleanWidget::showScanResultFinished() -{ - if (!m_leftButton->isEnabled()) { - m_leftButton->setDisabled(false); - } - m_showItems--; - if (m_showItems == 0) { - stageChanged(SCAN_FINISHED); - } -} - -// 因界面变动要求重新统计总计文件大小 -void TrashCleanWidget::recount() -{ - if (PREPARING == m_stage) { - // 在PREPARING状态下不响应检查项的recount信号 - return; - } - - quint64 fileSize = 0; - int fileAmount = 0; - - foreach (auto item, m_rootItems) { - if (!item->isSelected() || !item->isShown()) { - continue; - } - fileSize += item->totalFileSize(); - fileAmount += item->totalFileAmount(); - } - - // recount结果会根据项目选中变化,此处应使用qMax统计 - m_totalSize = qMax(m_totalSize, fileSize); - m_totalScannedFiles = qMax(m_totalScannedFiles, fileAmount); - m_lastScannedSize = TrashCleanItem::fileSizeToString(m_totalSize); - - if (SCAN_FINISHED == m_stage || SCAN_STARTED == m_stage) { - m_scanResultStr = tr("%1 junk files, %2 selected") - .arg(m_lastScannedSize) - .arg(TrashCleanItem::fileSizeToString(fileSize)); - setHeadTextWithElidedText(m_scanResultStr); - m_tipTitle->setText(tr("Scanned: %1 files").arg(m_totalScannedFiles)); - } - - // 如果在清理前之选择了部分项目 - // 清理完成后选择另外部分项目,则重新回到清理开始状态 - // 根据重新计算的总大小判断是否回退状态到清理完成 - if (CLEAN_FINISHED == m_stage && fileSize) { - onStageChanged(SCAN_FINISHED); - return; - } - - if (SCAN_FINISHED == m_stage && !fileSize && !m_isFirstShow) { - onStageChanged(CLEAN_FINISHED); - return; - } -} - -// 通知扫描线程,中断扫描过程 -void TrashCleanWidget::stopScan() -{ - onStageChanged(SCAN_FINISHED); -} - -void TrashCleanWidget::setWidgetPrepare() -{ - // 回到配置界面,清空历史数据 - // 隐藏检查树 - // 隐藏右按键 - m_resultFrame->setVisible(false); - m_configFrame->setVisible(true); - m_headerLogo->setVisible(false); - m_scanProgressBar->setVisible(false); - m_leftButton->setText(tr("Scan Now")); - m_rightButton->setVisible(false); - m_configLogo->setVisible(true); - m_isCleaned = false; - m_bottomLine->setVisible(false); - - // 隐藏扫描计时 - m_scanTime->setVisible(false); - - // 由gsetting取上一次清理结果 - // 如果不为空,说明存在上一次清理 - // 将其写上界面 - if (m_dataInterface) { - m_lastCleanedSize = m_dataInterface->GetValueFromeGSettings(CLEANER_LAST_TIME_CLEANED); - } - if (!m_lastCleanedSize.isEmpty()) { - m_tipTitle->setText(tr("Last clean: %1").arg(m_lastCleanedSize)); - } else { - m_tipTitle->setText(tr("Start cleaning now to refresh your computer")); - } - m_headerTitle->setText(tr("Clean out junk files and free up disk space")); - Q_EMIT prepare(); -} - -void TrashCleanWidget::setWidgetScanStart() -{ - // 开始扫描 - // 显示header上logo - // 显示进度条 - // 隐藏所有的配置项与配置区logo - // 显示树结构 - // 显示“正在扫描”旋转 - // 左按键重命名“取消扫描” - m_doneItems = 0; - m_totalSize = 0; - m_totalScannedFiles = 0; - m_showItems = 0; - m_currentScanProgressValue = 0; - // 有可能在scanfinish时将按键设为disable - // 此处还原 - m_rightButton->setDisabled(false); - - int i = 0; - int hiddens = 0; - - foreach (auto item, m_configItem) { - if (item->getCheckBoxStatus()) { - // 开始显示选中的根项和子项窗口 - m_treeWidget->topLevelItem(i)->setHidden(false); - // 默认将项目设为选中状态 - m_rootItems[i]->setConfigToScan(); - Q_EMIT m_rootItems[i]->scanStarted(true); - - m_doneItems++; - m_showItems++; - } else { - // 隐藏未选中的检查项 - hiddens++; - m_treeWidget->topLevelItem(i)->setHidden(true); - m_rootItems[i]->setSelected(false); - } - i++; - } - m_treeWidget->collapseAll(); - - // 选中了配置项,可以开始扫描 - if (hiddens < m_rootItems.size()) { - m_configFrame->setVisible(false); - m_leftButton->setDisabled(true); - m_headerLogo->setVisible(true); - m_tipTitle->setText(tr("Initializing")); - m_scanProgressBar->setVisible(true); - m_resultFrame->setVisible(true); - m_leftButton->setText(tr("Cancel", "button")); - m_rightButton->setVisible(false); - m_bottomLine->setVisible(true); - - // 扫描计时 - // 扫描计时初始化 - m_scanTime->setText(tr("Time elapsed %1:%2:%3").arg("00").arg("00").arg("00")); - m_scanTime->setVisible(true); - - QTimer scanTimer; - QDateTime currentTime = QDateTime::currentDateTime(); - connect(&scanTimer, &QTimer::timeout, this, [=] { - QDateTime duration = - QDateTime::fromSecsSinceEpoch(QDateTime::currentDateTime().toSecsSinceEpoch() - - currentTime.toSecsSinceEpoch()) - .toUTC(); - // 格式来自于需求,可能是翻译要求 - m_scanTime->setText(tr("Time elapsed %1:%2:%3") - .arg(duration.toString("hh")) - .arg(duration.toString("mm")) - .arg(duration.toString("ss"))); - }); - scanTimer.start(1000); - - m_isCleaned = false; - foreach (auto rootItem, m_rootItems) { - if (rootItem) { - rootItem->removeChildren(); - } - } - - // 从树上移除所有子项目,等待重新插入 - QList childrenItem = - m_treeWidget->topLevelItem(SYS_CHECK_INDEX)->takeChildren(); - childrenItem.append(m_treeWidget->topLevelItem(APP_CHECK_INDEX)->takeChildren()); - childrenItem.append(m_treeWidget->topLevelItem(HISTORY_CHECK_INDEX)->takeChildren()); - childrenItem.append(m_treeWidget->topLevelItem(BROWSER_CACHE_CHECK_INDEX)->takeChildren()); - qDeleteAll(childrenItem.begin(), childrenItem.end()); - childrenItem.clear(); - - m_scanProgressBar->setValue(0); - - // 插入所有子项目 - // 增加调用deb文件相关接口后,有明显的延时 - addChildrenCheckItems(); - - // 仅扩展树的最顶级检查项 - // 在“应用”相关的检查项时,就只会显示到应用名称 - // 如果客户需要详细信息,再双击点开 - // 否则会因内容过多,列表太长,影响体验 - m_treeWidget->expandToDepth(0); - - m_isFirstShow = true; - m_cleanedSize = 0; - m_cleanedAmount = 0; - - Q_EMIT prepare(); - Q_EMIT startWork(); - } else { - onStageChanged(PREPARING); - } -} - -void TrashCleanWidget::setWidgetScanFinish() -{ - // 取消扫描 - // 显示扫描完成页面 - // 左按键重命名为“返回” - // 显示右按键,命名“立即清理” - m_leftButton->setText(tr("Back", "button")); - m_rightButton->setVisible(true); - m_rightButton->setText(tr("Clean Up")); - m_scanProgressBar->setVisible(false); - // 要求统计所有项目并在界面上写对应信息 - recount(); - - m_isFirstShow = false; - - // 由于在中止扫描的情况下有两次调用setWidgetFinished - // 此处应注意不被上一次调用影响 - m_rightButton->setDisabled(!m_totalSize); - - if (m_isbScan) { - // 添加安全日志 - m_isbScan = false; - // 添加安全日志 - if (m_dataInterface) { - m_dataInterface->AddSecurityLog(SECURITY_LOG_TYPE_CLEANER, - tr("Scanned: %1 files, junk files: %2") - .arg(m_totalScannedFiles) - .arg(m_lastScannedSize)); - } - } -} - -void TrashCleanWidget::setWidgetCleanStart() -{ - // 有可能在scanfinish时将按键设为disable - // 此处还原 - m_rightButton->setDisabled(false); - - m_isCleaned = true; - m_leftButton->setText(tr("Cancel", "button")); - m_rightButton->setVisible(false); - - m_doneItems = 0; - m_cleanedSize = 0; - m_cleanedAmount = 0; - foreach (TrashCleanItem *root, m_rootItems) { - if (root) { - // 记录被选中进行清理的项目数 - if (root->isSelected()) { - m_doneItems++; - } - } - } - Q_EMIT startClean(); - - // 添加安全日志 - if (m_dataInterface) { - m_dataInterface->AddSecurityLog(SECURITY_LOG_TYPE_CLEANER, - tr("Removed: %1 junk files").arg(m_lastCleanedSize)); - } -} - -void TrashCleanWidget::setWidgetCleanFinish() -{ - // 有可能在scanfinish时将按键设为disable - // 此处还原 - m_rightButton->setDisabled(false); - - m_leftButton->setText(tr("Scan Again")); - m_rightButton->setText(tr("Done", "button")); - m_rightButton->setVisible(true); - m_lastCleanedSize = TrashCleanItem::fileSizeToString(m_cleanedSize); - m_headerTitle->setText(tr("%1 removed").arg(m_lastCleanedSize)); - m_tipTitle->setText(tr("Cleaned: %1 files").arg(m_cleanedAmount)); - if (m_dataInterface) { - m_dataInterface->SetValueToGSettings(CLEANER_LAST_TIME_CLEANED, m_lastCleanedSize); - } -} - -void TrashCleanWidget::getScanPathsFromDataInterface() -{ - if (nullptr == m_dataInterface) { - m_trashInfoList.clear(); - m_cacheInfoLIst.clear(); - m_logInfoList.clear(); - m_historyInfoList.clear(); - m_appJsonStr.clear(); - m_configItem.clear(); - return; - } - - // GetCacheInfoList 可能存在耗时较长的问题 - // 关联的数据获取集中在此处修改 - QFuture future = QtConcurrent::run([&]() { - if (m_configItem[SYS_CHECK_INDEX]->getCheckBoxStatus()) { - m_trashInfoList = m_dataInterface->GetTrashInfoList(); - m_cacheInfoLIst = m_dataInterface->GetCacheInfoList(); - m_logInfoList = m_dataInterface->GetLogInfoList(); - } - - if (m_configItem[APP_CHECK_INDEX]->getCheckBoxStatus()) { - m_appJsonStr = m_dataInterface->GetAppTrashInfoList(); - } - - if (m_configItem[HISTORY_CHECK_INDEX]->getCheckBoxStatus()) { - m_historyInfoList = m_dataInterface->GetHistoryInfoList(); - } - - if (m_configItem[BROWSER_CACHE_CHECK_INDEX]->getCheckBoxStatus()) { - m_cookiesJsonStr = m_dataInterface->GetBrowserCookiesInfoList(); - } - }); - while (!future.isFinished()) { - QApplication::processEvents(); - } -} - -// 随主题变化,改变图标 -void TrashCleanWidget::setPixmapByTheme(DGuiApplicationHelper::ColorType themeType) -{ - // 判断当前主题类型 - if (themeType == DGuiApplicationHelper::ColorType::LightType) { - QIcon icon = QIcon::fromTheme(TRASH_CLEAN_CONFIG_BIG_LOGO_LIGHT); - m_configLogo->setPixmap(icon.pixmap(300, 300)); - } else { - QIcon icon = QIcon::fromTheme(TRASH_CLEAN_CONFIG_BIG_LOGO_DARK); - m_configLogo->setPixmap(icon.pixmap(300, 300)); - } -} - -// 如果所有检查项未勾选,左按键置灰 -void TrashCleanWidget::onConfigItemClicked() -{ - foreach (CleanerItem *ci, m_configItem) { - if (ci->getCheckBoxStatus()) { - m_leftButton->setDisabled(false); - return; - } - } - - m_leftButton->setDisabled(true); -} - -void TrashCleanWidget::onCleanFinished() -{ - m_doneItems--; - // 未被选中的根项不会有删除文件的内容,所以不需要判断是否选中 - m_cleanedSize = 0; - m_cleanedAmount = 0; - foreach (auto item, m_rootItems) { - m_cleanedSize += item->cleanedSize(); - m_cleanedAmount += item->cleanedAmount(); - } - // 所有选中项目都已经清理完成 - if (!m_doneItems) { - onStageChanged(CLEAN_FINISHED); - } - m_lastCleanedSize = TrashCleanItem::fileSizeToString(m_cleanedSize); - m_headerTitle->setText(tr("%1 removed").arg(m_lastCleanedSize)); - m_tipTitle->setText(tr("Cleaned: %1 files").arg(m_cleanedAmount)); -} - -void TrashCleanWidget::DeleteSpecifiedFiles(QStringList paths) -{ - foreach (auto filePath, paths) { - if (filePath.contains(CLEANER_SYSTEM_TRASH_PATH)) { - DTrashManager::instance()->cleanTrash(); - break; - } - } - - if (m_dataInterface) { - m_dataInterface->DeleteSpecifiedFiles(paths); - } -} - -void TrashCleanWidget::DeleteSpecifiedAppRecord(const QString &pkgName) -{ - if (m_dataInterface) { - m_dataInterface->DeleteSpecifiedAppUninstallInfo(pkgName); - } -} - -// 代理函数 -MyItemDelegateTree::MyItemDelegateTree(QObject *parent) - : QItemDelegate(parent) -{ -} - -// 重绘操作 -void MyItemDelegateTree::paint(QPainter *painter, - const QStyleOptionViewItem &option, - const QModelIndex &index) const -{ - Q_UNUSED(painter); - Q_UNUSED(option); - Q_UNUSED(index); -} - -void TrashCleanWidget::paintEvent(QPaintEvent *event) -{ - if (SCAN_FINISHED == m_stage) { - setHeadTextWithElidedText(m_scanResultStr); - } - - QWidget::paintEvent(event); -} - -// 根据实际长度设置标题内容,右侧发生遮拦时以省略号代替内容 -void TrashCleanWidget::setHeadTextWithElidedText(const QString &headStr) -{ - // 因扫描时间控件在可见时造成遮挡 - if (m_scanTime->isVisible()) { - QFontMetrics scanTimeFontmet(m_scanTime->font()); - int scanTimeWidth = scanTimeFontmet.horizontalAdvance(m_scanTime->text(), -1); - QFontMetrics headFontmet(m_headerTitle->font()); - QString elidedStr; - elidedStr = headFontmet.elidedText(headStr, - Qt::TextElideMode::ElideRight, - MAX_HEAD_TITLE_WIDTH - scanTimeWidth - 10); - m_headerTitle->setText(elidedStr); - } -} diff --git a/deepin-pc-manager/src/window/modules/cleaner/trashcleanwidget.h b/deepin-pc-manager/src/window/modules/cleaner/trashcleanwidget.h deleted file mode 100644 index bb28ee9..0000000 --- a/deepin-pc-manager/src/window/modules/cleaner/trashcleanwidget.h +++ /dev/null @@ -1,215 +0,0 @@ -// Copyright (C) 2019 ~ 2020 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include "../../namespace.h" - -#include -#include -#include - -#include -#include - -DWIDGET_BEGIN_NAMESPACE -class DFrame; -class DLabel; -class DSuggestButton; -class DProgressBar; -DWIDGET_END_NAMESPACE - -class CheckItem; -class CleanerItem; -class TrashCleanItem; -class TitleLabel; - -namespace def { -namespace widgets { -class SmallLabel; -} -} // namespace def - -class QGSettings; - -class CleanerDBusAdaptorInterface; - -DWIDGET_USE_NAMESPACE - -/* 添加树表代理 */ -class MyItemDelegateTree : public QItemDelegate -{ - Q_OBJECT -public: - explicit MyItemDelegateTree(QObject *parent = nullptr); - - virtual ~MyItemDelegateTree() { } - - // 重绘 - void paint(QPainter *painter, - const QStyleOptionViewItem &option, - const QModelIndex &index) const; -}; - -class TrashCleanWidget : public QWidget -{ - Q_OBJECT -public: - /** - * @brief ScanStages 枚举控制该控件页面的显示状态,依次为: - * 检查功能首页 - * 扫描启动 - * 扫描完成 - * 清理启动 - * 清理完成 - */ - enum ScanStages { PREPARING, SCAN_STARTED, SCAN_FINISHED, CLEAN_STARTED, CLEAN_FINISHED }; - - explicit TrashCleanWidget(QWidget *parent = nullptr, - CleanerDBusAdaptorInterface *interfact = nullptr); - ~TrashCleanWidget(); - - void setServerInterface(CleanerDBusAdaptorInterface *); - - inline quint64 GetScanedSize() const { return m_totalSize; } - - inline quint64 GetCleanedSize() const { return m_cleanedSize; } - - inline int GetScanedAcount() const { return m_totalScannedFiles; } - - inline int GetCleanedAcount() const { return m_cleanedAmount; } - - inline ScanStages GetCurrentStage() const { return m_stage; } - - QString getElidedScanTitle(const QString &) const; - -protected: - void paintEvent(QPaintEvent *event); - -private: - void initHeaderFrame(); - void initConfigFrame(); - void initResultFrame(); - void initBottomFrame(); - - void changeStageByLeftButton(); - void changeStageByRightButton(); - void onStageChanged(ScanStages); - - void addRootCheckItems(); - void addSystemChildCheckItems(); - void addAppCheckItems(); - void addUninstalledAppCheckItems(); - void addBrowserCookies(); - void addChildrenCheckItems(); - void - addChildItem(int rootIndex, const QString &title, const QString &tip, const QStringList &paths); - void addChildItem(int rootIndex, - const QString &title, - const QString &pkgName, - const QString &tip, - const QList &paths, - bool isRemained = false); - - void startScan(); - void stopScan(); - void scan(); - - void setWidgetPrepare(); - void setWidgetScanStart(); - void setWidgetScanFinish(); - void setWidgetCleanStart(); - void setWidgetCleanFinish(); - - void getScanPathsFromDataInterface(); - void setHeadTextWithElidedText(const QString &); - -Q_SIGNALS: - void stageChanged(ScanStages); - void prepare(); - void startWork(); - // void stopWork(); - void stopShowResult(); - void sendScanFinished(); - void showScanResult(); - void showResult(); - void startClean(); - -public Q_SLOTS: - void scanDone(); - void setScanTitleName(QString); - void showScanResultFinished(); - void recount(); - void setPixmapByTheme(Dtk::Gui::DGuiApplicationHelper::ColorType themeType); - void onConfigItemClicked(); - void onCleanFinished(); - void DeleteSpecifiedFiles(QStringList paths); - void DeleteSpecifiedAppRecord(const QString &pkgName); - -private: - // 界面由4个frame拼起来 - DFrame *m_headerFrame; - DFrame *m_configFrame; - DFrame *m_resultFrame; - DFrame *m_bottomFrame; - DFrame *m_bottomLine; - // 记录界面状态 - ScanStages m_stage; - - // 使用的控件 - DPushButton *m_leftButton; - DSuggestButton *m_rightButton; - DLabel *m_configLogo; - TitleLabel *m_headerTitle; - DProgressBar *m_scanProgressBar; - DLabel *m_tipTitle; - DLabel *m_headerLogo; - DTreeWidget *m_treeWidget; - - // 配置界面的选项 - QList m_configItem; - // 检查界面的选项 - QList m_rootItems; - - // 上一次扫描的大小 - QString m_lastScannedSize; - QString m_lastCleanedSize; - - // 记录检查完成数 - int m_doneItems; - int m_showItems; - // 记录进度条值 - int m_currentScanProgressValue; - // 记录本次扫描垃圾大小 - quint64 m_totalSize; - int m_totalScannedFiles; - quint64 m_cleanedSize; - int m_cleanedAmount; - bool m_isCleaned; - - // 表格代理 - MyItemDelegateTree *m_delegate; - - // 扫描按钮 标志位 - bool m_isbScan; - - // 扫描时间展示 - DLabel *m_scanTime; - CleanerDBusAdaptorInterface *m_dataInterface; - - // 是否扫描后首次显示结果 - bool m_isFirstShow; - - QStringList m_trashInfoList; - QStringList m_cacheInfoLIst; - QStringList m_logInfoList; - QStringList m_historyInfoList; - QString m_appJsonStr; - QString m_cookiesJsonStr; - - QString m_scanResultStr; -}; - -DEF_NAMESPACE_END diff --git a/deepin-pc-manager/src/window/modules/cleaner/widgets/trashcleangreetingwidget.cpp b/deepin-pc-manager/src/window/modules/cleaner/widgets/trashcleangreetingwidget.cpp deleted file mode 100644 index 2c5c7c0..0000000 --- a/deepin-pc-manager/src/window/modules/cleaner/widgets/trashcleangreetingwidget.cpp +++ /dev/null @@ -1,197 +0,0 @@ -// Copyright (C) 2019 ~ 2022 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "trashcleangreetingwidget.h" - -#include "../trashcleandefinition.h" -#include "trashcleanconfigitem.h" - -#include -#include - -#include -#include - -DWIDGET_USE_NAMESPACE - -TrashCleanGreetingWidget::TrashCleanGreetingWidget(QWidget *parent) - : DFrame(parent) - , m_logo(nullptr) - , m_title(nullptr) - , m_greeting(nullptr) - , m_sysItem(nullptr) - , m_appItem(nullptr) - , m_hisItem(nullptr) - , m_cookiesItem(nullptr) - , m_scanBtn(nullptr) -//, m_guiHelper(nullptr) -{ - this->setFixedSize(770, 590); - this->setFocusPolicy(Qt::NoFocus); - this->setFrameShape(QFrame::NoFrame); - m_scanConfigList = { 0, 0, 0, 0 }; - initUI(); - initConnection(); - - m_sysItem->setCheckBoxStatus(true); - m_appItem->setCheckBoxStatus(true); - m_hisItem->setCheckBoxStatus(false); - m_cookiesItem->setCheckBoxStatus(false); - - // 主题变换 改变部分图标颜色 - // m_guiHelper = DGuiApplicationHelper::instance(); - // setPixmapByTheme(m_guiHelper->themeType()); - // connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, - // &TrashCleanGreetingWidget::setPixmapByTheme); -} - -void TrashCleanGreetingWidget::setGreeing(const QString &info) -{ - if (!info.isEmpty()) { - m_greeting->setText(tr("Last clean: %1").arg(info)); - } else { - m_greeting->setText(tr("Start cleaning now to refresh your computer")); - } -} - -void TrashCleanGreetingWidget::onItemStageChanged(int id, int stage) -{ - if (id < 0 || id > m_scanConfigList.length() - 1) { - return; - } - m_scanConfigList[id] = stage; - - m_scanBtn->setDisabled(m_scanConfigList.count(Qt::Unchecked) == m_scanConfigList.length()); -} - -void TrashCleanGreetingWidget::initUI() -{ - m_logo = new DLabel(this); - m_logo->setFixedSize(400, 220); - m_logo->setPixmap(QIcon::fromTheme(kGreetingLogoPath).pixmap(400, 220)); - m_logo->setAccessibleName("greetingLogo"); - - m_title = new DLabel(this); - m_title->setText(tr("Clean out junk files and free up disk space")); - m_title->setAccessibleName("greetingTitle"); - QFont titleFont = m_logo->font(); - titleFont.setPixelSize(30); - titleFont.setWeight(QFont::DemiBold); - m_title->setFont(titleFont); - - m_greeting = new DLabel(this); - m_greeting->setAccessibleName("greetingInfo"); - m_greeting->setText(tr("Start cleaning now to refresh your computer")); - QFont greFont = m_greeting->font(); - greFont.setPixelSize(14); - greFont.setWeight(QFont::Normal); - m_greeting->setFont(greFont); - - m_sysItem = new TrashCleanConfigItem(this); - m_sysItem->setIconPath(kSysIconPath); - m_sysItem->setTitles(tr("System junk"), tr("Useless files created by the system")); - m_sysItem->setIndex(SYS_CONFIG_INDEX); - m_sysItem->setAccessibleName("systemJunkFrame"); - - m_appItem = new TrashCleanConfigItem(this); - m_appItem->setIconPath(kAppIconPath); - m_appItem->setTitles(tr("Application junk"), tr("Unneeded files created by applications")); - m_appItem->setIndex(APP_CONFIG_INDEX); - m_appItem->setAccessibleName("appJunkFrame"); - - m_hisItem = new TrashCleanConfigItem(this); - m_hisItem->setIconPath(kHisIconPath); - m_hisItem->setTitles(tr("Traces"), tr("Activity traces of the system and applications")); - m_hisItem->setIndex(HISTORY_CONFIG_INDEX); - m_hisItem->setAccessibleName("tracesFrame"); - - m_cookiesItem = new TrashCleanConfigItem(this); - m_cookiesItem->setIconPath(kCookiesIconPath); - m_cookiesItem->setTitles(tr("Cookies"), tr("Cookies from Internet browsers")); - m_cookiesItem->setIndex(COOKIES_CONFIG_INDEX); - m_cookiesItem->setAccessibleName("cookiesFrame"); - - m_scanBtn = new DSuggestButton(this); - m_scanBtn->setAccessibleName("scanButton"); - DFontSizeManager::instance()->unbind(m_scanBtn); - QFont scanBtnFont = m_scanBtn->font(); - scanBtnFont.setPixelSize(14); - m_scanBtn->setFont(scanBtnFont); - m_scanBtn->setFixedSize(150, 36); - m_scanBtn->setText(tr("Scan Now", "button")); - m_scanBtn->setFocusPolicy(Qt::NoFocus); - - QGridLayout *mainLayout = new QGridLayout(this); - mainLayout->setContentsMargins(0, 0, 0, 0); - mainLayout->setSpacing(0); - - mainLayout->setColumnStretch(0, 107); - mainLayout->setColumnMinimumWidth(0, 107); - mainLayout->setColumnStretch(1, 516); - mainLayout->setColumnMinimumWidth(1, 516); - mainLayout->setColumnStretch(2, 147); - mainLayout->setColumnMinimumWidth(2, 147); - - mainLayout->setRowMinimumHeight(0, 230); - mainLayout->addWidget(m_logo, 0, 0, 1, -1, Qt::AlignBottom | Qt::AlignHCenter); - mainLayout->setRowMinimumHeight(1, 54); - mainLayout->addWidget(m_title, 1, 0, 1, -1, Qt::AlignCenter); - mainLayout->setRowMinimumHeight(2, 24); - mainLayout->addWidget(m_greeting, 2, 0, 1, -1, Qt::AlignCenter); - mainLayout->setRowMinimumHeight(3, 22); - - mainLayout->setRowMinimumHeight(4, 42); - mainLayout->setRowMinimumHeight(5, 42); - mainLayout->setRowMinimumHeight(6, 42); - mainLayout->setRowMinimumHeight(7, 42); - mainLayout->addWidget(m_sysItem, 4, 1); - mainLayout->addWidget(m_appItem, 5, 1); - mainLayout->addWidget(m_hisItem, 6, 1); - mainLayout->addWidget(m_cookiesItem, 7, 1); - - mainLayout->setRowMinimumHeight(8, 88); - mainLayout->addWidget(m_scanBtn, 8, 0, 1, -1, Qt::AlignCenter); - - mainLayout->setRowMinimumHeight(9, 4); -} - -void TrashCleanGreetingWidget::initConnection() -{ - connect(m_sysItem, - &TrashCleanConfigItem::stageChanged, - this, - &TrashCleanGreetingWidget::onItemStageChanged); - connect(m_appItem, - &TrashCleanConfigItem::stageChanged, - this, - &TrashCleanGreetingWidget::onItemStageChanged); - connect(m_hisItem, - &TrashCleanConfigItem::stageChanged, - this, - &TrashCleanGreetingWidget::onItemStageChanged); - connect(m_cookiesItem, - &TrashCleanConfigItem::stageChanged, - this, - &TrashCleanGreetingWidget::onItemStageChanged); - - connect(m_scanBtn, &QPushButton::clicked, this, &TrashCleanGreetingWidget::notifyStartScan); -} - -// 随主题变化,改变图标 -void TrashCleanGreetingWidget::setPixmapByTheme(DGuiApplicationHelper::ColorType themeType) -{ - // 判断当前主题类型 - if (themeType == DGuiApplicationHelper::ColorType::LightType) { - m_sysItem->setIconPath(kSysIconPath); - m_appItem->setIconPath(kAppIconPath); - m_hisItem->setIconPath(kHisIconPath); - m_cookiesItem->setIconPath(kCookiesIconPath); - } else { - m_sysItem->setIconPath(kSysIconPathDark); - m_appItem->setIconPath(kAppIconPathDark); - m_hisItem->setIconPath(kHisIconPathDark); - m_cookiesItem->setIconPath(kCookiesIconPathDark); - } -} diff --git a/deepin-pc-manager/src/window/modules/cleaner/widgets/trashcleangreetingwidget.h b/deepin-pc-manager/src/window/modules/cleaner/widgets/trashcleangreetingwidget.h deleted file mode 100644 index 9d53437..0000000 --- a/deepin-pc-manager/src/window/modules/cleaner/widgets/trashcleangreetingwidget.h +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (C) 2019 ~ 2022 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef TRASHCLEANGREETINGWIDGET_H -#define TRASHCLEANGREETINGWIDGET_H - -#include "trashcleanconfigitem.h" - -#include -#include -#include -#include - -#include -#include - -class CleanerDBusAdaptorInterface; - -class TrashCleanGreetingWidget : public Dtk::Widget::DFrame -{ - Q_OBJECT -public: - explicit TrashCleanGreetingWidget(QWidget *parent = nullptr); - - ~TrashCleanGreetingWidget() { } - - inline const QList &getScanConfig() { return m_scanConfigList; } - - void setGreeing(const QString &info); - -Q_SIGNALS: - void notifyStartScan(); - -public Q_SLOTS: - void onItemStageChanged(int, int); - void setPixmapByTheme(Dtk::Gui::DGuiApplicationHelper::ColorType themeType); - -private: - void initUI(); - void initConnection(); - -private: - Dtk::Widget::DLabel *m_logo; - Dtk::Widget::DLabel *m_title; - Dtk::Widget::DLabel *m_greeting; - TrashCleanConfigItem *m_sysItem; - TrashCleanConfigItem *m_appItem; - TrashCleanConfigItem *m_hisItem; - TrashCleanConfigItem *m_cookiesItem; - Dtk::Widget::DSuggestButton *m_scanBtn; - QList m_scanConfigList; - - // 应用界面工具对象,方便使用系统主题相关方法 - // DGuiApplicationHelper *m_guiHelper; -}; - -#endif // TRASHCLEANGREETINGWIDGET_H diff --git a/deepin-pc-manager/src/window/modules/cleaner/widgets/trashcleanresultwidget.cpp b/deepin-pc-manager/src/window/modules/cleaner/widgets/trashcleanresultwidget.cpp deleted file mode 100644 index d22b719..0000000 --- a/deepin-pc-manager/src/window/modules/cleaner/widgets/trashcleanresultwidget.cpp +++ /dev/null @@ -1,987 +0,0 @@ -// Copyright (C) 2019 ~ 2020 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "trashcleanresultwidget.h" - -#include "../trashcleandefinition.h" -#include "../trashcleanitem.h" -#include "cleanerresultitemwidget.h" -#include "dtkwidget_global.h" -#include "trashcleanresultheaderitem.h" -#include "window/modules/cleaner/cleanerdbusadaptorinterface.h" -#include "window/modules/common/common.h" -#include "window/modules/common/gsettingkey.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define SYS_CHECK_INDEX 0 -#define APP_CHECK_INDEX 1 -#define HISTORY_CHECK_INDEX 2 -#define BROWSER_CACHE_CHECK_INDEX 3 - -#define APP_UNINSTALL_REMAIN_PATH_INDEX 0 -#define APP_CONFIG_PATH_INDEX 0 -#define APP_CACHE_PATH_INDEX 1 - -#define CONTENT_FRAME_LEFT_MARGINS 35 - -#define MAX_HEAD_TITLE_WIDTH 520 - -DWIDGET_USE_NAMESPACE - -TrashCleanResultWidget::TrashCleanResultWidget(CleanerDBusAdaptorInterface *interface, - QWidget *parent) - : QWidget(parent) - , m_leftButton(nullptr) - , m_rightButton(nullptr) - , m_treeWidget(nullptr) - , m_delegate(nullptr) - , m_isbScan(false) - , m_dataInterface(interface) - , m_isFirstShow(false) - , m_headerItem(nullptr) -{ - this->setAccessibleName("rightWidget_trashCleanWidget"); - - // 固定窗口 - setFixedSize(QSize(770, 590)); - QGridLayout *mainLayout = new QGridLayout; - mainLayout->setSpacing(10); - mainLayout->setContentsMargins(10, 10, 10, 10); - - // 布局 - mainLayout->setRowStretch(0, 146); - mainLayout->setRowMinimumHeight(0, 146); - mainLayout->setRowStretch(1, 368); - mainLayout->setRowMinimumHeight(1, 368); - mainLayout->setRowStretch(2, 36); - mainLayout->setColumnStretch(0, 420); - mainLayout->setColumnMinimumWidth(0, 420); - mainLayout->setColumnStretch(1, 150); - mainLayout->setColumnMinimumWidth(1, 150); - mainLayout->setColumnStretch(2, 150); - mainLayout->setColumnMinimumWidth(2, 150); - - // 上部分标题视图绘制 - m_headerItem = new TrashCleanResultHeaderItem(this); - m_headerItem->setAccessibleName("resultWidgetHeader"); - mainLayout->addWidget(m_headerItem, 0, 0, 1, -1, Qt::AlignCenter); - - initTable(); - mainLayout->addWidget(m_treeWidget, 1, 0, 1, -1, Qt::AlignCenter); - - initButtons(); - mainLayout->addWidget(m_leftButton, 2, 1, Qt::AlignCenter); - mainLayout->addWidget(m_cancelScanButton, 2, 2, Qt::AlignCenter); - mainLayout->addWidget(m_rightButton, 2, 2, Qt::AlignCenter); - setLayout(mainLayout); - - // 由onStageChanged统一处理窗口状态变化 - connect(this, - &TrashCleanResultWidget::stageChanged, - this, - &TrashCleanResultWidget::onStageChanged); - - foreach (auto item, m_rootItems) { - connect(this, - &TrashCleanResultWidget::prepare, - item, - &TrashCleanItem::prepare); // 移除上一次扫描数据 - connect(this, - &TrashCleanResultWidget::startWork, - item, - &TrashCleanItem::startScan); // 开始扫描 - connect(this, - &TrashCleanResultWidget::showScanResult, - item, - &TrashCleanItem::showScanResult); // 扫描完成后展示结果 - connect(this, - &TrashCleanResultWidget::stopShowResult, - item, - &TrashCleanItem::stopShowResult); // 停止展示,响应“中止扫描” - connect(this, - &TrashCleanResultWidget::startClean, - item, - &TrashCleanItem::clean); // 开始清理 - - connect(item, - &TrashCleanItem::showScanResultFinished, - this, - &TrashCleanResultWidget::showScanResultFinished); // 开始展示扫描结果 - connect(item, - &TrashCleanItem::scanFinished, - this, - &TrashCleanResultWidget::scanDone); // 根项扫描结束 - connect(item, - &TrashCleanItem::noticeFileName, - this, - &TrashCleanResultWidget::setScanTitleName); // 根项通知主界面当前展示的文件名称 - connect(item, &TrashCleanItem::recounted, this, &TrashCleanResultWidget::recount); - connect(item, - &TrashCleanItem::cleanFinished, - this, - &TrashCleanResultWidget::onCleanFinished); - - // 后台服务文件删除功能 - connect(item, - &TrashCleanItem::deleteUserFiles, - this, - &TrashCleanResultWidget::DeleteSpecifiedFiles); - // 后台卸载应用数据库删除 - connect(item, - &TrashCleanItem::noticeAppName, - this, - &TrashCleanResultWidget::DeleteSpecifiedAppRecord); - } - - // 由于提供了公有查询方法,变量应当初始化 - m_totalSize = 0; - m_totalScannedFiles = 0; - m_cleanedSize = 0; - m_cleanedAmount = 0; - onStageChanged(ScanStages::PREPARING); -} - -TrashCleanResultWidget::~TrashCleanResultWidget() -{ - Q_EMIT stopScan(); - Q_EMIT stopShowResult(); - - foreach (auto root, m_rootItems) { - if (root) { - root->removeChildren(); - } - root->itemWidget()->deleteLater(); - root->deleteLater(); - } - // 注意,指针在list中以值保存,foreach操作时,会以值的形式复制给局部变量 - // 不要在foreach遍历中进行指针删除 - qDeleteAll(m_rootItems.begin(), m_rootItems.end()); - m_rootItems.clear(); -} - -void TrashCleanResultWidget::processScan() -{ - // 初始化后,将主界面设为PREPARING状态 - if (m_stage != SCAN_STARTED) { - onStageChanged(PREPARING); - onStageChanged(SCAN_STARTED); - } -} - -void TrashCleanResultWidget::haltScan() -{ - Q_EMIT stopScan(); - Q_EMIT stopShowResult(); - Q_EMIT stageChanged(SCAN_FINISHED); -} - -void TrashCleanResultWidget::setServerInterface(CleanerDBusAdaptorInterface *interface) -{ - m_dataInterface = interface; -} - -void TrashCleanResultWidget::initTable() -{ - m_treeWidget = new DTreeWidget(this); - m_treeWidget->setAccessibleName("centerResultFrame_treeWidget"); - m_treeWidget->setFixedSize(750, 368); - m_treeWidget->setFrameShape(QFrame::NoFrame); - m_treeWidget->setIndentation(16); - m_treeWidget->setSelectionMode(QAbstractItemView::SelectionMode::NoSelection); - m_treeWidget->setBackgroundRole(QPalette::Window); - m_treeWidget->setHeaderHidden(true); - m_treeWidget->setColumnCount(1); - m_treeWidget->setFocusPolicy(Qt::NoFocus); - m_delegate = new TCTableDelegateTree(this); - m_treeWidget->setItemDelegate(m_delegate); - - QStringList strList; - strList << "treeWidget_headerLable"; - m_treeWidget->setHeaderLabels(strList); - m_treeWidget->setContentsMargins(0, 0, 0, 0); - - // 在树中插入根检查项 - addRootCheckItems(); -} - -void TrashCleanResultWidget::initButtons() -{ - m_leftButton = new DPushButton(this); - m_leftButton->setFont(Utils::getFixFontSize(14)); - m_leftButton->setAccessibleName("leftButton"); - m_leftButton->setObjectName("leftButton"); - m_leftButton->setFixedSize(QSize(150, 36)); - m_leftButton->setText(tr("Scan Now", "buton")); - - m_cancelScanButton = new DPushButton(this); - m_cancelScanButton->setFont(Utils::getFixFontSize(14)); - m_cancelScanButton->setAccessibleName("cancelButton"); - m_cancelScanButton->setObjectName("cancelButton"); - m_cancelScanButton->setFixedSize(QSize(150, 36)); - m_cancelScanButton->setText(tr("Cancel", "button")); - m_cancelScanButton->setVisible(false); - - // 右按键背景色 - m_rightButton = new DSuggestButton(this); - m_rightButton->setFont(Utils::getFixFontSize(14)); - m_rightButton->setAccessibleName("rightButton"); - m_rightButton->setObjectName("rightButton"); - m_rightButton->setFixedSize(QSize(150, 36)); - m_rightButton->setText(tr("Scan Now", "button")); - - connect(m_cancelScanButton, &QPushButton::clicked, this, [this] { - Q_EMIT stopShowResult(); - Q_EMIT stageChanged(SCAN_FINISHED); - }); - connect(m_leftButton, - &QPushButton::clicked, - this, - &TrashCleanResultWidget::changeStageByLeftButton); - connect(m_rightButton, - &QPushButton::clicked, - this, - &TrashCleanResultWidget::changeStageByRightButton); -} - -// 在界面上添加固定的根检查项 -void TrashCleanResultWidget::addRootCheckItems() -{ - // 添加根项检查点 - // 根项只有标题,没有说明 - QStringList itemlist = { tr("System junk"), - tr("Application junk"), - tr("Traces"), - tr("Cookies") }; - foreach (auto item, itemlist) { - TrashCleanItem *trash = new TrashCleanItem(nullptr); - trash->setTitle(item); - m_rootItems.push_back(trash); - QTreeWidgetItem *treeItem = new QTreeWidgetItem(m_treeWidget); - treeItem->setData(0, Qt::DisplayRole, "treeWidget_rootItem"); - treeItem->setHidden(true); - m_treeWidget->setItemWidget(treeItem, 0, trash->itemWidget()); - } -} - -// 为所有根检查项添加子项检查 -void TrashCleanResultWidget::addChildrenCheckItems() -{ - if (!m_dataInterface) { - return; - } - getScanPathsFromDataInterface(); - - // 系统扫描项为固定目录 - // 垃圾箱 - addChildItem(SYS_CHECK_INDEX, - tr("Trash"), - tr("Make sure all files in the trash can be deleted"), - m_trashInfoList); - // 系统缓存 - addChildItem(SYS_CHECK_INDEX, - tr("System caches"), - tr("Caches created by the system"), - m_cacheInfoLIst); - // 系统日志 - addChildItem(SYS_CHECK_INDEX, - tr("System logs"), - tr("Log files created by the system"), - m_logInfoList); - - // 痕迹扫描项为固定目录 - addChildItem(HISTORY_CHECK_INDEX, - tr("System and Application traces"), - tr(""), - m_historyInfoList); - - // 根据服务返回清单,建立应用扫描项 - addAppCheckItems(); - - // 浏览器cookies扫描项 - addBrowserCookies(); -} - -// 服务返回JSON文件在这里处理,收集文件信息 -// 待重构 -// 服务返回改为结构体,更有效率 -void TrashCleanResultWidget::addAppCheckItems() -{ - if (!m_dataInterface) { - return; - } - - QJsonParseError err; - // 读app.json获取名称和路径信息 - QJsonObject object = QJsonDocument::fromJson(m_appJsonStr.toUtf8(), &err).object(); - // 文件错误检查 - if (QJsonParseError::NoError != err.error) { - qDebug() << "failed to parse JSON content when addAppCheckItems"; - return; - } - - QJsonArray appArr = object[CLEANER_APP_JSON_NAME].toArray(); - // 从后台服务传递的JSON中取出对应路径并设置给子检查项 - foreach (auto app, appArr) { - QStringList configPaths; - QStringList cachePaths; - QList paths; - foreach (auto item, app[CLEANER_APP_CONFIG_PATH].toArray()) { - configPaths.append(item.toString()); - } - foreach (auto item, app[CLEANER_APP_CACHE_PATH].toArray()) { - cachePaths.append(item.toString()); - } - paths.append(configPaths); - paths.append(cachePaths); - - // 应用的缷载标志 - bool isInstalled = app[CLEANER_APP_INSTALL_FLAG].toBool(); - QString pkgName = app[CLEANER_APP_COM_NAME].toString(); - addChildItem(APP_CHECK_INDEX, - app[CLEANER_APP_NAME].toString(), - pkgName, - QString(""), - paths, - isInstalled); - } -} - -void TrashCleanResultWidget::addBrowserCookies() -{ - if (!m_dataInterface) { - return; - } - - QJsonParseError err; - // 读app.json获取名称和路径信息 - QJsonObject object = QJsonDocument::fromJson(m_cookiesJsonStr.toUtf8(), &err).object(); - // 文件错误检查 - if (QJsonParseError::NoError != err.error) { - qDebug() << "failed to parse JSON content when addBrowserCookies"; - return; - } - - QJsonArray appArr = object[CLEANER_BROWSER_JSON_NAME].toArray(); - foreach (auto app, appArr) { - QStringList paths; - foreach (auto item, app[CLEANER_BROWSER_COOKIES_PATH].toArray()) { - paths.append(item.toString()); - } - addChildItem(BROWSER_CACHE_CHECK_INDEX, app[CLEANER_APP_NAME].toString(), tr(""), paths); - } -} - -// 将子项检查内容添加到根项 -// 根据需求如果子项大小为0则不显示子项 -// 这里根据文件数实现,如果文件数为0,即大小为0 -void TrashCleanResultWidget::addChildItem(int rootIndex, - const QString &title, - const QString &pkgName, - const QString &tip, - const QList &paths, - bool isInstalled) -{ - if (rootIndex >= m_rootItems.size() || rootIndex < 0) - return; - - // 构建应用上级检查项 - // 上级结点是逻辑结点,不要设置扫描路径 - TrashCleanItem *item = new TrashCleanItem(m_rootItems[rootIndex]); - - TrashCleanItem *childItem = nullptr; - // 构建次级检查项 - // 判断是否应用已经卸载 - if (isInstalled) { - if (!paths[APP_CACHE_PATH_INDEX].isEmpty()) { - childItem = new TrashCleanItem(item); - childItem->setTitle(tr("Cache and log files")); - childItem->setFilePaths(paths[APP_CACHE_PATH_INDEX]); - } - } else { - // 构建卸载应用残留 - QStringList filePath(paths[APP_CACHE_PATH_INDEX]); - filePath.append(paths[APP_CONFIG_PATH_INDEX]); - if (!filePath.isEmpty()) { - childItem = new TrashCleanItem(item); - childItem->setPkgName(pkgName); - childItem->setTitle(tr("Residual files")); - childItem->setFilePaths(filePath); - } - } - - // TrashCleanItem类中,UI在构造时产生,因此只能从上至下的形式构造树 - // 如果是卸载项目,在子项目为空的情况下,不需要构建上级扫描项,此处将父项从根项中删除 - if (!childItem && !isInstalled) { - m_rootItems[rootIndex]->removeChild(item); - if (item) { - delete item; - item = nullptr; - } - return; - } - - // 父项达成存在条件时设置父项属性并建立界面 - // 1.应用没有被缷载 - // 2.应用被缷载,且存在残留内容 - item->setObjectName(title); - item->setTitle(title); - item->setTip(tip.toUtf8()); - QTreeWidgetItem *itemWidget = new QTreeWidgetItem(); - itemWidget->setData(0, Qt::DisplayRole, "treeWidget_childItem"); - m_treeWidget->topLevelItem(rootIndex)->addChild(itemWidget); - m_treeWidget->setItemWidget(itemWidget, 0, item->itemWidget()); - - // 次级项存在内容时建立界面 - if (childItem) { - QTreeWidgetItem *childWidget = new QTreeWidgetItem; - childWidget->setData(0, Qt::DisplayRole, "treeWidget_childItem"); - itemWidget->addChild(childWidget); - m_treeWidget->setItemWidget(childWidget, 0, childItem->itemWidget()); - } else { - // 次级不存在时,插入一个空的对象以标识父项的身份 - item->addChild(nullptr); - } -} - -void TrashCleanResultWidget::addChildItem(int rootIndex, - const QString &title, - const QString &tip, - const QStringList &paths) -{ - if (rootIndex >= m_rootItems.size() || rootIndex < 0) - return; - TrashCleanItem *item = new TrashCleanItem(m_rootItems[rootIndex]); - item->setObjectName(title); - item->setTitle(title); - item->setTip(tip.toUtf8()); - item->setFilePaths(paths); - QTreeWidgetItem *itemWidget = new QTreeWidgetItem(); - itemWidget->setData(0, Qt::DisplayRole, "treeWidget_childItem"); - m_treeWidget->topLevelItem(rootIndex)->addChild(itemWidget); - m_treeWidget->setItemWidget(itemWidget, 0, item->itemWidget()); -} - -// 待重构 -// 控制内容重写为函数 -void TrashCleanResultWidget::onStageChanged(ScanStages stage) -{ - m_stage = stage; - switch (m_stage) { - case SCAN_STARTED: - setWidgetScanStart(); - break; - case SCAN_FINISHED: - setWidgetScanFinish(); - break; - case PREPARING: - m_isbScan = true; - setWidgetPrepare(); - break; - case CLEAN_STARTED: - setWidgetCleanStart(); - break; - case CLEAN_FINISHED: - setWidgetCleanFinish(); - break; - } -} - -// 左按键引发的状态变化 -void TrashCleanResultWidget::changeStageByLeftButton() -{ - // m_state为当前状态 - // 开始进入下一状态 - switch (m_stage) { - // 由配置界面,开始扫描 - case PREPARING: - // m_isbScan = true; - // Q_EMIT stageChanged(SCAN_STARTED); - // break; - // 扫描过程中要求中止 - case SCAN_STARTED: - // Q_EMIT stopShowResult(); - // Q_EMIT stageChanged(SCAN_FINISHED); - // break; - // 扫描完成要求返回到配置页 - case SCAN_FINISHED: - // Q_EMIT stageChanged(PREPARING); - // break; - // 清理过程中要求中止 - case CLEAN_STARTED: - // Q_EMIT stageChanged(CLEAN_FINISHED); - break; - // 清理结束后返回配置界面 - case CLEAN_FINISHED: - m_isbScan = true; - Q_EMIT stageChanged(SCAN_STARTED); - break; - } -} - -// 右按键引发的状态变化 -void TrashCleanResultWidget::changeStageByRightButton() -{ - // m_state为当前状态 - // 开始进入下一状态 - switch (m_stage) { - // 扫描结束时,按下开始进行清理 - case SCAN_FINISHED: - if (m_rootItems[0]->isSelected() || m_rootItems[1]->isSelected() - || m_rootItems[2]->isSelected() || m_rootItems[3]->isSelected()) { - Q_EMIT stageChanged(CLEAN_STARTED); - } - break; - // 清理结束时,按下返回到配置界面 - case CLEAN_FINISHED: - // Q_EMIT stageChanged(PREPARING); - // 回退到前一页面 - Q_EMIT stageChanged(PREPARING); - Q_EMIT notifyBackToGreetingWidget(); - break; - default: - break; - } -} - -// 需要顺序执行 -void TrashCleanResultWidget::startScan() -{ - // 启动扫描 - // 获取所有项目的文件列表和大小数据 - - // 待重构 - // 将扫描功能移动到后端服务 - - Q_EMIT startWork(); -} - -void TrashCleanResultWidget::scanDone() -{ - // 扫描并获得全部文件数量 - m_doneItems--; - if (m_doneItems == 0) { - // 开始延时显示扫描结果 - m_totalSize = 0; - Q_EMIT showScanResult(); - } -} - -// 接收工作线程发送的信号,以同步标题上的扫描文件名 -// 展示当前扫描进度 -void TrashCleanResultWidget::setScanTitleName(const QString &fileName) -{ - if (!m_leftButton->isEnabled()) { - m_leftButton->setDisabled(false); - } - m_headerItem->updateScanPath(fileName); -} - -// 根检查项通知过程结束 -void TrashCleanResultWidget::showScanResultFinished() -{ - if (!m_leftButton->isEnabled()) { - m_leftButton->setDisabled(false); - } - - m_cancelScanButton->setDisabled(false); - m_showItems--; - if (m_showItems == 0) { - stageChanged(SCAN_FINISHED); - } -} - -// 因界面变动要求重新统计总计文件大小 -void TrashCleanResultWidget::recount() -{ - if (PREPARING == m_stage) { - // 在PREPARING状态下不响应检查项的recount信号 - return; - } - - quint64 fileSize = 0; - int fileAmount = 0; - - foreach (auto item, m_rootItems) { - if (!item->isSelected() || !item->isShown()) { - continue; - } - fileSize += item->totalFileSize(); - fileAmount += item->totalFileAmount(); - } - - // recount结果会根据项目选中变化,此处应使用qMax统计 - m_totalSize = qMax(m_totalSize, fileSize); - m_totalScannedFiles = qMax(m_totalScannedFiles, fileAmount); - m_lastScannedSize = TrashCleanItem::fileSizeToString(m_totalSize); - - if (SCAN_FINISHED == m_stage || SCAN_STARTED == m_stage) { - m_scanResultStr = tr("%1 junk files, %2 selected") - .arg(m_lastScannedSize) - .arg(TrashCleanItem::fileSizeToString(fileSize)); - QString tipInfo = tr("Scanned: %1 files").arg(m_totalScannedFiles); - m_headerItem->setTitle(m_scanResultStr); - m_headerItem->setTip(tipInfo); - } - - // 如果在清理前之选择了部分项目 - // 清理完成后选择另外部分项目,则重新回到清理开始状态 - // 根据重新计算的总大小判断是否回退状态到清理完成 - if (CLEAN_FINISHED == m_stage && fileSize) { - onStageChanged(SCAN_FINISHED); - return; - } - - if (SCAN_FINISHED == m_stage && !fileSize && !m_isFirstShow) { - onStageChanged(CLEAN_FINISHED); - return; - } -} - -// 通知扫描线程,中断扫描过程 -void TrashCleanResultWidget::stopScan() -{ - if (m_stage == SCAN_STARTED) { - onStageChanged(SCAN_FINISHED); - } -} - -void TrashCleanResultWidget::setWidgetPrepare() -{ - m_headerItem->setTitle(tr("Clean out junk files and free up disk space")); - Q_EMIT prepare(); -} - -void TrashCleanResultWidget::setWidgetScanStart() -{ - // 开始扫描 - // 显示header上logo - // 显示进度条 - // 隐藏所有的配置项与配置区logo - // 显示树结构 - // 显示“正在扫描”旋转 - // 左按键重命名“取消扫描” - m_doneItems = 0; - m_totalSize = 0; - m_totalScannedFiles = 0; - m_showItems = 0; - // 有可能在scanfinish时将按键设为disable - // 此处还原 - - m_headerItem->setLogo(kHeaderScanningIconPath); - - m_leftButton->setVisible(false); - m_rightButton->setVisible(false); - m_cancelScanButton->setVisible(true); - m_cancelScanButton->setDisabled(true); - Q_EMIT notifySetBackForwardBtnStatus(false); - - int i = 0; - int hiddens = 0; - - foreach (auto item, m_scanConfigList) { - if (item != Qt::Unchecked) { - // 开始显示选中的根项和子项窗口 - m_treeWidget->topLevelItem(i)->setHidden(false); - // 默认将项目设为选中状态 - m_rootItems[i]->setConfigToScan(); - Q_EMIT m_rootItems[i]->scanStarted(true); - - m_doneItems++; - m_showItems++; - } else { - // 隐藏未选中的检查项 - hiddens++; - m_treeWidget->topLevelItem(i)->setHidden(true); - m_rootItems[i]->setSelected(false); - } - i++; - } - m_treeWidget->collapseAll(); - - // 选中了配置项,可以开始扫描 - if (hiddens < m_rootItems.size()) { - m_leftButton->setDisabled(true); - m_headerItem->setTip(tr("Initializing")); - - QString scanTimeInfo = tr("Time elapsed %1:%2:%3").arg("00").arg("00").arg("00"); - m_headerItem->setTimeInfo(scanTimeInfo); - QTimer scanTimer; - QDateTime currentTime = QDateTime::currentDateTime(); - connect(&scanTimer, &QTimer::timeout, this, [=] { - QDateTime duration = - QDateTime::fromSecsSinceEpoch(QDateTime::currentDateTime().toSecsSinceEpoch() - - currentTime.toSecsSinceEpoch()) - .toUTC(); - // 格式来自于需求,可能是翻译要求 - m_headerItem->setTimeInfo(tr("Time elapsed %1:%2:%3") - .arg(duration.toString("hh")) - .arg(duration.toString("mm")) - .arg(duration.toString("ss"))); - }); - scanTimer.start(1000); - - m_isCleaned = false; - foreach (auto rootItem, m_rootItems) { - if (rootItem) { - rootItem->removeChildren(); - } - } - - // 从树上移除所有子项目,等待重新插入 - QList childrenItem = - m_treeWidget->topLevelItem(SYS_CHECK_INDEX)->takeChildren(); - childrenItem.append(m_treeWidget->topLevelItem(APP_CHECK_INDEX)->takeChildren()); - childrenItem.append(m_treeWidget->topLevelItem(HISTORY_CHECK_INDEX)->takeChildren()); - childrenItem.append(m_treeWidget->topLevelItem(BROWSER_CACHE_CHECK_INDEX)->takeChildren()); - qDeleteAll(childrenItem.begin(), childrenItem.end()); - childrenItem.clear(); - - // 插入所有子项目 - // 增加调用deb文件相关接口后,有明显的延时 - addChildrenCheckItems(); - - // 仅扩展树的最顶级检查项 - // 在“应用”相关的检查项时,就只会显示到应用名称 - // 如果客户需要详细信息,再双击点开 - // 否则会因内容过多,列表太长,影响体验 - m_treeWidget->expandToDepth(0); - - m_isFirstShow = true; - m_cleanedSize = 0; - m_cleanedAmount = 0; - - Q_EMIT prepare(); - Q_EMIT startWork(); - } else { - onStageChanged(PREPARING); - } -} - -void TrashCleanResultWidget::setWidgetScanFinish() -{ - // 取消扫描 - // 显示扫描完成页面 - // 左按键重命名为“返回” - // 显示右按键,命名“立即清理” - m_leftButton->setVisible(false); - m_cancelScanButton->setVisible(false); - m_rightButton->setVisible(true); - m_rightButton->setText(tr("Clean Up", "button")); - m_headerItem->setLogo(kHeaderScanedIconPath); - // 要求统计所有项目并在界面上写对应信息 - recount(); - - m_isFirstShow = false; - - // 由于在中止扫描的情况下有两次调用setWidgetFinished - // 此处应注意不被上一次调用影响 - m_rightButton->setDisabled(!m_totalSize); - - // 针对无垃圾情况额外处理 - if (!m_totalSize) { - m_cancelScanButton->setVisible(false); - m_leftButton->setDisabled(false); - m_rightButton->setDisabled(false); - m_leftButton->setText(tr("Scan Again", "button")); - m_rightButton->setText(tr("Done", "button")); - m_leftButton->setVisible(true); - m_rightButton->setVisible(true); - m_headerItem->setLogo(kHeaderCleanedIconPath); - m_stage = CLEAN_FINISHED; - } - - if (m_isbScan) { - // 添加安全日志 - m_isbScan = false; - // 添加安全日志 - if (m_dataInterface) { - m_dataInterface->AddSecurityLog(SECURITY_LOG_TYPE_CLEANER, - tr("Scanned: %1 files, junk files: %2") - .arg(m_totalScannedFiles) - .arg(m_lastScannedSize)); - } - } - Q_EMIT notifySetBackForwardBtnStatus(true); -} - -void TrashCleanResultWidget::setWidgetCleanStart() -{ - // 有可能在scanfinish时将按键设为disable - // 此处还原 - m_rightButton->setDisabled(false); - m_cancelScanButton->setVisible(false); - - m_isCleaned = true; - m_leftButton->setText(tr("Cancel", "button")); - m_rightButton->setVisible(false); - - m_doneItems = 0; - m_cleanedSize = 0; - m_cleanedAmount = 0; - foreach (TrashCleanItem *root, m_rootItems) { - if (root) { - // 记录被选中进行清理的项目数 - if (root->isSelected()) { - m_doneItems++; - } - } - } - Q_EMIT startClean(); - - // 添加安全日志 - if (m_dataInterface) { - m_dataInterface->AddSecurityLog(SECURITY_LOG_TYPE_CLEANER, - tr("Removed: %1 junk files").arg(m_lastCleanedSize)); - } -} - -void TrashCleanResultWidget::setWidgetCleanFinish() -{ - // 有可能在scanfinish时将按键设为disable - // 此处还原 - m_rightButton->setDisabled(false); - - m_cancelScanButton->setVisible(false); - m_leftButton->setText(tr("Scan Again", "button")); - m_rightButton->setText(tr("Done", "button")); - m_leftButton->setVisible(true); - m_rightButton->setVisible(true); - m_lastCleanedSize = TrashCleanItem::fileSizeToString(m_cleanedSize); - m_headerItem->setLogo(kHeaderCleanedIconPath); - - QString titleInfo = tr("%1 removed").arg(m_lastCleanedSize); - QString tipInfo = tr("Cleaned: %1 files").arg(m_cleanedAmount); - m_headerItem->setCleanFinished(titleInfo, tipInfo); - if (m_dataInterface) { - m_dataInterface->SetValueToGSettings(CLEANER_LAST_TIME_CLEANED, m_lastCleanedSize); - } - Q_EMIT notifyUpdateLastCleaned(m_lastCleanedSize); -} - -void TrashCleanResultWidget::getScanPathsFromDataInterface() -{ - if (nullptr == m_dataInterface) { - m_trashInfoList.clear(); - m_cacheInfoLIst.clear(); - m_logInfoList.clear(); - m_historyInfoList.clear(); - m_appJsonStr.clear(); - return; - } - - // GetCacheInfoList 可能存在耗时较长的问题 - // 关联的数据获取集中在此处修改 - QFuture future = QtConcurrent::run([&]() { - if (m_scanConfigList[SYS_CHECK_INDEX]) { - m_trashInfoList = m_dataInterface->GetTrashInfoList(); - m_cacheInfoLIst = m_dataInterface->GetCacheInfoList(); - m_logInfoList = m_dataInterface->GetLogInfoList(); - } - - if (m_scanConfigList[APP_CHECK_INDEX]) { - m_appJsonStr = m_dataInterface->GetAppTrashInfoList(); - } - - if (m_scanConfigList[HISTORY_CHECK_INDEX]) { - m_historyInfoList = m_dataInterface->GetHistoryInfoList(); - } - - if (m_scanConfigList[BROWSER_CACHE_CHECK_INDEX]) { - m_cookiesJsonStr = m_dataInterface->GetBrowserCookiesInfoList(); - } - }); - while (!future.isFinished()) { - QApplication::processEvents(); - } -} - -void TrashCleanResultWidget::onCleanFinished() -{ - m_doneItems--; - // 未被选中的根项不会有删除文件的内容,所以不需要判断是否选中 - m_cleanedSize = 0; - m_cleanedAmount = 0; - foreach (auto item, m_rootItems) { - m_cleanedSize += item->cleanedSize(); - m_cleanedAmount += item->cleanedAmount(); - } - // 所有选中项目都已经清理完成 - if (!m_doneItems) { - onStageChanged(CLEAN_FINISHED); - } - m_lastCleanedSize = TrashCleanItem::fileSizeToString(m_cleanedSize); - - QString titleInfo = tr("%1 removed").arg(m_lastCleanedSize); - QString tipInfo = tr("Cleaned: %1 files").arg(m_cleanedAmount); - m_headerItem->setCleanFinished(titleInfo, tipInfo); -} - -void TrashCleanResultWidget::DeleteSpecifiedFiles(const QStringList &paths) -{ - foreach (auto filePath, paths) { - if (filePath.contains(CLEANER_SYSTEM_TRASH_PATH)) { - DTrashManager::instance()->cleanTrash(); - break; - } - } - - if (m_dataInterface) { - m_dataInterface->DeleteSpecifiedFiles(paths); - } -} - -void TrashCleanResultWidget::DeleteSpecifiedAppRecord(const QString &pkgName) -{ - if (m_dataInterface) { - m_dataInterface->DeleteSpecifiedAppUninstallInfo(pkgName); - } -} - -// 代理函数 -TCTableDelegateTree::TCTableDelegateTree(QObject *parent) - : QItemDelegate(parent) -{ -} - -// 重绘操作 -void TCTableDelegateTree::paint(QPainter *painter, - const QStyleOptionViewItem &option, - const QModelIndex &index) const -{ - Q_UNUSED(painter); - Q_UNUSED(option); - Q_UNUSED(index); -} - -void TrashCleanResultWidget::paintEvent(QPaintEvent *event) -{ - if (SCAN_FINISHED == m_stage) { - m_headerItem->setTitle(m_scanResultStr); - } - - QWidget::paintEvent(event); -} diff --git a/deepin-pc-manager/src/window/modules/cleaner/widgets/trashcleanresultwidget.h b/deepin-pc-manager/src/window/modules/cleaner/widgets/trashcleanresultwidget.h deleted file mode 100644 index 7999e0c..0000000 --- a/deepin-pc-manager/src/window/modules/cleaner/widgets/trashcleanresultwidget.h +++ /dev/null @@ -1,208 +0,0 @@ -// Copyright (C) 2019 ~ 2020 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include "src/window/namespace.h" - -#include -#include -#include - -#include -#include - -DWIDGET_BEGIN_NAMESPACE -class DFrame; -class DLabel; -class DSuggestButton; -class DProgressBar; -DWIDGET_END_NAMESPACE - -class CheckItem; -class CleanerItem; -class TrashCleanItem; -class TitleLabel; -class TrashCleanResultHeaderItem; - -namespace def { -namespace widgets { -class SmallLabel; -} -} // namespace def - -class QGSettings; - -class CleanerDBusAdaptorInterface; - -DWIDGET_USE_NAMESPACE - -/* 添加树表代理 */ -class TCTableDelegateTree : public QItemDelegate -{ - Q_OBJECT -public: - explicit TCTableDelegateTree(QObject *parent = nullptr); - - virtual ~TCTableDelegateTree() { } - - // 重绘 - void paint(QPainter *painter, - const QStyleOptionViewItem &option, - const QModelIndex &index) const; -}; - -class TrashCleanResultWidget : public QWidget -{ - Q_OBJECT -public: - /** - * @brief ScanStages 枚举控制该控件页面的显示状态,依次为: - * 检查功能首页 - * 扫描启动 - * 扫描完成 - * 清理启动 - * 清理完成 - */ - enum ScanStages { PREPARING, SCAN_STARTED, SCAN_FINISHED, CLEAN_STARTED, CLEAN_FINISHED }; - - explicit TrashCleanResultWidget(CleanerDBusAdaptorInterface *interfact, - QWidget *parent = nullptr); - ~TrashCleanResultWidget(); - - void processScan(); - void haltScan(); - - void setServerInterface(CleanerDBusAdaptorInterface *); - - inline quint64 GetScanedSize() const { return m_totalSize; } - - inline quint64 GetCleanedSize() const { return m_cleanedSize; } - - inline int GetScanedAcount() const { return m_totalScannedFiles; } - - inline int GetCleanedAcount() const { return m_cleanedAmount; } - - inline ScanStages GetCurrentStage() const { return m_stage; } - - inline void setScanConfigList(const QList &config) { m_scanConfigList = config; } - -protected: - void paintEvent(QPaintEvent *event); - -private: - void initTable(); - void initButtons(); - - void changeStageByLeftButton(); - void changeStageByRightButton(); - void onStageChanged(ScanStages); - - void addRootCheckItems(); - void addSystemChildCheckItems(); - void addAppCheckItems(); - void addUninstalledAppCheckItems(); - void addBrowserCookies(); - void addChildrenCheckItems(); - void - addChildItem(int rootIndex, const QString &title, const QString &tip, const QStringList &paths); - void addChildItem(int rootIndex, - const QString &title, - const QString &pkgName, - const QString &tip, - const QList &paths, - bool isRemained = false); - - void startScan(); - void stopScan(); - void scan(); - - void setWidgetPrepare(); - void setWidgetScanStart(); - void setWidgetScanFinish(); - void setWidgetCleanStart(); - void setWidgetCleanFinish(); - - void getScanPathsFromDataInterface(); - // void setHeadTextWithElidedText(const QString &); - -Q_SIGNALS: - void stageChanged(ScanStages); - void prepare(); - void startWork(); - // void stopWork(); - void stopShowResult(); - void sendScanFinished(); - void showScanResult(); - void showResult(); - void startClean(); - - void notifyBackToGreetingWidget(); - void notifySetBackForwardBtnStatus(bool); - void notifyUpdateLastCleaned(const QString &); - -public Q_SLOTS: - void scanDone(); - void setScanTitleName(const QString &); - void showScanResultFinished(); - void recount(); - void onCleanFinished(); - void DeleteSpecifiedFiles(const QStringList &paths); - void DeleteSpecifiedAppRecord(const QString &pkgName); - -private: - // 记录界面状态 - ScanStages m_stage; - - // 使用的控件 - DPushButton *m_leftButton; - DPushButton *m_cancelScanButton; - DSuggestButton *m_rightButton; - DTreeWidget *m_treeWidget; - - // 检查界面的选项 - QList m_rootItems; - - // 上一次扫描的大小 - QString m_lastScannedSize; - QString m_lastCleanedSize; - - // 记录检查完成数 - int m_doneItems; - int m_showItems; - - // 记录本次扫描垃圾大小 - quint64 m_totalSize; - int m_totalScannedFiles; - quint64 m_cleanedSize; - int m_cleanedAmount; - bool m_isCleaned; - - // 表格代理 - TCTableDelegateTree *m_delegate; - - // 扫描按钮 标志位 - bool m_isbScan; - - // 扫描时间展示 - DLabel *m_scanTime; - CleanerDBusAdaptorInterface *m_dataInterface; - - // 是否扫描后首次显示结果 - bool m_isFirstShow; - - QStringList m_trashInfoList; - QStringList m_cacheInfoLIst; - QStringList m_logInfoList; - QStringList m_historyInfoList; - QString m_appJsonStr; - QString m_cookiesJsonStr; - - QString m_scanResultStr; - TrashCleanResultHeaderItem *m_headerItem; - QList m_scanConfigList; -}; - -DEF_NAMESPACE_END diff --git a/deepin-pc-manager/src/window/modules/common/comdata.h b/deepin-pc-manager/src/window/modules/common/comdata.h deleted file mode 100644 index c21336d..0000000 --- a/deepin-pc-manager/src/window/modules/common/comdata.h +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (C) 2020 ~ 2020 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef COMDATA_H -#define COMDATA_H - -#include - -// 当前扫描处于状态 -enum ScanStatus { - Free = 0, // 空闲状态 - Scanning, // 扫描中 同 CONTINUE - Pausing, // 暂停中 - ResultThreats, //  扫描结果页,有异常 - ResultNoThreats, //  扫描结果页, 无异常 - UsbScanning, // Usb扫描中 - HomePageScanning, // 首页扫描中 - HomePageResult, // 首页扫描结果 - HomePageFixing, // 首页修复中 - VdbUpdating, // 病毒库更新中 -}; - -// 提示框表叫高的几种提示语 -enum TipTextInfo { - TipHomeChecking = 0, // 首页正在体检中 - TipHomeThreats, // 首页有异常但是没有修复 - TipHomeFixing, // 首页异常在修复中 - TipThreatScaning, // 三中扫描方式,右键 在开启扫描页面 - TipUsbScaning, // usb正在扫描中 - TipUpdate, // 更新中 - TipNetWorkEroor, // 网络异常 - TipDefault -}; - -// 提示的左上角图标 -enum TipIcon { - IconNormal = 0, // 常规 安全中心的图标 - IconTip, // 一般提示 浅黄色感叹号 - IconWaring, // 警告 红色感叹号 -}; - -#endif // COMDATA_H diff --git a/deepin-pc-manager/src/window/modules/common/common.cpp b/deepin-pc-manager/src/window/modules/common/common.cpp deleted file mode 100644 index 1054188..0000000 --- a/deepin-pc-manager/src/window/modules/common/common.cpp +++ /dev/null @@ -1,299 +0,0 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "common.h" - -#include "src/window/modules/common/invokers/invokerfactory.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// 汉字方法相关 -const QRegularExpression OnlyNumRegular = QRegularExpression("^[0-9]+$"); - -// desktop文件中deepin经销商关键字 -#define X_DEEPIN_VENDOR_STR "deepin" - -/*! - * \brief wordwrapText,根据指定换行长度向字符串中添加换行符 - * \param font 当前使用的字体 - * \param text 带换行的字符串 - * \param nLabelLenth 指定换行长度 - */ -QString Utils::wordwrapText(const QFontMetrics &font, const QString &text, int nLabelLenth) -{ - int textLenth = font.horizontalAdvance(text); - if (textLenth <= nLabelLenth) - return text; - - QString retStr; - QString lineString; - for (int i = 0; i < text.size(); i++) { - lineString.append(text.at(i)); - long lenthTmp = font.horizontalAdvance( - lineString); // 积累的字符串长度,到达标签长度时重置,并向返回的字符串retStr后添加"\n" - if (nLabelLenth < lenthTmp) { - lineString = lineString.left(lineString.count() - 1); - i--; - lineString.append("\n"); - retStr.append(lineString); - lineString.clear(); - } - } - retStr.append(lineString); - - return retStr; -} - -// 根据流量数据大小改变单位 -QString Utils::changeFlowValueUnit(double input, int prec) -{ - QString flowValueStr; - if (GB_COUNT < input) { - // 单位为GB - flowValueStr = QString::number(input / GB_COUNT, 'd', prec) + "GB"; - } else if (MB_COUNT < input) { - // 单位为MB - flowValueStr = QString::number(input / MB_COUNT, 'd', prec) + "MB"; - } else { - // 单位为KB - flowValueStr = QString::number(input / KB_COUNT, 'd', prec) + "KB"; - } - return flowValueStr; -} - -// 根据网速大小改变单位 -QString Utils::changeFlowSpeedValueUnit(double input, int prec) -{ - QString flowSpeedValueStr; - if (GB_COUNT < input) { - // 单位为GB - flowSpeedValueStr = QString::number(input / GB_COUNT, 'd', prec) + "GB/s"; - } else if (MB_COUNT < input) { - // 单位为MB - flowSpeedValueStr = QString::number(input / MB_COUNT, 'd', prec) + "MB/s"; - } else { - // 单位为KB - flowSpeedValueStr = QString::number(input / KB_COUNT, 'd', prec) + "KB/s"; - } - return flowSpeedValueStr; -} - -QString Utils::formatBytes(qint64 input, int prec) -{ - QString flowValueStr; - if (KB_COUNT > input) { - flowValueStr = QString::number(input / 1.0, 'd', prec) + " B"; - } else if (MB_COUNT > input) { - flowValueStr = - QString::number(input / double(KB_COUNT) + double(input % KB_COUNT) / KB_COUNT, - 'd', - prec) - + " KB"; - } else if (GB_COUNT > input) { - flowValueStr = - QString::number(input / double(MB_COUNT) + double(input % MB_COUNT) / MB_COUNT, - 'd', - prec) - + " MB"; - } else if (TB_COUNT > input) { - flowValueStr = - QString::number(input / double(GB_COUNT) + double(input % GB_COUNT) / GB_COUNT, - 'd', - prec) - + " GB"; - } else { - // 大于TB单位 - flowValueStr = - QString::number(input / double(TB_COUNT) + double(input % TB_COUNT) / TB_COUNT, - 'd', - prec) - + " TB"; - } - return flowValueStr; -} - -// 检查并转换QDbusVariant为QVariant -QVariant Utils::checkAndTransQDbusVarIntoQVar(const QVariant &var) -{ - QDBusVariant qdbusVar = var.value(); - QVariant retVar = qdbusVar.variant(); - if (!retVar.isNull()) { - return retVar; - } - return var; -} - -bool Utils::isChineseChar(const QChar &character) -{ - ushort unicode = character.unicode(); - if (unicode >= 0x4E00 && unicode <= 0x9FFF) { - return true; - } - return false; -} - -PinyinInfo Utils::getPinYinInfoFromStr(const QString &words) -{ - PinyinInfo result; - for (const QChar &singleChar : words) { - QString singlePinyin = Dtk::Core::Chinese2Pinyin(singleChar); - result.normalPinYin.append(singlePinyin); - - // 如果非汉字,则不转换 - if (!isChineseChar(singleChar)) { - result.noTonePinYin.append(singleChar); - result.simpliyiedPinYin.append(singleChar); - continue; - } - // 无声调拼音 - QString singleNoTonePinyin; - // 去除声调 - for (const QChar &singlePinyinChar : singlePinyin) { - QRegularExpressionMatch match = OnlyNumRegular.match(singlePinyinChar, 0); - if (match.hasMatch()) { - continue; - } - singleNoTonePinyin.append(singlePinyinChar); - } - result.noTonePinYin.append(singleNoTonePinyin); - - // 首字母 - result.simpliyiedPinYin.append(singlePinyin.front()); - } - - return result; -} - -// 显示普通系统通知信息 -bool Utils::showNormalNotification(DBusInvokerInterface *notifInter, const QString &msg) -{ - QString name = "deepin-pc-manager"; - uint id = 0; - QString themeIconName = "deepin-pc-manager"; - QString abstract = ""; - QString content = msg; - QStringList btnInfoList; - QVariantMap cmdMapOfBtn; - int timeout = 3000; // ms - - QDBusMessage dbusMsg = DBUS_NOBLOCK_INVOKE(notifInter, - "Notify", - name, - id, - themeIconName, - abstract, - content, - btnInfoList, - cmdMapOfBtn, - timeout); - - if (QDBusMessage::MessageType::ErrorMessage == dbusMsg.type() - || QDBusMessage::MessageType::InvalidMessage == dbusMsg.type()) { - qDebug() << Q_FUNC_INFO << "notified error" << dbusMsg.errorMessage(); - return false; - } - - return true; -} - -QString Utils::getAppNameFromDesktop(const QString &desktopPath) -{ - QString appName; - QString sysLanguage = QLocale::system().name(); - QString sysLanguagePrefix = sysLanguage.split("_").first(); - - // 是否为界面应用 - QSettings readIniSettingMethod(desktopPath, QSettings::Format::IniFormat); - QTextCodec *textCodec = QTextCodec::codecForName("UTF-8"); - readIniSettingMethod.setIniCodec(textCodec); - readIniSettingMethod.beginGroup("Desktop Entry"); - // 应用名称 - QString xDeepinVendor = readIniSettingMethod.value("X-Deepin-Vendor").toString(); - if (X_DEEPIN_VENDOR_STR == xDeepinVendor) { - appName = - readIniSettingMethod.value(QString("GenericName[%1]").arg(sysLanguage)).toString(); - // 如果没获取到语言对应的应用名称,则获取语言前缀对应的应用名称 - if (appName.isEmpty()) { - appName = readIniSettingMethod.value(QString("GenericName[%1]").arg(sysLanguagePrefix)) - .toString(); - } - } else { - appName = readIniSettingMethod.value(QString("Name[%1]").arg(sysLanguage)).toString(); - // 如果没获取到语言对应的应用名称,则获取语言前缀对应的应用名称 - if (appName.isEmpty()) { - appName = - readIniSettingMethod.value(QString("Name[%1]").arg(sysLanguagePrefix)).toString(); - } - } - - if (appName.isEmpty()) { - appName = readIniSettingMethod.value("Name").toString(); - } - - return appName; -} - -QFont Utils::getFixFontSize(int nSize) -{ - QFont f; - f.setPixelSize(nSize); - return f; -} - -void Utils::unbindDWidgetFont(QWidget *w) -{ - Dtk::Widget::DFontSizeManager::instance()->unbind(w); -} - -void Utils::setWidgetFontPixSize(QWidget *w, int nSize) -{ - QFont f = w->font(); - f.setPixelSize(nSize); - w->setFont(f); -} - -void Utils::setWidgetFontBold(QWidget *w, bool bold) -{ - QFont f = w->font(); - f.setBold(bold); - w->setFont(f); -} - -bool Utils::judgeIsSysAppFromDesktop(const QString &desktopPath) -{ - // 获取执行路径 - QSettings readIniSettingMethod(desktopPath, QSettings::Format::IniFormat); - readIniSettingMethod.beginGroup("Desktop Entry"); - QString execPath = readIniSettingMethod.value("Exec").toString(); - readIniSettingMethod.endGroup(); - - // 判断是否是系统应用 - return judgeIsSysAppByExecPath(execPath); -} - -bool Utils::judgeIsSysAppByExecPath(const QString &execPath) -{ - // 判断是否是系统应用 - bool isbSysApp = true; - if (execPath.contains("/opt/")) { - isbSysApp = false; - } - // android 也判定为第三方应用,非系统应用 - if (execPath.contains("android")) { - isbSysApp = false; - } - - return isbSysApp; -} diff --git a/deepin-pc-manager/src/window/modules/common/common.h b/deepin-pc-manager/src/window/modules/common/common.h deleted file mode 100644 index a5f7bd3..0000000 --- a/deepin-pc-manager/src/window/modules/common/common.h +++ /dev/null @@ -1,378 +0,0 @@ -// Copyright (C) 2017 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include - -#include -#include -#include -#include - -DCORE_USE_NAMESPACE - -// 文件大小单位,以b为基本单位 -#define KB_COUNT (1 << 10) -#define MB_COUNT (1 << 20) -#define GB_COUNT (1 << 30) -#define TB_COUNT (long(1) << 40) - -// 用于添加accessname -#define ACCNAMESTR(content) #content -#ifdef QT_DEBUG -#define SET_ACCESS_NAME(control, className, name) \ - control->setAccessibleName(ACCNAMESTR(className##_##name)); -#else -#define SET_ACCESS_NAME(control, className, name) control->setAccessibleName(ACCNAMESTR(name)); -#endif -// 系统更新标志 -enum UpdatesStatus { UpdateDefault = 0, - Checking, - DeependenciesBrokenError, - CheckUpdatesFailed }; - -// 主题类型 -enum ColorType { UnknownType, - LightType, - DarkType }; - -// 病毒库离线导入错误状态 -enum VirusImportError { - VirusImportSuccessed = 0, - VirusImportFailed, - VirusVersionVeryLow, - AkImportSuccessed, - AkImportFailed, - AkVersionVeryLow, - RisingImportSuccessed, - RisingImportFailed, - RisingVersionVeryLow -}; - -// 定时扫描时间类型 -enum ScheduleScanTimeType { - Everyday = 0, // 每天 - Everyweek, // 每周 - Everymonth, // 每月 - CustomizeType // 自定义 -}; - -const QSize Q_IconSize(28, 28); - -// 登录密码安全级别枚举 -enum PwdLimitLevel { Low = 1, - Medium, - High }; - -// 不同类型对应的密码修改提醒时间 -#define PWD_CHANGE_DEADLINE_OF_TYPE_ONE 30 -#define PWD_CHANGE_DEADLINE_OF_TYPE_TWO 60 -#define PWD_CHANGE_DEADLINE_OF_TYPE_THREE 90 -#define PWD_CHANGE_DEADLINE_OF_TYPE_FOUR 120 -#define PWD_CHANGE_DEADLINE_OF_TYPE_FIVE 150 -#define PWD_CHANGE_DEADLINE_OF_TYPE_SIX 180 -#define PWD_CHANGE_DEADLINE_OF_TYPE_SEVEN 0 - -// 登录密码安全级别枚举 -enum SystemLevelSynType { TrustFile = 0, - FireWall, - SystemMonitor }; - -#define ARCH_AMD "x86_64" // AMD平台 -#define ARCH_ARM "aarch64" // ARM平台 -#define ARCH_MIPS "mips64" // MIPS平台 -#define ARCH_SW "sw_64" // SW平台 -#define ARCH_LOONGARCH "loongarch64" // LOONGARCH平台 - -// 安全中心右上角基础设置与安全设置名称 -#define SETTING_JSON ":/dt-settings.json" // 获取文件配置 -#define SETTING_BASE_VIRUS_ENGIN "base.virus_engin.virus_engin_type" // 病毒引擎设置 -#define SETTING_BASE_CLOSE_WINDOW "base.close_window.close_window_type" // 关闭主窗口设置 -#define SETTING_SAFETY_USB_STORAGE_DEVICES \ - "safety.usb_storage_devices.usb_storage_devices_type" // USB存储设备设置 - -// 设置窗口的json key -#define SETTING_CLOSE_WINDOW_TYPE "close_window_type" // 关闭窗口类型 -#define SETTING_USB_STORAGE_DEVICES_TYPE "usb_storage_devices_type" // USB存储设备类型 - -// caitao/2020.6.19 define global properties -// 主窗口对象名称 -#define MAIN_WINDOW_OBJ_NAME "mainWindow" - -// 各模块名称 -#define MODULE_HOMEPAGE_NAME "homepage" // 主页名称 -#define MODULE_DISK_CLEANER_NAME "diskcleaner" // 磁盘清理名称 -#define MODULE_SECURITY_TOOLS_NAME "securitytools" // 安全工具名称 - -// system safety modules' index -#define LOGIN_SECURITY_INDEX 0 // login security index -#define SCREEN_SECURITY_INDEX 1 // screen security index -#define UPDATE_POLICY_INDEX 2 // updating policy index -#define USB_CONNECTION_INDEX 3 // usb connection index - -// 系统工具各模块索引 -#define DATA_USAGE_INDEX 1 // 流量详情索引 -#define STARTUP_CONTROL_INDEX 2 // 自启动管理索引 -#define NET_CONTROL_INDEX 3 // 网络权限控制索引 -#define USB_CONN_INDEX 4 // usb管控索引 -#define LOGIN_SAFETY_INDEX 5 // 登录安全索引 -#define TRUSTED_PROTECTION_INDEX 6 // 可信保护索引 - -// 系统工具各模块名称 -#define DATA_USAGE_NAME "data-usage" // 流量详情名称 -#define STARTUP_CONTROL_NAME "startup-control" // 自启动管理名称 -#define NET_CONTROL_NAME "network-control" // 网络权限控制名称 -#define USB_CONN_NAME "usb-control" // usb控制名称 -#define LOGIN_SAFETY_NAME "login-safety" // 登录安全名称 -#define TRUSTED_PROTECTION_NAME "trusted-protection" // 可信保护索引 - -// 时间跨度类型 -enum TimeRangeType { None = 0, - Today, - Yesterday, - ThisMonth, - LastMonth }; - -// 联网状态 -#define NET_STATUS_ITEMASK 0 // 询问 -#define NET_STATUS_ITEMALLOW 1 // 允许 -#define NET_STATUS_ITEMDISALLOW 2 // 禁止 - -// 垃圾清理 -#define CLEANER_SYSTEM_TRASH_PATH "/.local/share/Trash/files" // 回收站路径 -#define CLEANER_SYSTEM_LOG_PATH "/var/log" // 系统日志 -#define CLEANER_SYSTEM_CACHE_APT_PATH "/var/cache/apt/archives" // 系统缓存 -// 1040集成,接口方修改了JSON内容 -#define CLEANER_SYSTEM_CACHE_LASTORE_PATH "/var/cache/lastore/archives" // 系统缓存 -#define CLEANER_SYSTEM_CACHE_ARRAY_NAME "files" -#define CLEANER_SYSTEM_CACHE_DEB_NAME "name" -#define CLEANER_SYSTEM_TEMP_PATH "/tmp" -#define CLEANER_SYSTEM_HISTORY_PATH "/.bash_history" - -#define CLEANER_APP_JSON_NAME "appArray" -#define CLEANER_APP_COM_NAME "comName" -#define CLEANER_APP_NAME "appName" -#define CLEANER_APP_TIP "appTip" -#define CLEANER_APP_ID "appID" -#define CLEANER_APP_CACHE_PATH "appCachePath" -#define CLEANER_APP_CONFIG_PATH "appConfigPath" -#define CLEANER_APP_INSTALL_FLAG "appInstallFlag" -#define CLEANER_APP_WHITE_LIST "appWhiteList" -#define CLEANER_APP_BLACK_LIST "appBlackList" -#define CLEANER_BROWSER_JSON_NAME "browserCookiesArray" -#define CLEANER_BROWSER_COOKIES_PATH "cookiesPath" - -#define MIN_SCAN 20 // 最小扫描 -#define MAX_SCAN 5120 // 最大扫描 -#define TIP_DIALOG_WIDTH 380 // 提示dialog宽度 -#define TIP_DIALOG_HEIGHT 145 // 提示dialog高度 - -// 安全日志类型 -#define SECURITY_LOG_TYPE_ALL 0 -#define SECURITY_LOG_TYPE_HOME 1 -#define SECURITY_LOG_TYPE_ANTIAV 2 -#define SECURITY_LOG_TYPE_PROTECTION 3 -#define SECURITY_LOG_TYPE_CLEANER 4 -#define SECURITY_LOG_TYPE_TOOL 5 -#define SECURITY_LOG_TYPE_BASIC 6 -#define SECURITY_LOG_TYPE_SAFY 7 -#define SECURITY_LOG_TYPE_FIRE 8 -#define SECURITY_LOG_MAX 9 - -// 日期 -#define LAST_DATE_NOW 0 -#define LAST_DATE_THREE 1 -#define LAST_DATE_SEVEN 2 -#define LAST_DATE_MONTH 3 - -// 系统安全等级 -#define SYSTEM_SAFE_LEVEL_LOW 0 -#define SYSTEM_SAFE_LEVEL_MID 1 -#define SYSTEM_SAFE_LEVEL_HIGH 2 -#define SYSTEM_SAFE_LEVEL_SECADM_NAME "secadm" -#define SYSTEM_SAFE_LEVEL_STATUS_OPEN "open" -#define SYSTEM_SAFE_LEVEL_STATUS_OPENING "opening" -#define SYSTEM_SAFE_LEVEL_STATUS_CLOSE "close" -#define SYSTEM_SAFE_LEVEL_STATUS_CLOSING "closing" -// 系统安全等级服务状态 -#define SYSTEM_SAFE_LEVEL_SRV_STATUS_ABNORMAL 0 -#define SYSTEM_SAFE_LEVEL_SRV_STATUS_NORMAL 1 -#define SYSTEM_SAFE_LEVEL_SRV_STATUS_BUSY 2 - -// 病毒库架构 -#define VIRUS_LIBRARY_ARCH_AMD "x86_64" -#define VIRUS_LIBRARY_ARCH_ARM "aarch64" -#define VIRUS_LIBRARY_ARCH_MIPS "mips64" -#define VIRUS_LIBRARY_ARCH_SW "sw_64" -#define VIRUS_LIBRARY_ARCH_LOONGARCH "loongarch64" - -// USB扫描相关 -#define USB_SCAN_RESULT_DEAL_TYPE_AUTO_ISOLATE 1 -#define USB_SCAN_RESULT_DEAL_TYPE_ASK 0 - -#define LOCAL_LANGUAGE_US "en_US" -#define LOCAL_LANGUAGE_CN "zh_CN" -#define LOCAL_LANGUAGE_HK "zh_HK" -#define LOCAL_LANGUAGE_TW "zh_TW" - -// 缓存数据地址 -#define DEFENDER_LOCAL_CACHE_DB_PATH "/usr/share/deepin-pc-manager/localcache.db" -// 数据库相关 -#define DEFENDER_DATA_DIR_PATH "/usr/share/deepin-pc-manager/" // 数据库路径 -#define LOCAL_CACHE_DB_NAME "localcache.db" // 数据库路径 - -// 公共dbus接口类 -#define DBUS_PROPERTY_INVOKER_NAME "dbusPropertyInvoker" // 公共dbus接口属性获取识别 - -// 系统类型 -const DSysInfo::UosType SystemType = DSysInfo::uosType(); -const DSysInfo::UosEdition SystemEditionType = DSysInfo::uosEditionType(); - -// usb管控相关结构体和宏定义 -#define SUBSYSTEM "usb" -// 全部允许/允许白名单/全部禁止 -#define USB_LIMIT_MODEL_ALL "0" -#define USB_LIMIT_MODEL_PARTY "1" -#define USB_LIMIT_MODEL_ZERO "2" -// 配置目录 -#define USB_CONTROL_CONFIG_DIR "/usr/share/deepin-pc-manager/config/" -// 配置文件名 -#define CONFIG_FILE_NAME "usbconnectionconfig.ini" -// 连接记录备份文件名 -#define USB_CONNECTION_LOG_BAK_FILE_NAME "usbconnection.log.bak" -// 连接记录文件名 -#define USB_CONNECTION_LOG_FILE_NAME "usbconnection.log" -// 白名单备份文件名 -#define USB_WHITELIST_BAK_FILE_NAME "usbconnectionwhitelist.list.bak" -// 白名单文件名 -#define USB_WHITELIST_FILE_NAME "usbconnectionwhitelist.list" - -struct UsbDeviceInfo { - QString sProduct; // 产品型号 - QString sSerial; // 序列号 - QString sIdVendor; // 生产商ID - QString sIdProduct; // 产品ID - QString sInterfaceClass; // 接口类型 - QString sBusnum; // bus总线序号 - QString sDevNum; // 设备序号 - QString sSysPath; // /sys/ 下路径 - QString sDevPath; // 设备device路径,与sSysPath一致 - QString sSubSystem; // 子系统 - QString sDevType; // 设备类型 - QString sDevNode; // 设备节点 - QString sLabel; // 分区标签 - bool isMtp; // 是否为mtp - bool isPtp; // 是否为相册设备 - QString sParentSize; // 父设备大小 - QString sSize; // 分区大小 - QString fsType; // 文件系统类型 - - UsbDeviceInfo() - { - isMtp = false; - isPtp = false; - } -}; - -struct BlkInfo { - QString type; - QString parentDevPath; - QString devPath; - QString mountPoint; - QString canRemove; -}; - -// usb连接日志信息结构 -struct UsbConnectionInfo { - QString sName; - QString sDatetime; - QString sStatus; - QString sId; - QString sSerial; - QString sVendorID; - QString sProductID; - QString sParentSize; // 父设备大小 - QString sSize; // 分区大小 -}; - -// 拼音信息 -struct PinyinInfo { - QString normalPinYin; - QString noTonePinYin; - QString simpliyiedPinYin; -}; - -// 硬件检测结果 -enum ServiceResult { - ServiceBlock = 0, - NoFound, - CheckSucessed -}; - -// 网络设置检测结果 -enum NetSettingResult { - NoNetConn = 0, - NetSettingSkip, - NetSettingCheckFailed, - NetSettingCheckSucessed -}; - -// DHCP检测结果 -enum DHCPResult { - DHCPCheckFailed = 0, - DHCPCheckSucessed -}; - -// DNS检测结果 -enum DNSResult { - DNSCheckError = 0, - DNSCheckAbnormal, - DNSCheckSucessed -}; - -// host检测结果 -enum HostResult { - HostCheckFailed = 0, - HostCheckSucessed -}; - -// 网络连接访问结果 -enum NetConnResult { - NetConnFailed = 0, - NetConnSucessed -}; - -class DBusInvokerInterface; - -namespace Utils { -// 字符换行 -QString wordwrapText(const QFontMetrics &font, const QString &text, int nLabelSize); -// 根据流量数据大小改变单位 -QString changeFlowValueUnit(double input, int prec); -// 根据网速大小改变单位 -QString changeFlowSpeedValueUnit(double input, int prec); - -// 改变文件大小单位,以byte为基准 -QString formatBytes(qint64 input, int prec); -// 检查并转换QDbusVariant为QVariant -QVariant checkAndTransQDbusVarIntoQVar(const QVariant &var); -// 判断是否为汉字 -bool isChineseChar(const QChar &character); -// 字符串转拼音 -PinyinInfo getPinYinInfoFromStr(const QString &words); -// 显示普通系统通知信息 -bool showNormalNotification(DBusInvokerInterface *notifInter, const QString &msg); -// 从desktop文件中获得应用名称 -QString getAppNameFromDesktop(const QString &desktopPath); -QFont getFixFontSize(int nSize); -void unbindDWidgetFont(QWidget *w); -void setWidgetFontPixSize(QWidget *w, int nSize); -void setWidgetFontBold(QWidget *w, bool bold = true); -// 根据执行路径判断是否是系统应用 -bool judgeIsSysAppByExecPath(const QString &execPath); -// 从desktop文件中判断是否是系统应用 -bool judgeIsSysAppFromDesktop(const QString &desktopPath); -} // namespace Utils diff --git a/deepin-pc-manager/src/window/modules/common/compixmap.h b/deepin-pc-manager/src/window/modules/common/compixmap.h deleted file mode 100644 index 0df7aca..0000000 --- a/deepin-pc-manager/src/window/modules/common/compixmap.h +++ /dev/null @@ -1,119 +0,0 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef COMPIXMAP_H -#define COMPIXMAP_H - -#pragma once - -#include - -/*********************公共图标****************************/ -#define ICON_SEARCH "search" // 搜索图标 -#define ICON_ANIMATED_LINE_EDIT_GLOWING "def_animated_line_edit_glowing" // 编辑框动画 -#define ICON_WARNING "def_warning" // 警告图标 - -/*********************提示框****************************/ -#define DIALOG_TIP_YELLOW "dcc_login_tip" // 提示框---黄色感叹号 -#define DIALOG_TIP_RED "dcc_warning" // 提示框---红色感叹号 -#define DIALOG_WARNING_TIP_RED "dcc_warning_tip" // 提示框---红色感叹号(小图片) -#define DIALOG_CARE_TIP_YELLOW "dcc_care_tip" // 提示框---黄色感叹号(小图片) -#define DIALOG_OK_TIP_GREEN "dcc_ok_tip" // 提示框---绿色感叹号(小图片) -#define DIALOG_DEFENDER "deepin-defender" // 提示框---安全中心 -#define DIALOG_PC_MANAGER "deepin-pc-manager" // 提示框---电脑管家 - -/********************导航栏*****************************/ -#define HOMEPAGE_MODEL_LIGHT "dcc_home" // 首页模块--浅色 -#define HOMEPAGE_MODEL_DARK "dcc_home_dark" // 首页模块--深色 -#define HOMEPAGE_ANTIVIRUS_LIGHT "dcc_virus_scan" // 病毒查杀模块--浅色 -#define HOMEPAGE_ANTIVIRUS_DARK "dcc_Virus_Scan_dark" // 病毒查杀模块--深色 -#define ICON_MODULE_ICON_FIREWALL "dcc_network_protection" // 防火墙 -#define ICON_MODULE_ICON_DARK_FIREWALL "dcc_network_protection_dark" // 防火墙 -#define HOMEPAGE_CLEAR_LIGHT "dcc_cleanup" // 垃圾清理模块--浅色 -#define HOMEPAGE_CLEAR_DARK "dcc_cleanup_dark" // 垃圾清理模块--深色 -#define HOMEPAGE_SECURITY_LIGHT "dcc_application_security" // 安全防护模块--浅色 -#define HOMEPAGE_SECURITY_DARK "dcc_application_security_dark" // 安全防护模块--深色 -#define HOMEPAGE_TOOL_LIGHT "dcc_tools" // 安全工具模块--浅色 -#define HOMEPAGE_TOOL_DARK "dcc_tools_dark" // 安全工具模块--深色 - -/********************首页体检*****************************/ -#define HOMEPAGE_DEEPIN_LIGHT "dcc_Home_deepin_image" // 首页 deepin--浅色 -#define HOMEPAGE_DEEPIN_DARK "dcc_Home_deepin_image_dark" // 首页 deepin--深色 -#define HOMEPAGE_UOS_LIGHT "dcc_home_image_oem" // 首页 UOS--浅色 -#define HOMEPAGE_UOS_DARK "dcc_home_image_oem_dark" // 首页 UOS--深色 -#define CHECK_ITEM_ABNORMAL "dcc_home_restore" // 修复结果异常 -#define CHECK_ITEM_NORMAL "dcc_home_normal" // 修复结果正常 -#define CHECK_ITEM_ANTIVIRUS "def_trojan_virus" // 病毒查杀体检项 标题图片 -#define CHECK_ITEM_VIRUS_LIB_VER "def_virus_reservoir" // 病毒库体检项 标题图片 -#define CHECK_ITEM_AUTO_START "def_self_starting" // 自启动项 标题图片 -#define CHECK_ITEM_SSH "def_rdp_port" // 远程访问端口 标题图片 -#define CHECK_ITEM_SYS_UPDATE "def_system_upgrade" // 系统更新 标题图片 -#define CHECK_ITEM_CLEANER "def_garbage" // 垃圾清理 标题图片 -#define CHECK_ITEM_DISK_CHECK "def_disk" // 磁盘检测 标题图片 -#define CHECK_ITEM_ROOT_MODE "def_developers" // 开发者模式 标题图片 - -/*******************病毒查杀*********************/ -#define VIRUS_HOME_PAGE "dcc_virus_home_page" // 病毒查杀首页图标 -#define VIRUS_CHECK_UPDATE "dcc_virus_check_update" // 病毒查杀检查更新图标 -#define VIRUS_UPDATE "dcc_virus_update" // 病毒查杀更新图标 -#define ANTIAV_LOG_LIGHT "dcc_antiav_scanLogs" // 病毒扫描日志图标--浅色 -#define ANTIAV_LOG_DARK "dcc_antiav_scanLogs_dark" // 病毒扫描日志图标--深色 -#define ANTIAV_QUARANTINE_LIGHT "dcc_antiav_quarantine" // 隔离区图标--浅色 -#define ANTIAV_QUARANTINE_DARK "dcc_antiav_quarantine_dark" // 隔离区图标--深色 -#define ANTIAV_TRUST_LIGHT "dcc_antiav_whitelist" // 信任区图标--浅色 -#define ANTIAV_TRUST_DARK "dcc_antiav_whitelist_dark" // 信任区图标--深色 -#define ANTIAV_WHITELIST_LIGHT "def_Icon_Whitelist" // 白名单图标--浅色 -#define ANTIAV_LOG_DETAIL_LIGHT "dcc_natiav_log_details" // 日志详情--浅色 -#define ANTIAV_LOG_DETAIL_DARK "icon_log_details_dark" // 日志详情--深色 -#define ANTIAV_OPERATION_SUCCESS "dcc_antiav_normal" // 操作状态操作成功以后 -#define ANTIAV_RISING_LOG "dcc_rising_logo" // 瑞星log -#define ANTIAV_AH_LOG "dcc_Ahprotector_log" // 安恒log -#define UPDATE_VERSION_ICON "dcc_update_version" // 更新图标图标 -#define WHITE_GARBAGE_ICON "def_delete" // 白名单删除图标 -#define SCHEDULE_ICON "icon_schedulescan" // 定时扫描图标 -#define USBSCAN_ICON "icon_usbscan" // USB扫描图标 -#define SCANSETTING_ICON "icon_scansetting" // 扫描设置图标 -#define SCANSETTING_LIGHT_ICON "icon_scansetting_light" // 扫描设置图标 -#define SCANSETTING_DARK_ICON "icon_scansetting_dark" // 扫描设置图标 - -/*******************安全工具********************/ -#define DATA_USAGE_ICON "def_data_usage" // 流量管理 -#define START_PROGRAMS_ICON "def_startup_programs" // 启动项管理 -#define INTERNET_CONTROL_ICON "def_internet_control" // 联网应用 -#define USB_CONTROL_ICON "def_usb_connection" // usb管控图标 -#define SYSTEM_SAFE_LEVEL_ICON "def_system_safe_level" // 系统安全登记图标 -#define FILE_TRUST_PROTECTION_ICON "def_file_trust_protection" // 可信保护图标 -#define USB_CONTROL_CONNECTED_ICON "dcc_startup_enable" // usb设备已连接 -#define USB_CONTROL_LIMITED_ICON "dcc_startup_disable" // usb设备被限制连接 -#define USB_CONTROL_DETAIL_DLG_ICON "def_usb_storage_detail_dlg" // usb白名单详情弹框图标 -#define USB_CONTROL_DETAIL_ICON "def_usb_storage_detail" // usb白名单详情 -#define USB_CONTROL_ADD_ICON "def_usb_storage_add_whitelist" // usb白名单移除 -#define USB_CONTROL_REMOVE_ICON "def_usb_storage_remove_whitelist" // usb白名单移除 -#define SECURITYLEVEL_NOTICE_ICON "def_securitylevel_privilege" // 三权分立问号图标 -#define FILE_NET_CHECK_ICON "def_net_check" // 网络检测图标 - -// 登陆安全 -#define LOGIN_SAFETY_ICON "def_login_safety" // 流量管理 -#define LOGIN_SAFETY_LEVEL_SELECTED "def_select" // 登陆安全等级项选中 -/*******************垃圾清理*******************/ -#define TRASH_CLEAN_HEADER_LOGO "dcc_cleaner_header_logo" // 垃圾清理标题LOGO -#define TRASH_CLEAN_CONFIG_BIG_LOGO_DARK "dcc_cleaner_big_logo_dark" // 垃圾清理配置LOGO -#define TRASH_CLEAN_CONFIG_BIG_LOGO_LIGHT "dcc_cleaner_big_logo" // 垃圾清理配置LOGO - -/*******************防火墙*******************/ -#define ICON_FIREWALL_MODE_PUBLIC "def_firewall_mode_public" -#define ICON_FIREWALL_MODE_PRIVATE "def_firewall_mode_private" -#define ICON_FIREWALL_MODE_CUSTOMIZED "def_firewall_mode_customized" -#define ICON_ARROW_RIGHT "def_arrow_right" -#define ICON_FIREWALL_POLICY_ENABLE "def_firewall_policy_enable" -#define ICON_FIREWALL_POLICY_DISABLE "def_firewall_policy_disable" -#define ICON_FIREWALL "firewall" - -/*******************系统安全等级*******************/ -#define ICON_SYS_SEC_LEVEL_LOGO "System_security_level" -#define ICON_SYS_SEC_LEVEL_HIGH "dcc_system_level_high" -#define ICON_SYS_SEC_LEVEL_MEDIUM "dcc_system_level_medium" -#define ICON_SYS_SEC_LEVEL_LOW "dcc_system_level_low" - -#endif // COMPIXMAP_H diff --git a/deepin-pc-manager/src/window/modules/common/database/defenderdatabaseoperationbase.cpp b/deepin-pc-manager/src/window/modules/common/database/defenderdatabaseoperationbase.cpp deleted file mode 100644 index a56f134..0000000 --- a/deepin-pc-manager/src/window/modules/common/database/defenderdatabaseoperationbase.cpp +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "defenderdatabaseoperationbase.h" - -#include -#include -#include -#include - -// 固定逻辑 -// 特殊处理或错误判断请重写InitDataBase -DefenderDatabaseOperationBase::DefenderDatabaseOperationBase(QObject *parent) - : QObject(parent) - , m_isInited(false) -{ -} - -DefenderDatabaseOperationBase::~DefenderDatabaseOperationBase() -{ - if (m_db.isOpen()) { - m_query.finish(); - m_db.close(); - } -} - -bool DefenderDatabaseOperationBase::init() -{ - if (!initDataBase() || tableName().isEmpty()) { - return false; - } - m_isInited = true; - - // 检查表是否存在 - QString checkTableExistCmd = "SELECT name FROM sqlite_master " - "WHERE type='table' " - "AND name = '%1'"; - checkTableExistCmd = checkTableExistCmd.arg(tableName()); - // m_query为私有而且不计划改为protect - // 所以在此处单独处理 - if (!executeQuery(checkTableExistCmd)) { - m_isInited = false; - return m_isInited; - } - QString name; - if (m_query.first()) { - name = m_query.value(0).toString(); - } - // 结束查询防止锁数据库 - m_query.finish(); - - // 表不存在时创建 - if (name.isEmpty()) { - if (!createTable()) { - m_isInited = false; - return m_isInited; - } - } - return m_isInited; -} - -bool DefenderDatabaseOperationBase::initDataBase() -{ - // 初始化数据库 - QDir defenderDataDir; - if (!defenderDataDir.exists(DEFENDER_DATA_DIR_PATH)) { - defenderDataDir.mkdir(DEFENDER_DATA_DIR_PATH); - } - - if (QSqlDatabase::contains(connectName())) { - m_db = QSqlDatabase::database(connectName()); - } else { - m_db = QSqlDatabase::addDatabase("QSQLITE", connectName()); - } - - QString path = getDBPath(); - if (path.isEmpty()) { - return false; - } - m_db.setDatabaseName(path); - - if (!m_db.isValid()) { - qDebug() << path << "-" - << "db not valid error!"; - return false; - } - - if (!m_db.open()) { - qDebug() << path << "-" - << "db open error!"; - return false; - } - m_query = QSqlQuery(m_db); - - return true; -} - -bool DefenderDatabaseOperationBase::executeQuery(const QString &cmd) -{ - if (!m_isInited) { - return false; - } - return m_query.exec(cmd); -} - -// 私有方法不是使用父类使有变量,所以在此方法外判断是否初始化成功 -void DefenderDatabaseOperationBase::sendResult(int cmdType, QSqlQuery &query) -{ - Q_UNUSED(cmdType); - Q_UNUSED(query); - - // 增加信号处理到下面 - // switch(cmdType) - return; -} - -// 注意 增 删 改,均无返回 -// 仅查询或某些功能性语句会有返回结果 -void DefenderDatabaseOperationBase::executeCmd(int commandID, const QVariantList ¶ms) -{ - if (!m_isInited) { - return; - } - // 参数校验 - QString cmd = formatCmd(commandID, params); - - if (cmd.isEmpty()) { - return; - } - - if (executeQuery(cmd)) { - sendResultSignal(commandID); - } else { - QSqlError err = m_query.lastError(); - QString errInfo = err.text(); - qDebug() << "executeCmd query failed : " << errInfo; - } -} - -// 子类重写,自行组装sql命令 -QString DefenderDatabaseOperationBase::formatCmd(int cmdType, const QVariantList ¶ms) -{ - Q_UNUSED(cmdType); - Q_UNUSED(params); - return ""; -} - -// 子类重写 -// 根据命令ID触发不同的自定义信号 -// 从m_query中获取所需数据 -void DefenderDatabaseOperationBase::sendResultSignal(int cmdType) -{ - if (!m_isInited) { - return; - } - sendResult(cmdType, m_query); - m_query.finish(); - return; -} - -// 创建连接名 -QString DefenderDatabaseOperationBase::connectName() -{ - if (m_connName.isEmpty()) { - m_connName = QUuid::createUuid().toString(); - } - return m_connName; -} - -// 返回db文件的保存位置 -QString DefenderDatabaseOperationBase::getDBPath() -{ - return QString("%1%2").arg(DEFENDER_DATA_DIR_PATH).arg(LOCAL_CACHE_DB_NAME); -} - -// 子类重写方法 -QString DefenderDatabaseOperationBase::tableName() -{ - return ""; -} - -// 检查表是否存在,否则创建表 -bool DefenderDatabaseOperationBase::createTable() -{ - return false; -} diff --git a/deepin-pc-manager/src/window/modules/common/database/defenderdatabaseoperationbase.h b/deepin-pc-manager/src/window/modules/common/database/defenderdatabaseoperationbase.h deleted file mode 100644 index 121b84a..0000000 --- a/deepin-pc-manager/src/window/modules/common/database/defenderdatabaseoperationbase.h +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef DEFENDER_DATABASE_OPERATION_BASE_H -#define DEFENDER_DATABASE_OPERATION_BASE_H - -#include "src/window/modules/common/common.h" - -#include -#include -#include -#include -#include - -// 非线程安全 -// 不要跨线程使用 -class DefenderDatabaseOperationBase : public QObject -{ - Q_OBJECT -public: - explicit DefenderDatabaseOperationBase(QObject *parent = nullptr); - virtual ~DefenderDatabaseOperationBase(); - - // database构造与初始化 - bool init(); - // 执行ID指向的命令 - void executeCmd(int commandID, const QVariantList & = {}); - // 结果输出 - void sendResultSignal(int); - -Q_SIGNALS: - // 派生类自定义信号以返回查询结果 - // 自定义数据结构不要使用MAP,会排序改变输入 - // 信号参数封装成QVariantList以提高泛用性 - // 调用者自行解析数据 - -protected: - bool executeQuery(const QString &); - // 数据库初始化 - virtual bool initDataBase(); - // 提供默认的自动生成连接名,但是也允许派生类重写 - virtual QString connectName(); - // 数据库文件位置 - virtual QString getDBPath(); - -private: - // 必须重写 - // 均是子类行为,不要加const以免对子类形成约束 - virtual QString tableName(); - virtual bool createTable(); - virtual void sendResult(int, QSqlQuery &); - virtual QString formatCmd(int, const QVariantList &); - -private: - QSqlQuery m_query; - QSqlDatabase m_db; - bool m_isInited; - QString m_connName; -}; - -#endif // DEFENDER_DATABASE_OPERATION_BASE_H diff --git a/deepin-pc-manager/src/window/modules/common/database/trashcleanuninstallappsql.cpp b/deepin-pc-manager/src/window/modules/common/database/trashcleanuninstallappsql.cpp deleted file mode 100644 index b45427d..0000000 --- a/deepin-pc-manager/src/window/modules/common/database/trashcleanuninstallappsql.cpp +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "trashcleanuninstallappsql.h" - -#include - -#define QUERY_CMD "select * from uninstallAppinfo order by id desc;" -#define INSERT_CMD "insert into uninstallAppinfo (APPID,APPNAME) values ('%1','%2');" -#define DELETE_CMD "delete from uninstallAppinfo where appid = '%1'"; -#define UNINSTALL_TABLE_NAME "uninstallAppinfo" - -TrashCleanUninstallAppSql::TrashCleanUninstallAppSql(QObject *parent) - : DefenderDatabaseOperationBase(parent) -{ -} - -TrashCleanUninstallAppSql::~TrashCleanUninstallAppSql() { } - -// 提供给基类以检查表是否存在 -QString TrashCleanUninstallAppSql::tableName() -{ - return UNINSTALL_TABLE_NAME; -} - -// 重写以完成父类中的建表 -bool TrashCleanUninstallAppSql::createTable() -{ - QString createCmd = "CREATE TABLE %1 " - "(id INTEGER PRIMARY KEY AUTOINCREMENT, " - "appid TEXT NOT NULL," - "appname TEXT NOT NULL);"; - createCmd = createCmd.arg(UNINSTALL_TABLE_NAME); - return executeQuery(createCmd); -} - -// 已完成命令的输出格式化 -// 通过特有的信号发送结果 -void TrashCleanUninstallAppSql::sendResult(int cmdID, QSqlQuery &query) -{ - QVariantList queryResult; - switch (cmdID) { - case UninstalledAppSqlCmdType::INSERT_A_RECORD: - case UninstalledAppSqlCmdType::DELETE_A_RECORD: - // DO NOTHING - Q_EMIT sendQueryResultSignal({}); - break; - case UninstalledAppSqlCmdType::GET_ALL_RECORDS: - while (query.next()) { - QStringList record = { query.value(1).toString(), query.value(2).toString() }; - queryResult.append(QVariant::fromValue(record)); - } - Q_EMIT sendQueryResultSignal(queryResult); - break; - } -} - -// 待执行命令的格式化,不同ID对应不同形为 -// 均为自定义内容 -QString TrashCleanUninstallAppSql::formatCmd(int cmdID, const QVariantList ¶ms) -{ - QString queryCmd; - int paramSize = params.size(); - switch (cmdID) { - case UninstalledAppSqlCmdType::INSERT_A_RECORD: - queryCmd = INSERT_CMD; - if (2 != paramSize) { - qDebug() << "TrashCleanUninstallAppSql insert incorrect param size"; - return QString(); - } - { - // 一般来讲不会出现包ID空的情况 - QString appID = params.at(0).value(); - if (appID.isEmpty()) { - return QString(); - } - // 注意主键插入NULL以完成自增 - queryCmd = queryCmd.arg(appID).arg(params.at(1).value()); - } - break; - case UninstalledAppSqlCmdType::GET_ALL_RECORDS: - queryCmd = QUERY_CMD; - break; - case UninstalledAppSqlCmdType::DELETE_A_RECORD: - queryCmd = DELETE_CMD; - if (1 != paramSize) { - qDebug() << "TrashCleanUninstallAppSql delete incorrect param size"; - return QString(); - } - { - QString appID = params.first().value(); - queryCmd = queryCmd.arg(appID); - } - break; - } - return queryCmd; -} diff --git a/deepin-pc-manager/src/window/modules/common/database/trashcleanuninstallappsql.h b/deepin-pc-manager/src/window/modules/common/database/trashcleanuninstallappsql.h deleted file mode 100644 index f74fda1..0000000 --- a/deepin-pc-manager/src/window/modules/common/database/trashcleanuninstallappsql.h +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef TRASHCLEANUNINSTALLAPPSQL_H -#define TRASHCLEANUNINSTALLAPPSQL_H - -#include "defenderdatabaseoperationbase.h" - -class TrashCleanUninstallAppSql : public DefenderDatabaseOperationBase -{ - Q_OBJECT -public: - enum UninstalledAppSqlCmdType { GET_ALL_RECORDS, INSERT_A_RECORD, DELETE_A_RECORD }; - -public: - typedef QList> QueryRecordsList; - explicit TrashCleanUninstallAppSql(QObject *parent = nullptr); - virtual ~TrashCleanUninstallAppSql() override; - -Q_SIGNALS: - void sendQueryResultSignal(QVariantList); - -private: - QString tableName() override; - void sendResult(int, QSqlQuery &) override; - QString formatCmd(int, const QVariantList & = {}) override; - virtual bool createTable() override; -}; - -#endif // TRASHCLEANUNINSTALLAPPSQL_H diff --git a/deepin-pc-manager/src/window/modules/common/gsettingkey.h b/deepin-pc-manager/src/window/modules/common/gsettingkey.h deleted file mode 100644 index e6316da..0000000 --- a/deepin-pc-manager/src/window/modules/common/gsettingkey.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2019 ~ 2020 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include - -#define DEEPIN_PC_MANAGER_GSETTING_PATH "com.deepin.dde.deepin-pc-manager" // 安全中心gsetting路径 -#define CLOSE_TYPE "close-type" // 主界面关闭方式配置项 -#define ASK_TYPE "ask-type" // 主界面退出询问弹框配置项 -#define CLEANER_LAST_TIME_CLEANED "cleaner-last-time-cleaned" // 垃圾清理-上次清理大小 -// 首页体检 -#define LAST_CHECK_TIME "last-check-time" // 上次体检时间 -#define SAFETY_SCORE "safety-score" // 上次体检得分 -#define IGNORE_AUTO_START_CHECKING "ignore-auto-start-checking" // 是否忽略检测自启动项 -#define IGNORE_DEV_MODE_CHECKING "ignore-dev-mode-checking" // 是否忽略检测开发者模式项 - -// 安全中心主题类型 -#define DEFENDER_PALETTE_TYPE "defender-palette-type" - -// 网络检测 -#define NET_CHECK_TYPE "net-check-type" -#define NET_CHECK_INTRANET_DOMAIN "net-check-intranet-domain" diff --git a/deepin-pc-manager/src/window/modules/common/invokers/deepindefendersettingsInvoker.cpp b/deepin-pc-manager/src/window/modules/common/invokers/deepindefendersettingsInvoker.cpp deleted file mode 100644 index a32850f..0000000 --- a/deepin-pc-manager/src/window/modules/common/invokers/deepindefendersettingsInvoker.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "deepindefendersettingsInvoker.h" - -#include - -// TODO:GSettings 要改为 DConfig - -DeepinDefenderSettingsInvoker::DeepinDefenderSettingsInvoker(const QByteArray &schema_id, - const QByteArray &path, - QObject *parent) - : QObject(parent) -{ - if (!parent) { - parent = this; - } - Q_UNUSED(schema_id); - Q_UNUSED(path); - // m_settings = new QGSettings(schema_id, path, parent); -} - -QVariant DeepinDefenderSettingsInvoker::GetValue(const QString &key) const -{ - Q_UNUSED(key); - // if (m_settings) { - // return m_settings->get(key); - // } - - return QVariant(QVariant::Type::Invalid); -} - -void DeepinDefenderSettingsInvoker::SetValue(const QString &key, const QVariant &value) -{ - Q_UNUSED(key); - Q_UNUSED(value); - // if (m_settings) { - // m_settings->set(key, value); - // } -} - -void DeepinDefenderSettingsInvoker::Reset(const QString &key) -{ - Q_UNUSED(key); - // if (m_settings) { - // m_settings->reset(key); - // } -} diff --git a/deepin-pc-manager/src/window/modules/common/invokers/deepindefendersettingsInvoker.h b/deepin-pc-manager/src/window/modules/common/invokers/deepindefendersettingsInvoker.h deleted file mode 100644 index c18b3de..0000000 --- a/deepin-pc-manager/src/window/modules/common/invokers/deepindefendersettingsInvoker.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef DEEPIN_DEFENDER_SETTINGS_H -#define DEEPIN_DEFENDER_SETTINGS_H - -#include "invokerinterface.h" - -#include - -class QGSettings; - -class DeepinDefenderSettingsInvoker : public QObject, public SettingsInvokerInterface -{ - Q_OBJECT -public: - explicit DeepinDefenderSettingsInvoker(const QByteArray &schema_id, - const QByteArray &path = QByteArray(), - QObject *parent = nullptr); - - virtual ~DeepinDefenderSettingsInvoker() override { } - - virtual QVariant GetValue(const QString &key) const override; - virtual void SetValue(const QString &key, const QVariant &value) override; - virtual void Reset(const QString &key) override; - -private: - QGSettings *m_settings; - - // 禁用拷贝构造,没有这种操作的必要,并且会增加资源控制的麻烦 - DeepinDefenderSettingsInvoker(DeepinDefenderSettingsInvoker &); - DeepinDefenderSettingsInvoker &operator=(const DeepinDefenderSettingsInvoker &); -}; - -#endif // DEEPIN_DEFENDER_SETTINGS_H diff --git a/deepin-pc-manager/src/window/modules/common/invokers/invokerfactory.cpp b/deepin-pc-manager/src/window/modules/common/invokers/invokerfactory.cpp deleted file mode 100644 index b2de3ff..0000000 --- a/deepin-pc-manager/src/window/modules/common/invokers/invokerfactory.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "invokerfactory.h" - -#include "dbusinvoker.h" -#include "deepindefendersettingsInvoker.h" - -InvokerFactory::InvokerFactory() { } - -InvokerFactory::~InvokerFactory() { } - -DBusInvokerInterface *InvokerFactory::CreateInvoker(const QString &service, - const QString &path, - const QString &interface, - ConnectType type, - QObject *parent) -{ -#ifdef DEEPIN_DEFENDER_UNITTEST - if (m_intefaceMap.contains(interface)) { - // 这个逻辑是为了单元测试的配置需要增加的 - // 父指针在设置前指定 - return m_intefaceMap.value(interface); - } else { - // 使用者自行处理,必须通过set方法设置interface - return nullptr; - } - -#endif - return new DBusInvoker(service, path, interface, type, parent); -} - -SettingsInvokerInterface *InvokerFactory::CreateSettings(const QByteArray &schema_id, - const QByteArray &path, - QObject *parent) -{ -#ifdef DEEPIN_DEFENDER_UNITTEST - if (m_settingsMap.contains(schema_id)) { - // 这个逻辑是为了单元测试的配置需要增加的 - // 父指针在设置前指定 - return m_settingsMap.value(schema_id); - } else { - // 使用者自行处理,必须通过set方法设置interface - return nullptr; - } -#endif - return new DeepinDefenderSettingsInvoker(schema_id, path, parent); -} - -// 单元测试扩展处理 -void InvokerFactory::setInvokerInteface(const QString &interfaceName, - DBusInvokerInterface *interface) -{ -#ifdef DEEPIN_DEFENDER_UNITTEST - // 不关心是否重复 - m_intefaceMap.insert(interfaceName, interface); -#else - Q_UNUSED(interfaceName); - Q_UNUSED(interface); -#endif -} - -// 单元测试扩展处理 -void InvokerFactory::setSettinsInteface(const QString &settingName, - SettingsInvokerInterface *interface) -{ -#ifdef DEEPIN_DEFENDER_UNITTEST - // 不关心是否重复 - m_settingsMap.insert(settingName, interface); -#else - Q_UNUSED(settingName); - Q_UNUSED(interface); -#endif -} diff --git a/deepin-pc-manager/src/window/modules/common/systemsettings/systemsettings.cpp b/deepin-pc-manager/src/window/modules/common/systemsettings/systemsettings.cpp deleted file mode 100644 index 8ce1ba7..0000000 --- a/deepin-pc-manager/src/window/modules/common/systemsettings/systemsettings.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (C) 2019 ~ 2021 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "systemsettings.h" - -#include "../invokers/invokerfactory.h" - -#include - -namespace def { -SystemSettings::SystemSettings(QObject *parent) - : QObject(parent) - , m_netMonitorDBusInvoker(nullptr) -{ - m_netMonitorDBusInvoker = - InvokerFactory::GetInstance().CreateInvoker("com.deepin.pc.manager.MonitorNetFlow", - "/com/deepin/pc/manager/MonitorNetFlow", - "com.deepin.pc.manager.MonitorNetFlow", - ConnectType::SYSTEM, - this); - - m_netMonitorDBusInvoker->Connect("SysSettingValueChanged", - this, - SLOT(onValueChanged(QString, QDBusVariant))); -} - -SystemSettings::~SystemSettings() { } - -bool SystemSettings::setValue(const QString &key, const QVariant &value) -{ - // 装载到QDBusVariant - QDBusVariant dbusVar(value); - // 装载到QVariant - QVariant var; - var.setValue(dbusVar); - QDBusMessage msg = DBUS_BLOCK_INVOKE(m_netMonitorDBusInvoker, "SetSysSettingValue", key, var); - GET_MESSAGE_VALUE(bool, ret, msg); - return ret; -} - -QVariant SystemSettings::getValue(const QString &key) -{ - QDBusMessage msg = DBUS_BLOCK_INVOKE(m_netMonitorDBusInvoker, "GetSysSettingValue", key); - GET_MESSAGE_VALUE(QDBusVariant, valueDBusVar, msg); - return valueDBusVar.variant(); -} - -void SystemSettings::onValueChanged(const QString &key, const QDBusVariant &value) -{ - Q_EMIT valueChanged(key, value.variant()); -} -} // namespace def diff --git a/deepin-pc-manager/src/window/modules/common/systemsettings/systemsettings.h b/deepin-pc-manager/src/window/modules/common/systemsettings/systemsettings.h deleted file mode 100644 index fec7729..0000000 --- a/deepin-pc-manager/src/window/modules/common/systemsettings/systemsettings.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2019 ~ 2021 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include -#include - -class DBusInvokerInterface; - -namespace def { -class SystemSettings : public QObject -{ - Q_OBJECT -public: - explicit SystemSettings(QObject *parent = nullptr); - virtual ~SystemSettings() override; - - bool setValue(const QString &key, const QVariant &value); - QVariant getValue(const QString &key); - -Q_SIGNALS: - void valueChanged(const QString &key, const QVariant &value); - -public Q_SLOTS: - void onValueChanged(const QString &key, const QDBusVariant &value); - -private: - DBusInvokerInterface *m_netMonitorDBusInvoker; -}; -} // namespace def diff --git a/deepin-pc-manager/src/window/modules/homepagecheck/checkitem.cpp b/deepin-pc-manager/src/window/modules/homepagecheck/checkitem.cpp deleted file mode 100644 index f1f4cea..0000000 --- a/deepin-pc-manager/src/window/modules/homepagecheck/checkitem.cpp +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "checkitem.h" - -#include "src/window/modules/common/common.h" - -#include -#include -#include -#include - -#include - -CheckItem::CheckItem(DLabel *titlePic, - DLabel *title, - DLabel *tipPic, - DLabel *tip, - DCommandLinkButton *btn, - DCommandLinkButton *ignoreBtn, - DCommandLinkButton *notIgnoreBtn, - DSpinner *spinner, - QWidget *parent) - : DFrame(parent) - , m_lbTitlePic(titlePic) - , m_lbTitle(title) - , m_lbTipPic(tipPic) - , m_lbTip(tip) - , m_btn(btn) - , m_ignoreBtn(ignoreBtn) - , m_notIgnoreBtn(notIgnoreBtn) - , m_spinner(spinner) -{ - // 设置背景色 - setBackgroundRole(DPalette::ItemBackground); - setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Expanding); - // 设置外框线宽 - setLineWidth(0); - - QHBoxLayout *mainLayout = new QHBoxLayout; - // 设置边界间隔 - mainLayout->setContentsMargins(20, 0, 20, 0); - setLayout(mainLayout); - - // 添加标题图标 - mainLayout->addWidget(m_lbTitlePic); - - // 添加标题 - m_lbTitle->setFont(Utils::getFixFontSize(14)); - m_lbTitle->setFixedWidth(200); - m_lbTitle->setWordWrap(true); - mainLayout->addWidget(m_lbTitle); - - // 添加提示图标 - mainLayout->addWidget(m_lbTipPic); - // 添加提示文字 - - // 设置字体 - QFont ft = m_lbTip->font(); - ft.setPixelSize(12); - ft.setWeight(QFont::Weight::Medium); - m_lbTip->setFont(ft); - m_lbTip->setWordWrap(true); - mainLayout->addWidget(m_lbTip, 1); - - // 如果存在操作按钮,则添加 - if (m_btn) { - mainLayout->addWidget(m_btn); - } - - // 如果存在忽略按钮,则添加 - if (m_ignoreBtn) { - mainLayout->addWidget(m_ignoreBtn); - } - - // 如果存在取消忽略按钮,则添加 - if (m_notIgnoreBtn) { - mainLayout->addWidget(m_notIgnoreBtn); - } - - // 如果存在旋转按钮,则添加 - if (m_spinner) { - mainLayout->addWidget(m_spinner); - } -} diff --git a/deepin-pc-manager/src/window/modules/homepagecheck/checkitem.h b/deepin-pc-manager/src/window/modules/homepagecheck/checkitem.h deleted file mode 100644 index 7f40f22..0000000 --- a/deepin-pc-manager/src/window/modules/homepagecheck/checkitem.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once -#include "window/namespace.h" - -#include -#include -#include -#include - -class QHBoxLayout; - -DWIDGET_USE_NAMESPACE - -class CheckItem : public DFrame -{ - Q_OBJECT -public: - CheckItem(DLabel *titlePic, - DLabel *title, - DLabel *tipPic, - DLabel *tip, - DCommandLinkButton *btn = nullptr, - DCommandLinkButton *ignoreBtn = nullptr, - DCommandLinkButton *notIgnoreBtn = nullptr, - DSpinner *spinner = nullptr, - QWidget *parent = nullptr); - -private: - // 标题图标 - DLabel *m_lbTitlePic; - // 标题文字 - DLabel *m_lbTitle; - // 提示图标 - DLabel *m_lbTipPic; - // 提示文字 - DLabel *m_lbTip; - // 操作按钮 - DCommandLinkButton *m_btn; - // 忽略按钮 - DCommandLinkButton *m_ignoreBtn; - // 取消忽略按钮 - DCommandLinkButton *m_notIgnoreBtn; - // 旋转等待按钮 - DSpinner *m_spinner; -}; diff --git a/deepin-pc-manager/src/window/modules/homepagecheck/homepage.cpp b/deepin-pc-manager/src/window/modules/homepagecheck/homepage.cpp deleted file mode 100644 index 5c63d5e..0000000 --- a/deepin-pc-manager/src/window/modules/homepagecheck/homepage.cpp +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "homepage.h" - -#include "widgets/systemcheckdefinition.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -HomePage::HomePage(HomePageModel *mode, QWidget *parent) - : QWidget(parent) - , m_mode(mode) - , m_guiHelper(nullptr) - , m_scorePic(nullptr) - , m_lbScoreTip(nullptr) - , m_greetingInfo(nullptr) - , m_examTip(nullptr) - , m_examBtn(nullptr) -{ - this->setFixedSize(770, 590); - this->setAccessibleName("rightWidget_homeWidget"); - this->setContentsMargins(0, 0, 0, 0); - // 获取应用界面工具实例 - m_guiHelper = DGuiApplicationHelper::instance(); - - QVBoxLayout *mainLayout = new QVBoxLayout; - mainLayout->setSpacing(0); - mainLayout->setContentsMargins(0, 0, 0, 0); - mainLayout->setAlignment(Qt::AlignHCenter); - - // 首页展现的图片 - m_scorePic = new QLabel(this); - m_scorePic->setAccessibleName("homeWidget_scorePictureLable"); - // 水平居中对齐 - m_scorePic->setAlignment(Qt::AlignCenter); - m_scorePic->setFixedHeight(320); - m_scorePic->setPixmap(QIcon::fromTheme(k1stPageLogoPath).pixmap(320, 320)); - mainLayout->addSpacing(20); - mainLayout->addWidget(m_scorePic, 0, Qt::AlignHCenter); - - // 分数提示项 - m_lbScoreTip = new DLabel(this); - m_lbScoreTip->setFixedHeight(24); - FIXED_FONT_PIXEL_SIZE(m_lbScoreTip, 14); - m_lbScoreTip->setAccessibleName("homeWidget_scoreTipLable"); - m_lbScoreTip->setAlignment(Qt::AlignBottom | Qt::AlignHCenter); - m_lbScoreTip->setElideMode(Qt::ElideMiddle); - mainLayout->addSpacing(20); - mainLayout->addWidget(m_lbScoreTip, 0, Qt::AlignHCenter); - - // 欢迎语 - m_greetingInfo = new DLabel(this); - m_greetingInfo->setFixedHeight(44); - m_greetingInfo->setText("########"); - FIXED_FONT_PIXEL_SIZE(m_greetingInfo, 30); - m_greetingInfo->setAccessibleName("homeWidget_greetingLable"); - m_greetingInfo->setAlignment(Qt::AlignHCenter); - m_greetingInfo->setElideMode(Qt::ElideMiddle); - // 设置分数提示字体样式 - QFont ft = m_greetingInfo->font(); - ft.setBold(true); - m_greetingInfo->setFont(ft); - mainLayout->addWidget(m_greetingInfo, 0, Qt::AlignHCenter); - - // 体检提示标签 - m_examTip = new DTipLabel("", this); - m_examTip->setFixedHeight(20); - m_examTip->setAccessibleName("homeWidget_examTipLable"); - m_examTip->setAlignment(Qt::AlignBottom); - m_examTip->setElideMode(Qt::ElideMiddle); - DFontSizeManager::instance()->unbind(m_examTip); - FIXED_FONT_PIXEL_SIZE(m_examTip, 14); - mainLayout->addSpacing(20); - mainLayout->addWidget(m_examTip, 0, Qt::AlignHCenter); - mainLayout->addSpacing(25); - - // 体检按钮 - m_examBtn = new DSuggestButton(this); - m_examBtn->setAccessibleName("homeWidget_examButton"); - m_examBtn->setFixedSize(170, 36); - FIXED_FONT_PIXEL_SIZE(m_examBtn, 14); - mainLayout->addWidget(m_examBtn, 0, Qt::AlignHCenter); - mainLayout->addSpacing(60); - - setLayout(mainLayout); - - // 更新界面 - updateUI(); - // 连接信号 - connect(m_examBtn, &DSuggestButton::clicked, this, &HomePage::notifyShowCheckPage); - // 主题变换 - connect(m_guiHelper, - &DGuiApplicationHelper::themeTypeChanged, - this, - &HomePage::changePicWithTheme); -} - -HomePage::~HomePage() -{ -} - -// 设置数据处理对象 -void HomePage::setModel(HomePageModel *mode) -{ - m_mode = mode; -} - -// 更新界面 -void HomePage::updateUI() -{ - // 根据体检分数,改变显示 - int score = m_mode->GetSafetyScore(); - // 若分数为“-1”,则表示没有体检过 - if (-1 == score) { - // 分数提示项 - QString coloredTip = kOutOfDateGreetingStatus; - coloredTip = SystemCheckHelper::getColoredText(-1, coloredTip); - m_lbScoreTip->setText(coloredTip); - m_examTip->setText(kOutOfDateGreetingInfo); - m_examBtn->setText(tr("Check Now")); - m_greetingInfo->setText(kOutOfDateGreetingStatus); - return; - } - // 非常安全分数阶段; - else if (PERFECTLY_SAFE_SCORE_ABOVE <= score) { - // 分数提示项 - m_lbScoreTip->setText( - tr("Last Result: %2 points").arg(k90_100Color).arg(score)); - m_examBtn->setText(tr("Check Now")); - m_greetingInfo->setText(k90_100GreetingStatus); - m_examTip->setText(k90_100GreetingInfo); - } - // 安全分数阶段 - else if (SAFE_SCORE_ABOVE <= score) { - // 分数提示项 - m_lbScoreTip->setText( - tr("Last Result: %2 points").arg(k75_90Color).arg(score)); - m_examTip->setText(k75_90GreetingInfo); - m_examBtn->setText(tr("Check Now")); - m_greetingInfo->setText(k75_90GreetingStatus); - } - // 危险分数阶段 - else if (DANGEROUS_SCORE_ABOVE <= score) { - // 分数提示项 - m_lbScoreTip->setText( - tr("Last Result: %2 points").arg(k60_75Color).arg(score)); - m_examTip->setText(k60_75GreetingInfo); - m_examBtn->setText(tr("Check Now")); - - QString coloredGreeting = kyouComputer + SystemCheckHelper::getColoredText(score, katRist); - m_greetingInfo->setText(coloredGreeting); - } - // 非常危险分数阶段 - else { - // 分数提示项 - m_lbScoreTip->setText( - tr("Last Result: %2 points").arg(k0_60Color).arg(score)); - m_examTip->setText(k0_60GreetingInfo); - m_examBtn->setText(tr("Check Now")); - - QString coloredGreeting = - kyouComputer + SystemCheckHelper::getColoredText(score, katHighRist); - m_greetingInfo->setText(coloredGreeting); - } - - // 根据上次体检时间,调整体检提示标签文字 - QDateTime lastCheckTime = m_mode->GetLastCheckTime(); - qint64 days = lastCheckTime.daysTo(QDateTime::currentDateTime()); - if (days > 5) { - QString coloredTip = tr("Checked %1 days ago").arg(int(days)); - coloredTip = SystemCheckHelper::getColoredText(-1, coloredTip); - m_lbScoreTip->setText(coloredTip); - - m_examTip->setText(k5DaysGreetingInfo); - - m_greetingInfo->setText(k5DaysGreetingStatus); - } - - // 随主题类型改变首页图 - changePicWithTheme(m_guiHelper->themeType()); -} - -void HomePage::changePicWithTheme(DGuiApplicationHelper::ColorType themeType) -{ - Q_UNUSED(themeType); - - // QIcon icon; - // // 只有是社区版才是社区 其他的都是专业 - // if (DSysInfo::uosEditionType() == DSysInfo::UosEdition::UosCommunity) { - // // 社区版本 - // if (themeType == DGuiApplicationHelper::ColorType::LightType) { - // icon = QIcon::fromTheme(HOMEPAGE_DEEPIN_LIGHT); - // } else { - // icon = QIcon::fromTheme(HOMEPAGE_DEEPIN_DARK); - // } - // } else { - // // 专业版本 - // if (themeType == DGuiApplicationHelper::ColorType::LightType) { - // icon = QIcon::fromTheme(HOMEPAGE_UOS_LIGHT); - // } else { - // icon = QIcon::fromTheme(HOMEPAGE_UOS_DARK); - // } - // } - // m_scorePic->setPixmap(icon.pixmap(300, 300)); -} diff --git a/deepin-pc-manager/src/window/modules/homepagecheck/homepagemodel.cpp b/deepin-pc-manager/src/window/modules/homepagecheck/homepagemodel.cpp deleted file mode 100644 index bb66a70..0000000 --- a/deepin-pc-manager/src/window/modules/homepagecheck/homepagemodel.cpp +++ /dev/null @@ -1,328 +0,0 @@ -// Copyright (C) 2019 ~ 2020 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "homepagemodel.h" - -#include "src/window/modules/common/gsettingkey.h" -#include "src/window/modules/common/invokers/invokerfactory.h" - -#include - -#include -#include -#include -#include - -#define DIALOG_WIDTH 380 // dialog 宽度 -#define DIALOG_HEIGHT 145 // dialog 高度 - -DWIDGET_USE_NAMESPACE - -HomePageModel::HomePageModel(QObject *parent) - : QObject(parent) - , m_gSettingsInvokerInter(nullptr) - , m_defenderDataInvokerInter(nullptr) - , m_controlCenterInvokerInter(nullptr) - , m_helperInvokerInter(nullptr) - , m_diskManagerInvokerInter(nullptr) - , m_netFlowMonitorInvokerInter(nullptr) - , m_securityCenterInter(nullptr) - , m_sysUpdaterModel(nullptr) - , m_autoStartAppChecking(false) - , m_sysVersionChecking(false) - , m_trashChecking(false) - , m_diskChecking(false) - , m_developModeChecking(false) -{ - // 使用GSetting读取参数 - m_gSettingsInvokerInter = - InvokerFactory::GetInstance().CreateSettings(DEEPIN_PC_MANAGER_GSETTING_PATH, "", this); - m_defenderDataInvokerInter = - InvokerFactory::GetInstance().CreateInvoker("com.deepin.pc.manager.session.daemon", - "/com/deepin/pc/manager/session/daemon", - "com.deepin.pc.manager.session.daemon", - ConnectType::SESSION, - this); - // 控制中心dbus服务对象 - m_controlCenterInvokerInter = - InvokerFactory::GetInstance().CreateInvoker("com.deepin.dde.ControlCenter", - "/com/deepin/dde/ControlCenter", - "com.deepin.dde.ControlCenter", - ConnectType::SESSION, - this); - // 安全中心dbus服务对象 - m_defenderWindowInvokerInter = - InvokerFactory::GetInstance().CreateInvoker("com.deepin.pc.manager", - "/com/deepin/pc/manager", - "com.deepin.pc.manager", - ConnectType::SESSION, - this); - // 同步助手dbus服务,用于查询是否处于开发者模式 - m_helperInvokerInter = InvokerFactory::GetInstance().CreateInvoker("com.deepin.sync.Helper", - "/com/deepin/sync/Helper", - "com.deepin.sync.Helper", - ConnectType::SYSTEM, - this); - // 磁盘管理dbus服务 - m_diskManagerInvokerInter = - InvokerFactory::GetInstance().CreateInvoker("com.deepin.diskmanager", - "/com/deepin/diskmanager", - "com.deepin.diskmanager", - ConnectType::SYSTEM, - this); - // 流量监控系统dbus服务 - m_netFlowMonitorInvokerInter = - InvokerFactory::GetInstance().CreateInvoker("com.deepin.pc.manager.MonitorNetFlow", - "/com/deepin/pc/manager/MonitorNetFlow", - "com.deepin.pc.manager.MonitorNetFlow", - ConnectType::SYSTEM, - this); - - m_securityCenterInter = - InvokerFactory::GetInstance().CreateInvoker("com.deepin.pc.manager.datainterface", - "/com/deepin/pc/manager/securitytooldialog", - "com.deepin.pc.manager.securitytooldialog", - ConnectType::SESSION, - this); - - // 系统更新数据处理对象 - m_sysUpdaterModel = new SysUpdaterModel(this); - - // 预启动磁盘管理器服务,避免磁盘检测时调用接口卡顿 - DBUS_NOBLOCK_INVOKE(m_diskManagerInvokerInter, "Start"); - - //// 自启动 - // 更新自启动应用个数 - m_defenderDataInvokerInter->Connect("AccessRefreshData", - this, - SLOT(updateStartUpAppCount(bool, QString))); - //// ssh - // 当ssh状态改变时 - m_netFlowMonitorInvokerInter->Connect("SendSSHStatus", this, SIGNAL(sendSSHStatus(bool))); - //// 系统版本 - // 通知去检查系统更新 - connect(this, - &HomePageModel::NotifyCheckSysUpdate, - m_sysUpdaterModel, - &SysUpdaterModel::CheckForUpdates); - // 通知去停止检查系统更新 - connect(this, - &HomePageModel::notifyStopCheckSysUpdate, - m_sysUpdaterModel, - &SysUpdaterModel::stopCheckingSysVer); - connect(this, - &HomePageModel::notifyTimeroutSysUpdate, - m_sysUpdaterModel, - &SysUpdaterModel::onCheckJobStatusChanged); - // 检查系统更新完成 - connect(m_sysUpdaterModel, - &SysUpdaterModel::SendHaveUpdates, - this, - &HomePageModel::CheckSysUpdateFinished); - /// 垃圾清理 - // 请求开始垃圾文件扫描 - connect(this, &HomePageModel::requestStartTrashScan, this, [this] { - DBUS_NOBLOCK_INVOKE(m_defenderDataInvokerInter, "RequestStartTrashScan"); - }); - - // 垃圾文件扫描完成时 - m_defenderDataInvokerInter->Connect("TrashScanFinished", - this, - SIGNAL(trashScanFinished(double))); - // 请求清理选中的垃圾文件 - connect(this, &HomePageModel::requestCleanSelectTrash, this, [this] { - DBUS_NOBLOCK_INVOKE(m_defenderDataInvokerInter, "RequestCleanSelectTrash"); - }); - // 清理选中的垃圾文件完成时 - m_defenderDataInvokerInter->Connect("CleanSelectTrashFinished", - this, - SIGNAL(cleanSelectTrashFinished())); -} - -// 设置上次体检分数 -void HomePageModel::setSafetyScore(const int &score) -{ - qInfo() << "[HomePageModel] [setSafetyScore] homecheck score set " << score; - m_gSettingsInvokerInter->SetValue(SAFETY_SCORE, score); -} - -// 获取上次体检分数 -int HomePageModel::GetSafetyScore() -{ - int score = m_gSettingsInvokerInter->GetValue(SAFETY_SCORE).toInt(); - qInfo() << "[HomePageModel] [GetSafetyScore] homecheck score get " << score; - return score; -} - -// 设置上次体检时间 -void HomePageModel::SetLastCheckTime(QDateTime dateTime) -{ - qInfo() << "[HomePageModel] [SetLastCheckTime] homecheck time set " - << dateTime.toString("yyyy-MM-dd-hh-mm-ss"); - m_gSettingsInvokerInter->SetValue(LAST_CHECK_TIME, dateTime.toString("yyyy-MM-dd-hh-mm-ss")); -} - -// 获取上次体检时间 -QDateTime HomePageModel::GetLastCheckTime() -{ - QString timeStr = m_gSettingsInvokerInter->GetValue(LAST_CHECK_TIME).toString(); - qInfo() << "[HomePageModel] [GetLastCheckTime] homecheck time get " << timeStr; - return QDateTime::fromString(timeStr, "yyyy-MM-dd-hh-mm-ss"); -} - -void HomePageModel::openStartupControlPage() -{ - DBUS_NOBLOCK_INVOKE(m_securityCenterInter, "ShowStartup"); - addSecurityLog(tr("Startup programs checked")); -} - -// 打开系统更新界面 -void HomePageModel::openSysUpdatePage() -{ - DBUS_NOBLOCK_INVOKE(m_controlCenterInvokerInter, "Show"); - DBUS_NOBLOCK_INVOKE(m_controlCenterInvokerInter, "ShowPage", "update", ""); - addSecurityLog(tr("System updated")); -} - -// 磁盘管理器 是否已安装 -bool HomePageModel::isDiskManagerInterValid() -{ - QProcess proc; - // 查询是否已经安装 磁盘管理器 - proc.start("dpkg", { "-s", "deepin-diskmanager" }); - proc.waitForFinished(); - QString status = proc.readAllStandardOutput(); - qInfo() << "[HomePageModel] [isDiskManagerInterValid] disk status " << status; - - // 若返回结果以 "Package: deepin-diskmanager\nStatus: install",则说明已安装 - return status.startsWith("Package: deepin-diskmanager\nStatus: install"); -} - -// 获取磁盘状态 -bool HomePageModel::getDiskStatus() -{ - // 遍历所有磁盘设备路径 - QDBusMessage msg; - msg = DBUS_BLOCK_INVOKE(m_netFlowMonitorInvokerInter, "GetDiskDevicePathList"); - GET_MESSAGE_VALUE(QStringList, devPaths, msg); - - for (QString devPath : devPaths) { - msg = DBUS_BLOCK_INVOKE(m_diskManagerInvokerInter, "onGetDeviceHardStatus", devPath); - GET_MESSAGE_VALUE(QString, data, msg); - - // 状态结果转小写 - QString status = data.toLower(); - // 若状态为异常,返回false - if ("passed" != status) { - qWarning() << "[HomePageModel] [getDiskStatus] no passed"; - return false; - } - } - - // 所有磁盘正常 - return true; -} - -// 是否处于开发者模式 -bool HomePageModel::IsDeveloperMode() -{ - QDBusMessage msg = DBUS_BLOCK_INVOKE(m_helperInvokerInter, "IsDeveloperMode"); - GET_MESSAGE_VALUE(bool, rst, msg); - qInfo() << "[HomePageModel] [IsDeveloperMode] " << rst; - - return rst; -} - -bool HomePageModel::ignoreDevModeChecking() const -{ - // 服务器版差异修改 - if (DSysInfo::UosType::UosServer == SystemType) { - return true; - } - - return m_gSettingsInvokerInter->GetValue(IGNORE_DEV_MODE_CHECKING).toBool(); -} - -void HomePageModel::setIgnoreDevModeChecking(bool ignore) -{ - m_gSettingsInvokerInter->SetValue(IGNORE_DEV_MODE_CHECKING, ignore); -} - -// 更新自启动应用个数 -void HomePageModel::updateStartUpAppCount(bool bAdd, const QString &sID) -{ - Q_UNUSED(bAdd); - Q_UNUSED(sID); - QtConcurrent::run([this] { - // 判断自启动应用个数 - int count = getAutoStartAppCount(); - Q_EMIT autoStartAppCountChanged(count); - }); -} - -void HomePageModel::onTrashScanFinished(double sum) -{ - Q_EMIT trashScanFinished(sum); -} - -void HomePageModel::checkAutoStart() -{ - QtConcurrent::run([this] { - int nEnableCount = getAutoStartAppCount(); - // 若当前正在检查自启动 - if (m_autoStartAppChecking) { - Q_EMIT checkAutoStartFinished(nEnableCount); - } - }); -} - -bool HomePageModel::ignoreAutoStartChecking() const -{ - return m_gSettingsInvokerInter->GetValue(IGNORE_AUTO_START_CHECKING).toBool(); -} - -void HomePageModel::setIgnoreAutoStartChecking(bool ignore) -{ - m_gSettingsInvokerInter->SetValue(IGNORE_AUTO_START_CHECKING, ignore); -} - -// 异步获取ssh状态 -void HomePageModel::asyncGetSSHStatus() const -{ - DBUS_BLOCK_INVOKE(m_netFlowMonitorInvokerInter, "AsyncGetRemRegisterStatus"); -} - -void HomePageModel::asyncSetSSHStatus(bool status) -{ - DBUS_BLOCK_INVOKE(m_netFlowMonitorInvokerInter, "AsyncSetRemRegisterStatus", status); -} - -// 获取允许自启动应用个数 -int HomePageModel::getAutoStartAppCount() const -{ - int nEnableCount = 0; - QDBusMessage msg = DBUS_BLOCK_INVOKE(m_defenderDataInvokerInter, "startLauncherManage"); - GET_MESSAGE_VALUE(bool, success, msg); - if (success) { - QDBusMessage msgEnable = DBUS_BLOCK_INVOKE(m_defenderDataInvokerInter, "getAppsInfoEnable"); - GET_MESSAGE_VALUE(QString, sEnableInfo, msgEnable); - QApplication::processEvents(); - if (!sEnableInfo.isEmpty()) { - nEnableCount = sEnableInfo.split("|").count(); - qInfo() << "[HomePageModel] [getAutoStartAppCount] " << nEnableCount; - } - } - - return nEnableCount; -} - -// 添加安全日志 -void HomePageModel::addSecurityLog(QString sInfo) -{ - DBUS_NOBLOCK_INVOKE(m_netFlowMonitorInvokerInter, - "AddSecurityLog", - SECURITY_LOG_TYPE_HOME, - sInfo); -} diff --git a/deepin-pc-manager/src/window/modules/homepagecheck/homepagemodel.h b/deepin-pc-manager/src/window/modules/homepagecheck/homepagemodel.h deleted file mode 100644 index 11f0d79..0000000 --- a/deepin-pc-manager/src/window/modules/homepagecheck/homepagemodel.h +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright (C) 2019 ~ 2020 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include "sysupdatermodel.h" -#include "window/modules/common/common.h" -#include "window/namespace.h" - -#include - -class QGSettings; -class DBusInvokerInterface; -class SettingsInvokerInterface; - -class HomePageModel : public QObject -{ - Q_OBJECT -public: - explicit HomePageModel(QObject *parent = nullptr); - -public: - // 设置上次体检分数 - void setSafetyScore(const int &score); - // 获取上次体检分数 - int GetSafetyScore(); - // 设置上次体检时间 - void SetLastCheckTime(QDateTime dateTime); - // 获取上次体检时间 - QDateTime GetLastCheckTime(); - - // 设置是否处于自启动app数检测中 - inline void SetAutoStartAppChecking(bool checking) { m_autoStartAppChecking = checking; } - - // 是否处于自启动app数检测中 - inline bool autoStartAppChecking() { return m_autoStartAppChecking; } - - // 打开自启动管理页 - void openStartupControlPage(); - // 检查自启动 - void checkAutoStart(); - // 是否忽略检测自启动项 - bool ignoreAutoStartChecking() const; - - // 设置是否忽略检测自启动项 - void setIgnoreAutoStartChecking(bool ignore); - - //// ssh检测 - // 异步获取ssh状态 - void asyncGetSSHStatus() const; - - // 异步设置ssh状态 - void asyncSetSSHStatus(bool status); - - //// 系统更新检测 - // 设置是否处于系统版本检测中 - inline void SetSysVersionChecking(bool checking) { m_sysVersionChecking = checking; } - - // 是否处于系统版本检测中 - inline bool sysVersionChecking() const { return m_sysVersionChecking; } - - // 打开系统更新界面 - void openSysUpdatePage(); - - // 设置是否处于垃圾文件检测中 - inline void SetTrashChecking(bool checking) { m_trashChecking = checking; } - - // 磁盘管理器 是否已安装 - bool isDiskManagerInterValid(); - // 获取磁盘状态 - bool getDiskStatus(); - - // 设置是否处于磁盘检测中 - inline void SetDiskChecking(bool checking) { m_diskChecking = checking; } - - // 设置是否处于正在检测开发者模式 - inline void SetDevelopModeChecking(bool checking) { m_developModeChecking = checking; } - - // 是否处于开发者模式 - bool IsDeveloperMode(); - // 是否忽略检测开发者模式 - bool ignoreDevModeChecking() const; - // 设置是否忽略检测开发者模式 - void setIgnoreDevModeChecking(bool ignore); - -public Q_SLOTS: - // 更新自启动应用个数 - void updateStartUpAppCount(bool bAdd, const QString &sID); - - // 垃圾文件扫描完成时 - void onTrashScanFinished(double sum); - - // 添加安全日志 - void addSecurityLog(QString sInfo); - -Q_SIGNALS: - // 通知打开体检首页 - void notifyShowHomepage(); - - // 当自启动检查结束时 - void checkAutoStartFinished(int count); - // 自启动应用数量改变时 - void autoStartAppCountChanged(int count); - - // 发送ssh状态 - void sendSSHStatus(bool status); - - // 通知去检查系统更新 - void NotifyCheckSysUpdate(); - // 通知去停止检查系统更新 - void notifyStopCheckSysUpdate(); - void notifyTimeroutSysUpdate(const QString &status); - // 检查系统更新完成 - void CheckSysUpdateFinished(bool canUpdate); - - // 请求开始垃圾文件扫描 - void requestStartTrashScan(); - // 垃圾文件扫描完成时 - void trashScanFinished(const double sum); - // 请求清理选中的垃圾文件 - void requestCleanSelectTrash(); - // 清理选中的垃圾文件完成时 - void cleanSelectTrashFinished(); - -private: - // 获取允许自启动应用个数 - int getAutoStartAppCount() const; - -private: - // gsetting对象 - SettingsInvokerInterface *m_gSettingsInvokerInter; - // 安全中心数据接口服务对象 - DBusInvokerInterface *m_defenderDataInvokerInter; - // 控制中心dbus服务 - DBusInvokerInterface *m_controlCenterInvokerInter; - // 安全中心界面dbus服务 - DBusInvokerInterface *m_defenderWindowInvokerInter; - // 同步助手dbus服务,用于查询是否处于开发者模式 - DBusInvokerInterface *m_helperInvokerInter; - // 磁盘管理dbus服务 - DBusInvokerInterface *m_diskManagerInvokerInter; - // 流量监控系统dbus服务 - DBusInvokerInterface *m_netFlowMonitorInvokerInter; - DBusInvokerInterface *m_langSelectInvokerInter; - // 自启动服务 - DBusInvokerInterface *m_securityCenterInter; - - // 系统更新数据处理对象 - SysUpdaterModel *m_sysUpdaterModel; - // 是否正在进行检查自启动应用数 - bool m_autoStartAppChecking; - // 是否正在进行检查系统版本 - bool m_sysVersionChecking; - // 是否正在进行检测垃圾文件 - bool m_trashChecking; - // 是否正在进行磁盘检测 - bool m_diskChecking; - // 是否正在进行检查开发者模式 - bool m_developModeChecking; -}; diff --git a/deepin-pc-manager/src/window/modules/homepagecheck/homepagemodule.cpp b/deepin-pc-manager/src/window/modules/homepagecheck/homepagemodule.cpp deleted file mode 100644 index 4989633..0000000 --- a/deepin-pc-manager/src/window/modules/homepagecheck/homepagemodule.cpp +++ /dev/null @@ -1,294 +0,0 @@ -// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "homepagemodule.h" - -#include "homepage.h" -#include "homepagemodel.h" - -#include - -#include -#include -#include -#include - -#define AUTO_RESET_WIDGET(className, widget) \ - { \ - connect(widget, &className::destroyed, this, [this] { \ - widget = nullptr; \ - }); \ - } - -HomePageModule::HomePageModule(FrameProxyInterface *frame, QObject *parent) - : QObject(parent) - , ModuleInterface(frame) - , m_homePageModel(nullptr) - , m_sysCheckAdaptorModel(nullptr) - , m_homePage(nullptr) - , m_homePagecheckWidget(nullptr) - , m_progressWidget(nullptr) - , m_resultWidget(nullptr) - , m_isDeactived(true) -{ -} - -HomePageModule::~HomePageModule() -{ - if (m_progressWidget) { - m_sysCheckAdaptorModel->onCheckCanceled(); - m_progressWidget->deleteLater(); - m_progressWidget = nullptr; - } - - if (m_resultWidget) { - m_resultWidget->deleteLater(); - m_resultWidget = nullptr; - } - - if (m_homePage) { - m_homePage->deleteLater(); - m_homePage = nullptr; - } -} - -// 初始化 -void HomePageModule::initialize() { } - -// 预初始化 -void HomePageModule::preInitialize() -{ - if (!m_homePageModel) { - m_homePageModel = new HomePageModel(this); - } - - if (!m_sysCheckAdaptorModel) { - m_sysCheckAdaptorModel = new SysCheckAdaptorModel(m_homePageModel, this); - connect(m_sysCheckAdaptorModel, &SysCheckAdaptorModel::checkFinished, this, [this] { - // 展示结果页 - showResultPage(); - }); - - connect(m_sysCheckAdaptorModel, &SysCheckAdaptorModel::fixItemFinished, this, [this] { - if (m_resultWidget) { - m_resultWidget->setFastFixValid(m_sysCheckAdaptorModel->isFastFixValid()); - } - }); - - connect(m_sysCheckAdaptorModel, &SysCheckAdaptorModel::fixItemStarted, this, [this] { - if (m_frameProxy) { - m_frameProxy->setBackForwardButtonStatus(false); - } - }); - connect(m_sysCheckAdaptorModel, &SysCheckAdaptorModel::fixItemFinished, this, [this] { - if (m_frameProxy) { - if (!m_sysCheckAdaptorModel->isProcessingFastFixing()) { - m_frameProxy->setBackForwardButtonStatus(true); - } - } - }); - } -} - -// 模块名称 -const QString HomePageModule::name() const -{ - return MODULE_HOMEPAGE_NAME; -} - -// 激活 -void HomePageModule::active(int index) -{ - Q_UNUSED(index); - m_isDeactived = false; - // 若体检首页没有创建,则新建 - if (nullptr == m_homePage) { - m_homePage = new HomePage(m_homePageModel); - AUTO_RESET_WIDGET(HomePage, m_homePage); - - connect(m_homePage, - &HomePage::notifyShowCheckPage, - this, - &HomePageModule::showProgressPage); - } - - // 优先显示检查过程(如果处理检查中) - if (m_progressWidget) { - m_homePage->hide(); - m_frameProxy->pushWidget(this, m_progressWidget); - return; - } - - // 更新体检首页界面数据 - m_homePage->updateUI(); - // 将体检页推到主窗口显示栈 - m_frameProxy->pushWidget(this, m_homePage); - - // 优先显示体检页(如果已产生体检结果) - if (m_resultWidget) { - m_homePage->hide(); - m_frameProxy->pushWidget(this, m_resultWidget); - m_frameProxy->setBackForwardButtonStatus(!m_sysCheckAdaptorModel->isProcessingFastFixing()); - return; - } -} - -// 反激活 -void HomePageModule::deactive() -{ - // m_frameProxy->popWidget(this); - m_isDeactived = true; -} - -// 打开体检页 -// 因重构弃用 -void HomePageModule::showCheckPage() { } - -void HomePageModule::showProgressPage() -{ - // 若体检页没有创建,则新建 - if (nullptr == m_progressWidget) { - m_progressWidget = new CheckProcessingWidget; - connect(m_progressWidget, - &CheckProcessingWidget::checkCanceled, - this, - &HomePageModule::onCheckCanceled); - connect(m_sysCheckAdaptorModel, - &SysCheckAdaptorModel::checkStarted, - m_progressWidget, - &CheckProcessingWidget::onCheckInitial); - connect(m_sysCheckAdaptorModel, - &SysCheckAdaptorModel::checkFinished, - m_progressWidget, - &CheckProcessingWidget::onCheckDone); - connect(m_sysCheckAdaptorModel, - &SysCheckAdaptorModel::stageChanged, - m_progressWidget, - &CheckProcessingWidget::onCheckMissionStarted); - - AUTO_RESET_WIDGET(CheckProcessingWidget, m_progressWidget); - } - // 隐藏首页 - m_frameProxy->popWidget(this); - m_frameProxy->pushWidget(this, m_progressWidget); - m_sysCheckAdaptorModel->startExam(); -} - -void HomePageModule::showResultPage() -{ - if (!m_resultWidget) { - m_resultWidget = new SysCheckResultWidget; - m_resultWidget->setResultModel(m_sysCheckAdaptorModel->getResultModel()); - m_resultWidget->setHeaderContent(m_sysCheckAdaptorModel->getIssuePoint(), - m_sysCheckAdaptorModel->getIssueCount()); - - connect(m_resultWidget, - &SysCheckResultWidget::requestSetIgnore, - m_sysCheckAdaptorModel, - &SysCheckAdaptorModel::onRequestSetIgnore); - connect(m_resultWidget, - &SysCheckResultWidget::requestFixAll, - m_sysCheckAdaptorModel, - &SysCheckAdaptorModel::onRequestFixAll); - connect(m_resultWidget, - &SysCheckResultWidget::requestFixItem, - m_sysCheckAdaptorModel, - &SysCheckAdaptorModel::onRequestFixItem); - connect(m_resultWidget, - &SysCheckResultWidget::requestCheckAgain, - this, - &HomePageModule::onRequestCheckAgain); - connect(m_resultWidget, - &SysCheckResultWidget::requestQuit, - this, - &HomePageModule::onRequestQuitResultWidget); - - connect(m_sysCheckAdaptorModel, - &SysCheckAdaptorModel::fixItemStarted, - m_resultWidget, - &SysCheckResultWidget::onFixStarted); - connect(m_sysCheckAdaptorModel, - &SysCheckAdaptorModel::fixItemFinished, - m_resultWidget, - &SysCheckResultWidget::onFixFinished); - - AUTO_RESET_WIDGET(SysCheckResultWidget, m_resultWidget); - } - m_resultWidget->setFastFixValid(m_sysCheckAdaptorModel->isFastFixValid()); - - if (!m_isDeactived) { - // 删除过程页 - m_frameProxy->popAndDelWidget(this); - // 插入主页与结果页 - m_frameProxy->pushWidget(this, m_homePage); - m_homePage->hide(); - m_frameProxy->pushWidget(this, m_resultWidget); - } else { - m_progressWidget->deleteLater(); - m_progressWidget = nullptr; - } -} - -void HomePageModule::onCheckCanceled() -{ - // 通知model取消其它检查 - m_sysCheckAdaptorModel->onCheckCanceled(); - m_homePageModel->notifyStopCheckSysUpdate(); - // 检查中断,回退到前一页面 - m_frameProxy->popAndDelWidget(this); - m_frameProxy->pushWidget(this, m_homePage); -} - -void HomePageModule::onRequestCheckAgain() -{ - m_frameProxy->popAndDelWidget(this); - showProgressPage(); -} - -void HomePageModule::requestStopExaming() -{ - m_sysCheckAdaptorModel->onCheckCanceled(); - m_homePageModel->notifyStopCheckSysUpdate(); -} - -void HomePageModule::onRequestQuitResultWidget() -{ - if (m_resultWidget) { - if (!m_resultWidget->isHidden()) { - m_frameProxy->popAndDelWidget(this); - m_frameProxy->pushWidget(this, m_homePage); - } - } -} - -void HomePageModule::onBackForward() -{ - if (m_homePage) { - m_homePage->updateUI(); - } -} - -// 打开体检首页 -// 因重构弃用 -void HomePageModule::showHomepage() -{ - // // 若体检首页没有创建,则新建 - // if (nullptr == m_homePage) { - // m_homePage = new HomePage(m_homePageModel); - // connect(m_homePage, &HomePage::notifyShowCheckPage, this, - // &HomePageModule::ShowCheckPage); - // } - - // // 若体检页已存在,则删除 - // if (nullptr != m_homePagecheckWidget) { - // m_frameProxy->popWidget(this); - // m_homePagecheckWidget->deleteLater(); - // m_homePagecheckWidget = nullptr; - // } - - // m_homePage->updateUI(); - // // 将体检页推到主窗口显示栈 - // m_frameProxy->pushWidget(this, m_homePage); -} diff --git a/deepin-pc-manager/src/window/modules/homepagecheck/homepagemodule.h b/deepin-pc-manager/src/window/modules/homepagecheck/homepagemodule.h deleted file mode 100644 index 4b33337..0000000 --- a/deepin-pc-manager/src/window/modules/homepagecheck/homepagemodule.h +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (C) 2010 ~ 2010 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include "widgets/checkprocessingwidget.h" -#include "widgets/syscheckresultwidget.h" -#include "window/interface/frameproxyinterface.h" -#include "window/interface/moduleinterface.h" -#include "window/modules/homepagecheck/syscheckadaptormodel.h" - -class FrameProxyInterface; -class ModuleInterface; - -class QObject; -class HomePageModel; -class HomePage; -class HomePageCheckWidget; -class QObject; - -class HomePageModule : public QObject, public ModuleInterface -{ - Q_OBJECT -public: - explicit HomePageModule(FrameProxyInterface *frame, QObject *parent = nullptr); - ~HomePageModule() override; - -public: - // 初始化 - void initialize() override; - // 预初始化 - void preInitialize() override; - // 模块名称 - const QString name() const override; - // 激活 - void active(int index) override; - // 反激活 - void deactive() override; - - // 获得首页数据处理对象 - inline HomePageModel *getModel() { return m_homePageModel; } - -Q_SIGNALS: - -public Q_SLOTS: - // 打开体检首页 - void showHomepage(); - // 打开体检页 - void showCheckPage(); - // v23重构,增加进度页 - void showProgressPage(); - // v23重构,打开结果页 - void showResultPage(); - // v23重构,检查中止处理 - void onCheckCanceled(); - // v23重构,重新检查 - void onRequestCheckAgain(); - // back farward - void requestStopExaming(); - // request quit result widget - void onRequestQuitResultWidget(); - // sync check score - void onBackForward(); - -private: - // 首页数据处理对象 - HomePageModel *m_homePageModel; - // model适配器 - SysCheckAdaptorModel *m_sysCheckAdaptorModel; - // 首页 - HomePage *m_homePage; - // 体检页 - HomePageCheckWidget *m_homePagecheckWidget = nullptr; - // 进度页 - CheckProcessingWidget *m_progressWidget; - // V23结果页 - SysCheckResultWidget *m_resultWidget; - bool m_isDeactived; -}; diff --git a/deepin-pc-manager/src/window/modules/homepagecheck/syscheckadaptormodel.cpp b/deepin-pc-manager/src/window/modules/homepagecheck/syscheckadaptormodel.cpp deleted file mode 100644 index 39bb69a..0000000 --- a/deepin-pc-manager/src/window/modules/homepagecheck/syscheckadaptormodel.cpp +++ /dev/null @@ -1,447 +0,0 @@ -// Copyright (C) 2019 ~ 2022 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "syscheckadaptormodel.h" - -#include - -#define SEPERATOR ", " - -SysCheckAdaptorModel::SysCheckAdaptorModel(HomePageModel *model, QObject *parent) - : QObject(parent) - , m_model(model) - , m_issuePoint(0) - , m_processingIndex(0) -{ - if (m_model) { - initConnection(); - } -} - -SysCheckAdaptorModel::~SysCheckAdaptorModel() -{ - qDeleteAll(m_resultItems); - m_resultItems.clear(); -} - -bool SysCheckAdaptorModel::isFastFixValid() -{ - return (m_totalTrashSize >= 100 * MB_COUNT); -} - -void SysCheckAdaptorModel::startExam() -{ - m_issuePoint = 0; - m_issueCount = 0; - m_autoStartCount = 0; - m_isDevMode = false; - m_isDiskNormal = true; - m_isSysOutDate = false; - m_totalTrashSize = 0.0; - - m_logProblemItemsInfo = ""; - m_fixingItems.clear(); - - Q_EMIT checkStarted(); - resetResultItems(); - startSSHExam(); -} - -void SysCheckAdaptorModel::startDiskExam() -{ - if (m_processingIndex != SysCheckItemID::Trash) { - return; - } - - Q_EMIT stageChanged(SysCheckItemID::Disk); - QStandardItem *diskItem = m_resultItems[SysCheckItemID::Disk]; - diskItem->setData(SysCheckItemID::Disk, CheckResultModelRole::ID); - - if (m_model->isDiskManagerInterValid()) { - m_isDiskNormal = m_model->getDiskStatus(); - diskItem->setData(CheckProgressStatus::Success, CheckResultModelRole::CheckProgressFlag); - diskItem->setData(m_isDiskNormal != true, CheckResultModelRole::IsIssueHappen); - diskItem->setData(m_isDiskNormal, CheckResultModelRole::Details); - diskItem->setData(false, CheckResultModelRole::IsIgnored); - } else { - diskItem->setData(CheckProgressStatus::Masked, CheckResultModelRole::CheckProgressFlag); - } - - m_processingIndex = SysCheckItemID::Disk; - Q_EMIT DiskExamFinished(); -} - -void SysCheckAdaptorModel::startSSHExam() -{ - // SSH为禁用项,不显示开始状态 - QStandardItem *sshItem = m_resultItems[SysCheckItemID::SSH]; - sshItem->setData(SysCheckItemID::SSH, CheckResultModelRole::ID); - sshItem->setData(CheckProgressStatus::Masked, CheckResultModelRole::CheckProgressFlag); - m_processingIndex = SysCheckItemID::SSH; - Q_EMIT SSHExamFinished(); -} - -void SysCheckAdaptorModel::startTrashExam() -{ - if (m_processingIndex != SysCheckItemID::SystemUpdate) { - return; - } - - Q_EMIT stageChanged(SysCheckItemID::Trash); - Q_EMIT m_model->requestStartTrashScan(); - m_processingIndex = SysCheckItemID::Trash; -} - -void SysCheckAdaptorModel::startSysVersionExam() -{ - if (m_processingIndex != SysCheckItemID::AutoStartApp) { - return; - } - - Q_EMIT stageChanged(SysCheckItemID::SystemUpdate); - Q_EMIT m_model->NotifyCheckSysUpdate(); - - m_sysVersionTimer.stop(); - m_sysVersionTimer.setSingleShot(true); - m_sysVersionTimer.start(SYS_VER_CHECK_TIMEOUT); - // 设置正在检查系统更新中 - m_model->SetSysVersionChecking(true); - m_processingIndex = SysCheckItemID::SystemUpdate; -} - -void SysCheckAdaptorModel::startDevModeExam() -{ - if (m_processingIndex != SysCheckItemID::Disk) { - return; - } - - Q_EMIT stageChanged(SysCheckItemID::DevMode); - - m_isDevMode = m_model->IsDeveloperMode(); - - QStandardItem *devItem = m_resultItems[SysCheckItemID::DevMode]; - devItem->setData(SysCheckItemID::DevMode, CheckResultModelRole::ID); - devItem->setData(CheckProgressStatus::Success, CheckResultModelRole::CheckProgressFlag); - devItem->setData(m_isDevMode, CheckResultModelRole::IsIssueHappen); - devItem->setData(m_isDevMode, CheckResultModelRole::Details); - devItem->setData(m_model->ignoreDevModeChecking(), CheckResultModelRole::IsIgnored); - m_processingIndex = SysCheckItemID::DevMode; - - Q_EMIT DevModeExamFinished(); -} - -void SysCheckAdaptorModel::startAutoStartExam() -{ - if (m_processingIndex != SysCheckItemID::SSH) { - return; - } - - Q_EMIT stageChanged(SysCheckItemID::AutoStartApp); - m_model->checkAutoStart(); - m_model->SetAutoStartAppChecking(true); - m_processingIndex = SysCheckItemID::AutoStartApp; -} - -// 将结果拼凑成一个standardModel统一接口 -const QStandardItemModel &SysCheckAdaptorModel::getResultModel() -{ - m_resultModel.clear(); - m_resultModel.appendRow(m_resultItems); - return m_resultModel; -} - -bool SysCheckAdaptorModel::isProcessingFastFixing() -{ - return m_fixingItems.size() > 0; -} - -void SysCheckAdaptorModel::onCheckStarted() { } - -void SysCheckAdaptorModel::onCheckDone() -{ - // 统计分数 - updateIssuePoint(); - // 记录检查完成时间 - m_model->SetLastCheckTime(QDateTime::currentDateTime()); - - Q_EMIT checkFinished(); -} - -void SysCheckAdaptorModel::onCheckCanceled() -{ - m_processingIndex = SysCheckItemID::MaxLimit; - qDeleteAll(m_resultItems); - m_resultItems.clear(); -} - -void SysCheckAdaptorModel::onRequestFixAll() -{ - fixTrash(); -} - -void SysCheckAdaptorModel::onRequestFixItem(SysCheckItemID itemId) -{ - switch (itemId) { - case SysCheckItemID::Disk: - fixDisk(); - break; - case SysCheckItemID::Trash: - fixTrash(); - break; - case SysCheckItemID::SystemUpdate: - fixSysUpdate(); - break; - case SysCheckItemID::DevMode: - fixDevMode(); - break; - case SysCheckItemID::AutoStartApp: - fixAutoStart(); - break; - default: - break; - } -} - -void SysCheckAdaptorModel::onRequestSetIgnore(SysCheckItemID id, bool isNeedIgnore) -{ - if (SysCheckItemID::DevMode == id) { - QString logInfo = kDevModeDismissed; - m_model->setIgnoreDevModeChecking(isNeedIgnore); - if (isNeedIgnore) { - m_model->addSecurityLog(logInfo); - } - return; - } - - if (SysCheckItemID::AutoStartApp == id) { - QString logInfo = isNeedIgnore ? kAutoStartDismissed : kAutoStartResumed; - m_model->addSecurityLog(logInfo); - m_model->setIgnoreAutoStartChecking(isNeedIgnore); - return; - } -} - -void SysCheckAdaptorModel::onSysVersionCheckTimeout() -{ - if (m_processingIndex != SysCheckItemID::SystemUpdate) { - return; - } - - m_sysVersionTimer.stop(); - if (m_model->sysVersionChecking()) { - Q_EMIT m_model->notifyTimeroutSysUpdate("failed"); - } - - QStandardItem *sysVersionItem = m_resultItems[SysCheckItemID::SystemUpdate]; - sysVersionItem->setData(SysCheckItemID::SystemUpdate, CheckResultModelRole::ID); - // 超时,不显示该项 - sysVersionItem->setData(CheckProgressStatus::Masked, CheckResultModelRole::CheckProgressFlag); - Q_EMIT SysVersionExamFinished(); -} - -void SysCheckAdaptorModel::fixDisk() -{ - QProcess::startDetached("deepin-diskmanager", {}); - m_model->addSecurityLog(KDiskChecked); -} - -void SysCheckAdaptorModel::fixTrash() -{ - if (m_totalTrashSize >= 100 * MB_COUNT) { - m_fixingItems.append(SysCheckItemID::Trash); - Q_EMIT fixItemStarted(SysCheckItemID::Trash); - Q_EMIT m_model->requestCleanSelectTrash(); - m_model->addSecurityLog(kTrashFixed); - } -} - -void SysCheckAdaptorModel::fixSysUpdate() -{ - if (m_isSysOutDate) { - m_model->openSysUpdatePage(); - } -} - -void SysCheckAdaptorModel::fixDevMode() -{ - // do nothing -} - -void SysCheckAdaptorModel::fixAutoStart() -{ - m_model->openStartupControlPage(); -} - -void SysCheckAdaptorModel::initConnection() -{ - connect(this, - &SysCheckAdaptorModel::SSHExamFinished, - this, - &SysCheckAdaptorModel::startAutoStartExam); - connect(this, - &SysCheckAdaptorModel::AutoStartExamFinished, - this, - &SysCheckAdaptorModel::startSysVersionExam); - connect(this, - &SysCheckAdaptorModel::SysVersionExamFinished, - this, - &SysCheckAdaptorModel::startTrashExam); - connect(this, - &SysCheckAdaptorModel::TrashExamFinished, - this, - &SysCheckAdaptorModel::startDiskExam); - connect(this, - &SysCheckAdaptorModel::DiskExamFinished, - this, - &SysCheckAdaptorModel::startDevModeExam); - connect(this, - &SysCheckAdaptorModel::DevModeExamFinished, - this, - &SysCheckAdaptorModel::onCheckDone); - - connect(&m_sysVersionTimer, - &QTimer::timeout, - this, - &SysCheckAdaptorModel::onSysVersionCheckTimeout); - connect(m_model, &HomePageModel::trashScanFinished, this, [this](double size) { - if (m_processingIndex != SysCheckItemID::Trash) { - return; - } - m_totalTrashSize = size; - QStandardItem *trashItem = m_resultItems[SysCheckItemID::Trash]; - trashItem->setData(SysCheckItemID::Trash, CheckResultModelRole::ID); - trashItem->setData(CheckProgressStatus::Success, CheckResultModelRole::CheckProgressFlag); - trashItem->setData(m_totalTrashSize >= (100 * MB_COUNT), - CheckResultModelRole::IsIssueHappen); - trashItem->setData(m_totalTrashSize, CheckResultModelRole::Details); - - Q_EMIT TrashExamFinished(); - }); - // SSH DISK没有相关信号可转发 - connect(m_model, &HomePageModel::CheckSysUpdateFinished, this, [this](bool isOutOfDate) { - if (m_processingIndex != SysCheckItemID::SystemUpdate) { - return; - } - m_sysVersionTimer.stop(); - m_isSysOutDate = isOutOfDate; - m_model->SetSysVersionChecking(false); - - QStandardItem *sysVersionItem = m_resultItems[SysCheckItemID::SystemUpdate]; - sysVersionItem->setData(SysCheckItemID::SystemUpdate, CheckResultModelRole::ID); - sysVersionItem->setData(CheckProgressStatus::Success, - CheckResultModelRole::CheckProgressFlag); - sysVersionItem->setData(m_isSysOutDate, CheckResultModelRole::IsIssueHappen); - sysVersionItem->setData(m_isSysOutDate, CheckResultModelRole::Details); - Q_EMIT SysVersionExamFinished(); - }); - // 开发者模式没有信号可转发 - connect(m_model, &HomePageModel::checkAutoStartFinished, this, [this](int count) { - if (m_processingIndex != SysCheckItemID::AutoStartApp) { - return; - } - m_autoStartCount = count; - m_model->SetAutoStartAppChecking(false); - QStandardItem *autoStartItem = m_resultItems[SysCheckItemID::AutoStartApp]; - autoStartItem->setData(SysCheckItemID::AutoStartApp, CheckResultModelRole::ID); - autoStartItem->setData(CheckProgressStatus::Success, - CheckResultModelRole::CheckProgressFlag); - autoStartItem->setData(m_autoStartCount > 0, CheckResultModelRole::IsIssueHappen); - autoStartItem->setData(m_model->ignoreAutoStartChecking(), CheckResultModelRole::IsIgnored); - autoStartItem->setData(m_autoStartCount, CheckResultModelRole::Details); - Q_EMIT AutoStartExamFinished(); - }); - - connect(m_model, &HomePageModel::cleanSelectTrashFinished, this, [this] { - if (!m_resultItems.size()) { - return; - } - m_totalTrashSize = 0.0; - m_resultItems[SysCheckItemID::Trash]->setData(false, CheckResultModelRole::IsIssueHappen); - m_resultItems[SysCheckItemID::Trash]->setData(m_totalTrashSize, - CheckResultModelRole::Details); - m_fixingItems.removeAll(SysCheckItemID::Trash); - Q_EMIT fixItemFinished(SysCheckItemID::Trash); - }); - - connect(m_model, - &HomePageModel::autoStartAppCountChanged, - this, - &SysCheckAdaptorModel::onAutoStartAppCountChanged); -} - -// 更新检查结果 -void SysCheckAdaptorModel::updateIssuePoint() -{ - m_issuePoint = 0; - m_issueCount = 0; - - // disk - m_issuePoint += !m_isDiskNormal ? kIssuePointInfoList[SysCheckItemID::Disk] : 0; - m_issueCount += !m_isDiskNormal ? 1 : 0; - if (!m_isDiskNormal) { - if (!m_logProblemItemsInfo.isEmpty()) { - m_logProblemItemsInfo.append(SEPERATOR); - } - m_logProblemItemsInfo.append(kTypename4); - } - - // trash - m_issuePoint += - m_totalTrashSize >= (100 * MB_COUNT) ? kIssuePointInfoList[SysCheckItemID::Trash] : 0; - m_issueCount += m_totalTrashSize >= (100 * MB_COUNT) ? 1 : 0; - // trash总量大于1G时,有修正值 - m_issuePoint += m_totalTrashSize > (1 * GB_COUNT) ? kTrashSizeTooLargeAdjustPoint : 0; - if (m_totalTrashSize >= (100 * MB_COUNT)) { - if (!m_logProblemItemsInfo.isEmpty()) { - m_logProblemItemsInfo.append(SEPERATOR); - } - m_logProblemItemsInfo.append(kTypename5); - } - - // sys update - m_issuePoint += m_isSysOutDate ? kIssuePointInfoList[SysCheckItemID::SystemUpdate] : 0; - m_issueCount += m_isSysOutDate ? 1 : 0; - if (m_isSysOutDate) { - if (!m_logProblemItemsInfo.isEmpty()) { - m_logProblemItemsInfo.append(SEPERATOR); - } - m_logProblemItemsInfo.append(kTypename6); - } - - // devmod - if (!m_model->ignoreDevModeChecking()) { - m_issuePoint += m_isDevMode ? kIssuePointInfoList[SysCheckItemID::DevMode] : 0; - m_issueCount += m_isDevMode ? 1 : 0; - if (m_isDevMode) { - if (!m_logProblemItemsInfo.isEmpty()) { - m_logProblemItemsInfo.append(SEPERATOR); - } - m_logProblemItemsInfo.append(kTypename7); - } - } - // autostart - if (!m_model->ignoreAutoStartChecking()) { - m_issuePoint += m_autoStartCount ? kIssuePointInfoList[SysCheckItemID::AutoStartApp] : 0; - m_issueCount += m_autoStartCount ? 1 : 0; - if (m_autoStartCount) { - if (!m_logProblemItemsInfo.isEmpty()) { - m_logProblemItemsInfo.append(SEPERATOR); - } - m_logProblemItemsInfo.append(kTypename8); - } - } - - m_model->setSafetyScore(CHECK_MAX_POINT > m_issuePoint ? CHECK_MAX_POINT - m_issuePoint : 0); - m_model->addSecurityLog(kErrorInfomation.arg(m_issueCount).arg(m_logProblemItemsInfo)); -} - -void SysCheckAdaptorModel::resetResultItems() -{ - qDeleteAll(m_resultItems); - m_resultItems.clear(); - for (int i = SysCheckItemID::SSH; i <= SysCheckItemID::AutoStartApp; i++) { - m_resultItems.push_back(new QStandardItem); - } -} diff --git a/deepin-pc-manager/src/window/modules/homepagecheck/syscheckadaptormodel.h b/deepin-pc-manager/src/window/modules/homepagecheck/syscheckadaptormodel.h deleted file mode 100644 index 8bd064a..0000000 --- a/deepin-pc-manager/src/window/modules/homepagecheck/syscheckadaptormodel.h +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (C) 2019 ~ 2022 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef SYSCHECKADAPTORMODE_H -#define SYSCHECKADAPTORMODE_H - -#include "homepagemodel.h" -#include "widgets/systemcheckdefinition.h" - -#include -#include -#include -#include - -class SysCheckAdaptorModel : public QObject -{ - Q_OBJECT -public: - explicit SysCheckAdaptorModel(HomePageModel *model, QObject *parent = nullptr); - ~SysCheckAdaptorModel(); - - inline int getIssueCount() { return m_issueCount; } - - inline int getIssuePoint() - { - return CHECK_MAX_POINT > m_issuePoint ? CHECK_MAX_POINT - m_issuePoint : 0; - } - - bool isFastFixValid(); - -Q_SIGNALS: - void DiskExamFinished(); - void SSHExamFinished(); - void TrashExamFinished(); - void SysVersionExamFinished(); - void DevModeExamFinished(); - void AutoStartExamFinished(); - - void checkStarted(); - void stageChanged(SysCheckItemID); - void checkFinished(); - - void fixItemStarted(SysCheckItemID); - void fixItemFinished(SysCheckItemID); - void onAutoStartAppCountChanged(int); - -public Q_SLOTS: - // 根据UI的设计,此处串行执行 - void startExam(); - void startDiskExam(); - void startSSHExam(); - void startTrashExam(); - void startSysVersionExam(); - void startDevModeExam(); - void startAutoStartExam(); - - void onCheckStarted(); - void onCheckDone(); - void onCheckCanceled(); - - void onRequestFixAll(); - void onRequestFixItem(SysCheckItemID); - void onRequestSetIgnore(SysCheckItemID, bool); - - void onSysVersionCheckTimeout(); - - const QStandardItemModel &getResultModel(); - - bool isProcessingFastFixing(); - -private: - void initConnection(); - void updateIssuePoint(); - void resetResultItems(); - - void fixDisk(); - void fixTrash(); - void fixSysUpdate(); - void fixDevMode(); - void fixAutoStart(); - -private: - HomePageModel *m_model; - bool m_isDiskNormal; - double m_totalTrashSize; - bool m_isSysOutDate; - bool m_isDevMode; - int m_autoStartCount; - // 用于检查页结果展示的数据 - QList m_resultItems; - QStandardItemModel m_resultModel; - int m_issuePoint; // 检查项累积扣分 - int m_processingIndex; // 检查进度索引,避免受外部信号影响检查过程 - int m_issueCount; - QTimer m_sysVersionTimer; // 系统体检超时处理 - QString m_logProblemItemsInfo; - QList m_fixingItems; -}; - -#endif // SYSCHECKADAPTORMODE_H diff --git a/deepin-pc-manager/src/window/modules/homepagecheck/widgets/checkprocessingwidget.cpp b/deepin-pc-manager/src/window/modules/homepagecheck/widgets/checkprocessingwidget.cpp deleted file mode 100644 index 74dd138..0000000 --- a/deepin-pc-manager/src/window/modules/homepagecheck/widgets/checkprocessingwidget.cpp +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright (C) 2019 ~ 2022 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "checkprocessingwidget.h" - -#include -#include - -#include -#include - -#define PROGRESS_MAX 100 -#define PROGRESS_MIN 0 -#define TIME_FORMAT "hh:mm:ss" - -DWIDGET_USE_NAMESPACE; - -#define FIXED_ROW(row, height) \ - { \ - mainLayout->setRowStretch(row, height); \ - mainLayout->setRowMinimumHeight(row, height); \ - } - -#define FIXED_COL(column, weight) \ - { \ - mainLayout->setColumnStretch(column, weight); \ - mainLayout->setColumnMinimumWidth(column, weight); \ - } - -#define SET_ACC_NAME(control, name) SET_ACCESS_NAME_T(control, checkProgressingWidget, name) - -CheckProcessingWidget::CheckProcessingWidget(QWidget *parent) - : DFrame(parent) - , m_movieLable(nullptr) - , m_stageLable(nullptr) - , m_infoLable(nullptr) - , m_progressBar(nullptr) - , m_timeLable(nullptr) - , m_progressValue(PROGRESS_MIN) -{ - this->setFixedSize(770, 590); - this->setContentsMargins(0, 10, 0, 10); - this->setFocusPolicy(Qt::NoFocus); - this->setLineWidth(0); - - initUI(); - initConnection(); - - m_timer.setInterval(1000); - m_timer.setSingleShot(false); - connect(&m_timer, &QTimer::timeout, this, &CheckProcessingWidget::ticktock); - - // 唯一窗口实例 - this->setObjectName("checkProgressingWidget"); - this->setAccessibleName("checkProgressingWidget"); -} - -void CheckProcessingWidget::onCheckMissionCompleted(int point) -{ - int current = m_progressBar->value(); - current += point; - m_progressBar->setValue(current < PROGRESS_MAX ? current : PROGRESS_MAX); -} - -void CheckProcessingWidget::onCheckMissionStarted(SysCheckItemID id) -{ - if (SysCheckItemID::SSH == id) { - m_stageLable->setText(kStageinfo3); - } else if (SysCheckItemID::Disk == id) { - m_stageLable->setText(kStageinfo4); - } else if (SysCheckItemID::Trash == id) { - m_stageLable->setText(kStageinfo5); - } else if (SysCheckItemID::SystemUpdate == id) { - m_stageLable->setText(kStageinfo6); - } else if (SysCheckItemID::DevMode == id) { - m_stageLable->setText(kStageinfo7); - } else if (SysCheckItemID::AutoStartApp == id) { - m_stageLable->setText(kStageinfo8); - } else if (SysCheckItemID::MaxLimit == id) { - m_stageLable->setText(kStageinfo8); - } - m_progressBar->setValue(m_progressValue); - m_progressValue += PROGRESS_MAX / (int(SysCheckItemID::MaxLimit) - 2); -} - -// 检查初始化 -void CheckProcessingWidget::onCheckInitial() -{ - m_startTime = QTime::currentTime(); - m_progressBar->setValue(PROGRESS_MIN); - m_stageLable->setText(""); - m_timeLable->setText(QTime(0, 0, 0, 0).toString(TIME_FORMAT)); - - m_infoLable->setText(kProcessingText); - - m_timer.start(); - - m_progressValue = PROGRESS_MIN; - - // 在这里通过modal开始检查 - Q_EMIT checkPrepared(); -} - -void CheckProcessingWidget::onCheckDone() -{ - m_timer.stop(); - - m_progressBar->setValue(PROGRESS_MAX); - // 通知上层显示结果页 - Q_EMIT checkDone(); -} - -void CheckProcessingWidget::ticktock() -{ - QTime now = QTime::currentTime(); - QTime info(0, 0, 0, 0); - info = info.addSecs(m_startTime.secsTo(now)); - m_timeLable->setText(info.toString(TIME_FORMAT)); - - QString infoText = m_infoLable->text(); - infoText.append("."); - infoText.remove("...."); - m_infoLable->setText(infoText); -} - -void CheckProcessingWidget::initUI() -{ - m_movieLable = new DLabel(this); - m_movieLable->setFixedSize(340, 340); - m_movieLable->setAlignment(Qt::AlignCenter); - m_movieLable->setPixmap(QIcon::fromTheme(k1stPageLogoPath).pixmap(320, 320)); - SET_ACC_NAME(m_movieLable, movieLable); - - m_stageLable = new DLabel(this); - SET_ACC_NAME(m_stageLable, stageLable); - FIXED_FONT_PIXEL_SIZE(m_stageLable, 16); - - m_infoLable = new DLabel(this); - SET_ACC_NAME(m_infoLable, infoLable); - FIXED_FONT_PIXEL_SIZE(m_infoLable, 30); - - m_progressBar = new DProgressBar(this); - SET_ACC_NAME(m_progressBar, progressBar); - m_progressBar->setRange(PROGRESS_MIN, PROGRESS_MAX); - m_progressBar->setValue(50); - m_progressBar->setFixedSize(573, 12); - m_progressBar->setTextVisible(false); - - m_cancelButton = new DPushButton(this); - SET_ACC_NAME(m_cancelButton, cancelButton); - m_cancelButton->setFixedSize(22, 22); - m_cancelButton->setFlat(true); - m_cancelButton->setIcon(QIcon::fromTheme(kProgressCancelIconPath)); - m_cancelButton->setIconSize(QSize(22, 22)); - - m_timeLable = new DTipLabel("", this); - SET_ACC_NAME(m_timeLable, timeLable); - m_timeLable->setText(QTime(0, 0, 0, 0).toString(TIME_FORMAT)); - DFontSizeManager::instance()->unbind(m_timeLable); - FIXED_FONT_PIXEL_SIZE(m_timeLable, 12); - - QGridLayout *mainLayout = new QGridLayout; - mainLayout->setContentsMargins(0, 0, 0, 0); - - FIXED_COL(0, 87); - FIXED_COL(1, 573); - FIXED_COL(2, 0); - FIXED_COL(3, 78); - - FIXED_ROW(0, 340); // logo - mainLayout->addWidget(m_movieLable, 0, 0, 1, -1, Qt::AlignBottom | Qt::AlignHCenter); - FIXED_ROW(1, 24); // stage - mainLayout->addWidget(m_stageLable, 1, 0, 1, -1, Qt::AlignHCenter | Qt::AlignBottom); - FIXED_ROW(2, 54); // info - mainLayout->addWidget(m_infoLable, 2, 0, 1, -1, Qt::AlignHCenter | Qt::AlignBottom); - FIXED_ROW(3, 20); // space - FIXED_ROW(4, 22); // progressbar - mainLayout->addWidget(m_progressBar, 4, 1, 1, 1, Qt::AlignVCenter); - mainLayout->addWidget(m_cancelButton, 4, 3, 1, 1, Qt::AlignVCenter | Qt::AlignLeft); - FIXED_ROW(5, 27); // time - mainLayout->addWidget(m_timeLable, 5, 0, 1, -1, Qt::AlignCenter); - FIXED_ROW(6, 78); // space - - this->setLayout(mainLayout); -} - -void CheckProcessingWidget::initConnection() -{ - connect(m_cancelButton, &DPushButton::clicked, this, [this] { - Q_EMIT checkCanceled(); - }); -} diff --git a/deepin-pc-manager/src/window/modules/homepagecheck/widgets/checkprocessingwidget.h b/deepin-pc-manager/src/window/modules/homepagecheck/widgets/checkprocessingwidget.h deleted file mode 100644 index 978360a..0000000 --- a/deepin-pc-manager/src/window/modules/homepagecheck/widgets/checkprocessingwidget.h +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2019 ~ 2022 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef CHECKPROCESSINGWIDGET_H -#define CHECKPROCESSINGWIDGET_H - -#include "systemcheckdefinition.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -class CheckProcessingWidget : public Dtk::Widget::DFrame -{ - Q_OBJECT -public: - explicit CheckProcessingWidget(QWidget *parent = nullptr); - -public Q_SLOTS: - // point为任务自身属性 - void onCheckMissionCompleted(int point); - void onCheckMissionStarted(SysCheckItemID); - void onCheckInitial(); - void onCheckDone(); - void ticktock(); - -Q_SIGNALS: - void checkCanceled(); - void checkPrepared(); - void checkDone(); - -private: - void initUI(); - void initConnection(); - -private: - Dtk::Widget::DLabel *m_movieLable; - Dtk::Widget::DLabel *m_stageLable; - Dtk::Widget::DLabel *m_infoLable; - Dtk::Widget::DProgressBar *m_progressBar; - Dtk::Widget::DTipLabel *m_timeLable; - Dtk::Widget::DPushButton *m_cancelButton; - QTimer m_timer; - QTime m_startTime; - int m_progressValue; -}; - -#endif // CHECKPROCESSINGWIDGET_H diff --git a/deepin-pc-manager/src/window/modules/homepagecheck/widgets/syscheckresultwidget.cpp b/deepin-pc-manager/src/window/modules/homepagecheck/widgets/syscheckresultwidget.cpp deleted file mode 100644 index adac00c..0000000 --- a/deepin-pc-manager/src/window/modules/homepagecheck/widgets/syscheckresultwidget.cpp +++ /dev/null @@ -1,248 +0,0 @@ -// Copyright (C) 2019 ~ 2022 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "syscheckresultwidget.h" - -#include "systemcheckdefinition.h" - -#include -#include - -DWIDGET_USE_NAMESPACE - -#define SET_ACC_NAME(control, name) SET_ACCESS_NAME_T(control, sysCheckResultWidget, name) - -SysCheckResultWidget::SysCheckResultWidget(QWidget *parent) - : DFrame(parent) - , m_header(nullptr) - , m_checkedButton(nullptr) - , m_fixedButton(nullptr) - , m_recheckButton(nullptr) - -{ - this->setFixedSize(770, 590); - this->setFocusPolicy(Qt::NoFocus); - this->setLineWidth(0); - this->setContentsMargins(0, 10, 0, 10); - - initUI(); - initConnection(); - onCheckFinished(); - - // 唯一窗口实例 - this->setAccessibleName("sysCheckResultWidget"); -} - -void SysCheckResultWidget::onCheckFinished() -{ - hideAll(); - m_checkedButton->show(); - m_recheckButton->show(); - m_checkedButton->setDisabled(false); - m_recheckButton->setDisabled(false); -} - -void SysCheckResultWidget::onFixing() -{ - hideAll(); - m_checkedButton->show(); - m_recheckButton->show(); - m_checkedButton->setDisabled(true); - m_recheckButton->setDisabled(true); -} - -void SysCheckResultWidget::onFixed() -{ - hideAll(); - m_fixedButton->show(); - m_recheckButton->show(); - m_fixedButton->setDisabled(false); - m_recheckButton->setDisabled(false); -} - -void SysCheckResultWidget::setResultModel(const QStandardItemModel &result) -{ - // 对各项设置结果 - for (auto wid : m_itemWidgets) { - wid->setResult(result); - } - resetItemsBackGround(); -} - -void SysCheckResultWidget::setHeaderContent(int point, int issueCount) -{ - m_header->onPointChanged(point, issueCount); -} - -void SysCheckResultWidget::setFastFixValid(bool isValid) -{ - if (isValid) { - m_checkedButton->show(); - m_fixedButton->hide(); - } else { - m_fixedButton->show(); - m_checkedButton->hide(); - } -} - -void SysCheckResultWidget::resetItemsBackGround() -{ - bool isNeedColored = false; - for (int index = 0; index < m_itemWidgets.size(); index++) { - auto wid = m_itemWidgets[index]; - if (!wid->isHidden()) { - DPalette::ColorType role = isNeedColored ? DPalette::ItemBackground : DPalette::NoType; - wid->setBackgroundRole(role); - isNeedColored = !isNeedColored; - } - } -} - -void SysCheckResultWidget::setAutoStartAppCount(int count) -{ - Q_EMIT autoStartAppCountChanged(count); -} - -void SysCheckResultWidget::onFixStarted(SysCheckItemID id) -{ - if (id == SysCheckItemID::Trash) { - m_currentFixingItems.push_back(id); - m_recheckButton->setDisabled(true); - m_checkedButton->setDisabled(true); - } - - Q_EMIT onFixItemStarted(id); -} - -void SysCheckResultWidget::onFixFinished(SysCheckItemID id) -{ - if (id == SysCheckItemID::Trash) { - if (m_currentFixingItems.contains(id)) { - m_currentFixingItems.removeAll(id); - } - if (!m_currentFixingItems.size()) { - m_recheckButton->setDisabled(false); - m_checkedButton->setDisabled(false); - } - } - Q_EMIT onFixItemFinished(id); -} - -void SysCheckResultWidget::initUI() -{ - QGridLayout *mainLayout = new QGridLayout; - mainLayout->setSpacing(10); - mainLayout->setContentsMargins(0, 0, 0, 0); - - m_header = new SysCheckResultHeaderWidget(this); - m_checkedButton = new DSuggestButton(this); - SET_ACC_NAME(m_checkedButton, checkedButton); - m_checkedButton->setFocusPolicy(Qt::NoFocus); - m_checkedButton->setFixedWidth(150); - FIXED_FONT_PIXEL_SIZE(m_checkedButton, 14); - m_checkedButton->setText(kResultWidRightButtonChecked); - - m_fixedButton = new DSuggestButton(this); - SET_ACC_NAME(m_fixedButton, fixedButton); - m_fixedButton->setFocusPolicy(Qt::NoFocus); - m_fixedButton->setFixedWidth(150); - FIXED_FONT_PIXEL_SIZE(m_fixedButton, 14); - m_fixedButton->setText(kResultWidRightButtonFixed); - - m_recheckButton = new DPushButton(this); - SET_ACC_NAME(m_recheckButton, recheckButton); - m_recheckButton->setFocusPolicy(Qt::NoFocus); - m_recheckButton->setFixedWidth(150); - FIXED_FONT_PIXEL_SIZE(m_recheckButton, 14); - m_recheckButton->setText(kResultWidLeftButtonRecheck); - - createItemWidgets(); - QVBoxLayout *boxLayout = new QVBoxLayout; - boxLayout->setSpacing(4); - - // 调整检查项的显示顺序 - boxLayout->addWidget(m_itemWidgets[SysCheckItemID::SSH], 0, Qt::AlignTop | Qt::AlignLeft); - boxLayout->addWidget(m_itemWidgets[SysCheckItemID::AutoStartApp], - 0, - Qt::AlignTop | Qt::AlignLeft); - boxLayout->addWidget(m_itemWidgets[SysCheckItemID::SystemUpdate], - 0, - Qt::AlignTop | Qt::AlignLeft); - boxLayout->addWidget(m_itemWidgets[SysCheckItemID::Trash], 0, Qt::AlignTop | Qt::AlignLeft); - boxLayout->addWidget(m_itemWidgets[SysCheckItemID::Disk], 0, Qt::AlignTop | Qt::AlignLeft); - boxLayout->addWidget(m_itemWidgets[SysCheckItemID::DevMode], 0, Qt::AlignTop | Qt::AlignLeft); - - boxLayout->addStretch(10); - - FIXED_ROW(0, 146); - FIXED_ROW(1, 348); - FIXED_ROW(2, 56); - - FIXED_COL(0, 385); - FIXED_COL(1, 385); - - mainLayout->addWidget(m_header, 0, 0, 1, -1, Qt::AlignCenter); - mainLayout->addLayout(boxLayout, 1, 0, 1, -1, Qt::AlignCenter); - mainLayout->addWidget(m_recheckButton, 2, 0, Qt::AlignRight | Qt::AlignVCenter); - mainLayout->addWidget(m_checkedButton, 2, 1, Qt::AlignLeft | Qt::AlignVCenter); - mainLayout->addWidget(m_fixedButton, 2, 1, Qt::AlignLeft | Qt::AlignVCenter); - - this->setLayout(mainLayout); -} - -void SysCheckResultWidget::initConnection() -{ - connect(m_recheckButton, &QPushButton::clicked, this, &SysCheckResultWidget::requestCheckAgain); - connect(m_fixedButton, &QPushButton::clicked, this, &SysCheckResultWidget::requestQuit); - connect(m_checkedButton, &QPushButton::clicked, this, &SysCheckResultWidget::requestFixAll); -} - -void SysCheckResultWidget::createItemWidgets() -{ - QStringList accNames = { "sshCheckItem", "diskCheckItem", "trashCheckItem", - "sysUpdateCheckItem", "devModeCheckItem", "autoStartCheckItem" }; - m_itemWidgets.clear(); - for (int id = SysCheckItemID::SSH; id <= SysCheckItemID::AutoStartApp; id++) { - SysCheckResultItemWidget *item = new SysCheckResultItemWidget(SysCheckItemID(id), this); - - item->setAccessibleName(accNames[id]); - - connect(item, - &SysCheckResultItemWidget::requestFixItem, - this, - &SysCheckResultWidget::requestFixItem); - connect(item, - &SysCheckResultItemWidget::requestSetIgnore, - this, - &SysCheckResultWidget::requestSetIgnore); - connect(item, - &SysCheckResultItemWidget::widgetHidden, - this, - &SysCheckResultWidget::resetItemsBackGround); - - connect(this, - &SysCheckResultWidget::onFixItemStarted, - item, - &SysCheckResultItemWidget::onNotifyFixStarted); - connect(this, - &SysCheckResultWidget::onFixItemFinished, - item, - &SysCheckResultItemWidget::onNotifyFixFinished); - connect(this, - &SysCheckResultWidget::autoStartAppCountChanged, - item, - &SysCheckResultItemWidget::onAutoStartAppCountChanged); - - m_itemWidgets.push_back(item); - } - - resetItemsBackGround(); -} - -void SysCheckResultWidget::hideAll() -{ - m_fixedButton->hide(); - m_checkedButton->hide(); -} diff --git a/deepin-pc-manager/src/window/modules/homepagecheck/widgets/syscheckresultwidget.h b/deepin-pc-manager/src/window/modules/homepagecheck/widgets/syscheckresultwidget.h deleted file mode 100644 index 2e2d7f1..0000000 --- a/deepin-pc-manager/src/window/modules/homepagecheck/widgets/syscheckresultwidget.h +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (C) 2019 ~ 2022 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef SYSCHECKRESUTLWIDGET_H -#define SYSCHECKRESUTLWIDGET_H - -#include "syscheckresultheaderwidget.h" -#include "syscheckresultitemwidget.h" - -#include -#include -#include - -#include -#include -#include - -class SysCheckResultWidget : public Dtk::Widget::DFrame -{ - Q_OBJECT -public: - explicit SysCheckResultWidget(QWidget *parent = nullptr); - -public Q_SLOTS: - void onCheckFinished(); - void onFixing(); - void onFixed(); - void setResultModel(const QStandardItemModel &); - void setHeaderContent(int point, int issueCount); - void setFastFixValid(bool); - void resetItemsBackGround(); - void setAutoStartAppCount(int); - void onFixStarted(SysCheckItemID id); - void onFixFinished(SysCheckItemID id); - -Q_SIGNALS: - void onFixItemStarted(SysCheckItemID id); - void onFixItemFinished(SysCheckItemID id); - void requestFixItem(SysCheckItemID id); - void requestFixAll(); - - void requestCheckAgain(); - void requestSetIgnore(SysCheckItemID, bool); - - void requestQuit(); - void autoStartAppCountChanged(int); - -private: - void initUI(); - void initConnection(); - void createItemWidgets(); - void hideAll(); - -private: - SysCheckResultHeaderWidget *m_header; - Dtk::Widget::DSuggestButton *m_checkedButton; - Dtk::Widget::DSuggestButton *m_fixedButton; - Dtk::Widget::DPushButton *m_recheckButton; - QList m_itemWidgets; - QList m_currentFixingItems; -}; - -#endif // SYSCHECKRESUTLWIDGET_H diff --git a/deepin-pc-manager/src/window/modules/homepagecheck/widgets/systemcheckdefinition.h b/deepin-pc-manager/src/window/modules/homepagecheck/widgets/systemcheckdefinition.h deleted file mode 100644 index f9ffebf..0000000 --- a/deepin-pc-manager/src/window/modules/homepagecheck/widgets/systemcheckdefinition.h +++ /dev/null @@ -1,231 +0,0 @@ -// Copyright (C) 2019 ~ 2022 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef SYSTEMCHECKDEFINITION_H -#define SYSTEMCHECKDEFINITION_H - -#include -#include -#include - -#define MB_COUNT (1 << 20) -#define GB_COUNT (1 << 30) - -#define SYS_VER_CHECK_TIMEOUT 40 * 1000 - -#define FIXED_ROW(row, height) \ - { \ - mainLayout->setRowStretch(row, height); \ - mainLayout->setRowMinimumHeight(row, height); \ - } - -#define FIXED_COL(column, weight) \ - { \ - mainLayout->setColumnStretch(column, weight); \ - mainLayout->setColumnMinimumWidth(column, weight); \ - } - -#define FIXED_FONT_PIXEL_SIZE(widget, size) \ - { \ - QFont widget##Font = widget->font(); \ - widget##Font.setPixelSize(size); \ - widget->setFont(widget##Font); \ - } - -#define CHECK_MAX_POINT 100 -#define RICH_TEXT_COLOR_FORMAT "%2" - -// 自动化标签 -#define ACCNAMESTR(content) #content -#define SET_ACCESS_NAME_T(control, className, name) \ - control->setAccessibleName(ACCNAMESTR(className##_##name)); - -enum SysCheckItemID { SSH, Disk, Trash, SystemUpdate, DevMode, AutoStartApp, MaxLimit }; - -enum IgnoreStatus { WithNoIgnore, Ignored, IgnoreCanceled }; - -enum CheckProgressStatus { Success, TimeOut, Masked }; - -// 错误数据模型角色 -enum CheckResultModelRole { - ID = Qt::UserRole + 1, // 检查项ID - CheckProgressFlag, // 检查项是完成还是超时还是被屏蔽(异常状态为系统版本检查超时, - // 病毒查杀冲突, SSH被隐藏) - IsIssueHappen, // 检查项是否存在问题 - IsIgnored, // 检查项是否被设置为忽略状态 - Details // 检查项问题详细数据(不要记录复杂数据,仅检查项UI需要显示的数据,如 int - // bool等,具体数据放在本model中处理) -}; - -class SystemCheckDocument : public QObject -{ - Q_OBJECT -}; - -const QString k1stPageLogoPath = "dcc_syscheck_main_logo"; -const QString kprogressingLogoPath = "dcc_syscheck_progressing"; -const QString kAbnormalStatusIconPath = "dcc_syscheck_item_abnormal"; -const QString kNormalStatusIconPath = "dcc_syscheck_item_normal"; - -const QString kAbnormalResultLogoPath = "dcc_syscheck_result_abnormal"; -const QString kRepairingResultLogoPath = "dcc_syscheck_result_repair"; -const QString k100PointResultLogoPath = "dcc_syscheck_result_100point"; - -const QString kIgnoreBtnIconPath = "dcc_syscheck_item_ignore"; -const QString kDisIgnoreBtnIconPath = "dcc_syscheck_item_noignore"; - -const QString kProgressCancelIconPath = "dcc_syscheck_progress_cancel"; - -const QString k90_100Color = "#00C134"; -const QString k75_90Color = "#8CD400"; -const QString k60_75Color = "#FF5C00"; -const QString k0_60Color = "#D80000"; -const QString kOutOfDate = "#FF5C00"; - -#define kPointText SystemCheckDocument::tr("points") -#define kFixTip SystemCheckDocument::tr("Fixing") -#define kProcessingText SystemCheckDocument::tr("Checking") -// 首页上的彩色拼接字符串 -#define kyouComputer SystemCheckDocument::tr("Your computer is ") -#define katRist SystemCheckDocument::tr("at risk") -#define katHighRist SystemCheckDocument::tr("at high risk") - -#define k90_100GreetingStatus SystemCheckDocument::tr("Your computer is healthy") -#define k75_90GreetingStatus SystemCheckDocument::tr("Your computer is in good condition") -#define k60_75GreetingStatus SystemCheckDocument::tr("Your computer is at risk") -#define k0_60GreetingStatus SystemCheckDocument::tr("Your computer is at high risk") -#define k5DaysGreetingStatus \ - SystemCheckDocument::tr("Your computer has not been checked for a long time") -#define kOutOfDateGreetingStatus SystemCheckDocument::tr("Your computer has not been checked yet") - -#define k90_100GreetingInfo SystemCheckDocument::tr("Great! Keep staying healthy please.") -#define k75_90GreetingInfo SystemCheckDocument::tr("Start a check and perform some improvements.") -#define k60_75GreetingInfo SystemCheckDocument::tr("Please check your system now.") -#define k0_60GreetingInfo \ - SystemCheckDocument::tr("It is strongly recommended to check and fix your system now.") -#define k5DaysGreetingInfo SystemCheckDocument::tr("Have a new check right now.") -#define kOutOfDateGreetingInfo SystemCheckDocument::tr("Try a full check.") - -#define kAbnormalResultTitle SystemCheckDocument::tr("%1 issue(s) found") -#define kAbnormalResultTip \ - SystemCheckDocument::tr("Fix issues right now to keep your computer healthy.") -#define kNormalResultTitle SystemCheckDocument::tr("Your computer is healthy") -#define kNormalResultTip SystemCheckDocument::tr("Great! Keep staying healthy please.") - -#define kFixingTitle SystemCheckDocument::tr("Fixing issues") -#define kFixingTip SystemCheckDocument::tr("It will be completed soon.") -#define kFIxingText SystemCheckDocument::tr("fixing") - -// 以下列表,元素顺序均与6.0需求文档与UI对应 -// 注意 SSH检查略过,能窗口中略过检查和隐藏,不要在这里删除代码 -// configuration start -const QList kSystemCheckTypeIconList = { - "dcc_syscheck_item_antivirus", "dcc_syscheck_item_avupdate", "dcc_syscheck_item_ssh", - "dcc_syscheck_item_disk", "dcc_syscheck_item_garbage", "dcc_syscheck_item_sysupdate", - "dcc_syscheck_item_dev", "dcc_syscheck_item_autostart" -}; - -#define kTypename1 SystemCheckDocument::tr("Viruses and Trojans") -#define kTypename2 SystemCheckDocument::tr("Database version") -#define kTypename3 SystemCheckDocument::tr("Remote access (SSH)") -#define kTypename4 SystemCheckDocument::tr("Disk checking") -#define kTypename5 SystemCheckDocument::tr("System cleanup") -#define kTypename6 SystemCheckDocument::tr("System version") -#define kTypename7 SystemCheckDocument::tr("Developer mode") -#define kTypename8 SystemCheckDocument::tr("Startup programs") - -#define kStatusNormal1 SystemCheckDocument::tr("No threats found") -#define kStatusNormal2 SystemCheckDocument::tr("Up to date") -#define kStatusNormal3 SystemCheckDocument::tr("Closed") -#define kStatusNormal4 SystemCheckDocument::tr("No errors found") -#define kStatusNormal5 SystemCheckDocument::tr("Clean") -#define kStatusNormal6 SystemCheckDocument::tr("Up to date") -#define kStatusNormal7 SystemCheckDocument::tr("No root access") -#define kStatusNormal8 SystemCheckDocument::tr("%1 apps") - -#define kStatusAbnormal1 SystemCheckDocument::tr("Found threats") -#define kStatusAbnormal2 SystemCheckDocument::tr("Out of date") -#define kStatusAbnormal3 SystemCheckDocument::tr("Open") -#define kStatusAbnormal4 SystemCheckDocument::tr("Found errors") -#define kStatusAbnormal5 SystemCheckDocument::tr("There are junk files") -#define kStatusAbnormal6 SystemCheckDocument::tr("Out of date") -#define kStatusAbnormal7 SystemCheckDocument::tr("Root access allowed, which is risky") -#define kStatusAbnormal8 SystemCheckDocument::tr("%1 apps") - -#define kJumpLabel1 SystemCheckDocument::tr("Fix now") -#define kJumpLabel2 SystemCheckDocument::tr("Update now") -#define kJumpLabel3 SystemCheckDocument::tr("Close it") -#define kJumpLabel4 SystemCheckDocument::tr("Go to check") -#define kJumpLabel5 SystemCheckDocument::tr("Clean up") -#define kJumpLabel6 SystemCheckDocument::tr("Check for updates") -#define kJumpLabel7 "" -#define kJumpLabel8 SystemCheckDocument::tr("Check up") - -#define kStageinfo1 SystemCheckDocument::tr("Scanning viruses and Trojans") -#define kStageinfo2 SystemCheckDocument::tr("Checking the version of virus database") -#define kStageinfo3 SystemCheckDocument::tr("Checking the state of remote access (SSH)") -#define kStageinfo4 SystemCheckDocument::tr("Checking disks") -#define kStageinfo5 SystemCheckDocument::tr("Checking system junk") -#define kStageinfo6 SystemCheckDocument::tr("Checking if your system is up to date") -#define kStageinfo7 SystemCheckDocument::tr("Checking if the developer mode is enabled") -#define kStageinfo8 SystemCheckDocument::tr("Checking startup programs") - -// 检查项异常扣分规则 -const QList kIssuePointInfoList{ 30, // av - 10, // av version - 5, // ssh - 15, // disk - 5, // trash - 5, // system update - 5, // dev mode - 5 }; // autostart -// 垃圾清理总量大于1G时,额外扣分 -const int kTrashSizeTooLargeAdjustPoint = 5; - -#define kResultWidLeftButtonRecheck SystemCheckDocument::tr("Check Again") -#define kResultWidRightButtonChecked SystemCheckDocument::tr("Fix All") -#define kResultWidRightButtonFixed SystemCheckDocument::tr("Done", "button") - -#define kIgnoreButtonToolTip SystemCheckDocument::tr("Dismiss") -#define kDisIgnoreButtonToolTip SystemCheckDocument::tr("No dismission") - -// 日志相关 -#define kAutoStartDismissed SystemCheckDocument::tr("Startup programs checking dismissed") -#define kAutoStartResumed SystemCheckDocument::tr("Startup programs checking resumed") -#define kDevModeDismissed SystemCheckDocument::tr("Developer mode checking dismissed") -#define kAVFixed SystemCheckDocument::tr("Viruses and Trojans processed") -#define kAVVersionFixed SystemCheckDocument::tr("Virus database updated") -#define kTrashFixed SystemCheckDocument::tr("Junk files cleaned up") -#define KDiskChecked SystemCheckDocument::tr("Disk errors checked") -#define kErrorInfomation SystemCheckDocument::tr("%1 issues found in %2") - -// configuration end - -class SystemCheckHelper -{ -public: - static QString getColoredText(int point, const QString &input) - { - if (point >= 90) { - return QString(RICH_TEXT_COLOR_FORMAT).arg(k90_100Color).arg(input); - } - - if (point >= 75) { - return QString(RICH_TEXT_COLOR_FORMAT).arg(k75_90Color).arg(input); - } - - if (point >= 60) { - return QString(RICH_TEXT_COLOR_FORMAT).arg(k60_75Color).arg(input); - } - - if (point >= 0) { - return QString(RICH_TEXT_COLOR_FORMAT).arg(k0_60Color).arg(input); - } - - return QString(RICH_TEXT_COLOR_FORMAT).arg(kOutOfDate).arg(input); - } -}; - -#endif // SYSTEMCHECKDEFINITION_H diff --git a/deepin-pc-manager/src/window/modules/securitytools/defsecuritytoolinfo.cpp b/deepin-pc-manager/src/window/modules/securitytools/defsecuritytoolinfo.cpp deleted file mode 100644 index 7eb3917..0000000 --- a/deepin-pc-manager/src/window/modules/securitytools/defsecuritytoolinfo.cpp +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (C) 2020 ~ 2022 Uniontech Software Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "defsecuritytoolinfo.h" - -#include - -void registerDefSecurityToolInfo() -{ - qRegisterMetaType("DEFSECURITYTOOLINFO"); - qDBusRegisterMetaType(); -} - -void registerDefSecurityToolInfoList() -{ - qRegisterMetaType("DEFSECURITYTOOLINFOLIST"); - qRegisterMetaType>("QList"); - qDBusRegisterMetaType(); - qDBusRegisterMetaType>(); -} - -QDBusArgument &operator<<(QDBusArgument &argument, const DEFSECURITYTOOLINFO &toolInfo) -{ - argument.beginStructure(); - argument << toolInfo.strPackageName; - argument << toolInfo.strAppName; - argument << toolInfo.strImagePath; - argument << toolInfo.strDescription; - argument << toolInfo.strCompany; - argument << toolInfo.strInallModel; - argument << toolInfo.strCallMethodName; - argument << toolInfo.bSystemTool; - argument << toolInfo.bHasInstalled; - argument << toolInfo.bCanUpdate; - argument << toolInfo.iClassify; - argument << toolInfo.strReserve; - argument << toolInfo.strReserve2; - argument << toolInfo.strReserve3; - argument << toolInfo.strReserve4; - argument.endStructure(); - return argument; -} - -const QDBusArgument &operator>>(const QDBusArgument &argument, DEFSECURITYTOOLINFO &toolInfo) -{ - argument.beginStructure(); - argument >> toolInfo.strPackageName; - argument >> toolInfo.strAppName; - argument >> toolInfo.strImagePath; - argument >> toolInfo.strDescription; - argument >> toolInfo.strCompany; - argument >> toolInfo.strInallModel; - argument >> toolInfo.strCallMethodName; - argument >> toolInfo.bSystemTool; - argument >> toolInfo.bHasInstalled; - argument >> toolInfo.bCanUpdate; - argument >> toolInfo.iClassify; - argument >> toolInfo.strReserve; - argument >> toolInfo.strReserve2; - argument >> toolInfo.strReserve3; - argument >> toolInfo.strReserve4; - argument.endStructure(); - return argument; -} diff --git a/deepin-pc-manager/src/window/modules/securitytools/defsecuritytoolinfo.h b/deepin-pc-manager/src/window/modules/securitytools/defsecuritytoolinfo.h deleted file mode 100644 index 04d26b8..0000000 --- a/deepin-pc-manager/src/window/modules/securitytools/defsecuritytoolinfo.h +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (C) 2020 ~ 2022 Uniontech Software Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef DEFSECURITYTOOLINFO_H -#define DEFSECURITYTOOLINFO_H - -#include -#include -#include - -// 定义工具状态信息 -enum DEFSECURITYTOOLSTATUS { - UNINSTALLED, // 未安装 - INSTALLING, // 安装中 - INSTALLED, // 已安装 - INSTALLFAILED, // 安装失败 - INSTALLSUCCESS, // 安装成功 - WAITFORUPDATE, // 待更新状态 - UPDATING, // 更新中 - UPDATEFAIL, // 更新失败 - UPDATASUCCESS, // 更新成功 - UNINSTALLING, // 卸载中 - UNINSTALLFAILED // 卸载失败 -}; - -// 定义工具安装状态 -enum TOOLSSTATUS { ALL, INSTALLEDTOOL, UNINSTALLEDTOOL }; - -// 定义工具分类 -enum TOOLCLASSIFY { - ALLTOOLS, // 所有 - SYSTEMTOOLS, // 系统 - NETWORKTOOLS, // 网络 - DATATOOLS, // 数据 - APPMGRTOOLS, // 应用管理 - DEVICETOOLS // 外设 -}; - -// 定义工具信息结构体 -typedef struct DefSecurityToolInfo -{ - explicit DefSecurityToolInfo() - : strPackageName("") - , strAppName("") - , strImagePath("") - , strDescription("") - , strCompany("") - , strInallModel("") - , strCallMethodName("") - , bSystemTool(false) - , bHasInstalled(false) - , bCanUpdate(false) - , iClassify(ALLTOOLS) - , strReserve("") - , strReserve2("") - , strReserve3("") - , strReserve4("") - { - } - - QString getPackageKey() { return QString("%1_%2").arg(strPackageName).arg(strAppName); } - - QString strPackageName; // 安装包名称 - QString strAppName; // 应用名称 - QString strImagePath; // 图标名称 - QString strDescription; // 应用描述 - QString strCompany; - QString strInallModel; // 安装模型 - QString strCallMethodName; // 调用方法名称 - bool bSystemTool; // 是否可卸载 - bool bHasInstalled; // 已安装 - bool bCanUpdate; // 是否有更新 - int iClassify; // 应用分类 - QString strReserve; // 保留参数1,黙认对应用DBus的Service,当有其它调用方式时可以覆盖使用。 - QString strReserve2; // 保留参数2,黙认对应用DBus的Path, 当有其它调用方式时可以覆盖使用。 - QString strReserve3; // 保留参数3,黙认对应用DBus的Interface,当有其它调用方式时可以覆盖使用。 - QString strReserve4; // 保留参数3,黙认对应用DBus的服务总线类型,当有其它调用方式时可以覆盖使用。 -} DEFSECURITYTOOLINFO, *LPDEFSECURITYTOOLINFO; - -typedef QList DEFSECURITYTOOLINFOLIST; - -Q_DECLARE_METATYPE(DEFSECURITYTOOLINFO); -Q_DECLARE_METATYPE(DEFSECURITYTOOLINFOLIST); -void registerDefSecurityToolInfo(); -void registerDefSecurityToolInfoList(); -QDBusArgument &operator<<(QDBusArgument &argument, const DEFSECURITYTOOLINFO &toolInfo); -const QDBusArgument &operator>>(const QDBusArgument &argument, DEFSECURITYTOOLINFO &toolInfo); - -#endif // DEFSECURITYTOOLINFO_H diff --git a/deepin-pc-manager/src/window/modules/securitytools/defsecuritytoollistwidget.h b/deepin-pc-manager/src/window/modules/securitytools/defsecuritytoollistwidget.h deleted file mode 100644 index 8fc9b8f..0000000 --- a/deepin-pc-manager/src/window/modules/securitytools/defsecuritytoollistwidget.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2020 ~ 2022 Uniontech Software Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef DEFSECURITYTOOLVIEW_H -#define DEFSECURITYTOOLVIEW_H - -#include - -DWIDGET_USE_NAMESPACE - -class DefSecurityToolListWidget : public DListWidget -{ - Q_OBJECT -public: - explicit DefSecurityToolListWidget(QWidget *parent = nullptr); - ~DefSecurityToolListWidget() override; - -signals: - -public slots: -}; - -#endif // DEFSECURITYTOOLVIEW_H diff --git a/deepin-pc-manager/src/window/modules/securitytools/defsecuritytoolsfrontunit.cpp b/deepin-pc-manager/src/window/modules/securitytools/defsecuritytoolsfrontunit.cpp deleted file mode 100644 index ae02eaf..0000000 --- a/deepin-pc-manager/src/window/modules/securitytools/defsecuritytoolsfrontunit.cpp +++ /dev/null @@ -1,386 +0,0 @@ -// Copyright (C) 2020 ~ 2022 Uniontech Software Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "defsecuritytoolsfrontunit.h" - -#include "securitytoolsmodel.h" -#include "src/window/modules/common/compixmap.h" - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -DefSecurityToolsFrontUnit::DefSecurityToolsFrontUnit(DWidget *parent) - : DFrame(parent) - , m_toolInfo() - , m_status(DEFSECURITYTOOLSTATUS::UNINSTALLED) - , m_pImageLabel(nullptr) - , m_pAppNameLabel(nullptr) - , m_pDesLabel(nullptr) - , m_pCompanyNameLabel(nullptr) - , m_pOpenBtn(nullptr) - , m_pUpdateBtn(nullptr) - , m_pInstallBtn(nullptr) - , m_pUnInstallBtn(nullptr) - , m_pSpinner(nullptr) - , m_pDataModel(nullptr) -{ - initUi(); - initTranslation(); -} - -DefSecurityToolsFrontUnit::~DefSecurityToolsFrontUnit() -{ - if (m_pImageLabel) { - m_pImageLabel->deleteLater(); - m_pImageLabel = nullptr; - } - - if (m_pAppNameLabel) { - m_pAppNameLabel->deleteLater(); - m_pAppNameLabel = nullptr; - } - - if (m_pDesLabel) { - m_pDesLabel->deleteLater(); - m_pDesLabel = nullptr; - } - - if (m_pCompanyNameLabel) { - m_pCompanyNameLabel->deleteLater(); - m_pCompanyNameLabel = nullptr; - } - - if (m_pOpenBtn) { - m_pOpenBtn->deleteLater(); - m_pOpenBtn = nullptr; - } - - if (m_pUpdateBtn) { - m_pUpdateBtn->deleteLater(); - m_pUpdateBtn = nullptr; - } - - if (m_pInstallBtn) { - m_pInstallBtn->deleteLater(); - m_pInstallBtn = nullptr; - } - - if (m_pUnInstallBtn) { - m_pUnInstallBtn->deleteLater(); - m_pUnInstallBtn = nullptr; - } -} - -void DefSecurityToolsFrontUnit::setToolsInfo(const DEFSECURITYTOOLINFO &info) -{ - m_toolInfo = info; - QPixmap pixmap = QIcon::fromTheme(info.strImagePath.trimmed()).pixmap(48, 48); - m_pImageLabel->setPixmap(pixmap); - setShowString(m_pAppNameLabel, getTranslation(info.strAppName), 140); - setShowString(m_pDesLabel, getTranslation(info.strDescription), 140); - setShowString(m_pCompanyNameLabel, - QString(tr("Supported by %1").arg(getTranslation(info.strCompany))), - 140); - - if (info.bHasInstalled) { - if (info.bCanUpdate) { - setAppStatus(DEFSECURITYTOOLSTATUS::WAITFORUPDATE); - } else { - setAppStatus(DEFSECURITYTOOLSTATUS::INSTALLED); - } - } else { - setAppStatus(DEFSECURITYTOOLSTATUS::UNINSTALLED); - } - - if (info.bSystemTool) { - m_pUnInstallBtn->setHidden(true); - } -} - -void DefSecurityToolsFrontUnit::setAppStatus(DEFSECURITYTOOLSTATUS status) -{ - m_status = status; - - switch (m_status) { - case UNINSTALLED: - m_pOpenBtn->setHidden(true); - m_pUpdateBtn->setHidden(true); - m_pUnInstallBtn->setHidden(true); - m_pSpinner->setHidden(true); - m_pSpinner->stop(); - m_pInstallBtn->setHidden(false); - break; - case INSTALLING: - m_pOpenBtn->setHidden(true); - m_pUpdateBtn->setHidden(true); - m_pUnInstallBtn->setHidden(true); - m_pInstallBtn->setHidden(true); - m_pSpinner->setHidden(false); - m_pSpinner->start(); - break; - case INSTALLED: - m_pOpenBtn->setHidden(false); - m_pUpdateBtn->setHidden(true); - m_pUnInstallBtn->setHidden(false); - m_pInstallBtn->setHidden(true); - m_pSpinner->setHidden(true); - m_pSpinner->stop(); - break; - case INSTALLFAILED: - reportStatus(m_strInstallFailed); - setAppStatus(DEFSECURITYTOOLSTATUS::UNINSTALLED); - break; - case INSTALLSUCCESS: - setAppStatus(DEFSECURITYTOOLSTATUS::INSTALLED); - break; - case WAITFORUPDATE: - m_pOpenBtn->setHidden(true); - m_pUpdateBtn->setHidden(false); - m_pUnInstallBtn->setHidden(false); - m_pInstallBtn->setHidden(true); - m_pSpinner->setHidden(true); - break; - case UPDATING: - m_pOpenBtn->setHidden(true); - m_pUpdateBtn->setHidden(true); - m_pUnInstallBtn->setHidden(true); - m_pInstallBtn->setHidden(true); - m_pSpinner->setHidden(false); - break; - case UPDATEFAIL: - reportStatus(m_strUpdateFailed); - setAppStatus(DEFSECURITYTOOLSTATUS::WAITFORUPDATE); - break; - case UPDATASUCCESS: - setAppStatus(DEFSECURITYTOOLSTATUS::INSTALLED); - break; - case UNINSTALLING: - m_pOpenBtn->setHidden(true); - m_pUpdateBtn->setHidden(true); - m_pUnInstallBtn->setHidden(true); - m_pInstallBtn->setHidden(true); - m_pSpinner->setHidden(false); - m_pSpinner->start(); - break; - case UNINSTALLFAILED: - reportStatus(m_strUninstallFailed); - setAppStatus(DEFSECURITYTOOLSTATUS::INSTALLED); - break; - } -} - -void DefSecurityToolsFrontUnit::setDataModel(QObject *pModel) -{ - Q_ASSERT((pModel != nullptr) && ("pModel can't be empty")); - m_pDataModel = pModel; - - QObject::connect(m_pOpenBtn, &QPushButton::clicked, this, [=]() { - this->showtool(); - }); - - QObject::connect(m_pUpdateBtn, &QPushButton::clicked, this, [=]() { - this->updatePackage(); - }); - - QObject::connect(m_pInstallBtn, &QPushButton::clicked, this, [=]() { - this->installPackage(); - }); - - QObject::connect(m_pUnInstallBtn, &QPushButton::clicked, this, [=]() { - this->unInstallPackage(); - }); -} - -void DefSecurityToolsFrontUnit::installPackage() -{ - SecurityToolsModel *pAttachedModel = qobject_cast(m_pDataModel); - pAttachedModel->installTool(m_toolInfo.getPackageKey()); -} - -void DefSecurityToolsFrontUnit::unInstallPackage() -{ - SecurityToolsModel *pAttachedModel = qobject_cast(m_pDataModel); - pAttachedModel->unInstallTool(m_toolInfo.getPackageKey()); -} - -void DefSecurityToolsFrontUnit::updatePackage() -{ - SecurityToolsModel *pAttachedModel = qobject_cast(m_pDataModel); - pAttachedModel->updateTool(m_toolInfo.getPackageKey()); -} - -void DefSecurityToolsFrontUnit::showtool() -{ - SecurityToolsModel *pAttachedModel = qobject_cast(m_pDataModel); - pAttachedModel->openTool(m_toolInfo.getPackageKey()); -} - -void DefSecurityToolsFrontUnit::updateAppStatus() -{ -} - -void DefSecurityToolsFrontUnit::initUi() -{ - QHBoxLayout *pMainLayout = new QHBoxLayout; - pMainLayout->setContentsMargins(10, 10, 10, 10); - pMainLayout->setSpacing(10); - m_pImageLabel = new DLabel; - QPixmap pixMap = QPixmap(48, 48); - pixMap.fill(Qt::darkGray); - m_pImageLabel->setPixmap(pixMap); - - QVBoxLayout *pVlayout = new QVBoxLayout; - pVlayout->setSpacing(2); - m_pAppNameLabel = createLabel(14); - m_pAppNameLabel->setForegroundRole(DPalette::TextTitle); - m_pAppNameLabel->setAccessibleName("DefSecurityToolsFrontUnit_AppNameLabel"); - m_pDesLabel = createLabel(12); - m_pDesLabel->setForegroundRole(DPalette::TextTips); - m_pDesLabel->setAccessibleName("DefSecurityToolsFrontUnit_DesLabel"); - m_pCompanyNameLabel = createLabel(10); - m_pCompanyNameLabel->setForegroundRole(DPalette::PlaceholderText); - m_pCompanyNameLabel->setAccessibleName("DefSecurityToolsFrontUnit_CompanyNameLabel"); - - pVlayout->addWidget(m_pAppNameLabel); - pVlayout->addWidget(m_pDesLabel); - pVlayout->addWidget(m_pCompanyNameLabel); - DPushButton *pBtn = creatorBtn(tr("Open", "button"), true); - m_pOpenBtn = qobject_cast(pBtn); - pBtn = creatorBtn(tr("Update", "button"), true); - m_pUpdateBtn = qobject_cast(pBtn); - m_pInstallBtn = creatorBtn(tr("Install", "button"), false); - m_pUnInstallBtn = creatorBtn(tr("UnInstall", "button"), false); - m_pSpinner = new DSpinner; - m_pSpinner->setFixedSize(32, 32); - m_pSpinner->hide(); - - pMainLayout->addWidget(m_pImageLabel); - pMainLayout->addLayout(pVlayout); - pMainLayout->addStretch(); - pMainLayout->addWidget(m_pInstallBtn); - pMainLayout->addWidget(m_pUnInstallBtn); - pMainLayout->addWidget(m_pOpenBtn); - pMainLayout->addWidget(m_pUpdateBtn); - pMainLayout->addWidget(m_pSpinner); - setLayout(pMainLayout); - setFixedSize(UNITWIDTH, UNITHEIGHT); - setFrameRounded(true); - setBackgroundRole(DPalette::ItemBackground); -} - -void DefSecurityToolsFrontUnit::initConnection() -{ -} - -DLabel *DefSecurityToolsFrontUnit::createLabel(int iPixSize) -{ - DLabel *pLabel = new DLabel; - QFont font; - font.setFamily("SourceHanSansSC"); - font.setWeight(QFont::Medium); - font.setPixelSize(iPixSize); - pLabel->setFont(font); - pLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); - return pLabel; -} - -DPushButton *DefSecurityToolsFrontUnit::creatorBtn(const QString &strText, bool bSuggest) -{ - DPushButton *pBtn = nullptr; - - if (bSuggest) { - pBtn = new DSuggestButton; - } else { - pBtn = new DPushButton; - } - - QFont font; - font.setFamily("SourceHanSansSC"); - font.setWeight(QFont::Medium); - font.setPixelSize(14); - pBtn->setFont(font); - // QPalette pal = pBtn->palette(); - // pal.setColor(QPalette::ButtonText, Qt::red); - // pBtn->setPalette(pal); - pBtn->setFixedSize(60, 36); - pBtn->setAccessibleName("DefSecurityToolsFrontUnit_" + strText); - setShowString(pBtn, strText, 45); - pBtn->hide(); - return pBtn; -} - -void DefSecurityToolsFrontUnit::setShowString(DLabel *pLabel, const QString &strText, int iLen) -{ - QFont font = pLabel->font(); - QFontMetrics metrics(font); - int iTextLen = metrics.horizontalAdvance(strText); - QString strShowText = strText; - - if (iTextLen > iLen) { - strShowText = metrics.elidedText(strText, Qt::ElideRight, iLen); - pLabel->setToolTip(strText); - } - - pLabel->setText(strShowText); -} - -void DefSecurityToolsFrontUnit::setShowString(DPushButton *pBtn, const QString &strText, int iLen) -{ - QFont font = pBtn->font(); - QFontMetrics metrics(font); - int iTextLen = metrics.horizontalAdvance(strText); - QString strShowText = strText; - - if (iTextLen > iLen) { - strShowText = metrics.elidedText(strText, Qt::ElideRight, iLen); - pBtn->setToolTip(strText); - } - - pBtn->setText(strShowText); -} - -void DefSecurityToolsFrontUnit::initTranslation() -{ - transMap.clear(); - - // 模块名称 - transMap.insert("Startup Programs", tr("Startup Programs")); - transMap.insert("Network Detection", tr("Network Detection")); - - // 模块描述 - transMap.insert("Manage auto-startup programs", tr("Manage auto-startup programs")); - transMap.insert("One-click detection, comprehensive network troubleshooting", tr("One-click detection, comprehensive network troubleshooting")); -} - -QString DefSecurityToolsFrontUnit::getTranslation(const QString &strKey) -{ - QString strValue = strKey; - - if (transMap.contains(strKey)) { - strValue = transMap.value(strKey); - } - - return strValue; -} - -void DefSecurityToolsFrontUnit::reportStatus(const QString &strMsg) -{ - DFloatingMessage *floMsgSwitchOff = nullptr; - floMsgSwitchOff = new DFloatingMessage(DFloatingMessage::TransientType); - floMsgSwitchOff->setIcon(QIcon::fromTheme(DIALOG_WARNING_TIP_RED)); - floMsgSwitchOff->setDuration(3000); - floMsgSwitchOff->setMessage(strMsg); - DMessageManager::instance()->sendMessage(this->parentWidget(), floMsgSwitchOff); - DMessageManager::instance()->setContentMargens(this->parentWidget(), QMargins(0, 0, 0, 20)); -} diff --git a/deepin-pc-manager/src/window/modules/securitytools/defsecuritytoolsfrontunit.h b/deepin-pc-manager/src/window/modules/securitytools/defsecuritytoolsfrontunit.h deleted file mode 100644 index 6d8ca6b..0000000 --- a/deepin-pc-manager/src/window/modules/securitytools/defsecuritytoolsfrontunit.h +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (C) 2020 ~ 2022 Uniontech Software Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef DEFSECURITYTOOLSFRONTITEM_H -#define DEFSECURITYTOOLSFRONTITEM_H - -#include "defsecuritytoolinfo.h" - -#include -#include -#include -#include -#include - -#include - -DWIDGET_USE_NAMESPACE - -#define UNITWIDTH 345 -#define UNITHEIGHT 80 - -class DefSecurityToolsFrontUnit : public DFrame -{ - Q_OBJECT -public: - explicit DefSecurityToolsFrontUnit(DWidget *parent = nullptr); - ~DefSecurityToolsFrontUnit() override; - -public: - // 设置第三方应用信息 - void setToolsInfo(const DEFSECURITYTOOLINFO &info); - void setAppStatus(DEFSECURITYTOOLSTATUS status); - void setDataModel(QObject *pModel); - -private: - void installPackage(); - void unInstallPackage(); - void updatePackage(); - void showtool(); - void updateAppStatus(); - void initUi(); - void initConnection(); - DLabel *createLabel(int iPixSize); - DPushButton *creatorBtn(const QString &strText, bool bSuggest); - void setShowString(DLabel *pLabel, const QString &strText, int iLen); - void setShowString(DPushButton *pBtn, const QString &strText, int iLen); - void initTranslation(); - QString getTranslation(const QString &strKey); - void reportStatus(const QString &strMsg); -signals: - -public slots: - -private: - DEFSECURITYTOOLINFO m_toolInfo; - DEFSECURITYTOOLSTATUS m_status; - DLabel *m_pImageLabel; - DLabel *m_pAppNameLabel; - DLabel *m_pDesLabel; - DLabel *m_pCompanyNameLabel; - DSuggestButton *m_pOpenBtn; - DSuggestButton *m_pUpdateBtn; - DPushButton *m_pInstallBtn; - DPushButton *m_pUnInstallBtn; - DSpinner *m_pSpinner; - QObject *m_pDataModel; - QMap transMap; - -private: - const QString m_strInstallFailed = tr("Failed to install the tool. Please try later."); - const QString m_strUpdateFailed = tr("Failed to update the tool. Please try later."); - const QString m_strUninstallFailed = tr("Failed to uninstall the tool. Please try later."); -}; - -#endif // DEFSECURITYTOOLSFRONTITEM_H diff --git a/deepin-pc-manager/src/window/modules/securitytools/securitytoolsmodel.cpp b/deepin-pc-manager/src/window/modules/securitytools/securitytoolsmodel.cpp deleted file mode 100644 index c45cccf..0000000 --- a/deepin-pc-manager/src/window/modules/securitytools/securitytoolsmodel.cpp +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (C) 2019 ~ 2021 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "securitytoolsmodel.h" - -#include "defsecuritytoolinfo.h" -#include "window/modules/common/common.h" -#include "window/modules/common/invokers/invokerfactory.h" - -#include -#include -#include - -#define IMA_NAME "com.deepin.daemon.ImaDaemon" -#define IMA_PATH "/com/deepin/daemon/ImaDaemon" -#define IMA_INTERFACE "com.deepin.daemon.ImaDaemon" - -SecurityToolsModel::SecurityToolsModel(QObject *parent) - : QObject(parent) - , m_pSecurityToolDBusInter(nullptr) - , m_gsetting(nullptr) -{ - // 初始化数据 - initData(); - initConnectoin(); -} - -SecurityToolsModel::~SecurityToolsModel() { } - -void SecurityToolsModel::initData() -{ - registerDefSecurityToolInfo(); - registerDefSecurityToolInfoList(); - - m_pSecurityToolDBusInter = - InvokerFactory::GetInstance().CreateInvoker("com.deepin.pc.manager.securitytooldialog", - "/com/deepin/pc/manager/securitytooldialog", - "com.deepin.pc.manager.securitytooldialog", - ConnectType::SESSION, - this); -} - -void SecurityToolsModel::initConnectoin() -{ - m_pSecurityToolDBusInter->Connect("notifyToolsInfoUpdate", - this, - SLOT(onToolsInfoUpdate(const DEFSECURITYTOOLINFOLIST &))); - m_pSecurityToolDBusInter->Connect("notifyAppStatusChanged", - this, - SLOT(onAppStatusChanged(const QString &, int))); -} - -void SecurityToolsModel::onToolsInfoUpdate(const DEFSECURITYTOOLINFOLIST &infos) -{ - m_toolinfos.clear(); - m_toolinfos = infos; - Q_EMIT sUpdateToolsInfo(); -} - -void SecurityToolsModel::onAppStatusChanged(const QString &strPackageKey, int status) -{ - DEFSECURITYTOOLSTATUS curStatus = DEFSECURITYTOOLSTATUS(status); - - if (curStatus == DEFSECURITYTOOLSTATUS::INSTALLSUCCESS - || curStatus == DEFSECURITYTOOLSTATUS::INSTALLFAILED) { - bool bInstalled = false; - - if (curStatus == DEFSECURITYTOOLSTATUS::INSTALLSUCCESS) { - bInstalled = true; - } else if (curStatus == DEFSECURITYTOOLSTATUS::INSTALLFAILED) { - bInstalled = false; - } - - for (auto iter = m_toolinfos.begin(); iter != m_toolinfos.end(); iter++) { - if (iter->getPackageKey() == strPackageKey) { - iter->bHasInstalled = bInstalled; - } - } - } - - Q_EMIT notityAppStatusChanged(strPackageKey, status); -} - -void SecurityToolsModel::onStatusCheckFinished() { } - -void SecurityToolsModel::updateToolsInfo() -{ - DBUS_NOBLOCK_INVOKE(m_pSecurityToolDBusInter, "OnRequestUpdateToolsInfo"); -} - -QList SecurityToolsModel::getToolsInfo(TOOLSSTATUS status) -{ - QList infos; - - foreach (auto info, m_toolinfos) { - if (TOOLSSTATUS::ALL == status) { - infos.push_back(info); - } else if (TOOLSSTATUS::INSTALLEDTOOL == status) { - if (info.bHasInstalled) { - infos.push_back(info); - } - } else { - if (!info.bHasInstalled) { - infos.push_back(info); - } - } - } - - return infos; -} - -void SecurityToolsModel::openTool(const QString &strPackageKey, const QStringList &strParams) -{ - DBUS_NOBLOCK_INVOKE(m_pSecurityToolDBusInter, "OnShowTool", strPackageKey, strParams); -} - -void SecurityToolsModel::updateTool(const QString &strPackageKey) -{ - DBUS_NOBLOCK_INVOKE(m_pSecurityToolDBusInter, "OnUpdatePackage", strPackageKey); -} - -void SecurityToolsModel::installTool(const QString &strPackageKey) -{ - DBUS_NOBLOCK_INVOKE(m_pSecurityToolDBusInter, "OnInstallPackage", strPackageKey); -} - -void SecurityToolsModel::unInstallTool(const QString &strPackageKey) -{ - DBUS_NOBLOCK_INVOKE(m_pSecurityToolDBusInter, "OnUnInstallPackage", strPackageKey); -} - -// 得到正在安装/更新/卸载的app -QStringList SecurityToolsModel::getInstallingApps() -{ - // 获取等保开启状态 - QDBusMessage msg = DBUS_BLOCK_INVOKE(m_pSecurityToolDBusInter, "GetInstallingApps"); - GET_MESSAGE_VALUE(QStringList, applist, msg); - return applist; -} - -QStringList SecurityToolsModel::getUpdatingApps() -{ - // 获取等保开启状态 - QDBusMessage msg = DBUS_BLOCK_INVOKE(m_pSecurityToolDBusInter, "GetUpdatingApps"); - GET_MESSAGE_VALUE(QStringList, applist, msg); - return applist; -} - -QStringList SecurityToolsModel::getUninstallingApps() -{ - // 获取等保开启状态 - QDBusMessage msg = DBUS_BLOCK_INVOKE(m_pSecurityToolDBusInter, "GetUninstallingApps"); - GET_MESSAGE_VALUE(QStringList, applist, msg); - return applist; -} diff --git a/deepin-pc-manager/src/window/modules/securitytools/securitytoolsmodel.h b/deepin-pc-manager/src/window/modules/securitytools/securitytoolsmodel.h deleted file mode 100644 index 29d1e9a..0000000 --- a/deepin-pc-manager/src/window/modules/securitytools/securitytoolsmodel.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (C) 2019 ~ 2021 UnionTech Software Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include "defsecuritytoolinfo.h" - -#include - -class DBusInvokerInterface; -class SettingsInvokerInterface; - -class SecurityToolsModel : public QObject -{ - Q_OBJECT -public: - explicit SecurityToolsModel(QObject *parent = nullptr); - ~SecurityToolsModel(); - - void updateToolsInfo(); - - // 获取工具信息 - QList getToolsInfo(TOOLSSTATUS status); - void openTool(const QString &strPackageKey, const QStringList &strParams = QStringList()); - void updateTool(const QString &strPackageKey); - void installTool(const QString &strPackageKey); - void unInstallTool(const QString &strPackageKey); - - // 得到正在安装/更新/卸载的app - QStringList getInstallingApps(); - QStringList getUpdatingApps(); - QStringList getUninstallingApps(); - -private: - // 初始化数据 - void initData(); - void initConnectoin(); - -public Q_SLOTS: - void onToolsInfoUpdate(const DEFSECURITYTOOLINFOLIST &infos); - void onAppStatusChanged(const QString &strPackageKey, int status); - void onStatusCheckFinished(); - -Q_SIGNALS: - void sUpdateToolsInfo(); - void notityAppStatusChanged(const QString &strPackageKey, int status); - -private: - DBusInvokerInterface *m_pSecurityToolDBusInter; // 安全工具 - SettingsInvokerInterface *m_gsetting; // 安全中心gsetting配置 - QList m_toolinfos; -}; diff --git a/deepin-pc-manager/src/window/modules/securitytools/securitytoolsmodule.cpp b/deepin-pc-manager/src/window/modules/securitytools/securitytoolsmodule.cpp deleted file mode 100644 index c9f23af..0000000 --- a/deepin-pc-manager/src/window/modules/securitytools/securitytoolsmodule.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (C) 2020 ~ 2020 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "securitytoolsmodule.h" - -#include "securitytoolsmodel.h" -#include "securitytoolswidget.h" - -#include -#include - -#define TOOL_PKG_KEY_DATA_USAGE "deepin-defender_Data Usage" -#define TOOL_PKG_KEY_STARTUP "deepin-defender_Startup Programs" -#define TOOL_PKG_KEY_NET_CONTRL "deepin-defender_Internet Control" -#define TOOL_PKG_KEY_USB_CONN "deepin-defender_USB Connection" -#define TOOL_PKG_KEY_LOGIN_SAFETY "deepin-defender_Login Safety" -#define TOOL_PKG_KEY_TRUSTED_PROTECTION "deepin-defender_Execution Prevention" - -SecurityToolsModule::SecurityToolsModule(FrameProxyInterface *frame, QObject *parent) - : QObject(parent) - , ModuleInterface(frame) - , m_securityToolsWidget(nullptr) - , m_securityToolsModel(nullptr) -{ -} - -SecurityToolsModule::~SecurityToolsModule() -{ - deactive(); -} - -void SecurityToolsModule::initialize() { } - -void SecurityToolsModule::preInitialize() { } - -const QString SecurityToolsModule::name() const -{ - return MODULE_SECURITY_TOOLS_NAME; -} - -void SecurityToolsModule::active(int index) -{ - Q_UNUSED(index) - if (!m_securityToolsModel) { - m_securityToolsModel = new SecurityToolsModel(this); - } - - m_securityToolsWidget = new SecurityToolsWidget(m_securityToolsModel); - m_securityToolsWidget->show(); - m_frameProxy->pushWidget(this, m_securityToolsWidget); - - switch (index) { - case STARTUP_CONTROL_INDEX: { - m_securityToolsModel->openTool(TOOL_PKG_KEY_STARTUP); - break; - } - case USB_CONN_INDEX: { - m_securityToolsModel->openTool(TOOL_PKG_KEY_USB_CONN); - break; - } - case LOGIN_SAFETY_INDEX: - m_securityToolsModel->openTool(TOOL_PKG_KEY_LOGIN_SAFETY); - break; - case TRUSTED_PROTECTION_INDEX: - m_securityToolsModel->openTool(TOOL_PKG_KEY_TRUSTED_PROTECTION); - break; - default: - break; - } -} - -void SecurityToolsModule::deactive() -{ - if (nullptr != m_securityToolsWidget) { - m_securityToolsWidget->deleteLater(); - m_securityToolsWidget = nullptr; - } -} diff --git a/deepin-pc-manager/src/window/modules/securitytools/securitytoolsmodule.h b/deepin-pc-manager/src/window/modules/securitytools/securitytoolsmodule.h deleted file mode 100644 index 0659a47..0000000 --- a/deepin-pc-manager/src/window/modules/securitytools/securitytoolsmodule.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2020 ~ 2020 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include "window/interface/moduleinterface.h" - -class SecurityToolsWidget; -class SecurityToolsModel; - -// 可信保护模块 -class TrustedProtectionWidget; - -class SecurityToolsModule : public QObject, public ModuleInterface -{ - Q_OBJECT -public: - explicit SecurityToolsModule(FrameProxyInterface *frame, QObject *parent = nullptr); - ~SecurityToolsModule() override; - -public: - void initialize() override; - void preInitialize() override; - const QString name() const override; - void active(int index) override; - void deactive() override; - -private: - SecurityToolsWidget *m_securityToolsWidget; - SecurityToolsModel *m_securityToolsModel; -}; diff --git a/deepin-pc-manager/src/window/modules/securitytools/securitytoolswidget.cpp b/deepin-pc-manager/src/window/modules/securitytools/securitytoolswidget.cpp deleted file mode 100644 index f99aa8d..0000000 --- a/deepin-pc-manager/src/window/modules/securitytools/securitytoolswidget.cpp +++ /dev/null @@ -1,298 +0,0 @@ -// Copyright (C) 2020 ~ 2020 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "securitytoolswidget.h" - -#include "defsecuritytoolinfo.h" -#include "defsecuritytoolsfrontunit.h" -#include "securitytoolsmodel.h" -#include "window/modules/securitytools/defsecuritytoollistwidget.h" - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define PACKAGEKEY Qt::UserRole + 1 - -enum TOOLMSGPANE { - DATA, // 有数据 - EMPTY // 无数据 -}; - -SecurityToolsWidget::SecurityToolsWidget(SecurityToolsModel *model, DWidget *parent) - : DWidget(parent) - , m_model(model) - , m_scrollAreaWidgetContents(nullptr) - , m_pSecurityButtonBox(nullptr) - , m_pMsgLabel(nullptr) - , m_toolStatus(TOOLSSTATUS::ALL) - , m_iClassify(TOOLCLASSIFY::ALLTOOLS) - , m_pStackedWidget(nullptr) -{ - // 注册信号类型 - registerDefSecurityToolInfo(); - registerDefSecurityToolInfoList(); - this->setAccessibleName("rightWidget_securityToolsWidget"); - - // 初始化UI - initUI(); - initConnection(); - m_model->updateToolsInfo(); -} - -SecurityToolsWidget::~SecurityToolsWidget() { } - -// 初始化界面 -void SecurityToolsWidget::initUI() -{ - QVBoxLayout *pMainLayout = new QVBoxLayout; - pMainLayout->setContentsMargins(10, 10, 10, 10); - - QHBoxLayout *phlayout = new QHBoxLayout; - phlayout->setContentsMargins(22, 0, 20, 0); - m_pSecurityButtonBox = new DButtonBox(this); - m_pSecurityButtonBox->setOrientation(Qt::Horizontal); - QList btnlist; - DButtonBoxButton *pBtn = createBoxButton(tr("All"), m_pSecurityButtonBox); - pBtn->setAccessibleName("securitytoolswidget_AllBtn"); - btnlist.append(pBtn); - - pBtn = createBoxButton(tr("System"), m_pSecurityButtonBox); - pBtn->setAccessibleName("securitytoolswidget_SystemBtn"); - btnlist.append(pBtn); - - pBtn = createBoxButton(tr("Network"), m_pSecurityButtonBox); - pBtn->setAccessibleName("securitytoolswidget_NetworkBtn"); - btnlist.append(pBtn); - - pBtn = createBoxButton(tr("Data"), m_pSecurityButtonBox); - pBtn->setAccessibleName("securitytoolswidget_DataBtn"); - btnlist.append(pBtn); - - pBtn = createBoxButton(tr("Apps"), m_pSecurityButtonBox); - pBtn->setAccessibleName("securitytoolswidget_AppsBtn"); - btnlist.append(pBtn); - - pBtn = createBoxButton(tr("Devices"), m_pSecurityButtonBox); - pBtn->setAccessibleName("securitytoolswidget_DeviceBtn"); - btnlist.append(pBtn); - m_pSecurityButtonBox->setButtonList(btnlist, true); - btnlist.at(0)->setChecked(true); - - for (int i = 0; i < btnlist.size(); i++) { - m_pSecurityButtonBox->setId(btnlist.at(i), TOOLCLASSIFY(i)); - } - - m_pDropDown = new DDropdown; - phlayout->addWidget(m_pSecurityButtonBox); - phlayout->addStretch(); - phlayout->addWidget(m_pDropDown); - m_pDropDown->setAccessibleName("securitytoolswidget_Drop"); - - DefSecurityToolListWidget *pSecurityList = new DefSecurityToolListWidget; - pSecurityList->setAccessibleName("securitytoolswidget_SecurityView"); - pSecurityList->setSpacing(10); - pSecurityList->setContentsMargins(0, 0, 0, 0); - DWidget *pEmptyWidget = createEmptyDataPane(); - pEmptyWidget->setAccessibleName("securitytoolswidget_EmptyWidget"); - - m_pStackedWidget = new DStackedWidget; - m_pStackedWidget->setAccessibleName("securitytoolswidget_StackedWidget"); - m_pStackedWidget->setFixedSize(740, 500); - m_pStackedWidget->insertWidget(TOOLMSGPANE::DATA, pSecurityList); - m_pStackedWidget->insertWidget(TOOLMSGPANE::EMPTY, pEmptyWidget); - pMainLayout->addLayout(phlayout); - pMainLayout->addWidget(m_pStackedWidget, 0, Qt::AlignHCenter); - pMainLayout->addStretch(); - setLayout(pMainLayout); -} - -void SecurityToolsWidget::initConnection() -{ - QObject::connect(m_model, &SecurityToolsModel::sUpdateToolsInfo, this, [&] { - clearToolInfoList(); - DEFSECURITYTOOLINFOLIST infos = m_model->getToolsInfo(m_toolStatus); - DEFSECURITYTOOLINFOLIST showInfos = getToolInfoByClassify(infos); - - QStringList sInstallingApps = m_model->getInstallingApps(); - QStringList sUpdatingApps = m_model->getUpdatingApps(); - QStringList sUninstallingApps = m_model->getUninstallingApps(); - - if (showInfos.empty()) { - m_pStackedWidget->setCurrentIndex(TOOLMSGPANE::EMPTY); - } else { - m_pStackedWidget->setCurrentIndex(TOOLMSGPANE::DATA); - DWidget *pWidget = m_pStackedWidget->widget(TOOLMSGPANE::DATA); - DefSecurityToolListWidget *pSecurityList = - qobject_cast(pWidget); - - foreach (auto info, showInfos) { - DefSecurityToolsFrontUnit *pUnit = new DefSecurityToolsFrontUnit(pSecurityList); - pUnit->setAccessibleName("securitytoolswidget_Unit" + info.getPackageKey()); - pUnit->setToolsInfo(info); - pUnit->setDataModel(m_model); - QListWidgetItem *pItem = new QListWidgetItem; - QString packageKey = info.getPackageKey(); - pItem->setData(PACKAGEKEY, packageKey); - pItem->setSizeHint(QSize(UNITWIDTH, UNITHEIGHT)); - pSecurityList->addItem(pItem); - pSecurityList->setItemWidget(pItem, pUnit); - - if (sInstallingApps.contains(packageKey)) { - pUnit->setAppStatus(DEFSECURITYTOOLSTATUS::INSTALLING); - } else if (sUpdatingApps.contains(packageKey)) { - pUnit->setAppStatus(DEFSECURITYTOOLSTATUS::UPDATING); - } else if (sUninstallingApps.contains(packageKey)) { - pUnit->setAppStatus(DEFSECURITYTOOLSTATUS::UNINSTALLING); - } - } - - pSecurityList->setSpacing(10); - } - }); - - QObject::connect(m_model, - &SecurityToolsModel::notityAppStatusChanged, - this, - [&](const QString &strPackageKey, int status) { - DWidget *pWidget = m_pStackedWidget->widget(TOOLMSGPANE::DATA); - DefSecurityToolListWidget *pSecurityList = - qobject_cast(pWidget); - int iCount = pSecurityList->count(); - - for (int i = 0; i < iCount; i++) { - QListWidgetItem *pItem = pSecurityList->item(i); - QString strPackageData = pItem->data(PACKAGEKEY).toString(); - - if (strPackageData == strPackageKey) { - QWidget *pTempWidget = pSecurityList->itemWidget(pItem); - DefSecurityToolsFrontUnit *pUnit = - qobject_cast(pTempWidget); - pUnit->setAppStatus(DEFSECURITYTOOLSTATUS(status)); - } - } - }); - - QObject::connect(m_pDropDown, &DDropdown::triggeredAll, this, [&]() { - updateToolsMsgByStatus(TOOLSSTATUS::ALL); - }); - - QObject::connect(m_pDropDown, &DDropdown::triggeredInstalled, this, [&]() { - updateToolsMsgByStatus(TOOLSSTATUS::INSTALLEDTOOL); - }); - - QObject::connect(m_pDropDown, &DDropdown::triggeredUnInstalled, this, [&]() { - updateToolsMsgByStatus(TOOLSSTATUS::UNINSTALLEDTOOL); - }); - - QObject::connect(m_pSecurityButtonBox, - &DButtonBox::buttonClicked, - this, - [&](QAbstractButton *pBtn) { - int iID = m_pSecurityButtonBox->id(pBtn); - updateToolsMsgByClassify(TOOLCLASSIFY(iID)); - }); -} - -DButtonBoxButton *SecurityToolsWidget::createBoxButton(const QString &strText, QWidget *pParent) -{ - Q_ASSERT(!strText.isEmpty() && "string can't be empty!"); - QFont font; - font.setFamily("SourceHanSansSC"); - font.setWeight(QFont::Medium); - font.setPixelSize(14); - DButtonBoxButton *pBtn = new DButtonBoxButton(strText, pParent); - pBtn->setAccessibleName(QString("SecurityToolsWidget_%1").arg(strText.at(0).toLower())); - pBtn->setFixedSize(QSize(72, 30)); - pBtn->setFont(font); - return pBtn; -} - -void SecurityToolsWidget::clearToolInfoList() -{ - DWidget *pWidget = m_pStackedWidget->widget(TOOLMSGPANE::DATA); - DefSecurityToolListWidget *pSecurityList = qobject_cast(pWidget); - int iCount = pSecurityList->count(); - - for (int i = 0; i < iCount; i++) { - QListWidgetItem *pItem = pSecurityList->item(i); - QWidget *pUnitWidget = pSecurityList->itemWidget(pItem); - pUnitWidget->deleteLater(); - pUnitWidget = nullptr; - } - - pSecurityList->clear(); -} - -DEFSECURITYTOOLINFOLIST -SecurityToolsWidget::getToolInfoByClassify(const DEFSECURITYTOOLINFOLIST &infolist) const -{ - DEFSECURITYTOOLINFOLIST desInfolist; - - if (m_iClassify == TOOLCLASSIFY::ALLTOOLS) { - desInfolist = infolist; - } else { - foreach (DEFSECURITYTOOLINFO info, infolist) { - if (m_iClassify == info.iClassify) { - desInfolist.push_back(info); - } - } - } - - return desInfolist; -} - -DWidget *SecurityToolsWidget::createEmptyDataPane() -{ - DWidget *pEmptyWidget = new DWidget; - DLabel *pImageLabel = new DLabel; - QPixmap pixmap = QIcon::fromTheme("No_related_tool_is_found").pixmap(96, 96); - pImageLabel->setPixmap(pixmap); - DLabel *pEmptyLabel = new DLabel; - pEmptyLabel->setText(tr("No tools found")); - QFont font; - font.setFamily("SourceHanSansSC"); - font.setWeight(QFont::Medium); - font.setPixelSize(12); - pEmptyLabel->setFont(font); - pEmptyLabel->setAlignment(Qt::AlignCenter); - QVBoxLayout *pVlayout = new QVBoxLayout; - pVlayout->setSpacing(20); - pVlayout->addStretch(); - pVlayout->addWidget(pImageLabel, 0, Qt::AlignCenter); - pVlayout->addWidget(pEmptyLabel); - pVlayout->addStretch(); - pEmptyWidget->setLayout(pVlayout); - return pEmptyWidget; -} - -// 设置因主题改变图标 -void SecurityToolsWidget::changeThemeType(ColorType themeType) -{ - Q_UNUSED(themeType); -} - -void SecurityToolsWidget::updateToolsMsgByStatus(TOOLSSTATUS status) -{ - m_toolStatus = status; - m_model->updateToolsInfo(); -} - -void SecurityToolsWidget::updateToolsMsgByClassify(TOOLCLASSIFY iClassify) -{ - m_iClassify = iClassify; - m_model->updateToolsInfo(); -} diff --git a/deepin-pc-manager/src/window/modules/securitytools/securitytoolswidget.h b/deepin-pc-manager/src/window/modules/securitytools/securitytoolswidget.h deleted file mode 100644 index b63ebcb..0000000 --- a/deepin-pc-manager/src/window/modules/securitytools/securitytoolswidget.h +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (C) 2020 ~ 2020 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef SECURITYTOOLSWIDGET_H -#define SECURITYTOOLSWIDGET_H - -#include "securitytoolsmodel.h" -#include "widgets/ddropdown.h" -#include "window/modules/common/common.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -// 病毒查杀类型 -enum SecurityClickType { - DataUsageItem, // 流量详情 - StartupItem, // 自启动项 - NetControlItem, // 联网应用 - UsbControl, // USB管控 - LoginSafety, // 登录安全 - SystemSafeLevel, // 系统安全等级 - FileTrustProtection // 可信保护 -}; - -class QStandardItemModel; -class SecurityToolsModel; - -DWIDGET_USE_NAMESPACE - -class SecurityToolsWidget : public QWidget -{ - Q_OBJECT - -public: - explicit SecurityToolsWidget(SecurityToolsModel *model, DWidget *parent = nullptr); - ~SecurityToolsWidget(); - -private: - // 初始化界面 - void initUI(); - void initConnection(); - void clearToolInfoList(); - // 更新工具信息 - void updateToolsMsgByStatus(TOOLSSTATUS status); - void updateToolsMsgByClassify(TOOLCLASSIFY iClassify); - DButtonBoxButton *createBoxButton(const QString &strText, QWidget *pParent = nullptr); - DEFSECURITYTOOLINFOLIST getToolInfoByClassify(const DEFSECURITYTOOLINFOLIST &infolist) const; - DWidget *createEmptyDataPane(); - -private Q_SLOTS: - // 设置因主题改变图标 - void changeThemeType(ColorType themeType); - -private: - SecurityToolsModel *m_model; - DFrame *m_scrollAreaWidgetContents; - DButtonBox *m_pSecurityButtonBox; - DLabel *m_pMsgLabel; - TOOLSSTATUS m_toolStatus; - TOOLCLASSIFY m_iClassify; - DDropdown *m_pDropDown; - DStackedWidget *m_pStackedWidget; -}; - -#endif // SECURITYTOOLSWIDGET_H diff --git a/deepin-pc-manager/src/window/modules/systemcheck/autostartcheck/autostartcheckmodel.cpp b/deepin-pc-manager/src/window/modules/systemcheck/autostartcheck/autostartcheckmodel.cpp new file mode 100644 index 0000000..00570b5 --- /dev/null +++ b/deepin-pc-manager/src/window/modules/systemcheck/autostartcheck/autostartcheckmodel.cpp @@ -0,0 +1,64 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "autostartcheckmodel.h" +#include "window/common/invokers/invokerfactory.h" + +AutoStartCheckModel::AutoStartCheckModel(QObject *parent) + : QObject(parent) + , m_launcherInter(nullptr) + , m_startManagerInterface(nullptr) +{ + initData(); +} + +AutoStartCheckModel::~AutoStartCheckModel() +{ +} + +void AutoStartCheckModel::initData() +{ + registerLauncherItemInfoMetaType(); + + // 取应用数据接口 + m_launcherInter = InvokerFactory::GetInstance().CreateInvoker("com.deepin.dde.daemon.Launcher", + "/com/deepin/dde/daemon/Launcher", + "com.deepin.dde.daemon.Launcher", + ConnectType::SESSION, + this); + m_startManagerInterface = InvokerFactory::GetInstance().CreateInvoker("com.deepin.SessionManager", + "/com/deepin/StartManager", + "com.deepin.StartManager", + ConnectType::SESSION, + this); +} + +// 获取允许自启动应用个数 +int AutoStartCheckModel::getAutoStartAppCount() +{ + int count = 0; + + QDBusMessage msg = DBUS_BLOCK_INVOKE(m_launcherInter, "GetAllItemInfos"); + QDBusArgument arg = msg.arguments().first().value(); + QList datas; + arg >> datas; + + for (const auto &it : datas) { + // 判断该应用状态(是否是自启动) + bool bStatus = isAutostart(it.Path); + if (bStatus) { + count += 1; + } + } + return count; +} + +// 判断是否是开机自启 +bool AutoStartCheckModel::isAutostart(QString sPath) +{ + QDBusMessage msg = DBUS_BLOCK_INVOKE(m_startManagerInterface, "IsAutostart", sPath); + GET_MESSAGE_VALUE(bool, flag, msg); + + return flag; +} diff --git a/deepin-pc-manager/src/window/modules/systemcheck/autostartcheck/autostartcheckmodel.h b/deepin-pc-manager/src/window/modules/systemcheck/autostartcheck/autostartcheckmodel.h new file mode 100644 index 0000000..f8493d7 --- /dev/null +++ b/deepin-pc-manager/src/window/modules/systemcheck/autostartcheck/autostartcheckmodel.h @@ -0,0 +1,30 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "defenderlauncherinfo.h" + +#include + +class DBusInvokerInterface; +class AutoStartCheckModel : public QObject +{ + Q_OBJECT +public: + explicit AutoStartCheckModel(QObject *parent = nullptr); + ~AutoStartCheckModel(); + + // 获取允许自启动应用个数 + int getAutoStartAppCount(); + +private: + // 初始化数据 + void initData(); + bool isAutostart(QString sPath); + +private: + DBusInvokerInterface *m_launcherInter; // 取应用数据接口 + DBusInvokerInterface *m_startManagerInterface; // 自启动接口 +}; diff --git a/deepin-pc-manager/src/window/modules/systemcheck/autostartcheck/defenderlauncherinfo.cpp b/deepin-pc-manager/src/window/modules/systemcheck/autostartcheck/defenderlauncherinfo.cpp new file mode 100644 index 0000000..9ad646f --- /dev/null +++ b/deepin-pc-manager/src/window/modules/systemcheck/autostartcheck/defenderlauncherinfo.cpp @@ -0,0 +1,34 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "defenderlauncherinfo.h" + +// 重载launcher dbus GetAllItemInfos获取的结构体操作符函数 +const QDBusArgument &operator>>(const QDBusArgument &argument, LauncherItemInfo &iteminfos) +{ + argument.beginStructure(); + argument >> iteminfos.Path >> iteminfos.Name >> iteminfos.ID >> iteminfos.Icon >> iteminfos.CategoryID >> iteminfos.TimeInstalled; + argument.endStructure(); + return argument; +} + +const QDBusArgument &operator<<(QDBusArgument &argument, const LauncherItemInfo &iteminfo) +{ + argument.beginStructure(); + argument << iteminfo.Path << iteminfo.Name << iteminfo.ID << iteminfo.Icon << iteminfo.CategoryID << iteminfo.TimeInstalled; + argument.endStructure(); + return argument; +} + +void registerLauncherItemInfoMetaType() +{ + qRegisterMetaType("LauncherItemInfo"); + qDBusRegisterMetaType(); +} + +void registerLauncherItemInfoListMetaType() +{ + qRegisterMetaType("LauncherItemInfoList"); + qDBusRegisterMetaType(); +} diff --git a/deepin-pc-manager/src/window/modules/systemcheck/autostartcheck/defenderlauncherinfo.h b/deepin-pc-manager/src/window/modules/systemcheck/autostartcheck/defenderlauncherinfo.h new file mode 100644 index 0000000..4d5f56d --- /dev/null +++ b/deepin-pc-manager/src/window/modules/systemcheck/autostartcheck/defenderlauncherinfo.h @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef SOCKETLAUNCHERINFO_H +#define SOCKETLAUNCHERINFO_H + +#include +#include +#include +#include + +// com.deepin.dde.daemon.Launcher dbus GetAllItemInfos获取的结构体信息 +struct LauncherItemInfo { + QString Path; + QString Name; + QString ID; + QString Icon; + qint64 CategoryID; + qint64 TimeInstalled; +}; +Q_DECLARE_METATYPE(LauncherItemInfo); + +typedef QList LauncherItemInfoList; +Q_DECLARE_METATYPE(LauncherItemInfoList) + +// 重载launcher dbus GetAllItemInfos获取的结构体操作符函数 +const QDBusArgument &operator>>(const QDBusArgument &argument, LauncherItemInfo &iteminfos); +const QDBusArgument &operator<<(QDBusArgument &argument, const LauncherItemInfo &iteminfos); +void registerLauncherItemInfoMetaType(); +void registerLauncherItemInfoListMetaType(); + +#endif // SOCKETLAUNCHERINFO_H diff --git a/deepin-pc-manager/src/window/modules/systemcheck/diskcheck/diskcheckmodel.cpp b/deepin-pc-manager/src/window/modules/systemcheck/diskcheck/diskcheckmodel.cpp new file mode 100644 index 0000000..94e4dd2 --- /dev/null +++ b/deepin-pc-manager/src/window/modules/systemcheck/diskcheck/diskcheckmodel.cpp @@ -0,0 +1,104 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "diskcheckmodel.h" +#include "window/common/invokers/invokerfactory.h" +#include "parted/parted.h" + +#include +#include + +// 检查是否为可用设备 +bool useableDevice(const PedDevice *lpDevice) +{ + Q_ASSERT(nullptr != lpDevice); + char *buf = static_cast(malloc(size_t(lpDevice->sector_size))); + if (!buf) + return false; + + // Must be able to read from the first sector before the disk device is considered + // useable in GParted. + bool success = false; + int fd = open(lpDevice->path, O_RDONLY | O_NONBLOCK); + if (fd >= 0) { + ssize_t bytesRead = read(fd, buf, size_t(lpDevice->sector_size)); + success = (bytesRead == lpDevice->sector_size); + close(fd); + } + free(buf); + return success; +} + +DiskCheckModel::DiskCheckModel(QObject *parent) + : QObject(parent) + , m_diskManagerInvokerInter(nullptr) +{ + initData(); +} + +DiskCheckModel::~DiskCheckModel() +{ +} + +void DiskCheckModel::initData() +{ + // 磁盘管理dbus服务 + m_diskManagerInvokerInter = InvokerFactory::GetInstance().CreateInvoker("com.deepin.diskmanager", + "/com/deepin/diskmanager", + "com.deepin.diskmanager", + ConnectType::SYSTEM, + this); +} + +// 磁盘管理器 是否已安装 +bool DiskCheckModel::isDiskManagerInterValid() +{ + QProcess proc; + // 查询是否已经安装 磁盘管理器 + proc.start("dpkg", {"-s", "deepin-diskmanager"}); + proc.waitForFinished(); + QString status = proc.readAllStandardOutput(); + + return status.startsWith("Package: deepin-diskmanager\nStatus: install"); +} + +// 获取磁盘状态 +bool DiskCheckModel::getDiskStatus() +{ + // 遍历所有磁盘设备路径 + QDBusMessage msg; + QStringList devPaths = getDiskDevicePathList(); + for (QString devPath : devPaths) { + msg = DBUS_BLOCK_INVOKE(m_diskManagerInvokerInter, "onGetDeviceHardStatus", devPath); + GET_MESSAGE_VALUE(QString, data, msg); + + // 状态结果转小写 + QString status = data.toLower(); + // 若状态为异常,返回false + if ("passed" != status) { + qWarning() << "[HomePageModel] [getDiskStatus] no passed"; + return false; + } + } + + // 所有磁盘正常 + return true; +} + +// 获取磁盘设备路径列表 +QList DiskCheckModel::getDiskDevicePathList() +{ + QList devicepaths {}; + + ped_device_probe_all(); + PedDevice *lpDevice = ped_device_get_next(nullptr); + while (lpDevice) { + if (useableDevice(lpDevice)) { + devicepaths.append(lpDevice->path); + } + lpDevice = ped_device_get_next(lpDevice); + } + + return devicepaths; +} diff --git a/deepin-pc-manager/src/window/modules/systemcheck/diskcheck/diskcheckmodel.h b/deepin-pc-manager/src/window/modules/systemcheck/diskcheck/diskcheckmodel.h new file mode 100644 index 0000000..5bf246d --- /dev/null +++ b/deepin-pc-manager/src/window/modules/systemcheck/diskcheck/diskcheckmodel.h @@ -0,0 +1,34 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include +#include + +#include + +class DBusInvokerInterface; +class DiskCheckModel : public QObject +{ + Q_OBJECT +public: + explicit DiskCheckModel(QObject *parent = nullptr); + ~DiskCheckModel(); + + // 磁盘管理器 是否已安装 + bool isDiskManagerInterValid(); + // 获取磁盘状态 + bool getDiskStatus(); + +private: + // 初始化数据 + void initData(); + + // 获取磁盘设备路径列表 + QList getDiskDevicePathList(); + +private: + DBusInvokerInterface *m_diskManagerInvokerInter; // 磁盘管理dbus服务 +}; diff --git a/deepin-pc-manager/src/window/modules/homepagecheck/widgets/syscheckresultheaderwidget.cpp b/deepin-pc-manager/src/window/modules/systemcheck/syscheckresultheaderwidget.cpp similarity index 61% rename from deepin-pc-manager/src/window/modules/homepagecheck/widgets/syscheckresultheaderwidget.cpp rename to deepin-pc-manager/src/window/modules/systemcheck/syscheckresultheaderwidget.cpp index 1fd54a7..b8c6725 100644 --- a/deepin-pc-manager/src/window/modules/homepagecheck/widgets/syscheckresultheaderwidget.cpp +++ b/deepin-pc-manager/src/window/modules/systemcheck/syscheckresultheaderwidget.cpp @@ -5,15 +5,32 @@ #include "syscheckresultheaderwidget.h" -#include #include #include +#include #include DWIDGET_USE_NAMESPACE -#define SET_ACC_NAME(control, name) SET_ACCESS_NAME_T(control, sysCheckResultHeaderWidget, name) +#define FIXED_COL(column, weight) \ + { \ + mainLayout->setColumnStretch(column, weight); \ + mainLayout->setColumnMinimumWidth(column, weight); \ + } +#define FIXED_ROW(row, height) \ + { \ + mainLayout->setRowStretch(row, height); \ + mainLayout->setRowMinimumHeight(row, height); \ + } + +#define RICH_TEXT_COLOR_FORMAT "%2" + +const QString k90_100Color = "#00C134"; +const QString k75_90Color = "#8CD400"; +const QString k60_75Color = "#FF5C00"; +const QString k0_60Color = "#D80000"; +const QString kOutOfDate = "#FF5C00"; SysCheckResultHeaderWidget::SysCheckResultHeaderWidget(QWidget *parent) : DFrame(parent) @@ -27,10 +44,10 @@ SysCheckResultHeaderWidget::SysCheckResultHeaderWidget(QWidget *parent) { this->setFixedSize(750, 146); this->setLineWidth(0); - this->setBackgroundRole(DPalette::Window); + this->setBackgroundRole(DPalette::Background); this->setContentsMargins(0, 0, 0, 0); DPalette dpa = DPaletteHelper::instance()->palette(this, this->palette()); - dpa.setColor(DPalette::Window, QColor::fromRgb(163, 211, 255, int(0.13 * 255))); + dpa.setColor(DPalette::Background, QColor::fromRgb(163, 211, 255, int(0.13 * 255))); DPaletteHelper::instance()->setPalette(this, dpa); initUI(); @@ -48,18 +65,16 @@ void SysCheckResultHeaderWidget::onPointChanged(int value, int issueCount) m_tips->show(); m_logo->show(); - m_pointValue->setText(SystemCheckHelper::getColoredText(value, QString("%1").arg(value))); + m_pointValue->setText(getColoredText(value, QString("%1").arg(value))); - if (CHECK_MAX_POINT == value) { - m_title->setText(kNormalResultTitle); - m_tips->setText(kNormalResultTip); - m_logo->setPixmap(QIcon::fromTheme(k100PointResultLogoPath).pixmap(190, 146)); + if (100 == value) { + m_title->setText(tr("Your computer is healthy")); + m_tips->setText(tr("Great! Keep staying healthy please.")); + m_logo->setPixmap(QIcon::fromTheme("dcc_syscheck_result_100point").pixmap(190, 146)); } else { - m_title->setText( - QString(kAbnormalResultTitle) - .arg(SystemCheckHelper::getColoredText(value, QString("%1").arg(issueCount)))); - m_tips->setText(kAbnormalResultTip); - m_logo->setPixmap(QIcon::fromTheme(kAbnormalResultLogoPath).pixmap(190, 146)); + m_title->setText(QString(tr("%1 issue(s) found")).arg(getColoredText(value, QString("%1").arg(issueCount)))); + m_tips->setText(tr("Fix issues right now to keep your computer healthy.")); + m_logo->setPixmap(QIcon::fromTheme("dcc_syscheck_result_abnormal").pixmap(190, 146)); } } @@ -69,13 +84,13 @@ void SysCheckResultHeaderWidget::onFastFixFinished() hideAll(); m_pointValue->show(); m_pointText->show(); - m_pointValue->setText(SystemCheckHelper::getColoredText(100, QString("%1").arg(100))); + m_pointValue->setText(getColoredText(100, QString("%1").arg(100))); m_title->show(); - m_title->setText(kNormalResultTitle); + m_title->setText(tr("Your computer is healthy")); m_tips->show(); - m_tips->setText(kNormalResultTip); + m_tips->setText(tr("Great! Keep staying healthy please.")); - m_logo->setPixmap(QIcon::fromTheme(k100PointResultLogoPath).pixmap(190, 146)); + m_logo->setPixmap(QIcon::fromTheme("dcc_syscheck_result_100point").pixmap(190, 146)); m_logo->show(); } @@ -84,56 +99,44 @@ void SysCheckResultHeaderWidget::onFastFixStarted() hideAll(); m_fixingTips->show(); m_fixingTitle->show(); - m_fixingTips->setText(kFixingTitle); - m_tips->setText(kFixingTip); - m_logo->setPixmap(QIcon::fromTheme(kRepairingResultLogoPath).pixmap(190, 146)); + m_fixingTips->setText(tr("Fixing issues")); + m_tips->setText(tr("It will be completed soon.")); + m_logo->setPixmap(QIcon::fromTheme("dcc_syscheck_result_repair").pixmap(190, 146)); m_logo->show(); } void SysCheckResultHeaderWidget::initUI() { m_pointValue = new DLabel(this); - SET_ACC_NAME(m_pointValue, pointValue); m_pointValue->setFixedHeight(87); QFont pvf = m_pointValue->font(); pvf.setPixelSize(60); m_pointValue->setFont(pvf); m_pointText = new DLabel(this); - SET_ACC_NAME(m_pointText, pointText); m_pointText->setFixedHeight(20); - FIXED_FONT_PIXEL_SIZE(m_pointText, 14); - m_pointText->setText(kPointText); + m_pointText->setText(tr("points")); m_title = new DLabel(this); - SET_ACC_NAME(m_title, title); m_title->setFixedHeight(32); - FIXED_FONT_PIXEL_SIZE(m_title, 22); m_title->setAlignment(Qt::AlignBottom); m_tips = new DTipLabel("", this); - SET_ACC_NAME(m_tips, tips); m_tips->setFixedHeight(17); DFontSizeManager::instance()->unbind(m_tips); - FIXED_FONT_PIXEL_SIZE(m_tips, 12); m_tips->setAlignment(Qt::AlignBottom); m_logo = new DLabel(this); - SET_ACC_NAME(m_logo, logo); m_logo->setFixedSize(190, 146); m_fixingTitle = new DLabel(this); - SET_ACC_NAME(m_fixingTitle, fixingTitle); m_fixingTitle->setFixedHeight(32); - FIXED_FONT_PIXEL_SIZE(m_fixingTitle, 22); m_fixingTitle->setAlignment(Qt::AlignBottom); m_fixingTips = new DTipLabel("", this); - SET_ACC_NAME(m_fixingTips, fixingTips); m_fixingTips->setFixedHeight(17); DFontSizeManager::instance()->unbind(m_fixingTips); - FIXED_FONT_PIXEL_SIZE(m_fixingTips, 12); m_fixingTips->setAlignment(Qt::AlignBottom); @@ -175,3 +178,24 @@ void SysCheckResultHeaderWidget::hideAll() m_fixingTips->hide(); m_fixingTitle->hide(); } + +QString SysCheckResultHeaderWidget::getColoredText(int point, const QString &input) +{ + if (point >= 90) { + return QString(RICH_TEXT_COLOR_FORMAT).arg(k90_100Color).arg(input); + } + + if (point >= 75) { + return QString(RICH_TEXT_COLOR_FORMAT).arg(k75_90Color).arg(input); + } + + if (point >= 60) { + return QString(RICH_TEXT_COLOR_FORMAT).arg(k60_75Color).arg(input); + } + + if (point >= 0) { + return QString(RICH_TEXT_COLOR_FORMAT).arg(k0_60Color).arg(input); + } + + return QString(RICH_TEXT_COLOR_FORMAT).arg(kOutOfDate).arg(input); +} diff --git a/deepin-pc-manager/src/window/modules/homepagecheck/widgets/syscheckresultheaderwidget.h b/deepin-pc-manager/src/window/modules/systemcheck/syscheckresultheaderwidget.h similarity index 67% rename from deepin-pc-manager/src/window/modules/homepagecheck/widgets/syscheckresultheaderwidget.h rename to deepin-pc-manager/src/window/modules/systemcheck/syscheckresultheaderwidget.h index 1abde43..69d4c88 100644 --- a/deepin-pc-manager/src/window/modules/homepagecheck/widgets/syscheckresultheaderwidget.h +++ b/deepin-pc-manager/src/window/modules/systemcheck/syscheckresultheaderwidget.h @@ -6,21 +6,19 @@ #ifndef SYSCHECKRESULTHEADERWIDGET_H #define SYSCHECKRESULTHEADERWIDGET_H -#include "systemcheckdefinition.h" - #include #include #include #include +DWIDGET_USE_NAMESPACE class SysCheckResultHeaderWidget : public Dtk::Widget::DFrame { Q_OBJECT public: explicit SysCheckResultHeaderWidget(QWidget *parent = nullptr); - - ~SysCheckResultHeaderWidget() { } + ~SysCheckResultHeaderWidget() {} public Q_SLOTS: void onPointChanged(int, int); @@ -31,14 +29,16 @@ public Q_SLOTS: void initUI(); void hideAll(); + QString getColoredText(int point, const QString &input); + private: - Dtk::Widget::DLabel *m_pointValue; - Dtk::Widget::DLabel *m_pointText; - Dtk::Widget::DLabel *m_title; - Dtk::Widget::DLabel *m_logo; - Dtk::Widget::DTipLabel *m_tips; - Dtk::Widget::DLabel *m_fixingTitle; - Dtk::Widget::DTipLabel *m_fixingTips; + DLabel *m_pointValue; + DLabel *m_pointText; + DLabel *m_title; + DLabel *m_logo; + DTipLabel *m_tips; + DLabel *m_fixingTitle; + DTipLabel *m_fixingTips; }; #endif // SYSCHECKRESULTHEADERWIDGET_H diff --git a/deepin-pc-manager/src/window/modules/homepagecheck/widgets/syscheckresultitemwidget.cpp b/deepin-pc-manager/src/window/modules/systemcheck/syscheckresultitemwidget.cpp similarity index 61% rename from deepin-pc-manager/src/window/modules/homepagecheck/widgets/syscheckresultitemwidget.cpp rename to deepin-pc-manager/src/window/modules/systemcheck/syscheckresultitemwidget.cpp index 7a5fa38..b42ab32 100644 --- a/deepin-pc-manager/src/window/modules/homepagecheck/widgets/syscheckresultitemwidget.cpp +++ b/deepin-pc-manager/src/window/modules/systemcheck/syscheckresultitemwidget.cpp @@ -5,13 +5,22 @@ #include "syscheckresultitemwidget.h" -#include "systemcheckdefinition.h" - #include DWIDGET_USE_NAMESPACE -#define SET_ACC_NAME(control, name) SET_ACCESS_NAME_T(control, sysCheckResultItemWidget, name) +#define FIXED_COL(column, weight) \ + { \ + mainLayout->setColumnStretch(column, weight); \ + mainLayout->setColumnMinimumWidth(column, weight); \ + } + +#define RICH_TEXT_COLOR_FORMAT "%2" +const QString k90_100Color = "#00C134"; +const QString k75_90Color = "#8CD400"; +const QString k60_75Color = "#FF5C00"; +const QString k0_60Color = "#D80000"; +const QString kOutOfDate = "#FF5C00"; SysCheckResultItemWidget::SysCheckResultItemWidget(SysCheckItemID id, QWidget *parent) : DFrame(parent) @@ -46,45 +55,40 @@ void SysCheckResultItemWidget::onNotifyComplete(SysCheckItemID index, bool isAbn if (isAbnormal) { m_jumpLabel->show(); - m_statusIconLabel->setPixmap(QIcon::fromTheme(kAbnormalStatusIconPath).pixmap(12, 12)); - if (SysCheckItemID::SSH == m_id) { - m_jumpLabel->setText(kJumpLabel3); - m_statusInfoLabel->setText(SystemCheckHelper::getColoredText(65, kStatusAbnormal3)); - } else if (SysCheckItemID::Disk == m_id) { - m_jumpLabel->setText(kJumpLabel4); - m_statusInfoLabel->setText(SystemCheckHelper::getColoredText(65, kStatusAbnormal4)); - } else if (SysCheckItemID::Trash == m_id) { - m_jumpLabel->setText(kJumpLabel5); - m_statusInfoLabel->setText(SystemCheckHelper::getColoredText(65, kStatusAbnormal5)); + m_statusIconLabel->setPixmap(QIcon::fromTheme("dcc_syscheck_item_abnormal").pixmap(12, 12)); + if (SysCheckItemID::AutoStartApp == m_id) { + m_jumpLabel->setText(tr("Check up")); + m_statusInfoLabel->setText(getColoredText(65, tr("%1 apps"))); } else if (SysCheckItemID::SystemUpdate == m_id) { - m_jumpLabel->setText(kJumpLabel6); - m_statusInfoLabel->setText(SystemCheckHelper::getColoredText(65, kStatusAbnormal6)); + m_jumpLabel->setText(tr("Check for updates")); + m_statusInfoLabel->setText(getColoredText(65, tr("Out of date"))); + } else if (SysCheckItemID::Trash == m_id) { + m_jumpLabel->setText(tr("Clean up")); + m_statusInfoLabel->setText(getColoredText(65, tr("There are junk files"))); + } else if (SysCheckItemID::Disk == m_id) { + m_jumpLabel->setText(tr("Go to check")); + m_statusInfoLabel->setText(getColoredText(65, tr("Found errors"))); } else if (SysCheckItemID::DevMode == m_id) { - m_jumpLabel->setText(kJumpLabel7); - m_statusInfoLabel->setText(SystemCheckHelper::getColoredText(65, kStatusAbnormal7)); - } else if (SysCheckItemID::AutoStartApp == m_id) { - m_jumpLabel->setText(kJumpLabel8); - m_statusInfoLabel->setText(SystemCheckHelper::getColoredText(65, kStatusAbnormal8)); + m_jumpLabel->setText(""); + m_statusInfoLabel->setText(getColoredText(65, tr("Root access allowed, which is risky"))); } else if (SysCheckItemID::MaxLimit == m_id) { - m_jumpLabel->setText(kJumpLabel8); - m_statusInfoLabel->setText(SystemCheckHelper::getColoredText(65, kStatusAbnormal8)); + m_jumpLabel->setText(tr("Check up")); + m_statusInfoLabel->setText(getColoredText(65, tr("%1 apps"))); } } else { - m_statusIconLabel->setPixmap(QIcon::fromTheme(kNormalStatusIconPath).pixmap(12, 12)); - if (SysCheckItemID::SSH == m_id) { - m_statusInfoLabel->setText(SystemCheckHelper::getColoredText(100, kStatusNormal3)); - } else if (SysCheckItemID::Disk == m_id) { - m_statusInfoLabel->setText(SystemCheckHelper::getColoredText(100, kStatusNormal4)); - } else if (SysCheckItemID::Trash == m_id) { - m_statusInfoLabel->setText(SystemCheckHelper::getColoredText(100, kStatusNormal5)); + m_statusIconLabel->setPixmap(QIcon::fromTheme("dcc_syscheck_item_normal").pixmap(12, 12)); + if (SysCheckItemID::AutoStartApp == m_id) { + m_statusInfoLabel->setText(getColoredText(100, tr("%1 apps"))); } else if (SysCheckItemID::SystemUpdate == m_id) { - m_statusInfoLabel->setText(SystemCheckHelper::getColoredText(100, kStatusNormal6)); + m_statusInfoLabel->setText(getColoredText(100, tr("Up to date"))); + } else if (SysCheckItemID::Trash == m_id) { + m_statusInfoLabel->setText(getColoredText(100, tr("Clean"))); + } else if (SysCheckItemID::Disk == m_id) { + m_statusInfoLabel->setText(getColoredText(100, tr("No errors found"))); } else if (SysCheckItemID::DevMode == m_id) { - m_statusInfoLabel->setText(SystemCheckHelper::getColoredText(100, kStatusNormal7)); - } else if (SysCheckItemID::AutoStartApp == m_id) { - m_statusInfoLabel->setText(SystemCheckHelper::getColoredText(100, kStatusNormal8)); + m_statusInfoLabel->setText(getColoredText(100, tr("No root access"))); } else if (SysCheckItemID::MaxLimit == m_id) { - m_statusInfoLabel->setText(SystemCheckHelper::getColoredText(100, kStatusNormal8)); + m_statusInfoLabel->setText(getColoredText(100, tr("%1 apps"))); } } } @@ -95,7 +99,7 @@ void SysCheckResultItemWidget::onNotifyFixStarted(SysCheckItemID index) if (m_id == index) { hideAll(); m_fixTipLabel->show(); - m_fixTipLabel->setText(kFixTip); + m_fixTipLabel->setText(tr("Fixing")); m_fixSpinner->show(); m_fixSpinner->start(); @@ -107,23 +111,21 @@ void SysCheckResultItemWidget::onNotifyFixFinished(SysCheckItemID index) if (m_id == index) { hideAll(); m_statusIconLabel->show(); - m_statusIconLabel->setPixmap(QIcon::fromTheme(kNormalStatusIconPath).pixmap(12, 12)); + m_statusIconLabel->setPixmap(QIcon::fromTheme("dcc_syscheck_item_normal").pixmap(12, 12)); m_statusInfoLabel->show(); - if (SysCheckItemID::SSH == m_id) { - m_statusInfoLabel->setText(SystemCheckHelper::getColoredText(100, kStatusNormal3)); - } else if (SysCheckItemID::Disk == m_id) { - m_statusInfoLabel->setText(SystemCheckHelper::getColoredText(100, kStatusNormal4)); + if (SysCheckItemID::Disk == m_id) { + m_statusInfoLabel->setText(getColoredText(100, tr("No errors found"))); } else if (SysCheckItemID::Trash == m_id) { - m_statusInfoLabel->setText(SystemCheckHelper::getColoredText(100, kStatusNormal5)); + m_statusInfoLabel->setText(getColoredText(100, tr("Clean"))); } else if (SysCheckItemID::SystemUpdate == m_id) { - m_statusInfoLabel->setText(SystemCheckHelper::getColoredText(100, kStatusNormal6)); + m_statusInfoLabel->setText(getColoredText(100, tr("Up to date"))); } else if (SysCheckItemID::DevMode == m_id) { - m_statusInfoLabel->setText(SystemCheckHelper::getColoredText(100, kStatusNormal7)); + m_statusInfoLabel->setText(getColoredText(100, tr("No root access"))); } else if (SysCheckItemID::AutoStartApp == m_id) { - m_statusInfoLabel->setText(SystemCheckHelper::getColoredText(100, kStatusNormal8)); + m_statusInfoLabel->setText(getColoredText(100, tr("%1 apps"))); } else if (SysCheckItemID::MaxLimit == m_id) { - m_statusInfoLabel->setText(SystemCheckHelper::getColoredText(100, kStatusNormal8)); + m_statusInfoLabel->setText(getColoredText(100, tr("%1 apps"))); } m_fixSpinner->stop(); @@ -137,29 +139,27 @@ void SysCheckResultItemWidget::onNotifyIgnored(bool isIgnored) // 仅两个项目需要处理忽略状态 if (SysCheckItemID::DevMode == m_id) { QString info = m_resultItem->data(CheckResultModelRole::IsIssueHappen).toBool() - ? kStatusAbnormal7 - : kStatusNormal7; + ? tr("Root access allowed, which is risky") + : tr("No root access"); if (isIgnored) { // 被忽略时不要隐藏,依照早期需求处理 // this->hide(); // 下次检查时被隐藏,不需要处理按钮 m_ignoreBtn->hide(); m_disIgnoreBtn->show(); - m_statusIconLabel->setPixmap(QIcon::fromTheme(kNormalStatusIconPath).pixmap(12, 12)); - m_statusInfoLabel->setText(SystemCheckHelper::getColoredText(100, info)); + m_statusIconLabel->setPixmap(QIcon::fromTheme("dcc_syscheck_item_normal").pixmap(12, 12)); + m_statusInfoLabel->setText(getColoredText(100, info)); } else { // 显示忽略按钮 m_ignoreBtn->show(); m_disIgnoreBtn->hide(); if (m_resultItem->data(CheckResultModelRole::IsIssueHappen).toBool()) { - m_statusIconLabel->setPixmap( - QIcon::fromTheme(kAbnormalStatusIconPath).pixmap(12, 12)); - m_statusInfoLabel->setText(SystemCheckHelper::getColoredText(65, info)); + m_statusIconLabel->setPixmap(QIcon::fromTheme("dcc_syscheck_item_abnormal").pixmap(12, 12)); + m_statusInfoLabel->setText(getColoredText(65, info)); } else { - m_statusIconLabel->setPixmap( - QIcon::fromTheme(kNormalStatusIconPath).pixmap(12, 12)); + m_statusIconLabel->setPixmap(QIcon::fromTheme("dcc_syscheck_item_normal").pixmap(12, 12)); QString info = m_statusInfoLabel->text(); - m_statusInfoLabel->setText(SystemCheckHelper::getColoredText(100, info)); + m_statusInfoLabel->setText(getColoredText(100, info)); } } return; @@ -169,20 +169,18 @@ void SysCheckResultItemWidget::onNotifyIgnored(bool isIgnored) if (m_resultItem) { m_resultItem->setData(isIgnored, CheckResultModelRole::IsIgnored); int count = m_resultItem->data(CheckResultModelRole::Details).toInt(); - QString autoStartDetail = kStatusNormal8; + QString autoStartDetail = tr("%1 apps"); autoStartDetail = autoStartDetail.arg(count); if (isIgnored) { m_ignoreBtn->hide(); m_disIgnoreBtn->show(); - m_statusIconLabel->setPixmap( - QIcon::fromTheme(kNormalStatusIconPath).pixmap(12, 12)); - m_statusInfoLabel->setText(SystemCheckHelper::getColoredText(100, autoStartDetail)); + m_statusIconLabel->setPixmap(QIcon::fromTheme("dcc_syscheck_item_normal").pixmap(12, 12)); + m_statusInfoLabel->setText(getColoredText(100, autoStartDetail)); } else { m_ignoreBtn->show(); m_disIgnoreBtn->hide(); - m_statusIconLabel->setPixmap( - QIcon::fromTheme(kAbnormalStatusIconPath).pixmap(12, 12)); - m_statusInfoLabel->setText(SystemCheckHelper::getColoredText(65, autoStartDetail)); + m_statusIconLabel->setPixmap(QIcon::fromTheme("dcc_syscheck_item_abnormal").pixmap(12, 12)); + m_statusInfoLabel->setText(getColoredText(65, autoStartDetail)); } return; } @@ -227,70 +225,54 @@ void SysCheckResultItemWidget::onAutoStartAppCountChanged(int count) void SysCheckResultItemWidget::initUI() { m_typeIconLabel = new DLabel(this); - SET_ACC_NAME(m_typeIconLabel, typeIconLabel); m_typeIconLabel->setFixedSize(16, 16); m_typeIconLabel->setPixmap(QIcon::fromTheme(kSystemCheckTypeIconList[m_id]).pixmap(16, 16)); m_typeNameLabel = new DLabel(this); - SET_ACC_NAME(m_typeNameLabel, typeNameLabel); m_typeNameLabel->setFixedHeight(17); - FIXED_FONT_PIXEL_SIZE(m_typeNameLabel, 12); - if (SysCheckItemID::SSH == m_id) { - m_typeNameLabel->setText(kTypename3); - } else if (SysCheckItemID::Disk == m_id) { - m_typeNameLabel->setText(kTypename4); + if (SysCheckItemID::Disk == m_id) { + m_typeNameLabel->setText(tr("Disk checking")); } else if (SysCheckItemID::Trash == m_id) { - m_typeNameLabel->setText(kTypename5); + m_typeNameLabel->setText(tr("System cleanup")); } else if (SysCheckItemID::SystemUpdate == m_id) { - m_typeNameLabel->setText(kTypename6); + m_typeNameLabel->setText(tr("System version")); } else if (SysCheckItemID::DevMode == m_id) { - m_typeNameLabel->setText(kTypename7); + m_typeNameLabel->setText(tr("Developer mode")); } else if (SysCheckItemID::AutoStartApp == m_id) { - m_typeNameLabel->setText(kTypename8); + m_typeNameLabel->setText(tr("Startup programs")); } else if (SysCheckItemID::MaxLimit == m_id) { - m_typeNameLabel->setText(kTypename8); + m_typeNameLabel->setText(tr("Startup programs")); } m_statusIconLabel = new DLabel(this); - SET_ACC_NAME(m_statusIconLabel, statusIconLabel); m_statusIconLabel->setFixedSize(12, 12); - m_statusIconLabel->setPixmap(QIcon::fromTheme(kNormalStatusIconPath).pixmap(12, 12)); + m_statusIconLabel->setPixmap(QIcon::fromTheme("dcc_syscheck_item_normal").pixmap(12, 12)); m_statusInfoLabel = new DLabel(this); - SET_ACC_NAME(m_statusInfoLabel, statusInfoLabel); m_statusInfoLabel->setFixedHeight(17); - FIXED_FONT_PIXEL_SIZE(m_statusInfoLabel, 12); m_fixTipLabel = new DTipLabel("", this); - SET_ACC_NAME(m_fixTipLabel, fixTipLabel); - FIXED_FONT_PIXEL_SIZE(m_fixTipLabel, 12); m_ignoreBtn = new DPushButton(this); - SET_ACC_NAME(m_ignoreBtn, ignoreBtn); m_ignoreBtn->setFixedSize(16, 16); m_ignoreBtn->setIconSize(QSize(16, 16)); - m_ignoreBtn->setIcon(QIcon::fromTheme(kDisIgnoreBtnIconPath).pixmap(16, 16)); + m_ignoreBtn->setIcon(QIcon::fromTheme("dcc_syscheck_item_noignore").pixmap(16, 16)); m_ignoreBtn->setFlat(true); m_ignoreBtn->setFocusPolicy(Qt::FocusPolicy::NoFocus); - m_ignoreBtn->setToolTip(kIgnoreButtonToolTip); + m_ignoreBtn->setToolTip(tr("Dismiss")); m_disIgnoreBtn = new DPushButton(this); - SET_ACC_NAME(m_disIgnoreBtn, disIgnoreBtn); m_disIgnoreBtn->setFixedSize(16, 16); m_disIgnoreBtn->setIconSize(QSize(16, 16)); - m_disIgnoreBtn->setIcon(QIcon::fromTheme(kIgnoreBtnIconPath).pixmap(16, 16)); + m_disIgnoreBtn->setIcon(QIcon::fromTheme("dcc_syscheck_item_ignore").pixmap(16, 16)); m_disIgnoreBtn->setFlat(true); m_disIgnoreBtn->setFocusPolicy(Qt::FocusPolicy::NoFocus); - m_disIgnoreBtn->setToolTip(kDisIgnoreButtonToolTip); + m_disIgnoreBtn->setToolTip(tr("No dismission")); m_jumpLabel = new DCommandLinkButton("", this); - SET_ACC_NAME(m_jumpLabel, jumpLabel); m_jumpLabel->setFixedHeight(17); - FIXED_FONT_PIXEL_SIZE(m_jumpLabel, 12); - m_fixSpinner = new DSpinner(this); - SET_ACC_NAME(m_fixSpinner, fixSpinner); m_fixSpinner->setFixedSize(16, 16); m_fixSpinner->hide(); @@ -301,10 +283,10 @@ void SysCheckResultItemWidget::initUI() FIXED_COL(0, 46); // 靠右放置图标 FIXED_COL(1, 10); FIXED_COL(2, 174); // 项目说明 - FIXED_COL(3, 12); // 状态图标 + FIXED_COL(3, 12); // 状态图标 FIXED_COL(4, 10); FIXED_COL(5, 354); // 状态说明 - FIXED_COL(6, 16); // 忽略图标 + FIXED_COL(6, 16); // 忽略图标 FIXED_COL(7, 20); FIXED_COL(8, 108); // 跳转与spinner @@ -327,6 +309,7 @@ void SysCheckResultItemWidget::initConnection() Q_EMIT requestSetIgnore(m_id, true); m_disIgnoreBtn->show(); m_ignoreBtn->hide(); + m_jumpLabel->hide(); onNotifyIgnored(true); if (SysCheckItemID::DevMode == m_id) { m_disIgnoreBtn->hide(); @@ -336,6 +319,7 @@ void SysCheckResultItemWidget::initConnection() Q_EMIT requestSetIgnore(m_id, false); m_disIgnoreBtn->hide(); m_ignoreBtn->show(); + m_jumpLabel->show(); onNotifyIgnored(false); }); @@ -388,14 +372,15 @@ void SysCheckResultItemWidget::setResult(QStandardItem *resultItem) // 针对自启动 if (m_id == SysCheckItemID::AutoStartApp) { int count = resultItem->data(CheckResultModelRole::Details).toInt(); - QString autoStartDetail = kTypename8; + QString autoStartDetail = tr("%1 apps"); autoStartDetail = autoStartDetail.arg(count); if (isIssueFound && !isIgnored) { - m_statusInfoLabel->setText(SystemCheckHelper::getColoredText(65, autoStartDetail)); - m_statusIconLabel->setPixmap(QIcon::fromTheme(kAbnormalStatusIconPath).pixmap(12, 12)); + m_statusInfoLabel->setText(getColoredText(65, autoStartDetail)); + m_statusIconLabel->setPixmap(QIcon::fromTheme("dcc_syscheck_item_abnormal").pixmap(12, 12)); } else { - m_statusInfoLabel->setText(SystemCheckHelper::getColoredText(100, autoStartDetail)); - m_statusIconLabel->setPixmap(QIcon::fromTheme(kNormalStatusIconPath).pixmap(12, 12)); + m_statusInfoLabel->setText(getColoredText(100, autoStartDetail)); + m_statusIconLabel->setPixmap(QIcon::fromTheme("dcc_syscheck_item_normal").pixmap(12, 12)); + m_jumpLabel->hide(); } // 数量0时,隐藏忽略按钮 @@ -406,3 +391,24 @@ void SysCheckResultItemWidget::setResult(QStandardItem *resultItem) return; } } + +QString SysCheckResultItemWidget::getColoredText(int point, const QString &input) +{ + if (point >= 90) { + return QString(RICH_TEXT_COLOR_FORMAT).arg(k90_100Color).arg(input); + } + + if (point >= 75) { + return QString(RICH_TEXT_COLOR_FORMAT).arg(k75_90Color).arg(input); + } + + if (point >= 60) { + return QString(RICH_TEXT_COLOR_FORMAT).arg(k60_75Color).arg(input); + } + + if (point >= 0) { + return QString(RICH_TEXT_COLOR_FORMAT).arg(k0_60Color).arg(input); + } + + return QString(RICH_TEXT_COLOR_FORMAT).arg(kOutOfDate).arg(input); +} diff --git a/deepin-pc-manager/src/window/modules/homepagecheck/widgets/syscheckresultitemwidget.h b/deepin-pc-manager/src/window/modules/systemcheck/syscheckresultitemwidget.h similarity index 67% rename from deepin-pc-manager/src/window/modules/homepagecheck/widgets/syscheckresultitemwidget.h rename to deepin-pc-manager/src/window/modules/systemcheck/syscheckresultitemwidget.h index 04e298c..08bec19 100644 --- a/deepin-pc-manager/src/window/modules/homepagecheck/widgets/syscheckresultitemwidget.h +++ b/deepin-pc-manager/src/window/modules/systemcheck/syscheckresultitemwidget.h @@ -6,25 +6,33 @@ #ifndef SYSCHECKREUSLTITEMWIDGET_H #define SYSCHECKREUSLTITEMWIDGET_H -#include "systemcheckdefinition.h" +#include "window/common/common.h" -#include #include #include -#include -#include #include +#include +#include +#include -#include #include +#include + +const QList kSystemCheckTypeIconList = { + "dcc_syscheck_item_autostart", + "dcc_syscheck_item_sysupdate", + "dcc_syscheck_item_garbage", + "dcc_syscheck_item_disk", + "dcc_syscheck_item_dev", +}; +DWIDGET_USE_NAMESPACE class SysCheckResultItemWidget : public Dtk::Widget::DFrame { Q_OBJECT public: explicit SysCheckResultItemWidget(SysCheckItemID id, QWidget *parent = nullptr); - - ~SysCheckResultItemWidget() { } + ~SysCheckResultItemWidget() {} public Q_SLOTS: void onNotifyComplete(SysCheckItemID index, bool isAbnormal); @@ -45,18 +53,19 @@ public Q_SLOTS: void hideAll(); void setResult(QStandardItem *); + QString getColoredText(int point, const QString &input); + private: SysCheckItemID m_id; - Dtk::Widget::DLabel *m_typeIconLabel; - Dtk::Widget::DLabel *m_typeNameLabel; - Dtk::Widget::DLabel *m_statusIconLabel; - Dtk::Widget::DLabel *m_statusInfoLabel; - Dtk::Widget::DTipLabel *m_fixTipLabel; - // Dtk::Widget::DLabel *m_ignoreLabel; - Dtk::Widget::DCommandLinkButton *m_jumpLabel; - Dtk::Widget::DSpinner *m_fixSpinner; - Dtk::Widget::DPushButton *m_ignoreBtn; - Dtk::Widget::DPushButton *m_disIgnoreBtn; + DLabel *m_typeIconLabel; + DLabel *m_typeNameLabel; + DLabel *m_statusIconLabel; + DLabel *m_statusInfoLabel; + DTipLabel *m_fixTipLabel; + DCommandLinkButton *m_jumpLabel; + DSpinner *m_fixSpinner; + DPushButton *m_ignoreBtn; + DPushButton *m_disIgnoreBtn; QStandardItem *m_resultItem; }; diff --git a/deepin-pc-manager/src/window/modules/systemcheck/systemcheckmodel.cpp b/deepin-pc-manager/src/window/modules/systemcheck/systemcheckmodel.cpp new file mode 100644 index 0000000..aa301a4 --- /dev/null +++ b/deepin-pc-manager/src/window/modules/systemcheck/systemcheckmodel.cpp @@ -0,0 +1,432 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "systemcheckmodel.h" +#include "window/common/gsettingkey.h" +#include "window/common/invokers/invokerfactory.h" + +#include + +SystemCheckModel::SystemCheckModel(QObject *parent) + : QObject(parent) + , m_dconfig(nullptr) +{ + initData(); +} + +SystemCheckModel::~SystemCheckModel() +{ +} + +void SystemCheckModel::initData() +{ + m_dconfig = DConfig::create("org.deepin.dde.deepin-pc-manager", "org.deepin.dde.deepin-pc-manager"); + m_autoStartCheckModel = new AutoStartCheckModel(this); + m_sysUpdateModel = new SysUpdaterModel(this); + m_diskCheckModel = new DiskCheckModel(this); + + // 检查系统更新完成 + connect(m_sysUpdateModel, &SysUpdaterModel::sendHaveUpdates, this, &SystemCheckModel::checkSysUpdateFinished); + + // 同步助手dbus服务,用于查询是否处于开发者模式 + m_helperInvokerInter = InvokerFactory::GetInstance().CreateInvoker("com.deepin.sync.Helper", + "/com/deepin/sync/Helper", + "com.deepin.sync.Helper", + ConnectType::SYSTEM, + this); + // 控制中心dbus服务对象 + m_controlCenterInvokerInter = + InvokerFactory::GetInstance().CreateInvoker("com.deepin.dde.ControlCenter", + "/com/deepin/dde/ControlCenter", + "com.deepin.dde.ControlCenter", + ConnectType::SESSION, + this); + + m_sysetemDaemonInvokerInter = InvokerFactory::GetInstance().CreateInvoker("com.deepin.pc.manager.system.daemon", + "/com/deepin/pc/manager/system/daemon", + "com.deepin.pc.manager.system.daemon", + ConnectType::SYSTEM, + this); +} + +// 设置上次体检分数 +void SystemCheckModel::setSafetyScore(int score) +{ + if (m_dconfig->isValid()) { + m_dconfig->setValue(SAFETY_SCORE, score); + } +} +// 获取上次体检分数 +int SystemCheckModel::getSafetyScore() +{ + int score = -1; + if (m_dconfig->isValid()) { + score = m_dconfig->value(SAFETY_SCORE).toInt(); + } + return score; +} + +// 设置上次体检时间 +void SystemCheckModel::setLastCheckTime(QDateTime dateTime) +{ + if (m_dconfig->isValid()) { + m_dconfig->setValue(LAST_CHECK_TIME, dateTime.toString("yyyy-MM-dd-hh-mm-ss")); + } +} +// 获取上次体检时间 +QDateTime SystemCheckModel::getLastCheckTime() +{ + QString timeStr; + if (m_dconfig->isValid()) { + timeStr = m_dconfig->value(LAST_CHECK_TIME).toString(); + } + return QDateTime::fromString(timeStr, "yyyy-MM-dd-hh-mm-ss"); +} + +bool SystemCheckModel::ignoreDevModeChecking() const +{ + bool status = false; + if (m_dconfig->isValid()) { + status = m_dconfig->value(IGNORE_DEV_MODE_CHECKING).toBool(); + } + return status; +} + +void SystemCheckModel::setIgnoreDevModeChecking(bool ignore) +{ + if (m_dconfig->isValid()) { + m_dconfig->setValue(IGNORE_DEV_MODE_CHECKING, ignore); + } +} + +bool SystemCheckModel::ignoreAutoStartChecking() const +{ + bool status = false; + if (m_dconfig->isValid()) { + status = m_dconfig->value(IGNORE_AUTO_START_CHECKING).toBool(); + } + return status; +} + +void SystemCheckModel::setIgnoreAutoStartChecking(bool ignore) +{ + if (m_dconfig->isValid()) { + m_dconfig->setValue(IGNORE_AUTO_START_CHECKING, ignore); + } +} + +// 开始体检 +void SystemCheckModel::startExam() +{ + m_issuePoint = 0; + m_issueCount = 0; + m_virusCount = 0; + m_isAVOutDate = false; + m_autoStartCount = 0; + m_isDevMode = false; + m_isDiskNormal = true; + m_isSysOutDate = false; + m_totalTrashSize = 0.0; + + m_logProblemItemsInfo = ""; + m_fixingItems.clear(); + + resetResultItems(); + startAutoStartExam(); +} +// 开始自启动检测 +void SystemCheckModel::startAutoStartExam() +{ + m_processingIndex = SysCheckItemID::AutoStartApp; + Q_EMIT stageChanged(SysCheckItemID::AutoStartApp); + + m_autoStartCount = m_autoStartCheckModel->getAutoStartAppCount(); + QStandardItem *autoStartItem = m_resultItems[SysCheckItemID::AutoStartApp]; + autoStartItem->setData(SysCheckItemID::AutoStartApp, CheckResultModelRole::ID); + autoStartItem->setData(CheckProgressStatus::Success, + CheckResultModelRole::CheckProgressFlag); + autoStartItem->setData(m_autoStartCount > 0, CheckResultModelRole::IsIssueHappen); + autoStartItem->setData(ignoreAutoStartChecking(), CheckResultModelRole::IsIgnored); + autoStartItem->setData(m_autoStartCount, CheckResultModelRole::Details); + + startSysVersionExam(); +} +// 开始系统版本检测 +void SystemCheckModel::startSysVersionExam() +{ + if (m_processingIndex != SysCheckItemID::AutoStartApp) { + return; + } + + m_processingIndex = SysCheckItemID::SystemUpdate; + Q_EMIT stageChanged(SysCheckItemID::SystemUpdate); + m_sysUpdateModel->checkForUpdates(); +} + +// 检查系统更新完成 +void SystemCheckModel::checkSysUpdateFinished(bool canUpdate) +{ + m_isSysOutDate = canUpdate; + QStandardItem *sysVersionItem = m_resultItems[SysCheckItemID::SystemUpdate]; + sysVersionItem->setData(SysCheckItemID::SystemUpdate, CheckResultModelRole::ID); + sysVersionItem->setData(CheckProgressStatus::Success, + CheckResultModelRole::CheckProgressFlag); + sysVersionItem->setData(m_isSysOutDate, CheckResultModelRole::IsIssueHappen); + sysVersionItem->setData(m_isSysOutDate, CheckResultModelRole::Details); + + startTrashExam(); +} + +// 开始垃圾清理检测 +void SystemCheckModel::startTrashExam() +{ + if (m_processingIndex != SysCheckItemID::SystemUpdate) { + return; + } + m_processingIndex = SysCheckItemID::Trash; + Q_EMIT stageChanged(SysCheckItemID::Trash); + + m_totalTrashSize = getTrashCheckCount(); + m_isTrashFiles = m_totalTrashSize >= (100 * MB_COUNT); + QStandardItem *trashItem = m_resultItems[SysCheckItemID::Trash]; + trashItem->setData(SysCheckItemID::Trash, CheckResultModelRole::ID); + trashItem->setData(CheckProgressStatus::Success, CheckResultModelRole::CheckProgressFlag); + trashItem->setData(m_totalTrashSize >= (100 * MB_COUNT), + CheckResultModelRole::IsIssueHappen); + trashItem->setData(m_totalTrashSize, CheckResultModelRole::Details); + + startDiskExam(); +} +// 开始磁盘检测 +void SystemCheckModel::startDiskExam() +{ + if (m_processingIndex != SysCheckItemID::Trash) { + return; + } + + m_processingIndex = SysCheckItemID::Disk; + Q_EMIT stageChanged(SysCheckItemID::Disk); + + QStandardItem *diskItem = m_resultItems[SysCheckItemID::Disk]; + diskItem->setData(SysCheckItemID::Disk, CheckResultModelRole::ID); + if (m_diskCheckModel->isDiskManagerInterValid()) { + m_isDiskNormal = m_diskCheckModel->getDiskStatus(); + diskItem->setData(CheckProgressStatus::Success, CheckResultModelRole::CheckProgressFlag); + diskItem->setData(m_isDiskNormal != true, CheckResultModelRole::IsIssueHappen); + diskItem->setData(m_isDiskNormal, CheckResultModelRole::Details); + diskItem->setData(false, CheckResultModelRole::IsIgnored); + } else { + diskItem->setData(CheckProgressStatus::Masked, CheckResultModelRole::CheckProgressFlag); + } + + startDevModeExam(); +} +// 开始开发者模式检测 +void SystemCheckModel::startDevModeExam() +{ + if (m_processingIndex != SysCheckItemID::Disk) { + return; + } + + m_processingIndex = SysCheckItemID::DevMode; + Q_EMIT stageChanged(SysCheckItemID::DevMode); + + m_isDevMode = IsDeveloperMode(); + + QStandardItem *devItem = m_resultItems[SysCheckItemID::DevMode]; + devItem->setData(SysCheckItemID::DevMode, CheckResultModelRole::ID); + devItem->setData(CheckProgressStatus::Success, CheckResultModelRole::CheckProgressFlag); + devItem->setData(m_isDevMode, CheckResultModelRole::IsIssueHappen); + devItem->setData(m_isDevMode, CheckResultModelRole::Details); + devItem->setData(ignoreDevModeChecking(), CheckResultModelRole::IsIgnored); + m_processingIndex = SysCheckItemID::DevMode; + + onCheckDone(); +} +// 取消体检 +void SystemCheckModel::onCheckCanceled() +{ + m_processingIndex = SysCheckItemID::MaxLimit; +} +void SystemCheckModel::onCheckDone() +{ + // 统计分数 + updateIssuePoint(); + // 记录检查完成时间 + setLastCheckTime(QDateTime::currentDateTime()); + Q_EMIT checkFinished(); +} + +void SystemCheckModel::resetResultItems() +{ + qDeleteAll(m_resultItems); + m_resultItems.clear(); + for (int i = SysCheckItemID::AutoStartApp; i <= SysCheckItemID::DevMode; i++) { + m_resultItems.push_back(new QStandardItem); + } +} + +const QStandardItemModel &SystemCheckModel::getResultModel() +{ + m_resultModel.clear(); + m_resultModel.appendRow(m_resultItems); + return m_resultModel; +} + +// 更新检查结果 +void SystemCheckModel::updateIssuePoint() +{ + m_issuePoint = 0; + m_issueCount = 0; + + // autostart + + if (!ignoreAutoStartChecking()) { + m_issuePoint += m_autoStartCount ? kIssuePointInfoList[SysCheckItemID::AutoStartApp] : 0; + m_issueCount += m_autoStartCount ? 1 : 0; + if (m_autoStartCount) { + if (!m_logProblemItemsInfo.isEmpty()) { + m_logProblemItemsInfo.append(SEPERATOR); + } + m_logProblemItemsInfo.append(tr("Startup programs")); + } + } + + // sys update + m_issuePoint += m_isSysOutDate ? kIssuePointInfoList[SysCheckItemID::SystemUpdate] : 0; + m_issueCount += m_isSysOutDate ? 1 : 0; + if (m_isSysOutDate) { + if (!m_logProblemItemsInfo.isEmpty()) { + m_logProblemItemsInfo.append(SEPERATOR); + } + m_logProblemItemsInfo.append(tr("System version")); + } + + // trash + m_issuePoint += + m_totalTrashSize >= (100 * MB_COUNT) ? kIssuePointInfoList[SysCheckItemID::Trash] : 0; + m_issueCount += m_totalTrashSize >= (100 * MB_COUNT) ? 1 : 0; + // trash总量大于1G时,有修正值 + m_issuePoint += m_totalTrashSize > (1 * GB_COUNT) ? kTrashSizeTooLargeAdjustPoint : 0; + if (m_totalTrashSize >= (100 * MB_COUNT)) { + if (!m_logProblemItemsInfo.isEmpty()) { + m_logProblemItemsInfo.append(SEPERATOR); + } + m_logProblemItemsInfo.append(tr("System cleanup")); + } + + // disk + m_issuePoint += !m_isDiskNormal ? kIssuePointInfoList[SysCheckItemID::Disk] : 0; + m_issueCount += !m_isDiskNormal ? 1 : 0; + if (!m_isDiskNormal) { + if (!m_logProblemItemsInfo.isEmpty()) { + m_logProblemItemsInfo.append(SEPERATOR); + } + m_logProblemItemsInfo.append(tr("Disk checking")); + } + + // devmod + if (!ignoreDevModeChecking()) { + m_issuePoint += m_isDevMode ? kIssuePointInfoList[SysCheckItemID::DevMode] : 0; + m_issueCount += m_isDevMode ? 1 : 0; + if (m_isDevMode) { + if (!m_logProblemItemsInfo.isEmpty()) { + m_logProblemItemsInfo.append(SEPERATOR); + } + m_logProblemItemsInfo.append(tr("Developer mode")); + } + } + + setSafetyScore(100 > m_issuePoint ? 100 - m_issuePoint : 0); +} + +// 是否处于开发者模式 +bool SystemCheckModel::IsDeveloperMode() +{ + QDBusMessage msg = DBUS_BLOCK_INVOKE(m_helperInvokerInter, "IsDeveloperMode"); + GET_MESSAGE_VALUE(bool, rst, msg); + qInfo() << "[HomePageModel] [IsDeveloperMode] " << rst; + + return rst; +} + +double SystemCheckModel::getTrashCheckCount() +{ + QDBusMessage msg; + msg = DBUS_BLOCK_INVOKE(m_sysetemDaemonInvokerInter, "GetTrashFileCount", QDir::homePath()); + GET_MESSAGE_VALUE(double, trashFileCount, msg); + msg = DBUS_BLOCK_INVOKE(m_sysetemDaemonInvokerInter, "GetCacheFileCount"); + GET_MESSAGE_VALUE(double, cacheFileCount, msg); + msg = DBUS_BLOCK_INVOKE(m_sysetemDaemonInvokerInter, "GetLogFileCount"); + GET_MESSAGE_VALUE(double, logFileCount, msg); + msg = DBUS_BLOCK_INVOKE(m_sysetemDaemonInvokerInter, "GetHistoryFileCount", QDir::homePath()); + GET_MESSAGE_VALUE(double, historyFileCount, msg); + + return trashFileCount + cacheFileCount + logFileCount + historyFileCount; +} + +void SystemCheckModel::requestFixItem(SysCheckItemID itemId) +{ + switch (itemId) { + case SysCheckItemID::AutoStartApp: + fixAutoStart(); + break; + case SysCheckItemID::SystemUpdate: + fixSysUpdate(); + break; + case SysCheckItemID::Trash: + fixTrash(); + break; + case SysCheckItemID::Disk: + fixDisk(); + break; + default: + break; + } +} + +void SystemCheckModel::fixAutoStart() +{ + // 跳转到自启动界面 +} + +void SystemCheckModel::fixSysUpdate() +{ + DBUS_NOBLOCK_INVOKE(m_controlCenterInvokerInter, "Show"); + DBUS_NOBLOCK_INVOKE(m_controlCenterInvokerInter, "ShowPage", "update", ""); +} + +void SystemCheckModel::fixTrash() +{ + QStringList itemList; + itemList.append(TRASH_CLEAN_ITEM_TYPE_CACHE); + itemList.append(TRASH_CLEAN_ITEM_TYPE_LOG); + itemList.append(TRASH_CLEAN_ITEM_TYPE_HISTORY); + // 清理系统垃圾文件 + DTrashManager::instance()->cleanTrash(); + DBUS_NOBLOCK_INVOKE(m_sysetemDaemonInvokerInter, "CleanTrashFiles", itemList); + + m_totalTrashSize = 0.0; + m_isTrashFiles = false; + m_resultItems[SysCheckItemID::Trash]->setData(false, CheckResultModelRole::IsIssueHappen); + m_resultItems[SysCheckItemID::Trash]->setData(m_totalTrashSize, + CheckResultModelRole::Details); + m_fixingItems.removeAll(SysCheckItemID::Trash); + Q_EMIT sendFixItemFinished(SysCheckItemID::Trash); +} + +void SystemCheckModel::fixDisk() +{ + QProcess::startDetached("deepin-diskmanager", {}); +} + +void SystemCheckModel::setItemIgnore(SysCheckItemID id, bool status) +{ + if (SysCheckItemID::AutoStartApp == id) { + setIgnoreAutoStartChecking(status); + } + if (SysCheckItemID::DevMode == id) { + setIgnoreDevModeChecking(status); + } +} diff --git a/deepin-pc-manager/src/window/modules/systemcheck/systemcheckmodel.h b/deepin-pc-manager/src/window/modules/systemcheck/systemcheckmodel.h new file mode 100644 index 0000000..55e4817 --- /dev/null +++ b/deepin-pc-manager/src/window/modules/systemcheck/systemcheckmodel.h @@ -0,0 +1,130 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "window/common/common.h" +#include "autostartcheck/autostartcheckmodel.h" +#include "systemupdatecheck/sysupdatermodel.h" +#include "diskcheck/diskcheckmodel.h" + +#include +#include + +#include +#include +#include + +#define SEPERATOR ", " +#define MB_COUNT (1 << 20) +#define GB_COUNT (1 << 30) +// 垃圾清理总量大于1G时,额外扣分 +const int kTrashSizeTooLargeAdjustPoint = 5; +// 检查项异常扣分规则 +const QList kIssuePointInfoList { + 5, // autostart + 5, // system update + 5, // trash + 15, // disk + 5}; // dev mode + +DCORE_USE_NAMESPACE +class DBusInvokerInterface; +class SystemCheckModel : public QObject +{ + Q_OBJECT +public: + explicit SystemCheckModel(QObject *parent = nullptr); + ~SystemCheckModel(); + + inline int getIssueCount() { return m_issueCount; } + + inline int getIssuePoint() + { + return 100 > m_issuePoint ? 100 - m_issuePoint : 0; + } + + inline bool isTrashFile() { return m_isTrashFiles; } + + // 设置上次体检分数 + void setSafetyScore(int score); + // 获取上次体检分数 + int getSafetyScore(); + // 设置上次体检时间 + void setLastCheckTime(QDateTime dateTime); + // 获取上次体检时间 + QDateTime getLastCheckTime(); + // 获取是否忽略开发者模式 + bool ignoreDevModeChecking() const; + // 设置是否忽略检测开发者模式 + void setIgnoreDevModeChecking(bool ignore); + // 获取是否忽略自启动项 + bool ignoreAutoStartChecking() const; + // 设置是否忽略检测自启动项 + void setIgnoreAutoStartChecking(bool ignore); + + // 是否处于开发者模式 + bool IsDeveloperMode(); + + void startExam(); + void startAutoStartExam(); + void startSysVersionExam(); + void startTrashExam(); + void startDiskExam(); + void startDevModeExam(); + void onCheckCanceled(); + void onCheckDone(); + void resetResultItems(); + void requestFixItem(SysCheckItemID); + void setItemIgnore(SysCheckItemID, bool); + + const QStandardItemModel &getResultModel(); + +private: + // 初始化数据 + void initData(); + void updateIssuePoint(); + double getTrashCheckCount(); + + void fixAutoStart(); + void fixSysUpdate(); + void fixTrash(); + void fixDisk(); + +public Q_SLOTS: + // 检查系统更新完成 + void checkSysUpdateFinished(bool canUpdate); + +Q_SIGNALS: + void stageChanged(SysCheckItemID); + void checkFinished(); + + void sendFixItemFinished(SysCheckItemID id); + +private: + DConfig *m_dconfig; + AutoStartCheckModel *m_autoStartCheckModel; + SysUpdaterModel *m_sysUpdateModel; + DiskCheckModel *m_diskCheckModel; + + DBusInvokerInterface *m_helperInvokerInter; // 同步助手dbus服务,用于查询是否处于开发者模式 + DBusInvokerInterface *m_controlCenterInvokerInter; // 控制中心dbus服务 + DBusInvokerInterface *m_sysetemDaemonInvokerInter; + + int m_processingIndex; + int m_issuePoint; // 检查项累积扣分 + int m_issueCount; + int m_virusCount; + bool m_isAVOutDate; + int m_autoStartCount; + bool m_isDevMode; + bool m_isDiskNormal; + bool m_isSysOutDate; + double m_totalTrashSize; + bool m_isTrashFiles; + QString m_logProblemItemsInfo; + QList m_fixingItems; + QList m_resultItems; + QStandardItemModel m_resultModel; +}; diff --git a/deepin-pc-manager/src/window/modules/systemcheck/systemcheckmodule.cpp b/deepin-pc-manager/src/window/modules/systemcheck/systemcheckmodule.cpp new file mode 100644 index 0000000..05c612e --- /dev/null +++ b/deepin-pc-manager/src/window/modules/systemcheck/systemcheckmodule.cpp @@ -0,0 +1,55 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "systemcheckmodule.h" +#include "systemcheckmodel.h" +#include "systemcheckwidget.h" +#include "window/common/common.h" + +SystemCheckModule::SystemCheckModule(FrameProxyInterface *frame, QObject *parent) + : QObject(parent) + , ModuleInterface(frame) + , m_systemCheckModel(nullptr) + , m_systemCheckWidget(nullptr) +{ +} + +SystemCheckModule::~SystemCheckModule() +{ +} + +// 初始化 +void SystemCheckModule::initialize() +{ +} + +// 预初始化 +void SystemCheckModule::preInitialize() +{ + m_systemCheckModel = new SystemCheckModel(this); +} + +// 模块名称 +const QString SystemCheckModule::name() const +{ + return MODULE_SYSTEM_CHECK_NAME; +} + +// 激活 +void SystemCheckModule::active(int index) +{ + Q_UNUSED(index); + + if (!m_systemCheckWidget) { + m_systemCheckWidget = new SystemCheckWidget(m_systemCheckModel); + } + m_systemCheckWidget->show(); + m_frameProxy->pushWidget(this, m_systemCheckWidget); +} + +// 反激活 +void SystemCheckModule::deactive() +{ + m_systemCheckWidget->hide(); +} diff --git a/deepin-pc-manager/src/window/modules/systemcheck/systemcheckmodule.h b/deepin-pc-manager/src/window/modules/systemcheck/systemcheckmodule.h new file mode 100644 index 0000000..0dc0cfa --- /dev/null +++ b/deepin-pc-manager/src/window/modules/systemcheck/systemcheckmodule.h @@ -0,0 +1,38 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "window/interface/frameproxyinterface.h" +#include "window/interface/moduleinterface.h" + +class FrameProxyInterface; +class ModuleInterface; +class SystemCheckModel; +class SystemCheckWidget; + +class SystemCheckModule : public QObject + , public ModuleInterface +{ + Q_OBJECT +public: + explicit SystemCheckModule(FrameProxyInterface *frame, QObject *parent = nullptr); + ~SystemCheckModule() override; + +public: + // 初始化 + void initialize() override; + // 预初始化 + void preInitialize() override; + // 模块名称 + const QString name() const override; + // 激活 + void active(int index) override; + // 反激活 + void deactive() override; + +private: + SystemCheckModel *m_systemCheckModel; + SystemCheckWidget *m_systemCheckWidget; +}; diff --git a/deepin-pc-manager/src/window/modules/systemcheck/systemcheckwidget.cpp b/deepin-pc-manager/src/window/modules/systemcheck/systemcheckwidget.cpp new file mode 100644 index 0000000..a06edac --- /dev/null +++ b/deepin-pc-manager/src/window/modules/systemcheck/systemcheckwidget.cpp @@ -0,0 +1,497 @@ +// Copyright (C) 2020 ~ 2020 Deepin Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "systemcheckwidget.h" +#include "systemcheckmodel.h" + +#include + +#define FIXED_COL(column, weight) \ + { \ + mainLayout->setColumnStretch(column, weight); \ + mainLayout->setColumnMinimumWidth(column, weight); \ + } + +#define FIXED_ROW(row, height) \ + { \ + mainLayout->setRowStretch(row, height); \ + mainLayout->setRowMinimumHeight(row, height); \ + } + +#define RICH_TEXT_COLOR_FORMAT "%2" +const QString k90_100Color = "#00C134"; +const QString k75_90Color = "#8CD400"; +const QString k60_75Color = "#FF5C00"; +const QString k0_60Color = "#D80000"; +const QString kOutOfDate = "#FF5C00"; + +SystemCheckWidget::SystemCheckWidget(SystemCheckModel *model, DWidget *parent) + : DWidget(parent) + , m_model(model) + , m_systemCheckHomePageWidget(nullptr) + , m_systemCheckProgressWidget(nullptr) + , m_systemCheckResultWidget(nullptr) +{ + // 初始化UI + initUI(); + + // 正在检测定时器 + m_timer = new QTimer(this); + connect(m_timer, &QTimer::timeout, this, &SystemCheckWidget::updateCheckingUI); + m_timer->start(1000); +} + +SystemCheckWidget::~SystemCheckWidget() +{ +} + +// 初始化界面 +void SystemCheckWidget::initUI() +{ + // 主布局 + QHBoxLayout *mainLayout = new QHBoxLayout(this); + mainLayout->setContentsMargins(0, 0, 0, 0); + mainLayout->setSpacing(0); + + // 加载系统体检首页 + mainLayout->addWidget(getSystemCheckHomePage()); + // 加载系统体检检测界面 + mainLayout->addWidget(getSystemCheckProgressPage()); + // 加载系统体检结果页 + mainLayout->addWidget(getSystemCheckResultPage()); + + // 初始化 + m_systemCheckHomePageWidget->setVisible(true); + m_systemCheckProgressWidget->setVisible(false); + m_systemCheckResultWidget->setVisible(false); + + // 更新界面 + updateUI(); + + // 连接信号 + connect(m_examBtn, &DSuggestButton::clicked, this, &SystemCheckWidget::showSystemCheckProgressPage); + connect(m_cancelButton, &DPushButton::clicked, this, &SystemCheckWidget::showSystemCheckHomePage); + connect(m_doneButton, &QPushButton::clicked, this, &SystemCheckWidget::requestCheckDone); + connect(m_fixAllButton, &QPushButton::clicked, this, &SystemCheckWidget::requestFixAll); + connect(m_recheckButton, &QPushButton::clicked, this, &SystemCheckWidget::requestCheckAgain); + + connect(m_model, &SystemCheckModel::checkFinished, this, &SystemCheckWidget::showSystemCheckResultPage); + connect(m_model, &SystemCheckModel::stageChanged, this, &SystemCheckWidget::onCheckMissionStarted); + connect(m_model, &SystemCheckModel::sendFixItemFinished, this, &SystemCheckWidget::onFixItemFinished); +} + +// 系统体检首页界面 +QWidget *SystemCheckWidget::getSystemCheckHomePage() +{ + m_systemCheckHomePageWidget = new QWidget(this); + + QVBoxLayout *mainLayout = new QVBoxLayout(m_systemCheckHomePageWidget); + mainLayout->setSpacing(0); + mainLayout->setContentsMargins(0, 0, 0, 0); + mainLayout->setAlignment(Qt::AlignHCenter); + m_systemCheckHomePageWidget->setLayout(mainLayout); + + // 首页展现的图片 + m_scorePic = new QLabel(this); + // 水平居中对齐 + m_scorePic->setAlignment(Qt::AlignCenter); + m_scorePic->setFixedHeight(320); + m_scorePic->setPixmap(QIcon::fromTheme(SYSTEM_CHECK_HOME_PAGE_LOGO).pixmap(320, 320)); + mainLayout->addSpacing(20); + mainLayout->addWidget(m_scorePic, 0, Qt::AlignHCenter); + + // 分数提示项 + m_lbScoreTip = new DLabel(this); + m_lbScoreTip->setFixedHeight(24); + m_lbScoreTip->setAlignment(Qt::AlignBottom | Qt::AlignHCenter); + m_lbScoreTip->setElideMode(Qt::ElideMiddle); + mainLayout->addSpacing(20); + mainLayout->addWidget(m_lbScoreTip, 0, Qt::AlignHCenter); + + // 欢迎语 + m_greetingInfo = new DLabel(this); + m_greetingInfo->setFixedHeight(44); + m_greetingInfo->setText("########"); + m_greetingInfo->setAlignment(Qt::AlignHCenter); + m_greetingInfo->setElideMode(Qt::ElideMiddle); + // 设置分数提示字体样式 + QFont ft = m_greetingInfo->font(); + ft.setBold(true); + m_greetingInfo->setFont(ft); + mainLayout->addWidget(m_greetingInfo, 0, Qt::AlignHCenter); + + // 体检提示标签 + m_examTip = new DTipLabel("", this); + m_examTip->setFixedHeight(20); + m_examTip->setAlignment(Qt::AlignBottom); + m_examTip->setElideMode(Qt::ElideMiddle); + mainLayout->addSpacing(20); + mainLayout->addWidget(m_examTip, 0, Qt::AlignHCenter); + mainLayout->addSpacing(25); + + // 体检按钮 + m_examBtn = new DSuggestButton(this); + m_examBtn->setFixedSize(170, 36); + mainLayout->addWidget(m_examBtn, 0, Qt::AlignHCenter); + mainLayout->addSpacing(60); + + return m_systemCheckHomePageWidget; +} + +// 系统体检检查界面 +QWidget *SystemCheckWidget::getSystemCheckProgressPage() +{ + m_systemCheckProgressWidget = new QWidget(this); + m_systemCheckProgressWidget->setContentsMargins(0, 10, 0, 10); + + m_movieLable = new DLabel(this); + m_movieLable->setFixedSize(340, 340); + m_movieLable->setAlignment(Qt::AlignCenter); + m_movieLable->setPixmap(QIcon::fromTheme(SYSTEM_CHECK_HOME_PAGE_LOGO).pixmap(320, 320)); + + m_stageLable = new DLabel(this); + m_infoLable = new DLabel(this); + + m_progressBar = new DProgressBar(this); + m_progressBar->setRange(0, 100); + m_progressBar->setValue(50); + m_progressBar->setFixedSize(573, 12); + m_progressBar->setTextVisible(false); + m_cancelButton = new DPushButton(this); + m_cancelButton->setFixedSize(22, 22); + m_cancelButton->setFlat(true); + m_cancelButton->setIcon(QIcon::fromTheme(SYSTEM_CHECK_CANCEL_LOGO)); + m_cancelButton->setIconSize(QSize(22, 22)); + + m_timeLable = new DTipLabel("", this); + m_timeLable->setText(QTime(0, 0, 0, 0).toString("hh:mm:ss")); + + QGridLayout *mainLayout = new QGridLayout(m_systemCheckProgressWidget); + mainLayout->setContentsMargins(0, 0, 0, 0); + m_systemCheckProgressWidget->setLayout(mainLayout); + + FIXED_COL(0, 87); + FIXED_COL(1, 573); + FIXED_COL(2, 0); + FIXED_COL(3, 78); + + FIXED_ROW(0, 340); // logo + mainLayout->addWidget(m_movieLable, 0, 0, 1, -1, Qt::AlignBottom | Qt::AlignHCenter); + FIXED_ROW(1, 24); // stage + mainLayout->addWidget(m_stageLable, 1, 0, 1, -1, Qt::AlignHCenter | Qt::AlignBottom); + FIXED_ROW(2, 54); // info + mainLayout->addWidget(m_infoLable, 2, 0, 1, -1, Qt::AlignHCenter | Qt::AlignBottom); + FIXED_ROW(3, 20); // space + FIXED_ROW(4, 22); // progressbar + mainLayout->addWidget(m_progressBar, 4, 1, 1, 1, Qt::AlignVCenter); + mainLayout->addWidget(m_cancelButton, 4, 3, 1, 1, Qt::AlignVCenter | Qt::AlignLeft); + FIXED_ROW(5, 27); // time + mainLayout->addWidget(m_timeLable, 5, 0, 1, -1, Qt::AlignCenter); + FIXED_ROW(6, 78); // space + + return m_systemCheckProgressWidget; +} + +// 系统体检结果界面 +QWidget *SystemCheckWidget::getSystemCheckResultPage() +{ + m_systemCheckResultWidget = new QWidget(this); + m_systemCheckResultWidget->setContentsMargins(0, 10, 0, 10); + + QGridLayout *mainLayout = new QGridLayout(m_systemCheckResultWidget); + mainLayout->setSpacing(10); + mainLayout->setContentsMargins(0, 0, 0, 0); + m_systemCheckResultWidget->setLayout(mainLayout); + + m_header = new SysCheckResultHeaderWidget(this); + m_fixAllButton = new DSuggestButton(this); + m_fixAllButton->setFocusPolicy(Qt::NoFocus); + m_fixAllButton->setFixedWidth(150); + m_fixAllButton->setText(tr("Fix All")); + + m_doneButton = new DSuggestButton(this); + m_doneButton->setFocusPolicy(Qt::NoFocus); + m_doneButton->setFixedWidth(150); + m_doneButton->setText(tr("Done", "button")); + + m_recheckButton = new DPushButton(this); + m_recheckButton->setFocusPolicy(Qt::NoFocus); + m_recheckButton->setFixedWidth(150); + m_recheckButton->setText(tr("Check Again")); + + createItemWidgets(); + QVBoxLayout *boxLayout = new QVBoxLayout; + boxLayout->setSpacing(4); + + // 调整检查项的显示顺序 + boxLayout->addWidget(m_itemWidgets[SysCheckItemID::AutoStartApp], 0, Qt::AlignTop | Qt::AlignLeft); + boxLayout->addWidget(m_itemWidgets[SysCheckItemID::SystemUpdate], 0, Qt::AlignTop | Qt::AlignLeft); + boxLayout->addWidget(m_itemWidgets[SysCheckItemID::Trash], 0, Qt::AlignTop | Qt::AlignLeft); + boxLayout->addWidget(m_itemWidgets[SysCheckItemID::Disk], 0, Qt::AlignTop | Qt::AlignLeft); + boxLayout->addWidget(m_itemWidgets[SysCheckItemID::DevMode], 0, Qt::AlignTop | Qt::AlignLeft); + + boxLayout->addStretch(10); + + FIXED_ROW(0, 146); + FIXED_ROW(1, 348); + FIXED_ROW(2, 56); + + FIXED_COL(0, 385); + FIXED_COL(1, 385); + + mainLayout->addWidget(m_header, 0, 0, 1, -1, Qt::AlignCenter); + mainLayout->addLayout(boxLayout, 1, 0, 1, -1, Qt::AlignCenter); + mainLayout->addWidget(m_recheckButton, 2, 0, Qt::AlignRight | Qt::AlignVCenter); + mainLayout->addWidget(m_fixAllButton, 2, 1, Qt::AlignLeft | Qt::AlignVCenter); + mainLayout->addWidget(m_doneButton, 2, 1, Qt::AlignLeft | Qt::AlignVCenter); + + return m_systemCheckResultWidget; +} + +// 更新界面 +void SystemCheckWidget::updateUI() +{ + // 根据体检分数,改变显示 + int score = m_model->getSafetyScore(); + // 若分数为“-1”,则表示没有体检过 + if (-1 == score) { + // 分数提示项 + QString coloredTip = tr("Your computer has not been checked yet"); + coloredTip = QString(RICH_TEXT_COLOR_FORMAT).arg(kOutOfDate).arg(coloredTip); + m_lbScoreTip->setText(coloredTip); + m_examTip->setText(tr("Try a full check.")); + m_examBtn->setText(tr("Check Now")); + m_greetingInfo->setText(tr("Your computer has not been checked yet")); + return; + } + // 非常安全分数阶段; + else if (PERFECTLY_SAFE_SCORE_ABOVE <= score) { + // 分数提示项 + m_lbScoreTip->setText(tr("Last Result: %2 points") + .arg(k90_100Color) + .arg(score)); + m_examBtn->setText(tr("Check Now")); + m_greetingInfo->setText(tr("Your computer is healthy")); + m_examTip->setText(tr("Great! Keep staying healthy please.")); + } + // 安全分数阶段 + else if (SAFE_SCORE_ABOVE <= score) { + // 分数提示项 + m_lbScoreTip->setText(tr("Last Result: %2 points") + .arg(k75_90Color) + .arg(score)); + m_examTip->setText(tr("Start a check and perform some improvements.")); + m_examBtn->setText(tr("Check Now")); + m_greetingInfo->setText(tr("Your computer is in good condition")); + } + // 危险分数阶段 + else if (DANGEROUS_SCORE_ABOVE <= score) { + // 分数提示项 + m_lbScoreTip->setText(tr("Last Result: %2 points") + .arg(k60_75Color) + .arg(score)); + m_examTip->setText(tr("Please check your system now.")); + m_examBtn->setText(tr("Check Now")); + + QString coloredGreeting = tr("Your computer is ") + QString(RICH_TEXT_COLOR_FORMAT).arg(k60_75Color).arg(tr("at risk")); + m_greetingInfo->setText(coloredGreeting); + } + // 非常危险分数阶段 + else { + // 分数提示项 + m_lbScoreTip->setText(tr("Last Result: %2 points") + .arg(k0_60Color) + .arg(score)); + m_examTip->setText(tr("It is strongly recommended to check and fix your system now.")); + m_examBtn->setText(tr("Check Now")); + + QString coloredGreeting = tr("Your computer is ") + QString(RICH_TEXT_COLOR_FORMAT).arg(k0_60Color).arg(tr("at high risk")); + m_greetingInfo->setText(coloredGreeting); + } + + //根据上次体检时间,调整体检提示标签文字 + QDateTime lastCheckTime = m_model->getLastCheckTime(); + qint64 days = lastCheckTime.daysTo(QDateTime::currentDateTime()); + if (days > 5) { + QString coloredTip = tr("Checked %1 days ago").arg(int(days)); + coloredTip = QString(RICH_TEXT_COLOR_FORMAT).arg(kOutOfDate).arg(coloredTip); + m_lbScoreTip->setText(coloredTip); + + m_examTip->setText(tr("Have a new check right now.")); + m_greetingInfo->setText(tr("Your computer has not been checked for a long time")); + } +} + +// 显示系统体检检测界面 +void SystemCheckWidget::showSystemCheckProgressPage() +{ + m_systemCheckHomePageWidget->setVisible(false); + m_systemCheckProgressWidget->setVisible(true); + m_systemCheckResultWidget->setVisible(false); + + m_startTime = QTime::currentTime(); + m_progressBar->setValue(0); + m_stageLable->setText(""); + m_timeLable->setText(QTime(0, 0, 0, 0).toString("hh:mm:ss")); + m_infoLable->setText(tr("Checking")); + + m_timer->start(); + m_progressValue = 0; + + // 开始体检 + m_model->startExam(); +} + +// 显示系统体检首页界面 +void SystemCheckWidget::showSystemCheckHomePage() +{ + if (m_timer->isActive()) { + m_timer->stop(); + } + m_systemCheckHomePageWidget->setVisible(true); + m_systemCheckProgressWidget->setVisible(false); + m_systemCheckResultWidget->setVisible(false); +} + +void SystemCheckWidget::showSystemCheckResultPage() +{ + if (m_timer->isActive()) { + m_timer->stop(); + } + m_systemCheckHomePageWidget->setVisible(false); + m_systemCheckProgressWidget->setVisible(false); + m_systemCheckResultWidget->setVisible(true); + + setResultModel(m_model->getResultModel()); + setHeaderContent(m_model->getIssuePoint(), m_model->getIssueCount()); + if (m_model->isTrashFile()) { + m_fixAllButton->show(); + m_doneButton->hide(); + } else { + m_fixAllButton->hide(); + m_doneButton->show(); + } +} + +// 定时器更新检测界面 +void SystemCheckWidget::updateCheckingUI() +{ + QTime now = QTime::currentTime(); + QTime info(0, 0, 0, 0); + info = info.addSecs(m_startTime.secsTo(now)); + m_timeLable->setText(info.toString("hh:mm:ss")); + + QString infoText = m_infoLable->text(); + infoText.append("."); + infoText.remove("...."); + m_infoLable->setText(infoText); +} +// 根据检测项更新检测过程 +void SystemCheckWidget::onCheckMissionStarted(SysCheckItemID id) +{ + if (SysCheckItemID::AutoStartApp == id) { + m_stageLable->setText(tr("Checking startup programs")); + } else if (SysCheckItemID::SystemUpdate == id) { + m_stageLable->setText(tr("Checking if your system is up to date")); + } else if (SysCheckItemID::Trash == id) { + m_stageLable->setText(tr("Checking system junk")); + } else if (SysCheckItemID::Disk == id) { + m_stageLable->setText(tr("Checking disks")); + } else if (SysCheckItemID::DevMode == id) { + m_stageLable->setText(tr("Checking if the developer mode is enabled")); + } else if (SysCheckItemID::MaxLimit == id) { + m_stageLable->setText(tr("Checking startup programs")); + } + m_progressBar->setValue(m_progressValue); + m_progressValue += 100 / (int(SysCheckItemID::MaxLimit) - 2); +} + +void SystemCheckWidget::createItemWidgets() +{ + QStringList accNames = {"antiVirusCheckItem", "avDatabaseCheckItem", "sshCheckItem", "diskCheckItem", + "trashCheckItem", "sysUpdateCheckItem", "devModeCheckItem", "autoStartCheckItem"}; + m_itemWidgets.clear(); + for (int id = SysCheckItemID::AutoStartApp; id <= SysCheckItemID::DevMode; id++) { + SysCheckResultItemWidget *item = new SysCheckResultItemWidget(SysCheckItemID(id), this); + + item->setAccessibleName(accNames[id]); + + connect(item, &SysCheckResultItemWidget::requestFixItem, this, &SystemCheckWidget::requestFixItem); + connect(item, &SysCheckResultItemWidget::requestSetIgnore, this, &SystemCheckWidget::requestSetIgnore); + connect(this, &SystemCheckWidget::onFixItemFinished, item, &SysCheckResultItemWidget::onNotifyFixFinished); + // connect(item, &SysCheckResultItemWidget::widgetHidden, this, &SysCheckResultWidget::resetItemsBackGround); + + // connect(this, &SysCheckResultWidget::onFixItemStarted, item, &SysCheckResultItemWidget::onNotifyFixStarted); + // connect(this, &SysCheckResultWidget::autoStartAppCountChanged, item, &SysCheckResultItemWidget::onAutoStartAppCountChanged); + + m_itemWidgets.push_back(item); + } + + resetItemsBackGround(); +} + +void SystemCheckWidget::setResultModel(const QStandardItemModel &result) +{ + // 对各项设置结果 + for (auto wid : m_itemWidgets) { + wid->setResult(result); + } + resetItemsBackGround(); +} + +void SystemCheckWidget::setHeaderContent(int point, int issueCount) +{ + m_header->onPointChanged(point, issueCount); +} + +void SystemCheckWidget::resetItemsBackGround() +{ + bool isNeedColored = false; + for (int index = 0; index < m_itemWidgets.size(); index++) { + auto wid = m_itemWidgets[index]; + if (!wid->isHidden()) { + DPalette::ColorType role = isNeedColored ? DPalette::ItemBackground : DPalette::NoType; + wid->setBackgroundRole(role); + isNeedColored = !isNeedColored; + } + } +} + +void SystemCheckWidget::requestFixItem(SysCheckItemID id) +{ + m_model->requestFixItem(id); + if (SysCheckItemID::Trash == id) { + if (m_model->isTrashFile()) { + m_fixAllButton->show(); + m_doneButton->hide(); + } else { + m_fixAllButton->hide(); + m_doneButton->show(); + } + } +} + +void SystemCheckWidget::requestSetIgnore(SysCheckItemID id, bool status) +{ + m_model->setItemIgnore(id, status); +} + +void SystemCheckWidget::requestFixAll() +{ + requestFixItem(SysCheckItemID::Trash); +} +void SystemCheckWidget::requestCheckDone() +{ + m_systemCheckHomePageWidget->setVisible(true); + m_systemCheckProgressWidget->setVisible(false); + m_systemCheckResultWidget->setVisible(false); + + updateUI(); +} + +void SystemCheckWidget::requestCheckAgain() +{ + showSystemCheckProgressPage(); +} diff --git a/deepin-pc-manager/src/window/modules/homepagecheck/homepage.h b/deepin-pc-manager/src/window/modules/systemcheck/systemcheckwidget.h similarity index 58% rename from deepin-pc-manager/src/window/modules/homepagecheck/homepage.h rename to deepin-pc-manager/src/window/modules/systemcheck/systemcheckwidget.h index abeb332..6777ab1 100644 --- a/deepin-pc-manager/src/window/modules/homepagecheck/homepage.h +++ b/deepin-pc-manager/src/window/modules/systemcheck/systemcheckwidget.h @@ -1,34 +1,25 @@ -// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later #pragma once -#include "dtkwidget_global.h" -#include "homepagemodel.h" -#include "window/namespace.h" +#include "window/common/common.h" +#include "syscheckresultheaderwidget.h" +#include "syscheckresultitemwidget.h" +#include +#include +#include #include -#include +#include #include +#include +#include -#include -#include - -DWIDGET_BEGIN_NAMESPACE -class DSuggestButton; -class DLabel; -DWIDGET_END_NAMESPACE - -QT_BEGIN_NAMESPACE -class QHBoxLayout; -class QLabel; -class QPushButton; -QT_END_NAMESPACE - -DWIDGET_USE_NAMESPACE -DCORE_USE_NAMESPACE +#include +#include +#include //// 安全级别界限分数 // 非常安全分数界限 @@ -85,40 +76,75 @@ DCORE_USE_NAMESPACE #define SCORE_DISCK_CHECK_ABNORMAL 15 // 磁盘检测异常扣除的分数 #define SCORE_ROOT_MODEL_ABNORMAL 5 // 处于开发者模式扣除的分数 -class HomePage : public QWidget +class SystemCheckModel; +DWIDGET_USE_NAMESPACE +class SystemCheckWidget : public QWidget { Q_OBJECT public: - explicit HomePage(HomePageModel *mode, QWidget *parent = nullptr); - ~HomePage(); - // 设置数据处理对象 - void setModel(HomePageModel *mode); + explicit SystemCheckWidget(SystemCheckModel *model, DWidget *parent = nullptr); + ~SystemCheckWidget(); + +private: + // 初始化界面 + void initUI(); // 更新界面 void updateUI(); -private: -Q_SIGNALS: - // 通知打开体检页 - void notifyShowCheckPage(); + // 系统体检首页界面 + QWidget *getSystemCheckHomePage(); + // 系统体检检查界面 + QWidget *getSystemCheckProgressPage(); + // 系统体检结果界面 + QWidget *getSystemCheckResultPage(); + + void createItemWidgets(); + void setResultModel(const QStandardItemModel &); + void setHeaderContent(int point, int issueCount); + void resetItemsBackGround(); public Q_SLOTS: + void showSystemCheckProgressPage(); + void showSystemCheckHomePage(); + void showSystemCheckResultPage(); + + void updateCheckingUI(); + void onCheckMissionStarted(SysCheckItemID); + void requestFixItem(SysCheckItemID id); + void requestSetIgnore(SysCheckItemID, bool); + void requestFixAll(); + void requestCheckDone(); + void requestCheckAgain(); - // 随主题类型改变首页图片 - void changePicWithTheme(DGuiApplicationHelper::ColorType themeType); +Q_SIGNALS: + void onFixItemFinished(SysCheckItemID id); private: - // 首页体检数据处理类 - HomePageModel *m_mode; - // 应用界面工具对象,方便使用系统主题相关方法 - DGuiApplicationHelper *m_guiHelper; - // 体检图片 + SystemCheckModel *m_model; + QTimer *m_timer; + QTime m_startTime; + int m_progressValue; + + QWidget *m_systemCheckHomePageWidget; QLabel *m_scorePic; - // 分数提示项 DLabel *m_lbScoreTip; - // 欢迎语 DLabel *m_greetingInfo; - // 体检提示 DTipLabel *m_examTip; - // 体检按钮 DSuggestButton *m_examBtn; + + QWidget *m_systemCheckProgressWidget; + DLabel *m_movieLable; + DLabel *m_stageLable; + DLabel *m_infoLable; + DProgressBar *m_progressBar; + DTipLabel *m_timeLable; + DPushButton *m_cancelButton; + + QWidget *m_systemCheckResultWidget; + SysCheckResultHeaderWidget *m_header; + DSuggestButton *m_fixAllButton; + DSuggestButton *m_doneButton; + DPushButton *m_recheckButton; + QList m_itemWidgets; + QList m_currentFixingItems; }; diff --git a/deepin-pc-manager/src/window/modules/homepagecheck/sysupdatermodel.cpp b/deepin-pc-manager/src/window/modules/systemcheck/systemupdatecheck/sysupdatermodel.cpp similarity index 74% rename from deepin-pc-manager/src/window/modules/homepagecheck/sysupdatermodel.cpp rename to deepin-pc-manager/src/window/modules/systemcheck/systemupdatecheck/sysupdatermodel.cpp index eb21482..8d86706 100644 --- a/deepin-pc-manager/src/window/modules/homepagecheck/sysupdatermodel.cpp +++ b/deepin-pc-manager/src/window/modules/systemcheck/systemupdatecheck/sysupdatermodel.cpp @@ -1,11 +1,10 @@ -// Copyright (C) 2019 ~ 2020 Deepin Technology Co., Ltd. // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later #include "sysupdatermodel.h" - -#include "src/window/modules/common/invokers/invokerfactory.h" +#include "window/common/invokers/invokerfactory.h" +#include "window/common/common.h" #include #include @@ -18,19 +17,15 @@ SysUpdaterModel::SysUpdaterModel(QObject *parent) , m_checkUpdateJobTimer(nullptr) { // 系统更新管理器dbus服务 - m_managerInvokerInter = - InvokerFactory::GetInstance().CreateInvoker("org.deepin.lastore1", - "/org/deepin/lastore1", - "org.deepin.lastore1.Manager", - ConnectType::SYSTEM, - this); + m_managerInvokerInter = InvokerFactory::GetInstance().CreateInvoker("com.deepin.lastore", + "/com/deepin/lastore", + "com.deepin.lastore.Manager", + ConnectType::SYSTEM, this); // 系统更新dbus服务 - m_updaterInvokerInter = - InvokerFactory::GetInstance().CreateInvoker("org.deepin.lastore1", - "/org/deepin/lastore1", - "org.deepin.lastore1.Updater", - ConnectType::SYSTEM, - this); + m_updaterInvokerInter = InvokerFactory::GetInstance().CreateInvoker("com.deepin.lastore", + "/com/deepin/lastore", + "com.deepin.lastore.Updater", + ConnectType::SYSTEM, this); m_checkUpdateJobTimer = new QTimer(this); m_checkUpdateJobTimer->setInterval(500); @@ -57,10 +52,12 @@ SysUpdaterModel::SysUpdaterModel(QObject *parent) }); } -SysUpdaterModel::~SysUpdaterModel() { } +SysUpdaterModel::~SysUpdaterModel() +{ +} // 检查是否有更新 -void SysUpdaterModel::CheckForUpdates() +void SysUpdaterModel::checkForUpdates() { // 如果任务正在进行,则不继续创建任务 if (m_checkUpdateJobInvokerInter) { @@ -72,7 +69,7 @@ void SysUpdaterModel::CheckForUpdates() QDBusMessage msg = DBUS_BLOCK_INVOKE(m_managerInvokerInter, "UpdateSource"); if (QDBusMessage::MessageType::ErrorMessage == msg.type()) { // 发送没有系统更新信号 - Q_EMIT this->SendHaveUpdates(false); + Q_EMIT this->sendHaveUpdates(false); stopCheckingSysVer(); qCritical() << "[SysUpdaterModel] [CheckForUpdates] UpdateSource error " << msg.errorMessage(); @@ -83,18 +80,16 @@ void SysUpdaterModel::CheckForUpdates() QDBusObjectPath jobPath = args.takeFirst().value(); const QString jobPathStr = jobPath.path(); // 设置检查系统更新任务 - SetCheckUpdatesJob(jobPathStr); + setCheckUpdatesJob(jobPathStr); } // 设置检查系统更新任务 -void SysUpdaterModel::SetCheckUpdatesJob(const QString &jobPath) +void SysUpdaterModel::setCheckUpdatesJob(const QString &jobPath) { - m_checkUpdateJobInvokerInter = - InvokerFactory::GetInstance().CreateInvoker("org.deepin.lastore1", - jobPath, - "org.deepin.lastore1.Job", - ConnectType::SYSTEM, - this); + m_checkUpdateJobInvokerInter = InvokerFactory::GetInstance().CreateInvoker("com.deepin.lastore", + jobPath, + "com.deepin.lastore.Job", + ConnectType::SYSTEM, this); m_checkUpdateJobTimer->start(); } @@ -121,7 +116,7 @@ void SysUpdaterModel::onCheckJobStatusChanged(const QString &status) qInfo() << "[SysUpdaterModel] [onCheckJobStatusChanged] status " << status; if (status == "failed") { stopCheckingSysVer(); - Q_EMIT SendHaveUpdates(false); + Q_EMIT sendHaveUpdates(false); } else if (status == "end" || status.isEmpty()) { stopCheckingSysVer(); @@ -155,7 +150,7 @@ void SysUpdaterModel::onCheckJobStatusChanged(const QString &status) } else { // 获取失败 // 发送没有系统更新信号 - Q_EMIT this->SendHaveUpdates(false); + Q_EMIT this->sendHaveUpdates(false); qCritical() << "[MainWindow] [onCheckJobStatusChanged] UpdateFailed, check for updates " "error: = " << msg; @@ -164,9 +159,9 @@ void SysUpdaterModel::onCheckJobStatusChanged(const QString &status) if (0 < (updatableAppsCount + updatablePackagesCount)) { // 有更新 - Q_EMIT this->SendHaveUpdates(true); + Q_EMIT this->sendHaveUpdates(true); } else { - Q_EMIT this->SendHaveUpdates(false); + Q_EMIT this->sendHaveUpdates(false); } } } diff --git a/deepin-pc-manager/src/window/modules/homepagecheck/sysupdatermodel.h b/deepin-pc-manager/src/window/modules/systemcheck/systemupdatecheck/sysupdatermodel.h similarity index 73% rename from deepin-pc-manager/src/window/modules/homepagecheck/sysupdatermodel.h rename to deepin-pc-manager/src/window/modules/systemcheck/systemupdatecheck/sysupdatermodel.h index cd3221c..c1ffc9e 100644 --- a/deepin-pc-manager/src/window/modules/homepagecheck/sysupdatermodel.h +++ b/deepin-pc-manager/src/window/modules/systemcheck/systemupdatecheck/sysupdatermodel.h @@ -1,19 +1,14 @@ -// Copyright (C) 2019 ~ 2020 Deepin Technology Co., Ltd. // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later #pragma once -#include "src/window/modules/common/common.h" -#include "window/namespace.h" - -#include +#include +#include class DBusInvokerInterface; -DEF_NAMESPACE_BEGIN - class SysUpdaterModel : public QObject { Q_OBJECT @@ -22,15 +17,15 @@ class SysUpdaterModel : public QObject ~SysUpdaterModel(); // 检查是否有更新 - void CheckForUpdates(); + void checkForUpdates(); Q_SIGNALS: // 发送是否存在系统更新结果 - void SendHaveUpdates(bool have); + void sendHaveUpdates(bool have); public Q_SLOTS: // 设置检查系统更新任务 - void SetCheckUpdatesJob(const QString &jobPath); + void setCheckUpdatesJob(const QString &jobPath); // 停止检查系统版本 void stopCheckingSysVer(); // 检查更新任务状态 @@ -45,5 +40,3 @@ public Q_SLOTS: DBusInvokerInterface *m_checkUpdateJobInvokerInter; QTimer *m_checkUpdateJobTimer; }; - -DEF_NAMESPACE_END diff --git a/deepin-pc-manager/src/window/modules/toolbox/toolboxdialog.cpp b/deepin-pc-manager/src/window/modules/toolbox/toolboxdialog.cpp new file mode 100644 index 0000000..bbf1a74 --- /dev/null +++ b/deepin-pc-manager/src/window/modules/toolbox/toolboxdialog.cpp @@ -0,0 +1,70 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "toolboxdialog.h" + +#include + +using namespace PCC_NAMESPACE; +ToolBoxDialog::ToolBoxDialog(QWidget *parent) + : DFrame(parent) + , m_mainlayout(nullptr) + , m_blurEffect(nullptr) + , m_titleBar(nullptr) +{ + // 大小设置 + this->resize(960, 640); + this->setFixedHeight(640); + // 设置为Dialog + setWindowFlags(Qt::Dialog); + // 设置为阻态 + setWindowModality(Qt::ApplicationModal); + // 背景透明化 + setAttribute(Qt::WA_TranslucentBackground); + + // 界面初始化 + initUI(); +} + +ToolBoxDialog::~ToolBoxDialog() +{ +} + +// 布局 +void ToolBoxDialog::initUI() +{ + // 主布局 + m_mainlayout = new QVBoxLayout(); + m_mainlayout->setContentsMargins(0, 0, 0, 0); + this->setLayout(m_mainlayout); + // 背景透明化 + m_blurEffect = new DBlurEffectWidget(this); + m_blurEffect->setBlendMode(DBlurEffectWidget::BehindWindowBlend); + // 设置模糊大小 + m_blurEffect->resize(size()); + m_blurEffect->lower(); + + // 右上角关闭按钮 + m_titleBar = new DTitlebar(this); + m_titleBar->setBackgroundTransparent(true); + m_titleBar->setTitle(""); + m_titleBar->setMenuVisible(false); + m_mainlayout->addWidget(m_titleBar, 0, Qt::AlignRight | Qt::AlignTop); +} + +void ToolBoxDialog::addWidget(ToolBoxInterface *inter) +{ + inter->setFrameProxy(this); + inter->active(); +} + +void ToolBoxDialog::popWidget(ToolBoxInterface *const inter) +{ + Q_UNUSED(inter); +} +void ToolBoxDialog::pushWidget(ToolBoxInterface *const inter, QWidget *const w) +{ + Q_UNUSED(inter); + m_mainlayout->addWidget(w); +} diff --git a/deepin-pc-manager/src/window/modules/toolbox/toolboxdialog.h b/deepin-pc-manager/src/window/modules/toolbox/toolboxdialog.h new file mode 100644 index 0000000..1a0c936 --- /dev/null +++ b/deepin-pc-manager/src/window/modules/toolbox/toolboxdialog.h @@ -0,0 +1,40 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "include/interface/toolboxinterface.h" +#include "include/interface/toolboxproxyinterface.h" + +#include +#include +#include +#include + +DWIDGET_USE_NAMESPACE + +class ToolBoxDialog : public DFrame + , public PCC_NAMESPACE::ToolBoxProxyInterface +{ + Q_OBJECT + +public: + explicit ToolBoxDialog(QWidget *parent = nullptr); + ~ToolBoxDialog() override; + + // 添加弹框内容 + void addWidget(PCC_NAMESPACE::ToolBoxInterface *inter); + + void popWidget(PCC_NAMESPACE::ToolBoxInterface *const inter) override; + void pushWidget(PCC_NAMESPACE::ToolBoxInterface *const inter, QWidget *const w) override; + +private: + // 初始化界面 + void initUI(); + +private: + QVBoxLayout *m_mainlayout; + DBlurEffectWidget *m_blurEffect; + DTitlebar *m_titleBar; +}; diff --git a/deepin-pc-manager/src/window/modules/toolbox/toolboxitemwidget.cpp b/deepin-pc-manager/src/window/modules/toolbox/toolboxitemwidget.cpp new file mode 100644 index 0000000..dc0d155 --- /dev/null +++ b/deepin-pc-manager/src/window/modules/toolbox/toolboxitemwidget.cpp @@ -0,0 +1,118 @@ +// Copyright (C) 2020 ~ 2022 Uniontech Software Co., Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "toolboxitemwidget.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +ToolBoxItemWidget::ToolBoxItemWidget(DWidget *parent) + : DFrame(parent) + , m_pImageLabel(nullptr) + , m_pAppNameLabel(nullptr) + , m_pDesLabel(nullptr) + , m_pCompanyNameLabel(nullptr) + , m_pOpenBtn(nullptr) +{ + this->setFixedSize(UNITWIDTH, UNITHEIGHT); + this->setFrameRounded(true); + this->setBackgroundRole(DPalette::ItemBackground); + + initUi(); +} + +ToolBoxItemWidget::~ToolBoxItemWidget() +{ +} + +void ToolBoxItemWidget::initUi() +{ + QHBoxLayout *pMainLayout = new QHBoxLayout; + pMainLayout->setContentsMargins(10, 10, 10, 10); + pMainLayout->setSpacing(10); + + this->setLayout(pMainLayout); + + // item图标 + m_pImageLabel = new DLabel; + + QVBoxLayout *pVlayout = new QVBoxLayout; + pVlayout->setSpacing(2); + // 应用名称 + m_pAppNameLabel = new DLabel(this); + QFont font1 = m_pAppNameLabel->font(); + font1.setBold(true); + font1.setWeight(QFont::DemiBold); + m_pAppNameLabel->setFont(font1); + DFontSizeManager::instance()->bind(m_pAppNameLabel, DFontSizeManager::T5); + + // 应用说明 + m_pDesLabel = new DLabel(this); + m_pDesLabel->setElideMode(Qt::ElideMiddle); + DFontSizeManager::instance()->bind(m_pDesLabel, DFontSizeManager::T8); + // 应用支持者 + m_pCompanyNameLabel = new DTipLabel("", this); + m_pCompanyNameLabel->setAlignment(Qt::AlignLeft); + DFontSizeManager::instance()->bind(m_pCompanyNameLabel, DFontSizeManager::T8); + + pVlayout->addWidget(m_pAppNameLabel); + pVlayout->addWidget(m_pDesLabel); + pVlayout->addWidget(m_pCompanyNameLabel); + + // 打开按钮 + m_pOpenBtn = new DSuggestButton(this); + m_pOpenBtn->setText(tr("Open")); + connect(m_pOpenBtn, &DSuggestButton::clicked, this, &ToolBoxItemWidget::openAppDialog); + + pMainLayout->addWidget(m_pImageLabel); + pMainLayout->addLayout(pVlayout); + pMainLayout->addStretch(); + pMainLayout->addWidget(m_pOpenBtn); +} + +void ToolBoxItemWidget::setIcon(QString icon) +{ + m_pImageLabel->setPixmap(QIcon::fromTheme(icon).pixmap(48, 48)); +} + +void ToolBoxItemWidget::setAppTitle(QString title) +{ + m_pAppNameLabel->setText(title); +} + +void ToolBoxItemWidget::setAppTip(QString tip) +{ + m_pDesLabel->setText(tip); +} + +void ToolBoxItemWidget::setSupporter(QString supporter) +{ + m_pCompanyNameLabel->setText(supporter); +} + +void ToolBoxItemWidget::setBtnProperty(QString property) +{ + m_pOpenBtn->setProperty("name", property); +} + +void ToolBoxItemWidget::setBtnCheckAuth(bool checkauth) +{ + m_pOpenBtn->setProperty("checkauth", checkauth); +} + +void ToolBoxItemWidget::openAppDialog() +{ + Q_EMIT sendOpenAppDialog(m_pOpenBtn->property("name").toString(), m_pOpenBtn->property("checkauth").toBool()); +} diff --git a/deepin-pc-manager/src/window/modules/toolbox/toolboxitemwidget.h b/deepin-pc-manager/src/window/modules/toolbox/toolboxitemwidget.h new file mode 100644 index 0000000..fc85de9 --- /dev/null +++ b/deepin-pc-manager/src/window/modules/toolbox/toolboxitemwidget.h @@ -0,0 +1,50 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include +#include +#include +#include +#include +#include + +#include + +DWIDGET_USE_NAMESPACE + +#define UNITWIDTH 345 +#define UNITHEIGHT 80 + +class ToolBoxItemWidget : public DFrame +{ + Q_OBJECT +public: + explicit ToolBoxItemWidget(DWidget *parent = nullptr); + ~ToolBoxItemWidget() override; + + void setIcon(QString icon); + void setAppTitle(QString title); + void setAppTip(QString tip); + void setSupporter(QString supporter); + void setBtnProperty(QString property); + void setBtnCheckAuth(bool checkauth); + +private: + void initUi(); + +public Q_SLOTS: + void openAppDialog(); + +Q_SIGNALS: + void sendOpenAppDialog(QString property, bool checkauth); + +private: + DLabel *m_pImageLabel; + DLabel *m_pAppNameLabel; + DLabel *m_pDesLabel; + DTipLabel *m_pCompanyNameLabel; + DSuggestButton *m_pOpenBtn; +}; diff --git a/deepin-pc-manager/src/window/modules/toolbox/toolboxkithelper.cpp b/deepin-pc-manager/src/window/modules/toolbox/toolboxkithelper.cpp new file mode 100644 index 0000000..2194088 --- /dev/null +++ b/deepin-pc-manager/src/window/modules/toolbox/toolboxkithelper.cpp @@ -0,0 +1,38 @@ +// Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "toolboxkithelper.h" + +ToolBoxKitHelper::ToolBoxKitHelper() +{ +} + +ToolBoxKitHelper::~ToolBoxKitHelper() +{ +} + +// 确认文件审计总开关状态 +void ToolBoxKitHelper::confirmCheckShowAudit(QString property) +{ + bool result = false; + // 权限验证 + result = checkAuthorization("com.deepin.deepin-pc-manager.checkAuthentication", getpid()); + Q_EMIT notifyCheckShowAudit(property, result); +} + +bool ToolBoxKitHelper::checkAuthorization(const QString &actionId, qint64 applicationPid) +{ + bool ret; + Authority::Result result; + result = Authority::instance()->checkAuthorizationSync(actionId, UnixProcessSubject(applicationPid), /// 第一个参数是需要验证的action,和规则文件写的保持一致 + Authority::AllowUserInteraction); + if (result == Authority::Yes) { + ret = true; + } else { + ret = false; + } + + return ret; +} diff --git a/deepin-pc-manager/src/window/modules/toolbox/toolboxkithelper.h b/deepin-pc-manager/src/window/modules/toolbox/toolboxkithelper.h new file mode 100644 index 0000000..c02cd82 --- /dev/null +++ b/deepin-pc-manager/src/window/modules/toolbox/toolboxkithelper.h @@ -0,0 +1,31 @@ +// Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include + +#include + +using namespace PolkitQt1; + +class ToolBoxKitHelper : public QObject +{ + Q_OBJECT +public: + explicit ToolBoxKitHelper(); + ~ToolBoxKitHelper(); + +Q_SIGNALS: + // 通知检测显示结果 + void notifyCheckShowAudit(QString property, bool result); + +public Q_SLOTS: + // 确认检测显示结果 + void confirmCheckShowAudit(QString property); + +public: + bool checkAuthorization(const QString &actionId, qint64 applicationPid); +}; diff --git a/deepin-pc-manager/src/window/modules/securitytools/defsecuritytoollistwidget.cpp b/deepin-pc-manager/src/window/modules/toolbox/toolboxlistview.cpp similarity index 74% rename from deepin-pc-manager/src/window/modules/securitytools/defsecuritytoollistwidget.cpp rename to deepin-pc-manager/src/window/modules/toolbox/toolboxlistview.cpp index 6105bce..c15f220 100644 --- a/deepin-pc-manager/src/window/modules/securitytools/defsecuritytoollistwidget.cpp +++ b/deepin-pc-manager/src/window/modules/toolbox/toolboxlistview.cpp @@ -3,9 +3,9 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -#include "defsecuritytoollistwidget.h" +#include "toolboxlistview.h" -DefSecurityToolListWidget::DefSecurityToolListWidget(QWidget *parent) +ToolBoxListView::ToolBoxListView(QWidget *parent) : DListWidget(parent) { setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -19,8 +19,9 @@ DefSecurityToolListWidget::DefSecurityToolListWidget(QWidget *parent) setFlow(QListView::LeftToRight); setUniformItemSizes(true); setDragEnabled(false); - // setStyleSheet("QListWidget {border:1px solid gray;}"); setContentsMargins(0, 0, 0, 0); } -DefSecurityToolListWidget::~DefSecurityToolListWidget() { } +ToolBoxListView::~ToolBoxListView() +{ +} diff --git a/deepin-pc-manager/src/window/modules/toolbox/toolboxlistview.h b/deepin-pc-manager/src/window/modules/toolbox/toolboxlistview.h new file mode 100644 index 0000000..31b903d --- /dev/null +++ b/deepin-pc-manager/src/window/modules/toolbox/toolboxlistview.h @@ -0,0 +1,16 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include + +DWIDGET_USE_NAMESPACE +class ToolBoxListView : public DListWidget +{ + Q_OBJECT +public: + explicit ToolBoxListView(QWidget *parent = nullptr); + ~ToolBoxListView() override; +}; diff --git a/deepin-pc-manager/src/window/modules/toolbox/toolboxmodel.cpp b/deepin-pc-manager/src/window/modules/toolbox/toolboxmodel.cpp new file mode 100644 index 0000000..b7a94a7 --- /dev/null +++ b/deepin-pc-manager/src/window/modules/toolbox/toolboxmodel.cpp @@ -0,0 +1,94 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "toolboxmodel.h" +#include "include/interface/toolboxinterface.h" +#include "window/common/common.h" + +const QString ModuleDirectory = "/usr/lib/deepin-pc-manager/modules/"; + +using namespace PCC_NAMESPACE; +ToolBoxModel::ToolBoxModel(QObject *parent) + : QObject(parent) +{ + initData(); + + // thread + m_policyKitHelper = new ToolBoxKitHelper; + m_polKitHelperThread = new QThread(this); + m_policyKitHelper->moveToThread(m_polKitHelperThread); + // 通知去改变usb限制模式 + connect(m_policyKitHelper, &ToolBoxKitHelper::notifyCheckShowAudit, this, &ToolBoxModel::acceptCheckShowAudit); + + m_polKitHelperThread->start(); + connect(this, &ToolBoxModel::nofityCheckAudit, m_policyKitHelper, &ToolBoxKitHelper::confirmCheckShowAudit); +} + +ToolBoxModel::~ToolBoxModel() +{ +} + +void ToolBoxModel::initData() +{ + QDir moduleDir(ModuleDirectory); + if (!moduleDir.exists()) { + qInfo() << "module directory not exists"; + return; + } + + moduleDir.setFilter(QDir::Files | QDir::NoDotAndDotDot); + auto moduleList = moduleDir.entryInfoList(); + for (const auto &module : moduleList) { + loadPlugin(module.absoluteFilePath()); + } +} + +void ToolBoxModel::loadPlugin(const QString &path) +{ + if (!QLibrary::isLibrary(path)) + return; + qDebug() << "loading module: " << path << " threadId:" << QThread::currentThreadId(); + + QPluginLoader loader(path); + const QJsonObject &meta = loader.metaData().value("MetaData").toObject(); + qDebug() << "api: " << meta.value("api").toString(); + if (!Utils::compareVersion(meta.value("api").toString(), "1.0.0")) { + qDebug() << "plugin's version is too low"; + return; + } + + QObject *instance = loader.instance(); + if (!instance) { + qWarning() << "Load plugin error:" << loader.errorString(); + return; + } + + auto *module = qobject_cast(instance); + if (!module) { + qWarning() << "module object is nullptr:"; + return; + } + AppInfo appInfo; + appInfo.apptype = module->apptype(); + appInfo.name = module->name(); + appInfo.apptitle = module->apptitle(); + appInfo.apptip = module->apptip(); + appInfo.appsupporter = module->appsupporter(); + appInfo.icon = module->icon(); + appInfo.enable = module->enable(); + appInfo.checkauth = module->checkauth(); + + m_allModules.push_back({appInfo, instance}); +} + +// 入口点击权限判断 +void ToolBoxModel::checkShowAudit(QString property) +{ + Q_EMIT nofityCheckAudit(property); +} + +void ToolBoxModel::acceptCheckShowAudit(QString property, bool result) +{ + Q_EMIT sendCheckShowAuditResult(property, result); +} diff --git a/deepin-pc-manager/src/window/modules/toolbox/toolboxmodel.h b/deepin-pc-manager/src/window/modules/toolbox/toolboxmodel.h new file mode 100644 index 0000000..1803b7f --- /dev/null +++ b/deepin-pc-manager/src/window/modules/toolbox/toolboxmodel.h @@ -0,0 +1,54 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "toolboxkithelper.h" + +#include +#include +#include + +struct AppInfo { + int apptype; + QString name; + QString apptitle; + QString apptip; + QString appsupporter; + QString icon; + bool enable; + bool checkauth; +}; + +class ToolBoxModel : public QObject +{ + Q_OBJECT +public: + explicit ToolBoxModel(QObject *parent = nullptr); + ~ToolBoxModel(); + + QList> getAllModulesInfo() { return m_allModules; } + // 入口点击权限判断 + void checkShowAudit(QString property); + +private: + // 初始化数据 + void initData(); + void loadPlugin(const QString &pluginPath); + +public Q_SLOTS: + void acceptCheckShowAudit(QString property, bool result); + +Q_SIGNALS: + // 发送入口点击提权 + void nofityCheckAudit(QString property); + // 发送入口点击权限判断结果 + void sendCheckShowAuditResult(QString property, bool result); + +private: + QList> m_allModules; + + ToolBoxKitHelper *m_policyKitHelper; + QThread *m_polKitHelperThread; +}; diff --git a/deepin-pc-manager/src/window/modules/toolbox/toolboxmodule.cpp b/deepin-pc-manager/src/window/modules/toolbox/toolboxmodule.cpp new file mode 100644 index 0000000..13deba9 --- /dev/null +++ b/deepin-pc-manager/src/window/modules/toolbox/toolboxmodule.cpp @@ -0,0 +1,54 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "toolboxmodule.h" +#include "toolboxmodel.h" +#include "toolboxwidget.h" +#include "window/common/common.h" + +ToolBoxModule::ToolBoxModule(FrameProxyInterface *frame, QObject *parent) + : QObject(parent) + , ModuleInterface(frame) + , m_toolBoxModel(nullptr) + , m_toolBoxWidget(nullptr) +{ +} + +ToolBoxModule::~ToolBoxModule() +{ +} + +// 初始化 +void ToolBoxModule::initialize() +{ +} + +// 预初始化 +void ToolBoxModule::preInitialize() +{ + m_toolBoxModel = new ToolBoxModel(this); +} + +// 模块名称 +const QString ToolBoxModule::name() const +{ + return MODULE_TOOL_BOX_NAME; +} + +// 激活 +void ToolBoxModule::active(int index) +{ + Q_UNUSED(index); + + if (!m_toolBoxWidget) { + m_toolBoxWidget = new ToolBoxWidget(m_toolBoxModel); + } + m_toolBoxWidget->show(); + m_frameProxy->pushWidget(this, m_toolBoxWidget); +} + +// 反激活 +void ToolBoxModule::deactive() +{ +} diff --git a/deepin-pc-manager/src/window/modules/toolbox/toolboxmodule.h b/deepin-pc-manager/src/window/modules/toolbox/toolboxmodule.h new file mode 100644 index 0000000..ec84e9b --- /dev/null +++ b/deepin-pc-manager/src/window/modules/toolbox/toolboxmodule.h @@ -0,0 +1,38 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "window/interface/frameproxyinterface.h" +#include "window/interface/moduleinterface.h" + +class FrameProxyInterface; +class ModuleInterface; +class ToolBoxModel; +class ToolBoxWidget; + +class ToolBoxModule : public QObject + , public ModuleInterface +{ + Q_OBJECT +public: + explicit ToolBoxModule(FrameProxyInterface *frame, QObject *parent = nullptr); + ~ToolBoxModule() override; + +public: + // 初始化 + void initialize() override; + // 预初始化 + void preInitialize() override; + // 模块名称 + const QString name() const override; + // 激活 + void active(int index) override; + // 反激活 + void deactive() override; + +private: + ToolBoxModel *m_toolBoxModel; + ToolBoxWidget *m_toolBoxWidget; +}; diff --git a/deepin-pc-manager/src/window/modules/toolbox/toolboxwidget.cpp b/deepin-pc-manager/src/window/modules/toolbox/toolboxwidget.cpp new file mode 100644 index 0000000..348647b --- /dev/null +++ b/deepin-pc-manager/src/window/modules/toolbox/toolboxwidget.cpp @@ -0,0 +1,186 @@ +// Copyright (C) 2020 ~ 2020 Deepin Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "toolboxwidget.h" +#include "toolboxmodel.h" +#include "toolboxdialog.h" +#include "include/interface/toolboxinterface.h" + +#include +#include + +#define APPTYPE Qt::UserRole + 1 +using namespace PCC_NAMESPACE; +ToolBoxWidget::ToolBoxWidget(ToolBoxModel *model, DWidget *parent) + : DWidget(parent) + , m_model(model) + , m_pToolButtonBox(nullptr) + , m_toolDialog(nullptr) +{ + // 初始化UI + initUI(); + initData(); + connect(m_model, &ToolBoxModel::sendCheckShowAuditResult, this, &ToolBoxWidget::acceptCheckShowAuditResult); +} + +ToolBoxWidget::~ToolBoxWidget() +{ +} + +// 初始化界面 +void ToolBoxWidget::initUI() +{ + QVBoxLayout *mainLayout = new QVBoxLayout; + mainLayout->setContentsMargins(20, 20, 20, 20); + this->setLayout(mainLayout); + + QHBoxLayout *btnLayout = new QHBoxLayout; + btnLayout->setContentsMargins(18, 0, 0, 0); + mainLayout->addLayout(btnLayout); + + m_pToolButtonBox = new DButtonBox(this); + m_pToolButtonBox->setOrientation(Qt::Horizontal); + m_pToolButtonBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); + + QList btnlist; + // 全部 + DButtonBoxButton *pBtn = createBoxButton(tr("All"), m_pToolButtonBox); + btnlist.append(pBtn); + // 系统 + pBtn = createBoxButton(tr("System"), m_pToolButtonBox); + btnlist.append(pBtn); + // 网络 + pBtn = createBoxButton(tr("Network"), m_pToolButtonBox); + btnlist.append(pBtn); + // 修复 + pBtn = createBoxButton(tr("Repair"), m_pToolButtonBox); + btnlist.append(pBtn); + // 应用 + pBtn = createBoxButton(tr("Apps"), m_pToolButtonBox); + btnlist.append(pBtn); + // 硬件 + pBtn = createBoxButton(tr("Devices"), m_pToolButtonBox); + btnlist.append(pBtn); + m_pToolButtonBox->setButtonList(btnlist, true); + btnlist.at(0)->setChecked(true); + + for (int i = 0; i < btnlist.size(); i++) { + m_pToolButtonBox->setId(btnlist.at(i), ToolBoxProxyInterface::AppType(i)); + } + + btnLayout->addWidget(m_pToolButtonBox, 0, Qt::AlignLeft); + m_pToolView = new ToolBoxListView(this); + m_pToolView->setFixedHeight(500); + m_pToolView->setSpacing(10); + mainLayout->addWidget(m_pToolView); + mainLayout->addStretch(); + + connect(m_pToolButtonBox, &DButtonBox::buttonClicked, this, [&](QAbstractButton *pBtn) { + int iID = m_pToolButtonBox->id(pBtn); + updateToolsMsgByClassify(iID); + }); +} + +DButtonBoxButton *ToolBoxWidget::createBoxButton(const QString &strText, QWidget *pParent) +{ + QFont font; + font.setFamily("SourceHanSansSC"); + font.setWeight(QFont::Medium); + font.setPixelSize(14); + DButtonBoxButton *pBtn = new DButtonBoxButton(strText, pParent); + pBtn->setFixedSize(QSize(72, 30)); + pBtn->setFont(font); + return pBtn; +} + +void ToolBoxWidget::initData() +{ + //updateToolsMsgByClassify(ToolBoxProxyInterface::AppType::All); + QList> modules = m_model->getAllModulesInfo(); + + for (auto &pluginInfo : modules) { + int apptype = pluginInfo.first.apptype; + QString name = pluginInfo.first.name; + QString apptitle = pluginInfo.first.apptitle; + QString apptip = pluginInfo.first.apptip; + QString appsupporter = pluginInfo.first.appsupporter; + QString icon = pluginInfo.first.icon; + bool enable = pluginInfo.first.enable; + bool checkauth = pluginInfo.first.checkauth; + if (!enable) { + continue; + } + + ToolBoxItemWidget *pToolItem = new ToolBoxItemWidget(m_pToolView); + connect(pToolItem, &ToolBoxItemWidget::sendOpenAppDialog, this, &ToolBoxWidget::openAppDialog); + pToolItem->setIcon(icon); + pToolItem->setAppTitle(apptitle); + pToolItem->setAppTip(apptip); + pToolItem->setSupporter(appsupporter); + pToolItem->setBtnProperty(name); + pToolItem->setBtnCheckAuth(checkauth); + + QListWidgetItem *pItem = new QListWidgetItem; + pItem->setSizeHint(QSize(UNITWIDTH, UNITHEIGHT)); + pItem->setData(APPTYPE, apptype); + m_pToolView->addItem(pItem); + m_pToolView->setItemWidget(pItem, pToolItem); + } +} + +void ToolBoxWidget::openAppDialog(QString property, bool checkauth) +{ + if (checkauth) { + m_model->checkShowAudit(property); + } else { + showAppWidget(property); + } +} + +// 发送入口点击权限判断结果 +void ToolBoxWidget::acceptCheckShowAuditResult(QString property, bool result) +{ + if (result) { + showAppWidget(property); + } +} + +void ToolBoxWidget::showAppWidget(QString property) +{ + QList> modules = m_model->getAllModulesInfo(); + for (auto &pluginInfo : modules) { + if (property == pluginInfo.first.name) { + QObject *instance = pluginInfo.second; + auto *module = qobject_cast(instance); + if (!module) { + qWarning() << "module object is nullptr:"; + return; + } + + m_toolDialog = new ToolBoxDialog(this); + m_toolDialog->addWidget(module); + m_toolDialog->raise(); + m_toolDialog->show(); + break; + } + } +} + +void ToolBoxWidget::updateToolsMsgByClassify(int type) +{ + int count = m_pToolView->count(); + for (int i = 0; i < count; ++i) { + QListWidgetItem *pItem = m_pToolView->item(i); + if (ToolBoxProxyInterface::AppType::All == type) { + m_pToolView->setItemHidden(m_pToolView->item(i), false); + } else { + if (pItem->data(APPTYPE).toInt() == type) { + m_pToolView->setItemHidden(m_pToolView->item(i), false); + } else { + m_pToolView->setItemHidden(m_pToolView->item(i), true); + } + } + } +} diff --git a/deepin-pc-manager/src/window/modules/toolbox/toolboxwidget.h b/deepin-pc-manager/src/window/modules/toolbox/toolboxwidget.h new file mode 100644 index 0000000..d45127b --- /dev/null +++ b/deepin-pc-manager/src/window/modules/toolbox/toolboxwidget.h @@ -0,0 +1,42 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "toolboxitemwidget.h" +#include "toolboxlistview.h" + +#include +#include + +DWIDGET_USE_NAMESPACE +class ToolBoxModel; +class ToolBoxDialog; +class ToolBoxWidget : public QWidget +{ + Q_OBJECT +public: + explicit ToolBoxWidget(ToolBoxModel *model, DWidget *parent = nullptr); + ~ToolBoxWidget(); + +private: + // 初始化界面 + void initUI(); + DButtonBoxButton *createBoxButton(const QString &strText, QWidget *pParent = nullptr); + void initData(); + + void updateToolsMsgByClassify(int type); + void showAppWidget(QString property); + +public Q_SLOTS: + void openAppDialog(QString property, bool checkauth); + // 发送入口点击权限判断结果 + void acceptCheckShowAuditResult(QString property, bool result); + +private: + ToolBoxModel *m_model; + DButtonBox *m_pToolButtonBox; + ToolBoxListView *m_pToolView; + ToolBoxDialog *m_toolDialog; +}; diff --git a/deepin-pc-manager/src/window/modules/cleaner/widgets/trashcleanconfigitem.cpp b/deepin-pc-manager/src/window/modules/trashclean/trashcleanconfigitem.cpp similarity index 97% rename from deepin-pc-manager/src/window/modules/cleaner/widgets/trashcleanconfigitem.cpp rename to deepin-pc-manager/src/window/modules/trashclean/trashcleanconfigitem.cpp index ab1e2dc..7e63f97 100644 --- a/deepin-pc-manager/src/window/modules/cleaner/widgets/trashcleanconfigitem.cpp +++ b/deepin-pc-manager/src/window/modules/trashclean/trashcleanconfigitem.cpp @@ -1,4 +1,3 @@ -// Copyright (C) 2019 ~ 2022 UnionTech Software Technology Co., Ltd. // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -36,6 +35,10 @@ TrashCleanConfigItem::TrashCleanConfigItem(QWidget *parent) initConnection(); } +TrashCleanConfigItem::~TrashCleanConfigItem() +{ +} + void TrashCleanConfigItem::setTitles(const QString &mainTitle, const QString &tipTitle) { m_title->setText(mainTitle); diff --git a/deepin-pc-manager/src/window/modules/cleaner/widgets/trashcleanconfigitem.h b/deepin-pc-manager/src/window/modules/trashclean/trashcleanconfigitem.h similarity index 78% rename from deepin-pc-manager/src/window/modules/cleaner/widgets/trashcleanconfigitem.h rename to deepin-pc-manager/src/window/modules/trashclean/trashcleanconfigitem.h index 832d15b..9620d1d 100644 --- a/deepin-pc-manager/src/window/modules/cleaner/widgets/trashcleanconfigitem.h +++ b/deepin-pc-manager/src/window/modules/trashclean/trashcleanconfigitem.h @@ -1,4 +1,3 @@ -// Copyright (C) 2019 ~ 2022 UnionTech Software Technology Co., Ltd. // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -8,24 +7,20 @@ #include #include +#include +#include #include #include -DWIDGET_BEGIN_NAMESPACE -class DLable; -class DTipLabel; -class DBackgroundGroup; -DWIDGET_END_NAMESPACE - -class TrashCleanConfigItem : public Dtk::Widget::DFrame +DWIDGET_USE_NAMESPACE +class TrashCleanConfigItem : public DFrame { Q_OBJECT - public: explicit TrashCleanConfigItem(QWidget *parent = nullptr); - ~TrashCleanConfigItem() { } + ~TrashCleanConfigItem(); void setTitles(const QString &, const QString &); void setCheckBoxStatus(bool); diff --git a/deepin-pc-manager/src/window/modules/trashclean/trashcleanmodel.cpp b/deepin-pc-manager/src/window/modules/trashclean/trashcleanmodel.cpp new file mode 100644 index 0000000..40a80d2 --- /dev/null +++ b/deepin-pc-manager/src/window/modules/trashclean/trashcleanmodel.cpp @@ -0,0 +1,64 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "trashcleanmodel.h" +#include "window/common/invokers/invokerfactory.h" + +#include + +TrashCleanModel::TrashCleanModel(QObject *parent) + : QObject(parent) +{ + initData(); +} + +TrashCleanModel::~TrashCleanModel() +{ +} + +void TrashCleanModel::initData() +{ + m_sysetemDaemonInvokerInter = InvokerFactory::GetInstance().CreateInvoker("com.deepin.pc.manager.system.daemon", + "/com/deepin/pc/manager/system/daemon", + "com.deepin.pc.manager.system.daemon", + ConnectType::SYSTEM, + this); +} + +double TrashCleanModel::getTrashFileCount() +{ + QDBusMessage msg; + msg = DBUS_BLOCK_INVOKE(m_sysetemDaemonInvokerInter, "GetTrashFileCount", QDir::homePath()); + GET_MESSAGE_VALUE(double, trashFileCount, msg); + return trashFileCount; +} +double TrashCleanModel::getCacheFileCount() +{ + QDBusMessage msg; + msg = DBUS_BLOCK_INVOKE(m_sysetemDaemonInvokerInter, "GetCacheFileCount"); + GET_MESSAGE_VALUE(double, cacheFileCount, msg); + return cacheFileCount; +} +double TrashCleanModel::getLogFileCount() +{ + QDBusMessage msg; + msg = DBUS_BLOCK_INVOKE(m_sysetemDaemonInvokerInter, "GetLogFileCount"); + GET_MESSAGE_VALUE(double, logFileCount, msg); + return logFileCount; +} +double TrashCleanModel::getHistoryFileCount() +{ + QDBusMessage msg; + msg = DBUS_BLOCK_INVOKE(m_sysetemDaemonInvokerInter, "GetHistoryFileCount", QDir::homePath()); + GET_MESSAGE_VALUE(double, historyFileCount, msg); + return historyFileCount; +} + +void TrashCleanModel::cleanTrashFile(QStringList itemlist) +{ + if (itemlist.contains(TRASH_CLEAN_ITEM_TYPE_TRASH)) { + DTrashManager::instance()->cleanTrash(); + } + DBUS_NOBLOCK_INVOKE(m_sysetemDaemonInvokerInter, "CleanTrashFiles", itemlist); +} diff --git a/deepin-pc-manager/src/window/modules/trashclean/trashcleanmodel.h b/deepin-pc-manager/src/window/modules/trashclean/trashcleanmodel.h new file mode 100644 index 0000000..06668e1 --- /dev/null +++ b/deepin-pc-manager/src/window/modules/trashclean/trashcleanmodel.h @@ -0,0 +1,34 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "window/common/common.h" + +#include + +#include + +DCORE_USE_NAMESPACE +class DBusInvokerInterface; +class TrashCleanModel : public QObject +{ + Q_OBJECT +public: + explicit TrashCleanModel(QObject *parent = nullptr); + ~TrashCleanModel(); + + double getTrashFileCount(); + double getCacheFileCount(); + double getLogFileCount(); + double getHistoryFileCount(); + void cleanTrashFile(QStringList itemlist); + +private: + // 初始化数据 + void initData(); + +private: + DBusInvokerInterface *m_sysetemDaemonInvokerInter; +}; diff --git a/deepin-pc-manager/src/window/modules/trashclean/trashcleanmodule.cpp b/deepin-pc-manager/src/window/modules/trashclean/trashcleanmodule.cpp new file mode 100644 index 0000000..b839b4a --- /dev/null +++ b/deepin-pc-manager/src/window/modules/trashclean/trashcleanmodule.cpp @@ -0,0 +1,54 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "trashcleanmodule.h" +#include "trashcleanmodel.h" +#include "trashcleanwidget.h" +#include "window/common/common.h" + +TrashCleanModule::TrashCleanModule(FrameProxyInterface *frame, QObject *parent) + : QObject(parent) + , ModuleInterface(frame) + , m_trashCleanModel(nullptr) + , m_trashCleanWidget(nullptr) +{ +} + +TrashCleanModule::~TrashCleanModule() +{ +} + +// 初始化 +void TrashCleanModule::initialize() +{ +} + +// 预初始化 +void TrashCleanModule::preInitialize() +{ + m_trashCleanModel = new TrashCleanModel(this); +} + +// 模块名称 +const QString TrashCleanModule::name() const +{ + return MODULE_TRASH_CLEAN_NAME; +} + +// 激活 +void TrashCleanModule::active(int index) +{ + Q_UNUSED(index); + + if (!m_trashCleanWidget) { + m_trashCleanWidget = new TrashCleanWidget(m_trashCleanModel); + } + m_trashCleanWidget->show(); + m_frameProxy->pushWidget(this, m_trashCleanWidget); +} + +// 反激活 +void TrashCleanModule::deactive() +{ +} diff --git a/deepin-pc-manager/src/window/modules/trashclean/trashcleanmodule.h b/deepin-pc-manager/src/window/modules/trashclean/trashcleanmodule.h new file mode 100644 index 0000000..1c94c6f --- /dev/null +++ b/deepin-pc-manager/src/window/modules/trashclean/trashcleanmodule.h @@ -0,0 +1,38 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "window/interface/frameproxyinterface.h" +#include "window/interface/moduleinterface.h" + +class FrameProxyInterface; +class ModuleInterface; +class TrashCleanModel; +class TrashCleanWidget; + +class TrashCleanModule : public QObject + , public ModuleInterface +{ + Q_OBJECT +public: + explicit TrashCleanModule(FrameProxyInterface *frame, QObject *parent = nullptr); + ~TrashCleanModule() override; + +public: + // 初始化 + void initialize() override; + // 预初始化 + void preInitialize() override; + // 模块名称 + const QString name() const override; + // 激活 + void active(int index) override; + // 反激活 + void deactive() override; + +private: + TrashCleanModel *m_trashCleanModel; + TrashCleanWidget *m_trashCleanWidget; +}; diff --git a/deepin-pc-manager/src/window/modules/cleaner/widgets/trashcleanresultheaderitem.cpp b/deepin-pc-manager/src/window/modules/trashclean/trashcleanresultheaderitem.cpp similarity index 98% rename from deepin-pc-manager/src/window/modules/cleaner/widgets/trashcleanresultheaderitem.cpp rename to deepin-pc-manager/src/window/modules/trashclean/trashcleanresultheaderitem.cpp index 201f13a..4f0e1c8 100644 --- a/deepin-pc-manager/src/window/modules/cleaner/widgets/trashcleanresultheaderitem.cpp +++ b/deepin-pc-manager/src/window/modules/trashclean/trashcleanresultheaderitem.cpp @@ -1,4 +1,3 @@ -// Copyright (C) 2019 ~ 2022 UnionTech Software Technology Co., Ltd. // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/src/window/modules/cleaner/widgets/trashcleanresultheaderitem.h b/deepin-pc-manager/src/window/modules/trashclean/trashcleanresultheaderitem.h similarity index 92% rename from deepin-pc-manager/src/window/modules/cleaner/widgets/trashcleanresultheaderitem.h rename to deepin-pc-manager/src/window/modules/trashclean/trashcleanresultheaderitem.h index abf9b7c..214594e 100644 --- a/deepin-pc-manager/src/window/modules/cleaner/widgets/trashcleanresultheaderitem.h +++ b/deepin-pc-manager/src/window/modules/trashclean/trashcleanresultheaderitem.h @@ -1,4 +1,3 @@ -// Copyright (C) 2019 ~ 2022 UnionTech Software Technology Co., Ltd. // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -18,7 +17,7 @@ class TrashCleanResultHeaderItem : public Dtk::Widget::DFrame public: explicit TrashCleanResultHeaderItem(QWidget *parent = nullptr); - ~TrashCleanResultHeaderItem() { } + ~TrashCleanResultHeaderItem() {} public Q_SLOTS: void setScanStarted(); diff --git a/deepin-pc-manager/src/window/modules/cleaner/widgets/cleanerresultitemwidget.cpp b/deepin-pc-manager/src/window/modules/trashclean/trashcleanresultitemwidget.cpp similarity index 68% rename from deepin-pc-manager/src/window/modules/cleaner/widgets/cleanerresultitemwidget.cpp rename to deepin-pc-manager/src/window/modules/trashclean/trashcleanresultitemwidget.cpp index 8f5ef38..37c676e 100644 --- a/deepin-pc-manager/src/window/modules/cleaner/widgets/cleanerresultitemwidget.cpp +++ b/deepin-pc-manager/src/window/modules/trashclean/trashcleanresultitemwidget.cpp @@ -1,12 +1,8 @@ -// Copyright (C) 2020 ~ 2020 Deepin Technology Co., Ltd. // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later -#include "cleanerresultitemwidget.h" - -#include "window/modules/common/common.h" -#include "window/modules/common/compixmap.h" +#include "trashcleanresultitemwidget.h" #include #include @@ -20,9 +16,9 @@ #define ROOT_NODE_WIDTH 734 #define ITEM_INDENTATION 16 #define FATHER_NODE_WIDTH (ROOT_NODE_WIDTH - ITEM_INDENTATION) -#define CHILD_NODE_WIDTH (FATHER_NODE_WIDTH - ITEM_INDENTATION) +#define CHILD_NODE_WIDTH (FATHER_NODE_WIDTH) -CleanerResultItemWidget::CleanerResultItemWidget(QWidget *parent) +TrashCleanResultItemWidget::TrashCleanResultItemWidget(QWidget *parent) : DFrame(parent) , m_isRootItem(false) , m_checkBox(nullptr) @@ -31,12 +27,11 @@ CleanerResultItemWidget::CleanerResultItemWidget(QWidget *parent) , m_headTipLabel(nullptr) , m_tailLabel(nullptr) , m_usageLabel(nullptr) - , m_spinner(nullptr) , m_contentFrame(nullptr) , m_root(nullptr) , m_isWorking(false) { - this->setFixedHeight(46); // 单个项目高度固定 + this->setFixedHeight(46); // 单个项目高度固定 this->setFixedWidth(FATHER_NODE_WIDTH); // 单个项目宽度固定,避免在不同位置产生变化 this->setBackgroundRole(DPalette::NoType); QHBoxLayout *mainLayout = new QHBoxLayout; @@ -115,7 +110,6 @@ CleanerResultItemWidget::CleanerResultItemWidget(QWidget *parent) // 右侧说明部分,记录状态或文件数量信息 m_tailLabel = new DTipLabel("", this); - m_tailLabel->setFont(Utils::getFixFontSize(14)); DFontSizeManager::instance()->unbind(m_tailLabel); m_tailLabel->setObjectName("tailLabel"); @@ -126,35 +120,25 @@ CleanerResultItemWidget::CleanerResultItemWidget(QWidget *parent) // 最右侧,记录本项检查总计文件空间大小 m_usageLabel = new DLabel(this); - m_usageLabel->setFont(Utils::getFixFontSize(14)); m_usageLabel->setObjectName("usageLabel"); m_usageLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); m_usageLabel->setContentsMargins(0, 0, 5, 0); firstLayerLayout->addWidget(m_usageLabel); - // 仅在根项目上显示,根项目处于扫描状态时显示并旋转 - m_spinner = new DSpinner(this); - m_spinner->setObjectName("spinner"); - // spinner大小暂时设置为16*16 - m_spinner->setFixedSize(QSize(16, 16)); - - // 对于子项,不显示spinner - m_spinner->stop(); - m_spinner->setVisible(false); - firstLayerLayout->addWidget(m_spinner); - // 设置边框的宽度 setLineWidth(0); // 项目选中时,触发上级和下级检查项状态变更 - connect(m_checkBox, &DCheckBox::clicked, this, &CleanerResultItemWidget::childSelected); + connect(m_checkBox, &DCheckBox::clicked, this, &TrashCleanResultItemWidget::checkBoxSelected); } -CleanerResultItemWidget::~CleanerResultItemWidget() { } +TrashCleanResultItemWidget::~TrashCleanResultItemWidget() +{ +} // 设置标题 -void CleanerResultItemWidget::setHeadText(const QString &text) +void TrashCleanResultItemWidget::setHeadText(const QString &text) { m_headLabel->setText(text); m_headStr = text; @@ -162,7 +146,7 @@ void CleanerResultItemWidget::setHeadText(const QString &text) } // 本项目内容说明 -void CleanerResultItemWidget::setHeadTipText(const QString &text) +void TrashCleanResultItemWidget::setHeadTipText(const QString &text) { m_headTipLabel->setText(text); m_headTipStr = text; @@ -171,7 +155,7 @@ void CleanerResultItemWidget::setHeadTipText(const QString &text) // 项目右侧提示信息 // 注意tailtext仅对根项目起作用 // 在子项上需要隐藏 -void CleanerResultItemWidget::setTailText(const QString &text) +void TrashCleanResultItemWidget::setTailText(const QString &text) { if (m_isRootItem) { // 扫描完成,显示内容 @@ -183,36 +167,35 @@ void CleanerResultItemWidget::setTailText(const QString &text) } // 由上一级或根结点遍历,在根项被勾选或 -void CleanerResultItemWidget::setCheckBoxStatus(bool isChecked) +void TrashCleanResultItemWidget::setCheckBoxStatus(bool isChecked) { m_checkBox->setChecked(isChecked); } // 清理完成时隐藏勾选框 -void CleanerResultItemWidget::setCheckBoxVisable(bool isVisable) +void TrashCleanResultItemWidget::setCheckBoxVisable(bool isVisable) { m_checkBox->setVisible(isVisable); } // 清理完成时显示完成图标 -void CleanerResultItemWidget::setIconVisable(bool isVisable) +void TrashCleanResultItemWidget::setIconVisable(bool isVisable) { m_iconLable->setVisible(isVisable); } // 清理成功 -void CleanerResultItemWidget::setCleanDone() +void TrashCleanResultItemWidget::setCleanDone() { // 修改勾选状态,通知根项重新计算大小 m_checkBox->setVisible(false); - childSelected(); setIconVisable(true); m_usageLabel->setText(""); m_usageLabel->setVisible(true); // 清理成功显示成功图标 - m_iconLable->setPixmap(QIcon::fromTheme(ANTIAV_OPERATION_SUCCESS).pixmap(16, 16)); + m_iconLable->setPixmap(QIcon::fromTheme("dcc_ok_tip").pixmap(16, 16)); m_iconLable->setVisible(true); m_tailLabel->setText(tr("Removed")); @@ -221,7 +204,7 @@ void CleanerResultItemWidget::setCleanDone() // 扫描完成时显示占用空间大小 // 所有检查项在扫描完成时均需要 -void CleanerResultItemWidget::setUsedSpace(const QString &text) +void TrashCleanResultItemWidget::setUsedSpace(const QString &text) { m_usageLabel->setVisible(true); m_usageLabel->setText(text); @@ -229,13 +212,13 @@ void CleanerResultItemWidget::setUsedSpace(const QString &text) resetElidedTextByFontChange(); } -bool CleanerResultItemWidget::getCheckBoxStatus() const +bool TrashCleanResultItemWidget::getCheckBoxStatus() const { return m_checkBox->isChecked(); } // 本项作为检查的根项目,修改页面效果 -void CleanerResultItemWidget::setAsRoot() +void TrashCleanResultItemWidget::setAsRoot() { m_isRootItem = true; // 根项不需要显示tip @@ -253,46 +236,21 @@ void CleanerResultItemWidget::setAsRoot() this->setFixedWidth(ROOT_NODE_WIDTH); } -void CleanerResultItemWidget::setAsChild() +void TrashCleanResultItemWidget::setAsChild() { // 缩小长度,与父级对齐右侧 this->setFixedWidth(CHILD_NODE_WIDTH); } -// 指向根项目的页面,以同步选中、非选中状态 -void CleanerResultItemWidget::setRoot(CleanerResultItemWidget *rootItem) -{ - m_root = rootItem; - if (rootItem != nullptr) { - m_isRootItem = false; - } -} - -// 控制根项目扫描显示界面样式 -// isStarted 为 true时,表示扫描开始 -void CleanerResultItemWidget::setWorkStarted(bool isStarted) +// 对于根项目,显示扫描总文件数与选中的文件大小 +// 对于子项目,只显示文件总大小 +void TrashCleanResultItemWidget::setScanResult(const QString &filesize) { - if (m_isRootItem) { - if (isStarted) { - // 显示spinner并转动 - m_spinner->start(); - m_spinner->show(); - setTailText(tr("Scanning...")); - - // 为根项重置勾选框 - m_checkBox->show(); - } else { - m_spinner->stop(); - m_spinner->hide(); - } - } - if (isStarted) { - m_checkBox->setDisabled(false); - } - m_isWorking = isStarted; + setTailText(tr("total %1, selected:").arg(filesize)); + setUsedSpace(filesize); } -void CleanerResultItemWidget::setUncheckable() +void TrashCleanResultItemWidget::setUncheckable() { if (m_isRootItem) { m_checkBox->hide(); @@ -300,64 +258,27 @@ void CleanerResultItemWidget::setUncheckable() m_checkBox->setDisabled(true); } - m_spinner->hide(); m_iconLable->hide(); } -// 对于根项目,显示扫描总文件数与选中的文件大小 -// 对于子项目,只显示文件总大小 -void CleanerResultItemWidget::setScanResult(uint account, const QString &filesize) +bool TrashCleanResultItemWidget::getCheckBoxEnable() { - setTailText(tr("%1 items, total %2, selected:").arg(account).arg(filesize)); - setUsedSpace(filesize); + return m_checkBox->isEnabled(); } -// 接收到检查项发出的prepare信号后 -// 初始化界面显示内容 -// 将所有相关的内容清空,以清除上一次扫描的结果 -// 将相关控件隐藏 -void CleanerResultItemWidget::prepare() +void TrashCleanResultItemWidget::checkBoxSelected() { - m_usageLabel->setText(""); - m_usageLabel->hide(); - m_tailLabel->setText(""); - m_tailLabel->hide(); - m_spinner->stop(); - m_spinner->hide(); - // 上一次可能被设置为已清理的状态 - m_iconLable->hide(); - m_checkBox->setChecked(true); - m_checkBox->setDisabled(true); - m_checkBox->show(); -} - -// 如果作为子项被选中,同步修改根项 -void CleanerResultItemWidget::childSelected() -{ - // 正在展示过程中,不响应“取消勾选” - // 同时重设勾选框状态 - if (m_isWorking) { - m_checkBox->setChecked(true); - return; - } - - if (!m_isRootItem) { - // 作为子项,通知上一级和下一次变化 - Q_EMIT childClicked(m_checkBox->checkState()); - } else { - // 作为根结点,设置全选或全反选 - Q_EMIT rootClicked(m_checkBox->checkState()); - } + Q_EMIT sendBoxClicked(m_checkBox->checkState()); } -void CleanerResultItemWidget::paintEvent(QPaintEvent *event) +void TrashCleanResultItemWidget::paintEvent(QPaintEvent *event) { resetElidedTextByFontChange(); DFrame::paintEvent(event); } // 在label被写入字符串或字体变化时,将超出label的文字部分写作为省略号 -void CleanerResultItemWidget::resetElidedTextByFontChange() +void TrashCleanResultItemWidget::resetElidedTextByFontChange() { if (m_isRootItem) { // 根项标题部分内容固定 diff --git a/deepin-pc-manager/src/window/modules/cleaner/widgets/cleanerresultitemwidget.h b/deepin-pc-manager/src/window/modules/trashclean/trashcleanresultitemwidget.h similarity index 50% rename from deepin-pc-manager/src/window/modules/cleaner/widgets/cleanerresultitemwidget.h rename to deepin-pc-manager/src/window/modules/trashclean/trashcleanresultitemwidget.h index 68e3f9a..053408a 100644 --- a/deepin-pc-manager/src/window/modules/cleaner/widgets/cleanerresultitemwidget.h +++ b/deepin-pc-manager/src/window/modules/trashclean/trashcleanresultitemwidget.h @@ -1,33 +1,21 @@ -// Copyright (C) 2020 ~ 2020 Deepin Technology Co., Ltd. // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later #pragma once -#include "dtkwidget_global.h" - #include #include +#include +#include -DWIDGET_BEGIN_NAMESPACE -class DLabel; -class DTipLabel; -class DSpinner; -DWIDGET_END_NAMESPACE DWIDGET_USE_NAMESPACE - -/** - * @brief The CleanerResultItemWidget class - * 为检查项模型提供界面 - * 展示被扫描项的状态 - */ -class CleanerResultItemWidget : public DFrame +class TrashCleanResultItemWidget : public DFrame { Q_OBJECT public: - explicit CleanerResultItemWidget(QWidget *parent = nullptr); - ~CleanerResultItemWidget(); + explicit TrashCleanResultItemWidget(QWidget *parent = nullptr); + ~TrashCleanResultItemWidget(); // 设置标题和提示 void setHeadText(const QString &text); @@ -50,38 +38,33 @@ class CleanerResultItemWidget : public DFrame void setAsRoot(); void setAsChild(); - void setRoot(CleanerResultItemWidget *rootItem); - void childSelected(); void rootSelected(); void resetElidedTextByFontChange(); -public Q_SLOTS: - // 作为根结点的工作状态启动 - void setWorkStarted(bool); - // 对于父项或根项,增加一个不可勾选的状态,以应对"未扫描完" 和 "所有项均被清理" + bool getCheckBoxEnable(); void setUncheckable(); - void setScanResult(uint, const QString &); - void prepare(); + +public Q_SLOTS: + void setScanResult(const QString &); + void checkBoxSelected(); Q_SIGNALS: - void childClicked(bool); - void rootClicked(bool); + void sendBoxClicked(bool); protected: void paintEvent(QPaintEvent *event); private: - bool m_isRootItem; // 作为根结点展示 - DCheckBox *m_checkBox; // 作为子项是否选中 - DLabel *m_iconLable; // 扫描结束使用小图标 - DLabel *m_headLabel; // 扫描项目名称 + bool m_isRootItem; // 作为根结点展示 + DCheckBox *m_checkBox; // 作为子项是否选中 + DLabel *m_iconLable; // 扫描结束使用小图标 + DLabel *m_headLabel; // 扫描项目名称 DTipLabel *m_headTipLabel; // 项目说明 - DTipLabel *m_tailLabel; // 状态标签 - DLabel *m_usageLabel; // 大小标签 - DSpinner *m_spinner; // 树首结点spinner + DTipLabel *m_tailLabel; // 状态标签 + DLabel *m_usageLabel; // 大小标签 DFrame *m_contentFrame; - CleanerResultItemWidget *m_root; // 根检查项的页面 + TrashCleanResultItemWidget *m_root; // 根检查项的页面 bool m_isWorking; // 由于需要对界面文字遮挡问题做出处理 diff --git a/deepin-pc-manager/src/window/modules/trashclean/trashcleanwidget.cpp b/deepin-pc-manager/src/window/modules/trashclean/trashcleanwidget.cpp new file mode 100644 index 0000000..9a42b25 --- /dev/null +++ b/deepin-pc-manager/src/window/modules/trashclean/trashcleanwidget.cpp @@ -0,0 +1,473 @@ +// Copyright (C) 2020 ~ 2020 Deepin Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "trashcleanwidget.h" +#include "trashcleanmodel.h" +#include "window/common/common.h" + +#include +#include + +TrashCleanWidget::TrashCleanWidget(TrashCleanModel *model, DWidget *parent) + : DWidget(parent) + , m_model(model) + , m_trashCleanHomePageWidget(nullptr) + , m_trashCleanResultPageWidget(nullptr) +{ + // 初始化UI + initUI(); +} + +TrashCleanWidget::~TrashCleanWidget() +{ +} + +// 初始化界面 +void TrashCleanWidget::initUI() +{ + // 主布局 + QHBoxLayout *mainLayout = new QHBoxLayout(this); + mainLayout->setContentsMargins(0, 0, 0, 0); + mainLayout->setSpacing(0); + + // 加载垃圾清理首页 + mainLayout->addWidget(getTrashCleanHomePage()); + // 加载垃圾清理结果页 + mainLayout->addWidget(getTrashCleanResultPage()); + + connect(m_sysItem, &TrashCleanConfigItem::stageChanged, this, &TrashCleanWidget::onItemStageChanged); + connect(m_hisItem, &TrashCleanConfigItem::stageChanged, this, &TrashCleanWidget::onItemStageChanged); + connect(m_scanBtn, &QPushButton::clicked, this, &TrashCleanWidget::showResultWidget); + connect(m_scanDoneButton, &QPushButton::clicked, this, &TrashCleanWidget::showHomeWidget); + connect(m_nowCleanButton, &QPushButton::clicked, this, &TrashCleanWidget::cleanTrashFiles); + connect(m_scanAgainButton, &QPushButton::clicked, this, &TrashCleanWidget::trashCleanAgianScan); + connect(m_systemItem, &TrashCleanResultItemWidget::sendBoxClicked, this, &TrashCleanWidget::trashCleanSystemItemChecked); + connect(m_systemTrashItem, &TrashCleanResultItemWidget::sendBoxClicked, this, &TrashCleanWidget::trashCleanSystemTrashItemChecked); + connect(m_systemCacheItem, &TrashCleanResultItemWidget::sendBoxClicked, this, &TrashCleanWidget::trashCleanSystemCacheItemChecked); + connect(m_systemLogItem, &TrashCleanResultItemWidget::sendBoxClicked, this, &TrashCleanWidget::trashCleanSystemLogItemChecked); + connect(m_hisInfoItem, &TrashCleanResultItemWidget::sendBoxClicked, this, &TrashCleanWidget::trashCleanHistoryItemChecked); + connect(m_hisInfoAppItem, &TrashCleanResultItemWidget::sendBoxClicked, this, &TrashCleanWidget::trashCleanHistoryInfoItemChecked); + + m_scanConfigList = {0, 0}; + m_sysItem->setCheckBoxStatus(true); + m_hisItem->setCheckBoxStatus(false); + m_trashCleanHomePageWidget->setVisible(true); + m_trashCleanResultPageWidget->setVisible(false); +} + +QWidget *TrashCleanWidget::getTrashCleanHomePage() +{ + m_trashCleanHomePageWidget = new QWidget(this); + + m_logo = new DLabel(this); + m_logo->setFixedSize(400, 220); + m_logo->setPixmap(QIcon::fromTheme("dcc_cleaner_greeting").pixmap(400, 220)); + + m_title = new DLabel(this); + m_title->setText(tr("Clean out junk files and free up disk space")); + QFont titleFont = m_title->font(); + titleFont.setWeight(QFont::Weight::DemiBold); + m_title->setFont(titleFont); + DFontSizeManager::instance()->bind(m_title, DFontSizeManager::T4); + + m_greeting = new DLabel(this); + m_greeting->setText(tr("Start cleaning now to refresh your computer")); + QFont greFont = m_greeting->font(); + greFont.setWeight(QFont::Normal); + m_greeting->setFont(greFont); + + m_sysItem = new TrashCleanConfigItem(this); + m_sysItem->setIconPath("dcc_cleaner_sys_icon"); + m_sysItem->setTitles(tr("System junk"), tr("Useless files created by the system")); + m_sysItem->setIndex(SYS_CONFIG_INDEX); + + m_hisItem = new TrashCleanConfigItem(this); + m_hisItem->setIconPath("dcc_cleaner_history_icon"); + m_hisItem->setTitles(tr("Traces"), tr("Activity traces of the system and applications")); + m_hisItem->setIndex(HISTORY_CONFIG_INDEX); + m_hisItem->setAccessibleName("tracesFrame"); + + m_scanBtn = new DSuggestButton(this); + QFont scanBtnFont = m_scanBtn->font(); + m_scanBtn->setFont(scanBtnFont); + m_scanBtn->setFixedSize(150, 36); + m_scanBtn->setText(tr("Scan Now", "button")); + m_scanBtn->setFocusPolicy(Qt::NoFocus); + + QGridLayout *mainLayout = new QGridLayout(m_trashCleanHomePageWidget); + mainLayout->setContentsMargins(0, 0, 0, 0); + mainLayout->setSpacing(0); + m_trashCleanHomePageWidget->setLayout(mainLayout); + + mainLayout->setColumnStretch(0, 107); + mainLayout->setColumnMinimumWidth(0, 107); + mainLayout->setColumnStretch(1, 516); + mainLayout->setColumnMinimumWidth(1, 516); + mainLayout->setColumnStretch(2, 147); + mainLayout->setColumnMinimumWidth(2, 147); + + mainLayout->setRowMinimumHeight(0, 230); + mainLayout->addWidget(m_logo, 0, 0, 1, -1, Qt::AlignBottom | Qt::AlignHCenter); + mainLayout->setRowMinimumHeight(1, 54); + mainLayout->addWidget(m_title, 1, 0, 1, -1, Qt::AlignCenter); + mainLayout->setRowMinimumHeight(2, 24); + mainLayout->addWidget(m_greeting, 2, 0, 1, -1, Qt::AlignCenter); + mainLayout->setRowMinimumHeight(3, 22); + + mainLayout->setRowMinimumHeight(4, 42); + mainLayout->setRowMinimumHeight(5, 42); + mainLayout->setRowMinimumHeight(6, 42); + mainLayout->addWidget(m_sysItem, 4, 1); + mainLayout->addWidget(m_hisItem, 5, 1); + + mainLayout->setRowStretch(6, 100); + mainLayout->setRowMinimumHeight(6, 88); + mainLayout->addWidget(m_scanBtn, 6, 0, 1, -1, Qt::AlignCenter); + + mainLayout->setRowMinimumHeight(8, 4); + + return m_trashCleanHomePageWidget; +} + +QWidget *TrashCleanWidget::getTrashCleanResultPage() +{ + m_trashCleanResultPageWidget = new QWidget(this); + + QVBoxLayout *mainLayout = new QVBoxLayout(m_trashCleanResultPageWidget); + mainLayout->setContentsMargins(10, 10, 10, 10); + mainLayout->setSpacing(10); + m_trashCleanResultPageWidget->setLayout(mainLayout); + + // 上部分标题视图绘制 + m_headerItem = new TrashCleanResultHeaderItem(this); + mainLayout->addWidget(m_headerItem, 0, Qt::AlignCenter); + + // 表格 + m_treeWidget = new DTreeWidget(this); + m_treeWidget->setAccessibleName("centerResultFrame_treeWidget"); + m_treeWidget->setFixedSize(750, 368); + m_treeWidget->setFrameShape(QFrame::NoFrame); + m_treeWidget->setIndentation(16); + m_treeWidget->setSelectionMode(QAbstractItemView::SelectionMode::NoSelection); + m_treeWidget->setBackgroundRole(QPalette::Window); + m_treeWidget->setHeaderHidden(true); + m_treeWidget->setColumnCount(1); + m_treeWidget->setFocusPolicy(Qt::NoFocus); + m_delegate = new TCTableDelegateTree(this); + m_treeWidget->setItemDelegate(m_delegate); + mainLayout->addWidget(m_treeWidget, 0, Qt::AlignCenter); + + // 系统垃圾 + m_systemItem = new TrashCleanResultItemWidget(this); + m_systemItem->setAsRoot(); + m_systemItem->setHeadText(tr("System junk")); + m_treeSystemItem = new QTreeWidgetItem(m_treeWidget); + m_treeSystemItem->setData(0, Qt::DisplayRole, ""); + m_treeWidget->setItemWidget(m_treeSystemItem, 0, m_systemItem); + m_treeSystemItem->setHidden(true); + + // 系统垃圾 -回收站 + m_systemTrashItem = new TrashCleanResultItemWidget(this); + m_systemTrashItem->setAsChild(); + m_systemTrashItem->setHeadText(tr("Trash")); + m_systemTrashItem->setHeadTipText(tr("Make sure all files in the trash can be deleted")); + QTreeWidgetItem *itemTrashWidget = new QTreeWidgetItem(); + itemTrashWidget->setData(0, Qt::DisplayRole, ""); + m_treeWidget->topLevelItem(0)->addChild(itemTrashWidget); + m_treeWidget->setItemWidget(itemTrashWidget, 0, m_systemTrashItem); + + // 系统垃圾 -缓存 + m_systemCacheItem = new TrashCleanResultItemWidget(this); + m_systemCacheItem->setAsChild(); + m_systemCacheItem->setHeadText(tr("System caches")); + m_systemCacheItem->setHeadTipText(tr("Caches created by the system")); + QTreeWidgetItem *itemCacheWidget = new QTreeWidgetItem(); + itemCacheWidget->setData(0, Qt::DisplayRole, ""); + m_treeWidget->topLevelItem(0)->addChild(itemCacheWidget); + m_treeWidget->setItemWidget(itemCacheWidget, 0, m_systemCacheItem); + + // 系统垃圾 -日志 + m_systemLogItem = new TrashCleanResultItemWidget(this); + m_systemLogItem->setAsChild(); + m_systemLogItem->setHeadText(tr("System logs")); + m_systemLogItem->setHeadTipText(tr("Log files created by the system")); + QTreeWidgetItem *itemLogWidget = new QTreeWidgetItem(); + itemLogWidget->setData(0, Qt::DisplayRole, ""); + m_treeWidget->topLevelItem(0)->addChild(itemLogWidget); + m_treeWidget->setItemWidget(itemLogWidget, 0, m_systemLogItem); + + // 痕迹信息 + m_hisInfoItem = new TrashCleanResultItemWidget(this); + m_hisInfoItem->setAsRoot(); + m_hisInfoItem->setHeadText("Traces"); + m_treeHisInfoItem = new QTreeWidgetItem(m_treeWidget); + m_treeHisInfoItem->setData(0, Qt::DisplayRole, ""); + m_treeWidget->setItemWidget(m_treeHisInfoItem, 0, m_hisInfoItem); + m_treeHisInfoItem->setHidden(true); + + // 痕迹信息 -系统和应用痕迹 + m_hisInfoAppItem = new TrashCleanResultItemWidget(this); + m_hisInfoAppItem->setAsChild(); + m_hisInfoAppItem->setHeadText(tr("System and Application traces")); + QTreeWidgetItem *itemHisInfoAppWidget = new QTreeWidgetItem(); + itemHisInfoAppWidget->setData(0, Qt::DisplayRole, ""); + m_treeWidget->topLevelItem(1)->addChild(itemHisInfoAppWidget); + m_treeWidget->setItemWidget(itemHisInfoAppWidget, 0, m_hisInfoAppItem); + + mainLayout->addStretch(); + + QHBoxLayout *layout = new QHBoxLayout; + layout->setContentsMargins(0, 0, 0, 0); + layout->setSpacing(10); + layout->addStretch(); + // 完成按钮 + m_scanDoneButton = new DPushButton(this); + m_scanDoneButton->setFixedSize(QSize(150, 36)); + m_scanDoneButton->setText(tr("Done", "button")); + layout->addWidget(m_scanDoneButton); + + // 清理按钮 + m_nowCleanButton = new DSuggestButton(this); + m_nowCleanButton->setFixedSize(QSize(150, 36)); + m_nowCleanButton->setText(tr("Clean Up")); + layout->addWidget(m_nowCleanButton); + + m_scanAgainButton = new DSuggestButton(this); + m_scanAgainButton->setFixedSize(QSize(150, 36)); + m_scanAgainButton->setText(tr("Scan Again")); + layout->addWidget(m_scanAgainButton); + mainLayout->addLayout(layout); + + return m_trashCleanResultPageWidget; +} + +void TrashCleanWidget::onItemStageChanged(int id, int stage) +{ + if (id < 0 || id > m_scanConfigList.length() - 1) { + return; + } + m_scanConfigList[id] = stage; + m_scanBtn->setDisabled(m_scanConfigList.count(Qt::Unchecked) == m_scanConfigList.length()); +} + +void TrashCleanWidget::showResultWidget() +{ + // 初始化垃圾清理界面显示 + m_trashCleanHomePageWidget->setVisible(false); + m_trashCleanResultPageWidget->setVisible(true); + m_nowCleanButton->setVisible(true); + m_scanAgainButton->setVisible(false); + + // 初始化垃圾文件大小 + m_trashFileCount = 0.00; + m_cacheFileCount = 0.00; + m_logFileCount = 0.00; + m_historyFileCount = 0.00; + + // 初始化检测结果界面 + if (m_scanConfigList[SYS_CONFIG_INDEX]) { + m_trashFileCount = m_model->getTrashFileCount(); + m_cacheFileCount = m_model->getCacheFileCount(); + m_logFileCount = m_model->getLogFileCount(); + m_treeSystemItem->setHidden(false); + + m_systemItem->setScanResult(fileSizeToString(quint64(m_trashFileCount + m_cacheFileCount + m_logFileCount))); + m_systemTrashItem->setScanResult(fileSizeToString(quint64(m_trashFileCount))); + m_systemCacheItem->setScanResult(fileSizeToString(quint64(m_cacheFileCount))); + m_systemLogItem->setScanResult(fileSizeToString(quint64(m_logFileCount))); + + double systemTrashCount = m_trashFileCount + m_cacheFileCount + m_logFileCount; + if (systemTrashCount < 1) { + m_systemItem->setUncheckable(); + m_systemItem->setCheckBoxStatus(false); + } + if (m_trashFileCount < 1) { + m_systemTrashItem->setUncheckable(); + m_systemTrashItem->setCheckBoxStatus(false); + } + if (m_cacheFileCount < 1) { + m_systemCacheItem->setUncheckable(); + m_systemCacheItem->setCheckBoxStatus(false); + } + if (m_logFileCount < 1) { + m_systemLogItem->setUncheckable(); + m_systemLogItem->setCheckBoxStatus(false); + } + } + if (m_scanConfigList[HISTORY_CONFIG_INDEX]) { + m_historyFileCount = m_model->getHistoryFileCount(); + m_treeHisInfoItem->setHidden(false); + + m_hisInfoItem->setScanResult(fileSizeToString(quint64(m_historyFileCount))); + m_hisInfoAppItem->setScanResult(fileSizeToString(quint64(m_historyFileCount))); + + if (m_historyFileCount < 1) { + m_hisInfoItem->setUncheckable(); + m_hisInfoItem->setCheckBoxStatus(false); + m_hisInfoAppItem->setUncheckable(); + m_hisInfoAppItem->setCheckBoxStatus(false); + } + } + + // 初始化结果页头部信息 + double count = m_trashFileCount + m_cacheFileCount + m_logFileCount + m_historyFileCount; + m_headerItem->setLogo("dcc_cleaner_scanned"); + QString resultStr = tr("%1 junk files, %2 selected") + .arg(fileSizeToString(quint64(count))) + .arg(fileSizeToString(quint64(count))); + m_headerItem->setTitle(resultStr); + + // 检测结果展开 + m_treeWidget->expandAll(); +} + +void TrashCleanWidget::showHomeWidget() +{ + m_trashCleanHomePageWidget->setVisible(true); + m_trashCleanResultPageWidget->setVisible(false); +} + +void TrashCleanWidget::cleanTrashFiles() +{ + double cleanSize = 0.00; + QStringList itemList; + + if (m_systemItem->getCheckBoxStatus()) { + m_systemItem->setUncheckable(); + m_systemItem->setScanResult(fileSizeToString(0)); + } + if (m_systemTrashItem->getCheckBoxStatus()) { + itemList.append(TRASH_CLEAN_ITEM_TYPE_TRASH); + cleanSize += m_trashFileCount; + m_systemTrashItem->setCleanDone(); + } + if (m_systemCacheItem->getCheckBoxStatus()) { + itemList.append(TRASH_CLEAN_ITEM_TYPE_CACHE); + cleanSize += m_cacheFileCount; + m_systemCacheItem->setCleanDone(); + } + if (m_systemLogItem->getCheckBoxStatus()) { + itemList.append(TRASH_CLEAN_ITEM_TYPE_LOG); + cleanSize += m_logFileCount; + m_systemLogItem->setCleanDone(); + } + if (m_hisInfoItem->getCheckBoxStatus()) { + m_hisInfoItem->setUncheckable(); + m_hisInfoItem->setScanResult(fileSizeToString(0)); + } + if (m_hisInfoItem->getCheckBoxStatus()) { + itemList.append(TRASH_CLEAN_ITEM_TYPE_HISTORY); + cleanSize += m_historyFileCount; + m_hisInfoItem->setCleanDone(); + } + + if (itemList.count()) { + m_model->cleanTrashFile(itemList); + } + + // 清理完成 + m_headerItem->setLogo("dcc_cleaner_cleaned"); + QString titleInfo = tr("%1 removed").arg(fileSizeToString(quint64(cleanSize))); + m_headerItem->setCleanFinished(titleInfo, ""); + + m_nowCleanButton->setVisible(false); + m_scanAgainButton->setVisible(true); +} + +void TrashCleanWidget::trashCleanAgianScan() +{ + showResultWidget(); +} + +QString TrashCleanWidget::fileSizeToString(quint64 filesize) +{ + QStringList unit; + unit << "Byte" + << "KB" + << "MB" + << "GB"; + + double quotient = 0; + + // 以1024为单位换算 + int i = 0; + while (1024 <= filesize && i < unit.size() - 1) { + quotient = filesize % 1024; + filesize /= 1024; + i++; + } + + double size = quotient / 1024 + filesize; + // 输出时,如果有小数,保留两位 + return QString("%1 %2").arg(QString::number(size, 'f', 2)).arg(unit[i]); +} + +void TrashCleanWidget::trashCleanSystemItemChecked(bool status) +{ + if (m_systemTrashItem->getCheckBoxEnable()) { + m_systemTrashItem->setCheckBoxStatus(status); + } + if (m_systemCacheItem->getCheckBoxEnable()) { + m_systemCacheItem->setCheckBoxStatus(status); + } + if (m_systemLogItem->getCheckBoxEnable()) { + m_systemLogItem->setCheckBoxStatus(status); + } +} +void TrashCleanWidget::trashCleanSystemTrashItemChecked(bool status) +{ + Q_UNUSED(status); + m_systemItem->setCheckBoxStatus(trashCleanItemAllStatus()); +} +void TrashCleanWidget::trashCleanSystemCacheItemChecked(bool status) +{ + Q_UNUSED(status); + m_systemItem->setCheckBoxStatus(trashCleanItemAllStatus()); +} +void TrashCleanWidget::trashCleanSystemLogItemChecked(bool status) +{ + Q_UNUSED(status); + m_systemItem->setCheckBoxStatus(trashCleanItemAllStatus()); +} +bool TrashCleanWidget::trashCleanItemAllStatus() +{ + bool status = false; + if (m_systemTrashItem->getCheckBoxStatus() || m_systemCacheItem->getCheckBoxStatus() || m_systemLogItem->getCheckBoxStatus()) { + status = true; + } + return status; +} + +void TrashCleanWidget::trashCleanHistoryItemChecked(bool status) +{ + if (m_hisInfoAppItem->getCheckBoxEnable()) { + m_hisInfoAppItem->setCheckBoxStatus(status); + } +} +void TrashCleanWidget::trashCleanHistoryInfoItemChecked(bool status) +{ + m_hisInfoItem->setCheckBoxStatus(status); +} + +// 代理函数 +TCTableDelegateTree::TCTableDelegateTree(QObject *parent) + : QItemDelegate(parent) +{ +} + +// 重绘操作 +void TCTableDelegateTree::paint(QPainter *painter, + const QStyleOptionViewItem &option, + const QModelIndex &index) const +{ + Q_UNUSED(painter); + Q_UNUSED(option); + Q_UNUSED(index); +} + +void TrashCleanWidget::paintEvent(QPaintEvent *event) +{ + QWidget::paintEvent(event); +} diff --git a/deepin-pc-manager/src/window/modules/trashclean/trashcleanwidget.h b/deepin-pc-manager/src/window/modules/trashclean/trashcleanwidget.h new file mode 100644 index 0000000..e3fb0f8 --- /dev/null +++ b/deepin-pc-manager/src/window/modules/trashclean/trashcleanwidget.h @@ -0,0 +1,109 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "trashcleanconfigitem.h" +#include "trashcleanresultheaderitem.h" +#include "trashcleanresultitemwidget.h" + +#include +#include +#include +#include +#include +#include +#include + +#include + +#define SYS_CONFIG_INDEX 0 +#define HISTORY_CONFIG_INDEX 1 + +DWIDGET_USE_NAMESPACE +class TrashCleanModel; + +/* 添加树表代理 */ +class TCTableDelegateTree : public QItemDelegate +{ + Q_OBJECT +public: + explicit TCTableDelegateTree(QObject *parent = nullptr); + + virtual ~TCTableDelegateTree() {} + + // 重绘 + void paint(QPainter *painter, + const QStyleOptionViewItem &option, + const QModelIndex &index) const; +}; + +class TrashCleanWidget : public QWidget +{ + Q_OBJECT + +public: + explicit TrashCleanWidget(TrashCleanModel *model, DWidget *parent = nullptr); + ~TrashCleanWidget(); + +private: + // 初始化界面 + void initUI(); + QWidget *getTrashCleanHomePage(); + QWidget *getTrashCleanResultPage(); + + // 将文件大小由BYTE转换为KB MB GB,最多保留两位小数 + static QString fileSizeToString(quint64 filesize); + +public Q_SLOTS: + void onItemStageChanged(int, int); + void showResultWidget(); + void showHomeWidget(); + void cleanTrashFiles(); + void trashCleanAgianScan(); + void trashCleanSystemItemChecked(bool status); + void trashCleanSystemTrashItemChecked(bool status); + void trashCleanSystemCacheItemChecked(bool status); + void trashCleanSystemLogItemChecked(bool status); + void trashCleanHistoryItemChecked(bool status); + void trashCleanHistoryInfoItemChecked(bool status); + bool trashCleanItemAllStatus(); + +protected: + void paintEvent(QPaintEvent *event); + +private: + TrashCleanModel *m_model; + double m_trashFileCount; + double m_cacheFileCount; + double m_logFileCount; + double m_historyFileCount; + + QWidget *m_trashCleanHomePageWidget; + DLabel *m_logo; + DLabel *m_title; + DLabel *m_greeting; + TrashCleanConfigItem *m_sysItem; + TrashCleanConfigItem *m_hisItem; + DSuggestButton *m_scanBtn; + QList m_scanConfigList; + + QWidget *m_trashCleanResultPageWidget; + TrashCleanResultHeaderItem *m_headerItem; + DTreeWidget *m_treeWidget; + TrashCleanResultItemWidget *m_systemItem; + QTreeWidgetItem *m_treeSystemItem; + TrashCleanResultItemWidget *m_systemTrashItem; + TrashCleanResultItemWidget *m_systemCacheItem; + TrashCleanResultItemWidget *m_systemLogItem; + TrashCleanResultItemWidget *m_hisInfoItem; + QTreeWidgetItem *m_treeHisInfoItem; + TrashCleanResultItemWidget *m_hisInfoAppItem; + DPushButton *m_scanDoneButton; + DSuggestButton *m_nowCleanButton; + DSuggestButton *m_scanAgainButton; + + // 表格代理 + TCTableDelegateTree *m_delegate; +}; diff --git a/deepin-pc-manager/src/window/namespace.h b/deepin-pc-manager/src/window/namespace.h deleted file mode 100644 index 5bd7d1b..0000000 --- a/deepin-pc-manager/src/window/namespace.h +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#define DEF_NAMESPACE_BEGIN - -#define DEF_NAMESPACE_END - -#define DEF_USING_NAMESPACE - -#define DEF_ANTIVIRUS_NAMESPACE_BEGIN - -#define DEF_ANTIVIRUS_NAMESPACE_END - -#define DEF_USING_ANTIVIRUS_NAMESPACE - -#define DEF_NETPROTECTION_NAMESPACE_BEGIN - -#define DEF_NETPROTECTION_NAMESPACE_END - -#define DEF_USING_NETPROTECTION_NAMESPACE diff --git a/deepin-pc-manager/src/window/restartdefenderdialog.cpp b/deepin-pc-manager/src/window/restartdefenderdialog.cpp deleted file mode 100644 index 4675179..0000000 --- a/deepin-pc-manager/src/window/restartdefenderdialog.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (C) 2020 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "restartdefenderdialog.h" - -#include "modules/common/invokers/invokerfactory.h" - -#include - -#define RESTART_CANCEL 0 // 弹框第一个按钮 -#define RESTART_OK 1 // 弹框第二个按钮 - -RestartDefenderDialog::RestartDefenderDialog(DDialog *parent) - : DDialog(parent) - , m_daemonservice(nullptr) -{ - // 安全中心心跳服务 - m_daemonservice = - InvokerFactory::GetInstance().CreateInvoker("com.deepin.pc.manager.daemonservice", - "/com/deepin/pc/manager/daemonservice", - "com.deepin.pc.manager.daemonservice", - ConnectType::SESSION, - this); - // 初始化界面 - initUi(); -} - -// 初始化界面 -void RestartDefenderDialog::initUi() -{ - setMinimumSize(QSize(200, 100)); - // 弹框样式 - setCloseButtonVisible(true); - this->setWindowFlag(Qt::WindowStaysOnTopHint); - this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - this->setModal(true); - - // 清除布局 - clearContents(); - clearButtons(); - setIcon(QIcon::fromTheme("deepin-pc-manager")); - - // 添加弹框文字 - DLabel *txt = nullptr; - txt = new DLabel(tr("Changes will take effect after the application restarts"), this); - // 字体剧中 - txt->setAlignment(Qt::AlignCenter); - txt->setWordWrap(true); - - // 添加布局 - addContent(txt); - addButton(tr("Cancel", "button")); - addButton(tr("Restart", "button")); - - // 按钮点击信号槽 - connect(this, - &RestartDefenderDialog::buttonClicked, - this, - &RestartDefenderDialog::doButtonClicked); -} - -RestartDefenderDialog::~RestartDefenderDialog() -{ - Q_EMIT onDialogClose(); -} - -// 按钮点击槽 -void RestartDefenderDialog::doButtonClicked(int index, const QString &text) -{ - Q_UNUSED(text); - if (index == RESTART_OK) { - Q_EMIT onRestartClose(); - } -} diff --git a/deepin-pc-manager/src/window/restartdefenderdialog.h b/deepin-pc-manager/src/window/restartdefenderdialog.h deleted file mode 100644 index 83a0967..0000000 --- a/deepin-pc-manager/src/window/restartdefenderdialog.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (C) 2020 ~ 2021 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef RESTARTDEFENDERDIALOG_H -#define RESTARTDEFENDERDIALOG_H - -#include - -// 心跳服务 -class DBusInvokerInterface; - -DWIDGET_USE_NAMESPACE - -class RestartDefenderDialog : public DTK_WIDGET_NAMESPACE::DDialog -{ - Q_OBJECT -public: - explicit RestartDefenderDialog(DDialog *parent = nullptr); - ~RestartDefenderDialog() override; - -private: - // 初始化界面 - void initUi(); - -Q_SIGNALS: - // 发送重启信号 - void onRestartClose(); - // 弹框关闭信号 - void onDialogClose(); - -private Q_SLOTS: - // 按钮点击槽 - void doButtonClicked(int index, const QString &text); - -private: - DBusInvokerInterface *m_daemonservice; // 心跳接口 -}; - -#endif // RESTARTDEFENDERDIALOG_H diff --git a/deepin-pc-manager/src/window/utils.h b/deepin-pc-manager/src/window/utils.h deleted file mode 100644 index 5077d51..0000000 --- a/deepin-pc-manager/src/window/utils.h +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (C) 2011 ~ 2019 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef V20_DISPLAY_UTILS_H -#define V20_DISPLAY_UTILS_H - -#include "namespace.h" - -#include -#include - -Q_DECLARE_METATYPE(QMargins) - -DEF_NAMESPACE_BEGIN - -// const QMargins ThirdPageContentsMargins(10, 10, 10, 10); -const QMargins ThirdPageContentsMargins(0, 0, 0, 0); -const QMargins ListViweItemMargin(10, 8, 10, 8); -const QVariant VListViewItemMargin = QVariant::fromValue(ListViweItemMargin); -const QMargins ListViweRightSubscriptItemMargin(42, 0, 0, 8); -const QVariant VListViewRightSubscripItemMargin = - QVariant::fromValue(ListViweRightSubscriptItemMargin); -const int List_Interval = 10; -DEF_NAMESPACE_END - -#endif // V20_DISPLAY_UTILS_H diff --git a/deepin-pc-manager/src/widgets/multiselectlistview.cpp b/deepin-pc-manager/src/window/widgets/multiselectlistview.cpp similarity index 100% rename from deepin-pc-manager/src/widgets/multiselectlistview.cpp rename to deepin-pc-manager/src/window/widgets/multiselectlistview.cpp diff --git a/deepin-pc-manager/src/widgets/multiselectlistview.h b/deepin-pc-manager/src/window/widgets/multiselectlistview.h similarity index 100% rename from deepin-pc-manager/src/widgets/multiselectlistview.h rename to deepin-pc-manager/src/window/widgets/multiselectlistview.h diff --git a/deepin-pc-manager/toolinfo.json b/deepin-pc-manager/toolinfo.json deleted file mode 100644 index e0dc742..0000000 Binary files a/deepin-pc-manager/toolinfo.json and /dev/null differ diff --git a/deepin-pc-manager/toolinfo.json.license b/deepin-pc-manager/toolinfo.json.license deleted file mode 100644 index b0d75e4..0000000 --- a/deepin-pc-manager/toolinfo.json.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. - -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/deepin-pc-manager/translate_ts2desktop.sh b/deepin-pc-manager/translate_ts2desktop.sh deleted file mode 100755 index d420cb5..0000000 --- a/deepin-pc-manager/translate_ts2desktop.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -# SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -# -# SPDX-License-Identifier: GPL-3.0-or-later - -DESKTOP_TEMP_FILE=deepin-defender-nativirus.desktop.tmp -DESKTOP_SOURCE_FILE=deepin-defender-nativirus.desktop - -DESKTOP_TS_DIR=translations/scandesktop/ - -/usr/bin/deepin-desktop-ts-convert ts2desktop $DESKTOP_SOURCE_FILE $DESKTOP_TS_DIR $DESKTOP_TEMP_FILE -mv $DESKTOP_TEMP_FILE $DESKTOP_SOURCE_FILE diff --git a/deepin-pc-manager/translations/deepin-pc-manager_en_US.qm b/deepin-pc-manager/translations/deepin-pc-manager_en_US.qm index 937ea3e..9dad8df 100644 Binary files a/deepin-pc-manager/translations/deepin-pc-manager_en_US.qm and b/deepin-pc-manager/translations/deepin-pc-manager_en_US.qm differ diff --git a/deepin-pc-manager/translations/deepin-pc-manager_en_US.ts b/deepin-pc-manager/translations/deepin-pc-manager_en_US.ts index 5c241a0..3cd6e6b 100644 --- a/deepin-pc-manager/translations/deepin-pc-manager_en_US.ts +++ b/deepin-pc-manager/translations/deepin-pc-manager_en_US.ts @@ -2,1448 +2,613 @@ - AVCPULimitation - - - Energy-saving mode - - - - - Virus scan takes a longer time in this mode - - - - - CleanerResultItemWidget - - - Removed - - - - - Scanning... - - - - - %1 items, total %2, selected: - - - - - DDropdown - - - All - - - - - Installed - - - - - Not installed - - - - - DefSecurityToolsFrontUnit - - - Supported by %1 - - - - - Open - button - - - - - Update - button - - - - - Install - button - - - - - UnInstall - button - - - - - Startup Programs - - - - - Network Detection - - - - - Manage auto-startup programs - - - - - One-click detection, comprehensive network troubleshooting - - - - - Failed to install the tool. Please try later. - - - - - Failed to update the tool. Please try later. - - - - - Failed to uninstall the tool. Please try later. - - - - - DialogManage - - - A task is in process, please update later - - - - - OK - button - - - - - Quick scanning on the Full Check page, please try later - - - - - Threats are found on the Full Check page, please go to remove them first - - - - - Fixing issues on the Full Check page, please try later - - - - - - Scanning virus, please try later - - - - - Scanning USB devices, please try later - - - - - Updating the virus database, please try later - - - - - Please check your network and update again - - - - - - OK - - - - - Trying to update the virus database, please make sure its server address is correct - - - - - HomePage - - - - - - - Check Now - - - - - - - - Last Result: <font color=%1>%2</font> points - - - - - Checked %1 days ago - - - - - HomePageCheckWidget - - - - Startup programs - - - - - Startup programs checking dismissed - - - - - Startup programs checking resumed - - - - - - Remote access (SSH) - - - - - Remote access (SSH): OFF - - - - - - System version - - - - - - System cleanup - - - - - Developer mode checking dismissed - - - - - - Fix All - - - - - points - - - - - Cancel - button - - - - - Back - button - - - - - Check Again - - - - - Done - button - - - - - - Disk checking - - - - - - Developer mode - - - - - - - - - - Scanning... - - - - - - - - - Waiting - - - - - - <font color=%1>%2 apps</font> - - - - - - Dismissed - - - - - Open - - - - - Closed - - - - - Out of date - - - - - Up to date - - - - - There are junk files - - - - - Clean - - - - - Found errors - - - - - No errors found - - - - - Root access allowed, which is risky - - - - - No root access - - - - - - - - - Fixed - - - - - Check up - - - - - - Dismiss - - - - - No dismission - - - - - Close it - - - - - Check for updates - - - - - Clean up - - - - - Go to check - - - - - - - - <font color=%1>%2</font> issue(s) found - - - - - Junk files cleaned up - - - - - Disk errors checked - - - - - %1 issues found in %2 - - - - - HomePageModel - - - Startup programs checked - - - - - System updated - - - - - MainWindow - - - Settings - - - - - Report issues - - - - - Full Check - - - - - Cleanup - - - - - Tools - - - - - - Security Center - - - - - - Exit - - - - - Minimize to system tray - - - - - Do not ask again - - - - - Please choose your action - - - - - Cancel - button - - - - - Confirm - button - - - - - QObject - - - Minimize to system tray - - - - - Exit - - - - - Ask me always - - - - - Basic - - - - - Close Main Window - - - - - PC Manager - - - - - RestartDefenderDialog - - - Changes will take effect after the application restarts - - - - - Cancel - button - - - - - Restart - button - - - - - SearchLineEdit - - - Search - - - - - SecurityToolsWidget - - - All - - - - - System - - - - - Network - - - - - Data - - - - - Apps - - - - - Devices - - - - - No tools found - - - - - SystemCheckDocument - - - points - - - - - Fixing - - - - - Checking - - - - - Your computer is - - - - - at risk - - - - - at high risk - - - - - - Your computer is healthy - - - - - Your computer is in good condition - - - - - Your computer is at risk - - - - - Your computer is at high risk - - - - - Your computer has not been checked for a long time - - - - - Your computer has not been checked yet - - - - - - Great! Keep staying healthy please. - - - - - Start a check and perform some improvements. - - - - - Please check your system now. - - - - - It is strongly recommended to check and fix your system now. - - - - - Have a new check right now. - - - - - Try a full check. - - - - - %1 issue(s) found - - - - - Fix issues right now to keep your computer healthy. - - - - - Fixing issues - - - - - It will be completed soon. - - - - - fixing - - - - - Viruses and Trojans - - - - - Database version - - + MainWindow - - Remote access (SSH) + + Service Support - - Disk checking + + Settings - - System cleanup + + + + Deepin PC Manager - - System version + + + Exit - - Developer mode + + Full Check - - Startup programs + + Cleanup - - No threats found + + Toolbox - - - Up to date + + Minimize to system tray - - Closed + + Do not ask again - - No errors found + + Please choose your action - - Clean + + Cancel + button - - No root access + + Confirm + button + + + QObject - - - %1 apps + + Minimize to system tray - - Found threats + + Exit - - - Out of date + + Ask me always - - Open + + Basic - - Found errors + + Close Main Window - - There are junk files + + PC Manager + + + SysCheckResultHeaderWidget - - Root access allowed, which is risky + + + Your computer is healthy - - Fix now + + + Great! Keep staying healthy please. - - Update now + + %1 issue(s) found - - Close it + + Fix issues right now to keep your computer healthy. - - Go to check + + Fixing issues - - Clean up + + It will be completed soon. - - Check for updates + + points + + + SysCheckResultItemWidget - + + Check up - - Scanning viruses and Trojans - - - - - Checking the version of virus database + + + + + + + + + %1 apps - - Checking the state of remote access (SSH) + + Check for updates - - Checking disks + + Out of date - - Checking system junk + + Clean up - - Checking if your system is up to date + + There are junk files - - Checking if the developer mode is enabled + + Go to check - - Checking startup programs + + Found errors - - Check Again + + + Root access allowed, which is risky - - Fix All + + + Up to date - - Done - button + + + Clean - - Dismiss + + + No errors found - - No dismission + + + + No root access - - Startup programs checking dismissed + + Fixing - - Startup programs checking resumed + + Disk checking - - Developer mode checking dismissed + + System cleanup - - Viruses and Trojans processed + + System version - - Virus database updated + + Developer mode - - Junk files cleaned up + + + Startup programs - - Disk errors checked + + Dismiss - - %1 issues found in %2 + + No dismission - TrashCleanGreetingWidget - - - Last clean: %1 - - + SystemCheckModel - - - Start cleaning now to refresh your computer + + Startup programs - - Clean out junk files and free up disk space + + System version - - System junk + + System cleanup - - Useless files created by the system + + Disk checking - - Application junk + + Developer mode + + + SystemCheckWidget - - Unneeded files created by applications + + Fix All - - Traces + + Done + button - - Activity traces of the system and applications + + Check Again - - Cookies + + + Your computer has not been checked yet - - Cookies from Internet browsers + + Try a full check. - - Scan Now - button + + + + + + Check Now - - - TrashCleanResultHeaderItem - - Scanned: %1 files + + + + + Last Result: <font color=%1>%2</font> points - - Scanning: %1 + + Your computer is healthy - - %1 junk files, %2 selected + + Great! Keep staying healthy please. - - - TrashCleanResultWidget - - Scan Now - buton + + Start a check and perform some improvements. - - - Cancel - button + + Your computer is in good condition - - Scan Now - button + + Please check your system now. - - System junk + + + Your computer is - - Application junk + + at risk - - Traces + + It is strongly recommended to check and fix your system now. - - Cookies + + at high risk - - Trash + + Checked %1 days ago - - Make sure all files in the trash can be deleted + + Have a new check right now. - - System caches + + Your computer has not been checked for a long time - - Caches created by the system + + Checking - - System logs + + + Checking startup programs - - Log files created by the system + + Checking if your system is up to date - - System and Application traces + + Checking system junk - - Cache and log files + + Checking disks - - Residual files + + Checking if the developer mode is enabled + + + ToolBoxItemWidget - - %1 junk files, %2 selected + + Open + + + ToolBoxWidget - - Scanned: %1 files + + All - - Clean out junk files and free up disk space + + System - - Initializing + + Network - - - Time elapsed %1:%2:%3 + + Repair - - Clean Up - button + + Apps - - - Scan Again - button + + Devices + + + TrashCleanResultHeaderItem - - - Done - button + + Scanned: %1 files - - Scanned: %1 files, junk files: %2 + + Scanning: %1 - - Removed: %1 junk files + + %1 junk files, %2 selected + + + TrashCleanResultItemWidget - - - %1 removed + + Removed - - - Cleaned: %1 files + + total %1, selected: TrashCleanWidget - - + Clean out junk files and free up disk space - - + Start cleaning now to refresh your computer - - + + System junk - + Useless files created by the system - - - Application junk - - - - - Unneeded files created by applications - - - - - + Traces - + Activity traces of the system and applications - - - Cookies - - - - - Cookies from Internet browsers - - - - - - + Scan Now + button - + Trash - + Make sure all files in the trash can be deleted - + System caches - + Caches created by the system - + System logs - + Log files created by the system - + System and Application traces - - Cache and log files - - - - - Residual files - - - - - Scanning: %1 - - - - - %1 junk files, %2 selected - - - - - Scanned: %1 files - - - - - Last clean: %1 - - - - - Initializing - - - - - - Cancel - button - - - - - - Time elapsed %1:%2:%3 - - - - - Back + + Done button - + Clean Up - - Scanned: %1 files, junk files: %2 - - - - - Removed: %1 junk files - - - - + Scan Again - - Done - button + + %1 junk files, %2 selected - - + %1 removed - - - - Cleaned: %1 files - - - - - UpdateAddressItem - - - Virus database server address - - - - - VirusWhitelistScanItem - - - (Files in the whitelist will be excluded from virus scan) - - main - + Deepin PC Manager is an application tool designed to help users quickly manage, maintain, and optimize computer systems. diff --git a/deepin-pc-manager/translations/deepin-pc-manager_zh_CN.qm b/deepin-pc-manager/translations/deepin-pc-manager_zh_CN.qm index f7c053c..34d9a74 100644 Binary files a/deepin-pc-manager/translations/deepin-pc-manager_zh_CN.qm and b/deepin-pc-manager/translations/deepin-pc-manager_zh_CN.qm differ diff --git a/deepin-pc-manager/translations/deepin-pc-manager_zh_CN.ts b/deepin-pc-manager/translations/deepin-pc-manager_zh_CN.ts index a203468..36fb22d 100644 --- a/deepin-pc-manager/translations/deepin-pc-manager_zh_CN.ts +++ b/deepin-pc-manager/translations/deepin-pc-manager_zh_CN.ts @@ -1,1160 +1,72 @@ - + - AVCPULimitation - - - Energy-saving mode - 节能模式 - - - - Virus scan takes a longer time in this mode - 开启后查杀时间较长 - - - - CleanerResultItemWidget - - - Removed - 已清理 - - - - Scanning... - 正在扫描... - - - - %1 items, total %2, selected: - 共%1项,%2,已选择: - - - - DDropdown - - - All - 全部 - - - - Installed - 已安装 - - - - Not installed - 未安装 - - - - DefSecurityToolsFrontUnit - - - Supported by %1 - 由%1提供服务 - - - - Open - button - 打 开 - - - - Update - button - 更 新 - - - - Install - button - 安 装 - - - - UnInstall - button - 卸 载 - - - - Security Level - 系统安全等级 - - - - Execution Prevention - 执行保护 - - - - Superior Protection - 超级防护 - - - - Block Removal of Kernel Modules - 内核模块防卸载 - - - - Login Safety - 登录安全 - - - - Internet Control - 联网控制 - - - - Data Usage - 流量监控 - - - - Firewall - 防火墙 - - - - Startup Programs - 自启动应用 - - - - Network Detection - 网络检测 - - - - USB Connection - USB安全管理 - - - - Switch system security levels with one click - 一键切换系统安全等级 - - - - Protect executable files from being tampered with - 保护可执行文件,防止被篡改或删除 - - - - Enable or disable privilege separation - 开启或关闭三权分立 - - - - Protect third-party kernel modules - 保护三方内核 - - - - Keep user login secure - 保护用户登录安全 - - - - Control the Internet access of apps - 管理应用联网权限 - - - - Monitor data usage details - 监控应用流量使用 - - - - Manage system firewalls - 管理系统防火墙 - - - - Manage auto-startup programs - 管理应用自启动权限 - - - - One-click detection, comprehensive network troubleshooting - 快速检测网络异常原因 - - - - Control permissions of USB storage devices - 管理USB存储设备权限 - - - - Failed to install the tool. Please try later. - 模块安装失败,请稍后重试。 - - - - Failed to update the tool. Please try later. - 模块更新失败,请稍后重试。 - - - - Failed to uninstall the tool. Please try later. - 模块卸载失败,请稍后重试。 - - - - DefSecurityToolsFrontUnit - - - Supported by %1 - 由%1提供服务 - - - - Open - button - 打 开 - - - - Update - button - 更 新 - - - - Install - button - 安 装 - - - - UnInstall - button - 卸 载 - - - - Startup Programs - Startup Programs - - - - Network Detection - 网络检测 - - - - Manage auto-startup programs - 管理应用自启动权限 - - - - One-click detection, comprehensive network troubleshooting - 快速检测网络异常原因 - - - - Failed to install the tool. Please try later. - 模块安装失败,请稍后重试。 - - - - Failed to update the tool. Please try later. - 模块更新失败,请稍后重试。 - - - - Failed to uninstall the tool. Please try later. - 模块卸载失败,请稍后重试。 - - - - DialogManage - - - A task is in process, please update later - 当前正在查杀中,请结束查杀后再更新 - - - - OK - button - 确 定 - - - - Quick scanning on the Full Check page, please try later - 系统体检正在执行快速查杀,请稍候 - - - - Threats are found on the Full Check page, please go to remove them first - 系统体检有病毒异常未处理,请前往处理 - - - - Fixing issues on the Full Check page, please try later - 系统体检正在执行修复任务,请稍候 - - - - - Scanning virus, please try later - 正在执行病毒查杀任务,请稍候 - - - - Scanning USB devices, please try later - 正在执行U盘查杀,请稍候 - - - - Updating the virus database, please try later - 病毒库正在更新,请稍候 - - - - Please check your network and update again - 网络异常,请检测网络后重新更新 - - - - - OK - 确定 - - - - Trying to update the virus database, please make sure its server address is correct - 病毒库正在尝试更新,请确保服务器地址正确 - - - - HomePage - - - - - - - Check Now - 立即体检 - - - - - - - Last Result: <font color=%1>%2</font> points - 上次体检结果:<font color=%1>%2</font>分 - - - - Checked %1 days ago - 距离上次体检已有%1天 - - - - HomePageCheckWidget - - - - Viruses and Trojans - 病毒木马 - - - - - Database version - 病毒库版本 - - - - - Startup programs - 自启动应用 - - - - Startup programs checking dismissed - 忽略开机自启应用检测 - - - - Startup programs checking resumed - 恢复开机自启应用检测 - - - - - Remote access (SSH) - 远程登录(SSH) - - - - Remote access (SSH): OFF - 远程登录(SSH):关闭 - - - - - System version - 系统版本 - - - - - System cleanup - 垃圾清理 - - - - Developer mode checking dismissed - 忽略开发者模式检测 - - - - - Fix All - 一键修复 - - - - points - - - - - Cancel - button - 取 消 - - - - Back - button - 返 回 - - - - Check Again - 重新体检 - - - - Done - button - 完 成 - - - - - Disk checking - 磁盘检测 - - - - - Developer mode - 开发者模式 - - - - - - - - - - - Scanning... - 正在扫描... - - - - - - - - - - Waiting - 等待扫描 - - - - Found threats - 有异常 - - - - No threats found - 未发现风险 - - - - - Out of date - 不是最新 - - - - - Up to date - 已是最新 - - - - - <font color=%1>%2 apps</font> - <font color=%1>%2个自启应用</font> - - - - - Dismissed - 已忽略 - - - - Open - 已开启 - - - - Closed - 已关闭 - - - - There are junk files - 系统有垃圾,请及时清理 - - - - Clean - 非常干净 - - - - Found errors - 磁盘有异常 - - - - No errors found - 磁盘无异常 - - - - Root access allowed, which is risky - 开发者模式已开启,可能存在风险 - - - - No root access - 未开启开发者模式 - - - - - - - - - - Fixed - 已修复 - - - - Fix now - 立即修复 - - - - Update now - 立即更新 - - - - Check up - 前往优化 - - - - - Dismiss - 忽略 - - - - No dismission - 取消忽略 - - - - Close it - 关闭 - - - - Check for updates - 前往更新 - - - - Clean up - 一键清理 - - - - Go to check - 前往查看 - - - - - - - <font color=%1>%2</font> issue(s) found - 发现<font color=%1>%2</font>项问题 - - - - Viruses and Trojans processed - 修复病毒木马 - - - - Virus database updated - 更新病毒库 - - - - Junk files cleaned up - 清理垃圾 - - - - Disk errors checked - 前往查看磁盘异常信息 - - - - %1 issues found in %2 - 发现%1项问题:%2 - - - - HomePageCheckWidget - - - - Viruses and Trojans - 病毒木马 - - - - - Database version - 病毒库版本 - - - - - Startup programs - 自启动应用 - - - - Startup programs checking dismissed - 忽略开机自启应用检测 - - - - Startup programs checking resumed - 恢复开机自启应用检测 - - - - - Remote access (SSH) - 远程登录(SSH) - - - - Remote access (SSH): OFF - 远程登录(SSH):关闭 - - - - - System version - 系统版本 - - - - - System cleanup - 垃圾清理 - - - - Developer mode checking dismissed - 忽略开发者模式检测 - - - - - Fix All - 一键修复 - - - - points - - - - - Cancel - button - 取 消 - - - - Back - button - 返 回 - - - - Check Again - 重新体检 - - - - Done - button - 完 成 - - - - - Disk checking - 磁盘检测 - - - - - Developer mode - 开发者模式 - - - - - - - - - - - Scanning... - 正在扫描... - - - - - - - - - - Waiting - 等待扫描 - - - - Found threats - 有异常 - - - - No threats found - 未发现风险 - - - - - Out of date - 不是最新 - - - - - Up to date - 已是最新 - - - - - <font color=%1>%2 apps</font> - <font color=%1>%2个自启应用</font> - - - - - Dismissed - 已忽略 - - - - Open - 已开启 - - - - Closed - 已关闭 - - - - There are junk files - 系统有垃圾,请及时清理 - - - - Clean - 非常干净 - - - - Found errors - 磁盘有异常 - - - - No errors found - 磁盘无异常 - - - - Root access allowed, which is risky - 开发者模式已开启,可能存在风险 - - - - No root access - 未开启开发者模式 - - - - - - - - - - Fixed - 已修复 - - - - Fix now - 立即修复 - - - - Update now - 立即更新 - - - - Check up - 前往优化 - - - - - Dismiss - 忽略 - - - - No dismission - 取消忽略 - - - - Close it - 关闭 - - - - Check for updates - 前往更新 - - - - Clean up - 一键清理 - - - - Go to check - 前往查看 - - - - - - - <font color=%1>%2</font> issue(s) found - 发现<font color=%1>%2</font>项问题 - - - - Viruses and Trojans processed - 修复病毒木马 - - - - Virus database updated - 更新病毒库 - - - - Junk files cleaned up - 清理垃圾 - - - - Disk errors checked - 前往查看磁盘异常信息 - - - - %1 issues found in %2 - 发现%1项问题:%2 - - - - HomePageModel - - - Startup programs checked - 前往优化自启应用 - - - - System updated - 前往更新系统 - - - - MainWindow - - - ###out defender log - ###out defender log - - - - Settings - 设置 - - - - Report issues - 用户反馈 - - - - Logs - 安全日志 - - - - Full Check - 系统体检 - - - - Virus Scan - 病毒查杀 - - - - Cleanup - 垃圾清理 - - - - Tools - 安全工具 - - - - ZIP files (*.zip) - ZIP文件 (*.zip) - - - - - Security Center - 安全中心 - - - - - Exit - 退出 - - - - Minimize to system tray - 最小化到系统托盘 - - - - Do not ask again - 不再询问 - - - - Please choose your action - 请选择您的操作 - - - - - - Cancel - button - 取 消 - + MainWindow - - Confirm - button - 确 定 + + Service Support + 服务支持 - - Moving the quarantined or whitelist files, please try later - 正在移动隔离/信任文件,请稍后再试 + + Settings + 设置 - - A scan is in progress. Are you sure you want to exit? - 扫描进行中,您确定要退出吗? + + + + Deepin PC Manager + 电脑管家 - - + + Exit - button - 退 出 + 退出 - - There are unprocessed threats. Are you sure you want to exit? - 存在未处理的风险项,确定退出吗? + + Full Check + 系统体检 - - The current antivirus engine has expired. Please wait while it is being processed. - 当前引擎已过期,正在处理,请稍候。 + + Cleanup + 垃圾清理 - - OK - Button - 确 定 + + Toolbox + 安全工具 - - Rising - 瑞星网安 + + Minimize to system tray + 最小化到系统托盘 - - DAS-Security - 安恒信息 + + Do not ask again + 不再询问 - - Dear users, since the %1 antivirus service has expired, Security Center will suspend its related services, and you can continue using the %2 antivirus engine. Thank you for your understanding and support. - 尊敬的用户您好,由于%1杀毒引擎服务已到期,安全中心将暂停提供其相关服务,您可继续使用%2杀毒引擎服务。感谢您的理解与支持。 + + Please choose your action + 请选择您的操作 - - - OK (%1s) + + Cancel button - 确 定 (%1s) + 取 消 - - OK + + Confirm button - 确 定 - - - - Import Again - 重新导入 - - - - Virus database imported - 病毒库导入成功 - - - - Failed to import the virus database, please select the right file and try again - 病毒库导入更新失败,请选择正确文件重试 - - - - The imported virus database is older than the current version - 病毒库导入版本低于当前版本 - - - - DAS-Security virus database imported - 安恒病毒库导入成功 - - - - Failed to import the DAS-Security virus database, please select the right file and try again - 安恒病毒库导入更新失败,请选择正确文件重试 - - - - The imported DAS-Security virus database is older than the current version - 安恒病毒库导入版本低于当前版本 - - - - Rising virus database imported - 瑞星病毒库导入成功 - - - - Failed to import the Rising virus database, please select the right file and try again - 瑞星病毒库导入更新失败,请选择正确文件重试 - - - - The imported Rising virus database is older than the current version - 瑞星病毒库导入版本低于当前版本 + 确 认 @@ -1185,897 +97,518 @@ 关闭主窗口 - + PC Manager 电脑管家 - RestartDefenderDialog - - - Changes will take effect after the application restarts - 请退出安全中心,重启应用后生效 - - - - Cancel - button - 取 消 - - - - Restart - button - 重 启 - - - - SearchLineEdit - - - Search - 搜索 - - - - SecurityToolsWidget - - - All - 全部工具 - - - - System - 系统安全 - - - - Network - 网络安全 - - - - Data - 数据安全 - - - - Apps - 应用管理 - - - - Devices - 外设管理 - - - - No tools found - 未查询到相关工具 - - - - SystemCheckDocument - - - points - - - - - Fixing - 正在修复 - - - - Checking - 正在体检 - - - - Your computer is - 您的电脑现在 - - - - at risk - 存在安全风险 - - - - at high risk - 极不安全 - + SysCheckResultHeaderWidget - - + + Your computer is healthy 您的电脑现在很健康 - - Your computer is in good condition - 您的电脑现在状况良好 - - - - Your computer is at risk - 您的电脑现在存在安全风险 - - - - Your computer is at high risk - 您的电脑现在极不安全 - - - - Your computer has not been checked for a long time - 您的电脑已经很久没体检了 - - - - Your computer has not been checked yet - 您的电脑还从未体检过 - - - - + + Great! Keep staying healthy please. 太棒了,继续保持吧 - - Start a check and perform some improvements. - 还可以继续体检优化 - - - - Please check your system now. - 建议立即进行系统体检 - - - - It is strongly recommended to check and fix your system now. - 强烈建议立即体检修复 - - - - Have a new check right now. - 建议立即体检 - - - - Try a full check. - 来一次全面体检吧 - - - + %1 issue(s) found 您的电脑有%1项健康风险 - + Fix issues right now to keep your computer healthy. 马上修复,让电脑恢复健康吧 - + Fixing issues 正在修复风险项 - + It will be completed soon. 稍等一下,马上就好 - - fixing - 正在修复 - - - - Viruses and Trojans - 病毒木马 - - - - Database version - 病毒库版本 - - - - Remote access (SSH) - 远程登录(SSH) - - - - Disk checking - 磁盘检测 - - - - System cleanup - 垃圾清理 - - - - System version - 系统版本 - - - - Developer mode - 开发者模式 - - - - Startup programs - 自启动应用 - - - - No threats found - 未发现风险 - - - - - Up to date - 已是最新 - - - - Closed - 已关闭 - - - - No errors found - 磁盘无异常 - - - - Clean - 非常干净 + + points + + + + SysCheckResultItemWidget - - No root access - 未开启开发者模式 + + + Check up + 前往优化 - - + + + + + + + + %1 apps %1个自启应用 - - Found threats - 有异常 + + Check for updates + 检查更新 - - + Out of date 不是最新 - - Open - 打开 - - - - Found errors - 磁盘有异常 + + Clean up + 一键清理 - + There are junk files 系统有垃圾,请及时清理 - - Root access allowed, which is risky - 开发者模式已开启,可能存在风险 - - - - Fix now - 立即修复 - - - - Update now - 立即更新 - - - - Close it - 关闭 - - - + Go to check 前往查看 - - Clean up - 一键清理 - - - - Check for updates - 检查更新 - - - - Check up - 前往优化 - - - - Scanning viruses and Trojans - 正在扫描系统中的病毒木马 - - - - Checking the version of virus database - 正在扫描病毒库版本 - - - - Checking the state of remote access (SSH) - 正在检查远程登陆(SSH)开启状态 - - - - Checking disks - 正在进行磁盘检测 - - - - Checking system junk - 正在检查系统是否存在垃圾文件 - - - - Checking if your system is up to date - 正在检查系统版本是否最新 - - - - Checking if the developer mode is enabled - 正在检查开发者模式是否开启 - - - - Checking startup programs - 正在检查自启动应用 + + Found errors + 磁盘有异常 - - - Check Again - 重新体检 + + + + Root access allowed, which is risky + 开发者模式已开启,可能存在风险 - - Fix All - 一键修复 + + + Up to date + 已是最新 - - Done - button - 完 成 + + + Clean + 非常干净 - - Dismiss - 忽略 + + + No errors found + 磁盘无异常 - - No dismission - 取消忽略 + + + + No root access + 未开启开发者模式 - - Startup programs checking dismissed - 忽略开机自启应用检测 + + Fixing + 正在修复 - - Startup programs checking resumed - 恢复开机自启应用检测 + + Disk checking + 磁盘检测 - - Developer mode checking dismissed - 忽略开发者模式检测 + + System cleanup + 垃圾清理 - - Viruses and Trojans processed - 修复病毒木马 + + System version + 系统版本 - - Virus database updated - 更新病毒库 + + Developer mode + 开发者模式 - - Junk files cleaned up - 清理垃圾 + + + Startup programs + 自启动应用 - - Disk errors checked - 前往查看磁盘异常信息 + + Dismiss + 忽略 - - %1 issues found in %2 - 发现%1项问题:%2 + + No dismission + 取消忽略 - TrashCleanGreetingWidget - - - Last clean: %1 - 上次清理了%1垃圾 - + SystemCheckModel - - - Start cleaning now to refresh your computer - 您还未进行过垃圾清理,赶快为电脑做一次大扫除吧 + + Startup programs + 忽略开机自启应用检测 - - Clean out junk files and free up disk space - 清理磁盘垃圾,释放电脑空间 + + System version + 系统版本 - - System junk - 系统垃圾 + + System cleanup + 垃圾清理 - - Useless files created by the system - 系统运行产生的各种垃圾 + + Disk checking + 磁盘检测 - - Application junk - 应用垃圾 + + Developer mode + 开发者模式 + + + SystemCheckWidget - - Unneeded files created by applications - 常用软件垃圾 + + Fix All + 一键修复 - - Traces - 痕迹信息 + + Done + button + 完 成 - - Activity traces of the system and applications - 系统、应用操作痕迹 + + Check Again + 重新体检 - - Cookies - Cookies + + + Your computer has not been checked yet + 您的电脑还从未体检过 - - Cookies from Internet browsers - 上网浏览cookies + + Try a full check. + 来一次全面体检吧 - - Scan Now - button - 立即扫描 + + + + + + Check Now + 立即体检 - - - TrashCleanResultHeaderItem - - Scanned: %1 files - 扫描文件:%1件 + + + + + Last Result: <font color=%1>%2</font> points + 上次体检结果:<font color=%1>%2</font>分 - - Scanning: %1 - 正在扫描:%1 + + Your computer is healthy + 您的电脑现在很健康 - - %1 junk files, %2 selected - 共发现%1垃圾,已选中%2垃圾 + + Great! Keep staying healthy please. + 太棒了,继续保持吧 - - - TrashCleanResultWidget - - Scan Now - buton - 立即扫描 + + Start a check and perform some improvements. + 还可以继续体检优化 - - - Cancel - button - 取 消 + + Your computer is in good condition + 您的电脑现在状况良好 - - Scan Now - button - 立即扫描 + + Please check your system now. + 建议立即进行系统体检 - - System junk - 系统垃圾 + + + Your computer is + 您的电脑现在 - - Application junk - 应用垃圾 + + at risk + 存在安全风险 - - Traces - 痕迹信息 + + It is strongly recommended to check and fix your system now. + 强烈建议立即体检修复 - - Cookies - Cookies + + at high risk + 极不安全 - - Trash - 回收站 + + Checked %1 days ago + 距离上次体检已有%1天 - - Make sure all files in the trash can be deleted - 清除前请确认回收站中的文件都是可删除的 + + Have a new check right now. + 建议立即体检 - - System caches - 系统缓存 + + Your computer has not been checked for a long time + 您的电脑已经很久没体检了 - - Caches created by the system - 系统运行使用过程中产生的缓存 + + Checking + 正在体检 - - System logs - 系统日志 + + + Checking startup programs + 正在检查自启动应用 - - Log files created by the system - 系统运行时产生的日志类文件 + + Checking if your system is up to date + 正在检查系统版本是否最新 - - System and Application traces - 系统和应用痕迹 + + Checking system junk + 正在检查系统是否存在垃圾文件 - - Cache and log files - 缓存和日志文件 + + Checking disks + 正在进行磁盘检测 - - Residual files - 卸载残留 + + Checking if the developer mode is enabled + 正在检查开发者模式是否开启 + + + ToolBoxItemWidget - - %1 junk files, %2 selected - 共发现%1垃圾,已选中%2垃圾 + + Open + 打 开 + + + ToolBoxWidget - - Scanned: %1 files - 扫描文件:%1件 + + All + 全部工具 - - Clean out junk files and free up disk space - 清理磁盘垃圾,释放电脑空间 + + System + 系统安全 - - Initializing - 正在初始化 + + Network + 网络安全 - - - Time elapsed %1:%2:%3 - 扫描用时 %1:%2:%3 + + Repair + 修复工具 - - Clean Up - button - 立即清理 + + Apps + 应用管理 - - - Scan Again - button - 重新扫描 + + Devices + 外设管理 + + + TrashCleanResultHeaderItem - - - Done - button - 完 成 + + Scanned: %1 files + 扫描文件:%1件 - - Scanned: %1 files, junk files: %2 - 扫描文件%1件,发现%2垃圾 + + Scanning: %1 + 正在扫描:%1 - - Removed: %1 junk files - 清理了%1垃圾 + + %1 junk files, %2 selected + 共发现%1垃圾,已选中%2垃圾 + + + TrashCleanResultItemWidget - - - %1 removed - 成功清理%1垃圾 + + Removed + 已清理 - - - Cleaned: %1 files - 清理文件:%1件 + + total %1, selected: + %1,已选择: TrashCleanWidget - - + Clean out junk files and free up disk space 清理磁盘垃圾,释放电脑空间 - - + Start cleaning now to refresh your computer 您还未进行过垃圾清理,赶快为电脑做一次大扫除吧 - - + + System junk 系统垃圾 - + Useless files created by the system 系统运行产生的各种垃圾 - - - Application junk - 应用垃圾 - - - - Unneeded files created by applications - 常用软件垃圾 - - - - + Traces 痕迹信息 - + Activity traces of the system and applications 系统、应用操作痕迹 - - - Cookies - Cookies - - - - Cookies from Internet browsers - 上网浏览cookies - - - - - + Scan Now + button 立即扫描 - + Trash 回收站 - + Make sure all files in the trash can be deleted 清除前请确认回收站中的文件都是可删除的 - + System caches 系统缓存 - + Caches created by the system 系统运行使用过程中产生的缓存 - + System logs 系统日志 - + Log files created by the system 系统运行时产生的日志类文件 - + System and Application traces 系统和应用痕迹 - - Cache and log files - 缓存和日志文件 - - - - Residual files - 卸载残留 - - - - Scanning: %1 - 正在扫描:%1 - - - - %1 junk files, %2 selected - 共发现%1垃圾,已选中%2垃圾 - - - - Scanned: %1 files - 扫描文件:%1件 - - - - Last clean: %1 - 上次清理了%1垃圾 - - - - Initializing - 正在初始化 - - - - - Cancel - button - 取 消 - - - - - Time elapsed %1:%2:%3 - 扫描用时 %1:%2:%3 - - - - Back + + Done button - 返 回 + 完 成 - + Clean Up 立即清理 - - Scanned: %1 files, junk files: %2 - 扫描文件%1件,发现%2垃圾 - - - - Removed: %1 junk files - 清理了%1垃圾 - - - + Scan Again - 重新扫描 + 再次扫描 - - Done - button - 完 成 + + %1 junk files, %2 selected + 共发现%1垃圾,已选中%2垃圾 - - + %1 removed 成功清理%1垃圾 - - - - Cleaned: %1 files - 清理文件:%1件 - - - - UpdateAddressItem - - - Virus database server address - 病毒库升级地址 - - - - VirusWhitelistScanItem - - - (Files in the whitelist will be excluded from virus scan) - (加入白名单后病毒扫描将被跳过) - main - + Deepin PC Manager is an application tool designed to help users quickly manage, maintain, and optimize computer systems. 电脑管家是一款帮助用户快速管理、维护和优化计算机系统的应用工具。