moved some Settings from Application to Settings
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "providers/twitch/PartialTwitchUser.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
#include "singletons/Resources.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "util/LayoutCreator.hpp"
|
||||
#include "util/PostToThread.hpp"
|
||||
#include "widgets/Label.hpp"
|
||||
@@ -336,23 +337,23 @@ void UserInfoPopup::installEvents()
|
||||
|
||||
if (checked)
|
||||
{
|
||||
getApp()->blacklistedUsers.insert(
|
||||
getSettings()->blacklistedUsers.insert(
|
||||
HighlightBlacklistUser{this->userName_, false});
|
||||
this->ui_.ignoreHighlights->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto &vector = getApp()->blacklistedUsers.raw();
|
||||
const auto &vector = getSettings()->blacklistedUsers.raw();
|
||||
|
||||
for (int i = 0; i < vector.size(); i++)
|
||||
{
|
||||
if (this->userName_ == vector[i].getPattern())
|
||||
{
|
||||
getApp()->blacklistedUsers.removeAt(i);
|
||||
getSettings()->blacklistedUsers.removeAt(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
if (getApp()->isBlacklistedUser(this->userName_))
|
||||
if (getSettings()->isBlacklistedUser(this->userName_))
|
||||
{
|
||||
this->ui_.ignoreHighlights->setToolTip(
|
||||
"Name matched by regex");
|
||||
@@ -455,7 +456,7 @@ void UserInfoPopup::updateUserData()
|
||||
|
||||
// get ignoreHighlights state
|
||||
bool isIgnoringHighlights = false;
|
||||
const auto &vector = getApp()->blacklistedUsers.raw();
|
||||
const auto &vector = getSettings()->blacklistedUsers.raw();
|
||||
for (int i = 0; i < vector.size(); i++)
|
||||
{
|
||||
if (this->userName_ == vector[i].getPattern())
|
||||
@@ -464,7 +465,7 @@ void UserInfoPopup::updateUserData()
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (getApp()->isBlacklistedUser(this->userName_) &&
|
||||
if (getSettings()->isBlacklistedUser(this->userName_) &&
|
||||
!isIgnoringHighlights)
|
||||
{
|
||||
this->ui_.ignoreHighlights->setToolTip("Name matched by regex");
|
||||
|
||||
@@ -52,7 +52,8 @@ HighlightingPage::HighlightingPage()
|
||||
highlights
|
||||
.emplace<EditableModelView>(
|
||||
(new HighlightModel(nullptr))
|
||||
->initialized(&app->highlightedMessages))
|
||||
->initialized(
|
||||
&getSettings()->highlightedMessages))
|
||||
.getElement();
|
||||
view->addRegexHelpLink();
|
||||
view->setTitles({"Pattern", "Flash\ntaskbar", "Play\nsound",
|
||||
@@ -71,7 +72,7 @@ HighlightingPage::HighlightingPage()
|
||||
});
|
||||
|
||||
view->addButtonPressed.connect([] {
|
||||
getApp()->highlightedMessages.append(HighlightPhrase{
|
||||
getSettings()->highlightedMessages.append(HighlightPhrase{
|
||||
"my phrase", true, false, false, false, "",
|
||||
*ColorProvider::instance().color(
|
||||
ColorType::SelfHighlight)});
|
||||
@@ -94,7 +95,7 @@ HighlightingPage::HighlightingPage()
|
||||
pingUsers
|
||||
.emplace<EditableModelView>(
|
||||
(new UserHighlightModel(nullptr))
|
||||
->initialized(&app->highlightedUsers))
|
||||
->initialized(&getSettings()->highlightedUsers))
|
||||
.getElement();
|
||||
|
||||
view->addRegexHelpLink();
|
||||
@@ -118,7 +119,7 @@ HighlightingPage::HighlightingPage()
|
||||
});
|
||||
|
||||
view->addButtonPressed.connect([] {
|
||||
getApp()->highlightedUsers.append(HighlightPhrase{
|
||||
getSettings()->highlightedUsers.append(HighlightPhrase{
|
||||
"highlighted user", true, false, false, false, "",
|
||||
*ColorProvider::instance().color(
|
||||
ColorType::SelfHighlight)});
|
||||
@@ -140,7 +141,7 @@ HighlightingPage::HighlightingPage()
|
||||
disabledUsers
|
||||
.emplace<EditableModelView>(
|
||||
(new HighlightBlacklistModel(nullptr))
|
||||
->initialized(&app->blacklistedUsers))
|
||||
->initialized(&getSettings()->blacklistedUsers))
|
||||
.getElement();
|
||||
|
||||
view->addRegexHelpLink();
|
||||
@@ -158,7 +159,7 @@ HighlightingPage::HighlightingPage()
|
||||
});
|
||||
|
||||
view->addButtonPressed.connect([] {
|
||||
getApp()->blacklistedUsers.append(
|
||||
getSettings()->blacklistedUsers.append(
|
||||
HighlightBlacklistUser{"blacklisted user", false});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ void addPhrasesTab(LayoutCreator<QVBoxLayout> layout)
|
||||
layout
|
||||
.emplace<EditableModelView>(
|
||||
(new IgnoreModel(nullptr))
|
||||
->initialized(&getApp()->ignores->phrases))
|
||||
->initialized(&getSettings()->ignoredMessages))
|
||||
.getElement();
|
||||
view->setTitles(
|
||||
{"Pattern", "Regex", "Case Sensitive", "Block", "Replacement"});
|
||||
@@ -62,7 +62,7 @@ void addPhrasesTab(LayoutCreator<QVBoxLayout> layout)
|
||||
});
|
||||
|
||||
view->addButtonPressed.connect([] {
|
||||
getApp()->ignores->phrases.append(
|
||||
getSettings()->ignoredMessages.append(
|
||||
IgnorePhrase{"my pattern", false, false,
|
||||
getSettings()->ignoredPhraseReplace.getValue(), true});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user