mirror of
https://github.com/Quill-OS/quill.git
synced 2024-10-31 21:33:22 -07:00
KoBox settings: enable/disable X11
This commit is contained in:
parent
3404337e29
commit
e19f3867ca
7 changed files with 191 additions and 44 deletions
|
@ -24,6 +24,7 @@ namespace global {
|
|||
}
|
||||
namespace kobox {
|
||||
inline bool showKoboxSplash;
|
||||
inline bool koboxSettingsRebootDialog;
|
||||
}
|
||||
namespace mainwindow {
|
||||
namespace tabSwitcher {
|
||||
|
@ -37,6 +38,9 @@ namespace global {
|
|||
inline bool updateDialog;
|
||||
inline bool lowBatteryDialog;
|
||||
}
|
||||
namespace settings {
|
||||
inline bool settingsRebootDialog;
|
||||
}
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/questions/6080853/c-multiple-definition-error-for-global-functions-in-the-header-file/20679534#20679534
|
||||
|
|
|
@ -62,13 +62,18 @@ generalDialog::generalDialog(QWidget *parent) :
|
|||
this->adjustSize();
|
||||
string_writeconfig("/inkbox/updateDialog", "false");
|
||||
}
|
||||
else if(checkconfig("/inkbox/settingsRebootDialog") == true) {
|
||||
else if(global::settings::settingsRebootDialog == true) {
|
||||
settingsRebootDialog = true;
|
||||
ui->stackedWidget->setCurrentIndex(1);
|
||||
ui->bodyLabel->setText("The settings you chose might require a complete reboot of the device for them to work properly.");
|
||||
if(global::kobox::koboxSettingsRebootDialog == true) {
|
||||
koboxSettingsRebootDialog = true;
|
||||
ui->bodyLabel->setText("The device will reboot now, since the settings you chose require it to work properly.");
|
||||
}
|
||||
else {
|
||||
ui->bodyLabel->setText("The settings you chose might require a complete reboot of the device for them to work properly.");
|
||||
}
|
||||
ui->headerLabel->setText("Information");
|
||||
this->adjustSize();
|
||||
string_writeconfig("/inkbox/settingsRebootDialog", "false");
|
||||
}
|
||||
else if(global::mainwindow::lowBatteryDialog == true) {
|
||||
lowBatteryDialog = true;
|
||||
|
@ -158,9 +163,14 @@ void generalDialog::on_acceptBtn_clicked()
|
|||
}
|
||||
|
||||
if(settingsRebootDialog == true) {
|
||||
QProcess process;
|
||||
process.startDetached("inkbox.sh", QStringList());
|
||||
qApp->quit();
|
||||
if(koboxSettingsRebootDialog == true) {
|
||||
reboot(true);
|
||||
}
|
||||
else {
|
||||
QProcess process;
|
||||
process.startDetached("inkbox.sh", QStringList());
|
||||
qApp->quit();
|
||||
}
|
||||
}
|
||||
|
||||
// We don't have any other option ;p
|
||||
|
|
|
@ -19,6 +19,7 @@ public:
|
|||
bool resetDialog = false;
|
||||
bool updateDialog = false;
|
||||
bool settingsRebootDialog = false;
|
||||
bool koboxSettingsRebootDialog = false;
|
||||
bool lowBatteryDialog = false;
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "koboxsettings.h"
|
||||
#include "ui_koboxsettings.h"
|
||||
#include "functions.h"
|
||||
|
||||
#include <QFile>
|
||||
|
||||
|
@ -17,6 +18,15 @@ koboxSettings::koboxSettings(QWidget *parent) :
|
|||
|
||||
// UI tweaks
|
||||
ui->okBtn->setProperty("type", "borderless");
|
||||
|
||||
if(checkconfig("/external_root/boot/flags/X11_START") == true) {
|
||||
ui->koboxStatusLabel->setText("KoBox is <b>enabled</b>");
|
||||
not_user_change = true;
|
||||
ui->checkBox->click();
|
||||
}
|
||||
else {
|
||||
ui->koboxStatusLabel->setText("KoBox is <b>disabled</b>");
|
||||
}
|
||||
}
|
||||
|
||||
koboxSettings::~koboxSettings()
|
||||
|
@ -28,3 +38,28 @@ void koboxSettings::on_okBtn_clicked()
|
|||
{
|
||||
koboxSettings::close();
|
||||
}
|
||||
|
||||
void koboxSettings::on_checkBox_toggled(bool checked)
|
||||
{
|
||||
if(checked == true) {
|
||||
if(not_user_change != true) {
|
||||
string_writeconfig("/external_root/boot/flags/X11_START", "true");
|
||||
openSettingsRebootDialog();
|
||||
}
|
||||
else {
|
||||
not_user_change = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
string_writeconfig("/external_root/boot/flags/X11_START", "false");
|
||||
openSettingsRebootDialog();
|
||||
}
|
||||
}
|
||||
|
||||
void koboxSettings::openSettingsRebootDialog() {
|
||||
global::settings::settingsRebootDialog = true;
|
||||
global::kobox::koboxSettingsRebootDialog = true;
|
||||
generalDialogWindow = new generalDialog(this);
|
||||
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||
generalDialogWindow->show();
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include <QWidget>
|
||||
|
||||
#include "generaldialog.h"
|
||||
|
||||
namespace Ui {
|
||||
class koboxSettings;
|
||||
}
|
||||
|
@ -15,11 +17,16 @@ public:
|
|||
explicit koboxSettings(QWidget *parent = nullptr);
|
||||
~koboxSettings();
|
||||
|
||||
bool not_user_change = false;
|
||||
void openSettingsRebootDialog();
|
||||
|
||||
private slots:
|
||||
void on_okBtn_clicked();
|
||||
void on_checkBox_toggled(bool checked);
|
||||
|
||||
private:
|
||||
Ui::koboxSettings *ui;
|
||||
generalDialog *generalDialogWindow;
|
||||
};
|
||||
|
||||
#endif // KOBOXSETTINGS_H
|
||||
|
|
164
koboxsettings.ui
164
koboxsettings.ui
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<width>446</width>
|
||||
<height>514</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -16,17 +16,112 @@
|
|||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="Line" name="line">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<item row="2" column="0">
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<widget class="QWidget" name="page">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="koboxStatusLabel">
|
||||
<property name="text">
|
||||
<string>KoBox is <status></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="text">
|
||||
<string>Enable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<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="0" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Chivo</family>
|
||||
<italic>true</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>KoBox status</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_2"/>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
|
@ -46,31 +141,26 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<widget class="QWidget" name="page">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_2"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_2"/>
|
||||
<item row="5" column="0">
|
||||
<widget class="QStackedWidget" name="settingsWidget">
|
||||
<widget class="QWidget" name="page_5"/>
|
||||
<widget class="QWidget" name="page_6"/>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="1" column="0">
|
||||
<widget class="Line" name="line">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QPushButton" name="okBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
|
@ -86,7 +176,7 @@ OK
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="7" column="0">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
|
|
|
@ -241,7 +241,7 @@ void settings::on_okBtn_clicked() {
|
|||
if(launch_sh == true) {
|
||||
if(ui_enable_changed == true) {
|
||||
ui_enable_changed = false;
|
||||
string_writeconfig("/inkbox/settingsRebootDialog", "true");
|
||||
global::settings::settingsRebootDialog = true;
|
||||
generalDialogWindow = new generalDialog();
|
||||
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||
generalDialogWindow->show();
|
||||
|
|
Loading…
Reference in a new issue