mirror of
https://github.com/Quill-OS/quill.git
synced 2024-11-01 05:43:21 -07:00
Show fake battery status on emulator
This commit is contained in:
parent
a020f1c093
commit
0b1fb63142
2 changed files with 13 additions and 10 deletions
18
functions.h
18
functions.h
|
@ -291,12 +291,18 @@ namespace {
|
||||||
}
|
}
|
||||||
void get_battery_level() {
|
void get_battery_level() {
|
||||||
QFile batt_level_file("/sys/devices/platform/pmic_battery.1/power_supply/mc13892_bat/capacity");
|
QFile batt_level_file("/sys/devices/platform/pmic_battery.1/power_supply/mc13892_bat/capacity");
|
||||||
batt_level_file.open(QIODevice::ReadOnly);
|
if(batt_level_file.exists()) {
|
||||||
batt_level = batt_level_file.readAll();
|
batt_level_file.open(QIODevice::ReadOnly);
|
||||||
batt_level = batt_level.trimmed();
|
batt_level = batt_level_file.readAll();
|
||||||
batt_level_int = batt_level.toInt();
|
batt_level = batt_level.trimmed();
|
||||||
batt_level = batt_level.append("%");
|
batt_level_int = batt_level.toInt();
|
||||||
batt_level_file.close();
|
batt_level = batt_level.append("%");
|
||||||
|
batt_level_file.close();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
batt_level_int = 100;
|
||||||
|
batt_level = "100%";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void writeconfig(std::string file, std::string config) {
|
void writeconfig(std::string file, std::string config) {
|
||||||
std::ofstream fhandler;
|
std::ofstream fhandler;
|
||||||
|
|
|
@ -328,10 +328,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
string_checkconfig_ro("/opt/inkbox_device");
|
batteryWatchdog->start();
|
||||||
if(checkconfig_str_val != "emu\n") {
|
|
||||||
batteryWatchdog->start();
|
|
||||||
}
|
|
||||||
|
|
||||||
// USB mass storage prompt
|
// USB mass storage prompt
|
||||||
QTimer *usbmsPrompt = new QTimer(this);
|
QTimer *usbmsPrompt = new QTimer(this);
|
||||||
|
|
Loading…
Reference in a new issue