aboutsummaryrefslogtreecommitdiff
path: root/src/yuzu/about_dialog.cpp
blob: c8edb902685071a72c7626e07538ed17368ff4b8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#include "yuzu/about_dialog.h"
#include <QIcon>
#include "common/scm_rev.h"
#include "ui_aboutdialog.h"
#include <fmt/ranges.h>

AboutDialog::AboutDialog(QWidget* parent)
    : QDialog(parent)
    , ui{std::make_unique<Ui::AboutDialog>()}
{
    static const std::string description = std::string(Common::g_build_version);
    static const std::string build_id = std::string(Common::g_build_id);
    static const std::string compiler = std::string(Common::g_compiler_id);

    std::string yuzu_build;
    if (Common::g_is_dev_build) {
        yuzu_build = fmt::format("Eden Nightly | {}-{} | {}", description, build_id, compiler);
    } else {
        yuzu_build = fmt::format("Eden | {} | {}", description, compiler);
    }

    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;