Gutenberg: improvements

This commit is contained in:
Nicolas Mailloux 2022-01-04 19:06:47 -05:00
parent 1ad1da2fa5
commit bbc5c3b927
4 changed files with 15 additions and 3 deletions

View file

@ -183,6 +183,11 @@ void libraryWidget::showToast(QString messageToDisplay) {
toastWindow->show();
}
void libraryWidget::closeIndefiniteToast() {
// Warning: use with caution
toastWindow->close();
}
void libraryWidget::syncCatalog() {
global::toast::modalToast = true;
global::toast::indefiniteToast = true;
@ -202,7 +207,7 @@ void libraryWidget::syncCatalog() {
qDebug() << "Gutenberg sync encountered an error";
toastWindow->close();
showToast("Error");
libraryWidget::close();
QTimer::singleShot(5000, this, SLOT(close()));
}
QFile::remove("/inkbox/gutenbergSyncDone");
}
@ -243,6 +248,7 @@ void libraryWidget::openLatestBookInfoDialog(int bookNumber, QString title) {
bookInfoDialogWindow = new bookInfoDialog(this);
connect(bookInfoDialogWindow, SIGNAL(showToast(QString)), SLOT(showToast(QString)));
connect(bookInfoDialogWindow, SIGNAL(closeIndefiniteToast()), SLOT(closeIndefiniteToast()));
bookInfoDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
bookInfoDialogWindow->setModal(true);
bookInfoDialogWindow->show();

View file

@ -30,6 +30,7 @@ private slots:
void syncCatalog();
void setupView();
void showToast(QString messageToDisplay);
void closeIndefiniteToast();
QString getTitle(int bookNumber);
void openLatestBookInfoDialog(int bookNumber, QString title);

View file

@ -1057,6 +1057,7 @@ void MainWindow::on_libraryButton_clicked()
// Create widget
libraryWidgetWindow = new libraryWidget();
connect(libraryWidgetWindow, SIGNAL(destroyed(QObject*)), SLOT(resetFullWindow()));
libraryWidgetWindow->setAttribute(Qt::WA_DeleteOnClose);
ui->stackedWidget->insertWidget(3, libraryWidgetWindow);
global::mainwindow::tabSwitcher::libraryWidgetCreated = true;
@ -1072,3 +1073,7 @@ void MainWindow::on_libraryButton_clicked()
;
}
}
void MainWindow::resetFullWindow() {
resetWindow(true);
}

View file

@ -53,7 +53,6 @@ public:
void openLowBatteryDialog();
void openCriticalBatteryAlertWindow();
void openUsbmsDialog();
void resetWindow(bool resetStackedWidget);
void resetIcons();
void setBatteryIcon();
int testPing();
@ -90,8 +89,9 @@ private slots:
void openReaderFramework();
void checkForUpdate();
void openEncfsRepackDialog();
void on_libraryButton_clicked();
void resetWindow(bool resetStackedWidget);
void resetFullWindow();
private:
Ui::MainWindow * ui;