diff --git a/forms/accountpopupform.ui b/forms/accountpopupform.ui
index 9080f61fb..969e73e8e 100644
--- a/forms/accountpopupform.ui
+++ b/forms/accountpopupform.ui
@@ -6,8 +6,8 @@
0
0
- 317
- 145
+ 461
+ 301
@@ -23,52 +23,6 @@
- -
-
-
-
-
-
- Views:
-
-
-
- -
-
-
- Loading...
-
-
-
- -
-
-
- Followers:
-
-
-
- -
-
-
- Loading...
-
-
-
- -
-
-
- Created at:
-
-
-
- -
-
-
- Loading...
-
-
-
-
-
-
@@ -128,6 +82,248 @@
+ -
+
+
-
+
+
+ Views:
+
+
+
+ -
+
+
+ Loading...
+
+
+
+ -
+
+
+ Followers:
+
+
+
+ -
+
+
+ Loading...
+
+
+
+ -
+
+
+ Created at:
+
+
+
+ -
+
+
+ Loading...
+
+
+
+
+
+ -
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+
+ 25
+ 16777215
+
+
+
+ Copy Username
+
+
+ qproperty-icon: url(:/images/CopyLongTextToClipboard_16x.png)
+
+
+
+
+
+
+ -
+
+
+ Profile
+
+
+
+
+
+
+ -
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+ Follow
+
+
+
+ -
+
+
+ Ignore
+
+
+
+ -
+
+
+ Disable Highlights
+
+
+
+ -
+
+
+ Enable Highlights
+
+
+
+ -
+
+
+ Message
+
+
+
+
+
+
+ -
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+ Ban
+
+
+
+ -
+
+
+ Purge
+
+
+
+ -
+
+
+ Unban
+
+
+
+ -
+
+
+ 10 Mins
+
+
+
+ -
+
+
+ 24 Hours
+
+
+
+ -
+
+
+ 1 Min
+
+
+
+ -
+
+
+ 1 Hour
+
+
+
+
+
+
+ -
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+ Mod
+
+
+
+ -
+
+
+ Unmod
+
+
+
+
+
+
diff --git a/src/channel.hpp b/src/channel.hpp
index e07ae18ec..d257c2779 100644
--- a/src/channel.hpp
+++ b/src/channel.hpp
@@ -35,6 +35,7 @@ public:
// methods
void addMessage(messages::SharedMessage message);
QString name;
+ QStringList modList;
virtual bool canSendMessage() const;
virtual void sendMessage(const QString &message);
diff --git a/src/ircmanager.cpp b/src/ircmanager.cpp
index f2c087c49..71e8038cd 100644
--- a/src/ircmanager.cpp
+++ b/src/ircmanager.cpp
@@ -270,6 +270,8 @@ void IrcManager::messageReceived(Communi::IrcMessage *message)
this->handleWhisperMessage(message);
} else if (command == "USERNOTICE") {
this->handleUserNoticeMessage(message);
+ } else if (command == "MODE") {
+ this->handleModeMessage(message);
}
}
@@ -309,6 +311,18 @@ void IrcManager::handleUserNoticeMessage(Communi::IrcMessage *message)
// do nothing
}
+void IrcManager::handleModeMessage(Communi::IrcMessage *message)
+{
+ auto channel = channelManager.getTwitchChannel(message->parameter(0).remove(0,1));
+ if(message->parameter(1) == "+o")
+ {
+ channel->modList.append(message->parameter(2));
+ } else if(message->parameter(1) == "-o")
+ {
+ channel->modList.append(message->parameter(2));
+ }
+}
+
bool IrcManager::isTwitchBlockedUser(QString const &username)
{
QMutexLocker locker(&this->twitchBlockedUsersMutex);
diff --git a/src/ircmanager.hpp b/src/ircmanager.hpp
index feb10a094..94ad534ca 100644
--- a/src/ircmanager.hpp
+++ b/src/ircmanager.hpp
@@ -90,6 +90,7 @@ private:
void handleUserStateMessage(Communi::IrcMessage *message);
void handleWhisperMessage(Communi::IrcMessage *message);
void handleUserNoticeMessage(Communi::IrcMessage *message);
+ void handleModeMessage(Communi::IrcMessage *message);
};
} // namespace chatterino
diff --git a/src/settingsmanager.cpp b/src/settingsmanager.cpp
index 83ac68e26..7b7471b79 100644
--- a/src/settingsmanager.cpp
+++ b/src/settingsmanager.cpp
@@ -35,6 +35,7 @@ SettingsManager::SettingsManager()
, pathHighlightSound(this->settingsItems, "pathHighlightSound", "qrc:/sounds/ping2.wav")
, highlightProperties(this->settingsItems, "highlightProperties",
QMap>())
+ , highlightUserBlacklist(this->settingsItems, "highlightUserBlacklist", "")
, enableTwitchEmotes(this->settingsItems, "enableTwitchEmotes", true)
, enableBttvEmotes(this->settingsItems, "enableBttvEmotes", true)
, enableFfzEmotes(this->settingsItems, "enableFfzEmotes", true)
diff --git a/src/settingsmanager.hpp b/src/settingsmanager.hpp
index 45a060353..58644bf5d 100644
--- a/src/settingsmanager.hpp
+++ b/src/settingsmanager.hpp
@@ -49,6 +49,7 @@ public:
Setting customHighlightSound;
Setting pathHighlightSound;
Setting>> highlightProperties;
+ Setting highlightUserBlacklist;
Setting enableTwitchEmotes;
Setting enableBttvEmotes;
Setting enableFfzEmotes;
diff --git a/src/twitch/twitchmessagebuilder.cpp b/src/twitch/twitchmessagebuilder.cpp
index f182e7a0f..ec89a0377 100644
--- a/src/twitch/twitchmessagebuilder.cpp
+++ b/src/twitch/twitchmessagebuilder.cpp
@@ -245,13 +245,6 @@ SharedMessage TwitchMessageBuilder::parse()
i++;
}
- // TODO: Implement this xD
- // if (!isReceivedWhisper &&
- // AppSettings.HighlightIgnoredUsers.ContainsKey(Username))
- // {
- // HighlightTab = false;
- // }
-
return this->getMessage();
}
@@ -397,6 +390,8 @@ void TwitchMessageBuilder::parseHighlights()
bool alert;
};
+ QStringList blackList = settings.highlightUserBlacklist.get().split("\n",QString::SkipEmptyParts);
+
// TODO: This vector should only be rebuilt upon highlights being changed
std::vector activeHighlights;
@@ -404,6 +399,7 @@ void TwitchMessageBuilder::parseHighlights()
activeHighlights.emplace_back(currentUsername, settings.enableHighlightSound.get(),
settings.enableHighlightTaskbar.get());
}
+
const auto &highlightProperties = settings.highlightProperties.get();
for (auto it = highlightProperties.begin(); it != highlightProperties.end(); ++it) {
@@ -414,37 +410,39 @@ void TwitchMessageBuilder::parseHighlights()
bool doHighlight = false;
bool playSound = false;
bool doAlert = false;
+ if(!blackList.contains(this->ircMessage->nick(),Qt::CaseInsensitive))
+ {
+ for (const Highlight &highlight : activeHighlights) {
+ if (this->originalMessage.contains(highlight.target, Qt::CaseInsensitive)) {
+ qDebug() << "Highlight because " << this->originalMessage << " contains "
+ << highlight.target;
+ doHighlight = true;
- for (const Highlight &highlight : activeHighlights) {
- if (this->originalMessage.contains(highlight.target, Qt::CaseInsensitive)) {
- qDebug() << "Highlight because " << this->originalMessage << " contains "
- << highlight.target;
- doHighlight = true;
+ if (highlight.sound) {
+ playSound = true;
+ }
- if (highlight.sound) {
- playSound = true;
- }
+ if (highlight.alert) {
+ doAlert = true;
+ }
- if (highlight.alert) {
- doAlert = true;
- }
-
- if (playSound && doAlert) {
- // Break if no further action can be taken from other highlights
- // This might change if highlights can have custom colors/sounds/actions
- break;
+ if (playSound && doAlert) {
+ // Break if no further action can be taken from other highlights
+ // This might change if highlights can have custom colors/sounds/actions
+ break;
+ }
}
}
- }
- this->setHighlight(doHighlight);
+ this->setHighlight(doHighlight);
- if (playSound) {
- player->play();
- }
+ if (playSound) {
+ player->play();
+ }
- if (doAlert) {
- QApplication::alert(windowManager.getMainWindow().window(), 2500);
+ if (doAlert) {
+ QApplication::alert(windowManager.getMainWindow().window(), 2500);
+ }
}
}
diff --git a/src/twitch/twitchuser.cpp b/src/twitch/twitchuser.cpp
index e61fd0777..0a20f9d7a 100644
--- a/src/twitch/twitchuser.cpp
+++ b/src/twitch/twitchuser.cpp
@@ -1,4 +1,5 @@
#include "twitchuser.hpp"
+#include "util/urlfetch.hpp"
namespace chatterino {
namespace twitch {
@@ -22,6 +23,16 @@ const QString &TwitchUser::getOAuthToken() const
return this->_oauthToken;
}
+const QString &TwitchUser::getUserId() const
+{
+ return this->_userId;
+}
+
+void TwitchUser::setUserId(const QString &id)
+{
+ this->_userId = id;
+}
+
bool TwitchUser::isAnon() const
{
return this->_isAnon;
diff --git a/src/twitch/twitchuser.hpp b/src/twitch/twitchuser.hpp
index 3123d25f6..220d01b58 100644
--- a/src/twitch/twitchuser.hpp
+++ b/src/twitch/twitchuser.hpp
@@ -14,12 +14,15 @@ public:
const QString &getOAuthToken() const;
const QString &getOAuthClient() const;
+ const QString &getUserId() const;
+ void setUserId(const QString &id);
bool isAnon() const;
private:
QString _oauthClient;
QString _oauthToken;
+ QString _userId;
bool _isAnon;
};
diff --git a/src/util/urlfetch.hpp b/src/util/urlfetch.hpp
index e86ed4074..a655996b3 100644
--- a/src/util/urlfetch.hpp
+++ b/src/util/urlfetch.hpp
@@ -1,6 +1,7 @@
#pragma once
#include "credentials.hpp"
+#include "accountmanager.hpp"
#include
#include
@@ -76,6 +77,32 @@ static void getUserID(QString username, std::function successCall
successCallback(id.toString());
});
}
+static void put(QUrl url, std::function successCallback)
+{
+ auto manager = new QNetworkAccessManager();
+ QNetworkRequest request(url);
+
+ request.setRawHeader("Client-ID", getDefaultClientID());
+ request.setRawHeader("Accept", "application/vnd.twitchtv.v5+json");
+ request.setRawHeader("Authorization", "OAuth " +
+ AccountManager::getInstance().getTwitchUser().getOAuthToken().toUtf8());
+ QNetworkReply *reply = manager->put(request,"");
+ QObject::connect(reply, &QNetworkReply::finished, [=](){
+ if(reply->error() == QNetworkReply::NetworkError::NoError)
+ {
+ QByteArray data = reply->readAll();
+ QJsonDocument jsonDoc(QJsonDocument::fromJson(data));
+ if(!jsonDoc.isNull())
+ {
+ QJsonObject rootNode = jsonDoc.object();
+
+ successCallback(rootNode);
+ }
+ }
+ reply->deleteLater();
+ manager->deleteLater();
+ });
+}
} // namespace twitch
diff --git a/src/widgets/accountpopup.cpp b/src/widgets/accountpopup.cpp
index 01dfcb8af..164a4530c 100644
--- a/src/widgets/accountpopup.cpp
+++ b/src/widgets/accountpopup.cpp
@@ -1,9 +1,14 @@
#include "widgets/accountpopup.hpp"
+#include "util/urlfetch.hpp"
+#include "accountmanager.hpp"
#include "channel.hpp"
#include "credentials.hpp"
+#include "settingsmanager.hpp"
#include "ui_accountpopupform.h"
+#include
#include
+#include
#include
#include
#include
@@ -25,10 +30,98 @@ AccountPopupWidget::AccountPopupWidget(std::shared_ptr channel)
setWindowFlags(Qt::FramelessWindowHint);
+ SettingsManager &settings = SettingsManager::getInstance();
+
+ permission = permissions::User;
+ for(auto button : this->_ui->profileLayout->findChildren())
+ {
+ button->setFocusProxy(this);
+ }
+ for(auto button: this->_ui->userLayout->findChildren())
+ {
+ button->setFocusProxy(this);
+ }
+ for(auto button: this->_ui->modLayout->findChildren())
+ {
+ button->setFocusProxy(this);
+ }
+ for(auto button: this->_ui->ownerLayout->findChildren())
+ {
+ button->setFocusProxy(this);
+ }
+
+ timeout(this->_ui->purge, 1);
+ timeout(this->_ui->min1, 60);
+ timeout(this->_ui->min10, 600);
+ timeout(this->_ui->hour1, 3600);
+ timeout(this->_ui->hour24, 86400);
+
+ sendCommand(this->_ui->ban, "/ban ");
+ sendCommand(this->_ui->unBan, "/unban ");
+ sendCommand(this->_ui->mod, "/mod ");
+ sendCommand(this->_ui->unMod, "/unmod ");
+
+ QObject::connect(this->_ui->profile, &QPushButton::clicked, this, [=](){
+ QDesktopServices::openUrl(QUrl("https://twitch.tv/" +
+ this->_ui->lblUsername->text()));
+ });
+
+ QObject::connect(this->_ui->sendMessage, &QPushButton::clicked, this, [=](){
+ QDesktopServices::openUrl(QUrl("https://www.twitch.tv/message/compose?to=" +
+ this->_ui->lblUsername->text()));
+ });
+
+ QObject::connect(this->_ui->copy, &QPushButton::clicked, this, [=](){
+ QApplication::clipboard()->setText(this->_ui->lblUsername->text());
+ });
+
+ QObject::connect(this->_ui->follow, &QPushButton::clicked, this, [=](){
+ QUrl requestUrl("https://api.twitch.tv/kraken/users/" +
+ AccountManager::getInstance().getTwitchUser().getUserId() +
+ "/follows/channels/" + this->userID);
+
+ util::twitch::put(requestUrl,[](QJsonObject obj){});
+ });
+
+ QObject::connect(this->_ui->ignore, &QPushButton::clicked, this, [=](){
+ QUrl requestUrl("https://api.twitch.tv/kraken/users/" +
+ AccountManager::getInstance().getTwitchUser().getUserId() +
+ "/blocks/" + this->userID);
+
+ util::twitch::put(requestUrl,[](QJsonObject obj){});
+ });
+
+ QObject::connect(this->_ui->disableHighlights, &QPushButton::clicked, this, [=, &settings](){
+ QString str = settings.highlightUserBlacklist.getnonConst();
+ str.append(this->_ui->lblUsername->text() + "\n");
+ settings.highlightUserBlacklist.set(str);
+ this->_ui->disableHighlights->hide();
+ this->_ui->enableHighlights->show();
+ });
+
+ QObject::connect(this->_ui->enableHighlights, &QPushButton::clicked, this, [=, &settings](){
+ QString str = settings.highlightUserBlacklist.getnonConst();
+ QStringList list = str.split("\n");
+ list.removeAll(this->_ui->lblUsername->text());
+ settings.highlightUserBlacklist.set(list.join("\n"));
+ this->_ui->enableHighlights->hide();
+ this->_ui->disableHighlights->show();
+ });
+
+
+ updateButtons(this->_ui->userLayout,false);
+ updateButtons(this->_ui->modLayout,false);
+ updateButtons(this->_ui->ownerLayout,false);
+
// Close button
connect(_ui->btnClose, &QPushButton::clicked, [=]() {
hide(); //
});
+
+ util::twitch::getUserID(AccountManager::getInstance().getTwitchUser().getNickName(),
+ [=](const QString &id){
+ AccountManager::getInstance().getTwitchUser().setUserId(id);
+ });
}
void AccountPopupWidget::setName(const QString &name)
@@ -44,55 +137,20 @@ void AccountPopupWidget::setChannel(std::shared_ptr channel)
void AccountPopupWidget::getUserId()
{
- qDebug() << this->_channel.get()->name;
- QUrl nameUrl("https://api.twitch.tv/kraken/users?login=" + _ui->lblUsername->text());
-
- QNetworkRequest req(nameUrl);
- req.setRawHeader(QByteArray("Accept"), QByteArray("application/vnd.twitchtv.v5+json"));
- req.setRawHeader(QByteArray("Client-ID"), getDefaultClientID());
-
- static auto manager = new QNetworkAccessManager();
- auto *reply = manager->get(req);
-
- QObject::connect(reply, &QNetworkReply::finished, this, [=] {
- if (reply->error() == QNetworkReply::NoError) {
- auto doc = QJsonDocument::fromJson(reply->readAll());
- auto obj = doc.object();
- auto array = obj.value("users").toArray();
-
- userID = array.at(0).toObject().value("_id").toString();
-
- getUserData();
- }
+ util::twitch::getUserID(this->_ui->lblUsername->text(),[=](const QString &id){
+ userID = id;
+ getUserData();
});
}
void AccountPopupWidget::getUserData()
{
- QUrl idUrl("https://api.twitch.tv/kraken/channels/" + userID);
+ util::twitch::get("https://api.twitch.tv/kraken/channels/" + userID,[=](const QJsonObject &obj){
+ _ui->lblFollowers->setText(QString::number(obj.value("followers").toInt()));
+ _ui->lblViews->setText(QString::number(obj.value("views").toInt()));
+ _ui->lblAccountAge->setText(obj.value("created_at").toString().section("T", 0, 0));
- QNetworkRequest req(idUrl);
- req.setRawHeader(QByteArray("Accept"), QByteArray("application/vnd.twitchtv.v5+json"));
- req.setRawHeader(QByteArray("Client-ID"), getDefaultClientID());
-
- static auto manager = new QNetworkAccessManager();
- auto *reply = manager->get(req);
-
- QObject::connect(reply, &QNetworkReply::finished, this, [=] {
- if (reply->error() == QNetworkReply::NoError) {
- auto doc = QJsonDocument::fromJson(reply->readAll());
- auto obj = doc.object();
-
- _ui->lblFollowers->setText(QString::number(obj.value("followers").toInt()));
- _ui->lblViews->setText(QString::number(obj.value("views").toInt()));
- _ui->lblAccountAge->setText(obj.value("created_at").toString().section("T", 0, 0));
-
- loadAvatar(QUrl(obj.value("logo").toString()));
- } else {
- _ui->lblFollowers->setText("ERROR");
- _ui->lblViews->setText("ERROR");
- _ui->lblAccountAge->setText("ERROR");
- }
+ loadAvatar(QUrl(obj.value("logo").toString()));
});
}
@@ -122,10 +180,43 @@ void AccountPopupWidget::loadAvatar(const QUrl &avatarUrl)
}
}
+void AccountPopupWidget::updatePermissions()
+{
+ if(this->_channel.get()->name == AccountManager::getInstance().getTwitchUser().getNickName())
+ {
+ permission = permissions::Owner;
+ }
+ else if(this->_channel->modList.contains(AccountManager::getInstance().getTwitchUser().getNickName()))
+ {
+ permission = permissions::Mod;
+ }
+}
+
+void AccountPopupWidget::updateButtons(QWidget* layout, bool state)
+{
+ for(auto button : layout->findChildren())
+ {
+ button->setVisible(state);
+ }
+}
+
+void AccountPopupWidget::timeout(QPushButton *button, int time)
+{
+ QObject::connect(button, &QPushButton::clicked, this, [=](){
+ this->_channel->sendMessage("/timeout " + this->_ui->lblUsername->text() + " " + QString::number(time));
+ });
+}
+
+void AccountPopupWidget::sendCommand(QPushButton *button, QString command)
+{
+ QObject::connect(button, &QPushButton::clicked, this, [=](){
+ this->_channel->sendMessage(command + this->_ui->lblUsername->text());
+ });
+}
+
void AccountPopupWidget::focusOutEvent(QFocusEvent *event)
{
- hide();
-
+ this->hide();
_ui->lblFollowers->setText("Loading...");
_ui->lblViews->setText("Loading...");
_ui->lblAccountAge->setText("Loading...");
@@ -133,5 +224,45 @@ void AccountPopupWidget::focusOutEvent(QFocusEvent *event)
_ui->lblAvatar->setText("Loading...");
}
+void AccountPopupWidget::showEvent(QShowEvent *event)
+{
+ if(this->_ui->lblUsername->text() != AccountManager::getInstance().getTwitchUser().getNickName())
+ {
+ updateButtons(this->_ui->userLayout, true);
+ if(permission != permissions::User)
+ {
+ if(!this->_channel->modList.contains(this->_ui->lblUsername->text()))
+ {
+ updateButtons(this->_ui->modLayout, true);
+ }
+ if(permission == permissions::Owner)
+ {
+ updateButtons(this->_ui->ownerLayout, true);
+ updateButtons(this->_ui->modLayout, true);
+ }
+ }
+ }
+ else
+ {
+ updateButtons(this->_ui->modLayout, false);
+ updateButtons(this->_ui->userLayout, false);
+ updateButtons(this->_ui->ownerLayout, false);
+ }
+
+ QString blacklisted = SettingsManager::getInstance().highlightUserBlacklist.getnonConst();
+ QStringList list = blacklisted.split("\n",QString::SkipEmptyParts);
+ if(list.contains(this->_ui->lblUsername->text(),Qt::CaseInsensitive))
+ {
+ this->_ui->disableHighlights->hide();
+ this->_ui->enableHighlights->show();
+ }
+ else
+ {
+ this->_ui->disableHighlights->show();
+ this->_ui->enableHighlights->hide();
+ }
+
+}
+
} // namespace widgets
} // namespace chatterino
diff --git a/src/widgets/accountpopup.hpp b/src/widgets/accountpopup.hpp
index ccbf57317..8b89ab184 100644
--- a/src/widgets/accountpopup.hpp
+++ b/src/widgets/accountpopup.hpp
@@ -1,6 +1,8 @@
#pragma once
#include "concurrentmap.hpp"
+#include "twitch/twitchchannel.hpp"
+#include
#include
#include
@@ -24,6 +26,8 @@ public:
void setName(const QString &name);
void setChannel(std::shared_ptr channel);
+ void updatePermissions();
+
private:
Ui::AccountPopup *_ui;
@@ -31,6 +35,13 @@ private:
void getUserData();
void loadAvatar(const QUrl &avatarUrl);
+ void updateButtons(QWidget* layout, bool state);
+ void timeout(QPushButton* button, int time);
+ void sendCommand(QPushButton* button, QString command);
+
+ enum class permissions { User, Mod, Owner };
+ permissions permission;
+
std::shared_ptr _channel;
QString userID;
@@ -40,6 +51,7 @@ private:
protected:
virtual void focusOutEvent(QFocusEvent *event) override;
+ virtual void showEvent(QShowEvent *event) override;
};
} // namespace widgets
diff --git a/src/widgets/channelview.cpp b/src/widgets/channelview.cpp
index 1594f76c9..c1bb189bb 100644
--- a/src/widgets/channelview.cpp
+++ b/src/widgets/channelview.cpp
@@ -30,7 +30,7 @@ ChannelView::ChannelView(WindowManager &windowManager, BaseWidget *parent)
: BaseWidget(parent)
, windowManager(windowManager)
, scrollBar(this)
- , userPopupWidget(std::shared_ptr())
+ , userPopupWidget(std::shared_ptr())
{
#ifndef Q_OS_MAC
// this->setAttribute(Qt::WA_OpaquePaintEvent);
@@ -787,6 +787,7 @@ void ChannelView::mouseReleaseEvent(QMouseEvent *event)
auto user = link.getValue();
this->userPopupWidget.setName(user);
this->userPopupWidget.move(event->screenPos().toPoint());
+ this->userPopupWidget.updatePermissions();
this->userPopupWidget.show();
this->userPopupWidget.setFocus();
diff --git a/src/widgets/chatwidget.cpp b/src/widgets/chatwidget.cpp
index d9ed67163..1b47a839e 100644
--- a/src/widgets/chatwidget.cpp
+++ b/src/widgets/chatwidget.cpp
@@ -238,7 +238,7 @@ void ChatWidget::doChangeChannel()
{
this->showChangeChannelPopup("Change channel");
auto popup = this->findChildren();
- if (popup.at(0)->isVisible() && !popup.at(0)->isFloating()) {
+ if (popup.size() && popup.at(0)->isVisible() && !popup.at(0)->isFloating()) {
popup.at(0)->hide();
doOpenViewerList();
}
@@ -426,6 +426,7 @@ void ChatWidget::doOpenAccountPopupWidget(AccountPopupWidget *widget, QString us
{
widget->setName(user);
widget->move(QCursor::pos());
+ widget->updatePermissions();
widget->show();
widget->setFocus();
}
diff --git a/src/widgets/settingsdialog.cpp b/src/widgets/settingsdialog.cpp
index d9939622e..52c07572f 100644
--- a/src/widgets/settingsdialog.cpp
+++ b/src/widgets/settingsdialog.cpp
@@ -379,9 +379,12 @@ void SettingsDialog::addTabs()
// Highlighting
vbox = new QVBoxLayout();
auto highlights = new QListWidget();
+ auto highlightUserBlacklist = new QTextEdit();
globalHighlights = highlights;
QStringList items = settings.highlightProperties.get().keys();
highlights->addItems(items);
+ highlightUserBlacklist->setText(settings.highlightUserBlacklist.getnonConst());
+ auto highlightTab = new QTabWidget();
auto customSound = new QHBoxLayout();
auto soundForm = new QFormLayout();
{
@@ -404,6 +407,7 @@ void SettingsDialog::addTabs()
soundForm->addRow(customSound);
+
{
auto hbox = new QHBoxLayout();
auto addBtn = new QPushButton("Add");
@@ -480,14 +484,38 @@ void SettingsDialog::addTabs()
}
});
vbox->addLayout(soundForm);
- vbox->addWidget(highlights);
+ auto layoutVbox = new QVBoxLayout();
+ auto btnHbox = new QHBoxLayout();
- hbox->addWidget(addBtn);
- hbox->addWidget(editBtn);
- hbox->addWidget(delBtn);
+ auto highlightWidget = new QWidget();
+ auto btnWidget = new QWidget();
+
+ btnHbox->addWidget(addBtn);
+ btnHbox->addWidget(editBtn);
+ btnHbox->addWidget(delBtn);
+ btnWidget->setLayout(btnHbox);
+
+ layoutVbox->addWidget(highlights);
+ layoutVbox->addWidget(btnWidget);
+ highlightWidget->setLayout(layoutVbox);
+
+ highlightTab->addTab(highlightWidget,"Highlights");
+ highlightTab->addTab(highlightUserBlacklist,"Disabled Users");
+ vbox->addWidget(highlightTab);
vbox->addLayout(hbox);
}
+
+ QObject::connect(&this->ui.okButton, &QPushButton::clicked, this, [=, &settings](){
+ QStringList list = highlightUserBlacklist->toPlainText().split("\n",QString::SkipEmptyParts);
+ list.removeDuplicates();
+ settings.highlightUserBlacklist.set(list.join("\n") + "\n");
+ });
+
+ settings.highlightUserBlacklist.valueChanged.connect([=](const QString &str){
+ highlightUserBlacklist->setPlainText(str);
+ });
+
vbox->addStretch(1);
addTab(vbox, "Highlighting", ":/images/format_Bold_16xLG.png");
diff --git a/src/widgets/settingsdialog.hpp b/src/widgets/settingsdialog.hpp
index a3ee48dce..643864fcd 100644
--- a/src/widgets/settingsdialog.hpp
+++ b/src/widgets/settingsdialog.hpp
@@ -30,7 +30,6 @@ public:
void select(SettingsDialogTab *tab);
static void showDialog();
-
private:
SettingsSnapshot snapshot;