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,13 +32,24 @@ generalDialog::generalDialog(QWidget *parent) :
ui->bodyLabel->setStyleSheet("font-size: 9pt");
if(checkconfig("/inkbox/resetDialog") == true) {
resetDialog = true;
ui->okBtn->setText("Proceed");
ui->cancelBtn->setText("Go back");
ui->bodyLabel->setText("This will erase any books you have on the device. Settings will be reset.");
ui->headerLabel->setText("Warning");
this->adjustSize();
string_writeconfig("/inkbox/resetDialog", "false");
if(checkconfig("/opt/inkbox_genuine") == true) {
resetDialog = true;
ui->okBtn->setText("Proceed");
ui->cancelBtn->setText("Go back");
ui->bodyLabel->setText("This will erase any books you have on the device. Settings will be reset.");
ui->headerLabel->setText("Warning");
this->adjustSize();
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) {
updateDialog = true;
@ -105,7 +116,12 @@ void generalDialog::on_okBtn_clicked()
QStringList args;
args << "reset-config.sh";
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();
}
}

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) {
// Counting number of parsed files
split_total = setup_book(book_file, 0, true);
@ -403,7 +403,17 @@ reader::reader(QWidget *parent) :
book_4 = checkconfig_str_val;
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) {
;
@ -522,7 +532,7 @@ void reader::on_aboutBtn_clicked()
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.";
string_checkconfig_ro("/external_root/opt/isa/version");
aboutmsg.append("\n\nInkBox v");
aboutmsg.append("\n\nInkBox ");
aboutmsg.append(checkconfig_str_val);
QMessageBox::information(this, tr("Information"), aboutmsg);
}

View file

@ -145,7 +145,7 @@ settings::settings(QWidget *parent) :
ui->comboBox->setCurrentText("6 pages");
}
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->okBtn->setText("OK");
}
else {
ui->label_8->setText("Reset InkBox");
}
QFile stylesheetFile(":/resources/eink.qss");
@ -226,7 +229,7 @@ void settings::on_aboutBtn_clicked()
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.";
string_checkconfig_ro("/external_root/opt/isa/version");
aboutmsg.append("\n\nInkBox v");
aboutmsg.append("\n\nInkBox ");
aboutmsg.append(checkconfig_str_val);
QMessageBox::information(this, tr("Information"), aboutmsg);
}