mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
implement show ignored users setting
This commit is contained in:
parent
3f41dfeff9
commit
320d74b287
4 changed files with 33 additions and 2 deletions
|
@ -12,6 +12,8 @@ class Paths;
|
||||||
|
|
||||||
class IgnoreModel;
|
class IgnoreModel;
|
||||||
|
|
||||||
|
enum ShowIgnoredUsersMessages { Never, IfModerator, IfBroadcaster };
|
||||||
|
|
||||||
class IgnoreController final : public Singleton
|
class IgnoreController final : public Singleton
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -80,6 +80,18 @@ bool TwitchMessageBuilder::isIgnored() const
|
||||||
{
|
{
|
||||||
if (sourceUserID == user.id)
|
if (sourceUserID == user.id)
|
||||||
{
|
{
|
||||||
|
switch (getSettings()->showIgnoredUsersMessages)
|
||||||
|
{
|
||||||
|
case ShowIgnoredUsersMessages::IfModerator:
|
||||||
|
if (this->channel->isMod() ||
|
||||||
|
this->channel->isBroadcaster())
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case ShowIgnoredUsersMessages::IfBroadcaster:
|
||||||
|
if (this->channel->isBroadcaster())
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
log("Blocking message because it's from blocked user {}",
|
log("Blocking message because it's from blocked user {}",
|
||||||
user.name);
|
user.name);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -128,6 +128,7 @@ public:
|
||||||
/// Ingored Users
|
/// Ingored Users
|
||||||
BoolSetting enableTwitchIgnoredUsers = {"/ignore/enableTwitchIgnoredUsers",
|
BoolSetting enableTwitchIgnoredUsers = {"/ignore/enableTwitchIgnoredUsers",
|
||||||
true};
|
true};
|
||||||
|
IntSetting showIgnoredUsersMessages = {"/ignore/showIgnoredUsers", 0};
|
||||||
|
|
||||||
/// Moderation
|
/// Moderation
|
||||||
QStringSetting timeoutAction = {"/moderation/timeoutAction", "Disable"};
|
QStringSetting timeoutAction = {"/moderation/timeoutAction", "Disable"};
|
||||||
|
|
|
@ -77,8 +77,24 @@ void addUsersTab(IgnoresPage &page, LayoutCreator<QVBoxLayout> users,
|
||||||
|
|
||||||
auto anyways = users.emplace<QHBoxLayout>().withoutMargin();
|
auto anyways = users.emplace<QHBoxLayout>().withoutMargin();
|
||||||
{
|
{
|
||||||
anyways.emplace<QLabel>("Show anyways if:");
|
anyways.emplace<QLabel>("Show messages from ignored users anyways:");
|
||||||
anyways.emplace<QComboBox>();
|
|
||||||
|
auto combo = anyways.emplace<QComboBox>().getElement();
|
||||||
|
combo->addItems(
|
||||||
|
{"Never", "If you are Moderator", "If you are Broadcaster"});
|
||||||
|
|
||||||
|
auto &setting = getSettings()->showIgnoredUsersMessages;
|
||||||
|
|
||||||
|
setting.connect(
|
||||||
|
[combo](const int value) { combo->setCurrentIndex(value); });
|
||||||
|
|
||||||
|
QObject::connect(combo,
|
||||||
|
QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||||
|
[&setting](int index) {
|
||||||
|
if (index != -1)
|
||||||
|
setting = index;
|
||||||
|
});
|
||||||
|
|
||||||
anyways->addStretch(1);
|
anyways->addStretch(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue