Remove Unnecessary Includes in Headers (#4275)

* refactor: remove unnecessary includes in headers

* fix: formatting

* chore: changelog

* fix: scrollbar

* fix: suggestions and old appbase remains

* fix: suggestion

* fix: missing Qt forward declarations

* fix: another qt include

* fix: includes for precompiled-headers=off

* Add missing `<memory>` includes

* Add missing `#pragma once`

* Fix tests

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
nerix
2022-12-31 15:41:01 +01:00
committed by GitHub
parent f04c4c7388
commit 1043f9f803
239 changed files with 871 additions and 544 deletions
@@ -3,6 +3,7 @@
#include "controllers/accounts/Account.hpp"
#include "controllers/accounts/AccountModel.hpp"
#include "providers/twitch/TwitchAccount.hpp"
#include "util/SharedPtrElementLess.hpp"
namespace chatterino {
@@ -3,7 +3,6 @@
#include "common/SignalVector.hpp"
#include "common/Singleton.hpp"
#include "providers/twitch/TwitchAccountManager.hpp"
#include "util/SharedPtrElementLess.hpp"
#include <QObject>
@@ -1,7 +1,6 @@
#pragma once
#include "common/SignalVectorModel.hpp"
#include "controllers/accounts/Account.hpp"
#include "util/QStringHash.hpp"
#include <unordered_map>
+6 -3
View File
@@ -1,12 +1,15 @@
#pragma once
#include "common/Channel.hpp"
#include "providers/twitch/TwitchChannel.hpp"
#include <QStringList>
#include <memory>
namespace chatterino {
class Channel;
using ChannelPtr = std::shared_ptr<Channel>;
class TwitchChannel;
struct CommandContext {
QStringList words;
@@ -1,21 +1,25 @@
#include "CommandController.hpp"
#include "controllers/commands/CommandController.hpp"
#include "Application.hpp"
#include "common/Env.hpp"
#include "common/NetworkResult.hpp"
#include "common/QLogging.hpp"
#include "common/SignalVector.hpp"
#include "controllers/accounts/AccountController.hpp"
#include "controllers/commands/builtin/twitch/ChatSettings.hpp"
#include "controllers/commands/Command.hpp"
#include "controllers/commands/CommandContext.hpp"
#include "controllers/commands/CommandModel.hpp"
#include "controllers/userdata/UserDataController.hpp"
#include "messages/Message.hpp"
#include "messages/MessageBuilder.hpp"
#include "messages/MessageElement.hpp"
#include "messages/MessageThread.hpp"
#include "providers/irc/IrcChannel2.hpp"
#include "providers/irc/IrcServer.hpp"
#include "providers/twitch/api/Helix.hpp"
#include "providers/twitch/TwitchAccount.hpp"
#include "providers/twitch/TwitchChannel.hpp"
#include "providers/twitch/TwitchCommon.hpp"
#include "providers/twitch/TwitchIrcServer.hpp"
#include "providers/twitch/TwitchMessageBuilder.hpp"
@@ -35,6 +39,7 @@
#include "util/Twitch.hpp"
#include "widgets/dialogs/ReplyThreadPopup.hpp"
#include "widgets/dialogs/UserInfoPopup.hpp"
#include "widgets/helper/ChannelView.hpp"
#include "widgets/splits/Split.hpp"
#include "widgets/splits/SplitContainer.hpp"
#include "widgets/Window.hpp"
@@ -1,11 +1,8 @@
#pragma once
#include "common/ChatterinoSetting.hpp"
#include "common/SignalVector.hpp"
#include "common/Singleton.hpp"
#include "controllers/commands/Command.hpp"
#include "controllers/commands/CommandContext.hpp"
#include "providers/twitch/TwitchChannel.hpp"
#include "util/QStringHash.hpp"
#include <pajlada/settings.hpp>
#include <QMap>
@@ -20,8 +17,12 @@ namespace chatterino {
class Settings;
class Paths;
class Channel;
using ChannelPtr = std::shared_ptr<Channel>;
struct Message;
struct Command;
class CommandModel;
struct CommandContext;
class CommandController final : public Singleton
{
+3 -1
View File
@@ -1,5 +1,7 @@
#include "CommandModel.hpp"
#include "controllers/commands/CommandModel.hpp"
#include "common/SignalVector.hpp"
#include "controllers/commands/Command.hpp"
#include "util/StandardItemHelper.hpp"
namespace chatterino {
+1 -1
View File
@@ -1,13 +1,13 @@
#pragma once
#include "common/SignalVectorModel.hpp"
#include "controllers/commands/Command.hpp"
#include <QObject>
namespace chatterino {
class CommandController;
struct Command;
class CommandModel : public SignalVectorModel<Command>
{
@@ -2,6 +2,7 @@
#include "Application.hpp"
#include "controllers/accounts/AccountController.hpp"
#include "controllers/commands/CommandContext.hpp"
#include "messages/MessageBuilder.hpp"
#include "providers/twitch/api/Helix.hpp"
#include "providers/twitch/TwitchAccount.hpp"
@@ -1,24 +1,28 @@
#pragma once
#include "controllers/commands/CommandContext.hpp"
#include <QString>
namespace chatterino::commands {
namespace chatterino {
QString emoteOnly(const CommandContext &ctx);
QString emoteOnlyOff(const CommandContext &ctx);
struct CommandContext;
QString subscribers(const CommandContext &ctx);
QString subscribersOff(const CommandContext &ctx);
namespace commands {
QString slow(const CommandContext &ctx);
QString slowOff(const CommandContext &ctx);
QString emoteOnly(const CommandContext &ctx);
QString emoteOnlyOff(const CommandContext &ctx);
QString followers(const CommandContext &ctx);
QString followersOff(const CommandContext &ctx);
QString subscribers(const CommandContext &ctx);
QString subscribersOff(const CommandContext &ctx);
QString uniqueChat(const CommandContext &ctx);
QString uniqueChatOff(const CommandContext &ctx);
QString slow(const CommandContext &ctx);
QString slowOff(const CommandContext &ctx);
} // namespace chatterino::commands
QString followers(const CommandContext &ctx);
QString followersOff(const CommandContext &ctx);
QString uniqueChat(const CommandContext &ctx);
QString uniqueChatOff(const CommandContext &ctx);
} // namespace commands
} // namespace chatterino
+2 -1
View File
@@ -1,6 +1,7 @@
#include "FilterModel.hpp"
#include "controllers/filters/FilterModel.hpp"
#include "Application.hpp"
#include "controllers/filters/FilterRecord.hpp"
#include "singletons/Settings.hpp"
#include "util/StandardItemHelper.hpp"
+3 -1
View File
@@ -1,12 +1,14 @@
#pragma once
#include "common/SignalVectorModel.hpp"
#include "controllers/filters/FilterRecord.hpp"
#include <QObject>
namespace chatterino {
class FilterRecord;
using FilterRecordPtr = std::shared_ptr<FilterRecord>;
class FilterModel : public SignalVectorModel<FilterRecordPtr>
{
public:
+53
View File
@@ -0,0 +1,53 @@
#include "controllers/filters/FilterRecord.hpp"
namespace chatterino {
FilterRecord::FilterRecord(const QString &name, const QString &filter)
: name_(name)
, filter_(filter)
, id_(QUuid::createUuid())
, parser_(std::make_unique<filterparser::FilterParser>(filter))
{
}
FilterRecord::FilterRecord(const QString &name, const QString &filter,
const QUuid &id)
: name_(name)
, filter_(filter)
, id_(id)
, parser_(std::make_unique<filterparser::FilterParser>(filter))
{
}
const QString &FilterRecord::getName() const
{
return this->name_;
}
const QString &FilterRecord::getFilter() const
{
return this->filter_;
}
const QUuid &FilterRecord::getId() const
{
return this->id_;
}
bool FilterRecord::valid() const
{
return this->parser_->valid();
}
bool FilterRecord::filter(const filterparser::ContextMap &context) const
{
return this->parser_->execute(context);
}
bool FilterRecord::operator==(const FilterRecord &other) const
{
return std::tie(this->name_, this->filter_, this->id_) ==
std::tie(other.name_, other.filter_, other.id_);
}
} // namespace chatterino
+8 -40
View File
@@ -1,7 +1,6 @@
#pragma once
#include "controllers/filters/parser/FilterParser.hpp"
#include "controllers/filters/parser/Types.hpp"
#include "util/RapidjsonHelpers.hpp"
#include "util/RapidJsonSerializeQString.hpp"
@@ -17,52 +16,21 @@ namespace chatterino {
class FilterRecord
{
public:
bool operator==(const FilterRecord &other) const
{
return std::tie(this->name_, this->filter_, this->id_) ==
std::tie(other.name_, other.filter_, other.id_);
}
FilterRecord(const QString &name, const QString &filter);
FilterRecord(const QString &name, const QString &filter)
: name_(name)
, filter_(filter)
, id_(QUuid::createUuid())
, parser_(std::make_unique<filterparser::FilterParser>(filter))
{
}
FilterRecord(const QString &name, const QString &filter, const QUuid &id);
FilterRecord(const QString &name, const QString &filter, const QUuid &id)
: name_(name)
, filter_(filter)
, id_(id)
, parser_(std::make_unique<filterparser::FilterParser>(filter))
{
}
const QString &getName() const;
const QString &getName() const
{
return this->name_;
}
const QString &getFilter() const;
const QString &getFilter() const
{
return this->filter_;
}
const QUuid &getId() const;
const QUuid &getId() const
{
return this->id_;
}
bool valid() const;
bool valid() const
{
return this->parser_->valid();
}
bool filter(const filterparser::ContextMap &context) const;
bool filter(const filterparser::ContextMap &context) const
{
return this->parser_->execute(context);
}
bool operator==(const FilterRecord &other) const;
private:
QString name_;
+78
View File
@@ -0,0 +1,78 @@
#include "controllers/filters/FilterSet.hpp"
#include "controllers/filters/FilterRecord.hpp"
#include "singletons/Settings.hpp"
namespace chatterino {
FilterSet::FilterSet()
{
this->listener_ =
getCSettings().filterRecords.delayedItemsChanged.connect([this] {
this->reloadFilters();
});
}
FilterSet::FilterSet(const QList<QUuid> &filterIds)
{
auto filters = getCSettings().filterRecords.readOnly();
for (const auto &f : *filters)
{
if (filterIds.contains(f->getId()))
this->filters_.insert(f->getId(), f);
}
this->listener_ =
getCSettings().filterRecords.delayedItemsChanged.connect([this] {
this->reloadFilters();
});
}
FilterSet::~FilterSet()
{
this->listener_.disconnect();
}
bool FilterSet::filter(const MessagePtr &m, ChannelPtr channel) const
{
if (this->filters_.size() == 0)
return true;
filterparser::ContextMap context =
filterparser::buildContextMap(m, channel.get());
for (const auto &f : this->filters_.values())
{
if (!f->valid() || !f->filter(context))
return false;
}
return true;
}
const QList<QUuid> FilterSet::filterIds() const
{
return this->filters_.keys();
}
void FilterSet::reloadFilters()
{
auto filters = getCSettings().filterRecords.readOnly();
for (const auto &key : this->filters_.keys())
{
bool found = false;
for (const auto &f : *filters)
{
if (f->getId() == key)
{
found = true;
this->filters_.insert(key, f);
}
}
if (!found)
{
this->filters_.remove(key);
}
}
}
} // namespace chatterino
+19 -68
View File
@@ -1,86 +1,37 @@
#pragma once
#include "controllers/filters/FilterRecord.hpp"
#include "singletons/Settings.hpp"
#include <pajlada/signals.hpp>
#include <QList>
#include <QMap>
#include <QUuid>
#include <memory>
namespace chatterino {
class FilterRecord;
using FilterRecordPtr = std::shared_ptr<FilterRecord>;
struct Message;
class Channel;
using MessagePtr = std::shared_ptr<const Message>;
using ChannelPtr = std::shared_ptr<Channel>;
class FilterSet
{
public:
FilterSet()
{
this->listener_ =
getCSettings().filterRecords.delayedItemsChanged.connect([this] {
this->reloadFilters();
});
}
FilterSet();
FilterSet(const QList<QUuid> &filterIds);
FilterSet(const QList<QUuid> &filterIds)
{
auto filters = getCSettings().filterRecords.readOnly();
for (const auto &f : *filters)
{
if (filterIds.contains(f->getId()))
this->filters_.insert(f->getId(), f);
}
~FilterSet();
this->listener_ =
getCSettings().filterRecords.delayedItemsChanged.connect([this] {
this->reloadFilters();
});
}
~FilterSet()
{
this->listener_.disconnect();
}
bool filter(const MessagePtr &m, ChannelPtr channel) const
{
if (this->filters_.size() == 0)
return true;
filterparser::ContextMap context =
filterparser::buildContextMap(m, channel.get());
for (const auto &f : this->filters_.values())
{
if (!f->valid() || !f->filter(context))
return false;
}
return true;
}
const QList<QUuid> filterIds() const
{
return this->filters_.keys();
}
bool filter(const MessagePtr &m, ChannelPtr channel) const;
const QList<QUuid> filterIds() const;
private:
QMap<QUuid, FilterRecordPtr> filters_;
pajlada::Signals::Connection listener_;
void reloadFilters()
{
auto filters = getCSettings().filterRecords.readOnly();
for (const auto &key : this->filters_.keys())
{
bool found = false;
for (const auto &f : *filters)
{
if (f->getId() == key)
{
found = true;
this->filters_.insert(key, f);
}
}
if (!found)
{
this->filters_.remove(key);
}
}
}
void reloadFilters();
};
using FilterSetPtr = std::shared_ptr<FilterSet>;
@@ -3,6 +3,9 @@
#include "Application.hpp"
#include "common/Channel.hpp"
#include "controllers/filters/parser/Types.hpp"
#include "messages/Message.hpp"
#include "providers/twitch/TwitchBadge.hpp"
#include "providers/twitch/TwitchChannel.hpp"
#include "providers/twitch/TwitchIrcServer.hpp"
namespace filterparser {
+8 -2
View File
@@ -1,9 +1,15 @@
#pragma once
#include "messages/Message.hpp"
#include <QRegularExpression>
#include <memory>
namespace chatterino {
struct Message;
}
namespace filterparser {
using MessagePtr = std::shared_ptr<const chatterino::Message>;
@@ -1,7 +1,11 @@
#include "BadgeHighlightModel.hpp"
#include "controllers/highlights/BadgeHighlightModel.hpp"
#include "Application.hpp"
#include "common/SignalVectorModel.hpp"
#include "controllers/highlights/HighlightBadge.hpp"
#include "controllers/highlights/HighlightPhrase.hpp"
#include "messages/Emote.hpp"
#include "providers/twitch/TwitchBadges.hpp"
#include "singletons/Settings.hpp"
#include "util/StandardItemHelper.hpp"
@@ -1,14 +1,13 @@
#pragma once
#include "common/SignalVectorModel.hpp"
#include "controllers/highlights/HighlightBadge.hpp"
#include "providers/twitch/TwitchBadges.hpp"
#include <QObject>
namespace chatterino {
class HighlightController;
class HighlightBadge;
class BadgeHighlightModel : public SignalVectorModel<HighlightBadge>
{
@@ -1,6 +1,7 @@
#include "HighlightBadge.hpp"
#include "messages/SharedMessageBuilder.hpp"
#include "providers/twitch/TwitchBadge.hpp"
#include "singletons/Resources.hpp"
namespace chatterino {
@@ -1,14 +1,19 @@
#pragma once
#include "providers/twitch/TwitchBadge.hpp"
#include "util/RapidjsonHelpers.hpp"
#include "util/RapidJsonSerializeQString.hpp"
#include <pajlada/serialize.hpp>
#include <QColor>
#include <QString>
#include <QUrl>
#include <memory>
namespace chatterino {
class Badge;
class HighlightBadge
{
public:
@@ -1,6 +1,7 @@
#include "controllers/highlights/HighlightBlacklistModel.hpp"
#include "Application.hpp"
#include "controllers/highlights/HighlightBlacklistUser.hpp"
#include "singletons/Settings.hpp"
#include "util/StandardItemHelper.hpp"
@@ -1,12 +1,12 @@
#pragma once
#include "common/SignalVectorModel.hpp"
#include "controllers/highlights/HighlightBlacklistUser.hpp"
#include <QObject>
namespace chatterino {
class HighlightBlacklistUser;
class HighlightController;
class HighlightBlacklistModel : public SignalVectorModel<HighlightBlacklistUser>
@@ -1,7 +1,17 @@
#include "controllers/highlights/HighlightController.hpp"
#include "Application.hpp"
#include "common/QLogging.hpp"
#include "controllers/accounts/AccountController.hpp"
#include "controllers/highlights/HighlightBadge.hpp"
#include "controllers/highlights/HighlightPhrase.hpp"
#include "messages/Message.hpp"
#include "messages/MessageBuilder.hpp"
#include "providers/colors/ColorProvider.hpp"
#include "providers/twitch/TwitchAccount.hpp"
#include "providers/twitch/TwitchBadge.hpp"
#include "singletons/Paths.hpp"
#include "singletons/Settings.hpp"
namespace {
@@ -282,6 +292,89 @@ void rebuildBadgeHighlights(Settings &settings,
namespace chatterino {
HighlightResult::HighlightResult(bool _alert, bool _playSound,
boost::optional<QUrl> _customSoundUrl,
std::shared_ptr<QColor> _color,
bool _showInMentions)
: alert(_alert)
, playSound(_playSound)
, customSoundUrl(std::move(_customSoundUrl))
, color(std::move(_color))
, showInMentions(_showInMentions)
{
}
HighlightResult HighlightResult::emptyResult()
{
return {
false, false, boost::none, nullptr, false,
};
}
bool HighlightResult::operator==(const HighlightResult &other) const
{
if (this->alert != other.alert)
{
return false;
}
if (this->playSound != other.playSound)
{
return false;
}
if (this->customSoundUrl != other.customSoundUrl)
{
return false;
}
if (this->color && other.color)
{
if (*this->color != *other.color)
{
return false;
}
}
if (this->showInMentions != other.showInMentions)
{
return false;
}
return true;
}
bool HighlightResult::operator!=(const HighlightResult &other) const
{
return !(*this == other);
}
bool HighlightResult::empty() const
{
return !this->alert && !this->playSound &&
!this->customSoundUrl.has_value() && !this->color &&
!this->showInMentions;
}
bool HighlightResult::full() const
{
return this->alert && this->playSound && this->customSoundUrl.has_value() &&
this->color && this->showInMentions;
}
std::ostream &operator<<(std::ostream &os, const HighlightResult &result)
{
os << "Alert: " << (result.alert ? "Yes" : "No") << ", "
<< "Play sound: " << (result.playSound ? "Yes" : "No") << " ("
<< (result.customSoundUrl
? result.customSoundUrl.get().toString().toStdString()
: "")
<< ")"
<< ", "
<< "Color: " << (result.color ? result.color->name().toStdString() : "")
<< ", "
<< "Show in mentions: " << (result.showInMentions ? "Yes" : "No");
return os;
}
void HighlightController::initialize(Settings &settings, Paths & /*paths*/)
{
this->rebuildListener_.addSetting(settings.enableSelfHighlight);
@@ -1,13 +1,12 @@
#pragma once
#include "common/FlagsEnum.hpp"
#include "common/Singleton.hpp"
#include "common/UniqueAccess.hpp"
#include "messages/MessageBuilder.hpp"
#include "providers/twitch/TwitchBadge.hpp"
#include "singletons/Paths.hpp"
#include "singletons/Settings.hpp"
#include <boost/optional.hpp>
#include <pajlada/settings.hpp>
#include <pajlada/settings/settinglistener.hpp>
#include <QColor>
#include <QUrl>
@@ -17,27 +16,20 @@
namespace chatterino {
class Badge;
struct MessageParseArgs;
enum class MessageFlag : int64_t;
using MessageFlags = FlagsEnum<MessageFlag>;
struct HighlightResult {
HighlightResult(bool _alert, bool _playSound,
boost::optional<QUrl> _customSoundUrl,
std::shared_ptr<QColor> _color, bool _showInMentions)
: alert(_alert)
, playSound(_playSound)
, customSoundUrl(std::move(_customSoundUrl))
, color(std::move(_color))
, showInMentions(_showInMentions)
{
}
std::shared_ptr<QColor> _color, bool _showInMentions);
/**
* @brief Construct an empty HighlightResult with all side-effects disabled
**/
static HighlightResult emptyResult()
{
return {
false, false, boost::none, nullptr, false,
};
}
static HighlightResult emptyResult();
/**
* @brief true if highlight should trigger the taskbar to flash
@@ -66,77 +58,21 @@ struct HighlightResult {
**/
bool showInMentions{false};
bool operator==(const HighlightResult &other) const
{
if (this->alert != other.alert)
{
return false;
}
if (this->playSound != other.playSound)
{
return false;
}
if (this->customSoundUrl != other.customSoundUrl)
{
return false;
}
if (this->color && other.color)
{
if (*this->color != *other.color)
{
return false;
}
}
if (this->showInMentions != other.showInMentions)
{
return false;
}
return true;
}
bool operator!=(const HighlightResult &other) const
{
return !(*this == other);
}
bool operator==(const HighlightResult &other) const;
bool operator!=(const HighlightResult &other) const;
/**
* @brief Returns true if no side-effect has been enabled
**/
[[nodiscard]] bool empty() const
{
return !this->alert && !this->playSound &&
!this->customSoundUrl.has_value() && !this->color &&
!this->showInMentions;
}
[[nodiscard]] bool empty() const;
/**
* @brief Returns true if all side-effects have been enabled
**/
[[nodiscard]] bool full() const
{
return this->alert && this->playSound &&
this->customSoundUrl.has_value() && this->color &&
this->showInMentions;
}
[[nodiscard]] bool full() const;
friend std::ostream &operator<<(std::ostream &os,
const HighlightResult &result)
{
os << "Alert: " << (result.alert ? "Yes" : "No") << ", "
<< "Play sound: " << (result.playSound ? "Yes" : "No") << " ("
<< (result.customSoundUrl
? result.customSoundUrl.get().toString().toStdString()
: "")
<< ")"
<< ", "
<< "Color: "
<< (result.color ? result.color->name().toStdString() : "") << ", "
<< "Show in mentions: " << (result.showInMentions ? "Yes" : "No");
return os;
}
const HighlightResult &result);
};
struct HighlightCheck {
@@ -1,6 +1,9 @@
#include "HighlightModel.hpp"
#include "controllers/highlights/HighlightModel.hpp"
#include "Application.hpp"
#include "common/SignalVectorModel.hpp"
#include "controllers/highlights/HighlightPhrase.hpp"
#include "providers/colors/ColorProvider.hpp"
#include "singletons/Settings.hpp"
#include "singletons/WindowManager.hpp"
#include "util/StandardItemHelper.hpp"
@@ -1,12 +1,13 @@
#pragma once
#include "common/SignalVectorModel.hpp"
#include "controllers/highlights/HighlightPhrase.hpp"
#include <QObject>
namespace chatterino {
class HighlightPhrase;
class HighlightModel : public SignalVectorModel<HighlightPhrase>
{
public:
@@ -1,6 +1,5 @@
#pragma once
#include "providers/colors/ColorProvider.hpp"
#include "util/RapidjsonHelpers.hpp"
#include "util/RapidJsonSerializeQString.hpp"
@@ -2,6 +2,7 @@
#include "Application.hpp"
#include "controllers/highlights/HighlightModel.hpp"
#include "controllers/highlights/HighlightPhrase.hpp"
#include "singletons/Settings.hpp"
#include "util/StandardItemHelper.hpp"
@@ -1,13 +1,13 @@
#pragma once
#include "common/SignalVectorModel.hpp"
#include "controllers/highlights/HighlightPhrase.hpp"
#include <QObject>
namespace chatterino {
class HighlightController;
class HighlightPhrase;
class UserHighlightModel : public SignalVectorModel<HighlightPhrase>
{
+1 -1
View File
@@ -1,6 +1,6 @@
#pragma once
#include "HotkeyCategory.hpp"
#include "controllers/hotkeys/HotkeyCategory.hpp"
#include <QString>
@@ -1,6 +1,7 @@
#include "controllers/hotkeys/HotkeyController.hpp"
#include "common/QLogging.hpp"
#include "controllers/hotkeys/Hotkey.hpp"
#include "controllers/hotkeys/HotkeyCategory.hpp"
#include "controllers/hotkeys/HotkeyModel.hpp"
#include "singletons/Settings.hpp"
+1
View File
@@ -1,6 +1,7 @@
#include "controllers/hotkeys/HotkeyModel.hpp"
#include "common/QLogging.hpp"
#include "controllers/hotkeys/Hotkey.hpp"
#include "util/StandardItemHelper.hpp"
namespace chatterino {
+1 -1
View File
@@ -1,7 +1,6 @@
#pragma once
#include "common/SignalVectorModel.hpp"
#include "controllers/hotkeys/Hotkey.hpp"
#include "util/QStringHash.hpp"
#include <unordered_map>
@@ -9,6 +8,7 @@
namespace chatterino {
class HotkeyController;
class Hotkey;
class HotkeyModel : public SignalVectorModel<std::shared_ptr<Hotkey>>
{
@@ -1,6 +1,8 @@
#include "controllers/ignores/IgnoreController.hpp"
#include "Application.hpp"
#include "common/QLogging.hpp"
#include "controllers/accounts/AccountController.hpp"
#include "controllers/ignores/IgnorePhrase.hpp"
#include "providers/twitch/TwitchAccount.hpp"
#include "singletons/Settings.hpp"
+2 -1
View File
@@ -1,6 +1,7 @@
#include "IgnoreModel.hpp"
#include "controllers/ignores/IgnoreModel.hpp"
#include "Application.hpp"
#include "controllers/ignores/IgnorePhrase.hpp"
#include "singletons/Settings.hpp"
#include "util/StandardItemHelper.hpp"
+2 -1
View File
@@ -1,12 +1,13 @@
#pragma once
#include "common/SignalVectorModel.hpp"
#include "controllers/ignores/IgnorePhrase.hpp"
#include <QObject>
namespace chatterino {
class IgnorePhrase;
class IgnoreModel : public SignalVectorModel<IgnorePhrase>
{
public:
+7
View File
@@ -3,6 +3,7 @@
#include "Application.hpp"
#include "controllers/accounts/AccountController.hpp"
#include "providers/twitch/TwitchAccount.hpp"
#include "singletons/Settings.hpp"
namespace chatterino {
@@ -112,4 +113,10 @@ bool IgnorePhrase::containsEmote() const
return !this->emotes_.empty();
}
IgnorePhrase IgnorePhrase::createEmpty()
{
return IgnorePhrase(QString(), false, false,
getSettings()->ignoredPhraseReplace.getValue(), true);
}
} // namespace chatterino
+8 -6
View File
@@ -1,7 +1,6 @@
#pragma once
#include "messages/Emote.hpp"
#include "singletons/Settings.hpp"
#include "common/Aliases.hpp"
#include "util/RapidjsonHelpers.hpp"
#include "util/RapidJsonSerializeQString.hpp"
@@ -9,10 +8,14 @@
#include <QRegularExpression>
#include <QString>
#include <memory>
#include <unordered_map>
namespace chatterino {
struct Emote;
using EmotePtr = std::shared_ptr<const Emote>;
class IgnorePhrase
{
public:
@@ -43,6 +46,8 @@ public:
bool containsEmote() const;
static IgnorePhrase createEmpty();
private:
QString pattern_;
bool isRegex_;
@@ -82,10 +87,7 @@ struct Deserialize<chatterino::IgnorePhrase> {
if (!value.IsObject())
{
PAJLADA_REPORT_ERROR(error)
return chatterino::IgnorePhrase(
QString(), false, false,
::chatterino::getSettings()->ignoredPhraseReplace.getValue(),
true);
return chatterino::IgnorePhrase::createEmpty();
}
QString _pattern;
@@ -1,6 +1,7 @@
#include "ModerationAction.hpp"
#include "controllers/moderationactions/ModerationAction.hpp"
#include "Application.hpp"
#include "debug/AssertInGuiThread.hpp"
#include "messages/Image.hpp"
#include "singletons/Resources.hpp"
@@ -1,5 +1,6 @@
#include "ModerationActionModel.hpp"
#include "controllers/moderationactions/ModerationActionModel.hpp"
#include "controllers/moderationactions/ModerationAction.hpp"
#include "util/StandardItemHelper.hpp"
namespace chatterino {
@@ -1,12 +1,13 @@
#pragma once
#include "common/SignalVectorModel.hpp"
#include "controllers/moderationactions/ModerationAction.hpp"
#include <QObject>
namespace chatterino {
class ModerationAction;
class ModerationActionModel : public SignalVectorModel<ModerationAction>
{
public:
-1
View File
@@ -1,6 +1,5 @@
#pragma once
#include "controllers/accounts/AccountController.hpp"
#include "util/RapidjsonHelpers.hpp"
#include "util/RapidJsonSerializeQString.hpp"
+2 -1
View File
@@ -1,6 +1,7 @@
#include "NicknamesModel.hpp"
#include "controllers/nicknames/NicknamesModel.hpp"
#include "Application.hpp"
#include "controllers/nicknames/Nickname.hpp"
#include "providers/twitch/api/Helix.hpp"
#include "singletons/Settings.hpp"
#include "util/StandardItemHelper.hpp"
+2 -1
View File
@@ -1,12 +1,13 @@
#pragma once
#include "common/SignalVectorModel.hpp"
#include "controllers/nicknames/Nickname.hpp"
#include <QObject>
namespace chatterino {
class Nickname;
class NicknamesModel : public SignalVectorModel<Nickname>
{
public:
@@ -5,9 +5,11 @@
#include "common/Outcome.hpp"
#include "common/QLogging.hpp"
#include "controllers/notifications/NotificationModel.hpp"
#include "messages/Message.hpp"
#include "providers/twitch/api/Helix.hpp"
#include "providers/twitch/TwitchIrcServer.hpp"
#include "providers/twitch/TwitchMessageBuilder.hpp"
#include "singletons/Settings.hpp"
#include "singletons/Toasts.hpp"
#include "singletons/WindowManager.hpp"
#include "util/Helpers.hpp"
@@ -1,8 +1,8 @@
#pragma once
#include "common/ChatterinoSetting.hpp"
#include "common/SignalVector.hpp"
#include "common/Singleton.hpp"
#include "singletons/Settings.hpp"
#include <QTimer>
@@ -1,7 +1,6 @@
#pragma once
#include "common/SignalVectorModel.hpp"
#include "controllers/notifications/NotificationController.hpp"
#include <QObject>
@@ -1,14 +1,11 @@
#pragma once
#include "common/SignalVectorModel.hpp"
#include "controllers/notifications/NotificationController.hpp"
#include <QObject>
namespace chatterino {
class MutedChannelController;
class MutedChannelModel : public SignalVectorModel<QString>
{
explicit MutedChannelModel(QObject *parent);