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"
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"
43 #define SETTINGS_KEY(name) u"AboutDialog/" name
45 AboutDialog::AboutDialog(QWidget
*parent
)
47 , m_ui(new Ui::AboutDialog
)
48 , m_storeDialogSize(SETTINGS_KEY(u
"Size"_s
))
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));
58 const QString aboutText
=
59 u
"<p style=\"white-space: pre-wrap;\">"
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>"
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
)
73 , tr("Bug Tracker:"));
74 m_ui
->labelAbout
->setText(aboutText
);
76 m_ui
->labelMascot
->setPixmap(Utils::Gui::scaledPixmap(Path(u
":/icons/mascot.png"_s
)));
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()));
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()));
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()));
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())
116 AboutDialog::~AboutDialog()
118 m_storeDialogSize
= size();
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
);