1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-02-22 14:10:34 +00:00
transmission/qt/AboutDialog.cc
Charles Kerr 1f28470cf4
chore: prefer QStringLiteral (#1284)
Further reading:
* https://forum.qt.io/topic/78540/qstringliteral-vs-qlatin1string/2
* https://woboq.com/blog/qstringliteral.html
* https://www.qt.io/blog/2014/06/13/qt-weekly-13-qstringliteral

tl;dr: QLatin1Literal uses less memory than QStringLiteral; however,
since most Qt APIs require a QString argument, there's extra runtime
cost of converting QLatin1Strings to QStrings. QStringLiteral uses a
little more memory but constructs its QStrings at compile time.

ok, the `prefer-qstringliteral` branch is getting out of control: the
secondary goal of fixing a .clang-tidy issue is causing more diffs
than the primary goal. So, I'm breaking it into two separate PRs.
2020-05-29 12:40:07 -05:00

51 lines
1.4 KiB
C++

/*
* This file Copyright (C) 2009-2015 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3
* or any future license endorsed by Mnemosyne LLC.
*
*/
#include <QApplication>
#include <QIcon>
#include <QMessageBox>
#include <QPushButton>
#include <libtransmission/transmission.h>
#include <libtransmission/version.h>
#include "AboutDialog.h"
#include "LicenseDialog.h"
#include "Utils.h"
AboutDialog::AboutDialog(QWidget* parent) :
BaseDialog(parent)
{
ui_.setupUi(this);
ui_.iconLabel->setPixmap(qApp->windowIcon().pixmap(48));
ui_.titleLabel->setText(tr("<b style='font-size:x-large'>Transmission %1</b>").arg(QStringLiteral(LONG_VERSION_STRING)));
QPushButton* b;
b = ui_.dialogButtons->addButton(tr("C&redits"), QDialogButtonBox::ActionRole);
connect(b, SIGNAL(clicked()), this, SLOT(showCredits()));
b = ui_.dialogButtons->addButton(tr("&License"), QDialogButtonBox::ActionRole);
connect(b, SIGNAL(clicked()), this, SLOT(showLicense()));
ui_.dialogButtons->button(QDialogButtonBox::Close)->setDefault(true);
}
void AboutDialog::showCredits()
{
QMessageBox::about(this, tr("Credits"), QString::fromUtf8(
"Charles Kerr (Backend; Daemon; GTK+; Qt)\n"
"Mitchell Livingston (OS X)\n"
"Mike Gelfand\n"));
}
void AboutDialog::showLicense()
{
Utils::openDialog(license_dialog_, this);
}