Relocate poweroff/reboot functions

This commit is contained in:
Nicolas Mailloux 2021-05-28 08:36:24 -04:00
parent 958dde6491
commit f42ef53338
6 changed files with 17 additions and 18 deletions

View file

@ -99,9 +99,9 @@ void alert::on_resetBtn_clicked()
// We set the DO_FACTORY_RESET flag and we restart the Kobo // We set the DO_FACTORY_RESET flag and we restart the Kobo
string_writeconfig("/external_root/boot/flags/DO_FACTORY_RESET", "true"); string_writeconfig("/external_root/boot/flags/DO_FACTORY_RESET", "true");
string_writeconfig("/external_root/boot/flags/DIAGS_BOOT", "true"); string_writeconfig("/external_root/boot/flags/DIAGS_BOOT", "true");
QString reboot_prog ("busybox"); QString reboot_prog ("/sbin/reboot");
QStringList reboot_args; QStringList reboot_args;
reboot_args << "reboot"; reboot_args << "no_splash";
QProcess *reboot_proc = new QProcess(); QProcess *reboot_proc = new QProcess();
reboot_proc->start(reboot_prog, reboot_args); reboot_proc->start(reboot_prog, reboot_args);
reboot_proc->waitForFinished(); reboot_proc->waitForFinished();

View file

@ -218,15 +218,15 @@ namespace {
} }
void poweroff(bool splash) { void poweroff(bool splash) {
if(splash == true) { if(splash == true) {
QString prog ("poweroff"); QString prog ("/sbin/poweroff");
QStringList args; QStringList args;
QProcess *proc = new QProcess(); QProcess *proc = new QProcess();
proc->start(prog, args); proc->start(prog, args);
} }
else { else {
QString prog ("busybox"); QString prog ("/sbin/poweroff");
QStringList args; QStringList args;
args << "poweroff"; args << "no_splash";
QProcess *proc = new QProcess(); QProcess *proc = new QProcess();
proc->start(prog, args); proc->start(prog, args);
} }
@ -239,9 +239,9 @@ namespace {
proc->start(prog, args); proc->start(prog, args);
} }
else { else {
QString prog ("busybox"); QString prog ("reboot");
QStringList args; QStringList args;
args << "reboot"; args << "no_splash";
QProcess *proc = new QProcess(); QProcess *proc = new QProcess();
proc->start(prog, args); proc->start(prog, args);
} }

View file

@ -133,7 +133,7 @@ void generalDialog::on_okBtn_clicked()
// We set a custom boot flag and reboot silently in Diagnostics // We set a custom boot flag and reboot silently in Diagnostics
string_writeconfig("/external_root/boot/flags/DIAGS_BOOT", "true"); string_writeconfig("/external_root/boot/flags/DIAGS_BOOT", "true");
string_writeconfig("/external_root/boot/flags/DO_SOFT_RESET", "true"); string_writeconfig("/external_root/boot/flags/DO_SOFT_RESET", "true");
QString prog ("reboot"); QString prog ("/sbin/reboot");
QStringList args; QStringList args;
QProcess *proc = new QProcess(); QProcess *proc = new QProcess();
proc->start(prog, args); proc->start(prog, args);

View file

@ -302,12 +302,11 @@ reader::reader(QWidget *parent) :
} }
else { else {
if(checkconfig("/opt/inkbox_genuine") == true) { if(checkconfig("/opt/inkbox_genuine") == true) {
QDir::setCurrent("/mnt/onboard/onboard"); QDir::setCurrent("/mnt/onboard");
QFileDialog *dialog = new QFileDialog(this); QFileDialog *dialog = new QFileDialog(this);
// https://forum.qt.io/topic/29471/solve-how-to-show-qfiledialog-at-center-position-screen/4
// Showing dialog in full screen QDesktopWidget desk;
dialog->setWindowState(Qt::WindowFullScreen); QRect screenres = desk.screenGeometry(0); dialog->setGeometry(QRect(screenres.width()/4,screenres.height() /4,screenres.width()/2,screenres.height()/2));
stylesheetFile.open(QFile::ReadOnly); stylesheetFile.open(QFile::ReadOnly);
dialog->setStyleSheet(stylesheetFile.readAll()); dialog->setStyleSheet(stylesheetFile.readAll());
stylesheetFile.close(); stylesheetFile.close();

View file

@ -376,9 +376,9 @@ void settings::on_usbmsBtn_clicked()
string contentstr = content.toStdString(); string contentstr = content.toStdString();
modules.close(); modules.close();
if(contentstr.find("1") != std::string::npos) { if(contentstr.find("1") != std::string::npos) {
QString reboot_prog ("busybox"); QString reboot_prog ("/sbin/reboot");
QStringList reboot_args; QStringList reboot_args;
reboot_args << "reboot"; reboot_args << "no_splash";
QProcess *reboot_proc = new QProcess(); QProcess *reboot_proc = new QProcess();
reboot_proc->start(reboot_prog, reboot_args); reboot_proc->start(reboot_prog, reboot_args);
reboot_proc->waitForFinished(); reboot_proc->waitForFinished();
@ -479,7 +479,7 @@ void settings::on_updateBtn_clicked()
string_writeconfig("/mnt/onboard/onboard/.inkbox/can_really_update", "true"); string_writeconfig("/mnt/onboard/onboard/.inkbox/can_really_update", "true");
string_writeconfig("/external_root/opt/update/will_update", "true"); string_writeconfig("/external_root/opt/update/will_update", "true");
string_writeconfig("/external_root/boot/flags/WILL_UPDATE", "true"); string_writeconfig("/external_root/boot/flags/WILL_UPDATE", "true");
QString prog ("reboot"); QString prog ("/sbin/reboot");
QStringList args; QStringList args;
QProcess *proc = new QProcess(); QProcess *proc = new QProcess();
proc->start(prog, args); proc->start(prog, args);

View file

@ -120,9 +120,9 @@ void usbms_splash::usbms_launch()
std::string contentstr = content.toStdString(); std::string contentstr = content.toStdString();
modules.close(); modules.close();
if(contentstr.find("1") != std::string::npos) { if(contentstr.find("1") != std::string::npos) {
QString reboot_prog ("busybox"); QString reboot_prog ("/sbin/reboot");
QStringList reboot_args; QStringList reboot_args;
reboot_args << "reboot"; reboot_args << "no_splash";
QProcess *reboot_proc = new QProcess(); QProcess *reboot_proc = new QProcess();
reboot_proc->start(reboot_prog, reboot_args); reboot_proc->start(reboot_prog, reboot_args);
reboot_proc->waitForFinished(); reboot_proc->waitForFinished();