summaryrefslogtreecommitdiffstats
path: root/qt-models/divetripmodel.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2020-04-01 07:37:35 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-04-04 12:00:25 -0700
commit00617aa9248dc300fab3bacc4b40d52def7db86e (patch)
tree704dd3df1aa400033926221c26786cafa2a16fc5 /qt-models/divetripmodel.cpp
parent3df0cf619679921b58297ab12943109b66a8080b (diff)
downloadsubsurface-00617aa9248dc300fab3bacc4b40d52def7db86e.tar.gz
core/models: give progress update while populating models
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 'qt-models/divetripmodel.cpp')
-rw-r--r--qt-models/divetripmodel.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp
index 207962906..2e5359b89 100644
--- a/qt-models/divetripmodel.cpp
+++ b/qt-models/divetripmodel.cpp
@@ -494,10 +494,14 @@ void DiveTripModelBase::reset()
beginResetModel();
clearData();
populate();
+ uiNotification(tr("setting up dive sites"));
LocationInformationModel::instance()->update();
+ uiNotification(tr("finish populating data store"));
endResetModel();
+ uiNotification(tr("setting up internal data structures"));
initSelection();
emit diveListNotifier.numShownChanged();
+ uiNotification(tr("done setting up internal data structures"));
}
DiveTripModelBase::DiveTripModelBase(QObject *parent) : QAbstractItemModel(parent),
@@ -716,7 +720,12 @@ DiveTripModelTree::DiveTripModelTree(QObject *parent) : DiveTripModelBase(parent
void DiveTripModelTree::populate()
{
+ // we want this to be two calls as the second text is overwritten below by the lines starting with "\r"
+ uiNotification(QObject::tr("populate data model"));
+ uiNotification(QObject::tr("start processing"));
for (int i = 0; i < dive_table.nr; ++i) {
+ if (i % 100 == 99)
+ uiNotification(QObject::tr("\r%1 dives processed").arg(i + 1));
dive *d = get_dive(i);
update_cylinder_related_info(d);
if (d->hidden_by_filter)
@@ -744,6 +753,7 @@ void DiveTripModelTree::populate()
// Remember the index of the current dive
oldCurrent = current_dive;
+ uiNotification(QObject::tr("\r%1 dives processed").arg(dive_table.nr));
}
int DiveTripModelTree::rowCount(const QModelIndex &parent) const