From 16a72984778699cd2df655f5bd93503c824d6d43 Mon Sep 17 00:00:00 2001 From: Collecting Date: Mon, 5 Jan 2026 04:44:12 +0000 Subject: [PATCH] fix(gamescope): About UI Signed-off-by: Collecting --- src/citron/about_dialog.cpp | 43 +++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/src/citron/about_dialog.cpp b/src/citron/about_dialog.cpp index 36137b7ea..9b9d15019 100644 --- a/src/citron/about_dialog.cpp +++ b/src/citron/about_dialog.cpp @@ -2,6 +2,10 @@ // SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include +#include +#include +#include #include #include #include "common/scm_rev.h" @@ -9,25 +13,50 @@ #include "citron/about_dialog.h" AboutDialog::AboutDialog(QWidget* parent) - : QDialog(parent) { +: QDialog(parent) { const bool is_gamescope = !qgetenv("GAMESCOPE_WIDTH").isEmpty() || qgetenv("XDG_CURRENT_DESKTOP") == "gamescope"; if (is_gamescope) { setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint); + setWindowModality(Qt::NonModal); + } else { + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); } - std::string citron_build_version = "citron | 0.12.25"; -#ifdef CITRON_ENABLE_PGO_USE - citron_build_version += " | PGO"; -#endif - ui = std::make_unique(); ui->setupUi(this); + connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); + connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); + + std::string citron_build_version = "citron | 0.12.25"; + #ifdef CITRON_ENABLE_PGO_USE + citron_build_version += " | PGO"; + #endif + + if (is_gamescope) { + // Safe-zone sizing for the Deck + resize(850, 500); + + // Add padding so text doesn't hit the edges of the screen + if (this->layout()) { + this->layout()->setContentsMargins(24, 24, 24, 24); + this->layout()->setSpacing(12); + } + + // Scale the "citron" title slightly for the handheld screen + // without stripping the HTML colors/fonts + QString currentStyle = ui->labelCitron->styleSheet(); + ui->labelCitron->setStyleSheet(currentStyle + QStringLiteral("font-size: 22pt;")); + } + const QIcon citron_logo = QIcon::fromTheme(QStringLiteral("org.citron_emu.citron")); if (!citron_logo.isNull()) { - ui->labelLogo->setPixmap(citron_logo.pixmap(200)); + int logo_size = is_gamescope ? 160 : 200; + ui->labelLogo->setPixmap(citron_logo.pixmap(logo_size)); + ui->labelLogo->setFixedSize(logo_size, logo_size); } + ui->labelBuildInfo->setText( ui->labelBuildInfo->text().arg(QString::fromStdString(citron_build_version), QString::fromUtf8(Common::g_build_date).left(10)));