Browse Source

Add QBT_APP_64BIT define

Now we use QT_POINTER_SIZE to detect CPU bitness, it has the advantage of applicable to all CPU
architectures not limiting to x86 arch.
adaptive-webui-19844
Chocobo1 6 years ago
parent
commit
04227f5a41
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 23
      src/app/stacktracedialog.h
  2. 4
      src/base/bittorrent/session.cpp
  3. 4
      src/base/global.h
  4. 6
      src/gui/aboutdialog.h
  5. 4
      src/gui/advancedsettings.cpp

23
src/app/stacktracedialog.h

@ -50,7 +50,7 @@ public:
void setStacktraceString(const QString &sigName, const QString &trace) void setStacktraceString(const QString &sigName, const QString &trace)
{ {
// try to call Qt function as less as possible // try to call Qt function as less as possible
QString htmlStr = QString( const QString htmlStr = QString(
"<p align=center><b><font size=7 color=red>" "<p align=center><b><font size=7 color=red>"
"qBittorrent has crashed" "qBittorrent has crashed"
"</font></b></p>" "</font></b></p>"
@ -61,21 +61,18 @@ public:
"</p></font>" "</p></font>"
"<br/><hr><br/>" "<br/><hr><br/>"
"<p align=center><font size=4>" "<p align=center><font size=4>"
#if defined(__x86_64__) || defined(_M_X64) "qBittorrent version: " QBT_VERSION " (%1-bit)<br/>"
"qBittorrent version: " QBT_VERSION " (64-bit)<br/>" "Libtorrent version: %2<br/>"
#else
"qBittorrent version: " QBT_VERSION " (32-bit)<br/>"
#endif
"Libtorrent version: %1<br/>"
"Qt version: " QT_VERSION_STR "<br/>" "Qt version: " QT_VERSION_STR "<br/>"
"Boost version: %2<br/>" "Boost version: %3<br/>"
"OpenSSL version: %3<br/>" "OpenSSL version: %4<br/>"
"OS version: %4<br/><br/>" "OS version: %5<br/><br/>"
"Caught signal: %5" "Caught signal: %6"
"</font></p>" "</font></p>"
"<pre><code>%6</code></pre>" "<pre><code>%7</code></pre>"
"<br/><hr><br/><br/>") "<br/><hr><br/><br/>")
.arg(Utils::Misc::libtorrentVersionString() .arg(QString::number(QT_POINTER_SIZE * 8)
, Utils::Misc::libtorrentVersionString()
, Utils::Misc::boostVersionString() , Utils::Misc::boostVersionString()
, Utils::Misc::opensslVersionString() , Utils::Misc::opensslVersionString()
, Utils::Misc::osName() , Utils::Misc::osName()

4
src/base/bittorrent/session.cpp

@ -2777,7 +2777,7 @@ int Session::diskCacheSize() const
{ {
int size = m_diskCacheSize; int size = m_diskCacheSize;
// These macros may not be available on compilers other than MSVC and GCC // These macros may not be available on compilers other than MSVC and GCC
#if defined(__x86_64__) || defined(_M_X64) #ifdef QBT_APP_64BIT
size = qMin(size, 4096); // 4GiB size = qMin(size, 4096); // 4GiB
#else #else
// When build as 32bit binary, set the maximum at less than 2GB to prevent crashes // When build as 32bit binary, set the maximum at less than 2GB to prevent crashes
@ -2789,7 +2789,7 @@ int Session::diskCacheSize() const
void Session::setDiskCacheSize(int size) void Session::setDiskCacheSize(int size)
{ {
#if defined(__x86_64__) || defined(_M_X64) #ifdef QBT_APP_64BIT
size = qMin(size, 4096); // 4GiB size = qMin(size, 4096); // 4GiB
#else #else
// allocate 1536MiB and leave 512MiB to the rest of program data in RAM // allocate 1536MiB and leave 512MiB to the rest of program data in RAM

4
src/base/global.h

@ -31,6 +31,10 @@
#include <type_traits> #include <type_traits>
#include <QtGlobal> #include <QtGlobal>
#if (QT_POINTER_SIZE == 8)
#define QBT_APP_64BIT
#endif
const char C_TORRENT_FILE_EXTENSION[] = ".torrent"; const char C_TORRENT_FILE_EXTENSION[] = ".torrent";
template <typename T> template <typename T>

6
src/gui/aboutdialog.h

@ -48,11 +48,7 @@ public:
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
// Title // Title
#if defined(__x86_64__) || defined(_M_X64) labelName->setText(QString("<b><h2>qBittorrent " QBT_VERSION " (%1-bit)</h2></b>").arg(QT_POINTER_SIZE * 8));
labelName->setText("<b><h2>qBittorrent " QBT_VERSION " (64-bit)</h2></b>");
#else
labelName->setText("<b><h2>qBittorrent " QBT_VERSION " (32-bit)</h2></b>");
#endif
logo->setPixmap(Utils::Gui::scaledPixmapSvg(":/icons/skin/qbittorrent-tray.svg", this, 32)); logo->setPixmap(Utils::Gui::scaledPixmapSvg(":/icons/skin/qbittorrent-tray.svg", this, 32));

4
src/gui/advancedsettings.cpp

@ -325,7 +325,7 @@ void AdvancedSettings::loadAdvancedSettings()
// Checking Memory Usage // Checking Memory Usage
spinBoxCheckingMemUsage.setMinimum(1); spinBoxCheckingMemUsage.setMinimum(1);
// When build as 32bit binary, set the maximum value lower to prevent crashes. // When build as 32bit binary, set the maximum value lower to prevent crashes.
#if (QT_POINTER_SIZE == 8) #ifdef QBT_APP_64BIT
spinBoxCheckingMemUsage.setMaximum(1024); spinBoxCheckingMemUsage.setMaximum(1024);
#else #else
// Allocate at most 128MiB out of the remaining 512MiB (see the cache part below) // Allocate at most 128MiB out of the remaining 512MiB (see the cache part below)
@ -339,7 +339,7 @@ void AdvancedSettings::loadAdvancedSettings()
spinBoxCache.setMinimum(-1); spinBoxCache.setMinimum(-1);
// When build as 32bit binary, set the maximum at less than 2GB to prevent crashes. // When build as 32bit binary, set the maximum at less than 2GB to prevent crashes.
// These macros may not be available on compilers other than MSVC and GCC // These macros may not be available on compilers other than MSVC and GCC
#if defined(__x86_64__) || defined(_M_X64) #ifdef QBT_APP_64BIT
spinBoxCache.setMaximum(4096); spinBoxCache.setMaximum(4096);
#else #else
// allocate 1536MiB and leave 512MiB to the rest of program data in RAM // allocate 1536MiB and leave 512MiB to the rest of program data in RAM

Loading…
Cancel
Save