Skip to content

Commit

Permalink
Update powerkit_dialog.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
rodlie committed Feb 4, 2024
1 parent fe57a7f commit aaa7bf6
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/powerkit_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -867,26 +867,27 @@ void Dialog::drawBattery()
const auto battery = Client::getBatteryLeft(dbus);
const auto onBattery = Client::onBattery(dbus);
QString batteryTime = QDateTime::fromTime_t(onBattery ? Client::timeToEmpty(dbus) : Client::timeToFull(dbus)).toUTC().toString("hh:mm");
QColor color = Qt::green;
QColor colorBg = Qt::green;
QColor colorFg = Qt::white;
if (onBattery) {
if (battery >= 76) {
color = Qt::gray;
} else if (battery >= 51) {
color = Qt::yellow;
if (battery >= 51) {
colorBg = Qt::yellow;
} else if (battery >= 26) {
color = QColor("orange");
colorBg = QColor("orange");
} else {
color = Qt::red;
colorBg = Qt::red;
}
} else {
if (battery == 100) { colorFg = Qt::green; }
}
batteryStatusLabel->setPixmap(Theme::drawCircleProgress(battery,
64,
4,
4,
true,
QString("%1%\n%2").arg(QString::number(battery), batteryTime),
color,
Qt::white));
colorBg,
colorFg));
}

void Dialog::drawCpu()
Expand Down

0 comments on commit aaa7bf6

Please sign in to comment.