From 7246ab38c7b5c9fe114506785bfe7f72677c698e Mon Sep 17 00:00:00 2001 From: badoge <18620902+badoge@users.noreply.github.com> Date: Sun, 24 Apr 2022 08:54:37 -0700 Subject: [PATCH] Add chatter count for each category in viewer list (#3683) Co-authored-by: Kasia Co-authored-by: Rasmus Karlsson --- CHANGELOG.md | 1 + src/widgets/splits/Split.cpp | 16 +++++++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9aeea040..8f7e9b98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Minor: Adjust large stream thumbnail to 16:9 (#3655) - Minor: Fixed being unable to load Twitch Usercards from the `/mentions` tab. (#3623) - Minor: Add information about the user's operating system in the About page. (#3663) +- Minor: Added chatter count for each category in viewer list. (#3683) - Bugfix: Fixed live notifications for usernames containing uppercase characters. (#3646) - Bugfix: Fixed certain settings dialogs appearing behind the main window, when `Always on top` was used. (#3679) - Bugfix: Fixed an issue in the emote picker where an emotes tooltip would not properly disappear. (#3686) diff --git a/src/widgets/splits/Split.cpp b/src/widgets/splits/Split.cpp index f22a36e6..2a0267a2 100644 --- a/src/widgets/splits/Split.cpp +++ b/src/widgets/splits/Split.cpp @@ -983,13 +983,6 @@ void Split::showViewerList() static QStringList jsonLabels = {"broadcaster", "moderators", "vips", "staff", "admins", "global_mods", "viewers"}; - QList labelList; - for (auto &x : labels) - { - auto label = formatListItemText(x); - label->setForeground(this->theme->accent); - labelList.append(label); - } auto loadingLabel = new QLabel("Loading..."); NetworkRequest::twitchRequest("https://tmi.twitch.tv/group/user/" + @@ -1014,7 +1007,10 @@ void Split::showViewerList() if (currentCategory.empty()) continue; - chattersList->addItem(labelList.at(i)); + auto label = formatListItemText(QString("%1 (%2)").arg( + labels.at(i), localizeNumbers(currentCategory.size()))); + label->setForeground(this->theme->accent); + chattersList->addItem(label); foreach (const QJsonValue &v, currentCategory) { chattersList->addItem(formatListItemText(v.toString())); @@ -1055,7 +1051,9 @@ void Split::showViewerList() }); auto listDoubleClick = [=](QString userName) { - if (!labels.contains(userName) && !userName.isEmpty()) + // if the list item contains a parentheses it means that + // it's a category label so don't show a usercard + if (!userName.contains("(") && !userName.isEmpty()) { this->view_->showUserInfoPopup(userName); }