mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
fix: 修复系统主题变化后快捷面板电池颜色显示错误的问题
1、电池图标响应主题变化来重新设置图标 2、修改控制中心电池名称的文案 Log: 修改系统主题变化后快捷面板电池颜色显示错误的问题 Influence: 打开快捷面板,在控制中心更改系统颜色,观察快捷面板中系统电池图标是否跟随系统颜色变化 Bug: https://pms.uniontech.com/bug-view-184085.html Change-Id: If02b8800b4d90696c2dc74ac43ebc230233f0f58
This commit is contained in:
parent
da1b436796
commit
5652e2a49a
@ -52,12 +52,8 @@ PowerPlugin::PowerPlugin(QObject *parent)
|
|||||||
, m_preChargeTimer(new QTimer(this))
|
, m_preChargeTimer(new QTimer(this))
|
||||||
, m_quickPanel(nullptr)
|
, m_quickPanel(nullptr)
|
||||||
{
|
{
|
||||||
m_tipsLabel->setVisible(false);
|
initUi();
|
||||||
m_tipsLabel->setObjectName("power");
|
initConnection();
|
||||||
m_preChargeTimer->setInterval(DELAYTIME);
|
|
||||||
m_preChargeTimer->setSingleShot(true);
|
|
||||||
initQuickPanel();
|
|
||||||
connect(m_preChargeTimer,&QTimer::timeout,this,&PowerPlugin::refreshTipsData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString PowerPlugin::pluginName() const
|
const QString PowerPlugin::pluginName() const
|
||||||
@ -67,7 +63,7 @@ const QString PowerPlugin::pluginName() const
|
|||||||
|
|
||||||
const QString PowerPlugin::pluginDisplayName() const
|
const QString PowerPlugin::pluginDisplayName() const
|
||||||
{
|
{
|
||||||
return tr("Power");
|
return tr("Battery");
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *PowerPlugin::itemWidget(const QString &itemKey)
|
QWidget *PowerPlugin::itemWidget(const QString &itemKey)
|
||||||
@ -100,6 +96,8 @@ void PowerPlugin::init(PluginProxyInterface *proxyInter)
|
|||||||
m_proxyInter = proxyInter;
|
m_proxyInter = proxyInter;
|
||||||
|
|
||||||
loadPlugin();
|
loadPlugin();
|
||||||
|
|
||||||
|
onThemeTypeChanged(DGuiApplicationHelper::instance()->themeType());
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString PowerPlugin::itemCommand(const QString &itemKey)
|
const QString PowerPlugin::itemCommand(const QString &itemKey)
|
||||||
@ -149,13 +147,12 @@ void PowerPlugin::setSortKey(const QString &itemKey, const int order)
|
|||||||
|
|
||||||
QIcon PowerPlugin::icon(const DockPart &dockPart, DGuiApplicationHelper::ColorType themeType)
|
QIcon PowerPlugin::icon(const DockPart &dockPart, DGuiApplicationHelper::ColorType themeType)
|
||||||
{
|
{
|
||||||
const QPixmap pixmap = m_powerStatusWidget->getBatteryIcon(themeType);
|
|
||||||
// 快捷面板使用m_quickPanel
|
// 快捷面板使用m_quickPanel
|
||||||
if (dockPart == DockPart::QuickPanel) {
|
if (dockPart == DockPart::QuickPanel) {
|
||||||
m_imageLabel->setPixmap(pixmap);
|
|
||||||
return QIcon();
|
return QIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QPixmap pixmap = m_powerStatusWidget->getBatteryIcon(themeType);
|
||||||
static QIcon batteryIcon;
|
static QIcon batteryIcon;
|
||||||
batteryIcon.detach();
|
batteryIcon.detach();
|
||||||
batteryIcon.addPixmap(pixmap);
|
batteryIcon.addPixmap(pixmap);
|
||||||
@ -289,8 +286,19 @@ void PowerPlugin::refreshTipsData()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PowerPlugin::initQuickPanel()
|
void PowerPlugin::onThemeTypeChanged(DGuiApplicationHelper::ColorType themeType)
|
||||||
{
|
{
|
||||||
|
const QPixmap pixmap = m_powerStatusWidget->getBatteryIcon(themeType);
|
||||||
|
m_imageLabel->setPixmap(pixmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PowerPlugin::initUi()
|
||||||
|
{
|
||||||
|
m_tipsLabel->setVisible(false);
|
||||||
|
m_tipsLabel->setObjectName("power");
|
||||||
|
m_preChargeTimer->setInterval(DELAYTIME);
|
||||||
|
m_preChargeTimer->setSingleShot(true);
|
||||||
|
|
||||||
m_quickPanel = new QWidget();
|
m_quickPanel = new QWidget();
|
||||||
QVBoxLayout *layout = new QVBoxLayout(m_quickPanel);
|
QVBoxLayout *layout = new QVBoxLayout(m_quickPanel);
|
||||||
layout->setAlignment(Qt::AlignVCenter);
|
layout->setAlignment(Qt::AlignVCenter);
|
||||||
@ -310,3 +318,9 @@ void PowerPlugin::initQuickPanel()
|
|||||||
layout->addSpacing(7);
|
layout->addSpacing(7);
|
||||||
layout->addWidget(m_labelText);
|
layout->addWidget(m_labelText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PowerPlugin::initConnection()
|
||||||
|
{
|
||||||
|
connect(m_preChargeTimer,&QTimer::timeout,this,&PowerPlugin::refreshTipsData);
|
||||||
|
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &PowerPlugin::onThemeTypeChanged);
|
||||||
|
}
|
||||||
|
@ -61,8 +61,12 @@ private:
|
|||||||
void updateBatteryVisible();
|
void updateBatteryVisible();
|
||||||
void loadPlugin();
|
void loadPlugin();
|
||||||
void onGSettingsChanged(const QString &key);
|
void onGSettingsChanged(const QString &key);
|
||||||
|
void initUi();
|
||||||
|
void initConnection();
|
||||||
|
|
||||||
|
private slots:
|
||||||
void refreshTipsData();
|
void refreshTipsData();
|
||||||
void initQuickPanel();
|
void onThemeTypeChanged(DGuiApplicationHelper::ColorType themeType);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_pluginLoaded;
|
bool m_pluginLoaded;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user