2022-01-20 18:27:56 +00:00
|
|
|
// This file Copyright © 2009-2022 Mnemosyne LLC.
|
2022-02-07 16:25:02 +00:00
|
|
|
// It may be used under GPLv2 (SPDX: GPL-2.0-only), GPLv3 (SPDX: GPL-3.0-only),
|
2022-01-20 18:27:56 +00:00
|
|
|
// or any future license endorsed by Mnemosyne LLC.
|
|
|
|
// License text can be found in the licenses/ folder.
|
2009-04-09 18:55:47 +00:00
|
|
|
|
2014-12-12 21:47:22 +00:00
|
|
|
#include <QApplication>
|
|
|
|
#include <QIcon>
|
2009-04-26 19:08:49 +00:00
|
|
|
#include <QMessageBox>
|
|
|
|
#include <QPushButton>
|
2009-04-09 18:55:47 +00:00
|
|
|
|
|
|
|
#include <libtransmission/transmission.h>
|
|
|
|
#include <libtransmission/version.h>
|
|
|
|
|
2015-06-10 21:27:11 +00:00
|
|
|
#include "AboutDialog.h"
|
|
|
|
#include "LicenseDialog.h"
|
2021-01-24 17:43:14 +00:00
|
|
|
#include "Session.h"
|
2015-07-30 06:18:02 +00:00
|
|
|
#include "Utils.h"
|
2009-04-09 18:55:47 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
AboutDialog::AboutDialog(Session& session, QWidget* parent)
|
|
|
|
: BaseDialog(parent)
|
2009-04-09 18:55:47 +00:00
|
|
|
{
|
2020-05-27 21:53:12 +00:00
|
|
|
ui_.setupUi(this);
|
2013-01-26 01:19:54 +00:00
|
|
|
|
2020-11-02 01:13:32 +00:00
|
|
|
ui_.iconLabel->setPixmap(QApplication::windowIcon().pixmap(48));
|
2021-01-24 17:43:14 +00:00
|
|
|
|
|
|
|
if (session.isServer())
|
|
|
|
{
|
|
|
|
auto const title = QStringLiteral("<b style='font-size:x-large'>Transmission %1</b>")
|
2021-08-15 09:41:48 +00:00
|
|
|
.arg(QStringLiteral(LONG_VERSION_STRING));
|
2021-01-24 17:43:14 +00:00
|
|
|
ui_.titleLabel->setText(title);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
QString title = QStringLiteral(
|
|
|
|
"<div style='font-size:x-large; font-weight: bold; text-align: center'>Transmission</div>");
|
|
|
|
title += QStringLiteral("<div style='text-align: center'>%1: %2</div>")
|
2021-12-12 21:32:06 +00:00
|
|
|
.arg(tr("Client"))
|
2021-08-15 09:41:48 +00:00
|
|
|
.arg(QStringLiteral(LONG_VERSION_STRING));
|
2021-12-12 21:32:06 +00:00
|
|
|
title += QStringLiteral("<div style='text-align: center'>%1: %2</div>").arg(tr("Server")).arg(session.sessionVersion());
|
2021-01-24 17:43:14 +00:00
|
|
|
ui_.titleLabel->setText(title);
|
|
|
|
}
|
2013-01-26 01:19:54 +00:00
|
|
|
|
2020-11-02 01:13:32 +00:00
|
|
|
QPushButton const* b = ui_.dialogButtons->addButton(tr("C&redits"), QDialogButtonBox::ActionRole);
|
2020-10-31 18:56:12 +00:00
|
|
|
connect(b, &QAbstractButton::clicked, this, &AboutDialog::showCredits);
|
2013-01-26 01:19:54 +00:00
|
|
|
|
2020-05-27 21:53:12 +00:00
|
|
|
b = ui_.dialogButtons->addButton(tr("&License"), QDialogButtonBox::ActionRole);
|
2020-10-31 18:56:12 +00:00
|
|
|
connect(b, &QAbstractButton::clicked, this, &AboutDialog::showLicense);
|
2013-01-26 01:19:54 +00:00
|
|
|
|
2020-05-27 21:53:12 +00:00
|
|
|
ui_.dialogButtons->button(QDialogButtonBox::Close)->setDefault(true);
|
2009-04-09 18:55:47 +00:00
|
|
|
}
|
2009-04-26 19:08:49 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
void AboutDialog::showCredits()
|
2009-04-26 19:08:49 +00:00
|
|
|
{
|
2021-08-15 09:41:48 +00:00
|
|
|
QMessageBox::about(
|
|
|
|
this,
|
|
|
|
tr("Credits"),
|
|
|
|
QString::fromUtf8("Charles Kerr (Backend; Daemon; GTK+; Qt)\n"
|
2022-06-27 20:28:37 +00:00
|
|
|
"Mitchell Livingston (macOS)\n"
|
2021-08-15 09:41:48 +00:00
|
|
|
"Mike Gelfand\n"));
|
2009-04-26 19:08:49 +00:00
|
|
|
}
|
2015-07-30 06:18:02 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
void AboutDialog::showLicense()
|
2015-07-30 06:18:02 +00:00
|
|
|
{
|
2022-08-02 23:34:53 +00:00
|
|
|
Utils::openDialog(license_dialog_, this); // NOLINT clang-analyzer-cplusplus.NewDelete
|
2015-07-30 06:18:02 +00:00
|
|
|
}
|