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 69e15aa commit bea47db
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/powerkit_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,7 @@ void Dialog::drawBattery()
QString batteryTime = QDateTime::fromTime_t(onBattery ? Client::timeToEmpty(dbus) : Client::timeToFull(dbus)).toUTC().toString("hh:mm");
QColor colorBg = Qt::green;
QColor colorFg = Qt::white;
QString status = QString("%1%\n%2").arg(QString::number(battery), batteryTime);
if (onBattery) {
if (battery >= 51) {
colorBg = Qt::yellow;
Expand All @@ -878,14 +879,17 @@ void Dialog::drawBattery()
colorBg = Qt::red;
}
} else {
if (battery == 100) { colorFg = Qt::green; }
if (battery == 100) {
colorFg = Qt::green;
status = QString("%1%").arg(QString::number(battery));
}
}
batteryStatusLabel->setPixmap(Theme::drawCircleProgress(battery,
64,
4,
4,
true,
QString("%1%\n%2").arg(QString::number(battery), batteryTime),
status,
colorBg,
colorFg));
}
Expand Down

0 comments on commit bea47db

Please sign in to comment.