diff --git a/src/feeddownloader.h b/src/feeddownloader.h index 15fb77241..4104ea1c0 100644 --- a/src/feeddownloader.h +++ b/src/feeddownloader.h @@ -32,7 +32,6 @@ #define FEEDDOWNLOADER_H #include -#include #include #include #include @@ -47,6 +46,14 @@ #include "bittorrent.h" #include "ui_feeddownloader.h" +#ifdef QT_4_5 +#include +#else +#include +#define QHash QMap +#define toHash toMap +#endif + class FeedFilter: public QHash { private: bool valid; @@ -477,4 +484,7 @@ protected slots: }; +#undef QHash +#undef toHash + #endif // FEEDDOWNLOADER_H diff --git a/src/peeraddition.h b/src/peeraddition.h index 52685a89e..7656b8f2f 100644 --- a/src/peeraddition.h +++ b/src/peeraddition.h @@ -35,7 +35,8 @@ #include #include #include "ui_peer.h" -#include +#include +#include class PeerAdditionDlg: public QDialog, private Ui::addPeerDialog { Q_OBJECT @@ -57,8 +58,8 @@ public: return spinPort->value(); } - static boost::asio::ip::tcp::endpoint askForPeerEndpoint() { - boost::asio::ip::tcp::endpoint ep; + static libtorrent::asio::ip::tcp::endpoint askForPeerEndpoint() { + libtorrent::asio::ip::tcp::endpoint ep; PeerAdditionDlg dlg; if(dlg.exec() == QDialog::Accepted) { const QRegExp is_ipv6(QString::fromUtf8("[0-9a-f]{4}(:[0-9a-f]{4}){7}"), Qt::CaseInsensitive, QRegExp::RegExp); @@ -66,10 +67,10 @@ public: QString IP = dlg.getIP(); if(is_ipv4.exactMatch(IP)) { // IPv4 - ep = boost::asio::ip::tcp::endpoint(boost::asio::ip::address_v4::from_string(IP.toLocal8Bit().data()), dlg.getPort()); + ep = libtorrent::asio::ip::tcp::endpoint(libtorrent::asio::ip::address_v4::from_string(IP.toLocal8Bit().data()), dlg.getPort()); } else { // IPv6 - ep = boost::asio::ip::tcp::endpoint(boost::asio::ip::address_v6::from_string(IP.toLocal8Bit().data()), dlg.getPort()); + ep = libtorrent::asio::ip::tcp::endpoint(libtorrent::asio::ip::address_v6::from_string(IP.toLocal8Bit().data()), dlg.getPort()); } } return ep; diff --git a/src/peerlistwidget.cpp b/src/peerlistwidget.cpp index 4c912cdfd..24a33f3d8 100644 --- a/src/peerlistwidget.cpp +++ b/src/peerlistwidget.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -143,8 +144,8 @@ void PeerListWidget::showPeerListMenu(QPoint) { if(empty_menu) return; QAction *act = menu.exec(QCursor::pos()); if(act == addPeerAct) { - boost::asio::ip::tcp::endpoint ep = PeerAdditionDlg::askForPeerEndpoint(); - if(ep != boost::asio::ip::tcp::endpoint()) { + libtorrent::asio::ip::tcp::endpoint ep = PeerAdditionDlg::askForPeerEndpoint(); + if(ep != libtorrent::asio::ip::tcp::endpoint()) { try { h.connect_peer(ep); QMessageBox::information(0, tr("Peer addition"), tr("The peer was added to this torrent.")); @@ -192,8 +193,8 @@ void PeerListWidget::limitUpRateSelectedPeers(QStringList peer_ips) { long limit = SpeedLimitDialog::askSpeedLimit(&ok, tr("Upload rate limiting"), -1); if(!ok) return; foreach(const QString &ip, peer_ips) { - boost::asio::ip::tcp::endpoint ep = peerEndpoints.value(ip, boost::asio::ip::tcp::endpoint()); - if(ep != boost::asio::ip::tcp::endpoint()) { + libtorrent::asio::ip::tcp::endpoint ep = peerEndpoints.value(ip, libtorrent::asio::ip::tcp::endpoint()); + if(ep != libtorrent::asio::ip::tcp::endpoint()) { qDebug("Settings Upload limit of %.1f Kb/s to peer %s", limit/1024., ip.toLocal8Bit().data()); try { h.set_peer_upload_limit(ep, limit); @@ -213,8 +214,8 @@ void PeerListWidget::limitDlRateSelectedPeers(QStringList peer_ips) { long limit = SpeedLimitDialog::askSpeedLimit(&ok, tr("Download rate limiting"), -1); if(!ok) return; foreach(const QString &ip, peer_ips) { - boost::asio::ip::tcp::endpoint ep = peerEndpoints.value(ip, boost::asio::ip::tcp::endpoint()); - if(ep != boost::asio::ip::tcp::endpoint()) { + libtorrent::asio::ip::tcp::endpoint ep = peerEndpoints.value(ip, libtorrent::asio::ip::tcp::endpoint()); + if(ep != libtorrent::asio::ip::tcp::endpoint()) { qDebug("Settings Download limit of %.1f Kb/s to peer %s", limit/1024., ip.toLocal8Bit().data()); try { h.set_peer_download_limit(ep, limit); diff --git a/src/peerlistwidget.h b/src/peerlistwidget.h index ee15cd7bb..efd0e9d7e 100644 --- a/src/peerlistwidget.h +++ b/src/peerlistwidget.h @@ -53,7 +53,7 @@ private: PeerListDelegate *listDelegate; QSortFilterProxyModel * proxyModel; QHash peerItems; - QHash peerEndpoints; + QHash peerEndpoints; QSet missingFlags; QPointer resolver; PropertiesWidget* properties; diff --git a/src/propertieswidget.cpp b/src/propertieswidget.cpp index f4e06315f..8cda32863 100644 --- a/src/propertieswidget.cpp +++ b/src/propertieswidget.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include diff --git a/src/reverseresolution.h b/src/reverseresolution.h index cb8ac1011..530509a7b 100644 --- a/src/reverseresolution.h +++ b/src/reverseresolution.h @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include "misc.h" #define MAX_THREADS 20 @@ -45,12 +45,12 @@ class ReverseResolutionST: public QThread { Q_OBJECT private: - boost::asio::ip::tcp::endpoint ip; - boost::asio::ip::tcp::resolver resolver; + libtorrent::asio::ip::tcp::endpoint ip; + libtorrent::asio::ip::tcp::resolver resolver; bool stopped; public: - ReverseResolutionST(boost::asio::io_service &ios, QObject *parent=0): QThread(parent), resolver(ios), stopped(false) { + ReverseResolutionST(libtorrent::asio::io_service &ios, QObject *parent=0): QThread(parent), resolver(ios), stopped(false) { } @@ -62,7 +62,7 @@ public: } } - void setIP(boost::asio::ip::tcp::endpoint &_ip) { + void setIP(libtorrent::asio::ip::tcp::endpoint &_ip) { ip = _ip; } @@ -72,9 +72,9 @@ signals: protected: void run() { try { - boost::asio::ip::tcp::resolver::iterator it = resolver.resolve(ip); + libtorrent::asio::ip::tcp::resolver::iterator it = resolver.resolve(ip); if(stopped) return; - boost::asio::ip::tcp::endpoint endpoint = *it; + libtorrent::asio::ip::tcp::endpoint endpoint = *it; emit ip_resolved(misc::toQString(endpoint.address().to_string()), misc::toQString((*it).host_name())); } catch(std::exception &e) { std::cerr << "Hostname resolution failed, reason: " << e.what() << std::endl; @@ -86,11 +86,11 @@ class ReverseResolution: public QThread { Q_OBJECT private: - QQueue ips; + QQueue ips; QMutex mut; QWaitCondition cond; bool stopped; - boost::asio::io_service ios; + libtorrent::asio::io_service ios; QList subThreads; @@ -115,7 +115,7 @@ public: cond.wakeOne(); } - void resolve(boost::asio::ip::tcp::endpoint ip) { + void resolve(libtorrent::asio::ip::tcp::endpoint ip) { mut.lock(); ips.enqueue(ip); if(subThreads.size() < MAX_THREADS) @@ -147,7 +147,7 @@ protected: mut.unlock(); break; } - boost::asio::ip::tcp::endpoint ip = ips.dequeue(); + libtorrent::asio::ip::tcp::endpoint ip = ips.dequeue(); ReverseResolutionST *st = new ReverseResolutionST(ios); subThreads.append(st); mut.unlock(); diff --git a/src/rss.cpp b/src/rss.cpp index 8ccf89754..ac75c514a 100644 --- a/src/rss.cpp +++ b/src/rss.cpp @@ -29,8 +29,14 @@ */ #include "rss.h" -#include -#include + +#ifdef QT_4_5 +#include +#else +#include +#define QHash QMap +#define toHash toMap +#endif /** RssFolder **/ @@ -673,3 +679,4 @@ void RssStream::processDownloadedFile(QString file_path) { void RssStream::setDownloadFailed(){ downloadFailure = true; } + diff --git a/src/rss.h b/src/rss.h index 1d54782df..2d68dff9f 100644 --- a/src/rss.h +++ b/src/rss.h @@ -40,14 +40,23 @@ #include #include #include -#include #include +#include +#include #include "misc.h" #include "feeddownloader.h" #include "bittorrent.h" #include "downloadthread.h" +#ifdef QT_4_5 +#include +#else +#include +#define QHash QMap +#define toHash toMap +#endif + class RssManager; class RssFile; // Folder or Stream class RssFolder; @@ -511,7 +520,4 @@ public: }; - - - #endif diff --git a/src/torrentpersistentdata.h b/src/torrentpersistentdata.h index bdb1ae352..2c06f0630 100644 --- a/src/torrentpersistentdata.h +++ b/src/torrentpersistentdata.h @@ -32,13 +32,19 @@ #define TORRENTPERSISTENTDATA_H #include -#include #include #include - #include "qtorrenthandle.h" #include "misc.h" +#ifdef QT_4_5 +#include +#else +#include +#define QHash QMap +#define toHash toMap +#endif + class TorrentTempData { public: static bool hasTempData(QString hash) { @@ -256,4 +262,8 @@ public: } }; + +#undef QHash +#undef toHash + #endif // TORRENTPERSISTENTDATA_H