diff --git a/frame/dbus/dbusdockadaptors.cpp b/frame/dbus/dbusdockadaptors.cpp index cf6121ee7..dc50ba105 100644 --- a/frame/dbus/dbusdockadaptors.cpp +++ b/frame/dbus/dbusdockadaptors.cpp @@ -326,7 +326,7 @@ QIcon DBusDockAdaptors::getSettingIcon(PluginsItemInterface *plugin, QSize &pixm { auto iconSize = [](const QIcon &icon) { QList iconSizes = icon.availableSizes(); - if (iconSizes.size() > 0) + if (iconSizes.size() > 0 && !iconSizes[0].isNull() ) return iconSizes[0]; return defaultIconSize; diff --git a/plugins/multitasking/multitaskingplugin.cpp b/plugins/multitasking/multitaskingplugin.cpp index fdfb7e80c..3baf4906a 100644 --- a/plugins/multitasking/multitaskingplugin.cpp +++ b/plugins/multitasking/multitaskingplugin.cpp @@ -8,6 +8,7 @@ #include #include +#include #include @@ -141,8 +142,17 @@ void MultitaskingPlugin::invokedMenuItem(const QString &itemKey, const QString & QIcon MultitaskingPlugin::icon(const DockPart &dockPart, DGuiApplicationHelper::ColorType themeType) { - if (dockPart == DockPart::DCCSetting) - return QIcon::fromTheme("dcc-multitasking-view",QIcon(":/icons/icons/dcc-multitasking-view.svg")); + if (dockPart == DockPart::DCCSetting) { + auto icon = QIcon::fromTheme("dcc-multitasking-view", QIcon(":/icons/dcc-multitasking-view.svg")); + QPixmap pixmap = icon.pixmap(QSize(18, 18)); + if (themeType == DGuiApplicationHelper::ColorType::LightType) + return pixmap; + + QPainter pa(&pixmap); + pa.setCompositionMode(QPainter::CompositionMode_SourceIn); + pa.fillRect(pixmap.rect(), Qt::white); + return pixmap; + } return QIcon(); } @@ -176,4 +186,4 @@ PluginsItemInterface::PluginType MultitaskingPlugin::type() PluginFlags MultitaskingPlugin::flags() const { return PluginFlag::Type_Fixed | Attribute_CanSetting; -} \ No newline at end of file +} diff --git a/plugins/show-desktop/CMakeLists.txt b/plugins/show-desktop/CMakeLists.txt index 76c8f474f..484b58f50 100644 --- a/plugins/show-desktop/CMakeLists.txt +++ b/plugins/show-desktop/CMakeLists.txt @@ -16,7 +16,7 @@ find_package(DtkWidget REQUIRED) pkg_check_modules(XCB_LIBS REQUIRED IMPORTED_TARGET xcursor) add_definitions("${QT_DEFINITIONS} -DQT_PLUGIN") -add_library(${PLUGIN_NAME} SHARED ${SRCS}) +add_library(${PLUGIN_NAME} SHARED ${SRCS} resource.qrc) set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../) target_include_directories(${PLUGIN_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS} ../../interfaces) target_link_libraries(${PLUGIN_NAME} PRIVATE diff --git a/plugins/show-desktop/showdesktopplugin.cpp b/plugins/show-desktop/showdesktopplugin.cpp index b6d56e180..0920167fd 100644 --- a/plugins/show-desktop/showdesktopplugin.cpp +++ b/plugins/show-desktop/showdesktopplugin.cpp @@ -4,11 +4,13 @@ // SPDX-License-Identifier: LGPL-3.0-or-later #include "showdesktopplugin.h" +#include "imageutil.h" #include "../widgets/tipswidget.h" #include #include #include +#include using namespace Dock; ShowDesktopPlugin::ShowDesktopPlugin(QObject *parent) @@ -121,9 +123,17 @@ void ShowDesktopPlugin::refreshIcon(const QString &itemKey) QIcon ShowDesktopPlugin::icon(const DockPart &dockPart, DGuiApplicationHelper::ColorType themeType) { - if (dockPart == DockPart::DCCSetting) { - return QIcon::fromTheme("dcc-show-desktop", QIcon(":/icons/icons/dcc-show-desktop.svg")); + auto loadsvg = []{ return ImageUtil::loadSvg(":/icons/dcc-show-desktop.svg", QSize(18, 18));}; + auto icon = QIcon::fromTheme("dcc-show-desktop", loadsvg()); + QPixmap pixmap = icon.pixmap(QSize(18, 18)); + if (themeType == DGuiApplicationHelper::ColorType::LightType) + return pixmap; + + QPainter pa(&pixmap); + pa.setCompositionMode(QPainter::CompositionMode_SourceIn); + pa.fillRect(pixmap.rect(), Qt::white); + return pixmap; } return QIcon(); diff --git a/plugins/shutdown/CMakeLists.txt b/plugins/shutdown/CMakeLists.txt index 106b625cb..4ab4bb5b3 100644 --- a/plugins/shutdown/CMakeLists.txt +++ b/plugins/shutdown/CMakeLists.txt @@ -4,7 +4,11 @@ set(PLUGIN_NAME "shutdown") project(${PLUGIN_NAME}) # Sources files -file(GLOB_RECURSE SRCS "*.h" "*.cpp" "../../widgets/tipswidget.h" "../../widgets/tipswidget.cpp") +file(GLOB_RECURSE SRCS "*.h" "*.cpp" + "../../widgets/tipswidget.h" + "../../widgets/tipswidget.cpp" + "../../frame/util/imageutil.cpp" +) find_package(PkgConfig REQUIRED) find_package(Qt5Widgets REQUIRED) diff --git a/plugins/shutdown/shutdownplugin.cpp b/plugins/shutdown/shutdownplugin.cpp index 7b0332623..5830b5943 100644 --- a/plugins/shutdown/shutdownplugin.cpp +++ b/plugins/shutdown/shutdownplugin.cpp @@ -275,10 +275,11 @@ void ShutdownPlugin::setSortKey(const QString &itemKey, const int order) QIcon ShutdownPlugin::icon(const DockPart &dockPart, DGuiApplicationHelper::ColorType themeType) { if (dockPart == DockPart::DCCSetting) { + QString iconFile(":/icons/resources/icons/dcc_shutdown.svg"); + auto pixmap = ImageUtil::loadSvg(iconFile, QSize(18, 18)); if (themeType == DGuiApplicationHelper::ColorType::LightType) - return QIcon(":/icons/resources/icons/dcc_shutdown.svg"); + return pixmap; - QPixmap pixmap(":/icons/resources/icons/dcc_shutdown.svg"); QPainter pa(&pixmap); pa.setCompositionMode(QPainter::CompositionMode_SourceIn); pa.fillRect(pixmap.rect(), Qt::white); diff --git a/plugins/sound/sounddeviceswidget.cpp b/plugins/sound/sounddeviceswidget.cpp index 29f8e8445..9df6742c3 100644 --- a/plugins/sound/sounddeviceswidget.cpp +++ b/plugins/sound/sounddeviceswidget.cpp @@ -530,7 +530,15 @@ QPixmap SoundDevicesWidget::pixmap(DGuiApplicationHelper::ColorType colorType, i else if (volmue > maxVolmue * 1 / 3) volumeString = "medium"; else - volumeString = "low";; + volumeString = "low"; - return QIcon::fromTheme(QString("audio-volume-%1-symbolic").arg(volumeString)).pixmap(iconWidth, iconHeight); + auto pixmap = QIcon::fromTheme(QString("audio-volume-%1-symbolic").arg(volumeString)).pixmap(iconWidth, iconHeight); + + if (colorType == DGuiApplicationHelper::ColorType::LightType) + return pixmap; + + QPainter pa(&pixmap); + pa.setCompositionMode(QPainter::CompositionMode_SourceIn); + pa.fillRect(pixmap.rect(), Qt::white); + return pixmap; } diff --git a/plugins/trash/trashplugin.cpp b/plugins/trash/trashplugin.cpp index 6454352b3..0489fc20f 100644 --- a/plugins/trash/trashplugin.cpp +++ b/plugins/trash/trashplugin.cpp @@ -5,6 +5,7 @@ #include "trashplugin.h" #include "../../widgets/tipswidget.h" +#include "imageutil.h" #include #include @@ -174,10 +175,10 @@ void TrashPlugin::pluginSettingsChanged() QIcon TrashPlugin::icon(const DockPart &dockPart, DGuiApplicationHelper::ColorType themeType) { if (dockPart == DockPart::DCCSetting) { + auto pixmap = ImageUtil::loadSvg(":/icons/dcc_trash.svg", QSize(18, 18)); if (themeType == DGuiApplicationHelper::ColorType::LightType) - return QIcon(":/icons/dcc_trash.svg"); + return pixmap; - QPixmap pixmap(":/icons/dcc_trash.svg"); QPainter pa(&pixmap); pa.setCompositionMode(QPainter::CompositionMode_SourceIn); pa.fillRect(pixmap.rect(), Qt::white);