aboutsummaryrefslogtreecommitdiff
path: root/main.h
diff options
context:
space:
mode:
Diffstat (limited to 'main.h')
-rw-r--r--main.h19
1 files changed, 11 insertions, 8 deletions
diff --git a/main.h b/main.h
index 47377f7a..6883e98e 100644
--- a/main.h
+++ b/main.h
@@ -30,20 +30,23 @@ public
slots:
void timeout()
{
+ QList<QStandardItem *> toRemove;
for (auto item : m_items)
{
+ int maximum = item->data(CategorizedViewRoles::ProgressMaximumRole).toInt();
int value = item->data(CategorizedViewRoles::ProgressValueRole).toInt();
- value += qrand() % 3;
- if (value >= item->data(CategorizedViewRoles::ProgressMaximumRole).toInt())
- {
- item->setData(item->data(CategorizedViewRoles::ProgressMaximumRole).toInt(),
- CategorizedViewRoles::ProgressValueRole);
- }
- else
+ int newvalue = std::min(value + 3, maximum);
+ item->setData(newvalue, CategorizedViewRoles::ProgressValueRole);
+
+ if(newvalue >= maximum)
{
- item->setData(value, CategorizedViewRoles::ProgressValueRole);
+ toRemove.append(item);
}
}
+ for(auto remove : toRemove)
+ {
+ m_items.removeAll(remove);
+ }
}
private: