Don't try to use charging control when running on SDK

This commit is contained in:
Matti Viljanen 2020-03-21 01:30:28 +02:00
parent b994721229
commit 5a3af9894d
No known key found for this signature in database
GPG key ID: CF32A1495158F888
2 changed files with 7 additions and 1 deletions

View file

@ -34,6 +34,11 @@ Battery::Battery(Settings* newSettings, QObject* parent) : QObject(parent)
qInfo() << "Reading charger status from" << chargerConnectedFile->fileName();
// ENABLE/DISABLE CHARGING
if(QHostInfo::localHostName().contains("SailfishEmul")) {
qInfo() << "Sailfish SDK detected";
qInfo() << "Charger control feature disabled";
}
else {
chargingEnabledFile = new QFile(this);
// e.g. for Sony Xperia XA2
@ -74,7 +79,7 @@ Battery::Battery(Settings* newSettings, QObject* parent) : QObject(parent)
qWarning() << "Charger control file" << chargingEnabledFile->fileName() << "is not writable";
qWarning() << "Charger control feature disabled";
}
}
}
// TODO

View file

@ -21,6 +21,7 @@
#include <QObject>
#include <QString>
#include <QFile>
#include <QHostInfo>
#include <QDebug>
#include "settings.h"