Skip to content

Commit

Permalink
chore: use 1070(v20) interfaces of dde-dock
Browse files Browse the repository at this point in the history
use 1070(v20) interfaces of dde-dock in community version (v23)

Log:
  • Loading branch information
FeiWang1119 committed Jun 28, 2024
1 parent f74e741 commit 8829092
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 28 deletions.
1 change: 0 additions & 1 deletion src/external/dde-dock-plugins/disk-mount/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ find_package(Qt5 COMPONENTS Concurrent Core REQUIRED)
find_package(Dtk COMPONENTS Widget Gui REQUIRED)
find_package(PkgConfig REQUIRED)

pkg_check_modules(DdeDockInterface REQUIRED dde-dock)
pkg_check_modules(Gesttings REQUIRED gsettings-qt)
pkg_search_module(LibMount REQUIRED mount IMPORTED_TARGET)

Expand Down
18 changes: 1 addition & 17 deletions src/external/dde-dock-plugins/disk-mount/diskmountplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ DiskMountPlugin::DiskMountPlugin(QObject *parent)
diskPluginItem(new DiskPluginItem)
{
loadTranslator();
diskPluginItem->setVisible(false);
diskPluginItem->setVisible(true);
tipsLabel->setObjectName("diskmount");
tipsLabel->setVisible(false);
tipsLabel->setText(tr("Disk"));
Expand Down Expand Up @@ -180,19 +180,3 @@ std::once_flag &DiskMountPlugin::onceFlag()
static std::once_flag flag;
return flag;
}

#ifdef COMPILE_ON_V23
QIcon DiskMountPlugin::icon(const DockPart &dockPart, DGuiApplicationHelper::ColorType)
{
if (dockPart == DockPart::SystemPanel) {
diskPluginItem->updateIcon();
return diskPluginItem->getIcon();
}
return QIcon();
}

PluginFlags DiskMountPlugin::flags() const
{
return PluginFlag::Type_Tray | PluginFlag::Attribute_CanDrag | PluginFlag::Attribute_CanInsert;
}
#endif
11 changes: 2 additions & 9 deletions src/external/dde-dock-plugins/disk-mount/diskmountplugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@

// `DOCK_API_VERSION` added after v2.0.0
#ifdef DOCK_API_VERSION
# ifdef COMPILE_ON_V20
# if (DOCK_API_VERSION >= DOCK_API_VERSION_CHECK(2, 0, 0))
# define USE_DOCK_NEW_INTERFACE
# endif
# if (DOCK_API_VERSION >= DOCK_API_VERSION_CHECK(2, 0, 0))
# define USE_DOCK_NEW_INTERFACE
# endif
#endif

Expand Down Expand Up @@ -64,11 +62,6 @@ class DiskMountPlugin : public QObject, PluginsItemInterface
void setSortKey(const QString &itemKey, const int order) override;
void refreshIcon(const QString &itemKey) override;

#ifdef COMPILE_ON_V23
QIcon icon(const DockPart &dockPart, DGuiApplicationHelper::ColorType themeType = DGuiApplicationHelper::instance()->themeType()) override;
PluginFlags flags() const override;
#endif

public slots:
void setDockEntryVisible(bool visible);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void DiskPluginItem::updateIcon()
{
QString &&iconName = "drive-removable-dock-symbolic";

#if defined(COMPILE_ON_V23) || defined(USE_DOCK_NEW_INTERFACE)
#if defined(USE_DOCK_NEW_INTERFACE)
if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType)
iconName.append(PLUGIN_MIN_ICON_NAME);
#else
Expand Down

0 comments on commit 8829092

Please sign in to comment.