mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-25 15:17:21 -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
16
functions.h
16
functions.h
|
@ -25,6 +25,8 @@ namespace global {
|
|||
namespace kobox {
|
||||
inline bool showKoboxSplash;
|
||||
inline bool koboxSettingsRebootDialog;
|
||||
inline bool resetKoboxUserDataBool;
|
||||
inline bool resetKoboxDialog;
|
||||
}
|
||||
namespace mainwindow {
|
||||
namespace tabSwitcher {
|
||||
|
@ -243,13 +245,21 @@ namespace {
|
|||
if(splash == true) {
|
||||
QString prog ("reboot");
|
||||
QStringList args;
|
||||
if(global::kobox::resetKoboxUserDataBool == true) {
|
||||
args << "splash" << "reset_kobox";
|
||||
}
|
||||
QProcess *proc = new QProcess();
|
||||
proc->start(prog, args);
|
||||
}
|
||||
else {
|
||||
QString prog ("reboot");
|
||||
QStringList args;
|
||||
args << "no_splash";
|
||||
if(global::kobox::resetKoboxUserDataBool == true) {
|
||||
args << "no_splash" << "reset_kobox";
|
||||
}
|
||||
else {
|
||||
args << "no_splash";
|
||||
}
|
||||
QProcess *proc = new QProcess();
|
||||
proc->start(prog, args);
|
||||
}
|
||||
|
@ -289,5 +299,9 @@ namespace {
|
|||
global::systemInfoText.append(kernelVersion);
|
||||
global::systemInfoText.append("\n");
|
||||
}
|
||||
void resetKoboxUserData() {
|
||||
global::kobox::resetKoboxUserDataBool = true;
|
||||
reboot(true);
|
||||
}
|
||||
}
|
||||
#endif // FUNCTIONS_H
|
||||
|
|
|
@ -95,6 +95,7 @@ generalDialog::generalDialog(QWidget *parent) :
|
|||
this->adjustSize();
|
||||
}
|
||||
else if(global::text::textBrowserDialog == true) {
|
||||
textBrowserDialog = true;
|
||||
textwidgetWindow = new textwidget();
|
||||
ui->headerLabel->setText("Information");
|
||||
ui->stackedWidget->setCurrentIndex(1);
|
||||
|
@ -102,6 +103,14 @@ generalDialog::generalDialog(QWidget *parent) :
|
|||
ui->mainStackedWidget->setCurrentIndex(1);
|
||||
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 {
|
||||
// We shouldn't be there ;)
|
||||
;
|
||||
|
@ -178,6 +187,9 @@ void generalDialog::on_okBtn_clicked()
|
|||
usbmsWindow->setGeometry(QRect(QPoint(0,0), screen()->geometry ().size()));
|
||||
usbmsWindow->show();
|
||||
}
|
||||
if(resetKoboxDialog == true) {
|
||||
resetKoboxUserData();
|
||||
}
|
||||
}
|
||||
void generalDialog::on_acceptBtn_clicked()
|
||||
{
|
||||
|
|
|
@ -26,6 +26,7 @@ public:
|
|||
bool lowBatteryDialog = false;
|
||||
bool usbmsDialog = false;
|
||||
bool textBrowserDialog = false;
|
||||
bool resetKoboxDialog = false;
|
||||
|
||||
private slots:
|
||||
void on_cancelBtn_clicked();
|
||||
|
|
|
@ -14,6 +14,7 @@ koboxSettings::koboxSettings(QWidget *parent) :
|
|||
// UI tweaks
|
||||
ui->okBtn->setProperty("type", "borderless");
|
||||
ui->pushButton->setProperty("type", "borderless");
|
||||
ui->resetKoboxBtn->setProperty("type", "borderless");
|
||||
|
||||
// Stylesheet
|
||||
QFile stylesheetFile(":/resources/eink.qss");
|
||||
|
@ -75,6 +76,12 @@ void koboxSettings::openSettingsRebootDialog() {
|
|||
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||
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)
|
||||
{
|
||||
|
@ -95,3 +102,8 @@ void koboxSettings::on_pushButton_clicked()
|
|||
usbmsWindow->setGeometry(QRect(QPoint(0,0), screen()->geometry ().size()));
|
||||
usbmsWindow->show();
|
||||
}
|
||||
|
||||
void koboxSettings::on_resetKoboxBtn_clicked()
|
||||
{
|
||||
openResetKoboxDialog();
|
||||
}
|
||||
|
|
|
@ -20,12 +20,14 @@ public:
|
|||
|
||||
bool not_user_change = false;
|
||||
void openSettingsRebootDialog();
|
||||
void openResetKoboxDialog();
|
||||
|
||||
private slots:
|
||||
void on_okBtn_clicked();
|
||||
void on_checkBox_toggled(bool checked);
|
||||
void on_spinBox_valueChanged(int arg1);
|
||||
void on_pushButton_clicked();
|
||||
void on_resetKoboxBtn_clicked();
|
||||
|
||||
private:
|
||||
Ui::koboxSettings *ui;
|
||||
|
|
|
@ -64,6 +64,9 @@ OK
|
|||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="leftMargin">
|
||||
|
@ -230,6 +233,39 @@ OK
|
|||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
|
|
Loading…
Reference in a new issue