Various fixes

This commit is contained in:
Nicolas Mailloux 2022-08-23 11:43:25 -04:00
parent 3116d7d918
commit 95fb6af4c2
21 changed files with 108 additions and 81 deletions

View file

@ -57,7 +57,7 @@ SOURCES += \
src/settings/settingschooser.cpp \
src/widgets/text/textwidget.cpp \
src/widgets/interfaceWidgets/toast.cpp \
src/splash/usbms_splash.cpp \
src/splash/usbmsSplash.cpp \
src/apps/userapps.cpp \
src/widgets/virtualKeyboard/virtualkeyboard.cpp \
src/widgets/virtualKeyboard/virtualkeypad.cpp \
@ -100,7 +100,7 @@ HEADERS += \
src/settings/settingschooser.h \
src/widgets/text/textwidget.h \
src/widgets/interfaceWidgets/toast.h \
src/splash/usbms_splash.h \
src/splash/usbmsSplash.h \
src/apps/userapps.h \
src/widgets/virtualKeyboard/virtualkeyboard.h \
src/widgets/virtualKeyboard/virtualkeypad.h \
@ -140,7 +140,7 @@ FORMS += \
src/settings/settingschooser.ui \
src/widgets/text/textwidget.ui \
src/widgets/interfaceWidgets/toast.ui \
src/splash/usbms_splash.ui \
src/splash/usbmsSplash.ui \
src/apps/userapps.ui \
src/widgets/virtualKeyboard/virtualkeyboard.ui \
src/widgets/virtualKeyboard/virtualkeypad.ui \

View file

@ -8,7 +8,7 @@
#include <QTimer>
#include <QMessageBox>
#include <QDateTime>
#include "usbms_splash.h"
#include "usbmsSplash.h"
#include "functions.h"
encryptionManager::encryptionManager(QWidget *parent) :
@ -346,7 +346,7 @@ void encryptionManager::on_usbmsBtn_clicked()
{
log("Showing USBMS splash", className);
global::usbms::launchUsbms = true;
usbmsWindow = new usbms_splash();
usbmsWindow = new usbmsSplash();
usbmsWindow->setAttribute(Qt::WA_DeleteOnClose);
usbmsWindow->setGeometry(QRect(QPoint(0,0), screen()->geometry ().size()));
usbmsWindow->show();

View file

@ -48,7 +48,7 @@ private:
toast * toastWindow;
hourglassAnimationWidget * hourglassAnimationWidgetWindow;
alert * alertWindow;
usbms_splash *usbmsWindow;
usbmsSplash *usbmsWindow;
};
#endif // ENCRYPTIONMANAGER_H

View file

