aboutsummaryrefslogtreecommitdiff
path: root/main.h
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2014-02-02 10:26:38 +0100
committerPetr Mrázek <peterix@gmail.com>2014-02-02 10:26:38 +0100
commitb2bf50a6d75d32ac483bb53d5c5948b353cd2d16 (patch)
treee907a7bc9d2712472205e9a8955028752fa64f3b /main.h
parent179451d5911ccce569492717b1f0b0186e25cab9 (diff)
downloadPrismLauncher-b2bf50a6d75d32ac483bb53d5c5948b353cd2d16.tar.gz
PrismLauncher-b2bf50a6d75d32ac483bb53d5c5948b353cd2d16.tar.bz2
PrismLauncher-b2bf50a6d75d32ac483bb53d5c5948b353cd2d16.zip
Small tweaks
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: