Fix functions and macros using to support both Qt4 and Qt5.

This commit is contained in:
Vladimir Golovnev (Glassez)
2013-09-21 11:59:58 +04:00
committed by sledgehammer999
parent 763d8a392f
commit ce3aac5f9d
51 changed files with 260 additions and 181 deletions

View File

@@ -36,6 +36,7 @@
#include <QMessageBox>
#include <QHostAddress>
#include "ui_peer.h"
#include <libtorrent/session.hpp>
#include <boost/version.hpp>

View File

@@ -209,7 +209,7 @@ void PeerListWidget::showPeerListMenu(const QPoint&)
return;
}
if (act == copyIPAct) {
#if defined(Q_WS_WIN) || defined(Q_OS_OS2)
#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
QApplication::clipboard()->setText(selectedPeerIPs.join("\r\n"));
#else
QApplication::clipboard()->setText(selectedPeerIPs.join("\n"));

View File

@@ -561,7 +561,7 @@ void PropertiesWidget::renameSelectedFile() {
// Check if that name is already used
for (int i=0; i<h.num_files(); ++i) {
if (i == file_index) continue;
#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
#if defined(Q_OS_UNIX) || defined(Q_WS_QWS)
if (h.filepath_at(i).compare(new_name, Qt::CaseSensitive) == 0) {
#else
if (h.filepath_at(i).compare(new_name, Qt::CaseInsensitive) == 0) {
@@ -600,7 +600,7 @@ void PropertiesWidget::renameSelectedFile() {
const int num_files = h.num_files();
for (int i=0; i<num_files; ++i) {
const QString current_name = h.filepath_at(i);
#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
#if defined(Q_OS_UNIX) || defined(Q_WS_QWS)
if (current_name.startsWith(new_path, Qt::CaseSensitive)) {
#else
if (current_name.startsWith(new_path, Qt::CaseInsensitive)) {

View File

@@ -43,8 +43,12 @@
#include "misc.h"
#include "propertieswidget.h"
#ifdef Q_WS_WIN
#ifdef Q_OS_WIN
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
#include <QPlastiqueStyle>
#else
#include <QProxyStyle>
#endif
#endif
// Defines for properties list columns
@@ -84,12 +88,16 @@ public:
newopt.minimum = 0;
newopt.state |= QStyle::State_Enabled;
newopt.textVisible = true;
#ifndef Q_WS_WIN
#ifndef Q_OS_WIN
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt, painter);
#else
// XXX: To avoid having the progress text on the right of the bar
QPlastiqueStyle st;
st.drawControl(QStyle::CE_ProgressBar, &newopt, painter, 0);
// XXX: To avoid having the progress text on the right of the bar
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
QPlastiqueStyle st;
#else
QProxyStyle st("fusion");
#endif
st.drawControl(QStyle::CE_ProgressBar, &newopt, painter, 0);
#endif
} else {
// Do not display anything if the file is disabled (progress == -1)