mirror of
https://git.citron-emu.org/citron/emulator
synced 2026-02-01 07:13:33 +00:00
fix(gamescope): About UI
Signed-off-by: Collecting <collecting@noreply.localhost>
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QVBoxLayout>
|
||||
#include <QIcon>
|
||||
#include <fmt/format.h>
|
||||
#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::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
|
||||
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)));
|
||||
|
||||
Reference in New Issue
Block a user