Replace Python with split-txt

This commit is contained in:
Nicolas Mailloux 2022-09-05 11:31:44 -04:00
parent 76728b7d4b
commit 11cb8aef7a

View file

@ -254,6 +254,7 @@ reader::reader(QWidget *parent) :
ui->text->setFont(QFont("Source Serif Pro")); ui->text->setFont(QFont("Source Serif Pro"));
} }
else { else {
log("Setting font to '" + checkconfig_str_val + "'", className);
if(checkconfig_str_val == "Crimson Pro") { if(checkconfig_str_val == "Crimson Pro") {
setCrimsonProFont(); setCrimsonProFont();
} }
@ -917,9 +918,9 @@ int reader::setup_book(QString book, int i, bool run_parser) {
; ;
} }
else { else {
QString parse_prog ("python3"); QString parse_prog ("/mnt/onboard/.adds/inkbox/system/bin/split-txt");
QStringList parse_args; QStringList parse_args;
parse_args << "split-txt.py" << checkconfig_str_val; parse_args << checkconfig_str_val;
QProcess * parse_proc = new QProcess(); QProcess * parse_proc = new QProcess();
parse_proc->start(parse_prog, parse_args); parse_proc->start(parse_prog, parse_args);
parse_proc->waitForFinished(); parse_proc->waitForFinished();
@ -936,10 +937,14 @@ int reader::setup_book(QString book, int i, bool run_parser) {
content << f.readAll(); content << f.readAll();
f.close(); f.close();
} }
content[i].replace("\n", "<br>");
content[i].replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;");
ittext = content[i]; ittext = content[i];
return content.size(); return content.size();
} }
else { else {
content[i].replace("\n", "<br>");
content[i].replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;");
ittext = content[i]; ittext = content[i];
} }
} }
@ -1312,7 +1317,7 @@ void reader::on_fontChooser_currentIndexChanged(const QString &arg1)
} }
if(arg1 == "Roboto Mono") { if(arg1 == "Roboto Mono") {
ui->text->setFont(QFont("Roboto Mono")); ui->text->setFont(QFont("Roboto Mono"));
writeFile(".config/04-boot/font", "Roboto Mono"); writeFile(".config/04-book/font", "Roboto Mono");
} }
if(arg1 == "Libertinus Serif") { if(arg1 == "Libertinus Serif") {
QFont libertinus("Libertinus Serif"); QFont libertinus("Libertinus Serif");