mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-01 07:05:48 +00:00
feat: use system battery icon first
Log:
This commit is contained in:
parent
c2aedfe052
commit
919a2b5a49
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user