src/platform/qt/AboutScreen.cpp (view raw)
1/* Copyright (c) 2013-2015 Jeffrey Pfau
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6#include "AboutScreen.h"
7
8extern "C" {
9#include "util/version.h"
10}
11
12#include <QPixmap>
13
14using namespace QGBA;
15
16AboutScreen::AboutScreen(QWidget* parent)
17 : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint)
18{
19 m_ui.setupUi(this);
20
21 QPixmap logo(":/res/mgba-1024.png");
22 logo = logo.scaled(m_ui.logo->minimumSize() * devicePixelRatio(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
23 logo.setDevicePixelRatio(devicePixelRatio());
24 m_ui.logo->setPixmap(logo);
25
26 QLatin1String tree(gitBranch);
27 if (tree == QLatin1String("(unknown)")) {
28 tree = QLatin1String(projectVersion);
29 }
30
31 m_ui.projectName->setText(QLatin1String(projectName));
32 m_ui.projectVersion->setText(QLatin1String(projectVersion));
33 QString gitInfo = m_ui.gitInfo->text();
34 gitInfo.replace("{gitBranch}", QLatin1String(gitBranch));
35 gitInfo.replace("{gitCommit}", QLatin1String(gitCommit));
36 m_ui.gitInfo->setText(gitInfo);
37 QString description = m_ui.description->text();
38 description.replace("{projectName}", QLatin1String(projectName));
39 m_ui.description->setText(description);
40 QString extraLinks = m_ui.extraLinks->text();
41 extraLinks.replace("{gitBranch}", tree);
42 m_ui.extraLinks->setText(extraLinks);
43}