Skip to content

Commit

Permalink
fix: 判断dde-dock版本,区分V23与V20插件实现
Browse files Browse the repository at this point in the history
判断dde-dock版本,区分V23与V20插件实现

Log: 判断dde-dock版本,区分V23与V20插件实现
  • Loading branch information
feeengli committed Sep 11, 2023
1 parent 6e1c14c commit a69f2c4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
3 changes: 2 additions & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ Build-Depends:
dde-dock-dev,
libgtest-dev,
libgmock-dev,
libdwayland-dev | libkf5wayland-dev
libdwayland-dev | libkf5wayland-dev,
libwayland-dev
Standards-Version: 3.9.8
Homepage: https://github.com/linuxdeepin/deepin-system-monitor

Expand Down
10 changes: 9 additions & 1 deletion deepin-system-monitor-plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,15 @@ find_package(Qt5DBus REQUIRED)
find_package(DtkWidget REQUIRED)

pkg_check_modules(QGSettings REQUIRED gsettings-qt)
pkg_check_modules(DdeDockInterface REQUIRED dde-dock)
pkg_check_modules(DdeDockInterface REQUIRED dde-dock)

if (DdeDockInterface_FOUND)
message("dde-dock founded: ${VERSION_MAJOR}")
string(REGEX MATCH "^[0-9]" VERSION_MAJOR ${DdeDockInterface_VERSION})
if (VERSION_MAJOR STREQUAL "6" OR VERSION_MAJOR STRGREATER "6")
add_definitions(-DDDE_DOCK_NEW_VERSION)
endif()
endif()

add_definitions("${QT_DEFINITIONS} -DQT_PLUGIN")
add_library(${PROJECT_NAME} SHARED ${SRCS} ${APP_RESOURCES})
Expand Down
5 changes: 2 additions & 3 deletions deepin-system-monitor-plugin/gui/monitor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,9 @@ void MonitorPlugin::invokedMenuItem(const QString &itemKey, const QString &menuI
}
}

#ifdef DDE_DOCK_NEW_VERSION
QIcon MonitorPlugin::icon(const DockPart &dockPart, DGuiApplicationHelper::ColorType themeType)
{
if (common::systemInfo().isOldVersion()) {
return PluginsItemInterface::icon(dockPart, themeType);
}
QString iconName = "dsm_pluginicon_light";
if (themeType == DGuiApplicationHelper::LightType) {
// 最小尺寸时,不画背景,采用深色图标
Expand Down Expand Up @@ -209,6 +207,7 @@ QIcon MonitorPlugin::icon(const DockPart &dockPart, DGuiApplicationHelper::Color
}
return icon;
}
#endif

void MonitorPlugin::udpateTipsInfo()
{
Expand Down
2 changes: 2 additions & 0 deletions deepin-system-monitor-plugin/gui/monitor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,13 @@ class MonitorPlugin : public QObject, PluginsItemInterface
//!
void invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked) Q_DECL_OVERRIDE;

#ifdef DDE_DOCK_NEW_VERSION
///
/// the icon for the plugin
/// themeType {0:UnknownType 1:LightType 2:DarkType}
///
QIcon icon(const DockPart &dockPart, DGuiApplicationHelper::ColorType themeType = DGuiApplicationHelper::instance()->themeType()) Q_DECL_OVERRIDE;
#endif

private slots:

Expand Down

0 comments on commit a69f2c4

Please sign in to comment.