From 8a5dc1f23971a11a41a37fb6c46819dab311ae78 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Mon, 22 Nov 2010 21:55:32 +0000 Subject: [PATCH] Fix compilation on Windows (Remove using namespace libtorrent; from headers) --- src/console_imp.h | 2 -- src/filterparserthread.h | 31 +++++++++--------- src/misc.cpp | 2 ++ src/misc.h | 16 +++++----- src/preferences/options_imp.cpp | 2 ++ src/preferences/options_imp.h | 2 -- src/previewselect.h | 4 +-- src/programupdater.cpp | 8 +++-- src/properties/downloadedpiecesbar.h | 7 ++--- src/properties/peeraddition.h | 2 -- src/properties/peerlistwidget.cpp | 2 ++ src/properties/peerlistwidget.h | 4 +-- src/properties/propertieswidget.cpp | 4 ++- src/properties/proplistdelegate.h | 2 +- src/properties/trackerlist.cpp | 2 ++ src/properties/trackersadditiondlg.h | 4 +-- src/qtlibtorrent/qbtsession.cpp | 2 ++ src/qtlibtorrent/qbtsession.h | 20 ++++++------ src/qtlibtorrent/qtorrenthandle.cpp | 2 ++ src/qtlibtorrent/qtorrenthandle.h | 40 +++++++++++------------- src/reverseresolution.h | 2 -- src/speedlimitdlg.h | 2 -- src/src.pro | 1 + src/statusbar.h | 2 +- src/torrentadditiondlg.cpp | 2 ++ src/torrentadditiondlg.h | 4 +-- src/torrentcreator/torrentcreatordlg.cpp | 2 ++ src/torrentfilesmodel.h | 9 +++--- src/tracker/qpeer.h | 14 ++++----- src/trackerlogin.h | 2 -- src/webui/eventmanager.cpp | 2 ++ src/webui/httpconnection.cpp | 2 ++ winconf.pri | 25 ++++++++++----- 33 files changed, 118 insertions(+), 109 deletions(-) diff --git a/src/console_imp.h b/src/console_imp.h index 010127581..1a0b08034 100644 --- a/src/console_imp.h +++ b/src/console_imp.h @@ -34,8 +34,6 @@ #include "qbtsession.h" #include "ui_console.h" -using namespace libtorrent; - class consoleDlg : public QDialog, private Ui_ConsoleDlg{ Q_OBJECT diff --git a/src/filterparserthread.h b/src/filterparserthread.h index 9ffc3e3b8..a54463068 100644 --- a/src/filterparserthread.h +++ b/src/filterparserthread.h @@ -40,7 +40,6 @@ #include #include -using namespace libtorrent; using namespace std; // P2B Stuff @@ -56,8 +55,8 @@ class FilterParserThread : public QThread { Q_OBJECT private: - session *s; - ip_filter filter; + libtorrent::session *s; + libtorrent::ip_filter filter; bool abort; QString filePath; @@ -94,7 +93,7 @@ protected: } public: - FilterParserThread(QObject* parent, session *s) : QThread(parent), s(s), abort(false) { + FilterParserThread(QObject* parent, libtorrent::session *s) : QThread(parent), s(s), abort(false) { } @@ -177,7 +176,7 @@ public: } // Now Add to the filter try { - filter.add_rule(startAddr, endAddr, ip_filter::blocked); + filter.add_rule(startAddr, endAddr, libtorrent::ip_filter::blocked); }catch(exception){ qDebug("Bad line in filter file, avoided crash..."); } @@ -246,7 +245,7 @@ public: continue; } try { - filter.add_rule(startAddr, endAddr, ip_filter::blocked); + filter.add_rule(startAddr, endAddr, libtorrent::ip_filter::blocked); } catch(std::exception&) { qDebug("p2p file: line %d is malformed.", nbLine); qDebug("Line was: %s", line.constData()); @@ -313,10 +312,10 @@ public: // Network byte order to Host byte order // asio address_v4 contructor expects it // that way - address_v4 first(ntohl(start)); - address_v4 last(ntohl(end)); + libtorrent::address_v4 first(ntohl(start)); + libtorrent::address_v4 last(ntohl(end)); // Apply to bittorrent session - filter.add_rule(first, last, ip_filter::blocked); + filter.add_rule(first, last, libtorrent::ip_filter::blocked); } } else if(version==3) { @@ -358,10 +357,10 @@ public: // Network byte order to Host byte order // asio address_v4 contructor expects it // that way - address_v4 first(ntohl(start)); - address_v4 last(ntohl(end)); + libtorrent::address_v4 first(ntohl(start)); + libtorrent::address_v4 last(ntohl(end)); // Apply to bittorrent session - filter.add_rule(first, last, ip_filter::blocked); + filter.add_rule(first, last, libtorrent::ip_filter::blocked); if(abort) return; } } else { @@ -391,16 +390,16 @@ public: start(); } - static void processFilterList(session *s, QStringList IPs) { + static void processFilterList(libtorrent::session *s, QStringList IPs) { // First, import current filter - ip_filter filter = s->get_ip_filter(); + libtorrent::ip_filter filter = s->get_ip_filter(); foreach(const QString &ip, IPs) { qDebug("Manual ban of peer %s", ip.toLocal8Bit().constData()); boost::system::error_code ec; - address_v4 addr = address_v4::from_string(ip.toLocal8Bit().constData(), ec); + libtorrent::address_v4 addr = libtorrent::address_v4::from_string(ip.toLocal8Bit().constData(), ec); Q_ASSERT(!ec); if(!ec) - filter.add_rule(addr, addr, ip_filter::blocked); + filter.add_rule(addr, addr, libtorrent::ip_filter::blocked); } s->set_ip_filter(filter); } diff --git a/src/misc.cpp b/src/misc.cpp index bd1eb6926..e36e86b2f 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -73,6 +73,8 @@ const int UNLEN = 256; #include #endif +using namespace libtorrent; + QString misc::QDesktopServicesDataLocation() { #ifdef Q_WS_WIN LPWSTR path=new WCHAR[256]; diff --git a/src/misc.h b/src/misc.h index 45a4d56e6..beaf7858e 100644 --- a/src/misc.h +++ b/src/misc.h @@ -47,8 +47,6 @@ const qlonglong MAX_ETA = 8640000; -using namespace libtorrent; - /* Miscellaneaous functions that can be useful */ class misc : public QObject{ Q_OBJECT @@ -73,14 +71,14 @@ public: return QString::fromUtf8(str); } - static inline QString toQString(sha1_hash hash) { + static inline QString toQString(libtorrent::sha1_hash hash) { std::ostringstream o; o << hash; return QString(o.str().c_str()); } - static inline sha1_hash toSha1Hash(QString hash) { - return sha1_hash(qPrintable(hash)); + static inline libtorrent::sha1_hash toSha1Hash(QString hash) { + return libtorrent::sha1_hash(qPrintable(hash)); } static void chmod644(const QDir& folder); @@ -93,10 +91,10 @@ public: return tmp.join("/"); } - static inline sha1_hash QStringToSha1(const QString& s) { + static inline libtorrent::sha1_hash QStringToSha1(const QString& s) { std::string str(s.toLocal8Bit().data()); std::istringstream i(str); - sha1_hash x; + libtorrent::sha1_hash x; i>>x; return x; } @@ -122,8 +120,8 @@ public: static quint64 computePathSize(QString path); - static QString truncateRootFolder(boost::intrusive_ptr t); - static QString truncateRootFolder(torrent_handle h); + static QString truncateRootFolder(boost::intrusive_ptr t); + static QString truncateRootFolder(libtorrent::torrent_handle h); static QString updateLabelInSavePath(const QString& defaultSavePath, QString save_path, const QString old_label, const QString new_label); diff --git a/src/preferences/options_imp.cpp b/src/preferences/options_imp.cpp index 30d95d741..3f83a8db4 100644 --- a/src/preferences/options_imp.cpp +++ b/src/preferences/options_imp.cpp @@ -50,6 +50,8 @@ #include "scannedfoldersmodel.h" #include "qinisettings.h" +using namespace libtorrent; + // Constructor options_imp::options_imp(QWidget *parent):QDialog(parent){ qDebug("-> Constructing Options"); diff --git a/src/preferences/options_imp.h b/src/preferences/options_imp.h index ca34f2bf0..0da29ffde 100644 --- a/src/preferences/options_imp.h +++ b/src/preferences/options_imp.h @@ -37,8 +37,6 @@ // actions on double-click on torrents enum DoubleClickAction {TOGGLE_PAUSE, OPEN_DEST, NO_ACTION}; -using namespace libtorrent; - class QCloseEvent; class AdvancedSettings; diff --git a/src/previewselect.h b/src/previewselect.h index 3ca29237b..ed62c8caf 100644 --- a/src/previewselect.h +++ b/src/previewselect.h @@ -47,8 +47,6 @@ #define SIZE 1 #define PROGRESS 2 -using namespace libtorrent; - class previewSelect: public QDialog, private Ui::preview { Q_OBJECT @@ -105,7 +103,7 @@ public: previewList->setItemDelegate(listDelegate); previewList->header()->resizeSection(0, 200); // Fill list in - std::vector fp; + std::vector fp; h.file_progress(fp); unsigned int nbFiles = h.num_files(); for(unsigned int i=0; i #include -using namespace libtorrent; #define BAR_HEIGHT 18 class DownloadedPiecesBar: public QWidget { @@ -54,7 +53,7 @@ public: setFixedHeight(BAR_HEIGHT); } - void setProgress(const bitfield &pieces, const bitfield &downloading_pieces) { + void setProgress(const libtorrent::bitfield &pieces, const libtorrent::bitfield &downloading_pieces) { if(pieces.empty()) { // Empty bar QPixmap pix = QPixmap(1, 1); @@ -67,8 +66,8 @@ public: const uint w = width(); if(nb_pieces > w) { const uint ratio = floor(nb_pieces/(double)w); - bitfield scaled_pieces(ceil(nb_pieces/(double)ratio), false); - bitfield scaled_downloading(ceil(nb_pieces/(double)ratio), false); + libtorrent::bitfield scaled_pieces(ceil(nb_pieces/(double)ratio), false); + libtorrent::bitfield scaled_downloading(ceil(nb_pieces/(double)ratio), false); uint scaled_index = 0; for(qulonglong i=0; i #endif -using namespace libtorrent; - class PeerAdditionDlg: public QDialog, private Ui::addPeerDialog { Q_OBJECT diff --git a/src/properties/peerlistwidget.cpp b/src/properties/peerlistwidget.cpp index e1e28ebf7..1a85f0cbe 100644 --- a/src/properties/peerlistwidget.cpp +++ b/src/properties/peerlistwidget.cpp @@ -45,6 +45,8 @@ #include #include "qinisettings.h" +using namespace libtorrent; + PeerListWidget::PeerListWidget(PropertiesWidget *parent): QTreeView(parent), properties(parent), display_flags(false) { // Visual settings setRootIsDecorated(false); diff --git a/src/properties/peerlistwidget.h b/src/properties/peerlistwidget.h index b4fb88ff3..d6e119cea 100644 --- a/src/properties/peerlistwidget.h +++ b/src/properties/peerlistwidget.h @@ -62,8 +62,8 @@ public: public slots: void loadPeers(const QTorrentHandle &h, bool force_hostname_resolution=false); - QStandardItem* addPeer(QString ip, peer_info peer); - void updatePeer(QString ip, peer_info peer); + QStandardItem* addPeer(QString ip, libtorrent::peer_info peer); + void updatePeer(QString ip, libtorrent::peer_info peer); void handleResolved(QString ip, QString hostname); void updatePeerHostNameResolutionState(); void updatePeerCountryResolutionState(); diff --git a/src/properties/propertieswidget.cpp b/src/properties/propertieswidget.cpp index 9706125f6..4c3bb50b6 100644 --- a/src/properties/propertieswidget.cpp +++ b/src/properties/propertieswidget.cpp @@ -55,6 +55,8 @@ #include "qinisettings.h" #include "proptabbar.h" +using namespace libtorrent; + PropertiesWidget::PropertiesWidget(QWidget *parent, MainWindow* main_window, TransferListWidget *transferList): QWidget(parent), transferList(transferList), main_window(main_window) { @@ -248,7 +250,7 @@ void PropertiesWidget::loadTorrentInfos(QTorrentHandle &_h) { // Expand first item if possible filesList->expand(PropListModel->index(0, 0)); } - } catch(invalid_handle e) { + } catch(invalid_handle& e) { } // Load dynamic data diff --git a/src/properties/proplistdelegate.h b/src/properties/proplistdelegate.h index 5cc3d232c..a47d87f90 100644 --- a/src/properties/proplistdelegate.h +++ b/src/properties/proplistdelegate.h @@ -152,7 +152,7 @@ public: if(index.column() != PRIORITY) return 0; if(properties) { QTorrentHandle h = properties->getCurrentTorrent(); - if(!h.is_valid() || static_cast(h).is_seed() || !h.has_metadata()) return 0; + if(!h.is_valid() || static_cast(h).is_seed() || !h.has_metadata()) return 0; } if(index.data().toInt() <= 0) { // IGNORED or MIXED diff --git a/src/properties/trackerlist.cpp b/src/properties/trackerlist.cpp index 43af5a4ec..510176e3d 100644 --- a/src/properties/trackerlist.cpp +++ b/src/properties/trackerlist.cpp @@ -43,6 +43,8 @@ #include "qbtsession.h" #include "qinisettings.h" +using namespace libtorrent; + TrackerList::TrackerList(PropertiesWidget *properties): QTreeWidget(), properties(properties) { // Graphical settings setRootIsDecorated(false); diff --git a/src/properties/trackersadditiondlg.h b/src/properties/trackersadditiondlg.h index 25de7850a..47d32850f 100644 --- a/src/properties/trackersadditiondlg.h +++ b/src/properties/trackersadditiondlg.h @@ -79,8 +79,8 @@ public slots: } QList existingTrackers; // Load from torrent handle - std::vector tor_trackers = h.trackers(); - std::vector::iterator itr = tor_trackers.begin(); + std::vector tor_trackers = h.trackers(); + std::vector::iterator itr = tor_trackers.begin(); while(itr != tor_trackers.end()) { existingTrackers << QUrl(misc::toQString(itr->url)); itr++; diff --git a/src/qtlibtorrent/qbtsession.cpp b/src/qtlibtorrent/qbtsession.cpp index b93e3e38c..03cf79b22 100644 --- a/src/qtlibtorrent/qbtsession.cpp +++ b/src/qtlibtorrent/qbtsession.cpp @@ -69,6 +69,8 @@ #include #include +using namespace libtorrent; + QBtSession* QBtSession::m_instance = 0; const int MAX_TRACKER_ERRORS = 2; diff --git a/src/qtlibtorrent/qbtsession.h b/src/qtlibtorrent/qbtsession.h index 4fc7e8221..21614b450 100644 --- a/src/qtlibtorrent/qbtsession.h +++ b/src/qtlibtorrent/qbtsession.h @@ -51,8 +51,6 @@ #include "qtorrenthandle.h" #include "trackerinfos.h" -using namespace libtorrent; - #define MAX_SAMPLES 20 class downloadThread; @@ -75,11 +73,11 @@ public: static void drop(); ~QBtSession(); QTorrentHandle getTorrentHandle(QString hash) const; - std::vector getTorrents() const; + std::vector getTorrents() const; bool isFilePreviewPossible(QString fileHash) const; float getPayloadDownloadRate() const; float getPayloadUploadRate() const; - session_status getSessionStatus() const; + libtorrent::session_status getSessionStatus() const; int getListenPort() const; float getRealRatio(QString hash) const; QHash getTrackersInfo(QString hash) const; @@ -91,7 +89,7 @@ public: qlonglong getETA(QString hash); inline QStringList getConsoleMessages() const { return consoleMessages; } inline QStringList getPeerBanMessages() const { return peerBanMessages; } - inline session* getSession() const { return s; } + inline libtorrent::session* getSession() const { return s; } inline bool useTemporaryFolder() const { return !defaultTempPath.isEmpty(); } inline QString getDefaultSavePath() const { return defaultSavePath; } inline ScanFoldersModel* getScanFoldersModel() const { return m_scanFolders; } @@ -132,8 +130,8 @@ public slots: void setUploadRateLimit(long rate); void setMaxRatio(float ratio); void setDHTPort(int dht_port); - void setProxySettings(const proxy_settings &proxySettings); - void setSessionSettings(const session_settings &sessionSettings); + void setProxySettings(const libtorrent::proxy_settings &proxySettings); + void setSessionSettings(const libtorrent::session_settings &sessionSettings); void startTorrentsInPause(bool b); void setDefaultTempPath(QString temppath); void setAppendLabelToSavePath(bool append); @@ -143,7 +141,7 @@ public slots: void appendqBextensionToTorrent(QTorrentHandle &h, bool append); void setAppendqBExtension(bool append); #endif - void applyEncryptionSettings(pe_settings se); + void applyEncryptionSettings(libtorrent::pe_settings se); void setDownloadLimit(QString hash, long val); void setUploadLimit(QString hash, long val); void enableUPnP(bool b); @@ -169,7 +167,7 @@ protected: bool loadFastResumeData(QString hash, std::vector &buf); void loadTorrentSettings(QTorrentHandle h); void loadTorrentTempData(QTorrentHandle h, QString savePath, bool magnet); - add_torrent_params initializeAddTorrentParams(QString hash); + libtorrent::add_torrent_params initializeAddTorrentParams(QString hash); protected slots: void addTorrentsFromScanFolder(QStringList&); @@ -181,7 +179,7 @@ protected slots: void sendNotificationEmail(QTorrentHandle h); void autoRunExternalProgram(QTorrentHandle h, bool async=true); void cleanUpAutoRunProcess(int); - void mergeTorrents(QTorrentHandle h_ex, boost::intrusive_ptr t); + void mergeTorrents(QTorrentHandle h_ex, boost::intrusive_ptr t); void exportTorrentFile(QTorrentHandle h); signals: @@ -211,7 +209,7 @@ private: private: // Bittorrent - session *s; + libtorrent::session *s; QPointer timerAlerts; QPointer bd_scheduler; QMap > savepathLabel_fromurl; diff --git a/src/qtlibtorrent/qtorrenthandle.cpp b/src/qtlibtorrent/qtorrenthandle.cpp index ceb3ce036..9488eaccd 100644 --- a/src/qtlibtorrent/qtorrenthandle.cpp +++ b/src/qtlibtorrent/qtorrenthandle.cpp @@ -45,6 +45,8 @@ #include #include +using namespace libtorrent; + QTorrentHandle::QTorrentHandle(torrent_handle h): torrent_handle(h) {} // diff --git a/src/qtlibtorrent/qtorrenthandle.h b/src/qtlibtorrent/qtorrenthandle.h index 2d403c72c..c9ad52b6b 100644 --- a/src/qtlibtorrent/qtorrenthandle.h +++ b/src/qtlibtorrent/qtorrenthandle.h @@ -35,14 +35,12 @@ #include #include -using namespace libtorrent; - #include class QStringList; // A wrapper for torrent_handle in libtorrent // to interact well with Qt types -class QTorrentHandle : public torrent_handle { +class QTorrentHandle : public libtorrent::torrent_handle { public: @@ -51,7 +49,7 @@ class QTorrentHandle : public torrent_handle { // QTorrentHandle() {} - explicit QTorrentHandle(torrent_handle h); + explicit QTorrentHandle(libtorrent::torrent_handle h); // // Getters @@ -59,15 +57,15 @@ class QTorrentHandle : public torrent_handle { QString hash() const; QString name() const; float progress() const; - bitfield pieces() const; + libtorrent::bitfield pieces() const; QString current_tracker() const; bool is_paused() const; bool has_filtered_pieces() const; - size_type total_size() const; - size_type piece_length() const; + libtorrent::size_type total_size() const; + libtorrent::size_type piece_length() const; int num_pieces() const; - size_type total_wanted_done() const; - size_type total_wanted() const; + libtorrent::size_type total_wanted_done() const; + libtorrent::size_type total_wanted() const; float download_payload_rate() const; float upload_payload_rate() const; int num_connections() const; @@ -78,22 +76,22 @@ class QTorrentHandle : public torrent_handle { int num_incomplete() const; QString save_path() const; QStringList url_seeds() const; - size_type actual_size() const; + libtorrent::size_type actual_size() const; int num_files() const; int queue_position() const; bool is_queued() const; QString filename_at(unsigned int index) const; - size_type filesize_at(unsigned int index) const; - torrent_status::state_t state() const; + libtorrent::size_type filesize_at(unsigned int index) const; + libtorrent::torrent_status::state_t state() const; QString creator() const; QString comment() const; - size_type total_failed_bytes() const; - size_type total_redundant_bytes() const; - size_type total_payload_download() const; - size_type total_payload_upload() const; - size_type all_time_upload() const; - size_type all_time_download() const; - size_type total_done() const; + libtorrent::size_type total_failed_bytes() const; + libtorrent::size_type total_redundant_bytes() const; + libtorrent::size_type total_payload_download() const; + libtorrent::size_type total_payload_upload() const; + libtorrent::size_type all_time_upload() const; + libtorrent::size_type all_time_download() const; + libtorrent::size_type total_done() const; QStringList files_path() const; QStringList uneeded_files_path() const; bool has_missing_files() const; @@ -112,7 +110,7 @@ class QTorrentHandle : public torrent_handle { QString firstFileSavePath() const; bool has_error() const; QString error() const; - void downloading_pieces(bitfield &bf) const; + void downloading_pieces(libtorrent::bitfield &bf) const; // // Setters @@ -125,7 +123,7 @@ class QTorrentHandle : public torrent_handle { void file_priority(int index, int priority) const; void set_tracker_login(QString username, QString password); void move_storage(QString path) const; - void add_tracker(const announce_entry& url); + void add_tracker(const libtorrent::announce_entry& url); void prioritize_first_last_piece(bool b); void rename_file(int index, QString name); bool save_torrent_file(QString path); diff --git a/src/reverseresolution.h b/src/reverseresolution.h index 783596708..0c5b0fad4 100644 --- a/src/reverseresolution.h +++ b/src/reverseresolution.h @@ -46,8 +46,6 @@ #include #endif -using namespace libtorrent; - const int MAX_THREADS = 20; const int CACHE_SIZE = 500; diff --git a/src/speedlimitdlg.h b/src/speedlimitdlg.h index 05956bf0f..ae06906fc 100644 --- a/src/speedlimitdlg.h +++ b/src/speedlimitdlg.h @@ -37,8 +37,6 @@ #include "misc.h" #include "qbtsession.h" -using namespace libtorrent; - class SpeedLimitDialog : public QDialog, private Ui_bandwidth_dlg { Q_OBJECT diff --git a/src/src.pro b/src/src.pro index 3e071c970..ddf5c9d50 100644 --- a/src/src.pro +++ b/src/src.pro @@ -25,6 +25,7 @@ ICONS_PATH = Icons # use "CONFIG -= debug" to disable debug CONFIG += debug +#CONFIG += release # Disable debug output in release mode !debug { diff --git a/src/statusbar.h b/src/statusbar.h index 522d8b326..2814cb53f 100644 --- a/src/statusbar.h +++ b/src/statusbar.h @@ -177,7 +177,7 @@ public slots: void refreshStatusBar() { // Update connection status - const session_status sessionStatus = QBtSession::instance()->getSessionStatus(); + const libtorrent::session_status sessionStatus = QBtSession::instance()->getSessionStatus(); if(!QBtSession::instance()->getSession()->is_listening()) { connecStatusLblIcon->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/disconnected.png"))); connecStatusLblIcon->setToolTip(QString::fromUtf8("")+tr("Connection Status:")+QString::fromUtf8("
")+tr("Offline. This usually means that qBittorrent failed to listen on the selected port for incoming connections.")); diff --git a/src/torrentadditiondlg.cpp b/src/torrentadditiondlg.cpp index fbf97083a..b4f1346b7 100644 --- a/src/torrentadditiondlg.cpp +++ b/src/torrentadditiondlg.cpp @@ -54,6 +54,8 @@ #include "torrentadditiondlg.h" +using namespace libtorrent; + torrentAdditionDialog::torrentAdditionDialog(QWidget *parent) : QDialog(parent), old_label(""), hidden_height(0) { const Preferences pref; diff --git a/src/torrentadditiondlg.h b/src/torrentadditiondlg.h index e017109ac..a89ee9735 100644 --- a/src/torrentadditiondlg.h +++ b/src/torrentadditiondlg.h @@ -37,8 +37,6 @@ #include -using namespace libtorrent; - class TorrentFilesModel; class PropListDelegate; @@ -84,7 +82,7 @@ private: TorrentFilesModel *PropListModel; PropListDelegate *PropDelegate; unsigned int nbFiles; - boost::intrusive_ptr t; + boost::intrusive_ptr t; QStringList files_path; bool is_magnet; int hidden_height; diff --git a/src/torrentcreator/torrentcreatordlg.cpp b/src/torrentcreator/torrentcreatordlg.cpp index fb16326dc..7ba144dfc 100644 --- a/src/torrentcreator/torrentcreatordlg.cpp +++ b/src/torrentcreator/torrentcreatordlg.cpp @@ -41,6 +41,8 @@ const uint NB_PIECES_MIN = 1200; const uint NB_PIECES_MAX = 2200; +using namespace libtorrent; + TorrentCreatorDlg::TorrentCreatorDlg(QWidget *parent): QDialog(parent), creatorThread(0) { setupUi(this); setAttribute(Qt::WA_DeleteOnClose); diff --git a/src/torrentfilesmodel.h b/src/torrentfilesmodel.h index f40a5ba64..e56e99c8d 100644 --- a/src/torrentfilesmodel.h +++ b/src/torrentfilesmodel.h @@ -40,7 +40,6 @@ #include #include "proplistdelegate.h" #include "misc.h" -using namespace libtorrent; enum FilePriority {IGNORED=0, NORMAL=1, HIGH=2, MAXIMUM=7, PARTIAL=-1}; enum TreeItemType {TFILE, FOLDER, ROOT}; @@ -60,7 +59,7 @@ private: public: // File Construction - TreeItem(file_entry f, TreeItem *parent, int _file_index) { + TreeItem(libtorrent::file_entry f, TreeItem *parent, int _file_index) { Q_ASSERT(parent); parentItem = parent; type = TFILE; @@ -333,7 +332,7 @@ public: delete rootItem; } - void updateFilesProgress(std::vector fp) { + void updateFilesProgress(std::vector fp) { for(unsigned int i=0; i= 0); files_index[i]->setProgress(fp[i]); @@ -519,7 +518,7 @@ public: emit layoutChanged(); } - void setupModelData(torrent_info const& t) { + void setupModelData(libtorrent::torrent_info const& t) { qDebug("setup model data called"); if(t.num_files() == 0) return; // Initialize files_index array @@ -551,7 +550,7 @@ public: // Iterate over files int i = 0; - torrent_info::file_iterator fi = t.begin_files(); + libtorrent::torrent_info::file_iterator fi = t.begin_files(); while(fi != t.end_files()) { current_parent = root_folder; QString path = QDir::cleanPath(misc::toQStringU(fi->path.string())).replace("\\", "/"); diff --git a/src/tracker/qpeer.h b/src/tracker/qpeer.h index 45c5084a6..2f4ddbac7 100644 --- a/src/tracker/qpeer.h +++ b/src/tracker/qpeer.h @@ -4,8 +4,6 @@ #include #include -using namespace libtorrent; - struct QPeer { bool operator!=(const QPeer &other) const { @@ -20,13 +18,13 @@ struct QPeer { return ip+":"+QString::number(port); } - entry toEntry(bool no_peer_id) const { - entry::dictionary_type peer_map; + libtorrent::entry toEntry(bool no_peer_id) const { + libtorrent::entry::dictionary_type peer_map; if(!no_peer_id) - peer_map["id"] = entry(peer_id.toStdString()); - peer_map["ip"] = entry(ip.toStdString()); - peer_map["port"] = entry(port); - return entry(peer_map); + peer_map["id"] = libtorrent::entry(peer_id.toStdString()); + peer_map["ip"] = libtorrent::entry(ip.toStdString()); + peer_map["port"] = libtorrent::entry(port); + return libtorrent::entry(peer_map); } QString ip; diff --git a/src/trackerlogin.h b/src/trackerlogin.h index 6d94b9511..59249d2a2 100644 --- a/src/trackerlogin.h +++ b/src/trackerlogin.h @@ -37,8 +37,6 @@ #include "ui_login.h" #include "qtorrenthandle.h" -using namespace libtorrent; - class trackerLogin : public QDialog, private Ui::authentication{ Q_OBJECT diff --git a/src/webui/eventmanager.cpp b/src/webui/eventmanager.cpp index 78d2b3117..aba8801ab 100644 --- a/src/webui/eventmanager.cpp +++ b/src/webui/eventmanager.cpp @@ -40,6 +40,8 @@ #include #include +using namespace libtorrent; + EventManager::EventManager(QObject *parent) : QObject(parent) { diff --git a/src/webui/httpconnection.cpp b/src/webui/httpconnection.cpp index 6d68e5c46..c89652901 100644 --- a/src/webui/httpconnection.cpp +++ b/src/webui/httpconnection.cpp @@ -46,6 +46,8 @@ #include #include +using namespace libtorrent; + HttpConnection::HttpConnection(QTcpSocket *socket, HttpServer *parent) : QObject(parent), socket(socket), httpserver(parent) { diff --git a/winconf.pri b/winconf.pri index 7f7fa22d9..456f00522 100644 --- a/winconf.pri +++ b/winconf.pri @@ -5,15 +5,26 @@ INCLUDEPATH += $$quote(C:/qBittorrent/RC_0_15/zlib) INCLUDEPATH += $$quote(C:/OpenSSL/include) LIBS += $$quote(-LC:/OpenSSL/lib/VC) -LIBS += $$quote(-L$C:/qBittorrent/libs) +LIBS += $$quote(-LC:/qBittorrent/libs) # LIBTORRENT DEFINES -DEFINES += BOOST_ALL_NO_LIB BOOST_ASIO_HASH_MAP_BUCKETS=1021 BOOST_EXCEPTION_DISABLE -DEFINES += BOOST_FILESYSTEM_STATIC_LINK=1 BOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DEFINES += BOOST_SYSTEM_STATIC_LINK=1 BOOST_THREAD_USE_LIB BOOST_THREAD_USE_LIB=1 -DEFINES += TORRENT_USE_OPENSSL UNICODE WIN32 WIN32_LEAN_AND_MEAN -DEFINES += _CRT_SECURE_NO_DEPRECATE _FILE_OFFSET_BITS=64 _SCL_SECURE_NO_DEPRECATE -DEFINES += _UNICODE _WIN32 _WIN32_WINNT=0x0500 __USE_W32_SOCKETS +DEFINES += BOOST_ALL_NO_LIB +DEFINES += BOOST_ASIO_HASH_MAP_BUCKETS=1021 +DEFINES += BOOST_EXCEPTION_DISABLE +DEFINES += BOOST_SYSTEM_STATIC_LINK=1 +DEFINES += BOOST_THREAD_USE_LIB +DEFINES += BOOST_THREAD_USE_LIB=1 +DEFINES += TORRENT_USE_OPENSSL +DEFINES += UNICODE +DEFINES += WIN32 +DEFINES += WIN32_LEAN_AND_MEAN +DEFINES += _CRT_SECURE_NO_DEPRECATE +DEFINES += _FILE_OFFSET_BITS=64 +DEFINES += _SCL_SECURE_NO_DEPRECATE +DEFINES += _UNICODE +DEFINES += _WIN32 +DEFINES += _WIN32_WINNT=0x0500 +DEFINES += __USE_W32_SOCKETS DEFINES += WITH_SHIPPED_GEOIP_H debug {