fix(gamescope): About UI

Signed-off-by: Collecting <collecting@noreply.localhost>
This commit is contained in:
Collecting
2026-01-05 06:30:24 +00:00
parent 8f3c9fde53
commit dffb9100e5

View File

@@ -13,47 +13,41 @@
#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);
}
ui = std::make_unique<Ui::AboutDialog>();
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
#ifdef CITRON_ENABLE_PGO_USE
citron_build_version += " | PGO";
#endif
#endif
if (is_gamescope) {
// Safe-zone sizing for the Deck
resize(850, 500);
resize(700, 450);
// 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 fonts up slightly so they aren't "too small"
QFont font = this->font();
font.setPointSize(font.pointSize() + 1);
this->setFont(font);
// 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;"));
// Keep the Citron header large
ui->labelCitron->setStyleSheet(QStringLiteral("font-size: 24pt; font-weight: bold;"));
}
const QIcon citron_logo = QIcon::fromTheme(QStringLiteral("org.citron_emu.citron"));
if (!citron_logo.isNull()) {
int logo_size = is_gamescope ? 160 : 200;
ui->labelLogo->setPixmap(citron_logo.pixmap(logo_size));
int logo_size = is_gamescope ? 150 : 200;
ui->labelLogo->setPixmap(citron_logo.pixmap(logo_size, logo_size));
ui->labelLogo->setScaledContents(true);
ui->labelLogo->setFixedSize(logo_size, logo_size);
}