mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
add button to copy version info in first level about box
This commit is contained in:
parent
260da99955
commit
69d23a4982
@ -24,10 +24,15 @@
|
|||||||
#include "HelpDialog.h"
|
#include "HelpDialog.h"
|
||||||
#include "rshare.h"
|
#include "rshare.h"
|
||||||
|
|
||||||
|
#include <retroshare/rsiface.h>
|
||||||
|
#include <retroshare/rsplugin.h>
|
||||||
#include <retroshare/rsdisc.h>
|
#include <retroshare/rsdisc.h>
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
#include "settings/rsharesettings.h"
|
#include "settings/rsharesettings.h"
|
||||||
|
#include <microhttpd.h>
|
||||||
|
|
||||||
|
#include <QClipboard>
|
||||||
|
#include <QSysInfo>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QBrush>
|
#include <QBrush>
|
||||||
@ -721,3 +726,79 @@ NextPieceLabel::NextPieceLabel( QWidget* parent /* = 0*/ ) : QLabel(parent)
|
|||||||
setAlignment(Qt::AlignCenter);
|
setAlignment(Qt::AlignCenter);
|
||||||
setAutoFillBackground(true);
|
setAutoFillBackground(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QString addLibraries(const std::string &name, const std::list<RsLibraryInfo> &libraries)
|
||||||
|
{
|
||||||
|
QString mTextEdit;
|
||||||
|
mTextEdit+=QString::fromUtf8(name.c_str());
|
||||||
|
mTextEdit+="\n";
|
||||||
|
|
||||||
|
std::list<RsLibraryInfo>::const_iterator libraryIt;
|
||||||
|
for (libraryIt = libraries.begin(); libraryIt != libraries.end(); ++libraryIt) {
|
||||||
|
|
||||||
|
mTextEdit+=" - ";
|
||||||
|
mTextEdit+=QString::fromUtf8(libraryIt->mName.c_str());
|
||||||
|
mTextEdit+=": ";
|
||||||
|
mTextEdit+=QString::fromUtf8(libraryIt->mVersion.c_str());
|
||||||
|
mTextEdit+="\n";
|
||||||
|
}
|
||||||
|
mTextEdit+="\n";
|
||||||
|
return mTextEdit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AboutDialog::on_copy_button_clicked()
|
||||||
|
{
|
||||||
|
QString verInfo;
|
||||||
|
QString rsVerString = "RetroShare Version: ";
|
||||||
|
rsVerString+=Rshare::retroshareVersion(true);
|
||||||
|
verInfo+=rsVerString;
|
||||||
|
verInfo+="\n";
|
||||||
|
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK (5, 0, 0)
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK (5, 4, 0)
|
||||||
|
verInfo+=QSysInfo::prettyProductName();
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#ifdef Q_WS_X11
|
||||||
|
verInfo+="Linux";
|
||||||
|
#endif
|
||||||
|
#ifdef Q_WS_WIN
|
||||||
|
verInfo+="Windows";
|
||||||
|
#endif
|
||||||
|
#ifdef Q_WS_MACX
|
||||||
|
verInfo+="Mac";
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
verInfo+=" ";
|
||||||
|
QString qtver = QString("QT ")+QT_VERSION_STR;
|
||||||
|
verInfo+=qtver;
|
||||||
|
verInfo+="\n\n";
|
||||||
|
|
||||||
|
/* Add version numbers of libretroshare */
|
||||||
|
std::list<RsLibraryInfo> libraries;
|
||||||
|
RsControl::instance()->getLibraries(libraries);
|
||||||
|
verInfo+=addLibraries("libretroshare", libraries);
|
||||||
|
|
||||||
|
/* Add version numbers of RetroShare */
|
||||||
|
// Add versions here. Find a better place.
|
||||||
|
libraries.clear();
|
||||||
|
libraries.push_back(RsLibraryInfo("Libmicrohttpd", MHD_get_version()));
|
||||||
|
verInfo+=addLibraries("RetroShare", libraries);
|
||||||
|
|
||||||
|
/* Add version numbers of plugins */
|
||||||
|
if (rsPlugins) {
|
||||||
|
for (int i = 0; i < rsPlugins->nbPlugins(); ++i) {
|
||||||
|
RsPlugin *plugin = rsPlugins->plugin(i);
|
||||||
|
if (plugin) {
|
||||||
|
libraries.clear();
|
||||||
|
plugin->getLibraries(libraries);
|
||||||
|
verInfo+=addLibraries(plugin->getPluginName(), libraries);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QApplication::clipboard()->setText(verInfo);
|
||||||
|
}
|
||||||
|
@ -50,6 +50,8 @@ private slots:
|
|||||||
void sl_levelChanged(int);
|
void sl_levelChanged(int);
|
||||||
void on_help_button_clicked();
|
void on_help_button_clicked();
|
||||||
|
|
||||||
|
void on_copy_button_clicked();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void si_scoreChanged(QString);
|
void si_scoreChanged(QString);
|
||||||
void si_maxScoreChanged(QString);
|
void si_maxScoreChanged(QString);
|
||||||
|
@ -23,7 +23,16 @@
|
|||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="margin">
|
<property name="leftMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
<number>9</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
@ -52,6 +61,17 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="copy_button">
|
||||||
|
<property name="text">
|
||||||
|
<string>Copy Info</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="images.qrc">
|
||||||
|
<normaloff>:/images/copy.png</normaloff>:/images/copy.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@ -76,7 +96,9 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources>
|
||||||
|
<include location="images.qrc"/>
|
||||||
|
</resources>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
<sender>close_button</sender>
|
<sender>close_button</sender>
|
||||||
|
Loading…
Reference in New Issue
Block a user