diff options
author | Petr Mrázek <peterix@gmail.com> | 2014-02-02 10:26:38 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2014-02-02 10:26:38 +0100 |
commit | b2bf50a6d75d32ac483bb53d5c5948b353cd2d16 (patch) | |
tree | e907a7bc9d2712472205e9a8955028752fa64f3b /main.h | |
parent | 179451d5911ccce569492717b1f0b0186e25cab9 (diff) | |
download | PrismLauncher-b2bf50a6d75d32ac483bb53d5c5948b353cd2d16.tar.gz PrismLauncher-b2bf50a6d75d32ac483bb53d5c5948b353cd2d16.tar.bz2 PrismLauncher-b2bf50a6d75d32ac483bb53d5c5948b353cd2d16.zip |
Small tweaks
Diffstat (limited to 'main.h')
-rw-r--r-- | main.h | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -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: |