WebAPI: Fix incorrect key in torrent creator
[qBittorrent.git] / src / gui / aboutdialog.cpp
blobbc1be50a358a26a6faf95b95637631b453d84082
1 /*
2 * Bittorrent Client using Qt and libtorrent.
3 * Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 * In addition, as a special exception, the copyright holders give permission to
20 * link this program with the OpenSSL project's "OpenSSL" library (or with
21 * modified versions of it that use the same license as the "OpenSSL" library),
22 * and distribute the linked executables. You must obey the GNU General Public
23 * License in all respects for all of the code used other than "OpenSSL". If you
24 * modify file(s), you may extend this exception to your version of the file(s),
25 * but you are not obligated to do so. If you do not wish to do so, delete this
26 * exception statement from your version.
29 #include "aboutdialog.h"
31 #include <QClipboard>
33 #include "base/global.h"
34 #include "base/path.h"
35 #include "base/unicodestrings.h"
36 #include "base/utils/io.h"
37 #include "base/utils/misc.h"
38 #include "base/version.h"
39 #include "ui_aboutdialog.h"
40 #include "uithememanager.h"
41 #include "utils.h"
43 #define SETTINGS_KEY(name) u"AboutDialog/" name
45 AboutDialog::AboutDialog(QWidget *parent)
46 : QDialog(parent)
47 , m_ui(new Ui::AboutDialog)
48 , m_storeDialogSize(SETTINGS_KEY(u"Size"_s))
50 m_ui->setupUi(this);
52 // Title
53 m_ui->labelName->setText(QStringLiteral("<b><h2>qBittorrent " QBT_VERSION " (%1-bit)</h2></b>").arg(QT_POINTER_SIZE * 8));
55 m_ui->logo->setPixmap(UIThemeManager::instance()->getScaledPixmap(u"qbittorrent-tray"_s, 32));
57 // About
58 const QString aboutText =
59 u"<p style=\"white-space: pre-wrap;\">"
60 u"%1\n\n"
61 u"%2\n\n"
62 u"<table>"
63 u"<tr><td>%3</td><td><a href=\"https://www.qbittorrent.org\">https://www.qbittorrent.org</a></td></tr>"
64 u"<tr><td>%4</td><td><a href=\"https://forum.qbittorrent.org\">https://forum.qbittorrent.org</a></td></tr>"
65 u"<tr><td>%5</td><td><a href=\"https://bugs.qbittorrent.org\">https://bugs.qbittorrent.org</a></td></tr>"
66 u"</table>"
67 u"</p>"_s
68 .arg(tr("An advanced BitTorrent client programmed in C++, based on Qt toolkit and libtorrent-rasterbar.")
69 .replace(u"C++"_s, u"C\u2060+\u2060+"_s) // make C++ non-breaking
70 , tr("Copyright %1 2006-2024 The qBittorrent project").arg(C_COPYRIGHT)
71 , tr("Home Page:")
72 , tr("Forum:")
73 , tr("Bug Tracker:"));
74 m_ui->labelAbout->setText(aboutText);
76 m_ui->labelMascot->setPixmap(Utils::Gui::scaledPixmap(Path(u":/icons/mascot.png"_s)));
78 // Thanks
79 if (const auto readResult = Utils::IO::readFile(Path(u":/thanks.html"_s), -1, QIODevice::Text))
81 m_ui->textBrowserThanks->setHtml(QString::fromUtf8(readResult.value()));
84 // Translation
85 if (const auto readResult = Utils::IO::readFile(Path(u":/translators.html"_s), -1, QIODevice::Text))
87 m_ui->textBrowserTranslation->setHtml(QString::fromUtf8(readResult.value()));
90 // License
91 if (const auto readResult = Utils::IO::readFile(Path(u":/gpl.html"_s), -1, QIODevice::Text))
93 m_ui->textBrowserLicense->setHtml(QString::fromUtf8(readResult.value()));
96 // Software Used
97 m_ui->labelQtVer->setText(QStringLiteral(QT_VERSION_STR));
98 m_ui->labelLibtVer->setText(Utils::Misc::libtorrentVersionString());
99 m_ui->labelBoostVer->setText(Utils::Misc::boostVersionString());
100 m_ui->labelOpensslVer->setText(Utils::Misc::opensslVersionString());
101 m_ui->labelZlibVer->setText(Utils::Misc::zlibVersionString());
103 connect(m_ui->btnCopyToClipboard, &QAbstractButton::clicked, this, &AboutDialog::copyVersionsToClipboard);
105 const QString DBIPText = u"<html><head/><body><p>"
106 u"%1 (<a href=\"https://db-ip.com/\">https://db-ip.com/</a>)"
107 u"</p></body></html>"_s
108 .arg(tr("The free IP to Country Lite database by DB-IP is used for resolving the countries of peers. "
109 "The database is licensed under the Creative Commons Attribution 4.0 International License"));
110 m_ui->labelDBIP->setText(DBIPText);
112 if (const QSize dialogSize = m_storeDialogSize; dialogSize.isValid())
113 resize(dialogSize);
116 AboutDialog::~AboutDialog()
118 m_storeDialogSize = size();
119 delete m_ui;
122 void AboutDialog::copyVersionsToClipboard() const
124 const QString versions = u"%1 %2\n%3 %4\n%5 %6\n%7 %8\n%9 %10\n"_s
125 .arg(m_ui->labelQt->text(), m_ui->labelQtVer->text()
126 , m_ui->labelLibt->text(), m_ui->labelLibtVer->text()
127 , m_ui->labelBoost->text(), m_ui->labelBoostVer->text()
128 , m_ui->labelOpenssl->text(), m_ui->labelOpensslVer->text()
129 , m_ui->labelZlib->text(), m_ui->labelZlibVer->text());
130 qApp->clipboard()->setText(versions);