mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-07 18:43:26 -08:00
[Fonts] Migrate ChatLog surfaces to theme font role (#7537)
* [Fonts] Migrate ChatLog surfaces to theme font role * [Fonts] Keep ChatView on the app font and share the report log font - ChatLog's unset fallback is qApp->font() again: ChatView never set a font before the role existed, so an unset role must not switch chat and the game log to monospace at the system GeneralFont size. - Move the monospace fallback the report dialogs used before into report_utils::reportLogFont(), which returns the theme's ChatLog role when it is set and the old monospace otherwise. tab_report, dlg_my_reports and dlg_report_user now share it, so they cannot drift and they honour a themed size instead of overriding it. --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
634f8115a5
commit
7a40ed9079
12 changed files with 89 additions and 7 deletions
|
|
@ -12,6 +12,7 @@
|
|||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QFlags>
|
||||
#include <QFontDatabase>
|
||||
#include <QGuiApplication>
|
||||
#include <QIODevice>
|
||||
#include <QLatin1Char>
|
||||
|
|
@ -658,11 +659,24 @@ QFont ThemeManager::appFont(AppFont::Role role) const
|
|||
return it.value();
|
||||
}
|
||||
|
||||
// No per-role scaling: every unset role resolves to the application font,
|
||||
// so with no fonts.toml present the result is identical to before.
|
||||
// Role fallbacks preserve the pre-theme defaults when no fonts.toml is
|
||||
// present: card text starts from a serif basis, everything else from the
|
||||
// application font. The report dialogs that used to hardcode monospace ask
|
||||
// for it explicitly (report_utils::reportLogFont).
|
||||
if (role == AppFont::CardText) {
|
||||
return QFont(QStringLiteral("Serif"));
|
||||
}
|
||||
|
||||
// No per-role scaling: every other unset role resolves to the application
|
||||
// font, so with no fonts.toml present the result is identical to before.
|
||||
return qApp->font();
|
||||
}
|
||||
|
||||
bool ThemeManager::hasAppFont(AppFont::Role role) const
|
||||
{
|
||||
return currentFonts.fonts.contains(role);
|
||||
}
|
||||
|
||||
QFont ThemeManager::defaultAppFont(AppFont::Role /*role*/) const
|
||||
{
|
||||
// No per-role scaling and no preview: an unset role resolves to the font
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue