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
- 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)
- 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)

View file

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