From 82703befa17961edf16a89279e94b7431190a1e8 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 9 Apr 2024 16:07:42 +0200 Subject: [PATCH] Core: Add "UI configuration" section to System Information "System Information..." provides the output of qtdiag. Among other info, it contains DPRs and font DPIs. With support of the DPI rounding policy, those values may deviate the IDE process. This makes the "System Information..." output in a bug report potentially lack relevant information. Also, the StyleHelper::UiElement* font may vary depending on DPR/DPI and other system settings. Since these fonts are used in the Welcome screen redesign, precise information of these fonts is missed in reports regarding the redesign. This change adds a "UI configuration" section to System Information. It contains most data from the "Environment -> Interface" settings page, and in addition a dump of all StyleHelper::UiElement fonts. Task-number: QTCREATORBUG-30579 Task-number: QTCREATORBUG-30637 Task-number: QTCREATORBUG-30650 Change-Id: Iff2c58903c5f8d5dbae4884b0521a8b85469b188 Reviewed-by: Reviewed-by: Eike Ziller --- src/plugins/coreplugin/icore.cpp | 47 +++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp index 1ed0987e5ab..8a727494c2d 100644 --- a/src/plugins/coreplugin/icore.cpp +++ b/src/plugins/coreplugin/icore.cpp @@ -1035,12 +1035,57 @@ void ICore::addPreCloseListener(const std::function &listener) d->m_preCloseListeners.append(listener); } +QString uiConfigInformation() +{ + QString info("UI configuration:\n\n"); + info.append(QString("Color: %1\n").arg(StyleHelper::requestedBaseColor().name())); + info.append(QString("Theme: %1 \"%2\"\n").arg(creatorTheme()->id()) + .arg(creatorTheme()->displayName())); + const QString toolbarStyle = + StyleHelper::toolbarStyle() == StyleHelper::ToolbarStyleCompact ? "Compact" : "Relaxed"; + info.append(QString("Toolbar style: Utils::StyleHelper::ToolbarStyle%1\n").arg(toolbarStyle)); + const QString policy = + QVariant::fromValue(QApplication::highDpiScaleFactorRoundingPolicy()).toString(); + QString userInterfaceLanguage = ICore::userInterfaceLanguage(); + if (userInterfaceLanguage.isEmpty()) + userInterfaceLanguage = QLocale::system().name() + " (System Language)"; + info.append(QString("Language: %1\n").arg(userInterfaceLanguage)); + info.append(QString("Device pixel ratio: %1, Qt::HighDpiScaleFactorRoundingPolicy::%2\n") + .arg(qApp->devicePixelRatio()).arg(policy)); + info.append(QString("Font DPI: %1\n").arg(qApp->fontMetrics().fontDpi())); + + info.append(QString("Utils::StyleHelper::UiElement:\n")); +#define QTC_ADD_UIELEMENT_FONT(uiElement) ( \ + info.append(QString(" %1: %2\n").arg(#uiElement) \ + .arg(StyleHelper::uiFont(StyleHelper::UiElement##uiElement).toString())) \ + ); + QTC_ADD_UIELEMENT_FONT(H1); + QTC_ADD_UIELEMENT_FONT(H2); + QTC_ADD_UIELEMENT_FONT(H3); + QTC_ADD_UIELEMENT_FONT(H4); + QTC_ADD_UIELEMENT_FONT(H5); + QTC_ADD_UIELEMENT_FONT(H6); + QTC_ADD_UIELEMENT_FONT(H6Capital); + QTC_ADD_UIELEMENT_FONT(Body1); + QTC_ADD_UIELEMENT_FONT(Body2); + QTC_ADD_UIELEMENT_FONT(ButtonMedium); + QTC_ADD_UIELEMENT_FONT(ButtonSmall); + QTC_ADD_UIELEMENT_FONT(CaptionStrong); + QTC_ADD_UIELEMENT_FONT(Caption); + QTC_ADD_UIELEMENT_FONT(IconStandard); + QTC_ADD_UIELEMENT_FONT(IconActive); +#undef QTC_ADD_UIELEMENT_FONT + + return info; +} + /*! \internal */ QString ICore::systemInformation() { - return PluginManager::systemInformation() + '\n' + aboutInformationCompact() + '\n'; + return PluginManager::systemInformation() + '\n' + uiConfigInformation() + '\n' + + aboutInformationCompact() + '\n'; } static const QString &screenShotsPath()