absorbed HighlightController into Application
This commit is contained in:
+36
-4
@@ -5,7 +5,8 @@
|
||||
#include "common/Args.hpp"
|
||||
#include "controllers/accounts/AccountController.hpp"
|
||||
#include "controllers/commands/CommandController.hpp"
|
||||
#include "controllers/highlights/HighlightController.hpp"
|
||||
#include "controllers/highlights/HighlightBlacklistUser.hpp"
|
||||
#include "controllers/highlights/HighlightPhrase.hpp"
|
||||
#include "controllers/ignores/IgnoreController.hpp"
|
||||
#include "controllers/moderationactions/ModerationActions.hpp"
|
||||
#include "controllers/notifications/NotificationController.hpp"
|
||||
@@ -30,6 +31,7 @@
|
||||
#include "singletons/Updates.hpp"
|
||||
#include "singletons/WindowManager.hpp"
|
||||
#include "util/IsBigEndian.hpp"
|
||||
#include "util/PersistSignalVector.hpp"
|
||||
#include "util/PostToThread.hpp"
|
||||
#include "widgets/Notebook.hpp"
|
||||
#include "widgets/Window.hpp"
|
||||
@@ -46,7 +48,11 @@ Application *Application::instance = nullptr;
|
||||
// to each other
|
||||
|
||||
Application::Application(Settings &_settings, Paths &_paths)
|
||||
: themes(&this->emplace<Theme>())
|
||||
: highlightedMessages(*new SignalVector<HighlightPhrase>())
|
||||
, highlightedUsers(*new SignalVector<HighlightPhrase>())
|
||||
, blacklistedUsers(*new SignalVector<HighlightBlacklistUser>())
|
||||
|
||||
, themes(&this->emplace<Theme>())
|
||||
, fonts(&this->emplace<Fonts>())
|
||||
, emotes(&this->emplace<Emotes>())
|
||||
, windows(&this->emplace<WindowManager>())
|
||||
@@ -54,7 +60,6 @@ Application::Application(Settings &_settings, Paths &_paths)
|
||||
|
||||
, accounts(&this->emplace<AccountController>())
|
||||
, commands(&this->emplace<CommandController>())
|
||||
, highlights(&this->emplace<HighlightController>())
|
||||
, notifications(&this->emplace<NotificationController>())
|
||||
, pings(&this->emplace<MutedChannelController>())
|
||||
, ignores(&this->emplace<IgnoreController>())
|
||||
@@ -63,10 +68,13 @@ Application::Application(Settings &_settings, Paths &_paths)
|
||||
, twitch2(&this->emplace<TwitchIrcServer>())
|
||||
, chatterinoBadges(&this->emplace<ChatterinoBadges>())
|
||||
, logging(&this->emplace<Logging>())
|
||||
|
||||
{
|
||||
this->instance = this;
|
||||
|
||||
persist(this->highlightedMessages, "/highlighting/highlights");
|
||||
persist(this->blacklistedUsers, "/highlighting/blacklist");
|
||||
persist(this->highlightedUsers, "/highlighting/users");
|
||||
|
||||
this->fonts->fontChanged.connect(
|
||||
[this]() { this->windows->layoutChannelViews(); });
|
||||
|
||||
@@ -321,4 +329,28 @@ Application *getApp()
|
||||
return Application::instance;
|
||||
}
|
||||
|
||||
bool Application::isHighlightedUser(const QString &username)
|
||||
{
|
||||
for (const auto &highlightedUser : this->highlightedUsers)
|
||||
{
|
||||
if (highlightedUser.isMatch(username))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Application::isBlacklistedUser(const QString &username)
|
||||
{
|
||||
auto items = this->blacklistedUsers.readOnly();
|
||||
|
||||
for (const auto &blacklistedUser : *items)
|
||||
{
|
||||
if (blacklistedUser.isMatch(username))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
Reference in New Issue
Block a user