@ -634,13 +634,13 @@ void MainWindow::setBatteryIcon() {
stdIconHeight = sH / 16;
QPixmap chargingPixmap(":/resources/battery_charging.png");
QPixmap scaledChargingPixmap = chargingPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
QPixmap scaledChargingPixmap = chargingPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
QPixmap fullPixmap(":/resources/battery_full.png");
QPixmap scaledFullPixmap = fullPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
QPixmap scaledFullPixmap = fullPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
QPixmap halfPixmap(":/resources/battery_half.png");
QPixmap scaledHalfPixmap = halfPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
QPixmap scaledHalfPixmap = halfPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
QPixmap emptyPixmap(":/resources/battery_empty.png");
QPixmap scaledEmptyPixmap = emptyPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
QPixmap scaledEmptyPixmap = emptyPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
// Checking battery level and status, then displaying the relevant icon on batteryIcon
if(isUsbPluggedIn() == true) {
@ -664,13 +664,13 @@ void MainWindow::setBatteryIcon() {
stdIconWidth = sW / 19;
stdIconHeight = sH / 19;
QPixmap chargingPixmap(":/resources/battery_charging.png");
QPixmap scaledChargingPixmap = chargingPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
QPixmap scaledChargingPixmap = chargingPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
QPixmap fullPixmap(":/resources/battery_full.png");
QPixmap scaledFullPixmap = fullPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
QPixmap scaledFullPixmap = fullPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
QPixmap halfPixmap(":/resources/battery_half.png");
QPixmap scaledHalfPixmap = halfPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
QPixmap scaledHalfPixmap = halfPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
QPixmap emptyPixmap(":/resources/battery_empty.png");
QPixmap scaledEmptyPixmap = emptyPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
QPixmap scaledEmptyPixmap = emptyPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
// Checking battery level and status, then displaying the relevant icon on batteryIcon
if(isUsbPluggedIn() == true) {
@ -711,11 +711,12 @@ void MainWindow::setInitialBrightness() {
// Coming from OOBE setup; not doing that fancy stuff again ;p
QFile::remove("/tmp/oobe-inkbox_completed");
pre_set_brightness(brightness_value);
log("Ignoring cinematic brightness call because it has already been done", className);
}
else {
// Fancy brightness fade-in
if(checkconfig("/tmp/inkbox-cinematic_brightness_auto") == true) {
QFile::remove("/tmp/inkbox-cinematic_brightness_auto");
if(checkconfig("/tmp/inkbox-cinematicBrightness_auto") == true) {
QFile::remove("/tmp/inkbox-cinematicBrightness_auto");
cinematicBrightness(brightness_value, 2);
}
else {
@ -723,6 +724,9 @@ void MainWindow::setInitialBrightness() {
string_writeconfig("/tmp/inkbox-cinematicBrightness_ran", "true");
cinematicBrightness(brightness_value, 0);
}
else {
log("Ignoring cinematic brightness call because it has already been done", className);
}
}
}
}

View file

@ -8,7 +8,7 @@
#include "reader.h"
#include "quit.h"
#include "alert.h"
#include "usbms_splash.h"
#include "usbmsSplash.h"
#include "brightnessdialog.h"
#include "generaldialog.h"
#include "koboxsettings.h"
@ -106,7 +106,7 @@ private:
reader * readerWindow;
quit * quitWindow;
alert * alertWindow;
usbms_splash * usbmsWindow;
usbmsSplash * usbmsWindow;
brightnessDialog * brightnessDialogWindow;
generalDialog * generalDialogWindow;
koboxSettings * koboxSettingsWindow;

View file

@ -366,30 +366,24 @@ reader::reader(QWidget *parent) :
float sH = QGuiApplication::screens()[0]->size().height();
// Defining what the icons' size will be
if(checkconfig("/opt/inkbox_genuine") == true) {
float stdIconWidth;
float stdIconHeight;
if(global::deviceID == "n705\n" or global::deviceID == "n905\n" or global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n437\n" or global::deviceID == "n306\n" or global::deviceID == "kt\n" or global::deviceID == "emu\n") {
float stdIconWidth = sW / 16;
float stdIconHeight = sW / 16;
QPixmap chargingPixmap(":/resources/battery_charging.png");
scaledChargingPixmap = chargingPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
QPixmap fullPixmap(":/resources/battery_full.png");
scaledFullPixmap = fullPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
QPixmap halfPixmap(":/resources/battery_half.png");
scaledHalfPixmap = halfPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
QPixmap emptyPixmap(":/resources/battery_empty.png");
scaledEmptyPixmap = emptyPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
stdIconWidth = sW / 16;
stdIconHeight = sW / 16;
}
else {
float stdIconWidth = sW / 19;
float stdIconHeight = sH / 19;
QPixmap chargingPixmap(":/resources/battery_charging.png");
scaledChargingPixmap = chargingPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
QPixmap fullPixmap(":/resources/battery_full.png");
scaledFullPixmap = fullPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
QPixmap halfPixmap(":/resources/battery_half.png");
scaledHalfPixmap = halfPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
QPixmap emptyPixmap(":/resources/battery_empty.png");
scaledEmptyPixmap = emptyPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
stdIconWidth = sW / 19;
stdIconHeight = sH / 19;
}
QPixmap chargingPixmap(":/resources/battery_charging.png");
scaledChargingPixmap = chargingPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
QPixmap fullPixmap(":/resources/battery_full.png");
scaledFullPixmap = fullPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
QPixmap halfPixmap(":/resources/battery_half.png");
scaledHalfPixmap = halfPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
QPixmap emptyPixmap(":/resources/battery_empty.png");
scaledEmptyPixmap = emptyPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
}
else {
float stdIconWidth = sW / 19;
@ -1282,7 +1276,7 @@ void reader::on_homeBtn_clicked()
// Remount tmpfs
string_writeconfig("/inkbox/remount", "true");
// Specify cinematic brightness mode
string_writeconfig("/tmp/inkbox-cinematic_brightness_auto", "true");
string_writeconfig("/tmp/inkbox-cinematicBrightness_auto", "true");
// Relaunching process
quit_restart();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 993 B

After

Width:  |  Height:  |  Size: 13 KiB

View file

@ -126,7 +126,7 @@ void koboxSettings::on_pushButton_clicked()
log("Exporting KoBox extensions onboard storage via USB", className);
log("Showing USBMS splash", className);
usbmsWindow = new usbms_splash();
usbmsWindow = new usbmsSplash();
usbmsWindow->setAttribute(Qt::WA_DeleteOnClose);
usbmsWindow->setGeometry(QRect(QPoint(0,0), screen()->geometry ().size()));
usbmsWindow->show();

View file

@ -4,7 +4,7 @@
#include <QWidget>
#include "generaldialog.h"
#include "usbms_splash.h"
#include "usbmsSplash.h"
namespace Ui {
class koboxSettings;
@ -33,7 +33,7 @@ private slots:
private:
Ui::koboxSettings *ui;
generalDialog *generalDialogWindow;
usbms_splash *usbmsWindow;
usbmsSplash *usbmsWindow;
};
#endif // KOBOXSETTINGS_H

View file

@ -901,7 +901,7 @@ void settings::usbms_launch()
log("Showing USBMS splash", className);
global::usbms::launchUsbms = true;
usbmsWindow = new usbms_splash();
usbmsWindow = new usbmsSplash();
usbmsWindow->setAttribute(Qt::WA_DeleteOnClose);
usbmsWindow->setGeometry(QRect(QPoint(0,0), screen()->geometry ().size()));
usbmsWindow->show();

View file

@ -3,7 +3,7 @@
#include <QWidget>
#include <usbms_splash.h>
#include <usbmsSplash.h>
#include "generaldialog.h"
#include "otamanager.h"
#include "toast.h"
@ -79,7 +79,7 @@ signals:
private:
Ui::settings *ui;
usbms_splash *usbmsWindow;
usbmsSplash *usbmsWindow;
generalDialog *generalDialogWindow;
otaManager *otaManagerWindow;
toast *toastWindow;

View file

@ -1,5 +1,5 @@
#include "usbms_splash.h"
#include "ui_usbms_splash.h"
#include "usbmsSplash.h"
#include "ui_usbmsSplash.h"
#include <QPixmap>
#include <QScreen>
@ -7,12 +7,12 @@
#include "functions.h"
usbms_splash::usbms_splash(QWidget *parent) :
usbmsSplash::usbmsSplash(QWidget *parent) :
QWidget(parent),
ui(new Ui::usbms_splash)
ui(new Ui::usbmsSplash)
{
ui->setupUi(this);
usbms_splash::setFont(QFont("u001"));
usbmsSplash::setFont(QFont("u001"));
ui->label->setFont(QFont("Inter"));
// Getting the screen's size
@ -60,11 +60,11 @@ usbms_splash::usbms_splash(QWidget *parent) :
if(global::usbms::launchUsbms == true) {
global::usbms::launchUsbms = false;
usbms_launch();
usbmsLaunch();
}
}
void usbms_splash::usbms_launch()
void usbmsSplash::usbmsLaunch()
{
log("Entering USBMS session", className);
string_writeconfig("/tmp/in_usbms", "true");
@ -169,16 +169,17 @@ void usbms_splash::usbms_launch()
usbms_t->start();
}
usbms_splash::~usbms_splash()
usbmsSplash::~usbmsSplash()
{
delete ui;
}
void usbms_splash::brightnessDown() {
void usbmsSplash::brightnessDown() {
cinematicBrightness(0, 1);
writeFile("/tmp/inkbox-cinematicBrightness_ran", "false");
}
void usbms_splash::quit_restart() {
void usbmsSplash::quit_restart() {
// If existing, cleaning bookconfig_mount mountpoint
string_writeconfig("/opt/ibxd", "bookconfig_unmount\n");
@ -188,7 +189,7 @@ void usbms_splash::quit_restart() {
qApp->quit();
}
void usbms_splash::restartServices() {
void usbmsSplash::restartServices() {
// Restarting USBNet
// NOTE: USBNet is only started if required conditions are met (see https://github.com/Kobo-InkBox/rootfs/blob/master/etc/init.d/usbnet)
string_writeconfig("/opt/ibxd", "usbnet_start\n");

View file

@ -4,22 +4,22 @@
#include <QWidget>
namespace Ui {
class usbms_splash;
class usbmsSplash;
}
class usbms_splash : public QWidget
class usbmsSplash : public QWidget
{
Q_OBJECT
public:
QString className = this->metaObject()->className();
explicit usbms_splash(QWidget *parent = nullptr);
~usbms_splash();
explicit usbmsSplash(QWidget *parent = nullptr);
~usbmsSplash();
float sW;
float sH;
QString massStorageModule;
void usbms_launch();
void usbmsLaunch();
private slots:
void brightnessDown();
@ -27,7 +27,7 @@ private slots:
void restartServices();
private:
Ui::usbms_splash *ui;
Ui::usbmsSplash *ui;
};
#endif // USBMS_SPLASH_H

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>usbms_splash</class>
<widget class="QWidget" name="usbms_splash">
<class>usbmsSplash</class>
<widget class="QWidget" name="usbmsSplash">
<property name="geometry">
<rect>
<x>0</x>

View file

@ -337,7 +337,7 @@ void generalDialog::on_okBtn_clicked()
global::usbms::usbmsDialog = false;
global::usbms::launchUsbms = true;
usbmsWindow = new usbms_splash();
usbmsWindow = new usbmsSplash();
usbmsWindow->setAttribute(Qt::WA_DeleteOnClose);
usbmsWindow->setGeometry(QRect(QPoint(0,0), screen()->geometry ().size()));
usbmsWindow->show();

View file

@ -3,7 +3,7 @@
#include <QDialog>
#include "usbms_splash.h"
#include "usbmsSplash.h"
#include "textwidget.h"
#include "virtualkeyboard.h"
#include "virtualkeypad.h"
@ -73,7 +73,7 @@ private slots:
private:
Ui::generalDialog *ui;
usbms_splash *usbmsWindow;
usbmsSplash *usbmsWindow;
textwidget *textwidgetWindow;
virtualkeyboard *keyboardWidget;
virtualkeypad *keypadWidget;

View file

@ -166,7 +166,7 @@ void koboxAppsDialog::on_launchBtn_clicked()
// Re-use USBMS splash window for KoBox splash, since it's pretty much the same layout
log("Showing KoBox splash", className);
usbmsSplashWindow = new usbms_splash();
usbmsSplashWindow = new usbmsSplash();
usbmsSplashWindow->setAttribute(Qt::WA_DeleteOnClose);
usbmsSplashWindow->setGeometry(QRect(QPoint(0,0), screen()->geometry().size()));
usbmsSplashWindow->show();

View file

@ -4,7 +4,7 @@
#include <QDialog>
#include <QModelIndex>
#include "usbms_splash.h"
#include "usbmsSplash.h"
namespace Ui {
class koboxAppsDialog;
@ -36,7 +36,7 @@ signals:
private:
Ui::koboxAppsDialog *ui;
usbms_splash *usbmsSplashWindow;
usbmsSplash *usbmsSplashWindow;
};
#endif // KOBOXAPPSDIALOG_H

View file

@ -12,6 +12,9 @@ connectiondialog::connectiondialog(QWidget *parent) :
{
ui->setupUi(this);
this->setFont(QFont("u001"));
ui->passphraseTextEdit->setFont(QFont("Noto Mono"));
ui->label->setFont(QFont("Inter"));
ui->label_2->setFont(QFont("Inter"));
// Stylesheet, style & misc.
QFile stylesheetFile("/mnt/onboard/.adds/inkbox/eink.qss");
@ -19,15 +22,29 @@ connectiondialog::connectiondialog(QWidget *parent) :
this->setStyleSheet(stylesheetFile.readAll());
stylesheetFile.close();
ui->cancelBtn->setStyleSheet("font-size: 9pt");
ui->connectBtn->setStyleSheet("font-size: 9pt");
ui->showPassphraseBtn->setStyleSheet("font-size: 9pt");
ui->cancelBtn->setProperty("type", "borderless");
ui->connectBtn->setProperty("type", "borderless");
ui->showPassphraseBtn->setProperty("type", "borderless");
ui->label->setStyleSheet("font-weight: bold");
ui->label_2->setStyleSheet("font-weight: bold");
ui->cancelBtn->setIcon(QIcon(":/resources/close.png"));
ui->connectBtn->setIcon(QIcon(":/resources/arrow-right.png"));
// Size
QRect screenGeometry = QGuiApplication::screens()[0]->geometry();
this->setFixedWidth(screenGeometry.width());
this->setFixedWidth(screenGeometry.width() / 1.5);
int halfOfHalfHeight = ((screenGeometry.height() / 2) / 2) / 2;
int finalHeight = screenGeometry.height() - halfOfHalfHeight * 6.3;
this->setFixedHeight(finalHeight);
// Centering dialog
int x = (screenGeometry.width() - this->width()) / 2;
int y = (screenGeometry.height() - this->height()) / 2;
this->move(x, y);
}
connectiondialog::~connectiondialog()
@ -63,12 +80,17 @@ void connectiondialog::applyVariables() {
}
QString passphrase = searchDatabase(connectedNetworkData.name);
if(passphrase.isEmpty() == false) {
log("Found passphrase: " + passphrase, className);
log("Found passphrase: '" + passphrase + "'", className);
ui->showPassphraseBtn->setIcon(QIcon(":/resources/show.png"));
showedPassphrase = false;
savedPassphrase = passphrase;
ui->passphraseTextEdit->setText("********");
int passphraseLength = passphrase.length();
QString hiddenPassphrase;
for(int i = 0; i < passphraseLength; i++) {
hiddenPassphrase.append("");
}
ui->passphraseTextEdit->setText(hiddenPassphrase);
}
else {
log("No passphrase found", className);
@ -224,12 +246,12 @@ void connectiondialog::on_passphraseTextEdit_cursorPositionChanged(int oldpos, i
global::keyboard::keyboardText = "";
}
else {
log("Passphrase is not saved; ignoring text edit call", className);
log("Passphrase is not saved; ignoring text edit widget call", className);
}
}
}
else {
log("Ignoring click on text edit", className);
log("Ignoring click on text edit widget", className);
cursorPositionIgnore = true;
}
}
@ -248,7 +270,13 @@ void connectiondialog::on_showPassphraseBtn_clicked()
else {
showedPassphrase = false;
ui->showPassphraseBtn->setIcon(QIcon(":/resources/show.png"));
ui->passphraseTextEdit->setText("********");
int passphraseLength = searchDatabase(connectedNetworkData.name).length();
QString hiddenPassphrase;
for(int i = 0; i < passphraseLength; i++) {
hiddenPassphrase.append("");
}
ui->passphraseTextEdit->setText(hiddenPassphrase);
}
}

View file

@ -22,7 +22,7 @@
<item>
<widget class="QPushButton" name="cancelBtn">
<property name="text">
<string>Cancel</string>
<string></string>
</property>
</widget>
</item>
@ -62,7 +62,7 @@
<item>
<widget class="QPushButton" name="connectBtn">
<property name="text">
<string>Connect</string>
<string></string>
</property>
</widget>
</item>