libxml2 consumes the main thread time while formatting the xml document. So I attached a patch that calls the export function in a new thread.
Now I am working on adding the progress bar functionality #785, but still can't interface with libxml2. Regards, Gehad
From 0375852abd694fbd988f8253d77d58e7bc528d45 Mon Sep 17 00:00:00 2001 From: Gehad elrobey <[email protected]> Date: Fri, 30 Jan 2015 21:42:33 +0200 Subject: [PATCH] Export the XSLT based exports in a new Thread. The XSLT based exports can consume long time while applying the xml format. this time can make the GUI unresponsive. Simpley the export functions need to be called in a new Thread. Signed-off-by: Gehad elrobey <[email protected]> --- qt-ui/divelogexportdialog.cpp | 3 ++- qt-ui/divelogexportdialog.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/qt-ui/divelogexportdialog.cpp b/qt-ui/divelogexportdialog.cpp index cb7d6a0..aff0265 100644 --- a/qt-ui/divelogexportdialog.cpp +++ b/qt-ui/divelogexportdialog.cpp @@ -1,6 +1,7 @@ #include <QFileDialog> #include <QShortcut> #include <QSettings> +#include <QtConcurrent> #include "divelogexportdialog.h" #include "diveshareexportdialog.h" @@ -310,7 +311,7 @@ void DiveLogExportDialog::on_buttonBox_accepted() settings.endGroup(); // the non XSLT exports are called directly above, the XSLT based ons are called here if (!stylesheet.isEmpty()) - export_dives_xslt(filename.toUtf8(), ui->exportSelected->isChecked(), ui->CSVUnits_2->currentIndex(), stylesheet.toUtf8()); + future = QtConcurrent::run(export_dives_xslt, filename.toUtf8(), ui->exportSelected->isChecked(), ui->CSVUnits_2->currentIndex(), stylesheet.toUtf8()); } } diff --git a/qt-ui/divelogexportdialog.h b/qt-ui/divelogexportdialog.h index 0a603ce..14f8f45 100644 --- a/qt-ui/divelogexportdialog.h +++ b/qt-ui/divelogexportdialog.h @@ -3,6 +3,7 @@ #include <QDialog> #include <QTextStream> +#include <QFuture> #include "helpers.h" #include "statistics.h" @@ -27,6 +28,7 @@ slots: void on_exportGroup_buttonClicked(QAbstractButton *); private: + QFuture<int> future; Ui::DiveLogExportDialog *ui; void showExplanation(); void exportHtmlInit(const QString &filename); -- 1.9.1
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
