代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/kiran-cc-daemon 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From d24efc2aec6c4fbc00a4536998caf30553dc1e9b Mon Sep 17 00:00:00 2001
From: meizhigang <meizhigang@kylinsec.com.cn>
Date: Tue, 9 Apr 2024 14:09:04 +0800
Subject: [PATCH 13/14] fix(power):Fix battery charging and discharging time
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 适配电池充电和放电时间
Related #28618
---
plugins/power/tray/power-tray.cpp | 41 ++++++++++++++++++++-----------
1 file changed, 26 insertions(+), 15 deletions(-)
diff --git a/plugins/power/tray/power-tray.cpp b/plugins/power/tray/power-tray.cpp
index 8f76bcb..c372ef9 100644
--- a/plugins/power/tray/power-tray.cpp
+++ b/plugins/power/tray/power-tray.cpp
@@ -107,30 +107,41 @@ void PowerTray::update_status_icon_toolstip(std::shared_ptr<PowerUPowerDevice> d
{
case UP_DEVICE_STATE_CHARGING:
{
- auto time_to_full_text = PowerUtils::get_time_translation(device_for_tray->get_props().time_to_full);
- auto tooltip_text = fmt::format(_("Remaining electricty: {0:.1f}%, approximately {1} until charged"),
- device_for_tray->get_props().percentage,
- time_to_full_text);
- gtk_status_icon_set_tooltip_text(this->status_icon_, tooltip_text.c_str());
+ auto time_to_full = device_for_tray->get_props().time_to_full;
+ if (time_to_full > 0)
+ {
+ auto time_to_full_text = PowerUtils::get_time_translation(time_to_full);
+ auto tooltip_text = fmt::format(_("Remaining electricty: {0:.1f}%, approximately {1} until charged"),
+ device_for_tray->get_props().percentage,
+ time_to_full_text);
+ gtk_status_icon_set_tooltip_text(this->status_icon_, tooltip_text.c_str());
+
+ return;
+ }
break;
}
case UP_DEVICE_STATE_DISCHARGING:
{
- auto time_to_empty_text = PowerUtils::get_time_translation(device_for_tray->get_props().time_to_empty);
- auto tooltip_text = fmt::format(_("Remaining electricty: {0:.1f}%, approximately provides {1} runtime"),
- device_for_tray->get_props().percentage,
- time_to_empty_text);
- gtk_status_icon_set_tooltip_text(this->status_icon_, tooltip_text.c_str());
+ auto time_to_empty = device_for_tray->get_props().time_to_empty;
+ if (time_to_empty > 0)
+ {
+ auto time_to_empty_text = PowerUtils::get_time_translation(time_to_empty);
+ auto tooltip_text = fmt::format(_("Remaining electricty: {0:.1f}%, approximately provides {1} runtime"),
+ device_for_tray->get_props().percentage,
+ time_to_empty_text);
+ gtk_status_icon_set_tooltip_text(this->status_icon_, tooltip_text.c_str());
+
+ return;
+ }
break;
}
case UP_DEVICE_STATE_FULLY_CHARGED:
default:
- {
- auto tooltip_text = fmt::format(_("Remaining electricty: {0:.1f}%"), device_for_tray->get_props().percentage);
- gtk_status_icon_set_tooltip_text(this->status_icon_, tooltip_text.c_str());
- }
- break;
+ break;
}
+
+ auto tooltip_text = fmt::format(_("Remaining electricty: {0:.1f}%"), device_for_tray->get_props().percentage);
+ gtk_status_icon_set_tooltip_text(this->status_icon_, tooltip_text.c_str());
}
void PowerTray::delay_update_status_icon()
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。