mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
3df0cf6196
commit
00617aa924
1 changed files with 10 additions and 0 deletions
|
@ -494,10 +494,14 @@ void DiveTripModelBase::reset()
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
clearData();
|
clearData();
|
||||||
populate();
|
populate();
|
||||||
|
uiNotification(tr("setting up dive sites"));
|
||||||
LocationInformationModel::instance()->update();
|
LocationInformationModel::instance()->update();
|
||||||
|
uiNotification(tr("finish populating data store"));
|
||||||
endResetModel();
|
endResetModel();
|
||||||
|
uiNotification(tr("setting up internal data structures"));
|
||||||
initSelection();
|
initSelection();
|
||||||
emit diveListNotifier.numShownChanged();
|
emit diveListNotifier.numShownChanged();
|
||||||
|
uiNotification(tr("done setting up internal data structures"));
|
||||||
}
|
}
|
||||||
|
|
||||||
DiveTripModelBase::DiveTripModelBase(QObject *parent) : QAbstractItemModel(parent),
|
DiveTripModelBase::DiveTripModelBase(QObject *parent) : QAbstractItemModel(parent),
|
||||||
|
@ -716,7 +720,12 @@ DiveTripModelTree::DiveTripModelTree(QObject *parent) : DiveTripModelBase(parent
|
||||||
|
|
||||||
void DiveTripModelTree::populate()
|
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) {
|
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);
|
dive *d = get_dive(i);
|
||||||
update_cylinder_related_info(d);
|
update_cylinder_related_info(d);
|
||||||
if (d->hidden_by_filter)
|
if (d->hidden_by_filter)
|
||||||
|
@ -744,6 +753,7 @@ void DiveTripModelTree::populate()
|
||||||
|
|
||||||
// Remember the index of the current dive
|
// Remember the index of the current dive
|
||||||
oldCurrent = current_dive;
|
oldCurrent = current_dive;
|
||||||
|
uiNotification(QObject::tr("\r%1 dives processed").arg(dive_table.nr));
|
||||||
}
|
}
|
||||||
|
|
||||||
int DiveTripModelTree::rowCount(const QModelIndex &parent) const
|
int DiveTripModelTree::rowCount(const QModelIndex &parent) const
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue