[Settings] Split cache_settings monolith into multiple SettingsManager sub-classes (#7050)

* [Settings] Split cache_settings into multiple files

Took 9 minutes

Took 4 minutes

* [Settings] Fwd declare settings classes in cache_settings

Took 15 minutes

* Fix oracle includes.

Took 8 minutes

* Address comments, fix windows CI

Took 8 minutes

* fix copy constructor visibility

Took 3 minutes

* lint

Took 2 minutes

* Fix native format tests.

Took 5 minutes

* Remove test header guard

Took 4 seconds

* Remove tests invalid in CI environ

Took 24 seconds

* Adjust to rebase.

Took 11 minutes

* Change settings file name.

Took 8 minutes

---------

Co-authored-by: Lukas Brübach <lukas.bruebach@bdosecurity.de>
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2026-07-27 11:25:39 +02:00 committed by GitHub
parent cf0b453e75
commit 12f0f59453
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
166 changed files with 5589 additions and 3066 deletions

View file

@ -14,6 +14,7 @@
#include <QMouseEvent>
#include <QScrollBar>
#include <libcockatrice/network/server/remote/user_level.h>
#include <libcockatrice/settings/chat_settings.h>
const QColor DEFAULT_MENTION_COLOR = QColor(194, 31, 47);
@ -292,8 +293,8 @@ void ChatView::appendMessage(QString message,
}
cursor.setCharFormat(defaultFormat);
bool mentionEnabled = SettingsCache::instance().getChatMention();
highlightedWords = SettingsCache::instance().getHighlightWords().split(' ', Qt::SkipEmptyParts);
bool mentionEnabled = SettingsCache::instance().chat().getChatMention();
highlightedWords = SettingsCache::instance().chat().getHighlightWords().split(' ', Qt::SkipEmptyParts);
// parse the message
while (message.size()) {
@ -395,8 +396,9 @@ void ChatView::checkMention(QTextCursor &cursor, QString &message, const QString
// You have received a valid mention!!
soundEngine->playSound("chat_mention");
mentionFormat.setBackground(QBrush(getCustomMentionColor()));
mentionFormat.setForeground(SettingsCache::instance().getChatMentionForeground() ? QBrush(Qt::white)
: QBrush(Qt::black));
mentionFormat.setForeground(SettingsCache::instance().chat().getChatMentionForeground()
? QBrush(Qt::white)
: QBrush(Qt::black));
cursor.insertText(mention, mentionFormat);
message = message.mid(mention.size());
showSystemPopup(userName);
@ -417,8 +419,8 @@ void ChatView::checkMention(QTextCursor &cursor, QString &message, const QString
// Moderator Sending Global Message
soundEngine->playSound("all_mention");
mentionFormat.setBackground(QBrush(getCustomMentionColor()));
mentionFormat.setForeground(SettingsCache::instance().getChatMentionForeground() ? QBrush(Qt::white)
: QBrush(Qt::black));
mentionFormat.setForeground(
SettingsCache::instance().chat().getChatMentionForeground() ? QBrush(Qt::white) : QBrush(Qt::black));
cursor.insertText("@" + fullMentionUpToSpaceOrEnd, mentionFormat);
message = message.mid(fullMentionUpToSpaceOrEnd.size() + 1);
showSystemPopup(userName);
@ -465,8 +467,8 @@ void ChatView::checkWord(QTextCursor &cursor, QString &message)
if (fullWordUpToSpaceOrEnd.compare(word, Qt::CaseInsensitive) == 0) {
// You have received a valid mention of custom word!!
highlightFormat.setBackground(QBrush(getCustomHighlightColor()));
highlightFormat.setForeground(SettingsCache::instance().getChatHighlightForeground() ? QBrush(Qt::white)
: QBrush(Qt::black));
highlightFormat.setForeground(
SettingsCache::instance().chat().getChatHighlightForeground() ? QBrush(Qt::white) : QBrush(Qt::black));
cursor.insertText(fullWordUpToSpaceOrEnd, highlightFormat);
cursor.insertText(rest, defaultFormat);
QApplication::alert(this);
@ -522,7 +524,7 @@ void ChatView::actMessageClicked()
void ChatView::showSystemPopup(const QString &userName)
{
QApplication::alert(this);
if (SettingsCache::instance().getShowMentionPopup()) {
if (SettingsCache::instance().chat().getShowMentionPopup()) {
emit showMentionPopup(userName);
}
}
@ -530,10 +532,10 @@ void ChatView::showSystemPopup(const QString &userName)
QColor ChatView::getCustomMentionColor()
{
#if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0))
QColor customColor = QColor::fromString("#" + SettingsCache::instance().getChatMentionColor());
QColor customColor = QColor::fromString("#" + SettingsCache::instance().chat().getChatMentionColor());
#else
QColor customColor;
customColor.setNamedColor("#" + SettingsCache::instance().getChatMentionColor());
customColor.setNamedColor("#" + SettingsCache::instance().chat().getChatMentionColor());
#endif
return customColor.isValid() ? customColor : DEFAULT_MENTION_COLOR;
}
@ -541,10 +543,10 @@ QColor ChatView::getCustomMentionColor()
QColor ChatView::getCustomHighlightColor()
{
#if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0))
QColor customColor = QColor::fromString("#" + SettingsCache::instance().getChatMentionColor());
QColor customColor = QColor::fromString("#" + SettingsCache::instance().chat().getChatMentionColor());
#else
QColor customColor;
customColor.setNamedColor("#" + SettingsCache::instance().getChatMentionColor());
customColor.setNamedColor("#" + SettingsCache::instance().chat().getChatMentionColor());
#endif
return customColor.isValid() ? customColor : DEFAULT_MENTION_COLOR;
}