Creating a Notification widget in the Main Window.

The main error message bar can be used to show exporting information and
other notification.

So a new Notification handler object is created in the main window
<NotificationWidget> that inherits <KMessageWidget> that shows different
type of notifications, ex. (Warning, Error and information)

Also this class contains a QFutureWatcher object that is set to handle
the QFuture variable returned from the exporting thread. this will allow
the UI to be updated when the thread finishes execution.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Gehad elrobey 2015-02-26 16:07:39 +02:00 committed by Dirk Hohndel
parent e6482bbdc8
commit 59ab849854
7 changed files with 88 additions and 12 deletions

View file

@ -9,6 +9,7 @@
#include "subsurfacewebservices.h"
#include "worldmap-save.h"
#include "save-html.h"
#include "mainwindow.h"
#define GET_UNIT(name, field, f, t) \
v = settings.value(QString(name)); \
@ -312,8 +313,11 @@ void DiveLogExportDialog::on_buttonBox_accepted()
settings.setValue("LastDir", fileInfo.dir().path());
settings.endGroup();
// the non XSLT exports are called directly above, the XSLT based ons are called here
if (!stylesheet.isEmpty())
if (!stylesheet.isEmpty()) {
future = QtConcurrent::run(export_dives_xslt, filename.toUtf8(), ui->exportSelected->isChecked(), ui->CSVUnits_2->currentIndex(), stylesheet.toUtf8());
MainWindow::instance()->getNotificationWidget()->showNotification("Exporting...", KMessageWidget::Information);
MainWindow::instance()->getNotificationWidget()->setFuture(future);
}
}
}