2017-06-11 09:31:45 +02:00
|
|
|
#include "widgets/accountpopup.hpp"
|
2018-04-27 22:11:19 +02:00
|
|
|
|
|
|
|
#include "application.hpp"
|
2017-06-11 09:31:45 +02:00
|
|
|
#include "channel.hpp"
|
2017-08-19 15:29:36 +02:00
|
|
|
#include "credentials.hpp"
|
2017-12-31 22:58:35 +01:00
|
|
|
#include "singletons/accountmanager.hpp"
|
2017-12-31 00:50:07 +01:00
|
|
|
#include "singletons/settingsmanager.hpp"
|
2017-04-19 15:25:05 +02:00
|
|
|
#include "ui_accountpopupform.h"
|
2017-12-16 02:22:35 +01:00
|
|
|
#include "util/urlfetch.hpp"
|
2017-04-12 17:46:44 +02:00
|
|
|
|
2017-09-23 19:23:10 +02:00
|
|
|
#include <QClipboard>
|
|
|
|
#include <QDesktopServices>
|
2017-07-31 22:14:54 +02:00
|
|
|
#include <QJsonArray>
|
|
|
|
#include <QJsonDocument>
|
|
|
|
#include <QJsonObject>
|
|
|
|
#include <QNetworkReply>
|
|
|
|
#include <QNetworkRequest>
|
|
|
|
#include <QPixmap>
|
2017-04-12 17:46:44 +02:00
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
namespace chatterino {
|
|
|
|
namespace widgets {
|
2017-04-12 17:46:44 +02:00
|
|
|
|
2018-01-24 13:15:41 +01:00
|
|
|
AccountPopupWidget::AccountPopupWidget(ChannelPtr _channel)
|
2018-01-14 21:55:36 +01:00
|
|
|
: BaseWindow()
|
2017-12-19 01:25:57 +01:00
|
|
|
, ui(new Ui::AccountPopup)
|
|
|
|
, channel(_channel)
|
2017-04-12 17:46:44 +02:00
|
|
|
{
|
2018-04-27 22:11:19 +02:00
|
|
|
auto app = getApp();
|
|
|
|
|
2017-12-19 01:25:57 +01:00
|
|
|
this->ui->setupUi(this);
|
2017-04-12 17:46:44 +02:00
|
|
|
|
2018-01-22 20:52:32 +01:00
|
|
|
this->setStayInScreenRect(true);
|
|
|
|
|
2017-12-18 01:17:02 +01:00
|
|
|
this->layout()->setSizeConstraint(QLayout::SetFixedSize);
|
|
|
|
|
2017-12-19 01:25:57 +01:00
|
|
|
this->setWindowFlags(Qt::FramelessWindowHint);
|
2017-12-17 16:45:15 +01:00
|
|
|
|
2017-12-19 01:25:57 +01:00
|
|
|
this->resize(0, 0);
|
2017-04-12 17:46:44 +02:00
|
|
|
|
2018-01-18 18:20:40 +01:00
|
|
|
connect(this, &AccountPopupWidget::refreshButtons, this,
|
|
|
|
&AccountPopupWidget::actuallyRefreshButtons, Qt::QueuedConnection);
|
|
|
|
|
2018-04-27 22:11:19 +02:00
|
|
|
app->accounts->Twitch.userChanged.connect([=] {
|
|
|
|
auto currentTwitchUser = app->accounts->Twitch.getCurrent();
|
2018-01-18 18:20:40 +01:00
|
|
|
if (!currentTwitchUser) {
|
|
|
|
// No twitch user set (should never happen)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
this->loggedInUser.username = currentTwitchUser->getUserName();
|
|
|
|
this->loggedInUser.userID = currentTwitchUser->getUserId();
|
|
|
|
|
|
|
|
this->loggedInUser.refreshUserType(this->channel, true);
|
|
|
|
});
|
|
|
|
|
2017-12-19 01:25:57 +01:00
|
|
|
for (auto button : this->ui->profileLayout->findChildren<QPushButton *>()) {
|
2017-09-23 19:23:10 +02:00
|
|
|
button->setFocusProxy(this);
|
|
|
|
}
|
2017-12-19 01:25:57 +01:00
|
|
|
for (auto button : this->ui->userLayout->findChildren<QPushButton *>()) {
|
2017-09-23 19:23:10 +02:00
|
|
|
button->setFocusProxy(this);
|
|
|
|
}
|
2017-12-19 01:25:57 +01:00
|
|
|
for (auto button : this->ui->modLayout->findChildren<QPushButton *>()) {
|
2017-09-23 19:23:10 +02:00
|
|
|
button->setFocusProxy(this);
|
|
|
|
}
|
2017-12-19 01:25:57 +01:00
|
|
|
for (auto button : this->ui->ownerLayout->findChildren<QPushButton *>()) {
|
2017-09-23 19:23:10 +02:00
|
|
|
button->setFocusProxy(this);
|
|
|
|
}
|
|
|
|
|
2017-12-19 01:25:57 +01:00
|
|
|
this->timeout(this->ui->purge, 1);
|
|
|
|
this->timeout(this->ui->min1, 60);
|
|
|
|
this->timeout(this->ui->min10, 600);
|
|
|
|
this->timeout(this->ui->hour1, 3600);
|
|
|
|
this->timeout(this->ui->hour24, 86400);
|
2017-09-23 19:23:10 +02:00
|
|
|
|
2017-12-19 01:25:57 +01:00
|
|
|
this->sendCommand(this->ui->ban, "/ban ");
|
|
|
|
this->sendCommand(this->ui->unBan, "/unban ");
|
|
|
|
this->sendCommand(this->ui->mod, "/mod ");
|
|
|
|
this->sendCommand(this->ui->unMod, "/unmod ");
|
2017-09-23 19:23:10 +02:00
|
|
|
|
2017-12-19 01:25:57 +01:00
|
|
|
QObject::connect(this->ui->profile, &QPushButton::clicked, this, [=]() {
|
2018-01-18 18:20:40 +01:00
|
|
|
QDesktopServices::openUrl(QUrl("https://twitch.tv/" + this->popupWidgetUser.username));
|
2017-09-23 19:23:10 +02:00
|
|
|
});
|
|
|
|
|
2017-12-19 01:25:57 +01:00
|
|
|
QObject::connect(this->ui->sendMessage, &QPushButton::clicked, this, [=]() {
|
2017-12-16 02:22:35 +01:00
|
|
|
QDesktopServices::openUrl(
|
2017-12-19 01:25:57 +01:00
|
|
|
QUrl("https://www.twitch.tv/message/compose?to=" + this->ui->lblUsername->text()));
|
2017-09-23 19:23:10 +02:00
|
|
|
});
|
|
|
|
|
2017-12-19 01:25:57 +01:00
|
|
|
QObject::connect(this->ui->copy, &QPushButton::clicked, this,
|
|
|
|
[=]() { QApplication::clipboard()->setText(this->ui->lblUsername->text()); });
|
2017-09-23 19:23:10 +02:00
|
|
|
|
2017-12-19 01:25:57 +01:00
|
|
|
QObject::connect(this->ui->follow, &QPushButton::clicked, this, [=]() {
|
2018-01-18 18:20:40 +01:00
|
|
|
debug::Log("Attempt to toggle follow user {}({}) as user {}({})",
|
|
|
|
this->popupWidgetUser.username, this->popupWidgetUser.userID,
|
|
|
|
this->loggedInUser.username, this->loggedInUser.userID);
|
|
|
|
|
|
|
|
QUrl requestUrl("https://api.twitch.tv/kraken/users/" + this->loggedInUser.userID +
|
|
|
|
"/follows/channels/" + this->popupWidgetUser.userID);
|
|
|
|
|
|
|
|
this->ui->follow->setEnabled(false);
|
|
|
|
if (!this->relationship.following) {
|
|
|
|
util::twitch::put(requestUrl, [this](QJsonObject obj) {
|
|
|
|
qDebug() << "follows channel: " << obj;
|
|
|
|
this->relationship.following = true;
|
|
|
|
emit refreshButtons();
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
util::twitch::sendDelete(requestUrl, [this] {
|
|
|
|
this->relationship.following = false;
|
|
|
|
emit refreshButtons();
|
|
|
|
});
|
|
|
|
}
|
2017-09-23 19:23:10 +02:00
|
|
|
});
|
|
|
|
|
2017-12-19 01:25:57 +01:00
|
|
|
QObject::connect(this->ui->ignore, &QPushButton::clicked, this, [=]() {
|
2018-01-18 18:20:40 +01:00
|
|
|
QUrl requestUrl("https://api.twitch.tv/kraken/users/" + this->loggedInUser.userID +
|
|
|
|
"/blocks/" + this->popupWidgetUser.userID);
|
2017-09-23 19:23:10 +02:00
|
|
|
|
2018-01-18 18:20:40 +01:00
|
|
|
if (!this->relationship.ignoring) {
|
|
|
|
util::twitch::put(requestUrl, [this](auto) {
|
|
|
|
this->relationship.ignoring = true; //
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
util::twitch::sendDelete(requestUrl, [this] {
|
|
|
|
this->relationship.ignoring = false; //
|
|
|
|
});
|
|
|
|
}
|
2017-09-23 19:23:10 +02:00
|
|
|
});
|
|
|
|
|
2018-04-27 22:11:19 +02:00
|
|
|
QObject::connect(this->ui->disableHighlights, &QPushButton::clicked, this, [=]() {
|
|
|
|
QString str = app->settings->highlightUserBlacklist;
|
2017-12-19 01:25:57 +01:00
|
|
|
str.append(this->ui->lblUsername->text() + "\n");
|
2018-04-27 22:11:19 +02:00
|
|
|
app->settings->highlightUserBlacklist = str;
|
2017-12-19 01:25:57 +01:00
|
|
|
this->ui->disableHighlights->hide();
|
|
|
|
this->ui->enableHighlights->show();
|
2017-09-23 19:23:10 +02:00
|
|
|
});
|
|
|
|
|
2018-04-27 22:11:19 +02:00
|
|
|
QObject::connect(this->ui->enableHighlights, &QPushButton::clicked, this, [=]() {
|
|
|
|
QString str = app->settings->highlightUserBlacklist;
|
2017-09-23 19:23:10 +02:00
|
|
|
QStringList list = str.split("\n");
|
2017-12-19 01:25:57 +01:00
|
|
|
list.removeAll(this->ui->lblUsername->text());
|
2018-04-27 22:11:19 +02:00
|
|
|
app->settings->highlightUserBlacklist = list.join("\n");
|
2017-12-19 01:25:57 +01:00
|
|
|
this->ui->enableHighlights->hide();
|
|
|
|
this->ui->disableHighlights->show();
|
2017-09-23 19:23:10 +02:00
|
|
|
});
|
|
|
|
|
2017-12-19 01:25:57 +01:00
|
|
|
this->updateButtons(this->ui->userLayout, false);
|
|
|
|
this->updateButtons(this->ui->modLayout, false);
|
|
|
|
this->updateButtons(this->ui->ownerLayout, false);
|
2017-09-23 19:23:10 +02:00
|
|
|
|
2017-04-12 17:46:44 +02:00
|
|
|
// Close button
|
2017-12-19 01:25:57 +01:00
|
|
|
QObject::connect(this->ui->btnClose, &QPushButton::clicked, [this] {
|
|
|
|
this->hide(); //
|
2017-04-12 17:46:44 +02:00
|
|
|
});
|
2017-09-23 19:23:10 +02:00
|
|
|
|
2018-01-25 20:49:49 +01:00
|
|
|
this->scaleChangedEvent(this->getScale());
|
2017-07-31 22:14:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void AccountPopupWidget::setName(const QString &name)
|
|
|
|
{
|
2018-01-18 18:20:40 +01:00
|
|
|
this->relationship.following = false;
|
|
|
|
this->relationship.ignoring = false;
|
|
|
|
|
|
|
|
this->popupWidgetUser.username = name;
|
2017-12-19 01:25:57 +01:00
|
|
|
this->ui->lblUsername->setText(name);
|
|
|
|
this->getUserId();
|
2018-01-18 18:20:40 +01:00
|
|
|
|
|
|
|
// Refresh popup widget users type
|
|
|
|
|
|
|
|
this->popupWidgetUser.refreshUserType(this->channel, false);
|
|
|
|
}
|
|
|
|
|
2018-01-24 13:15:41 +01:00
|
|
|
void AccountPopupWidget::User::refreshUserType(const ChannelPtr &channel, bool loggedInUser)
|
2018-01-18 18:20:40 +01:00
|
|
|
{
|
|
|
|
if (channel->name == this->username) {
|
|
|
|
this->userType = UserType::Owner;
|
|
|
|
} else if ((loggedInUser && channel->isMod()) || channel->modList.contains(this->username)) {
|
|
|
|
this->userType = UserType::Mod;
|
|
|
|
} else {
|
|
|
|
this->userType = UserType::User;
|
|
|
|
}
|
2017-07-31 22:14:54 +02:00
|
|
|
}
|
|
|
|
|
2018-01-24 13:15:41 +01:00
|
|
|
void AccountPopupWidget::setChannel(ChannelPtr _channel)
|
2017-09-12 22:10:30 +02:00
|
|
|
{
|
2017-12-19 01:25:57 +01:00
|
|
|
this->channel = _channel;
|
2017-09-12 22:10:30 +02:00
|
|
|
}
|
|
|
|
|
2017-07-31 22:14:54 +02:00
|
|
|
void AccountPopupWidget::getUserId()
|
|
|
|
{
|
2018-01-18 18:20:40 +01:00
|
|
|
util::twitch::getUserID(this->popupWidgetUser.username, this, [=](const QString &id) {
|
|
|
|
this->popupWidgetUser.userID = id;
|
2017-12-19 01:25:57 +01:00
|
|
|
this->getUserData();
|
2017-04-12 17:46:44 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-07-31 22:14:54 +02:00
|
|
|
void AccountPopupWidget::getUserData()
|
2017-04-12 17:46:44 +02:00
|
|
|
{
|
2017-12-16 02:22:35 +01:00
|
|
|
util::twitch::get(
|
2018-01-18 18:20:40 +01:00
|
|
|
"https://api.twitch.tv/kraken/channels/" + this->popupWidgetUser.userID, this,
|
|
|
|
[=](const QJsonObject &obj) {
|
2017-12-19 01:25:57 +01:00
|
|
|
this->ui->lblFollowers->setText(QString::number(obj.value("followers").toInt()));
|
|
|
|
this->ui->lblViews->setText(QString::number(obj.value("views").toInt()));
|
|
|
|
this->ui->lblAccountAge->setText(obj.value("created_at").toString().section("T", 0, 0));
|
2017-07-31 22:14:54 +02:00
|
|
|
|
2017-12-19 01:25:57 +01:00
|
|
|
this->loadAvatar(QUrl(obj.value("logo").toString()));
|
2017-12-16 02:22:35 +01:00
|
|
|
});
|
2018-01-18 18:20:40 +01:00
|
|
|
|
|
|
|
util::twitch::get("https://api.twitch.tv/kraken/users/" + this->loggedInUser.userID +
|
|
|
|
"/follows/channels/" + this->popupWidgetUser.userID,
|
|
|
|
this, [=](const QJsonObject &obj) {
|
|
|
|
this->ui->follow->setEnabled(true);
|
|
|
|
this->relationship.following = obj.contains("channel");
|
|
|
|
|
|
|
|
emit refreshButtons();
|
|
|
|
});
|
|
|
|
|
|
|
|
// TODO: Get ignore relationship between logged in user and popup widget user and update
|
|
|
|
// relationship.ignoring
|
2017-07-31 22:14:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void AccountPopupWidget::loadAvatar(const QUrl &avatarUrl)
|
|
|
|
{
|
2018-01-18 18:20:40 +01:00
|
|
|
if (!this->avatarMap.tryGet(this->popupWidgetUser.userID, this->avatar)) {
|
2017-08-12 12:09:26 +02:00
|
|
|
if (!avatarUrl.isEmpty()) {
|
2017-07-31 22:14:54 +02:00
|
|
|
QNetworkRequest req(avatarUrl);
|
|
|
|
static auto manager = new QNetworkAccessManager();
|
|
|
|
auto *reply = manager->get(req);
|
|
|
|
|
2017-08-12 12:09:26 +02:00
|
|
|
QObject::connect(reply, &QNetworkReply::finished, this, [=] {
|
|
|
|
if (reply->error() == QNetworkReply::NoError) {
|
2017-07-31 22:14:54 +02:00
|
|
|
const auto data = reply->readAll();
|
|
|
|
this->avatar.loadFromData(data);
|
2018-01-18 18:20:40 +01:00
|
|
|
this->avatarMap.insert(this->popupWidgetUser.userID, this->avatar);
|
2017-12-19 01:25:57 +01:00
|
|
|
this->ui->lblAvatar->setPixmap(this->avatar);
|
2017-08-12 12:09:26 +02:00
|
|
|
} else {
|
2017-12-19 01:25:57 +01:00
|
|
|
this->ui->lblAvatar->setText("ERROR");
|
2017-07-31 22:14:54 +02:00
|
|
|
}
|
|
|
|
});
|
2017-08-12 12:09:26 +02:00
|
|
|
} else {
|
2017-12-19 01:25:57 +01:00
|
|
|
this->ui->lblAvatar->setText("No Avatar");
|
2017-07-31 22:14:54 +02:00
|
|
|
}
|
2017-08-12 12:09:26 +02:00
|
|
|
} else {
|
2017-12-19 01:25:57 +01:00
|
|
|
this->ui->lblAvatar->setPixmap(this->avatar);
|
2017-07-31 22:14:54 +02:00
|
|
|
}
|
2017-04-12 17:46:44 +02:00
|
|
|
}
|
|
|
|
|
2018-01-25 20:49:49 +01:00
|
|
|
void AccountPopupWidget::scaleChangedEvent(float newDpi)
|
2017-12-18 01:17:02 +01:00
|
|
|
{
|
|
|
|
this->setStyleSheet(QString("* { font-size: <font-size>px; }")
|
|
|
|
.replace("<font-size>", QString::number((int)(12 * newDpi))));
|
|
|
|
|
2017-12-19 01:25:57 +01:00
|
|
|
this->ui->lblAvatar->setFixedSize((int)(100 * newDpi), (int)(100 * newDpi));
|
2017-12-18 01:17:02 +01:00
|
|
|
}
|
|
|
|
|
2017-12-16 02:22:35 +01:00
|
|
|
void AccountPopupWidget::updateButtons(QWidget *layout, bool state)
|
2017-09-23 19:23:10 +02:00
|
|
|
{
|
2017-12-16 02:22:35 +01:00
|
|
|
for (auto button : layout->findChildren<QPushButton *>()) {
|
2017-09-23 19:23:10 +02:00
|
|
|
button->setVisible(state);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AccountPopupWidget::timeout(QPushButton *button, int time)
|
|
|
|
{
|
2017-12-16 02:22:35 +01:00
|
|
|
QObject::connect(button, &QPushButton::clicked, this, [=]() {
|
2017-12-19 01:25:57 +01:00
|
|
|
this->channel->sendMessage("/timeout " + this->ui->lblUsername->text() + " " +
|
|
|
|
QString::number(time));
|
2017-09-23 19:23:10 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
void AccountPopupWidget::sendCommand(QPushButton *button, QString command)
|
2017-07-31 22:14:54 +02:00
|
|
|
{
|
2017-12-16 02:22:35 +01:00
|
|
|
QObject::connect(button, &QPushButton::clicked, this, [=]() {
|
2017-12-19 01:25:57 +01:00
|
|
|
this->channel->sendMessage(command + this->ui->lblUsername->text());
|
2017-09-23 19:23:10 +02:00
|
|
|
});
|
|
|
|
}
|
2017-07-31 22:14:54 +02:00
|
|
|
|
2018-01-18 18:20:40 +01:00
|
|
|
void AccountPopupWidget::refreshLayouts()
|
|
|
|
{
|
2018-04-27 22:11:19 +02:00
|
|
|
auto currentTwitchUser = getApp()->accounts->Twitch.getCurrent();
|
2018-01-18 18:20:40 +01:00
|
|
|
if (!currentTwitchUser) {
|
|
|
|
// No twitch user set (should never happen)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString loggedInUsername = currentTwitchUser->getUserName();
|
|
|
|
QString popupUsername = this->ui->lblUsername->text();
|
|
|
|
|
|
|
|
bool showModLayout = false;
|
|
|
|
bool showUserLayout = false;
|
|
|
|
bool showOwnerLayout = false;
|
|
|
|
|
|
|
|
if (loggedInUsername == popupUsername) {
|
|
|
|
// Clicked user is the same as the logged in user
|
|
|
|
showModLayout = false;
|
|
|
|
showUserLayout = false;
|
|
|
|
showOwnerLayout = false;
|
|
|
|
} else {
|
|
|
|
showUserLayout = true;
|
|
|
|
|
|
|
|
switch (this->loggedInUser.userType) {
|
|
|
|
case UserType::Mod: {
|
|
|
|
showModLayout = true;
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case UserType::Owner: {
|
|
|
|
showModLayout = true;
|
|
|
|
showOwnerLayout = true;
|
|
|
|
} break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this->popupWidgetUser.userType == UserType::Owner) {
|
|
|
|
showModLayout = false;
|
|
|
|
showOwnerLayout = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this->popupWidgetUser.userType == UserType::Mod &&
|
|
|
|
this->loggedInUser.userType != UserType::Owner) {
|
|
|
|
showModLayout = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
this->updateButtons(this->ui->modLayout, showModLayout);
|
|
|
|
this->updateButtons(this->ui->userLayout, showUserLayout);
|
|
|
|
this->updateButtons(this->ui->ownerLayout, showOwnerLayout);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AccountPopupWidget::actuallyRefreshButtons()
|
|
|
|
{
|
|
|
|
if (this->relationship.following) {
|
|
|
|
if (this->ui->follow->text() != "Unfollow") {
|
|
|
|
this->ui->follow->setText("Unfollow");
|
|
|
|
this->ui->follow->setEnabled(true);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (this->ui->follow->text() != "Follow") {
|
|
|
|
this->ui->follow->setText("Follow");
|
|
|
|
this->ui->follow->setEnabled(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this->relationship.ignoring) {
|
|
|
|
if (this->ui->ignore->text() != "Unignore") {
|
|
|
|
this->ui->ignore->setText("Unignore");
|
|
|
|
this->ui->ignore->setEnabled(true);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (this->ui->ignore->text() != "Ignore") {
|
|
|
|
this->ui->ignore->setText("Ignore");
|
|
|
|
this->ui->ignore->setEnabled(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-22 15:13:42 +01:00
|
|
|
void AccountPopupWidget::focusOutEvent(QFocusEvent *)
|
2017-09-23 19:23:10 +02:00
|
|
|
{
|
|
|
|
this->hide();
|
2017-12-19 01:25:57 +01:00
|
|
|
this->ui->lblFollowers->setText("Loading...");
|
|
|
|
this->ui->lblViews->setText("Loading...");
|
|
|
|
this->ui->lblAccountAge->setText("Loading...");
|
|
|
|
this->ui->lblUsername->setText("Loading...");
|
|
|
|
this->ui->lblAvatar->setText("Loading...");
|
2017-07-31 22:14:54 +02:00
|
|
|
}
|
|
|
|
|
2017-12-22 15:13:42 +01:00
|
|
|
void AccountPopupWidget::showEvent(QShowEvent *)
|
2017-09-23 19:23:10 +02:00
|
|
|
{
|
2018-01-18 18:20:40 +01:00
|
|
|
this->loggedInUser.refreshUserType(this->channel, true);
|
|
|
|
this->popupWidgetUser.refreshUserType(this->channel, false);
|
2017-12-16 02:21:06 +01:00
|
|
|
|
2018-01-18 18:20:40 +01:00
|
|
|
this->ui->follow->setEnabled(false);
|
|
|
|
// XXX: Uncomment when ignore/unignore is fully implemented
|
|
|
|
// this->ui->ignore->setEnabled(false);
|
|
|
|
|
|
|
|
this->refreshButtons();
|
|
|
|
|
|
|
|
this->refreshLayouts();
|
2017-09-23 19:23:10 +02:00
|
|
|
|
2018-04-27 22:11:19 +02:00
|
|
|
QString blacklisted = getApp()->settings->highlightUserBlacklist;
|
2017-12-16 02:22:35 +01:00
|
|
|
QStringList list = blacklisted.split("\n", QString::SkipEmptyParts);
|
2017-12-19 01:25:57 +01:00
|
|
|
if (list.contains(this->ui->lblUsername->text(), Qt::CaseInsensitive)) {
|
|
|
|
this->ui->disableHighlights->hide();
|
|
|
|
this->ui->enableHighlights->show();
|
2017-12-16 02:22:35 +01:00
|
|
|
} else {
|
2017-12-19 01:25:57 +01:00
|
|
|
this->ui->disableHighlights->show();
|
|
|
|
this->ui->enableHighlights->hide();
|
2017-09-23 19:23:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
} // namespace widgets
|
|
|
|
} // namespace chatterino
|