Fix MainWindow tabSwitcher bug

When an user would click another button-tab (e.g. Settings or Apps)
after launching libraryWidget, InkBox would reset the window entirely
and get back to the Home widget. The user would then have had to re-
click on the button-tab he wanted to pick to get the appropriate
content.

This commit fixes this issue by requiring a resetFullWindowException
boolean variable to be set to false (meaning that the user didn't click
on any button-tab before leaving libraryWidget) for the
resetWindow(true) function to occur as described in resetFullWindow(),
when libraryWidget is destroyed.
This commit is contained in:
Nicolas Mailloux 2022-01-28 00:44:23 -05:00
parent a6110cf7ac
commit 6155e9344e
2 changed files with 12 additions and 1 deletions

View file

@ -62,6 +62,7 @@ MainWindow::MainWindow(QWidget *parent)
global::usbms::launchUsbms = false;
global::usbms::koboxExportExtensions = false;
global::mainwindow::tabSwitcher::repaint = true;
resetFullWindowException = false;
// Getting the screen's size
sW = QGuiApplication::screens()[0]->size().width();
@ -611,6 +612,7 @@ void MainWindow::openCriticalBatteryAlertWindow() {
void MainWindow::on_settingsBtn_clicked()
{
resetFullWindowException = true;
resetWindow(false);
if(global::mainwindow::tabSwitcher::settingsChooserWidgetSelected != true) {
ui->settingsBtn->setStyleSheet("background: black");
@ -637,6 +639,7 @@ void MainWindow::on_settingsBtn_clicked()
void MainWindow::on_appsBtn_clicked()
{
resetFullWindowException = true;
resetWindow(false);
if(global::mainwindow::tabSwitcher::appsWidgetSelected != true) {
ui->appsBtn->setStyleSheet("background: black");
@ -720,6 +723,7 @@ void MainWindow::on_brightnessBtn_clicked()
void MainWindow::on_homeBtn_clicked()
{
global::mainwindow::tabSwitcher::repaint = true;
resetFullWindowException = false;
resetWindow(true);
}
@ -1060,6 +1064,7 @@ void MainWindow::openEncfsRepackDialog() {
void MainWindow::on_libraryButton_clicked()
{
resetFullWindowException = false;
resetWindow(false);
if(global::mainwindow::tabSwitcher::libraryWidgetSelected != true) {
ui->libraryButton->setStyleSheet("background: black; color: white");
@ -1085,7 +1090,12 @@ void MainWindow::on_libraryButton_clicked()
}
void MainWindow::resetFullWindow() {
resetWindow(true);
if(resetFullWindowException == false) {
resetWindow(true);
}
else {
resetFullWindowException = false;
}
}
void MainWindow::setRecentBooksLabelsTruncateTreshold() {

View file

@ -47,6 +47,7 @@ public:
bool existing_recent_books = false;
bool reboot_after_update = false;
bool resetFullWindowException;
int timerTime = 0;
QString relative_path;
QString usbmsStatus;