Browse Source

Create helper function to get boost version

adaptive-webui-19844
Chocobo1 9 years ago
parent
commit
12627bbc10
  1. 14
      src/app/stacktrace_win_dlg.h
  2. 11
      src/base/utils/misc.cpp
  3. 1
      src/base/utils/misc.h
  4. 4
      src/gui/about_imp.h

14
src/app/stacktrace_win_dlg.h

@ -32,7 +32,6 @@
#include <QString> #include <QString>
#include <QDialog> #include <QDialog>
#include "boost/version.hpp"
#include "libtorrent/version.hpp" #include "libtorrent/version.hpp"
#include "base/utils/misc.h" #include "base/utils/misc.h"
#include "ui_stacktrace_win_dlg.h" #include "ui_stacktrace_win_dlg.h"
@ -51,9 +50,6 @@ public:
void setStacktraceString(const QString& trace) void setStacktraceString(const QString& trace)
{ {
// try to call Qt function as less as possible // try to call Qt function as less as possible
const int boostVerMajor = BOOST_VERSION / 100000;
const int boostVerMinor = ((BOOST_VERSION / 100) % 1000);
const int boostVerSubMin = BOOST_VERSION % 100;
QString htmlStr = QString( 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"
@ -68,14 +64,12 @@ public:
"qBittorrent version: " VERSION "<br/>" "qBittorrent version: " VERSION "<br/>"
"Libtorrent version: " LIBTORRENT_VERSION "<br/>" "Libtorrent version: " LIBTORRENT_VERSION "<br/>"
"Qt version: " QT_VERSION_STR "<br/>" "Qt version: " QT_VERSION_STR "<br/>"
"Boost version: %1.%2.%3<br/>" "Boost version: %1<br/>"
"OS version: %4" "OS version: %2"
"</font></p><br/>" "</font></p><br/>"
"<pre><code>%5</code></pre>" "<pre><code>%3</code></pre>"
"<br/><hr><br/><br/>") "<br/><hr><br/><br/>")
.arg(boostVerMajor) .arg(Utils::Misc::boostVersionString())
.arg(boostVerMinor)
.arg(boostVerSubMin)
.arg(Utils::Misc::osName()) .arg(Utils::Misc::osName())
.arg(trace); .arg(trace);

11
src/base/utils/misc.cpp

@ -38,6 +38,7 @@
#include <QSettings> #include <QSettings>
#include <QThread> #include <QThread>
#include <QSysInfo> #include <QSysInfo>
#include <boost/version.hpp>
#ifdef DISABLE_GUI #ifdef DISABLE_GUI
#include <QCoreApplication> #include <QCoreApplication>
@ -650,3 +651,13 @@ QString Utils::Misc::osName()
#endif #endif
return name; return name;
} }
QString Utils::Misc::boostVersionString()
{
// static initialization for usage in signal handler
static const QString ver = QString("%1.%2.%3")
.arg(BOOST_VERSION / 100000)
.arg((BOOST_VERSION / 100) % 1000)
.arg(BOOST_VERSION % 100);
return ver;
}

1
src/base/utils/misc.h

@ -57,6 +57,7 @@ namespace Utils
QSize smallIconSize(); QSize smallIconSize();
#endif #endif
QString osName(); QString osName();
QString boostVersionString();
int pythonVersion(); int pythonVersion();
QString pythonExecutable(); QString pythonExecutable();

4
src/gui/about_imp.h

@ -34,7 +34,7 @@
#include "ui_about.h" #include "ui_about.h"
#include <QFile> #include <QFile>
#include <libtorrent/version.hpp> #include <libtorrent/version.hpp>
#include <boost/version.hpp> #include "base/utils/misc.h"
#include "base/unicodestrings.h" #include "base/unicodestrings.h"
class about: public QDialog, private Ui::AboutDlg class about: public QDialog, private Ui::AboutDlg
@ -92,7 +92,7 @@ public:
// Libraries // Libraries
label_11->setText(QT_VERSION_STR); label_11->setText(QT_VERSION_STR);
label_12->setText(LIBTORRENT_VERSION); label_12->setText(LIBTORRENT_VERSION);
label_13->setText(QString::number(BOOST_VERSION / 100000) + "." + QString::number((BOOST_VERSION / 100) % 1000) + "." + QString::number(BOOST_VERSION % 100)); label_13->setText(Utils::Misc::boostVersionString());
show(); show();
} }

Loading…
Cancel
Save