2017-10-09 08:35:48 +02:00
|
|
|
/*****************************************************************************
|
2018-05-24 22:32:00 +02:00
|
|
|
* gta5view Grand Theft Auto V Profile Viewer
|
2021-01-21 21:50:18 +01:00
|
|
|
* Copyright (C) 2016-2021 Syping
|
2017-10-09 08:35:48 +02:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2018-05-24 01:27:44 +02:00
|
|
|
#include <QDesktopServices>
|
2017-10-09 08:35:48 +02:00
|
|
|
#include <QStringBuilder>
|
2018-05-24 01:27:44 +02:00
|
|
|
#include <QMessageBox>
|
2017-10-09 08:35:48 +02:00
|
|
|
#include "AboutDialog.h"
|
|
|
|
#include "ui_AboutDialog.h"
|
|
|
|
#include "AppEnv.h"
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
AboutDialog::AboutDialog(QWidget *parent) :
|
|
|
|
QDialog(parent),
|
|
|
|
ui(new Ui::AboutDialog)
|
|
|
|
{
|
|
|
|
// Set Window Flags
|
|
|
|
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
|
|
|
|
|
|
|
|
// Build Strings
|
2021-01-21 21:54:15 +01:00
|
|
|
QString appVersion = QApplication::applicationVersion();
|
2021-01-21 21:50:18 +01:00
|
|
|
const char* literalBuildType = GTA5SYNC_BUILDTYPE;
|
|
|
|
const QString buildType = tr(literalBuildType);
|
2020-11-30 13:19:42 +01:00
|
|
|
const QString projectBuild = AppEnv::getBuildDateTime();
|
|
|
|
const QString buildStr = GTA5SYNC_BUILDSTRING;
|
2018-07-13 12:07:13 +02:00
|
|
|
#ifdef GTA5SYNC_COMMIT
|
2021-01-21 21:50:18 +01:00
|
|
|
if (literalBuildType == REL_BUILDTYPE && !appVersion.contains("-"))
|
2020-11-30 13:19:42 +01:00
|
|
|
appVersion = appVersion % "-" % GTA5SYNC_COMMIT;
|
2018-07-13 12:07:13 +02:00
|
|
|
#endif
|
2017-10-09 08:35:48 +02:00
|
|
|
|
|
|
|
// Translator Comments
|
|
|
|
//: Translated by translator, example Translated by Syping
|
2020-11-30 13:19:42 +01:00
|
|
|
const QString translatedByStr = tr("Translated by %1");
|
2018-01-16 22:28:37 +01:00
|
|
|
//: Insert your name here and profile here in following scheme, First Translator,First Profile\\nSecond Translator\\nThird Translator,Second Profile
|
2020-11-30 13:19:42 +01:00
|
|
|
const QString translatorVal = tr("TRANSLATOR");
|
2018-01-16 22:28:37 +01:00
|
|
|
QStringList translatorContent;
|
2020-11-30 13:19:42 +01:00
|
|
|
if (translatorVal != "TRANSLATOR") {
|
2018-01-16 22:28:37 +01:00
|
|
|
const QStringList translatorList = translatorVal.split('\n');
|
2020-11-30 13:19:42 +01:00
|
|
|
for (const QString &translatorStr : translatorList) {
|
2018-01-16 22:28:37 +01:00
|
|
|
QStringList translatorStrList = translatorStr.split(',');
|
2020-11-30 13:19:42 +01:00
|
|
|
const QString translatorName = translatorStrList.at(0);
|
2018-01-16 22:28:37 +01:00
|
|
|
translatorStrList.removeFirst();
|
|
|
|
QString translatorProfile = translatorStrList.join(QString());
|
2020-11-30 13:19:42 +01:00
|
|
|
if (!translatorProfile.isEmpty()) {
|
2018-01-16 22:28:37 +01:00
|
|
|
translatorContent += QString("<a href=\"%1\">%2</a>").arg(translatorProfile, translatorName);
|
|
|
|
}
|
2020-11-30 13:19:42 +01:00
|
|
|
else {
|
2018-01-16 22:28:37 +01:00
|
|
|
translatorContent += translatorName;
|
|
|
|
}
|
2017-10-09 08:35:48 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Project Description
|
2020-11-30 13:19:42 +01:00
|
|
|
const QString projectDes = tr("A project for viewing Grand Theft Auto V Snapmatic<br/>\nPictures and Savegames");
|
2017-10-09 08:35:48 +02:00
|
|
|
|
|
|
|
// Copyright Description
|
|
|
|
QString copyrightDes1 = tr("Copyright © <a href=\"%1\">%2</a> %3");
|
|
|
|
copyrightDes1 = copyrightDes1.arg(GTA5SYNC_APPVENDORLINK, GTA5SYNC_APPVENDOR, GTA5SYNC_COPYRIGHT);
|
|
|
|
QString copyrightDes2 = tr("%1 is licensed under <a href=\"https://www.gnu.org/licenses/gpl-3.0.html#content\">GNU GPLv3</a>");
|
|
|
|
copyrightDes2 = copyrightDes2.arg(GTA5SYNC_APPSTR);
|
|
|
|
QString copyrightDesA;
|
2020-11-30 13:19:42 +01:00
|
|
|
if (!translatorContent.isEmpty()) {
|
2018-01-16 22:28:37 +01:00
|
|
|
copyrightDesA = copyrightDes1 % "<br/>" % translatedByStr.arg(translatorContent.join(", ")) % "<br/>" % copyrightDes2;
|
2017-10-09 08:35:48 +02:00
|
|
|
}
|
2020-11-30 13:19:42 +01:00
|
|
|
else {
|
2017-10-09 08:35:48 +02:00
|
|
|
copyrightDesA = copyrightDes1 % "<br/>" % copyrightDes2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Setup User Interface
|
|
|
|
ui->setupUi(this);
|
|
|
|
aboutStr = ui->labAbout->text();
|
2020-11-30 13:19:42 +01:00
|
|
|
titleStr = windowTitle();
|
2017-10-09 08:35:48 +02:00
|
|
|
ui->labAbout->setText(aboutStr.arg(GTA5SYNC_APPSTR, projectDes, appVersion % " (" % buildType % ")", projectBuild, buildStr, qVersion(), copyrightDesA));
|
2020-11-30 13:19:42 +01:00
|
|
|
setWindowTitle(titleStr.arg(GTA5SYNC_APPSTR));
|
2017-10-09 08:35:48 +02:00
|
|
|
|
2018-01-11 08:41:00 +01:00
|
|
|
// Set Icon for Close Button
|
2020-11-30 13:19:42 +01:00
|
|
|
if (QIcon::hasThemeIcon("dialog-close")) {
|
2017-10-09 08:35:48 +02:00
|
|
|
ui->cmdClose->setIcon(QIcon::fromTheme("dialog-close"));
|
|
|
|
}
|
2020-11-30 13:19:42 +01:00
|
|
|
else if (QIcon::hasThemeIcon("gtk-close")) {
|
2018-01-11 08:41:00 +01:00
|
|
|
ui->cmdClose->setIcon(QIcon::fromTheme("gtk-close"));
|
|
|
|
}
|
2017-10-09 08:35:48 +02:00
|
|
|
|
|
|
|
// DPI calculation
|
|
|
|
qreal screenRatio = AppEnv::screenRatio();
|
2020-11-30 13:19:42 +01:00
|
|
|
if (!translatorContent.isEmpty()) {
|
2017-10-09 08:35:48 +02:00
|
|
|
resize(375 * screenRatio, 270 * screenRatio);
|
|
|
|
}
|
2020-11-30 13:19:42 +01:00
|
|
|
else {
|
2017-10-09 08:35:48 +02:00
|
|
|
resize(375 * screenRatio, 260 * screenRatio);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
AboutDialog::~AboutDialog()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
2018-05-24 01:27:44 +02:00
|
|
|
|
|
|
|
void AboutDialog::on_labAbout_linkActivated(const QString &link)
|
|
|
|
{
|
2020-11-30 13:19:42 +01:00
|
|
|
if (link.left(12) == "g5e://about?") {
|
2018-05-24 01:27:44 +02:00
|
|
|
QStringList aboutStrList = QString(link).remove(0, 12).split(":");
|
|
|
|
QMessageBox::information(this, QString::fromUtf8(QByteArray::fromBase64(aboutStrList.at(0).toUtf8())), QString::fromUtf8(QByteArray::fromBase64(aboutStrList.at(1).toUtf8())));
|
|
|
|
}
|
2020-11-30 13:19:42 +01:00
|
|
|
else {
|
2018-05-24 01:27:44 +02:00
|
|
|
QDesktopServices::openUrl(QUrl(link));
|
|
|
|
}
|
|
|
|
}
|