mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 07:27:22 -06:00
Use simpler DEFINE for detecting Qt5 so moc will work too.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user