Improve Univers/U001 font integration; generalDialog fixes

This commit is contained in:
Nicolas Mailloux 2022-03-03 22:03:20 -05:00
parent 0756004db6
commit a9929fc87f
16 changed files with 43 additions and 41 deletions

View file

@ -79,6 +79,7 @@ alert::alert(QWidget *parent) :
ui->securityLabel->setText("The battery's charge level is critical.");
ui->messageLabel->setText("To prevent damage, your device has been turned off.\nPlease consider charging it.");
poweroff(false);
qApp->quit();
}
ui->warningLabel->setStyleSheet("QLabel { background-color : black; color : white; font-size: 18pt }");

View file

@ -122,7 +122,6 @@ void apps::on_vncLaunchBtn_clicked()
generalDialogWindow = new generalDialog();
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
connect(generalDialogWindow, SIGNAL(refreshScreen()), SLOT(refreshScreenNative()));
generalDialogWindow->show();
}
void apps::refreshScreenNative() {

View file

@ -206,6 +206,7 @@ void encryptionManager::unlockEncryptedStorage() {
if(global::encfs::cancelSetup == true) {
global::encfs::cancelSetup = false;
poweroff(true);
qApp->quit();
}
else {
this->setStyleSheet("background-color: white");
@ -267,6 +268,7 @@ void encryptionManager::unlockEncryptedStorage() {
alertWindow->setAttribute(Qt::WA_DeleteOnClose);
alertWindow->showFullScreen();
poweroff(false);
qApp->quit();
}
if(passphraseTries <= 2) {

View file

@ -75,8 +75,8 @@
<item row="5" column="0">
<widget class="QLabel" name="descriptionLabel">
<property name="text">
<string>Encrypted storage allows you to keep your most important files and data safe from anyone else than you.
Would you like to enable it?</string>
<string>&lt;font face=&quot;u001&quot;&gt;Encrypted storage allows you to keep your most important files and data safe from anyone else than you.
Would you like to enable it&lt;/font&gt;&lt;font face=&quot;Inter&quot;&gt;?&lt;/font&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>

View file

@ -22,7 +22,6 @@ generalDialog::generalDialog(QWidget *parent) :
ui->setupUi(this);
ui->bodyLabel->setFont(QFont("u001"));
ui->searchComboBox->setFont(QFont("u001"));
ui->label_2->setFont(QFont("u001"));
// Preventing outside interaction
this->setModal(true);
@ -80,7 +79,7 @@ generalDialog::generalDialog(QWidget *parent) :
ui->cancelBtn->setText("Go back");
ui->bodyLabel->setText("This will erase any books you have on the device. Settings will be reset.");
ui->headerLabel->setText("Warning");
this->adjustSize();
QTimer::singleShot(50, this, SLOT(adjust_size()));
string_writeconfig("/inkbox/resetDialog", "false");
}
else {
@ -89,7 +88,7 @@ generalDialog::generalDialog(QWidget *parent) :
ui->cancelBtn->setText("Go back");
ui->bodyLabel->setText("Settings will be reset.");
ui->headerLabel->setText("Warning");
this->adjustSize();
QTimer::singleShot(50, this, SLOT(adjust_size()));
string_writeconfig("/inkbox/resetDialog", "false");
}
}
@ -99,7 +98,7 @@ generalDialog::generalDialog(QWidget *parent) :
ui->cancelBtn->setText("Not now");
ui->bodyLabel->setText("<font face='u001'>Do you want to update InkBox now</font><font face='Inter'>?</font>"); // Because I hate Univers/U001's question mark ...
ui->headerLabel->setText("Update available");
this->adjustSize();
QTimer::singleShot(50, this, SLOT(adjust_size()));
string_writeconfig("/inkbox/updateDialog", "false");
}
else if(global::settings::settingsRebootDialog == true) {
@ -113,7 +112,7 @@ generalDialog::generalDialog(QWidget *parent) :
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();
QTimer::singleShot(50, this, SLOT(adjust_size()));
}
else if(global::mainwindow::lowBatteryDialog == true) {
lowBatteryDialog = true;
@ -123,7 +122,7 @@ generalDialog::generalDialog(QWidget *parent) :
message.append(batt_level);
ui->bodyLabel->setText(message);
ui->headerLabel->setText("Low battery");
this->adjustSize();
QTimer::singleShot(50, this, SLOT(adjust_size()));
string_writeconfig("/inkbox/lowBatteryDialog", "false");
}
else if(global::usbms::usbmsDialog == true) {
@ -132,7 +131,7 @@ generalDialog::generalDialog(QWidget *parent) :
ui->cancelBtn->setText("Cancel");
ui->bodyLabel->setText("<font face='u001'>Do you want to connect your device to a computer to manage books</font><font face='Inter'>?</font>");
ui->headerLabel->setText("USB cable connected");
this->adjustSize();
QTimer::singleShot(50, this, SLOT(adjust_size()));
}
else if(global::text::textBrowserDialog == true) {
textBrowserDialog = true;
@ -141,7 +140,7 @@ generalDialog::generalDialog(QWidget *parent) :
ui->stackedWidget->setCurrentIndex(1);
ui->mainStackedWidget->insertWidget(1, textwidgetWindow);
ui->mainStackedWidget->setCurrentIndex(1);
this->adjustSize();
QTimer::singleShot(50, this, SLOT(adjust_size()));
}
else if(global::kobox::resetKoboxDialog == true) {
resetKoboxDialog = true;
@ -149,7 +148,7 @@ generalDialog::generalDialog(QWidget *parent) :
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();
QTimer::singleShot(50, this, SLOT(adjust_size()));
}
else if(global::keyboard::keyboardDialog == true) {
setupKeyboardDialog();
@ -162,27 +161,27 @@ generalDialog::generalDialog(QWidget *parent) :
ui->cancelBtn->setText("Cancel");
ui->mainStackedWidget->insertWidget(1, keypadWidget);
ui->mainStackedWidget->setCurrentIndex(1);
this->adjustSize();
QTimer::singleShot(50, this, SLOT(adjust_size()));
}
else if(global::encfs::disableStorageEncryptionDialog == true) {
ui->headerLabel->setText("Warning");
ui->okBtn->setText("Proceed");
ui->cancelBtn->setText("Go back");
ui->bodyLabel->setText("<font face='u001'>This will delete all the files you have encrypted. Are you sure you want to continue</font><font face='Inter'>?</font>");
this->adjustSize();
QTimer::singleShot(50, this, SLOT(adjust_size()));
}
else if(global::encfs::errorNoBooksInDropboxDialog == true) {
ui->stackedWidget->setCurrentIndex(1);
ui->headerLabel->setText("Error");
ui->bodyLabel->setText("Please put books in the 'encfs-dropbox' folder to repack your encrypted storage.");
this->adjustSize();
QTimer::singleShot(50, this, SLOT(adjust_size()));
}
else if(global::encfs::repackDialog == true) {
ui->headerLabel->setText("Information");
ui->okBtn->setText("Proceed");
ui->cancelBtn->setText("Not now");
ui->bodyLabel->setText("<font face='u001'>New files have been found in 'encfs-dropbox'. Would you want to repack your encrypted storage</font><font face='Inter'>?</font>");
this->adjustSize();
QTimer::singleShot(50, this, SLOT(adjust_size()));
}
else {
// We shouldn't be there ;)
@ -257,6 +256,7 @@ void generalDialog::on_okBtn_clicked()
string_writeconfig("/external_root/boot/flags/DIAGS_BOOT", "true");
string_writeconfig("/external_root/boot/flags/DO_SOFT_RESET", "true");
reboot(false);
qApp->quit();
}
else {
// Restore default settings, we're not on InkBox OS
@ -289,6 +289,7 @@ void generalDialog::on_okBtn_clicked()
}
else {
installUpdate();
qApp->quit();
}
}
if(usbmsDialog == true) {
@ -495,6 +496,7 @@ void generalDialog::on_acceptBtn_clicked()
if(settingsRebootDialog == true) {
if(koboxSettingsRebootDialog == true or global::encfs::enableStorageEncryptionDialog) {
reboot(true);
qApp->quit();
}
else {
QProcess process;
@ -517,6 +519,7 @@ void generalDialog::adjust_size() {
int x = (screenGeometry.width() - this->width()) / 2;
int y = (screenGeometry.height() - this->height()) / 2;
this->move(x, y);
this->show();
emit refreshScreen();
}
@ -594,6 +597,7 @@ void generalDialog::startOtaUpdate(bool wasDownloadSuccessful) {
if(wasDownloadSuccessful == true) {
global::otaUpdate::isUpdateOta = false;
installUpdate();
qApp->quit();
}
else {
emit showToast("Download failed");

View file

@ -10,6 +10,12 @@
<height>218</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
@ -262,7 +268,7 @@
<item row="1" column="0">
<widget class="QLabel" name="bodyLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>

View file

@ -17,7 +17,7 @@ koboxSettings::koboxSettings(QWidget *parent) :
ui->okBtn->setProperty("type", "borderless");
ui->pushButton->setProperty("type", "borderless");
ui->resetKoboxBtn->setProperty("type", "borderless");
ui->okBtn->setStyleSheet("font-weight: bold");
ui->pushButton->setStyleSheet("font-weight: bold");
// Stylesheet
QFile stylesheetFile(":/resources/eink.qss");
@ -97,13 +97,11 @@ void koboxSettings::openSettingsRebootDialog() {
global::kobox::koboxSettingsRebootDialog = true;
generalDialogWindow = new generalDialog(this);
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)

View file

@ -226,6 +226,7 @@ OK
<widget class="QPushButton" name="resetKoboxBtn">
<property name="font">
<font>
<family>Inter</family>
<weight>75</weight>
<bold>true</bold>
</font>

View file

@ -244,6 +244,7 @@ MainWindow::MainWindow(QWidget *parent)
// Rebooting if needed
if(reboot_after_update == true) {
reboot(false);
qApp->quit();
}
else {
// Update process finished.
@ -349,6 +350,7 @@ MainWindow::MainWindow(QWidget *parent)
if(checkconfig(".config/18-encrypted_storage/status") == true) {
QDir encfsDropboxDir("/mnt/onboard/onboard/encfs-dropbox");
if(!encfsDropboxDir.isEmpty()) {
global::usbms::showUsbmsDialog = false;
QTimer::singleShot(1000, this, SLOT(openEncfsRepackDialog()));
}
}
@ -565,6 +567,7 @@ MainWindow::MainWindow(QWidget *parent)
QFile::remove("/mnt/onboard/onboard/.inkbox/DEVKEY.dgst");
reboot(true);
qApp->quit();
}
// Write version control info to file in tmpfs
@ -583,12 +586,11 @@ void MainWindow::openUpdateDialog() {
// Write to a temporary file to show an "Update" prompt
string_writeconfig("/inkbox/updateDialog", "true");
// Show the dialog
// Setup the dialog
generalDialogWindow = new generalDialog(this);
connect(generalDialogWindow, SIGNAL(showToast(QString)), SLOT(showToast(QString)));
connect(generalDialogWindow, SIGNAL(closeIndefiniteToast()), SLOT(closeIndefiniteToast()));
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
generalDialogWindow->show();
QApplication::processEvents();
}
@ -598,7 +600,6 @@ void MainWindow::openLowBatteryDialog() {
generalDialogWindow = new generalDialog(this);
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
generalDialogWindow->show();
QApplication::processEvents();
}
@ -608,7 +609,6 @@ void MainWindow::openUsbmsDialog() {
generalDialogWindow = new generalDialog(this);
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
generalDialogWindow->show();
QApplication::processEvents();
}
@ -1078,7 +1078,6 @@ void MainWindow::openEncfsRepackDialog() {
global::encfs::repackDialog = true;
generalDialogWindow = new generalDialog(this);
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
generalDialogWindow->show();
}
void MainWindow::on_libraryButton_clicked()

View file

@ -52,6 +52,7 @@ void quit::on_pushButton_clicked()
global::battery::showLowBatteryDialog = false;
poweroff(true);
qApp->quit();
}
void quit::on_pushButton_2_clicked()
@ -60,6 +61,7 @@ void quit::on_pushButton_2_clicked()
global::battery::showLowBatteryDialog = false;
reboot(true);
qApp->quit();
}
void quit::on_pushButton_4_clicked()

View file

@ -1633,7 +1633,6 @@ void reader::openLowBatteryDialog() {
generalDialogWindow = new generalDialog(this);
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
generalDialogWindow->show();
QApplication::processEvents();
}
@ -1811,7 +1810,6 @@ void reader::openUsbmsDialog() {
generalDialogWindow = new generalDialog(this);
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
generalDialogWindow->show();
QApplication::processEvents();
}
@ -1879,7 +1877,6 @@ void reader::on_gotoBtn_clicked()
generalDialogWindow = new generalDialog();
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
connect(generalDialogWindow, SIGNAL(gotoPageSelected(int)), SLOT(gotoPage(int)));
generalDialogWindow->show();
}
void reader::gotoPage(int pageNumber) {

View file

@ -24,9 +24,9 @@ settings::settings(QWidget *parent) :
{
ui->setupUi(this);
settings::setFont(QFont("u001"));
ui->label->setFont(QFont("u001"));
ui->comboBox->setFont(QFont("u001"));
ui->sleepTimeoutComboBox->setFont(QFont("u001"));
ui->aboutBtn->setFont(QFont("u001"));
ui->okBtn->setFont(QFont("Inter"));
ui->setPasscodeBtn->setProperty("type", "borderless");
@ -390,7 +390,6 @@ void settings::on_okBtn_clicked() {
global::settings::settingsRebootDialog = true;
generalDialogWindow = new generalDialog();
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
generalDialogWindow->show();
}
else {
QProcess process;
@ -703,10 +702,9 @@ void settings::on_resetBtn_clicked()
// We write to a temporary file to show a "Reset" prompt
string_writeconfig("/inkbox/resetDialog", "true");
// We show the dialog
// We setup the dialog
generalDialogWindow = new generalDialog();
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
generalDialogWindow->show();
}
void settings::on_setPasscodeBtn_clicked()
@ -783,7 +781,6 @@ void settings::on_showSystemInfoBtn_clicked()
// Show a system info dialog
generalDialogWindow = new generalDialog();
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
generalDialogWindow->show();
}
void settings::on_pageSizeWidthSpinBox_valueChanged(int arg1)
@ -867,7 +864,6 @@ void settings::openUpdateDialog() {
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
connect(generalDialogWindow, SIGNAL(showToast(QString)), SLOT(showToastNative(QString)));
connect(generalDialogWindow, SIGNAL(closeIndefiniteToast()), SLOT(closeIndefiniteToastNative()));
generalDialogWindow->show();
QApplication::processEvents();
}
@ -933,7 +929,6 @@ void settings::on_enableEncryptedStorageCheckBox_toggled(bool checked)
global::encfs::enableStorageEncryptionDialog = true;
generalDialogWindow = new generalDialog(this);
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
generalDialogWindow->show();
}
else {
enableEncryptedStorageUserChange = true;
@ -945,7 +940,6 @@ void settings::on_enableEncryptedStorageCheckBox_toggled(bool checked)
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
connect(generalDialogWindow, SIGNAL(cancelDisableStorageEncryption()), SLOT(cancelDisableStorageEncryption()));
connect(generalDialogWindow, SIGNAL(disableStorageEncryption()), SLOT(disableStorageEncryption()));
generalDialogWindow->show();
}
}
@ -968,7 +962,6 @@ void settings::disableStorageEncryption() {
global::settings::settingsRebootDialog = true;
generalDialogWindow = new generalDialog(this);
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
generalDialogWindow->show();
}
void settings::cancelDisableStorageEncryption() {
@ -983,7 +976,6 @@ void settings::on_repackBtn_clicked()
global::encfs::errorNoBooksInDropboxDialog = true;
generalDialogWindow = new generalDialog(this);
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
generalDialogWindow->show();
}
else {
string_writeconfig("/external_root/run/encfs_repack", "true");

View file

@ -106,6 +106,7 @@ void usbms_splash::usbms_launch()
if(isUsbPluggedIn() == false) {
if(global::usbms::koboxExportExtensions == true) {
reboot(false);
qApp->quit();
}
else {
qDebug() << "Exiting USBMS session...";

View file

@ -192,11 +192,11 @@ virtualkeyboard::virtualkeyboard(QWidget *parent) :
}
ui->lineEdit->setStyleSheet("border: 3px solid black");
if(global::keyboard::vncDialog == true) {
if(global::keyboard::vncDialog == true or global::keyboard::wifiPassphraseDialog == true) {
ui->lineEdit->setFont(QFont("Noto Mono"));
}
else if(global::keyboard::searchDialog == true){
ui->lineEdit->setFont(QFont("Source Serif Pro"));
ui->lineEdit->setFont(QFont("u001"));
}
else {
ui->lineEdit->setFont(QFont("Roboto"));

View file

@ -8,6 +8,7 @@ virtualkeypad::virtualkeypad(QWidget *parent) :
ui(new Ui::virtualkeypad)
{
ui->setupUi(this);
ui->lineEdit->setFont(QFont("u001"));
// Style
ui->n1->setProperty("type", "borderless");

View file

@ -113,7 +113,6 @@ void wifiDialog::on_connectBtn_clicked()
connect(generalDialogWindow, SIGNAL(showToast(QString)), SLOT(showToastNative(QString)));
connect(generalDialogWindow, SIGNAL(closeIndefiniteToast()), SLOT(closeIndefiniteToastNative()));
connect(generalDialogWindow, SIGNAL(destroyed(QObject*)), SLOT(close()));
generalDialogWindow->show();
}
}