Merge pull request #2311 from PhenomRetroShare/Add_qmake_info

Add qmake DEFINES and CONFIG in About Info to know how RS was compiled.
This commit is contained in:
defnax 2021-02-12 19:19:48 +01:00 committed by GitHub
commit 5dc2602b39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 73 additions and 52 deletions

View File

@ -21,6 +21,7 @@
#include "AboutDialog.h" #include "AboutDialog.h"
#include "HelpDialog.h" #include "HelpDialog.h"
#include "qmake_info.h"
#include "rshare.h" #include "rshare.h"
#ifdef RS_JSONAPI #ifdef RS_JSONAPI
@ -302,17 +303,13 @@ void AWidget::drawBitField()
p.end() ; p.end() ;
} }
AWidget::AWidget() { AWidget::AWidget()
setMouseTracking(true); : page(0), density(5)
, mImagesReady(false), mState(0), mTimerId(0)
density = 5; , mStep(1.0f), mMaxStep(QFontMetricsF(font()).width(' '))
page = 0; {
mMaxStep = QFontMetricsF(font()).width(' ') ; setMouseTracking(true);
mStep = 1.0f ; //startTimer(15);
mState = 0 ;
mImagesReady = false ;
// startTimer(15);
} }
void AWidget::computeNextState() void AWidget::computeNextState()
@ -937,62 +934,63 @@ static QString addLibraries(const std::string &name, const std::list<RsLibraryIn
void AboutWidget::on_copy_button_clicked() void AboutWidget::on_copy_button_clicked()
{ {
QString verInfo; QString verInfo;
QString rsVerString = "RetroShare Version: "; QString rsVerString = "RetroShare Version: ";
rsVerString+=Rshare::retroshareVersion(true); rsVerString+=Rshare::retroshareVersion(true);
verInfo+=rsVerString; verInfo+=rsVerString;
#ifdef RS_ONLYHIDDENNODE #ifdef RS_ONLYHIDDENNODE
verInfo+=" " + tr("Only Hidden Node"); verInfo+=" " + tr("Only Hidden Node");
#endif #endif
verInfo+="\n"; verInfo+="\n";
#if QT_VERSION >= QT_VERSION_CHECK (5, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK (5, 0, 0)
#if QT_VERSION >= QT_VERSION_CHECK (5, 4, 0) #if QT_VERSION >= QT_VERSION_CHECK (5, 4, 0)
verInfo+=QSysInfo::prettyProductName(); verInfo+=QSysInfo::prettyProductName();
#endif #endif
#else #else
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
verInfo+="Linux"; verInfo+="Linux";
#endif #endif
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
verInfo+="Windows"; verInfo+="Windows";
#endif #endif
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
verInfo+="Mac"; verInfo+="Mac";
#endif #endif
#endif #endif
verInfo+=" "; verInfo+=" ";
QString qtver = QString("QT ")+QT_VERSION_STR; QString qtver = QString("QT ")+QT_VERSION_STR;
verInfo+=qtver; verInfo+=qtver;
verInfo+="\n\n"; verInfo+="\n\n";
/* Add version numbers of libretroshare */ /* Add version numbers of libretroshare */
std::list<RsLibraryInfo> libraries; std::list<RsLibraryInfo> libraries;
RsControl::instance()->getLibraries(libraries); RsControl::instance()->getLibraries(libraries);
verInfo+=addLibraries("libretroshare", libraries); verInfo+=addLibraries("libretroshare", libraries);
#ifdef RS_JSONAPI #ifdef RS_JSONAPI
// Disabled because I could not find how to get restbed version number // Disabled because I could not find how to get restbed version number
// /* Add version numbers of RetroShare */ // /* Add version numbers of RetroShare */
// // Add versions here. Find a better place. // // Add versions here. Find a better place.
// libraries.clear(); // libraries.clear();
// libraries.push_back(RsLibraryInfo("RestBed", restbed::get_version())); // libraries.push_back(RsLibraryInfo("RestBed", restbed::get_version()));
// verInfo+=addLibraries("RetroShare", libraries); // verInfo+=addLibraries("RetroShare", libraries);
#endif #endif
/* Add version numbers of plugins */ /* Add version numbers of plugins */
if (rsPlugins) { if (rsPlugins) {
for (int i = 0; i < rsPlugins->nbPlugins(); ++i) { for (int i = 0; i < rsPlugins->nbPlugins(); ++i) {
RsPlugin *plugin = rsPlugins->plugin(i); RsPlugin *plugin = rsPlugins->plugin(i);
if (plugin) { if (plugin) {
libraries.clear(); libraries.clear();
plugin->getLibraries(libraries); plugin->getLibraries(libraries);
verInfo+=addLibraries(plugin->getPluginName(), libraries); verInfo+=addLibraries(plugin->getPluginName(), libraries);
} }
} }
} }
verInfo+= "DEFINES:" + Rs_qmake_DEFINES + "\n";
verInfo+= "CONFIG:" + Rs_qmake_CONFIG + "\n";
QApplication::clipboard()->setText(verInfo); QApplication::clipboard()->setText(verInfo);
} }

View File

@ -0,0 +1,8 @@
#ifndef INFO_H
#define INFO_H
#include <QString>
static const QString Rs_qmake_DEFINES = QStringLiteral(\"$$RS_QMAKE_DEFINES\");
static const QString Rs_qmake_CONFIG = QStringLiteral(\"$$RS_QMAKE_CONFIG\");
#endif // INFO_H

View File

@ -1514,3 +1514,18 @@ wikipoos {
gui/gxs/RsGxsUpdateBroadcastWidget.cpp \ gui/gxs/RsGxsUpdateBroadcastWidget.cpp \
gui/gxs/RsGxsUpdateBroadcastPage.cpp \ gui/gxs/RsGxsUpdateBroadcastPage.cpp \
} }
################################################################
#Define qmake_info.h file so GUI can get wath was used to compil
# This must be at end to get all informations
################################################################
RS_QMAKE_DEFINES=\\\"$${DEFINES}\\\"
RS_QMAKE_CONFIG=\\\"$${CONFIG}\\\"
INCLUDEPATH += $$OUT_PWD/include
info_file.input = $$PWD/qmake_info.h.in
info_file.output = $$OUT_PWD/include/qmake_info.h
QMAKE_SUBSTITUTES += info_file
OTHER_FILES += \
qmake_info.h.in