mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-26 23:57:22 -08:00
Implemented "Wipe KoBox user data" function
This commit is contained in:
parent
74937453ba
commit
f6099b9394
6 changed files with 78 additions and 1 deletions
14
functions.h
14
functions.h
|
@ -25,6 +25,8 @@ namespace global {
|
||||||
namespace kobox {
|
namespace kobox {
|
||||||
inline bool showKoboxSplash;
|
inline bool showKoboxSplash;
|
||||||
inline bool koboxSettingsRebootDialog;
|
inline bool koboxSettingsRebootDialog;
|
||||||
|
inline bool resetKoboxUserDataBool;
|
||||||
|
inline bool resetKoboxDialog;
|
||||||
}
|
}
|
||||||
namespace mainwindow {
|
namespace mainwindow {
|
||||||
namespace tabSwitcher {
|
namespace tabSwitcher {
|
||||||
|
@ -243,13 +245,21 @@ namespace {
|
||||||
if(splash == true) {
|
if(splash == true) {
|
||||||
QString prog ("reboot");
|
QString prog ("reboot");
|
||||||
QStringList args;
|
QStringList args;
|
||||||
|
if(global::kobox::resetKoboxUserDataBool == true) {
|
||||||
|
args << "splash" << "reset_kobox";
|
||||||
|
}
|
||||||
QProcess *proc = new QProcess();
|
QProcess *proc = new QProcess();
|
||||||
proc->start(prog, args);
|
proc->start(prog, args);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QString prog ("reboot");
|
QString prog ("reboot");
|
||||||
QStringList args;
|
QStringList args;
|
||||||
|
if(global::kobox::resetKoboxUserDataBool == true) {
|
||||||
|
args << "no_splash" << "reset_kobox";
|
||||||
|
}
|
||||||
|
else {
|
||||||
args << "no_splash";
|
args << "no_splash";
|
||||||
|
}
|
||||||
QProcess *proc = new QProcess();
|
QProcess *proc = new QProcess();
|
||||||
proc->start(prog, args);
|
proc->start(prog, args);
|
||||||
}
|
}
|
||||||
|
@ -289,5 +299,9 @@ namespace {
|
||||||
global::systemInfoText.append(kernelVersion);
|
global::systemInfoText.append(kernelVersion);
|
||||||
global::systemInfoText.append("\n");
|
global::systemInfoText.append("\n");
|
||||||
}
|
}
|
||||||
|
void resetKoboxUserData() {
|
||||||
|
global::kobox::resetKoboxUserDataBool = true;
|
||||||
|
reboot(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif // FUNCTIONS_H
|
#endif // FUNCTIONS_H
|
||||||
|
|
|
@ -95,6 +95,7 @@ generalDialog::generalDialog(QWidget *parent) :
|
||||||
this->adjustSize();
|
this->adjustSize();
|
||||||
}
|
}
|
||||||
else if(global::text::textBrowserDialog == true) {
|
else if(global::text::textBrowserDialog == true) {
|
||||||
|
textBrowserDialog = true;
|
||||||
textwidgetWindow = new textwidget();
|
textwidgetWindow = new textwidget();
|
||||||
ui->headerLabel->setText("Information");
|
ui->headerLabel->setText("Information");
|
||||||
ui->stackedWidget->setCurrentIndex(1);
|
ui->stackedWidget->setCurrentIndex(1);
|
||||||
|
@ -102,6 +103,14 @@ generalDialog::generalDialog(QWidget *parent) :
|
||||||
ui->mainStackedWidget->setCurrentIndex(1);
|
ui->mainStackedWidget->setCurrentIndex(1);
|
||||||
this->adjustSize();
|
this->adjustSize();
|
||||||
}
|
}
|
||||||
|
else if(global::kobox::resetKoboxDialog == true) {
|
||||||
|
resetKoboxDialog = true;
|
||||||
|
ui->headerLabel->setText("Warning");
|
||||||
|
ui->okBtn->setText("Proceed");
|
||||||
|
ui->cancelBtn->setText("Go back");
|
||||||
|
ui->bodyLabel->setText("This will erase all KoBox user data. KoBox settings will be reset.");
|
||||||
|
this->adjustSize();
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
// We shouldn't be there ;)
|
// We shouldn't be there ;)
|
||||||
;
|
;
|
||||||
|
@ -178,6 +187,9 @@ void generalDialog::on_okBtn_clicked()
|
||||||
usbmsWindow->setGeometry(QRect(QPoint(0,0), screen()->geometry ().size()));
|
usbmsWindow->setGeometry(QRect(QPoint(0,0), screen()->geometry ().size()));
|
||||||
usbmsWindow->show();
|
usbmsWindow->show();
|
||||||
}
|
}
|
||||||
|
if(resetKoboxDialog == true) {
|
||||||
|
resetKoboxUserData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void generalDialog::on_acceptBtn_clicked()
|
void generalDialog::on_acceptBtn_clicked()
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,6 +26,7 @@ public:
|
||||||
bool lowBatteryDialog = false;
|
bool lowBatteryDialog = false;
|
||||||
bool usbmsDialog = false;
|
bool usbmsDialog = false;
|
||||||
bool textBrowserDialog = false;
|
bool textBrowserDialog = false;
|
||||||
|
bool resetKoboxDialog = false;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_cancelBtn_clicked();
|
void on_cancelBtn_clicked();
|
||||||
|
|
|
@ -14,6 +14,7 @@ koboxSettings::koboxSettings(QWidget *parent) :
|
||||||
// UI tweaks
|
// UI tweaks
|
||||||
ui->okBtn->setProperty("type", "borderless");
|
ui->okBtn->setProperty("type", "borderless");
|
||||||
ui->pushButton->setProperty("type", "borderless");
|
ui->pushButton->setProperty("type", "borderless");
|
||||||
|
ui->resetKoboxBtn->setProperty("type", "borderless");
|
||||||
|
|
||||||
// Stylesheet
|
// Stylesheet
|
||||||
QFile stylesheetFile(":/resources/eink.qss");
|
QFile stylesheetFile(":/resources/eink.qss");
|
||||||
|
@ -75,6 +76,12 @@ void koboxSettings::openSettingsRebootDialog() {
|
||||||
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
generalDialogWindow->show();
|
generalDialogWindow->show();
|
||||||
}
|
}
|
||||||
|
void koboxSettings::openResetKoboxDialog() {
|
||||||
|
global::kobox::resetKoboxDialog = true;
|
||||||
|
generalDialogWindow = new generalDialog(this);
|
||||||
|
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
generalDialogWindow->show();
|
||||||
|
}
|
||||||
|
|
||||||
void koboxSettings::on_spinBox_valueChanged(int arg1)
|
void koboxSettings::on_spinBox_valueChanged(int arg1)
|
||||||
{
|
{
|
||||||
|
@ -95,3 +102,8 @@ void koboxSettings::on_pushButton_clicked()
|
||||||
usbmsWindow->setGeometry(QRect(QPoint(0,0), screen()->geometry ().size()));
|
usbmsWindow->setGeometry(QRect(QPoint(0,0), screen()->geometry ().size()));
|
||||||
usbmsWindow->show();
|
usbmsWindow->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void koboxSettings::on_resetKoboxBtn_clicked()
|
||||||
|
{
|
||||||
|
openResetKoboxDialog();
|
||||||
|
}
|
||||||
|
|
|
@ -20,12 +20,14 @@ public:
|
||||||
|
|
||||||
bool not_user_change = false;
|
bool not_user_change = false;
|
||||||
void openSettingsRebootDialog();
|
void openSettingsRebootDialog();
|
||||||
|
void openResetKoboxDialog();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_okBtn_clicked();
|
void on_okBtn_clicked();
|
||||||
void on_checkBox_toggled(bool checked);
|
void on_checkBox_toggled(bool checked);
|
||||||
void on_spinBox_valueChanged(int arg1);
|
void on_spinBox_valueChanged(int arg1);
|
||||||
void on_pushButton_clicked();
|
void on_pushButton_clicked();
|
||||||
|
void on_resetKoboxBtn_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::koboxSettings *ui;
|
Ui::koboxSettings *ui;
|
||||||
|
|
|
@ -64,6 +64,9 @@ OK
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QStackedWidget" name="stackedWidget">
|
<widget class="QStackedWidget" name="stackedWidget">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<widget class="QWidget" name="page">
|
<widget class="QWidget" name="page">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
|
@ -230,6 +233,39 @@ OK
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>Reset KoBox</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<spacer name="horizontalSpacer_5">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QPushButton" name="resetKoboxBtn">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Reset</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0">
|
<item row="7" column="0">
|
||||||
|
|
Loading…
Reference in a new issue