yuzu/src/yuzu/about_dialog.cpp
Kyle K 8f3098fc1e about dialog: Fix the logo in a multiplatform way
The Icon was renamed in #8283 for Linux builds, and the fix proposed in #8312 would in turn break
the icon for Windows users.

I've decided to fix the aboutdialog.ui file via qtcreator.

I'm not sure its important to have the yuzu icon inside the About dialog grabbed from the local Qt theme,
but I've reword how the code works for that, and we can just delete those lines.

I've also thrown the yuzu.png through pngcrush to remove this warning
libpng warning: iCCP: known incorrect sRGB profile

Credit to abouvier for bringing bug up.
2022-05-16 05:42:38 -07:00

33 lines
1.3 KiB
C++

// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <QIcon>
#include <fmt/format.h>
#include "common/scm_rev.h"
#include "ui_aboutdialog.h"
#include "yuzu/about_dialog.h"
AboutDialog::AboutDialog(QWidget* parent)
: QDialog(parent), ui{std::make_unique<Ui::AboutDialog>()} {
const auto branch_name = std::string(Common::g_scm_branch);
const auto description = std::string(Common::g_scm_desc);
const auto build_id = std::string(Common::g_build_id);
const auto yuzu_build = fmt::format("yuzu Development Build | {}-{}", branch_name, description);
const auto override_build =
fmt::format(fmt::runtime(std::string(Common::g_title_bar_format_idle)), build_id);
const auto yuzu_build_version = override_build.empty() ? yuzu_build : override_build;
ui->setupUi(this);
// Try and request the icon from Qt theme (Linux?)
const QIcon yuzu_logo = QIcon::fromTheme(QStringLiteral("org.yuzu_emu.yuzu"));
if (!yuzu_logo.isNull()) {
ui->labelLogo->setPixmap(yuzu_logo.pixmap(200));
}
ui->labelBuildInfo->setText(
ui->labelBuildInfo->text().arg(QString::fromStdString(yuzu_build_version),
QString::fromUtf8(Common::g_build_date).left(10)));
}
AboutDialog::~AboutDialog() = default;