absorbed HighlightController into Application

This commit is contained in:
fourtf
2020-02-23 21:18:40 +01:00
parent d0a81f3fe7
commit f8a9850151
11 changed files with 70 additions and 103 deletions
+7 -8
View File
@@ -4,7 +4,7 @@
#include "common/Channel.hpp"
#include "common/NetworkRequest.hpp"
#include "controllers/accounts/AccountController.hpp"
#include "controllers/highlights/HighlightController.hpp"
#include "controllers/highlights/HighlightBlacklistUser.hpp"
#include "providers/twitch/PartialTwitchUser.hpp"
#include "providers/twitch/TwitchChannel.hpp"
#include "singletons/Resources.hpp"
@@ -336,24 +336,23 @@ void UserInfoPopup::installEvents()
if (checked)
{
getApp()->highlights->blacklistedUsers.insert(
getApp()->blacklistedUsers.insert(
HighlightBlacklistUser{this->userName_, false});
this->ui_.ignoreHighlights->setEnabled(true);
}
else
{
const auto &vector =
getApp()->highlights->blacklistedUsers.raw();
const auto &vector = getApp()->blacklistedUsers.raw();
for (int i = 0; i < vector.size(); i++)
{
if (this->userName_ == vector[i].getPattern())
{
getApp()->highlights->blacklistedUsers.removeAt(i);
getApp()->blacklistedUsers.removeAt(i);
i--;
}
}
if (getApp()->highlights->blacklistContains(this->userName_))
if (getApp()->isBlacklistedUser(this->userName_))
{
this->ui_.ignoreHighlights->setToolTip(
"Name matched by regex");
@@ -456,7 +455,7 @@ void UserInfoPopup::updateUserData()
// get ignoreHighlights state
bool isIgnoringHighlights = false;
const auto &vector = getApp()->highlights->blacklistedUsers.raw();
const auto &vector = getApp()->blacklistedUsers.raw();
for (int i = 0; i < vector.size(); i++)
{
if (this->userName_ == vector[i].getPattern())
@@ -465,7 +464,7 @@ void UserInfoPopup::updateUserData()
break;
}
}
if (getApp()->highlights->blacklistContains(this->userName_) &&
if (getApp()->isBlacklistedUser(this->userName_) &&
!isIgnoringHighlights)
{
this->ui_.ignoreHighlights->setToolTip("Name matched by regex");
+9 -13
View File
@@ -2,7 +2,6 @@
#include "Application.hpp"
#include "controllers/highlights/HighlightBlacklistModel.hpp"
#include "controllers/highlights/HighlightController.hpp"
#include "controllers/highlights/HighlightModel.hpp"
#include "controllers/highlights/UserHighlightModel.hpp"
#include "singletons/Settings.hpp"
@@ -53,7 +52,7 @@ HighlightingPage::HighlightingPage()
highlights
.emplace<EditableModelView>(
(new HighlightModel(nullptr))
->initialized(&app->highlights->phrases))
->initialized(&app->highlightedMessages))
.getElement();
view->addRegexHelpLink();
view->setTitles({"Pattern", "Flash\ntaskbar", "Play\nsound",
@@ -72,7 +71,7 @@ HighlightingPage::HighlightingPage()
});
view->addButtonPressed.connect([] {
getApp()->highlights->phrases.append(HighlightPhrase{
getApp()->highlightedMessages.append(HighlightPhrase{
"my phrase", true, false, false, false, "",
*ColorProvider::instance().color(
ColorType::SelfHighlight)});
@@ -95,8 +94,7 @@ HighlightingPage::HighlightingPage()
pingUsers
.emplace<EditableModelView>(
(new UserHighlightModel(nullptr))
->initialized(
&app->highlights->highlightedUsers))
->initialized(&app->highlightedUsers))
.getElement();
view->addRegexHelpLink();
@@ -120,11 +118,10 @@ HighlightingPage::HighlightingPage()
});
view->addButtonPressed.connect([] {
getApp()->highlights->highlightedUsers.append(
HighlightPhrase{"highlighted user", true, false, false,
false, "",
*ColorProvider::instance().color(
ColorType::SelfHighlight)});
getApp()->highlightedUsers.append(HighlightPhrase{
"highlighted user", true, false, false, false, "",
*ColorProvider::instance().color(
ColorType::SelfHighlight)});
});
QObject::connect(view->getTableView(), &QTableView::clicked,
@@ -143,8 +140,7 @@ HighlightingPage::HighlightingPage()
disabledUsers
.emplace<EditableModelView>(
(new HighlightBlacklistModel(nullptr))
->initialized(
&app->highlights->blacklistedUsers))
->initialized(&app->blacklistedUsers))
.getElement();
view->addRegexHelpLink();
@@ -162,7 +158,7 @@ HighlightingPage::HighlightingPage()
});
view->addButtonPressed.connect([] {
getApp()->highlights->blacklistedUsers.append(
getApp()->blacklistedUsers.append(
HighlightBlacklistUser{"blacklisted user", false});
});
}