Viewer list usability improvements (#2059)

* Updated to use accent color and added spaces between categories

* Switched order of Moderators and VIPs
This commit is contained in:
yodax 2020-10-17 09:00:10 -04:00 committed by GitHub
parent 6e7f8d9d9c
commit 2352c31dd6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 11 deletions

View file

@ -2,6 +2,7 @@
## Unversioned ## Unversioned
- Minor: Improved viewer list window.
- Major: Added Streamer Mode configuration (under `Settings -> General`), where you can select which features of Chatterino should behave differently when you are in Streamer Mode. (#2001) - Major: Added Streamer Mode configuration (under `Settings -> General`), where you can select which features of Chatterino should behave differently when you are in Streamer Mode. (#2001)
- Minor: Made the current channels emotes appear at the top of the emote picker popup. (#2057) - Minor: Made the current channels emotes appear at the top of the emote picker popup. (#2057)
- Minor: Added viewer list button to twitch channel header. (#1978) - Minor: Added viewer list button to twitch channel header. (#1978)

View file

@ -8,6 +8,7 @@
#include "providers/twitch/TwitchChannel.hpp" #include "providers/twitch/TwitchChannel.hpp"
#include "providers/twitch/TwitchIrcServer.hpp" #include "providers/twitch/TwitchIrcServer.hpp"
#include "providers/twitch/TwitchMessageBuilder.hpp" #include "providers/twitch/TwitchMessageBuilder.hpp"
#include "singletons/Fonts.hpp"
#include "singletons/Settings.hpp" #include "singletons/Settings.hpp"
#include "singletons/Theme.hpp" #include "singletons/Theme.hpp"
#include "singletons/WindowManager.hpp" #include "singletons/WindowManager.hpp"
@ -608,7 +609,8 @@ void Split::openWithCustomScheme()
void Split::showViewerList() void Split::showViewerList()
{ {
auto viewerDock = new QDockWidget("Viewer List", this); auto viewerDock =
new QDockWidget("Viewer List - " + this->getChannel()->getName(), this);
viewerDock->setAllowedAreas(Qt::LeftDockWidgetArea); viewerDock->setAllowedAreas(Qt::LeftDockWidgetArea);
viewerDock->setFeatures(QDockWidget::DockWidgetVerticalTitleBar | viewerDock->setFeatures(QDockWidget::DockWidgetVerticalTitleBar |
QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetClosable |
@ -625,17 +627,24 @@ void Split::showViewerList()
auto chattersList = new QListWidget(); auto chattersList = new QListWidget();
auto resultList = new QListWidget(); auto resultList = new QListWidget();
static QStringList labels = {"Broadcaster", "VIPs", "Moderators", auto formatListItemText = [](QString text) {
"Staff", "Admins", "Global Moderators", auto item = new QListWidgetItem();
"Viewers"}; item->setText(text);
static QStringList jsonLabels = {"broadcaster", "vips", "moderators", item->setFont(getApp()->fonts->getFont(FontStyle::ChatMedium, 1.0));
return item;
};
static QStringList labels = {
"Broadcaster", "Moderators", "VIPs", "Staff",
"Admins", "Global Moderators", "Viewers"};
static QStringList jsonLabels = {"broadcaster", "moderators", "vips",
"staff", "admins", "global_mods", "staff", "admins", "global_mods",
"viewers"}; "viewers"};
QList<QListWidgetItem *> labelList; QList<QListWidgetItem *> labelList;
for (auto &x : labels) for (auto &x : labels)
{ {
auto label = new QListWidgetItem(x); auto label = formatListItemText(x);
label->setBackgroundColor(this->theme->splits.header.background); label->setForeground(this->theme->accent);
labelList.append(label); labelList.append(label);
} }
auto loadingLabel = new QLabel("Loading..."); auto loadingLabel = new QLabel("Loading...");
@ -659,7 +668,10 @@ void Split::showViewerList()
chattersList->addItem(labelList.at(i)); chattersList->addItem(labelList.at(i));
foreach (const QJsonValue &v, currentCategory) foreach (const QJsonValue &v, currentCategory)
chattersList->addItem(v.toString()); {
chattersList->addItem(formatListItemText(v.toString()));
}
chattersList->addItem(new QListWidgetItem());
} }
return Success; return Success;
@ -677,7 +689,9 @@ void Split::showViewerList()
for (auto &item : results) for (auto &item : results)
{ {
if (!labels.contains(item->text())) if (!labels.contains(item->text()))
resultList->addItem(item->text()); {
resultList->addItem(formatListItemText(item->text()));
}
} }
resultList->show(); resultList->show();
} }
@ -692,7 +706,7 @@ void Split::showViewerList()
[=]() { viewerDock->setMinimumWidth(300); }); [=]() { viewerDock->setMinimumWidth(300); });
auto listDoubleClick = [=](QString userName) { auto listDoubleClick = [=](QString userName) {
if (!labels.contains(userName)) if (!labels.contains(userName) && !userName.isEmpty())
{ {
this->view_->showUserInfoPopup(userName); this->view_->showUserInfoPopup(userName);
} }