mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +00:00
Get library version strings at runtime
We mostly use boost in header-only mode, so it is a non-trivial job to get the version string at runtime.
This commit is contained in:
parent
5127156ba4
commit
6c307774f1
@ -43,8 +43,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <boost/version.hpp>
|
#include <boost/version.hpp>
|
||||||
#include <openssl/opensslv.h>
|
|
||||||
#include <libtorrent/version.hpp>
|
#include <libtorrent/version.hpp>
|
||||||
|
#include <openssl/crypto.h>
|
||||||
|
#include <openssl/opensslv.h>
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
@ -445,29 +446,37 @@ QString Utils::Misc::boostVersionString()
|
|||||||
{
|
{
|
||||||
// static initialization for usage in signal handler
|
// static initialization for usage in signal handler
|
||||||
static const QString ver = QString("%1.%2.%3")
|
static const QString ver = QString("%1.%2.%3")
|
||||||
.arg(BOOST_VERSION / 100000)
|
.arg(QString::number(BOOST_VERSION / 100000)
|
||||||
.arg((BOOST_VERSION / 100) % 1000)
|
, QString::number((BOOST_VERSION / 100) % 1000)
|
||||||
.arg(BOOST_VERSION % 100);
|
, QString::number(BOOST_VERSION % 100));
|
||||||
return ver;
|
return ver;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Utils::Misc::libtorrentVersionString()
|
QString Utils::Misc::libtorrentVersionString()
|
||||||
{
|
{
|
||||||
// static initialization for usage in signal handler
|
// static initialization for usage in signal handler
|
||||||
static const QString ver = LIBTORRENT_VERSION;
|
#if (LIBTORRENT_VERSION_NUM < 10200)
|
||||||
return ver;
|
static const auto version {QString::fromLatin1(libtorrent::version())};
|
||||||
|
#else
|
||||||
|
static const auto version {QString::fromLatin1(lt::version())};
|
||||||
|
#endif
|
||||||
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Utils::Misc::opensslVersionString()
|
QString Utils::Misc::opensslVersionString()
|
||||||
{
|
{
|
||||||
const QString version {OPENSSL_VERSION_TEXT};
|
#if (OPENSSL_VERSION_NUMBER >= 0x1010000f)
|
||||||
|
static const auto version {QString::fromLatin1(OpenSSL_version(OPENSSL_VERSION))};
|
||||||
|
#else
|
||||||
|
static const auto version {QString::fromLatin1(SSLeay_version(SSLEAY_VERSION))};
|
||||||
|
#endif
|
||||||
return version.splitRef(' ', QString::SkipEmptyParts)[1].toString();
|
return version.splitRef(' ', QString::SkipEmptyParts)[1].toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Utils::Misc::zlibVersionString()
|
QString Utils::Misc::zlibVersionString()
|
||||||
{
|
{
|
||||||
// static initialization for usage in signal handler
|
// static initialization for usage in signal handler
|
||||||
static const QString version {ZLIB_VERSION};
|
static const auto version {QString::fromLatin1(zlibVersion())};
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user