mirror of
https://github.com/Quill-OS/quill.git
synced 2024-10-31 21:33:22 -07:00
Gutenberg: Improvements
This commit is contained in:
parent
4fc7659f9d
commit
1614e51e88
3 changed files with 22 additions and 15 deletions
|
@ -48,11 +48,9 @@ bookInfoDialog::bookInfoDialog(QWidget *parent) :
|
|||
global::library::isLatestBook = false;
|
||||
|
||||
ui->bookTitleLabel->setText(global::library::bookTitle);
|
||||
global::library::bookTitle = "";
|
||||
}
|
||||
else {
|
||||
ui->bookTitleLabel->setText(global::library::bookTitle);
|
||||
global::library::bookTitle = "";
|
||||
|
||||
QDir gutenbergDir;
|
||||
gutenbergDir.mkpath("/inkbox/gutenberg");
|
||||
|
@ -93,6 +91,7 @@ bookInfoDialog::~bookInfoDialog()
|
|||
|
||||
void bookInfoDialog::on_closeBtn_clicked()
|
||||
{
|
||||
global::library::bookTitle = "";
|
||||
bookInfoDialog::close();
|
||||
}
|
||||
|
||||
|
@ -102,6 +101,7 @@ void bookInfoDialog::on_getBtn_clicked()
|
|||
QDir gutenbergDir;
|
||||
gutenbergDir.mkpath("/inkbox/gutenberg");
|
||||
string_writeconfig("/inkbox/gutenberg/bookid", QString::number(global::library::bookId).toStdString());
|
||||
string_writeconfig("/inkbox/gutenberg/booktitle", global::library::bookTitle.toStdString());
|
||||
string_writeconfig("/opt/ibxd", "gutenberg_get_book\n");
|
||||
|
||||
global::toast::modalToast = true;
|
||||
|
|
|
@ -248,26 +248,30 @@ void libraryWidget::closeIndefiniteToast() {
|
|||
void libraryWidget::syncCatalog() {
|
||||
global::toast::modalToast = true;
|
||||
global::toast::indefiniteToast = true;
|
||||
bool syncDone = false;
|
||||
showToast("Sync in progress");
|
||||
|
||||
string_writeconfig("/opt/ibxd", "gutenberg_sync\n");
|
||||
QTimer * syncCheckTimer = new QTimer(this);
|
||||
syncCheckTimer->setInterval(100);
|
||||
connect(syncCheckTimer, &QTimer::timeout, [&]() {
|
||||
if(QFile::exists("/inkbox/gutenbergSyncDone") == true) {
|
||||
if(checkconfig("/inkbox/gutenbergSyncDone") == true) {
|
||||
qDebug() << "Gutenberg sync successfully completed";
|
||||
toastWindow->close();
|
||||
setupView();
|
||||
if(syncDone == false) {
|
||||
if(QFile::exists("/inkbox/gutenbergSyncDone") == true) {
|
||||
if(checkconfig("/inkbox/gutenbergSyncDone") == true) {
|
||||
qDebug() << "Gutenberg sync successfully completed";
|
||||
toastWindow->close();
|
||||
setupView();
|
||||
}
|
||||
else {
|
||||
qDebug() << "Gutenberg sync encountered an error";
|
||||
toastWindow->close();
|
||||
showToast("Error");
|
||||
QFile::remove("/external_root/opt/storage/gutenberg/last_sync");
|
||||
QTimer::singleShot(5000, this, SLOT(close()));
|
||||
}
|
||||
QFile::remove("/inkbox/gutenbergSyncDone");
|
||||
syncDone = true;
|
||||
}
|
||||
else {
|
||||
qDebug() << "Gutenberg sync encountered an error";
|
||||
toastWindow->close();
|
||||
showToast("Error");
|
||||
QFile::remove("/external_root/opt/storage/gutenberg/last_sync");
|
||||
QTimer::singleShot(5000, this, SLOT(close()));
|
||||
}
|
||||
QFile::remove("/inkbox/gutenbergSyncDone");
|
||||
}
|
||||
} );
|
||||
syncCheckTimer->start();
|
||||
|
|
|
@ -502,6 +502,9 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
updatemsg = updatemsg.append(checkconfig_str_val);
|
||||
QMessageBox::information(this, tr("Information"), updatemsg);
|
||||
string_writeconfig("/external_root/opt/update/inkbox_updated", "false");
|
||||
if(QFile::exists("/external_root/opt/storage/gutenberg/last_sync")) {
|
||||
QFile::remove("/external_root/opt/storage/gutenberg/last_sync");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue