mirror of
https://github.com/Quill-OS/quill.git
synced 2024-11-01 05:43:21 -07:00
51fad25719
WIP, some changes coming, notably a critical/low battery alert, and some big code revamping.
73 lines
1.7 KiB
C++
73 lines
1.7 KiB
C++
#include "quit.h"
|
|
#include "ui_quit.h"
|
|
#include "functions.h"
|
|
#include <QProcess>
|
|
#include <QIcon>
|
|
#include <QPixmap>
|
|
#include <QFile>
|
|
#include <QDebug>
|
|
#include <QScreen>
|
|
|
|
quit::quit(QWidget *parent) :
|
|
QWidget(parent),
|
|
ui(new Ui::quit)
|
|
{
|
|
ui->setupUi(this);
|
|
|
|
ui->pushButton->setProperty("type", "borderless");
|
|
ui->pushButton_2->setProperty("type", "borderless");
|
|
ui->pushButton_3->setProperty("type", "borderless");
|
|
ui->pushButton_4->setProperty("type", "borderless");
|
|
ui->backBtn->setProperty("type", "borderless");
|
|
|
|
// Stylesheet
|
|
QFile stylesheetFile(":/resources/eink.qss");
|
|
stylesheetFile.open(QFile::ReadOnly);
|
|
this->setStyleSheet(stylesheetFile.readAll());
|
|
stylesheetFile.close();
|
|
|
|
// Getting the screen's size
|
|
float sW = QGuiApplication::screens()[0]->size().width();
|
|
float sH = QGuiApplication::screens()[0]->size().height();
|
|
// Defining what the "Quit" icon size will be
|
|
float stdIconWidth = sW / 1.25;
|
|
float stdIconHeight = sH / 1.25;
|
|
|
|
QPixmap pixmap(":/resources/exit.png");
|
|
QPixmap scaledPixmap = pixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
|
|
ui->label->setPixmap(scaledPixmap);
|
|
|
|
}
|
|
|
|
quit::~quit()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
void quit::on_pushButton_clicked()
|
|
{
|
|
poweroff(true);
|
|
}
|
|
|
|
void quit::on_pushButton_2_clicked()
|
|
{
|
|
reboot(true);
|
|
}
|
|
|
|
void quit::on_pushButton_4_clicked()
|
|
{
|
|
QProcess process;
|
|
process.startDetached("inkbox", QStringList());
|
|
qApp->quit();
|
|
}
|
|
|
|
void quit::on_backBtn_clicked()
|
|
{
|
|
quit::close();
|
|
}
|
|
|
|
void quit::on_pushButton_3_clicked()
|
|
{
|
|
// inotifywait waits for a MODIFY event, so we just do it instead of evtest and the power button
|
|
string_writeconfig("/external_root/tmp/power", "state changed");
|
|
}
|