mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Merge pull request #1007 from pphop/pphop-show-ignored
Show ignored users messages anyway setting
This commit is contained in:
commit
695d200d79
|
@ -12,6 +12,8 @@ class Paths;
|
||||||
|
|
||||||
class IgnoreModel;
|
class IgnoreModel;
|
||||||
|
|
||||||
|
enum class ShowIgnoredUsersMessages { Never, IfModerator, IfBroadcaster };
|
||||||
|
|
||||||
class IgnoreController final : public Singleton
|
class IgnoreController final : public Singleton
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -80,6 +80,19 @@ bool TwitchMessageBuilder::isIgnored() const
|
||||||
{
|
{
|
||||||
if (sourceUserID == user.id)
|
if (sourceUserID == user.id)
|
||||||
{
|
{
|
||||||
|
switch (static_cast<ShowIgnoredUsersMessages>(
|
||||||
|
getSettings()->showIgnoredUsersMessages.getValue()))
|
||||||
|
{
|
||||||
|
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