Browse Source

Add button to copy library versions to clipboard

Closes #18702.
adaptive-webui-19844
Chocobo1 1 year ago
parent
commit
0fdb1b3f53
  1. 15
      src/gui/aboutdialog.cpp
  2. 2
      src/gui/aboutdialog.h
  3. 40
      src/gui/aboutdialog.ui

15
src/gui/aboutdialog.cpp

@ -28,6 +28,8 @@
#include "aboutdialog.h" #include "aboutdialog.h"
#include <QClipboard>
#include "base/global.h" #include "base/global.h"
#include "base/path.h" #include "base/path.h"
#include "base/unicodestrings.h" #include "base/unicodestrings.h"
@ -101,6 +103,8 @@ AboutDialog::AboutDialog(QWidget *parent)
m_ui->labelOpensslVer->setText(Utils::Misc::opensslVersionString()); m_ui->labelOpensslVer->setText(Utils::Misc::opensslVersionString());
m_ui->labelZlibVer->setText(Utils::Misc::zlibVersionString()); m_ui->labelZlibVer->setText(Utils::Misc::zlibVersionString());
connect(m_ui->btnCopyToClipboard, &QAbstractButton::clicked, this, &AboutDialog::copyVersionsToClipboard);
const QString DBIPText = u"<html><head/><body><p>" const QString DBIPText = u"<html><head/><body><p>"
u"%1 (<a href=\"https://db-ip.com/\">https://db-ip.com/</a>)" u"%1 (<a href=\"https://db-ip.com/\">https://db-ip.com/</a>)"
u"</p></body></html>"_s u"</p></body></html>"_s
@ -117,3 +121,14 @@ AboutDialog::~AboutDialog()
m_storeDialogSize = size(); m_storeDialogSize = size();
delete m_ui; 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);
}

2
src/gui/aboutdialog.h

@ -47,6 +47,8 @@ public:
~AboutDialog() override; ~AboutDialog() override;
private: private:
void copyVersionsToClipboard() const;
Ui::AboutDialog *m_ui = nullptr; Ui::AboutDialog *m_ui = nullptr;
SettingValue<QSize> m_storeDialogSize; SettingValue<QSize> m_storeDialogSize;
}; };

40
src/gui/aboutdialog.ui

@ -281,12 +281,12 @@
</property> </property>
<item> <item>
<widget class="QTextBrowser" name="textBrowserTranslation"> <widget class="QTextBrowser" name="textBrowserTranslation">
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="lineWrapMode"> <property name="lineWrapMode">
<enum>QTextEdit::NoWrap</enum> <enum>QTextEdit::NoWrap</enum>
</property> </property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -322,6 +322,8 @@
<string>Software Used</string> <string>Software Used</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="SoftwareUsedTabLayout"> <layout class="QVBoxLayout" name="SoftwareUsedTabLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
@ -329,6 +331,28 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btnCopyToClipboard">
<property name="text">
<string>Copy to clipboard</string>
</property>
</widget>
</item>
</layout>
</item>
<item> <item>
<widget class="Line" name="line_2"> <widget class="Line" name="line_2">
<property name="orientation"> <property name="orientation">
@ -359,7 +383,7 @@
</spacer> </spacer>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="labelQt">
<property name="text"> <property name="text">
<string notr="true">Qt:</string> <string notr="true">Qt:</string>
</property> </property>
@ -372,7 +396,7 @@
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QLabel" name="label_9"> <widget class="QLabel" name="labelLibt">
<property name="text"> <property name="text">
<string notr="true">Libtorrent:</string> <string notr="true">Libtorrent:</string>
</property> </property>
@ -385,7 +409,7 @@
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="QLabel" name="label_10"> <widget class="QLabel" name="labelBoost">
<property name="text"> <property name="text">
<string notr="true">Boost:</string> <string notr="true">Boost:</string>
</property> </property>
@ -425,7 +449,7 @@
</spacer> </spacer>
</item> </item>
<item row="3" column="1"> <item row="3" column="1">
<widget class="QLabel" name="label_11"> <widget class="QLabel" name="labelOpenssl">
<property name="text"> <property name="text">
<string notr="true">OpenSSL:</string> <string notr="true">OpenSSL:</string>
</property> </property>
@ -445,7 +469,7 @@
</widget> </widget>
</item> </item>
<item row="4" column="1"> <item row="4" column="1">
<widget class="QLabel" name="label_12"> <widget class="QLabel" name="labelZlib">
<property name="text"> <property name="text">
<string notr="true">zlib:</string> <string notr="true">zlib:</string>
</property> </property>

Loading…
Cancel
Save