all repos — mgba @ 7c4df24bc76581a354dc56593caf5f879f1107e6

mGBA Game Boy Advance Emulator

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
 8#include "util/version.h"
 9
10#include <QPixmap>
11
12using namespace QGBA;
13
14AboutScreen::AboutScreen(QWidget* parent)
15	: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint)
16{
17	m_ui.setupUi(this);
18
19	QPixmap logo(":/res/mgba-1024.png");
20	logo = logo.scaled(m_ui.logo->minimumSize() * devicePixelRatio(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
21	logo.setDevicePixelRatio(devicePixelRatio());
22	m_ui.logo->setPixmap(logo);
23
24	QLatin1String tree(gitBranch);
25	if (tree == QLatin1String("(unknown)")) {
26		tree = QLatin1String(projectVersion);
27	}
28
29	m_ui.projectName->setText(QLatin1String(projectName));
30	m_ui.projectVersion->setText(QLatin1String(projectVersion));
31	QString gitInfo = m_ui.gitInfo->text();
32	gitInfo.replace("{gitBranch}", QLatin1String(gitBranch));
33	gitInfo.replace("{gitCommit}", QLatin1String(gitCommit));
34	m_ui.gitInfo->setText(gitInfo);
35	QString description = m_ui.description->text();
36	description.replace("{projectName}", QLatin1String(projectName));
37	m_ui.description->setText(description);
38	QString extraLinks = m_ui.extraLinks->text();
39	extraLinks.replace("{gitBranch}", tree);
40	m_ui.extraLinks->setText(extraLinks);
41}