Reset option for Nickel add-on and Recent Books bug fix

This commit is contained in:
Nicolas Mailloux 2021-04-06 13:40:43 -04:00
parent 11e7541759
commit 3a806fa17c
3 changed files with 42 additions and 13 deletions

View file

@ -32,6 +32,7 @@ generalDialog::generalDialog(QWidget *parent) :
ui->bodyLabel->setStyleSheet("font-size: 9pt"); ui->bodyLabel->setStyleSheet("font-size: 9pt");
if(checkconfig("/inkbox/resetDialog") == true) { if(checkconfig("/inkbox/resetDialog") == true) {
if(checkconfig("/opt/inkbox_genuine") == true) {
resetDialog = true; resetDialog = true;
ui->okBtn->setText("Proceed"); ui->okBtn->setText("Proceed");
ui->cancelBtn->setText("Go back"); ui->cancelBtn->setText("Go back");
@ -40,6 +41,16 @@ generalDialog::generalDialog(QWidget *parent) :
this->adjustSize(); this->adjustSize();
string_writeconfig("/inkbox/resetDialog", "false"); string_writeconfig("/inkbox/resetDialog", "false");
} }
else {
resetDialog = true;
ui->okBtn->setText("Proceed");
ui->cancelBtn->setText("Go back");
ui->bodyLabel->setText("Settings will be reset.");
ui->headerLabel->setText("Warning");
this->adjustSize();
string_writeconfig("/inkbox/resetDialog", "false");
}
}
if(checkconfig("/inkbox/updateDialog") == true) { if(checkconfig("/inkbox/updateDialog") == true) {
updateDialog = true; updateDialog = true;
ui->okBtn->setText("Update"); ui->okBtn->setText("Update");
@ -105,7 +116,12 @@ void generalDialog::on_okBtn_clicked()
QStringList args; QStringList args;
args << "reset-config.sh"; args << "reset-config.sh";
QProcess *proc = new QProcess(); QProcess *proc = new QProcess();
proc->startDetached(prog, args); proc->start(prog, args);
proc->waitForFinished();
// Relaunching InkBox
QProcess process;
process.startDetached("inkbox.sh", QStringList());
qApp->quit(); qApp->quit();
} }
} }

View file

@ -322,7 +322,7 @@ reader::reader(QWidget *parent) :
} }
} }
// Checking if we're waking from sleep; if so, do nothing there because the book should already have been parsed // Checking if we're waking from sleep; if so, do nothing there because the book should have already been parsed
if(wakeFromSleep != true) { if(wakeFromSleep != true) {
// Counting number of parsed files // Counting number of parsed files
split_total = setup_book(book_file, 0, true); split_total = setup_book(book_file, 0, true);
@ -403,7 +403,17 @@ reader::reader(QWidget *parent) :
book_4 = checkconfig_str_val; book_4 = checkconfig_str_val;
string str_book_4 = book_4.toStdString(); string str_book_4 = book_4.toStdString();
string book_file_str = book_file.toStdString(); string book_file_str;
// Don't mess up "Recently read books" with random "book.txt" buttons...
if(wakeFromSleep == true) {
string_checkconfig("/tmp/inkboxBookPath");
book_file_str = checkconfig_str_val.toStdString();
}
else {
book_file_str = book_file.toStdString();
string_writeconfig("/tmp/inkboxBookPath", book_file_str);
}
if(book_1 == book_file) { if(book_1 == book_file) {
; ;
@ -522,7 +532,7 @@ void reader::on_aboutBtn_clicked()
if(checkconfig("/opt/inkbox_genuine") == true) { if(checkconfig("/opt/inkbox_genuine") == true) {
QString aboutmsg = "InkBox is an open-source Qt-based eBook reader. It brings you the latest Qt features while being also fast and responsive."; QString aboutmsg = "InkBox is an open-source Qt-based eBook reader. It brings you the latest Qt features while being also fast and responsive.";
string_checkconfig_ro("/external_root/opt/isa/version"); string_checkconfig_ro("/external_root/opt/isa/version");
aboutmsg.append("\n\nInkBox v"); aboutmsg.append("\n\nInkBox ");
aboutmsg.append(checkconfig_str_val); aboutmsg.append(checkconfig_str_val);
QMessageBox::information(this, tr("Information"), aboutmsg); QMessageBox::information(this, tr("Information"), aboutmsg);
} }

View file

@ -145,7 +145,7 @@ settings::settings(QWidget *parent) :
ui->comboBox->setCurrentText("6 pages"); ui->comboBox->setCurrentText("6 pages");
} }
else { else {
qDebug() << "Refresh setting value out of range, skipping..."; // Something bad (or not ;p) has happened
} }
} }
@ -185,6 +185,9 @@ settings::settings(QWidget *parent) :
ui->line_7->show(); ui->line_7->show();
ui->okBtn->setText("OK"); ui->okBtn->setText("OK");
} }
else {
ui->label_8->setText("Reset InkBox");
}
QFile stylesheetFile(":/resources/eink.qss"); QFile stylesheetFile(":/resources/eink.qss");
@ -226,7 +229,7 @@ void settings::on_aboutBtn_clicked()
if(checkconfig("/opt/inkbox_genuine") == true) { if(checkconfig("/opt/inkbox_genuine") == true) {
QString aboutmsg = "InkBox is an open-source Qt-based eBook reader. It brings you the latest Qt features while being also fast and responsive."; QString aboutmsg = "InkBox is an open-source Qt-based eBook reader. It brings you the latest Qt features while being also fast and responsive.";
string_checkconfig_ro("/external_root/opt/isa/version"); string_checkconfig_ro("/external_root/opt/isa/version");
aboutmsg.append("\n\nInkBox v"); aboutmsg.append("\n\nInkBox ");
aboutmsg.append(checkconfig_str_val); aboutmsg.append(checkconfig_str_val);
QMessageBox::information(this, tr("Information"), aboutmsg); QMessageBox::information(this, tr("Information"), aboutmsg);
} }