feat: use system battery icon first

Log:
This commit is contained in:
chenhongtao 2023-11-22 11:10:47 +08:00 committed by deepin-bot[bot]
parent c2aedfe052
commit 919a2b5a49
2 changed files with 4 additions and 4 deletions

View File

@ -16,6 +16,7 @@
#include <DListView>
#include <DSpinner>
#include <DGuiApplicationHelper>
#include <DIconTheme>
#include <QBoxLayout>
#include <QStandardItemModel>
@ -115,7 +116,9 @@ QIcon BluetoothDeviceItem::getBatteryIcon(int percentage)
percentageStr = "unknow";
}
return QIcon::fromTheme(QString("battery-%1-symbolic").arg(percentageStr));
QString iconName = QString("battery-%1-symbolic").arg(percentageStr);
QIcon qrcIcon = DIconTheme::findQIcon(iconName, DIconTheme::DontFallbackToQIconFromTheme);
return DIconTheme::findQIcon(iconName, qrcIcon, DIconTheme::IgnoreBuiltinIcons);
}

View File

@ -95,9 +95,6 @@ QPixmap PowerStatusWidget::getBatteryIcon(int themeType)
.arg(plugged ? "plugged-symbolic" : "symbolic");
}
if (themeType == DGuiApplicationHelper::ColorType::LightType)
iconStr.append(PLUGIN_MIN_ICON_NAME);
const auto ratio = devicePixelRatioF();
QSize pixmapSize = QCoreApplication::testAttribute(Qt::AA_UseHighDpiPixmaps) ? QSize(20, 20) : (QSize(20, 20) * ratio);
QPixmap pix = QIcon::fromTheme(iconStr, QIcon::fromTheme(":/batteryicons/resources/batteryicons/" + iconStr + ".svg")).pixmap(pixmapSize);