mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-23 17:56:50 +03:00
Use simpler DEFINE for detecting Qt5 so moc will work too.
This commit is contained in:
parent
623ab03492
commit
17ac4b90be
28 changed files with 71 additions and 70 deletions
|
@ -357,7 +357,7 @@ void Application::initializeTranslation()
|
|||
}
|
||||
|
||||
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)) ||
|
||||
m_qtTranslator.load(
|
||||
#endif
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include <QSplashScreen>
|
||||
#ifdef QBT_STATIC_QT
|
||||
#include <QtPlugin>
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
Q_IMPORT_PLUGIN(QICOPlugin)
|
||||
#else
|
||||
Q_IMPORT_PLUGIN(qico)
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include <QStringList>
|
||||
#include <QUrl>
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
#include <QUrlQuery>
|
||||
#endif
|
||||
#include <QDir>
|
||||
|
@ -117,7 +117,7 @@ bool RequestParser::parseStartingLine(const QString &line)
|
|||
m_request.path = url.path(); // Path
|
||||
|
||||
// Parse GET parameters
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifndef QBT_USES_QT5
|
||||
QListIterator<QPair<QString, QString> > i(url.queryItems());
|
||||
#else
|
||||
QListIterator<QPair<QString, QString> > i(QUrlQuery(url).queryItems());
|
||||
|
@ -216,7 +216,7 @@ bool RequestParser::parseContent(const QByteArray& data)
|
|||
// Parse url-encoded POST data
|
||||
if (m_request.headers["content-type"].startsWith("application/x-www-form-urlencoded")) {
|
||||
QUrl url;
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifndef QBT_USES_QT5
|
||||
url.setEncodedQuery(data);
|
||||
QListIterator<QPair<QString, QString> > i(url.queryItems());
|
||||
#else
|
||||
|
|
|
@ -67,7 +67,7 @@ void Server::disableHttps()
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
void Server::incomingConnection(qintptr socketDescriptor)
|
||||
#else
|
||||
void Server::incomingConnection(int socketDescriptor)
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace Http
|
|||
#endif
|
||||
|
||||
private:
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
void incomingConnection(qintptr socketDescriptor);
|
||||
#else
|
||||
void incomingConnection(int socketDescriptor);
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <QDebug>
|
||||
#include <QRegExp>
|
||||
#include <QStringList>
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
#include <QUrlQuery>
|
||||
#endif
|
||||
|
||||
|
@ -160,7 +160,7 @@ QUrl DNSUpdater::getUpdateUrl() const
|
|||
}
|
||||
url.setPath("/nic/update");
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifndef QBT_USES_QT5
|
||||
url.addQueryItem("hostname", m_domain);
|
||||
url.addQueryItem("myip", m_lastIP.toString());
|
||||
#else
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace
|
|||
Float = 15
|
||||
};
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifndef QBT_USES_QT5
|
||||
Q_IPV6ADDR createMappedAddress(quint32 ip4);
|
||||
#endif
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ QDateTime GeoIPDatabase::buildEpoch() 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
|
||||
? createMappedAddress(hostAddr.toIPv4Address())
|
||||
: hostAddr.toIPv6Address();
|
||||
|
@ -499,7 +499,7 @@ QVariant GeoIPDatabase::readArrayValue(quint32 &offset, quint32 count) const
|
|||
|
||||
namespace
|
||||
{
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifndef QBT_USES_QT5
|
||||
Q_IPV6ADDR createMappedAddress(quint32 ip4)
|
||||
{
|
||||
Q_IPV6ADDR ip6;
|
||||
|
|
|
@ -1976,7 +1976,7 @@ void Preferences::setTrayIconStyle(TrayIcon::Style style)
|
|||
// in the same file.
|
||||
QByteArray Preferences::getAddNewTorrentDialogState() const
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
return value("AddNewTorrentDialog/qt5/treeHeaderState").toByteArray();
|
||||
#else
|
||||
return value("AddNewTorrentDialog/treeHeaderState").toByteArray();
|
||||
|
@ -1985,7 +1985,7 @@ QByteArray Preferences::getAddNewTorrentDialogState() const
|
|||
|
||||
void Preferences::setAddNewTorrentDialogState(const QByteArray &state)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
setValue("AddNewTorrentDialog/qt5/treeHeaderState", state);
|
||||
#else
|
||||
setValue("AddNewTorrentDialog/treeHeaderState", state);
|
||||
|
@ -2074,7 +2074,7 @@ void Preferences::setMainGeometry(const QByteArray &geometry)
|
|||
|
||||
QByteArray Preferences::getMainVSplitterState() const
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
return value("MainWindow/qt5/vsplitterState").toByteArray();
|
||||
#else
|
||||
return value("MainWindow/vsplitterState").toByteArray();
|
||||
|
@ -2083,7 +2083,7 @@ QByteArray Preferences::getMainVSplitterState() const
|
|||
|
||||
void Preferences::setMainVSplitterState(const QByteArray &state)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
setValue("MainWindow/qt5/vsplitterState", state);
|
||||
#else
|
||||
setValue("MainWindow/vsplitterState", state);
|
||||
|
@ -2134,7 +2134,7 @@ void Preferences::setPrefHSplitterSizes(const QStringList &sizes)
|
|||
|
||||
QByteArray Preferences::getPeerListState() const
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
return value("TorrentProperties/Peers/qt5/PeerListState").toByteArray();
|
||||
#else
|
||||
return value("TorrentProperties/Peers/PeerListState").toByteArray();
|
||||
|
@ -2143,7 +2143,7 @@ QByteArray Preferences::getPeerListState() const
|
|||
|
||||
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);
|
||||
#else
|
||||
setValue("TorrentProperties/Peers/PeerListState", state);
|
||||
|
@ -2162,7 +2162,7 @@ void Preferences::setPropSplitterSizes(const QString &sizes)
|
|||
|
||||
QByteArray Preferences::getPropFileListState() const
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
return value("TorrentProperties/qt5/FilesListState").toByteArray();
|
||||
#else
|
||||
return value("TorrentProperties/FilesListState").toByteArray();
|
||||
|
@ -2171,7 +2171,7 @@ QByteArray Preferences::getPropFileListState() const
|
|||
|
||||
void Preferences::setPropFileListState(const QByteArray &state)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
setValue("TorrentProperties/qt5/FilesListState", state);
|
||||
#else
|
||||
setValue("TorrentProperties/FilesListState", state);
|
||||
|
@ -2200,7 +2200,7 @@ void Preferences::setPropVisible(const bool visible)
|
|||
|
||||
QByteArray Preferences::getPropTrackerListState() const
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
return value("TorrentProperties/Trackers/qt5/TrackerListState").toByteArray();
|
||||
#else
|
||||
return value("TorrentProperties/Trackers/TrackerListState").toByteArray();
|
||||
|
@ -2209,7 +2209,7 @@ QByteArray Preferences::getPropTrackerListState() const
|
|||
|
||||
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);
|
||||
#else
|
||||
setValue("TorrentProperties/Trackers/TrackerListState", state);
|
||||
|
@ -2228,7 +2228,7 @@ void Preferences::setRssGeometry(const QByteArray &geometry)
|
|||
|
||||
QByteArray Preferences::getRssHSplitterSizes() const
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
return value("RssFeedDownloader/qt5/hsplitterSizes").toByteArray();
|
||||
#else
|
||||
return value("RssFeedDownloader/hsplitterSizes").toByteArray();
|
||||
|
@ -2237,7 +2237,7 @@ QByteArray Preferences::getRssHSplitterSizes() const
|
|||
|
||||
void Preferences::setRssHSplitterSizes(const QByteArray &sizes)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
setValue("RssFeedDownloader/qt5/hsplitterSizes", sizes);
|
||||
#else
|
||||
setValue("RssFeedDownloader/hsplitterSizes", sizes);
|
||||
|
@ -2256,7 +2256,7 @@ void Preferences::setRssOpenFolders(const QStringList &folders)
|
|||
|
||||
QByteArray Preferences::getRssHSplitterState() const
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
return value("Rss/qt5/splitter_h").toByteArray();
|
||||
#else
|
||||
return value("Rss/splitter_h").toByteArray();
|
||||
|
@ -2265,7 +2265,7 @@ QByteArray Preferences::getRssHSplitterState() const
|
|||
|
||||
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);
|
||||
#else
|
||||
setValue("Rss/splitter_h", state);
|
||||
|
@ -2274,7 +2274,7 @@ void Preferences::setRssHSplitterState(const QByteArray &state)
|
|||
|
||||
QByteArray Preferences::getRssVSplitterState() const
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
return value("Rss/qt5/splitter_v").toByteArray();
|
||||
#else
|
||||
return value("Rss/splitter_v").toByteArray();
|
||||
|
@ -2283,7 +2283,7 @@ QByteArray Preferences::getRssVSplitterState() const
|
|||
|
||||
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);
|
||||
#else
|
||||
setValue("Rss/splitter_v", state);
|
||||
|
@ -2422,7 +2422,7 @@ void Preferences::setTransSelFilter(const int &index)
|
|||
|
||||
QByteArray Preferences::getTransHeaderState() const
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
return value("TransferList/qt5/HeaderState").toByteArray();
|
||||
#else
|
||||
return value("TransferList/HeaderState").toByteArray();
|
||||
|
@ -2431,7 +2431,7 @@ QByteArray Preferences::getTransHeaderState() const
|
|||
|
||||
void Preferences::setTransHeaderState(const QByteArray &state)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
setValue("TransferList/qt5/HeaderState", state);
|
||||
#else
|
||||
setValue("TransferList/HeaderState", state);
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
#include <winbase.h>
|
||||
#endif
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifndef QBT_USES_QT5
|
||||
|
||||
#ifndef DISABLE_GUI
|
||||
#include <QDesktopServices>
|
||||
|
@ -182,7 +182,7 @@ bool Utils::Fs::forceRemove(const QString& file_path)
|
|||
*/
|
||||
void Utils::Fs::removeDirRecursive(const QString& dirName)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
QDir(dirName).removeRecursively();
|
||||
#else
|
||||
QDir dir(dirName);
|
||||
|
@ -439,7 +439,7 @@ QString Utils::Fs::QDesktopServicesCacheLocation()
|
|||
|
||||
QString Utils::Fs::QDesktopServicesDownloadLocation()
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
#if defined(Q_OS_WIN)
|
||||
if (QSysInfo::windowsVersion() <= QSysInfo::WV_XP) // Windows XP
|
||||
return QDir(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)).absoluteFilePath(
|
||||
|
|
|
@ -424,7 +424,7 @@ bool ICOHandler::canRead(QIODevice *device)
|
|||
|
||||
class ICOPlugin : public QImageIOPlugin
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
Q_PLUGIN_METADATA(IID "org.qbittorrent.ICOPlugin")
|
||||
#endif
|
||||
public:
|
||||
|
@ -461,7 +461,7 @@ QImageIOHandler *ICOPlugin::create(QIODevice *device, const QByteArray &format)
|
|||
return handler;
|
||||
}
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifndef QBT_USES_QT5
|
||||
Q_EXPORT_STATIC_PLUGIN(ICOPlugin)
|
||||
Q_EXPORT_PLUGIN2(ico, ICOPlugin)
|
||||
#endif
|
||||
|
|
|
@ -27,7 +27,7 @@ LineEdit::LineEdit(QWidget *parent)
|
|||
|
||||
int clearButtonSizeHintWidth = 0;
|
||||
int clearButtonSizeHintHeight = 0;
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifndef QBT_USES_QT5
|
||||
QPixmap pixmap2(":/lineeditimages/clear_left.png");
|
||||
clearButton = new QToolButton(this);
|
||||
clearButton->setIcon(QIcon(pixmap2));
|
||||
|
@ -58,13 +58,13 @@ void LineEdit::resizeEvent(QResizeEvent *e)
|
|||
|
||||
QSize sz = searchButton->sizeHint();
|
||||
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();
|
||||
clearButton->move((e->size().width() - frameWidth - cz.width()), (e->size().height() - sz.height()) / 2);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifndef QBT_USES_QT5
|
||||
void LineEdit::updateCloseButton(const QString &text)
|
||||
{
|
||||
clearButton->setVisible(!text.isEmpty());
|
||||
|
|
|
@ -24,14 +24,14 @@ public:
|
|||
protected:
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifndef QBT_USES_QT5
|
||||
private slots:
|
||||
void updateCloseButton(const QString &text);
|
||||
#endif
|
||||
|
||||
private:
|
||||
QToolButton *searchButton;
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifndef QBT_USES_QT5
|
||||
QToolButton *clearButton;
|
||||
#endif
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
#else
|
||||
scanFoldersView->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include "previewselect.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifndef QBT_USES_QT5
|
||||
#include <QPlastiqueStyle>
|
||||
#else
|
||||
#include <QProxyStyle>
|
||||
|
@ -80,7 +80,7 @@ class PreviewListDelegate: public QItemDelegate {
|
|||
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt, painter);
|
||||
#else
|
||||
// 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;
|
||||
#else
|
||||
QProxyStyle st("fusion");
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <QHeaderView>
|
||||
#include <QMessageBox>
|
||||
#include <QFile>
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
#include <QTableView>
|
||||
#endif
|
||||
|
||||
|
@ -54,7 +54,7 @@ PreviewSelect::PreviewSelect(QWidget* parent, BitTorrent::TorrentHandle *const t
|
|||
previewListModel->setHeaderData(NAME, Qt::Horizontal, tr("Name"));
|
||||
previewListModel->setHeaderData(SIZE, Qt::Horizontal, tr("Size"));
|
||||
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.
|
||||
// https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777
|
||||
QTableView unused;
|
||||
|
|
|
@ -39,7 +39,7 @@ PeersAdditionDlg::PeersAdditionDlg(QWidget *parent)
|
|||
setupUi(this);
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(validateInput()));
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
label_format->hide();
|
||||
peers_txt->setPlaceholderText("Format: IPv4:port / [IPv6]:port");
|
||||
#endif
|
||||
|
|
|
@ -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(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
|
||||
int barHeight = devicePixelRatio() * 18;
|
||||
#else
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include <QApplication>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifndef QBT_USES_QT5
|
||||
#include <QPlastiqueStyle>
|
||||
#else
|
||||
#include <QProxyStyle>
|
||||
|
@ -82,7 +82,7 @@ void PropListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
|
|||
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt, painter);
|
||||
#else
|
||||
// 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;
|
||||
#else
|
||||
QProxyStyle st("fusion");
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include <QDebug>
|
||||
#include <QUrl>
|
||||
#include <QMessageBox>
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
#include <QTableView>
|
||||
#include <QHeaderView>
|
||||
#endif
|
||||
|
@ -85,7 +85,7 @@ TrackerList::TrackerList(PropertiesWidget *properties): QTreeWidget(), propertie
|
|||
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);
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
// This hack fixes reordering of first column with Qt5.
|
||||
// https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777
|
||||
QTableView unused;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include <QKeyEvent>
|
||||
#include <QModelIndexList>
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
#include <QTableView>
|
||||
#include <QHeaderView>
|
||||
#endif
|
||||
|
@ -42,7 +42,7 @@
|
|||
TorrentContentTreeView::TorrentContentTreeView(QWidget* 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.
|
||||
// https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777
|
||||
QTableView unused;
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include "core/unicodestrings.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifndef QBT_USES_QT5
|
||||
#include <QPlastiqueStyle>
|
||||
#else
|
||||
#include <QProxyStyle>
|
||||
|
@ -214,7 +214,7 @@ void TransferListDelegate::paint(QPainter * painter, const QStyleOptionViewItem
|
|||
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt, painter);
|
||||
#else
|
||||
// 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;
|
||||
#else
|
||||
QProxyStyle st("fusion");
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include <QRegExp>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
#include <QTableView>
|
||||
#endif
|
||||
|
||||
|
@ -156,7 +156,7 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *main_window)
|
|||
editHotkey = new QShortcut(QKeySequence("F2"), this, SLOT(renameSelectedTorrent()), 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.
|
||||
// https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777
|
||||
QTableView unused;
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#include <QTemporaryFile>
|
||||
#include <QMimeData>
|
||||
#include <QClipboard>
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
#include <QTableView>
|
||||
#endif
|
||||
|
||||
|
@ -60,7 +60,7 @@ engineSelectDlg::engineSelectDlg(QWidget *parent, SupportedEngines *supported_en
|
|||
{
|
||||
setupUi(this);
|
||||
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.
|
||||
// https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777
|
||||
QTableView unused;
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include <QStandardItemModel>
|
||||
#include <QHeaderView>
|
||||
#include <QSortFilterProxyModel>
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef QBT_USES_QT5
|
||||
#include <QTableView>
|
||||
#endif
|
||||
|
||||
|
@ -48,7 +48,7 @@ SearchTab::SearchTab(SearchEngine *parent) : QWidget(), parent(parent)
|
|||
box = new QVBoxLayout();
|
||||
results_lbl = new QLabel();
|
||||
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.
|
||||
// https://github.com/qtproject/qtbase/commit/e0fc088c0c8bc61dbcaf5928b24986cd61a22777
|
||||
QTableView unused;
|
||||
|
|
|
@ -5,6 +5,7 @@ CONFIG += qt thread silent
|
|||
# C++11 support
|
||||
CONFIG += c++11
|
||||
DEFINES += BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
greaterThan(QT_MAJOR_VERSION, 4): DEFINES += QBT_USES_QT5
|
||||
|
||||
# Windows specific configuration
|
||||
win32: include(../winconf.pri)
|
||||
|
|
|
@ -260,7 +260,7 @@ void AbstractWebApplication::translateDocument(QString& data)
|
|||
if (isTranslationNeeded) {
|
||||
size_t context_index = 0;
|
||||
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);
|
||||
#else
|
||||
translation = qApp->translate(contexts[context_index].c_str(), word.constData(), 0, 1);
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
#include <QDebug>
|
||||
#include <QVariant>
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
||||
#ifndef QBT_USES_QT5
|
||||
#include <QMetaType>
|
||||
#endif
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
|
||||
|
@ -188,7 +188,7 @@ public:
|
|||
QTorrentCompare(QString key, bool greaterThan = false)
|
||||
: key_(key)
|
||||
, greaterThan_(greaterThan)
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
||||
#ifndef QBT_USES_QT5
|
||||
, type_(QVariant::Invalid)
|
||||
#endif
|
||||
{
|
||||
|
@ -196,7 +196,7 @@ public:
|
|||
|
||||
bool operator()(QVariant torrent1, QVariant torrent2)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
||||
#ifndef QBT_USES_QT5
|
||||
if (type_ == QVariant::Invalid)
|
||||
type_ = torrent1.toMap().value(key_).type();
|
||||
|
||||
|
@ -229,7 +229,7 @@ public:
|
|||
private:
|
||||
QString key_;
|
||||
bool greaterThan_;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
||||
#ifndef QBT_USES_QT5
|
||||
QVariant::Type type_;
|
||||
#endif
|
||||
};
|
||||
|
@ -793,7 +793,7 @@ QVariantMap generateSyncData(int acceptedResponseId, QVariantMap data, QVariantM
|
|||
lastAcceptedData.clear();
|
||||
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
|
||||
// since Qt5.5, so manually convert data["torrents"]
|
||||
QVariantMap torrentsMap;
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#define JSONUTILS_H
|
||||
|
||||
#include <QVariant>
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||
#ifdef QBT_USES_QT5
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
|
@ -49,7 +49,7 @@ namespace json {
|
|||
|
||||
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);
|
||||
#else
|
||||
QJson::Serializer serializer;
|
||||
|
@ -60,7 +60,7 @@ namespace 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();
|
||||
#else
|
||||
return QJson::Parser().parse(json.toUtf8());
|
||||
|
|
Loading…
Reference in a new issue