mirror of
https://github.com/UltimMC/Launcher.git
synced 2026-01-02 21:59:59 +00:00
Small tweaks
This commit is contained in:
19
main.h
19
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())
|
||||
int newvalue = std::min(value + 3, maximum);
|
||||
item->setData(newvalue, CategorizedViewRoles::ProgressValueRole);
|
||||
|
||||
if(newvalue >= maximum)
|
||||
{
|
||||
item->setData(item->data(CategorizedViewRoles::ProgressMaximumRole).toInt(),
|
||||
CategorizedViewRoles::ProgressValueRole);
|
||||
}
|
||||
else
|
||||
{
|
||||
item->setData(value, CategorizedViewRoles::ProgressValueRole);
|
||||
toRemove.append(item);
|
||||
}
|
||||
}
|
||||
for(auto remove : toRemove)
|
||||
{
|
||||
m_items.removeAll(remove);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user