Fix compilation on Windows (Remove using namespace libtorrent; from headers)

This commit is contained in:
Christophe Dumez
2010-11-22 21:55:32 +00:00
parent 61208fce13
commit 8a5dc1f239
33 changed files with 118 additions and 109 deletions

View File

@@ -69,6 +69,8 @@
#include <boost/filesystem/exception.hpp>
#include <queue>
using namespace libtorrent;
QBtSession* QBtSession::m_instance = 0;
const int MAX_TRACKER_ERRORS = 2;

View File

@@ -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<torrent_handle> getTorrents() const;
std::vector<libtorrent::torrent_handle> 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<QString, TrackerInfos> 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<char> &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<torrent_info> t);
void mergeTorrents(QTorrentHandle h_ex, boost::intrusive_ptr<libtorrent::torrent_info> t);
void exportTorrentFile(QTorrentHandle h);
signals:
@@ -211,7 +209,7 @@ private:
private:
// Bittorrent
session *s;
libtorrent::session *s;
QPointer<QTimer> timerAlerts;
QPointer<BandwidthScheduler> bd_scheduler;
QMap<QUrl, QPair<QString, QString> > savepathLabel_fromurl;

View File

@@ -45,6 +45,8 @@
#include <libtorrent/entry.hpp>
#include <boost/filesystem/fstream.hpp>
using namespace libtorrent;
QTorrentHandle::QTorrentHandle(torrent_handle h): torrent_handle(h) {}
//

View File

@@ -35,14 +35,12 @@
#include <libtorrent/torrent_handle.hpp>
#include <libtorrent/torrent_info.hpp>
using namespace libtorrent;
#include <QString>
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);