Fix use of leftover variable

This commit is contained in:
Matti Viljanen 2023-03-05 11:23:41 +02:00
parent 8ebebbb399
commit 0a88ca6692
No known key found for this signature in database
GPG key ID: CF32A1495158F888
2 changed files with 2 additions and 6 deletions

View file

@ -23,8 +23,6 @@ Battery::Battery(Settings* newSettings, Logger* newLogger, QObject* parent) : QO
logger = newLogger; logger = newLogger;
const QString notFound = "not found"; const QString notFound = "not found";
QStringList filenames;
// Battery charge percentage, number, e.g. 42 // Battery charge percentage, number, e.g. 42
const QStringList batteryFiles = { const QStringList batteryFiles = {
"/sys/class/power_supply/battery/capacity", "/sys/class/power_supply/battery/capacity",
@ -119,7 +117,7 @@ Battery::Battery(Settings* newSettings, Logger* newLogger, QObject* parent) : QO
"/sys/class/power_supply/battery/health", "/sys/class/power_supply/battery/health",
"/sys/class/power_supply/dollar_cove_battery/health" "/sys/class/power_supply/dollar_cove_battery/health"
}; };
foreach(const QString& file, filenames) { foreach(const QString& file, healthFiles) {
if(!healthFile && QFile::exists(file)) { if(!healthFile && QFile::exists(file)) {
healthFile = new QFile(file, this); healthFile = new QFile(file, this);
break; break;

View file

@ -34,8 +34,6 @@ Battery::Battery(Logger* newLogger, bool loglevelSet, QCoreApplication *app, QOb
chargeNotification = new MyNotification(this); chargeNotification = new MyNotification(this);
healthNotification = new MyNotification(this); healthNotification = new MyNotification(this);
QStringList filenames;
// Battery charge percentage, number, e.g. 42 // Battery charge percentage, number, e.g. 42
const QStringList capacityFiles = { const QStringList capacityFiles = {
"/sys/class/power_supply/battery/capacity", "/sys/class/power_supply/battery/capacity",
@ -171,7 +169,7 @@ Battery::Battery(Logger* newLogger, bool loglevelSet, QCoreApplication *app, QOb
"/sys/class/power_supply/battery/health", "/sys/class/power_supply/battery/health",
"/sys/class/power_supply/dollar_cove_battery/health" "/sys/class/power_supply/dollar_cove_battery/health"
}; };
foreach(const QString& file, filenames) { foreach(const QString& file, healthFiles) {
if(!healthFile && QFile::exists(file)) { if(!healthFile && QFile::exists(file)) {
healthFile = new QFile(file, this); healthFile = new QFile(file, this);
break; break;