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
|
|
@ -1,5 +1,6 @@
|
|||
#include "tab_report.h"
|
||||
|
||||
#include "../interface/theme_manager.h"
|
||||
#include "../server/user/user_context_menu.h"
|
||||
#include "../utility/report_utils.h"
|
||||
#include "abstract_client.h"
|
||||
|
|
@ -12,6 +13,7 @@
|
|||
#include <QComboBox>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QFont>
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QHBoxLayout>
|
||||
|
|
@ -137,7 +139,8 @@ TabReport::TabReport(TabSupervisor *_tabSupervisor, AbstractClient *_client) : T
|
|||
chatGroup = new QGroupBox;
|
||||
chatLogEdit = new QTextEdit;
|
||||
chatLogEdit->setReadOnly(true);
|
||||
chatLogEdit->setFont(QtUtils::monospaceFont());
|
||||
applyChatLogFont();
|
||||
connect(themeManager, &ThemeManager::fontsChanged, this, &TabReport::applyChatLogFont);
|
||||
auto *chatLayout = new QVBoxLayout(chatGroup);
|
||||
chatLayout->setContentsMargins(4, 4, 4, 4);
|
||||
chatLayout->addWidget(chatLogEdit);
|
||||
|
|
@ -269,6 +272,11 @@ TabReport::TabReport(TabSupervisor *_tabSupervisor, AbstractClient *_client) : T
|
|||
refreshList();
|
||||
}
|
||||
|
||||
void TabReport::applyChatLogFont()
|
||||
{
|
||||
chatLogEdit->setFont(report_utils::reportLogFont());
|
||||
}
|
||||
|
||||
void TabReport::retranslateUi()
|
||||
{
|
||||
userContextMenu->retranslateUi();
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ private slots:
|
|||
void statsResponse(const Response &response);
|
||||
void reopenReport();
|
||||
void reopenResponse(const Response &response);
|
||||
void applyChatLogFont();
|
||||
|
||||
private:
|
||||
int selectedReportId() const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue