Browse Source

Use simpler DEFINE for detecting Qt5 so moc will work too.

adaptive-webui-19844
sledgehammer999 9 years ago
parent
commit
17ac4b90be
  1. 2
      src/app/application.cpp
  2. 2
      src/app/main.cpp
  3. 6
      src/core/http/requestparser.cpp
  4. 2
      src/core/http/server.cpp
  5. 2
      src/core/http/server.h
  6. 4
      src/core/net/dnsupdater.cpp
  7. 6
      src/core/net/private/geoipdatabase.cpp
  8. 36
      src/core/preferences.cpp
  9. 6
      src/core/utils/fs.cpp
  10. 4
      src/gui/ico.cpp
  11. 6
      src/gui/lineedit/src/lineedit.cpp
  12. 4
      src/gui/lineedit/src/lineedit.h
  13. 2
      src/gui/options_imp.cpp
  14. 4
      src/gui/previewlistdelegate.h
  15. 4
      src/gui/previewselect.cpp
  16. 2
      src/gui/properties/peersadditiondlg.cpp
  17. 2
      src/gui/properties/propertieswidget.cpp
  18. 4
      src/gui/properties/proplistdelegate.cpp
  19. 4
      src/gui/properties/trackerlist.cpp
  20. 4
      src/gui/torrentcontenttreeview.cpp
  21. 4
      src/gui/transferlistdelegate.cpp
  22. 4
      src/gui/transferlistwidget.cpp
  23. 4
      src/searchengine/engineselectdlg.cpp
  24. 4
      src/searchengine/searchtab.cpp
  25. 1
      src/src.pro
  26. 2
      src/webui/abstractwebapplication.cpp
  27. 10
      src/webui/btjson.cpp
  28. 6
      src/webui/jsonutils.h

2
src/app/application.cpp

@ -357,7 +357,7 @@ void Application::initializeTranslation()
} }
if (m_qtTranslator.load( if (m_qtTranslator.load(
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
QString::fromUtf8("qtbase_") + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath)) || QString::fromUtf8("qtbase_") + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath)) ||
m_qtTranslator.load( m_qtTranslator.load(
#endif #endif

2
src/app/main.cpp

@ -42,7 +42,7 @@
#include <QSplashScreen> #include <QSplashScreen>
#ifdef QBT_STATIC_QT #ifdef QBT_STATIC_QT
#include <QtPlugin> #include <QtPlugin>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
Q_IMPORT_PLUGIN(QICOPlugin) Q_IMPORT_PLUGIN(QICOPlugin)
#else #else
Q_IMPORT_PLUGIN(qico) Q_IMPORT_PLUGIN(qico)

6
src/core/http/requestparser.cpp

@ -31,7 +31,7 @@
#include <QStringList> #include <QStringList>
#include <QUrl> #include <QUrl>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
#include <QUrlQuery> #include <QUrlQuery>
#endif #endif
#include <QDir> #include <QDir>
@ -117,7 +117,7 @@ bool RequestParser::parseStartingLine(const QString &line)
m_request.path = url.path(); // Path m_request.path = url.path(); // Path
// Parse GET parameters // Parse GET parameters
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) #ifndef QBT_USES_QT5
QListIterator<QPair<QString, QString> > i(url.queryItems()); QListIterator<QPair<QString, QString> > i(url.queryItems());
#else #else
QListIterator<QPair<QString, QString> > i(QUrlQuery(url).queryItems()); QListIterator<QPair<QString, QString> > i(QUrlQuery(url).queryItems());
@ -216,7 +216,7 @@ bool RequestParser::parseContent(const QByteArray& data)
// Parse url-encoded POST data // Parse url-encoded POST data
if (m_request.headers["content-type"].startsWith("application/x-www-form-urlencoded")) { if (m_request.headers["content-type"].startsWith("application/x-www-form-urlencoded")) {
QUrl url; QUrl url;
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) #ifndef QBT_USES_QT5
url.setEncodedQuery(data); url.setEncodedQuery(data);
QListIterator<QPair<QString, QString> > i(url.queryItems()); QListIterator<QPair<QString, QString> > i(url.queryItems());
#else #else

2
src/core/http/server.cpp

@ -67,7 +67,7 @@ void Server::disableHttps()
} }
#endif #endif
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
void Server::incomingConnection(qintptr socketDescriptor) void Server::incomingConnection(qintptr socketDescriptor)
#else #else
void Server::incomingConnection(int socketDescriptor) void Server::incomingConnection(int socketDescriptor)

2
src/core/http/server.h

@ -59,7 +59,7 @@ namespace Http
#endif #endif
private: private:
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
void incomingConnection(qintptr socketDescriptor); void incomingConnection(qintptr socketDescriptor);
#else #else
void incomingConnection(int socketDescriptor); void incomingConnection(int socketDescriptor);

4
src/core/net/dnsupdater.cpp

@ -32,7 +32,7 @@
#include <QDebug> #include <QDebug>
#include <QRegExp> #include <QRegExp>
#include <QStringList> #include <QStringList>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
#include <QUrlQuery> #include <QUrlQuery>
#endif #endif
@ -160,7 +160,7 @@ QUrl DNSUpdater::getUpdateUrl() const
} }
url.setPath("/nic/update"); url.setPath("/nic/update");
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) #ifndef QBT_USES_QT5
url.addQueryItem("hostname", m_domain); url.addQueryItem("hostname", m_domain);
url.addQueryItem("myip", m_lastIP.toString()); url.addQueryItem("myip", m_lastIP.toString());
#else #else

6
src/core/net/private/geoipdatabase.cpp

@ -66,7 +66,7 @@ namespace
Float = 15 Float = 15
}; };
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) #ifndef QBT_USES_QT5
Q_IPV6ADDR createMappedAddress(quint32 ip4); Q_IPV6ADDR createMappedAddress(quint32 ip4);
#endif #endif
} }
@ -166,7 +166,7 @@ QDateTime GeoIPDatabase::buildEpoch() const
QString GeoIPDatabase::lookup(const QHostAddress &hostAddr) const QString GeoIPDatabase::lookup(const QHostAddress &hostAddr) const
{ {
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) #ifndef QBT_USES_QT5
Q_IPV6ADDR addr = hostAddr.protocol() == QAbstractSocket::IPv4Protocol Q_IPV6ADDR addr = hostAddr.protocol() == QAbstractSocket::IPv4Protocol
? createMappedAddress(hostAddr.toIPv4Address()) ? createMappedAddress(hostAddr.toIPv4Address())
: hostAddr.toIPv6Address(); : hostAddr.toIPv6Address();
@ -499,7 +499,7 @@ QVariant GeoIPDatabase::readArrayValue(quint32 &offset, quint32 count) const
namespace namespace
{ {
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) #ifndef QBT_USES_QT5
Q_IPV6ADDR createMappedAddress(quint32 ip4) Q_IPV6ADDR createMappedAddress(quint32 ip4)
{ {
Q_IPV6ADDR ip6; Q_IPV6ADDR ip6;

36
src/core/preferences.cpp

@ -1976,7 +1976,7 @@ void Preferences::setTrayIconStyle(TrayIcon::Style style)
// in the same file. // in the same file.
QByteArray Preferences::getAddNewTorrentDialogState() const QByteArray Preferences::getAddNewTorrentDialogState() const
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
return value("AddNewTorrentDialog/qt5/treeHeaderState").toByteArray(); return value("AddNewTorrentDialog/qt5/treeHeaderState").toByteArray();
#else #else
return value("AddNewTorrentDialog/treeHeaderState").toByteArray(); return value("AddNewTorrentDialog/treeHeaderState").toByteArray();
@ -1985,7 +1985,7 @@ QByteArray Preferences::getAddNewTorrentDialogState() const
void Preferences::setAddNewTorrentDialogState(const QByteArray &state) void Preferences::setAddNewTorrentDialogState(const QByteArray &state)
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
setValue("AddNewTorrentDialog/qt5/treeHeaderState", state); setValue("AddNewTorrentDialog/qt5/treeHeaderState", state);
#else #else
setValue("AddNewTorrentDialog/treeHeaderState", state); setValue("AddNewTorrentDialog/treeHeaderState", state);
@ -2074,7 +2074,7 @@ void Preferences::setMainGeometry(const QByteArray &geometry)
QByteArray Preferences::getMainVSplitterState() const QByteArray Preferences::getMainVSplitterState() const
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
return value("MainWindow/qt5/vsplitterState").toByteArray(); return value("MainWindow/qt5/vsplitterState").toByteArray();
#else #else
return value("MainWindow/vsplitterState").toByteArray(); return value("MainWindow/vsplitterState").toByteArray();
@ -2083,7 +2083,7 @@ QByteArray Preferences::getMainVSplitterState() const
void Preferences::setMainVSplitterState(const QByteArray &state) void Preferences::setMainVSplitterState(const QByteArray &state)
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
setValue("MainWindow/qt5/vsplitterState", state); setValue("MainWindow/qt5/vsplitterState", state);
#else #else
setValue("MainWindow/vsplitterState", state); setValue("MainWindow/vsplitterState", state);
@ -2134,7 +2134,7 @@ void Preferences::setPrefHSplitterSizes(const QStringList &sizes)
QByteArray Preferences::getPeerListState() const QByteArray Preferences::getPeerListState() const
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
return value("TorrentProperties/Peers/qt5/PeerListState").toByteArray(); return value("TorrentProperties/Peers/qt5/PeerListState").toByteArray();
#else #else
return value("TorrentProperties/Peers/PeerListState").toByteArray(); return value("TorrentProperties/Peers/PeerListState").toByteArray();
@ -2143,7 +2143,7 @@ QByteArray Preferences::getPeerListState() const
void Preferences::setPeerListState(const QByteArray &state) void Preferences::setPeerListState(const QByteArray &state)
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
setValue("TorrentProperties/Peers/qt5/PeerListState", state); setValue("TorrentProperties/Peers/qt5/PeerListState", state);
#else #else
setValue("TorrentProperties/Peers/PeerListState", state); setValue("TorrentProperties/Peers/PeerListState", state);
@ -2162,7 +2162,7 @@ void Preferences::setPropSplitterSizes(const QString &sizes)
QByteArray Preferences::getPropFileListState() const QByteArray Preferences::getPropFileListState() const
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
return value("TorrentProperties/qt5/FilesListState").toByteArray(); return value("TorrentProperties/qt5/FilesListState").toByteArray();
#else #else
return value("TorrentProperties/FilesListState").toByteArray(); return value("TorrentProperties/FilesListState").toByteArray();
@ -2171,7 +2171,7 @@ QByteArray Preferences::getPropFileListState() const
void Preferences::setPropFileListState(const QByteArray &state) void Preferences::setPropFileListState(const QByteArray &state)
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
setValue("TorrentProperties/qt5/FilesListState", state); setValue("TorrentProperties/qt5/FilesListState", state);
#else #else
setValue("TorrentProperties/FilesListState", state); setValue("TorrentProperties/FilesListState", state);
@ -2200,7 +2200,7 @@ void Preferences::setPropVisible(const bool visible)
QByteArray Preferences::getPropTrackerListState() const QByteArray Preferences::getPropTrackerListState() const
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
return value("TorrentProperties/Trackers/qt5/TrackerListState").toByteArray(); return value("TorrentProperties/Trackers/qt5/TrackerListState").toByteArray();
#else #else
return value("TorrentProperties/Trackers/TrackerListState").toByteArray(); return value("TorrentProperties/Trackers/TrackerListState").toByteArray();
@ -2209,7 +2209,7 @@ QByteArray Preferences::getPropTrackerListState() const
void Preferences::setPropTrackerListState(const QByteArray &state) void Preferences::setPropTrackerListState(const QByteArray &state)
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
setValue("TorrentProperties/Trackers/qt5/TrackerListState", state); setValue("TorrentProperties/Trackers/qt5/TrackerListState", state);
#else #else
setValue("TorrentProperties/Trackers/TrackerListState", state); setValue("TorrentProperties/Trackers/TrackerListState", state);
@ -2228,7 +2228,7 @@ void Preferences::setRssGeometry(const QByteArray &geometry)
QByteArray Preferences::getRssHSplitterSizes() const QByteArray Preferences::getRssHSplitterSizes() const
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
return value("RssFeedDownloader/qt5/hsplitterSizes").toByteArray(); return value("RssFeedDownloader/qt5/hsplitterSizes").toByteArray();
#else #else
return value("RssFeedDownloader/hsplitterSizes").toByteArray(); return value("RssFeedDownloader/hsplitterSizes").toByteArray();
@ -2237,7 +2237,7 @@ QByteArray Preferences::getRssHSplitterSizes() const
void Preferences::setRssHSplitterSizes(const QByteArray &sizes) void Preferences::setRssHSplitterSizes(const QByteArray &sizes)
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
setValue("RssFeedDownloader/qt5/hsplitterSizes", sizes); setValue("RssFeedDownloader/qt5/hsplitterSizes", sizes);
#else #else
setValue("RssFeedDownloader/hsplitterSizes", sizes); setValue("RssFeedDownloader/hsplitterSizes", sizes);
@ -2256,7 +2256,7 @@ void Preferences::setRssOpenFolders(const QStringList &folders)
QByteArray Preferences::getRssHSplitterState() const QByteArray Preferences::getRssHSplitterState() const
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
return value("Rss/qt5/splitter_h").toByteArray(); return value("Rss/qt5/splitter_h").toByteArray();
#else #else
return value("Rss/splitter_h").toByteArray(); return value("Rss/splitter_h").toByteArray();
@ -2265,7 +2265,7 @@ QByteArray Preferences::getRssHSplitterState() const
void Preferences::setRssHSplitterState(const QByteArray &state) void Preferences::setRssHSplitterState(const QByteArray &state)
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
setValue("Rss/qt5/splitter_h", state); setValue("Rss/qt5/splitter_h", state);
#else #else
setValue("Rss/splitter_h", state); setValue("Rss/splitter_h", state);
@ -2274,7 +2274,7 @@ void Preferences::setRssHSplitterState(const QByteArray &state)
QByteArray Preferences::getRssVSplitterState() const QByteArray Preferences::getRssVSplitterState() const
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
return value("Rss/qt5/splitter_v").toByteArray(); return value("Rss/qt5/splitter_v").toByteArray();
#else #else
return value("Rss/splitter_v").toByteArray(); return value("Rss/splitter_v").toByteArray();
@ -2283,7 +2283,7 @@ QByteArray Preferences::getRssVSplitterState() const
void Preferences::setRssVSplitterState(const QByteArray &state) void Preferences::setRssVSplitterState(const QByteArray &state)
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
setValue("Rss/qt5/splitter_v", state); setValue("Rss/qt5/splitter_v", state);
#else #else
setValue("Rss/splitter_v", state); setValue("Rss/splitter_v", state);
@ -2422,7 +2422,7 @@ void Preferences::setTransSelFilter(const int &index)
QByteArray Preferences::getTransHeaderState() const QByteArray Preferences::getTransHeaderState() const
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
return value("TransferList/qt5/HeaderState").toByteArray(); return value("TransferList/qt5/HeaderState").toByteArray();
#else #else
return value("TransferList/HeaderState").toByteArray(); return value("TransferList/HeaderState").toByteArray();
@ -2431,7 +2431,7 @@ QByteArray Preferences::getTransHeaderState() const
void Preferences::setTransHeaderState(const QByteArray &state) void Preferences::setTransHeaderState(const QByteArray &state)
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
setValue("TransferList/qt5/HeaderState", state); setValue("TransferList/qt5/HeaderState", state);
#else #else
setValue("TransferList/HeaderState", state); setValue("TransferList/HeaderState", state);

6
src/core/utils/fs.cpp

@ -55,7 +55,7 @@
#include <winbase.h> #include <winbase.h>
#endif #endif
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) #ifndef QBT_USES_QT5
#ifndef DISABLE_GUI #ifndef DISABLE_GUI
#include <QDesktopServices> #include <QDesktopServices>
@ -182,7 +182,7 @@ bool Utils::Fs::forceRemove(const QString& file_path)
*/ */
void Utils::Fs::removeDirRecursive(const QString& dirName) void Utils::Fs::removeDirRecursive(const QString& dirName)
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
QDir(dirName).removeRecursively(); QDir(dirName).removeRecursively();
#else #else
QDir dir(dirName); QDir dir(dirName);
@ -439,7 +439,7 @@ QString Utils::Fs::QDesktopServicesCacheLocation()
QString Utils::Fs::QDesktopServicesDownloadLocation() QString Utils::Fs::QDesktopServicesDownloadLocation()
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
if (QSysInfo::windowsVersion() <= QSysInfo::WV_XP) // Windows XP if (QSysInfo::windowsVersion() <= QSysInfo::WV_XP) // Windows XP
return QDir(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)).absoluteFilePath( return QDir(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)).absoluteFilePath(

4
src/gui/ico.cpp

@ -424,7 +424,7 @@ bool ICOHandler::canRead(QIODevice *device)
class ICOPlugin : public QImageIOPlugin class ICOPlugin : public QImageIOPlugin
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
Q_PLUGIN_METADATA(IID "org.qbittorrent.ICOPlugin") Q_PLUGIN_METADATA(IID "org.qbittorrent.ICOPlugin")
#endif #endif
public: public:
@ -461,7 +461,7 @@ QImageIOHandler *ICOPlugin::create(QIODevice *device, const QByteArray &format)
return handler; return handler;
} }
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) #ifndef QBT_USES_QT5
Q_EXPORT_STATIC_PLUGIN(ICOPlugin) Q_EXPORT_STATIC_PLUGIN(ICOPlugin)
Q_EXPORT_PLUGIN2(ico, ICOPlugin) Q_EXPORT_PLUGIN2(ico, ICOPlugin)
#endif #endif

6
src/gui/lineedit/src/lineedit.cpp

@ -27,7 +27,7 @@ LineEdit::LineEdit(QWidget *parent)
int clearButtonSizeHintWidth = 0; int clearButtonSizeHintWidth = 0;
int clearButtonSizeHintHeight = 0; int clearButtonSizeHintHeight = 0;
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) #ifndef QBT_USES_QT5
QPixmap pixmap2(":/lineeditimages/clear_left.png"); QPixmap pixmap2(":/lineeditimages/clear_left.png");
clearButton = new QToolButton(this); clearButton = new QToolButton(this);
clearButton->setIcon(QIcon(pixmap2)); clearButton->setIcon(QIcon(pixmap2));
@ -58,13 +58,13 @@ void LineEdit::resizeEvent(QResizeEvent *e)
QSize sz = searchButton->sizeHint(); QSize sz = searchButton->sizeHint();
searchButton->move(frameWidth, (e->size().height() - sz.height()) / 2); searchButton->move(frameWidth, (e->size().height() - sz.height()) / 2);
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) #ifndef QBT_USES_QT5
QSize cz = clearButton->sizeHint(); QSize cz = clearButton->sizeHint();
clearButton->move((e->size().width() - frameWidth - cz.width()), (e->size().height() - sz.height()) / 2); clearButton->move((e->size().width() - frameWidth - cz.width()), (e->size().height() - sz.height()) / 2);
#endif #endif
} }
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) #ifndef QBT_USES_QT5
void LineEdit::updateCloseButton(const QString &text) void LineEdit::updateCloseButton(const QString &text)
{ {
clearButton->setVisible(!text.isEmpty()); clearButton->setVisible(!text.isEmpty());

4
src/gui/lineedit/src/lineedit.h

@ -24,14 +24,14 @@ public:
protected: protected:
void resizeEvent(QResizeEvent *e); void resizeEvent(QResizeEvent *e);
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) #ifndef QBT_USES_QT5
private slots: private slots:
void updateCloseButton(const QString &text); void updateCloseButton(const QString &text);
#endif #endif
private: private:
QToolButton *searchButton; QToolButton *searchButton;
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) #ifndef QBT_USES_QT5
QToolButton *clearButton; QToolButton *clearButton;
#endif #endif
}; };

2
src/gui/options_imp.cpp

@ -90,7 +90,7 @@ options_imp::options_imp(QWidget *parent)
} }
} }
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) #ifndef QBT_USES_QT5
scanFoldersView->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents); scanFoldersView->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
#else #else
scanFoldersView->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); scanFoldersView->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);

4
src/gui/previewlistdelegate.h

@ -42,7 +42,7 @@
#include "previewselect.h" #include "previewselect.h"
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) #ifndef QBT_USES_QT5
#include <QPlastiqueStyle> #include <QPlastiqueStyle>
#else #else
#include <QProxyStyle> #include <QProxyStyle>
@ -80,7 +80,7 @@ class PreviewListDelegate: public QItemDelegate {
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt, painter); QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt, painter);
#else #else
// XXX: To avoid having the progress text on the right of the bar // XXX: To avoid having the progress text on the right of the bar
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) #ifndef QBT_USES_QT5
QPlastiqueStyle st; QPlastiqueStyle st;
#else #else
QProxyStyle st("fusion"); QProxyStyle st("fusion");

4
src/gui/previewselect.cpp

@ -32,7 +32,7 @@
#include <QHeaderView> #include <QHeaderView>
#include <QMessageBox> #include <QMessageBox>
#include <QFile> #include <QFile>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
#include <QTableView> #include <QTableView>
#endif #endif
@ -54,7 +54,7 @@ PreviewSelect::PreviewSelect(QWidget* parent, BitTorrent::TorrentHandle *const t
previewListModel->setHeaderData(NAME, Qt::Horizontal, tr("Name")); previewListModel->setHeaderData(NAME, Qt::Horizontal, tr("Name"));
previewListModel->setHeaderData(SIZE, Qt::Horizontal, tr("Size")); previewListModel->setHeaderData(SIZE, Qt::Horizontal, tr("Size"));
previewListModel->setHeaderData(PROGRESS, Qt::Horizontal, tr("Progress")); previewListModel->setHeaderData(PROGRESS, Qt::Horizontal, tr("Progress"));
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
// This hack fixes reordering of first column with Qt5. // This hack fixes reordering of first column with Qt5.
// https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777 // https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777
QTableView unused; QTableView unused;

2
src/gui/properties/peersadditiondlg.cpp

@ -39,7 +39,7 @@ PeersAdditionDlg::PeersAdditionDlg(QWidget *parent)
setupUi(this); setupUi(this);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(validateInput())); connect(buttonBox, SIGNAL(accepted()), this, SLOT(validateInput()));
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
label_format->hide(); label_format->hide();
peers_txt->setPlaceholderText("Format: IPv4:port / [IPv6]:port"); peers_txt->setPlaceholderText("Format: IPv4:port / [IPv6]:port");
#endif #endif

2
src/gui/properties/propertieswidget.cpp

@ -100,7 +100,7 @@ PropertiesWidget::PropertiesWidget(QWidget *parent, MainWindow* main_window, Tra
connect(filesList->header(), SIGNAL(sectionResized(int, int, int)), this, SLOT(saveSettings())); connect(filesList->header(), SIGNAL(sectionResized(int, int, int)), this, SLOT(saveSettings()));
connect(filesList->header(), SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)), this, SLOT(saveSettings())); connect(filesList->header(), SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)), this, SLOT(saveSettings()));
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) #ifdef QBT_USES_QT5
// set bar height relative to screen dpi // set bar height relative to screen dpi
int barHeight = devicePixelRatio() * 18; int barHeight = devicePixelRatio() * 18;
#else #else

4
src/gui/properties/proplistdelegate.cpp

@ -38,7 +38,7 @@
#include <QApplication> #include <QApplication>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) #ifndef QBT_USES_QT5
#include <QPlastiqueStyle> #include <QPlastiqueStyle>
#else #else
#include <QProxyStyle> #include <QProxyStyle>
@ -82,7 +82,7 @@ void PropListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt, painter); QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt, painter);
#else #else
// XXX: To avoid having the progress text on the right of the bar // XXX: To avoid having the progress text on the right of the bar
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) #ifndef QBT_USES_QT5
QPlastiqueStyle st; QPlastiqueStyle st;
#else #else
QProxyStyle st("fusion"); QProxyStyle st("fusion");

4
src/gui/properties/trackerlist.cpp

@ -37,7 +37,7 @@
#include <QDebug> #include <QDebug>
#include <QUrl> #include <QUrl>
#include <QMessageBox> #include <QMessageBox>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
#include <QTableView> #include <QTableView>
#include <QHeaderView> #include <QHeaderView>
#endif #endif
@ -85,7 +85,7 @@ TrackerList::TrackerList(PropertiesWidget *properties): QTreeWidget(), propertie
deleteHotkey = new QShortcut(QKeySequence(QKeySequence::Delete), this, SLOT(deleteSelectedTrackers()), 0, Qt::WidgetShortcut); deleteHotkey = new QShortcut(QKeySequence(QKeySequence::Delete), this, SLOT(deleteSelectedTrackers()), 0, Qt::WidgetShortcut);
copyHotkey = new QShortcut(QKeySequence(Qt::ControlModifier + Qt::Key_C), this, SLOT(copyTrackerUrl()), 0, Qt::WidgetShortcut); copyHotkey = new QShortcut(QKeySequence(Qt::ControlModifier + Qt::Key_C), this, SLOT(copyTrackerUrl()), 0, Qt::WidgetShortcut);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
// This hack fixes reordering of first column with Qt5. // This hack fixes reordering of first column with Qt5.
// https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777 // https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777
QTableView unused; QTableView unused;

4
src/gui/torrentcontenttreeview.cpp

@ -32,7 +32,7 @@
#include <QKeyEvent> #include <QKeyEvent>
#include <QModelIndexList> #include <QModelIndexList>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
#include <QTableView> #include <QTableView>
#include <QHeaderView> #include <QHeaderView>
#endif #endif
@ -42,7 +42,7 @@
TorrentContentTreeView::TorrentContentTreeView(QWidget* parent) TorrentContentTreeView::TorrentContentTreeView(QWidget* parent)
: QTreeView(parent) : QTreeView(parent)
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
// This hack fixes reordering of first column with Qt5. // This hack fixes reordering of first column with Qt5.
// https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777 // https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777
QTableView unused; QTableView unused;

4
src/gui/transferlistdelegate.cpp

@ -42,7 +42,7 @@
#include "core/unicodestrings.h" #include "core/unicodestrings.h"
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) #ifndef QBT_USES_QT5
#include <QPlastiqueStyle> #include <QPlastiqueStyle>
#else #else
#include <QProxyStyle> #include <QProxyStyle>
@ -214,7 +214,7 @@ void TransferListDelegate::paint(QPainter * painter, const QStyleOptionViewItem
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt, painter); QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt, painter);
#else #else
// XXX: To avoid having the progress text on the right of the bar // XXX: To avoid having the progress text on the right of the bar
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) #ifndef QBT_USES_QT5
QPlastiqueStyle st; QPlastiqueStyle st;
#else #else
QProxyStyle st("fusion"); QProxyStyle st("fusion");

4
src/gui/transferlistwidget.cpp

@ -40,7 +40,7 @@
#include <QRegExp> #include <QRegExp>
#include <QFileDialog> #include <QFileDialog>
#include <QMessageBox> #include <QMessageBox>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
#include <QTableView> #include <QTableView>
#endif #endif
@ -156,7 +156,7 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *main_window)
editHotkey = new QShortcut(QKeySequence("F2"), this, SLOT(renameSelectedTorrent()), 0, Qt::WidgetShortcut); editHotkey = new QShortcut(QKeySequence("F2"), this, SLOT(renameSelectedTorrent()), 0, Qt::WidgetShortcut);
deleteHotkey = new QShortcut(QKeySequence::Delete, this, SLOT(deleteSelectedTorrents()), 0, Qt::WidgetShortcut); deleteHotkey = new QShortcut(QKeySequence::Delete, this, SLOT(deleteSelectedTorrents()), 0, Qt::WidgetShortcut);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
// This hack fixes reordering of first column with Qt5. // This hack fixes reordering of first column with Qt5.
// https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777 // https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777
QTableView unused; QTableView unused;

4
src/searchengine/engineselectdlg.cpp

@ -47,7 +47,7 @@
#include <QTemporaryFile> #include <QTemporaryFile>
#include <QMimeData> #include <QMimeData>
#include <QClipboard> #include <QClipboard>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
#include <QTableView> #include <QTableView>
#endif #endif
@ -60,7 +60,7 @@ engineSelectDlg::engineSelectDlg(QWidget *parent, SupportedEngines *supported_en
{ {
setupUi(this); setupUi(this);
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
// This hack fixes reordering of first column with Qt5. // This hack fixes reordering of first column with Qt5.
// https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777 // https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777
QTableView unused; QTableView unused;

4
src/searchengine/searchtab.cpp

@ -33,7 +33,7 @@
#include <QStandardItemModel> #include <QStandardItemModel>
#include <QHeaderView> #include <QHeaderView>
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
#include <QTableView> #include <QTableView>
#endif #endif
@ -48,7 +48,7 @@ SearchTab::SearchTab(SearchEngine *parent) : QWidget(), parent(parent)
box = new QVBoxLayout(); box = new QVBoxLayout();
results_lbl = new QLabel(); results_lbl = new QLabel();
resultsBrowser = new QTreeView(); resultsBrowser = new QTreeView();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #ifdef QBT_USES_QT5
// This hack fixes reordering of first column with Qt5. // This hack fixes reordering of first column with Qt5.
// https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777 // https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777
QTableView unused; QTableView unused;

1
src/src.pro

@ -5,6 +5,7 @@ CONFIG += qt thread silent
# C++11 support # C++11 support
CONFIG += c++11 CONFIG += c++11
DEFINES += BOOST_NO_CXX11_RVALUE_REFERENCES DEFINES += BOOST_NO_CXX11_RVALUE_REFERENCES
greaterThan(QT_MAJOR_VERSION, 4): DEFINES += QBT_USES_QT5
# Windows specific configuration # Windows specific configuration
win32: include(../winconf.pri) win32: include(../winconf.pri)

2
src/webui/abstractwebapplication.cpp

@ -260,7 +260,7 @@ void AbstractWebApplication::translateDocument(QString& data)
if (isTranslationNeeded) { if (isTranslationNeeded) {
size_t context_index = 0; size_t context_index = 0;
while ((context_index < context_count) && (translation == word)) { while ((context_index < context_count) && (translation == word)) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) #ifndef QBT_USES_QT5
translation = qApp->translate(contexts[context_index].c_str(), word.constData(), 0, QCoreApplication::UnicodeUTF8, 1); translation = qApp->translate(contexts[context_index].c_str(), word.constData(), 0, QCoreApplication::UnicodeUTF8, 1);
#else #else
translation = qApp->translate(contexts[context_index].c_str(), word.constData(), 0, 1); translation = qApp->translate(contexts[context_index].c_str(), word.constData(), 0, 1);

10
src/webui/btjson.cpp

@ -41,7 +41,7 @@
#include <QDebug> #include <QDebug>
#include <QVariant> #include <QVariant>
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) #ifndef QBT_USES_QT5
#include <QMetaType> #include <QMetaType>
#endif #endif
#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) #if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
@ -188,7 +188,7 @@ public:
QTorrentCompare(QString key, bool greaterThan = false) QTorrentCompare(QString key, bool greaterThan = false)
: key_(key) : key_(key)
, greaterThan_(greaterThan) , greaterThan_(greaterThan)
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) #ifndef QBT_USES_QT5
, type_(QVariant::Invalid) , type_(QVariant::Invalid)
#endif #endif
{ {
@ -196,7 +196,7 @@ public:
bool operator()(QVariant torrent1, QVariant torrent2) bool operator()(QVariant torrent1, QVariant torrent2)
{ {
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) #ifndef QBT_USES_QT5
if (type_ == QVariant::Invalid) if (type_ == QVariant::Invalid)
type_ = torrent1.toMap().value(key_).type(); type_ = torrent1.toMap().value(key_).type();
@ -229,7 +229,7 @@ public:
private: private:
QString key_; QString key_;
bool greaterThan_; bool greaterThan_;
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) #ifndef QBT_USES_QT5
QVariant::Type type_; QVariant::Type type_;
#endif #endif
}; };
@ -793,7 +793,7 @@ QVariantMap generateSyncData(int acceptedResponseId, QVariantMap data, QVariantM
lastAcceptedData.clear(); lastAcceptedData.clear();
syncData = data; syncData = data;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) && QT_VERSION < QT_VERSION_CHECK(5, 5, 0)) #if (QBT_USES_QT5 && QT_VERSION < QT_VERSION_CHECK(5, 5, 0))
// QJsonDocument::fromVariant() supports QVariantHash only // QJsonDocument::fromVariant() supports QVariantHash only
// since Qt5.5, so manually convert data["torrents"] // since Qt5.5, so manually convert data["torrents"]
QVariantMap torrentsMap; QVariantMap torrentsMap;

6
src/webui/jsonutils.h

@ -30,7 +30,7 @@
#define JSONUTILS_H #define JSONUTILS_H
#include <QVariant> #include <QVariant>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) #ifdef QBT_USES_QT5
#include <QJsonDocument> #include <QJsonDocument>
#include <QJsonObject> #include <QJsonObject>
#include <QJsonArray> #include <QJsonArray>
@ -49,7 +49,7 @@ namespace json {
inline QByteArray toJson(const QVariant& var) inline QByteArray toJson(const QVariant& var)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) #ifdef QBT_USES_QT5
return QJsonDocument::fromVariant(var).toJson(QJsonDocument::Compact); return QJsonDocument::fromVariant(var).toJson(QJsonDocument::Compact);
#else #else
QJson::Serializer serializer; QJson::Serializer serializer;
@ -60,7 +60,7 @@ namespace json {
inline QVariant fromJson(const QString& json) inline QVariant fromJson(const QString& json)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) #ifdef QBT_USES_QT5
return QJsonDocument::fromJson(json.toUtf8()).toVariant(); return QJsonDocument::fromJson(json.toUtf8()).toVariant();
#else #else
return QJson::Parser().parse(json.toUtf8()); return QJson::Parser().parse(json.toUtf8());

Loading…
Cancel
Save