From 5befd0666aef0b96e3e4bd41ed704ccaa3ace5d5 Mon Sep 17 00:00:00 2001 From: ConfuSomu Date: Mon, 10 Jul 2023 13:27:34 +0200 Subject: Implement basic multithreading support A few CPU heavy operations, which are opening an archive and displaying a selected Activity, have been moved to another thread to avoid having long-running operations on the main thread. --- src/archive_parser.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/archive_parser.cpp') diff --git a/src/archive_parser.cpp b/src/archive_parser.cpp index 77d3ec0..96df1ec 100644 --- a/src/archive_parser.cpp +++ b/src/archive_parser.cpp @@ -19,7 +19,7 @@ Archive::Archive(QString outbox_filename, ArchiveType archive_type) : outbox_filename(outbox_filename), archive_type(archive_type) {} -Archive::InitError Archive::init() { +std::variant Archive::init() { QFile outbox_file(outbox_filename); if (!outbox_file.open(QIODevice::ReadOnly | QIODevice::Text)) @@ -233,7 +233,7 @@ std::vector Archive::get_status_attachments_list(QJsonValueR } // status_index is assumed to be a valid index -QString Archive::get_html_status_info(int status_index, int text_zone_width, StatusType status_type, QLocale* locale) { +const QString Archive::get_html_status_info(int status_index, int text_zone_width, StatusType status_type, QLocale* locale) { // the JSON AP Activity (TODO: fix misleading name) QJsonObject obj = outbox_items->at(status_index).toObject(); @@ -303,7 +303,7 @@ QString Archive::get_html_status_info(int status_index, int text_zone_width, Sta } // TODO: make this use an APActivity object that will be present as an StatusListItem member. -QString Archive::get_html_status_text(int status_index) { +const QString Archive::get_html_status_text(int status_index) { QString text(""); QJsonObject obj = outbox_items->at(status_index).toObject(); -- cgit v1.2.3-54-g00ecf