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:
@@ -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>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user