aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2020-04-01 07:36:31 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-04-04 12:00:25 -0700
commit3df0cf619679921b58297ab12943109b66a8080b (patch)
tree30b987614e5cef443e9090c6447488e0cc9cf677 /core
parent85dfbfe67d0823b9fc5c5ae8d00c46be4673d708 (diff)
downloadsubsurface-3df0cf619679921b58297ab12943109b66a8080b.tar.gz
core/fulltext: give progress update while populating index
Especially with large dive logs this will prevent the user from thinking that the app is hung. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core')
-rw-r--r--core/fulltext.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/core/fulltext.cpp b/core/fulltext.cpp
index 2d7af752c..78988b1ab 100644
--- a/core/fulltext.cpp
+++ b/core/fulltext.cpp
@@ -4,6 +4,7 @@
#include "dive.h"
#include "divesite.h"
#include "trip.h"
+#include "qthelper.h"
#include <QLocale>
#include <map>
@@ -142,11 +143,20 @@ static std::vector<QString> getWords(const dive *d)
void FullText::reload()
{
+ // we want this to be two calls as the second text is overwritten below by the lines starting with "\r"
+ uiNotification(QObject::tr("Create full text index"));
+ uiNotification(QObject::tr("start processing"));
words.clear();
int i;
dive *d;
- for_each_dive(i, d)
+ for_each_dive(i, d) {
+ // this makes sure that every once in a while we allow the
+ // UI to respond to events
+ if (i % 100 == 99)
+ uiNotification(QObject::tr("\r%1 dives processed").arg(i + 1));
registerDive(d);
+ }
+ uiNotification(QObject::tr("\r%1 dives processed").arg(dive_table.nr));
}
void FullText::registerDive(struct dive *d)