mirror of
https://github.com/Quill-OS/quill.git
synced 2024-10-31 21:33:22 -07:00
66 lines
2.1 KiB
C++
66 lines
2.1 KiB
C++
|
#include "alert.h"
|
||
|
#include "ui_alert.h"
|
||
|
|
||
|
#include <QPixmap>
|
||
|
#include <QScreen>
|
||
|
#include <QFile>
|
||
|
#include <QProcess>
|
||
|
|
||
|
alert::alert(QWidget *parent) :
|
||
|
QWidget(parent),
|
||
|
ui(new Ui::alert)
|
||
|
{
|
||
|
ui->setupUi(this);
|
||
|
// Getting the screen's size
|
||
|
float sW = QGuiApplication::screens()[0]->size().width();
|
||
|
float sH = QGuiApplication::screens()[0]->size().height();
|
||
|
// Defining what the "Alert" icon size will be
|
||
|
float stdIconWidth = sW / 1.7;
|
||
|
float stdIconHeight = sH / 1.7;
|
||
|
|
||
|
QPixmap pixmap(":/resources/alert.png");
|
||
|
QPixmap scaledPixmap = pixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
|
||
|
ui->alertIconLabel->setPixmap(scaledPixmap);
|
||
|
|
||
|
// General stylesheet
|
||
|
QFile stylesheetFile(":/resources/eink_dark.qss");
|
||
|
stylesheetFile.open(QFile::ReadOnly);
|
||
|
this->setStyleSheet(stylesheetFile.readAll());
|
||
|
stylesheetFile.close();
|
||
|
|
||
|
ui->warningLabel->setStyleSheet("QLabel { background-color : black; color : white; font-size: 16pt}");
|
||
|
ui->messageLabel->setStyleSheet("QLabel { background-color : black; color : white; font-size: 9pt}");
|
||
|
ui->securityLabel->setStyleSheet("QLabel { background-color : black; color : white; font-size: 11pt}");
|
||
|
ui->continueBtn->setProperty("type", "borderless");
|
||
|
ui->resetBtn->setProperty("type", "borderless");
|
||
|
ui->continueBtn->setStyleSheet("padding: 20px");
|
||
|
ui->resetBtn->setStyleSheet("padding: 20px");
|
||
|
}
|
||
|
|
||
|
alert::~alert()
|
||
|
{
|
||
|
delete ui;
|
||
|
}
|
||
|
|
||
|
void alert::on_continueBtn_clicked()
|
||
|
{
|
||
|
// We continue anyway and re-set the ALERT flag
|
||
|
string_writeconfig("/external_root/boot/flags/ALERT", "false");
|
||
|
QProcess process;
|
||
|
process.startDetached("inkbox", QStringList());
|
||
|
qApp->quit();
|
||
|
}
|
||
|
|
||
|
void alert::on_resetBtn_clicked()
|
||
|
{
|
||
|
// 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/DIAGS_BOOT", "true");
|
||
|
QString reboot_prog ("busybox");
|
||
|
QStringList reboot_args;
|
||
|
reboot_args << "reboot";
|
||
|
QProcess *reboot_proc = new QProcess();
|
||
|
reboot_proc->start(reboot_prog, reboot_args);
|
||
|
reboot_proc->waitForFinished();
|
||
|
}
|