Don't alert on "100% idle", increase readability

This commit is contained in:
Matti Viljanen 2020-06-01 18:56:03 +03:00
parent f698a4c336
commit 28d4e4277d
No known key found for this signature in database
GPG key ID: CF32A1495158F888
2 changed files with 4 additions and 4 deletions

View file

@ -166,12 +166,12 @@ void Battery::showNotification() {
qInfo() << "battery" << charge << "low" << settings->getLowAlert() << "high" << settings->getHighAlert() << "state" << state; qInfo() << "battery" << charge << "low" << settings->getLowAlert() << "high" << settings->getHighAlert() << "state" << state;
if(charge <= settings->getLowAlert() && state.compare("charging")) { if(charge <= settings->getLowAlert() && state != "charging") {
qDebug() << "Battery notification timer: empty enough battery"; qDebug() << "Battery notification timer: empty enough battery";
notification->send(settings->getNotificationTitle().arg(charge), settings->getNotificationLowText(), settings->getLowAlertFile()); notification->send(settings->getNotificationTitle().arg(charge), settings->getNotificationLowText(), settings->getLowAlertFile());
} }
else if((charge >= settings->getHighAlert() && state.compare("discharging")) else if((charge >= settings->getHighAlert() && state != "discharging")
|| (charge == 100 && !state.compare("idle"))) { && !(charge == 100 && state == "idle")) {
qDebug() << "Battery notification timer: full enough battery"; qDebug() << "Battery notification timer: full enough battery";
notification->send(settings->getNotificationTitle().arg(charge), settings->getNotificationHighText(), settings->getHighAlertFile()); notification->send(settings->getNotificationTitle().arg(charge), settings->getNotificationHighText(), settings->getHighAlertFile());
} }

View file

@ -62,7 +62,7 @@ void Notification::send(QString title, QString body, QString soundFile)
void Notification::close() void Notification::close()
{ {
if(noteID.compare("1") == 0) if(noteID == "1")
return; return;
QStringList args; QStringList args;