From 0fdb1b3f535995df46ef3b470790a72ea1a87b8b Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Wed, 30 Aug 2023 15:11:02 +0800 Subject: [PATCH] Add button to copy library versions to clipboard Closes #18702. --- src/gui/aboutdialog.cpp | 15 +++++++++++++ src/gui/aboutdialog.h | 2 ++ src/gui/aboutdialog.ui | 50 ++++++++++++++++++++++++++++++----------- 3 files changed, 54 insertions(+), 13 deletions(-) diff --git a/src/gui/aboutdialog.cpp b/src/gui/aboutdialog.cpp index d2e2793e1..077f1aa6e 100644 --- a/src/gui/aboutdialog.cpp +++ b/src/gui/aboutdialog.cpp @@ -28,6 +28,8 @@ #include "aboutdialog.h" +#include + #include "base/global.h" #include "base/path.h" #include "base/unicodestrings.h" @@ -101,6 +103,8 @@ AboutDialog::AboutDialog(QWidget *parent) m_ui->labelOpensslVer->setText(Utils::Misc::opensslVersionString()); m_ui->labelZlibVer->setText(Utils::Misc::zlibVersionString()); + connect(m_ui->btnCopyToClipboard, &QAbstractButton::clicked, this, &AboutDialog::copyVersionsToClipboard); + const QString DBIPText = u"

" u"%1 (https://db-ip.com/)" u"

"_s @@ -117,3 +121,14 @@ AboutDialog::~AboutDialog() m_storeDialogSize = size(); delete m_ui; } + +void AboutDialog::copyVersionsToClipboard() const +{ + const QString versions = u"%1 %2\n%3 %4\n%5 %6\n%7 %8\n%9 %10\n"_s + .arg(m_ui->labelQt->text(), m_ui->labelQtVer->text() + , m_ui->labelLibt->text(), m_ui->labelLibtVer->text() + , m_ui->labelBoost->text(), m_ui->labelBoostVer->text() + , m_ui->labelOpenssl->text(), m_ui->labelOpensslVer->text() + , m_ui->labelZlib->text(), m_ui->labelZlibVer->text()); + qApp->clipboard()->setText(versions); +} diff --git a/src/gui/aboutdialog.h b/src/gui/aboutdialog.h index 2ac58617b..804933822 100644 --- a/src/gui/aboutdialog.h +++ b/src/gui/aboutdialog.h @@ -47,6 +47,8 @@ public: ~AboutDialog() override; private: + void copyVersionsToClipboard() const; + Ui::AboutDialog *m_ui = nullptr; SettingValue m_storeDialogSize; }; diff --git a/src/gui/aboutdialog.ui b/src/gui/aboutdialog.ui index 8b64e880d..e49099d9d 100644 --- a/src/gui/aboutdialog.ui +++ b/src/gui/aboutdialog.ui @@ -281,12 +281,12 @@ - - true - QTextEdit::NoWrap + + true + @@ -323,11 +323,35 @@ - - - qBittorrent was built with the following libraries: - - + + + + + qBittorrent was built with the following libraries: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Copy to clipboard + + + + @@ -359,7 +383,7 @@ - + Qt: @@ -372,7 +396,7 @@ - + Libtorrent: @@ -385,7 +409,7 @@ - + Boost: @@ -425,7 +449,7 @@ - + OpenSSL: @@ -445,7 +469,7 @@ - + zlib: