mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-14 20:01:06 -08:00
Compare commits
11 commits
7ba95f6c97
...
86fbf5032e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
86fbf5032e | ||
|
|
239642b8a0 | ||
|
|
64d7e28192 | ||
|
|
4b616a17e8 | ||
|
|
f6b8edc50c | ||
|
|
b5250b440b | ||
|
|
1407a2e142 | ||
|
|
ee2e0a9fa0 | ||
|
|
145f7adf73 | ||
|
|
2a3a31c24c | ||
|
|
ecc3ecd4ea |
6 changed files with 33 additions and 15 deletions
|
|
@ -117,10 +117,11 @@ GameView::GameView(GameScene *scene, QWidget *parent) : QGraphicsView(scene, par
|
||||||
tallyLayout->setSpacing(2);
|
tallyLayout->setSpacing(2);
|
||||||
tallyContainer->hide();
|
tallyContainer->hide();
|
||||||
|
|
||||||
applyDeckOverlayFonts();
|
applyDeckListFont();
|
||||||
|
connect(themeManager, &ThemeManager::fontsChanged, this, &GameView::applyDeckListFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameView::applyDeckOverlayFonts()
|
void GameView::applyDeckListFont()
|
||||||
{
|
{
|
||||||
dragCountLabel->setFont(deckOverlayFont(14, true));
|
dragCountLabel->setFont(deckOverlayFont(14, true));
|
||||||
totalCountLabel->setFont(deckOverlayFont(16, true));
|
totalCountLabel->setFont(deckOverlayFont(16, true));
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ private slots:
|
||||||
void refreshShortcuts();
|
void refreshShortcuts();
|
||||||
void updateTotalSelectionCount(const QSize &viewSize = QSize());
|
void updateTotalSelectionCount(const QSize &viewSize = QSize());
|
||||||
void setFocusDisabled(bool disabled);
|
void setFocusDisabled(bool disabled);
|
||||||
void applyDeckOverlayFonts();
|
void applyDeckListFont();
|
||||||
public slots:
|
public slots:
|
||||||
void updateSceneRect(const QRectF &rect);
|
void updateSceneRect(const QRectF &rect);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,12 +79,11 @@ void FontGridWidget::loadFonts(const FontConfig &cfg)
|
||||||
auto role = static_cast<AppFont::Role>(fontEnum.value(i));
|
auto role = static_cast<AppFont::Role>(fontEnum.value(i));
|
||||||
const FontRow &row = fontRows[role];
|
const FontRow &row = fontRows[role];
|
||||||
|
|
||||||
// Roles absent from the file resolve the same way the runtime does: an unset
|
// Roles absent from the file resolve to the startup font, not to the
|
||||||
// role falls back to the config's InterfaceDefault, and only then to the
|
// live preview: appFont() would return the previewed config, so Reset
|
||||||
// startup font. appFont() would return the live preview instead, so Reset and
|
// and a first load would both show the edited font instead of the
|
||||||
// a first load must not measure against it.
|
// theme's real default.
|
||||||
const QFont fallback = cfg.fonts.value(AppFont::InterfaceDefault, themeManager->defaultAppFont(role));
|
const QFont font = cfg.fonts.value(role, themeManager->defaultAppFont(role));
|
||||||
const QFont font = cfg.fonts.value(role, fallback);
|
|
||||||
row.familyCombo->setCurrentFont(font);
|
row.familyCombo->setCurrentFont(font);
|
||||||
|
|
||||||
int size = font.pointSize();
|
int size = font.pointSize();
|
||||||
|
|
|
||||||
|
|
@ -285,7 +285,9 @@ void PaletteEditorDialog::loadSchemes()
|
||||||
void PaletteEditorDialog::loadFonts()
|
void PaletteEditorDialog::loadFonts()
|
||||||
{
|
{
|
||||||
savedFontConfig = ThemeManager::loadDefaultFontConfig(themeDirPath, themeName);
|
savedFontConfig = ThemeManager::loadDefaultFontConfig(themeDirPath, themeName);
|
||||||
|
fontGrid->blockSignals(true);
|
||||||
fontGrid->loadFonts(savedFontConfig);
|
fontGrid->loadFonts(savedFontConfig);
|
||||||
|
fontGrid->blockSignals(false);
|
||||||
fontsDirty = false;
|
fontsDirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -392,6 +394,7 @@ void PaletteEditorDialog::onSave()
|
||||||
|
|
||||||
void PaletteEditorDialog::onReset()
|
void PaletteEditorDialog::onReset()
|
||||||
{
|
{
|
||||||
|
const bool hadFontPreview = fontsDirty;
|
||||||
workingConfig[loadedScheme] = savedConfig[loadedScheme];
|
workingConfig[loadedScheme] = savedConfig[loadedScheme];
|
||||||
paletteGrid->loadPalette(savedConfig[loadedScheme]);
|
paletteGrid->loadPalette(savedConfig[loadedScheme]);
|
||||||
// Restore the live theme before re-reading the grid: loadFonts resolves
|
// Restore the live theme before re-reading the grid: loadFonts resolves
|
||||||
|
|
@ -400,6 +403,9 @@ void PaletteEditorDialog::onReset()
|
||||||
themeManager->reloadCurrentTheme();
|
themeManager->reloadCurrentTheme();
|
||||||
fontGrid->loadFonts(savedFontConfig);
|
fontGrid->loadFonts(savedFontConfig);
|
||||||
fontsDirty = false;
|
fontsDirty = false;
|
||||||
|
if (hadFontPreview) {
|
||||||
|
themeManager->previewFonts(savedFontConfig);
|
||||||
|
}
|
||||||
seedAccentFromScheme(loadedScheme);
|
seedAccentFromScheme(loadedScheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ class FontGridWidget;
|
||||||
class QuickSetupPanel;
|
class QuickSetupPanel;
|
||||||
class QFrame;
|
class QFrame;
|
||||||
class QWidget;
|
class QWidget;
|
||||||
|
class QCloseEvent;
|
||||||
|
|
||||||
class PaletteEditorDialog : public QDialog
|
class PaletteEditorDialog : public QDialog
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -657,12 +657,23 @@ QFont ThemeManager::appFont(AppFont::Role role) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// Role fallbacks preserve the pre-theme defaults when no fonts.toml is
|
// Role fallbacks preserve the pre-theme defaults when no fonts.toml is
|
||||||
// present: an unset role resolves to the application font. Surfaces that
|
// present: chat logs rendered monospace (matching the report dialogs) and
|
||||||
// hardcoded a different family ask for it explicitly: counter painters
|
// every other role resolves to the app font. The surfaces that hardcoded a
|
||||||
// through cardTextFont(), the deck view headers and printed deck list
|
// different family ask for it explicitly: counter painters through
|
||||||
// through deckListFont(), the report dialogs through
|
// cardTextFont(), the deck view headers and printed deck list through
|
||||||
// report_utils::reportLogFont(). Only the family basis is fixed there;
|
// deckListFont(). Only the family basis is fixed there; sizes stay
|
||||||
// sizes stay caller-side.
|
// caller-side.
|
||||||
|
if (role == AppFont::ChatLog) {
|
||||||
|
// ChatView never set a font before the theme role existed, so an unset
|
||||||
|
// ChatLog must keep resolving to the application font. The report
|
||||||
|
// dialogs that used to hardcode monospace ask for it explicitly
|
||||||
|
// (report_utils::reportLogFont) instead of through this fallback.
|
||||||
|
return qApp->font();
|
||||||
|
}
|
||||||
|
// No per-role scaling: an unset role resolves to the application font, so
|
||||||
|
// with no fonts.toml present the result is identical to before. The counter
|
||||||
|
// painters that used to hardcode Serif ask for it through cardTextFont(),
|
||||||
|
// and the two deck-list sites that did through deckListFont().
|
||||||
return qApp->font();
|
return qApp->font();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue