Import progress is shown while import.

This commit is contained in:
2017-04-25 21:36:23 +02:00
parent 39ab4b74e2
commit dbbf4a0a67
5 changed files with 32 additions and 4 deletions
+16 -1
View File
@@ -4,6 +4,8 @@
#include <QList>
#include <QSharedPointer>
#include <QString>
#include <QEventLoop>
#include <QApplication>
#include <odb/core.hxx>
#include <odb/transaction.hxx>
@@ -15,6 +17,7 @@
#include "iservice.h"
#include "permissionevaluator.h"
#include "iimporter.h"
#include "iimportprogress.h"
#include "transaction.h"
@@ -179,7 +182,7 @@ public:
}
}
bool importData(IImporter *importer) {
bool importData(IImporter *importer, IImportProgress *progress = NULL) {
int count = importer->recordCount();
if (importer->isError()) {
@@ -201,6 +204,18 @@ public:
{
return false;
}
qApp->processEvents();
if (progress != NULL && progress->terminate())
{
return true;
}
if (progress != NULL)
{
progress->updateProgress(i * 100 / count);
}
}
return true;