mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-26 07:37:21 -08:00
Manage KoBox extensions via USB
This commit is contained in:
parent
f224345c26
commit
5af7dbf07f
6 changed files with 139 additions and 44 deletions
|
@ -42,6 +42,7 @@ namespace global {
|
|||
inline bool usbmsDialog;
|
||||
inline bool showUsbmsDialog;
|
||||
inline bool launchUsbms;
|
||||
inline bool koboxExportExtensions;
|
||||
}
|
||||
namespace settings {
|
||||
inline bool settingsRebootDialog;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "functions.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QScreen>
|
||||
|
||||
koboxSettings::koboxSettings(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
|
@ -10,15 +11,16 @@ koboxSettings::koboxSettings(QWidget *parent) :
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// UI tweaks
|
||||
ui->okBtn->setProperty("type", "borderless");
|
||||
ui->pushButton->setProperty("type", "borderless");
|
||||
|
||||
// Stylesheet
|
||||
QFile stylesheetFile(":/resources/eink.qss");
|
||||
stylesheetFile.open(QFile::ReadOnly);
|
||||
this->setStyleSheet(stylesheetFile.readAll());
|
||||
stylesheetFile.close();
|
||||
|
||||
// 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;
|
||||
|
@ -80,3 +82,16 @@ void koboxSettings::on_spinBox_valueChanged(int arg1)
|
|||
string number_str = number.toStdString();
|
||||
string_writeconfig(".config/00-kobox/dpiSetting", number_str);
|
||||
}
|
||||
|
||||
void koboxSettings::on_pushButton_clicked()
|
||||
{
|
||||
// Export Extensions disk image over USB with g_mass_storage
|
||||
global::usbms::usbmsDialog = false;
|
||||
global::usbms::launchUsbms = true;
|
||||
global::usbms::koboxExportExtensions = true;
|
||||
|
||||
usbmsWindow = new usbms_splash();
|
||||
usbmsWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||
usbmsWindow->setGeometry(QRect(QPoint(0,0), screen()->geometry ().size()));
|
||||
usbmsWindow->show();
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <QWidget>
|
||||
|
||||
#include "generaldialog.h"
|
||||
#include "usbms_splash.h"
|
||||
|
||||
namespace Ui {
|
||||
class koboxSettings;
|
||||
|
@ -23,12 +24,13 @@ public:
|
|||
private slots:
|
||||
void on_okBtn_clicked();
|
||||
void on_checkBox_toggled(bool checked);
|
||||
|
||||
void on_spinBox_valueChanged(int arg1);
|
||||
void on_pushButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::koboxSettings *ui;
|
||||
generalDialog *generalDialogWindow;
|
||||
usbms_splash *usbmsWindow;
|
||||
};
|
||||
|
||||
#endif // KOBOXSETTINGS_H
|
||||
|
|
138
koboxsettings.ui
138
koboxsettings.ui
|
@ -80,19 +80,6 @@ OK
|
|||
</property>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Chivo</family>
|
||||
<italic>true</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="koboxStatusLabel">
|
||||
<property name="text">
|
||||
|
@ -103,19 +90,6 @@ OK
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" 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>
|
||||
<item row="2" column="0">
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="frameShadow">
|
||||
|
@ -139,6 +113,45 @@ OK
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Chivo</family>
|
||||
<italic>true</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Extensions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Chivo</family>
|
||||
<italic>true</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" 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>
|
||||
<item row="5" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="1">
|
||||
|
@ -176,17 +189,7 @@ OK
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<item row="11" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
|
@ -229,6 +232,67 @@ OK
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="Line" name="line_5">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<layout class="QGridLayout" name="usbmsGridLayout">
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Inter</family>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Go</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Manage extensions over USB</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<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>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
@ -52,11 +52,12 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
ui->quoteHeadingLabel->setStyleSheet("padding: 30px");
|
||||
ui->homeBtn->setStyleSheet("padding: 5px");
|
||||
|
||||
// Variables
|
||||
// Initializing some variables
|
||||
global::battery::showLowBatteryDialog = true;
|
||||
global::battery::showCriticalBatteryAlert = true;
|
||||
global::usbms::showUsbmsDialog = true;
|
||||
global::usbms::launchUsbms = false;
|
||||
global::usbms::koboxExportExtensions = false;
|
||||
global::mainwindow::tabSwitcher::repaint = true;
|
||||
|
||||
// Getting the screen's size
|
||||
|
|
|
@ -60,7 +60,12 @@ void usbms_splash::usbms_launch()
|
|||
{
|
||||
QString umount_prog ("umount");
|
||||
QStringList umount_args;
|
||||
if(global::usbms::koboxExportExtensions == true) {
|
||||
umount_args << "/dev/loop10";
|
||||
}
|
||||
else {
|
||||
umount_args << "/dev/loop0";
|
||||
}
|
||||
QProcess *umount_proc = new QProcess();
|
||||
umount_proc->start(umount_prog, umount_args);
|
||||
umount_proc->waitForFinished();
|
||||
|
@ -81,7 +86,14 @@ void usbms_splash::usbms_launch()
|
|||
|
||||
QString prog_1 ("insmod");
|
||||
QStringList args_1;
|
||||
|
||||
if(global::usbms::koboxExportExtensions == true) {
|
||||
args_1 << "/external_root/modules/g_mass_storage.ko" << "file=/external_root/opt/storage/extensions.img" << "removable=y" << "stall=0";
|
||||
}
|
||||
else {
|
||||
args_1 << "/external_root/modules/g_mass_storage.ko" << "file=/external_root/opt/storage/onboard" << "removable=y" << "stall=0";
|
||||
}
|
||||
|
||||
QProcess *proc_1 = new QProcess();
|
||||
proc_1->start(prog_1, args_1);
|
||||
proc_1->waitForFinished();
|
||||
|
|
Loading…
Reference in a new issue