parent
9ac5005d1a
commit
98eb6f43d0
|
@ -1909,29 +1909,6 @@ QString LockWidget::getBatteryIconName()
|
|||
return QString();
|
||||
}
|
||||
|
||||
QString LockWidget::getBatteryIconName()
|
||||
{
|
||||
if (iface->isValid() && dface->isValid()) {
|
||||
bool batteryState = false;
|
||||
QDBusReply<QVariant> reply = batInterface->call("Get", UPOWER_SERVICE, "OnBattery");
|
||||
if (reply.isValid()) {
|
||||
batteryState = reply.value().toBool();
|
||||
}
|
||||
double percentage = -1.0;
|
||||
QDBusReply<QVariant> percentage_reply = iface->call("Get", UPOWER_DIVICES_SERVICE, "Percentage");
|
||||
if (percentage_reply.isValid()) {
|
||||
percentage = percentage_reply.value().toDouble();
|
||||
}
|
||||
|
||||
if (true == batteryState) {
|
||||
return QString("battery-level-%1-symbolic").arg((int)percentage / 10 * 10);
|
||||
} else {
|
||||
return QString("battery-level-%1-charging-symbolic").arg((int)percentage / 10 * 10);
|
||||
}
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
int LockWidget::getLoginedNum()
|
||||
{
|
||||
if(loginedNum != 0)
|
||||
|
|
Loading…
Reference in New Issue