mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-28 00:42:19 -07:00
[UserList] Show amount of online buddies
Took 11 minutes
This commit is contained in:
parent
d99798111e
commit
ff27364264
1 changed files with 13 additions and 1 deletions
|
|
@ -1638,14 +1638,26 @@ void UserListWidget::updateSectionDivider(Section section)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int visible = 0;
|
int visible = 0;
|
||||||
|
int online = 0;
|
||||||
for (int i = 0; i < divider->childCount(); ++i) {
|
for (int i = 0; i < divider->childCount(); ++i) {
|
||||||
if (!divider->child(i)->isHidden()) {
|
QTreeWidgetItem *child = divider->child(i);
|
||||||
|
if (!child->isHidden()) {
|
||||||
++visible;
|
++visible;
|
||||||
|
if (child->data(0, UserListRoles::Online).toBool()) {
|
||||||
|
++online;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// The tree draws no branches (rows are flush), so the divider carries its
|
// The tree draws no branches (rows are flush), so the divider carries its
|
||||||
// own collapse arrow glyph.
|
// own collapse arrow glyph.
|
||||||
const QString arrow = divider->isExpanded() ? QStringLiteral("\u25BE") : QStringLiteral("\u25B8");
|
const QString arrow = divider->isExpanded() ? QStringLiteral("\u25BE") : QStringLiteral("\u25B8");
|
||||||
|
if (section == Section::Buddy) {
|
||||||
|
// The buddy divider reports how many of the shown buddies are online,
|
||||||
|
// mirroring the "Buddies online: %1 / %2" title of the non-sectioned
|
||||||
|
// buddy list.
|
||||||
|
divider->setText(0, tr("%1 %2 (%3/%4)").arg(arrow, sectionTitle(section)).arg(online).arg(visible));
|
||||||
|
return;
|
||||||
|
}
|
||||||
divider->setText(0, tr("%1 %2 (%3)").arg(arrow, sectionTitle(section)).arg(visible));
|
divider->setText(0, tr("%1 %2 (%3)").arg(arrow, sectionTitle(section)).arg(visible));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue