From ae00cc42a3ecc5da15c164e53bfaa2e0fd543967 Mon Sep 17 00:00:00 2001 From: Nicolas Mailloux Date: Sun, 28 Mar 2021 01:14:37 -0400 Subject: [PATCH] Migrated Settings to QStackedWidget --- reader.ui | 2 +- settings.cpp | 82 +---- settings.ui | 866 +++++++++++++++++++++++++++------------------------ 3 files changed, 473 insertions(+), 477 deletions(-) diff --git a/reader.ui b/reader.ui index 3f42a43..634a8b5 100644 --- a/reader.ui +++ b/reader.ui @@ -115,7 +115,7 @@ QFrame::Plain - 4 + 2 Qt::Horizontal diff --git a/settings.cpp b/settings.cpp index 3b508a9..c548f01 100644 --- a/settings.cpp +++ b/settings.cpp @@ -46,14 +46,8 @@ settings::settings(QWidget *parent) : ui->label_6->hide(); ui->line_3->hide(); ui->line_7->hide(); - ui->line_9->hide(); - ui->softwareLabel->hide(); ui->updateBtn->hide(); ui->updateLabel->hide(); - ui->darkModeCheckBox->hide(); - ui->uiScalingLabel->hide(); - ui->uiScalingSlider->hide(); - ui->uiScaleNumberLabel->hide(); // Settings tweaking + enabling specific features whether it's running on the provided integrated OS or Kobo firmware if(checkconfig(".config/01-demo/config") == true) { @@ -281,31 +275,13 @@ void settings::on_usbmsBtn_clicked() usbms_t->start(); } -// Please forgive me, I didn't know that QStackedWidget existed back then... +// Now I know that QStackedWidget exists... ;p void settings::on_previousBtn_clicked() { settings_page = settings_page - 1; if(settings_page == 1) { - ui->line_6->show(); - ui->label_2->show(); - ui->demoCheckBox->show(); - ui->quoteCheckBox->show(); - ui->line_8->show(); - ui->label_7->show(); - ui->wordsNumber->show(); - ui->wordsNumberLabel->show(); - ui->clockCheckBox->show(); - ui->menuBarCheckBox->show(); - - ui->line_9->hide(); - ui->softwareLabel->hide(); - ui->updateBtn->hide(); - ui->updateLabel->hide(); - ui->darkModeCheckBox->hide(); - ui->uiScalingLabel->hide(); - ui->uiScalingSlider->hide(); - ui->uiScaleNumberLabel->hide(); + ui->stackedWidget->setCurrentIndex(0); if(checkconfig("/opt/inkbox_genuine") == true) { // Enforcing security policy if the user has not rooted the device @@ -321,38 +297,20 @@ void settings::on_previousBtn_clicked() ui->label_3->hide(); ui->line_3->hide(); } - ui->label_5->show(); - ui->label_6->show(); - ui->line_7->show(); - ui->usbmsBtn->show(); } } else { if(settings_page == 2) { - ui->line_6->hide(); - ui->label_2->hide(); - ui->label_7->hide(); - ui->line_8->hide(); - ui->clockCheckBox->hide(); - ui->menuBarCheckBox->hide(); - ui->demoCheckBox->hide(); - ui->quoteCheckBox->hide(); + ui->stackedWidget->setCurrentIndex(1); if(checkconfig("/opt/inkbox_genuine") == true) { - ui->label_3->hide(); - ui->label_4->hide(); - ui->label_5->hide(); - ui->label_6->hide(); - ui->line_7->hide(); - ui->line_3->hide(); - - ui->line_9->show(); - ui->softwareLabel->show(); - ui->darkModeCheckBox->show(); - if(checkconfig("/mnt/onboard/onboard/.inkbox/can_update") == true) { ui->updateBtn->show(); ui->updateLabel->show(); } + else { + ui->updateBtn->show(); + ui->updateLabel->show(); + } } } if(settings_page <= 0) { @@ -366,23 +324,7 @@ void settings::on_nextBtn_clicked() { settings_page = settings_page + 1; if(settings_page == 2) { - ui->line_6->hide(); - ui->label_2->hide(); - ui->label_7->hide(); - ui->line_8->hide(); - ui->demoCheckBox->hide(); - ui->quoteCheckBox->hide(); - ui->clockCheckBox->hide(); - ui->menuBarCheckBox->hide(); - ui->wordsNumber->hide(); - ui->wordsNumberLabel->hide(); - - ui->line_9->show(); - ui->softwareLabel->show(); - ui->darkModeCheckBox->show(); - ui->uiScalingLabel->show(); - ui->uiScalingSlider->show(); - ui->uiScaleNumberLabel->show(); + ui->stackedWidget->setCurrentIndex(1); if(checkconfig("/opt/inkbox_genuine") == true) { // Enforcing security policy if the user has not rooted the device @@ -398,14 +340,6 @@ void settings::on_nextBtn_clicked() ui->label_3->hide(); ui->line_3->hide(); } - ui->label_3->hide(); - ui->label_4->hide(); - ui->label_5->hide(); - ui->label_6->hide(); - ui->line_7->hide(); - ui->line_3->hide(); - ui->requestLeaseBtn->hide(); - ui->usbmsBtn->hide(); if(checkconfig("/mnt/onboard/onboard/.inkbox/can_update") == true) { ui->updateBtn->show(); diff --git a/settings.ui b/settings.ui index 2be9959..0973014 100644 --- a/settings.ui +++ b/settings.ui @@ -7,7 +7,7 @@ 0 0 477 - 650 + 603 @@ -16,225 +16,6 @@ - - - - 0 - - - - - - 75 - true - - - - -OK - - - - - - - - - - - Chivo - true - - - - Storage - - - - - - - QFrame::Plain - - - Qt::Horizontal - - - - - - - 0 - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Words number per page - - - - - - - 20 - - - 300 - - - 20 - - - 20 - - - - - - - - - QFrame::Plain - - - 2 - - - Qt::Horizontal - - - - - - - QFrame::Plain - - - Qt::Horizontal - - - - - - - - Chivo - true - - - - Home - - - - - - - 0 - - - - - 0 - - - 2 - - - 1 - - - 1 - - - 0 - - - Qt::Horizontal - - - - - - - UI scaling factor - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 75 - true - - - - 1 - - - - - - - - - Enable night mode - - - - - - - - Chivo - true - - - - Reading - - - - - - - QFrame::Plain - - - Qt::Horizontal - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - @@ -248,7 +29,14 @@ OK - + + + + About InkBox + + + + QFrame::Plain @@ -261,67 +49,454 @@ OK - - - + + + 0 - - 0 - - - - - - 75 - true - + + + + 6 - - Update + + 0 - - - - - - Qt::Horizontal + + 0 - - - 40 - 20 - + + 0 - - - - - - Update InkBox + + 0 - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + 0 + + + 0 + + + + + + Chivo + true + + + + Networking + + + + + + + Clock: Show seconds + + + + + + + + Chivo + true + + + + Home + + + + + + + QFrame::Plain + + + Qt::Horizontal + + + + + + + 0 + + + + + + 75 + true + + + + Go + + + + + + + Enter USB Mass Storage session + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Chivo + true + + + + Reading + + + + + + + + Chivo + true + + + + Storage + + + + + + + QFrame::Plain + + + Qt::Horizontal + + + + + + + Disable "Welcome to InkBox" message + + + + + + + 0 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Words number per page + + + + + + + 20 + + + 300 + + + 20 + + + 20 + + + + + + + + + QFrame::Plain + + + Qt::Horizontal + + + + + + + Disable authors quotes + + + + + + + QFrame::Plain + + + Qt::Horizontal + + + + + + + 0 + + + + + Request DHCP lease + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 75 + true + + + + Request + + + + + + + + + Always show menu bar + + + + + + + + + + + 0 - - - - - - - - QFrame::Plain - - - Qt::Horizontal - + + 0 + + + 0 + + + 0 + + + + + + + 0 + + + 0 + + + + + + 75 + true + + + + Update + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Update InkBox + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + Enable night mode + + + + + + + QFrame::Plain + + + Qt::Horizontal + + + + + + + + Chivo + true + + + + Software + + + + + + + 0 + + + + + UI scaling factor + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + 0 + + + 2 + + + 1 + + + 1 + + + 0 + + + Qt::Horizontal + + + + + + + + 75 + true + + + + 1 + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + - - + + QFrame::Plain + + 2 + Qt::Horizontal @@ -390,13 +565,26 @@ OK - - + + + + Qt::Vertical + + + + 20 + 40 + + + + + + 0 - - + + 75 @@ -404,135 +592,9 @@ OK - Request - - - - - - - Request DHCP lease - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - 0 - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Enter USB Mass Storage session - - - - - - - - 75 - true - - - - Go - - - - - - - - - Disable authors quotes - - - - - - - - Chivo - true - - - - Software - - - - - - - Disable "Welcome to InkBox" message - - - - - - - - Chivo - true - - - - Networking - - - - - - - About InkBox - - - - - - - Clock: Show seconds - - - - - - - 0 - - - - - Always show menu bar + +OK +