Browse Source

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

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
8a5dc1f239
  1. 2
      src/console_imp.h
  2. 31
      src/filterparserthread.h
  3. 2
      src/misc.cpp
  4. 16
      src/misc.h
  5. 2
      src/preferences/options_imp.cpp
  6. 2
      src/preferences/options_imp.h
  7. 4
      src/previewselect.h
  8. 8
      src/programupdater.cpp
  9. 7
      src/properties/downloadedpiecesbar.h
  10. 2
      src/properties/peeraddition.h
  11. 2
      src/properties/peerlistwidget.cpp
  12. 4
      src/properties/peerlistwidget.h
  13. 4
      src/properties/propertieswidget.cpp
  14. 2
      src/properties/proplistdelegate.h
  15. 2
      src/properties/trackerlist.cpp
  16. 4
      src/properties/trackersadditiondlg.h
  17. 2
      src/qtlibtorrent/qbtsession.cpp
  18. 20
      src/qtlibtorrent/qbtsession.h
  19. 2
      src/qtlibtorrent/qtorrenthandle.cpp
  20. 40
      src/qtlibtorrent/qtorrenthandle.h
  21. 2
      src/reverseresolution.h
  22. 2
      src/speedlimitdlg.h
  23. 1
      src/src.pro
  24. 2
      src/statusbar.h
  25. 2
      src/torrentadditiondlg.cpp
  26. 4
      src/torrentadditiondlg.h
  27. 2
      src/torrentcreator/torrentcreatordlg.cpp
  28. 9
      src/torrentfilesmodel.h
  29. 14
      src/tracker/qpeer.h
  30. 2
      src/trackerlogin.h
  31. 2
      src/webui/eventmanager.cpp
  32. 2
      src/webui/httpconnection.cpp
  33. 25
      winconf.pri

2
src/console_imp.h

@ -34,8 +34,6 @@
#include "qbtsession.h" #include "qbtsession.h"
#include "ui_console.h" #include "ui_console.h"
using namespace libtorrent;
class consoleDlg : public QDialog, private Ui_ConsoleDlg{ class consoleDlg : public QDialog, private Ui_ConsoleDlg{
Q_OBJECT Q_OBJECT

31
src/filterparserthread.h

@ -40,7 +40,6 @@
#include <libtorrent/session.hpp> #include <libtorrent/session.hpp>
#include <libtorrent/ip_filter.hpp> #include <libtorrent/ip_filter.hpp>
using namespace libtorrent;
using namespace std; using namespace std;
// P2B Stuff // P2B Stuff
@ -56,8 +55,8 @@ class FilterParserThread : public QThread {
Q_OBJECT Q_OBJECT
private: private:
session *s; libtorrent::session *s;
ip_filter filter; libtorrent::ip_filter filter;
bool abort; bool abort;
QString filePath; QString filePath;
@ -94,7 +93,7 @@ protected:
} }
public: 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 // Now Add to the filter
try { try {
filter.add_rule(startAddr, endAddr, ip_filter::blocked); filter.add_rule(startAddr, endAddr, libtorrent::ip_filter::blocked);
}catch(exception){ }catch(exception){
qDebug("Bad line in filter file, avoided crash..."); qDebug("Bad line in filter file, avoided crash...");
} }
@ -246,7 +245,7 @@ public:
continue; continue;
} }
try { try {
filter.add_rule(startAddr, endAddr, ip_filter::blocked); filter.add_rule(startAddr, endAddr, libtorrent::ip_filter::blocked);
} catch(std::exception&) { } catch(std::exception&) {
qDebug("p2p file: line %d is malformed.", nbLine); qDebug("p2p file: line %d is malformed.", nbLine);
qDebug("Line was: %s", line.constData()); qDebug("Line was: %s", line.constData());
@ -313,10 +312,10 @@ public:
// Network byte order to Host byte order // Network byte order to Host byte order
// asio address_v4 contructor expects it // asio address_v4 contructor expects it
// that way // that way
address_v4 first(ntohl(start)); libtorrent::address_v4 first(ntohl(start));
address_v4 last(ntohl(end)); libtorrent::address_v4 last(ntohl(end));
// Apply to bittorrent session // 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) { else if(version==3) {
@ -358,10 +357,10 @@ public:
// Network byte order to Host byte order // Network byte order to Host byte order
// asio address_v4 contructor expects it // asio address_v4 contructor expects it
// that way // that way
address_v4 first(ntohl(start)); libtorrent::address_v4 first(ntohl(start));
address_v4 last(ntohl(end)); libtorrent::address_v4 last(ntohl(end));
// Apply to bittorrent session // Apply to bittorrent session
filter.add_rule(first, last, ip_filter::blocked); filter.add_rule(first, last, libtorrent::ip_filter::blocked);
if(abort) return; if(abort) return;
} }
} else { } else {
@ -391,16 +390,16 @@ public:
start(); start();
} }
static void processFilterList(session *s, QStringList IPs) { static void processFilterList(libtorrent::session *s, QStringList IPs) {
// First, import current filter // First, import current filter
ip_filter filter = s->get_ip_filter(); libtorrent::ip_filter filter = s->get_ip_filter();
foreach(const QString &ip, IPs) { foreach(const QString &ip, IPs) {
qDebug("Manual ban of peer %s", ip.toLocal8Bit().constData()); qDebug("Manual ban of peer %s", ip.toLocal8Bit().constData());
boost::system::error_code ec; 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); Q_ASSERT(!ec);
if(!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); s->set_ip_filter(filter);
} }

2
src/misc.cpp

@ -73,6 +73,8 @@ const int UNLEN = 256;
#include <QDBusMessage> #include <QDBusMessage>
#endif #endif
using namespace libtorrent;
QString misc::QDesktopServicesDataLocation() { QString misc::QDesktopServicesDataLocation() {
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
LPWSTR path=new WCHAR[256]; LPWSTR path=new WCHAR[256];

16
src/misc.h

@ -47,8 +47,6 @@
const qlonglong MAX_ETA = 8640000; const qlonglong MAX_ETA = 8640000;
using namespace libtorrent;
/* Miscellaneaous functions that can be useful */ /* Miscellaneaous functions that can be useful */
class misc : public QObject{ class misc : public QObject{
Q_OBJECT Q_OBJECT
@ -73,14 +71,14 @@ public:
return QString::fromUtf8(str); return QString::fromUtf8(str);
} }
static inline QString toQString(sha1_hash hash) { static inline QString toQString(libtorrent::sha1_hash hash) {
std::ostringstream o; std::ostringstream o;
o << hash; o << hash;
return QString(o.str().c_str()); return QString(o.str().c_str());
} }
static inline sha1_hash toSha1Hash(QString hash) { static inline libtorrent::sha1_hash toSha1Hash(QString hash) {
return sha1_hash(qPrintable(hash)); return libtorrent::sha1_hash(qPrintable(hash));
} }
static void chmod644(const QDir& folder); static void chmod644(const QDir& folder);
@ -93,10 +91,10 @@ public:
return tmp.join("/"); 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::string str(s.toLocal8Bit().data());
std::istringstream i(str); std::istringstream i(str);
sha1_hash x; libtorrent::sha1_hash x;
i>>x; i>>x;
return x; return x;
} }
@ -122,8 +120,8 @@ public:
static quint64 computePathSize(QString path); static quint64 computePathSize(QString path);
static QString truncateRootFolder(boost::intrusive_ptr<torrent_info> t); static QString truncateRootFolder(boost::intrusive_ptr<libtorrent::torrent_info> t);
static QString truncateRootFolder(torrent_handle h); static QString truncateRootFolder(libtorrent::torrent_handle h);
static QString updateLabelInSavePath(const QString& defaultSavePath, QString save_path, const QString old_label, const QString new_label); static QString updateLabelInSavePath(const QString& defaultSavePath, QString save_path, const QString old_label, const QString new_label);

2
src/preferences/options_imp.cpp

@ -50,6 +50,8 @@
#include "scannedfoldersmodel.h" #include "scannedfoldersmodel.h"
#include "qinisettings.h" #include "qinisettings.h"
using namespace libtorrent;
// Constructor // Constructor
options_imp::options_imp(QWidget *parent):QDialog(parent){ options_imp::options_imp(QWidget *parent):QDialog(parent){
qDebug("-> Constructing Options"); qDebug("-> Constructing Options");

2
src/preferences/options_imp.h

@ -37,8 +37,6 @@
// actions on double-click on torrents // actions on double-click on torrents
enum DoubleClickAction {TOGGLE_PAUSE, OPEN_DEST, NO_ACTION}; enum DoubleClickAction {TOGGLE_PAUSE, OPEN_DEST, NO_ACTION};
using namespace libtorrent;
class QCloseEvent; class QCloseEvent;
class AdvancedSettings; class AdvancedSettings;

4
src/previewselect.h

@ -47,8 +47,6 @@
#define SIZE 1 #define SIZE 1
#define PROGRESS 2 #define PROGRESS 2
using namespace libtorrent;
class previewSelect: public QDialog, private Ui::preview { class previewSelect: public QDialog, private Ui::preview {
Q_OBJECT Q_OBJECT
@ -105,7 +103,7 @@ public:
previewList->setItemDelegate(listDelegate); previewList->setItemDelegate(listDelegate);
previewList->header()->resizeSection(0, 200); previewList->header()->resizeSection(0, 200);
// Fill list in // Fill list in
std::vector<size_type> fp; std::vector<libtorrent::size_type> fp;
h.file_progress(fp); h.file_progress(fp);
unsigned int nbFiles = h.num_files(); unsigned int nbFiles = h.num_files();
for(unsigned int i=0; i<nbFiles; ++i){ for(unsigned int i=0; i<nbFiles; ++i){

8
src/programupdater.cpp

@ -47,6 +47,8 @@ const QString RSS_URL = "http://sourceforge.net/api/file/index/project-id/163414
const QString FILE_EXT = "EXE"; const QString FILE_EXT = "EXE";
#endif #endif
using namespace libtorrent;
ProgramUpdater::ProgramUpdater(QObject *parent) : ProgramUpdater::ProgramUpdater(QObject *parent) :
QObject(parent) QObject(parent)
{ {
@ -55,7 +57,7 @@ ProgramUpdater::ProgramUpdater(QObject *parent) :
// Proxy support // Proxy support
if(pref.isProxyEnabled()) { if(pref.isProxyEnabled()) {
QNetworkProxy proxy; QNetworkProxy proxy;
switch(pref.getHTTPProxyType()) { switch(pref.getProxyType()) {
case Proxy::SOCKS4: case Proxy::SOCKS4:
case Proxy::SOCKS5: case Proxy::SOCKS5:
case Proxy::SOCKS5_PW: case Proxy::SOCKS5_PW:
@ -64,8 +66,8 @@ ProgramUpdater::ProgramUpdater(QObject *parent) :
proxy.setType(QNetworkProxy::HttpProxy); proxy.setType(QNetworkProxy::HttpProxy);
break; break;
} }
proxy.setHostName(pref.getHTTPProxyIp()); proxy.setHostName(pref.getProxyIp());
proxy.setPort(pref.getHTTPProxyPort()); proxy.setPort(pref.getProxyPort());
// Proxy authentication // Proxy authentication
if(pref.isProxyAuthEnabled()) { if(pref.isProxyAuthEnabled()) {
proxy.setUser(pref.getProxyUsername()); proxy.setUser(pref.getProxyUsername());

7
src/properties/downloadedpiecesbar.h

@ -38,7 +38,6 @@
#include <libtorrent/bitfield.hpp> #include <libtorrent/bitfield.hpp>
#include <math.h> #include <math.h>
using namespace libtorrent;
#define BAR_HEIGHT 18 #define BAR_HEIGHT 18
class DownloadedPiecesBar: public QWidget { class DownloadedPiecesBar: public QWidget {
@ -54,7 +53,7 @@ public:
setFixedHeight(BAR_HEIGHT); 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()) { if(pieces.empty()) {
// Empty bar // Empty bar
QPixmap pix = QPixmap(1, 1); QPixmap pix = QPixmap(1, 1);
@ -67,8 +66,8 @@ public:
const uint w = width(); const uint w = width();
if(nb_pieces > w) { if(nb_pieces > w) {
const uint ratio = floor(nb_pieces/(double)w); const uint ratio = floor(nb_pieces/(double)w);
bitfield scaled_pieces(ceil(nb_pieces/(double)ratio), false); libtorrent::bitfield scaled_pieces(ceil(nb_pieces/(double)ratio), false);
bitfield scaled_downloading(ceil(nb_pieces/(double)ratio), false); libtorrent::bitfield scaled_downloading(ceil(nb_pieces/(double)ratio), false);
uint scaled_index = 0; uint scaled_index = 0;
for(qulonglong i=0; i<nb_pieces; i+= ratio) { for(qulonglong i=0; i<nb_pieces; i+= ratio) {
bool have = true; bool have = true;

2
src/properties/peeraddition.h

@ -45,8 +45,6 @@
#include <boost/asio/ip/tcp.hpp> #include <boost/asio/ip/tcp.hpp>
#endif #endif
using namespace libtorrent;
class PeerAdditionDlg: public QDialog, private Ui::addPeerDialog { class PeerAdditionDlg: public QDialog, private Ui::addPeerDialog {
Q_OBJECT Q_OBJECT

2
src/properties/peerlistwidget.cpp

@ -45,6 +45,8 @@
#include <vector> #include <vector>
#include "qinisettings.h" #include "qinisettings.h"
using namespace libtorrent;
PeerListWidget::PeerListWidget(PropertiesWidget *parent): QTreeView(parent), properties(parent), display_flags(false) { PeerListWidget::PeerListWidget(PropertiesWidget *parent): QTreeView(parent), properties(parent), display_flags(false) {
// Visual settings // Visual settings
setRootIsDecorated(false); setRootIsDecorated(false);

4
src/properties/peerlistwidget.h

@ -62,8 +62,8 @@ public:
public slots: public slots:
void loadPeers(const QTorrentHandle &h, bool force_hostname_resolution=false); void loadPeers(const QTorrentHandle &h, bool force_hostname_resolution=false);
QStandardItem* addPeer(QString ip, peer_info peer); QStandardItem* addPeer(QString ip, libtorrent::peer_info peer);
void updatePeer(QString ip, peer_info peer); void updatePeer(QString ip, libtorrent::peer_info peer);
void handleResolved(QString ip, QString hostname); void handleResolved(QString ip, QString hostname);
void updatePeerHostNameResolutionState(); void updatePeerHostNameResolutionState();
void updatePeerCountryResolutionState(); void updatePeerCountryResolutionState();

4
src/properties/propertieswidget.cpp

@ -55,6 +55,8 @@
#include "qinisettings.h" #include "qinisettings.h"
#include "proptabbar.h" #include "proptabbar.h"
using namespace libtorrent;
PropertiesWidget::PropertiesWidget(QWidget *parent, MainWindow* main_window, TransferListWidget *transferList): PropertiesWidget::PropertiesWidget(QWidget *parent, MainWindow* main_window, TransferListWidget *transferList):
QWidget(parent), transferList(transferList), main_window(main_window) { QWidget(parent), transferList(transferList), main_window(main_window) {
@ -248,7 +250,7 @@ void PropertiesWidget::loadTorrentInfos(QTorrentHandle &_h) {
// Expand first item if possible // Expand first item if possible
filesList->expand(PropListModel->index(0, 0)); filesList->expand(PropListModel->index(0, 0));
} }
} catch(invalid_handle e) { } catch(invalid_handle& e) {
} }
// Load dynamic data // Load dynamic data

2
src/properties/proplistdelegate.h

@ -152,7 +152,7 @@ public:
if(index.column() != PRIORITY) return 0; if(index.column() != PRIORITY) return 0;
if(properties) { if(properties) {
QTorrentHandle h = properties->getCurrentTorrent(); QTorrentHandle h = properties->getCurrentTorrent();
if(!h.is_valid() || static_cast<torrent_handle>(h).is_seed() || !h.has_metadata()) return 0; if(!h.is_valid() || static_cast<libtorrent::torrent_handle>(h).is_seed() || !h.has_metadata()) return 0;
} }
if(index.data().toInt() <= 0) { if(index.data().toInt() <= 0) {
// IGNORED or MIXED // IGNORED or MIXED

2
src/properties/trackerlist.cpp

@ -43,6 +43,8 @@
#include "qbtsession.h" #include "qbtsession.h"
#include "qinisettings.h" #include "qinisettings.h"
using namespace libtorrent;
TrackerList::TrackerList(PropertiesWidget *properties): QTreeWidget(), properties(properties) { TrackerList::TrackerList(PropertiesWidget *properties): QTreeWidget(), properties(properties) {
// Graphical settings // Graphical settings
setRootIsDecorated(false); setRootIsDecorated(false);

4
src/properties/trackersadditiondlg.h

@ -79,8 +79,8 @@ public slots:
} }
QList<QUrl> existingTrackers; QList<QUrl> existingTrackers;
// Load from torrent handle // Load from torrent handle
std::vector<announce_entry> tor_trackers = h.trackers(); std::vector<libtorrent::announce_entry> tor_trackers = h.trackers();
std::vector<announce_entry>::iterator itr = tor_trackers.begin(); std::vector<libtorrent::announce_entry>::iterator itr = tor_trackers.begin();
while(itr != tor_trackers.end()) { while(itr != tor_trackers.end()) {
existingTrackers << QUrl(misc::toQString(itr->url)); existingTrackers << QUrl(misc::toQString(itr->url));
itr++; itr++;

2
src/qtlibtorrent/qbtsession.cpp

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

20
src/qtlibtorrent/qbtsession.h

@ -51,8 +51,6 @@
#include "qtorrenthandle.h" #include "qtorrenthandle.h"
#include "trackerinfos.h" #include "trackerinfos.h"
using namespace libtorrent;
#define MAX_SAMPLES 20 #define MAX_SAMPLES 20
class downloadThread; class downloadThread;
@ -75,11 +73,11 @@ public:
static void drop(); static void drop();
~QBtSession(); ~QBtSession();
QTorrentHandle getTorrentHandle(QString hash) const; QTorrentHandle getTorrentHandle(QString hash) const;
std::vector<torrent_handle> getTorrents() const; std::vector<libtorrent::torrent_handle> getTorrents() const;
bool isFilePreviewPossible(QString fileHash) const; bool isFilePreviewPossible(QString fileHash) const;
float getPayloadDownloadRate() const; float getPayloadDownloadRate() const;
float getPayloadUploadRate() const; float getPayloadUploadRate() const;
session_status getSessionStatus() const; libtorrent::session_status getSessionStatus() const;
int getListenPort() const; int getListenPort() const;
float getRealRatio(QString hash) const; float getRealRatio(QString hash) const;
QHash<QString, TrackerInfos> getTrackersInfo(QString hash) const; QHash<QString, TrackerInfos> getTrackersInfo(QString hash) const;
@ -91,7 +89,7 @@ public:
qlonglong getETA(QString hash); qlonglong getETA(QString hash);
inline QStringList getConsoleMessages() const { return consoleMessages; } inline QStringList getConsoleMessages() const { return consoleMessages; }
inline QStringList getPeerBanMessages() const { return peerBanMessages; } 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 bool useTemporaryFolder() const { return !defaultTempPath.isEmpty(); }
inline QString getDefaultSavePath() const { return defaultSavePath; } inline QString getDefaultSavePath() const { return defaultSavePath; }
inline ScanFoldersModel* getScanFoldersModel() const { return m_scanFolders; } inline ScanFoldersModel* getScanFoldersModel() const { return m_scanFolders; }
@ -132,8 +130,8 @@ public slots:
void setUploadRateLimit(long rate); void setUploadRateLimit(long rate);
void setMaxRatio(float ratio); void setMaxRatio(float ratio);
void setDHTPort(int dht_port); void setDHTPort(int dht_port);
void setProxySettings(const proxy_settings &proxySettings); void setProxySettings(const libtorrent::proxy_settings &proxySettings);
void setSessionSettings(const session_settings &sessionSettings); void setSessionSettings(const libtorrent::session_settings &sessionSettings);
void startTorrentsInPause(bool b); void startTorrentsInPause(bool b);
void setDefaultTempPath(QString temppath); void setDefaultTempPath(QString temppath);
void setAppendLabelToSavePath(bool append); void setAppendLabelToSavePath(bool append);
@ -143,7 +141,7 @@ public slots:
void appendqBextensionToTorrent(QTorrentHandle &h, bool append); void appendqBextensionToTorrent(QTorrentHandle &h, bool append);
void setAppendqBExtension(bool append); void setAppendqBExtension(bool append);
#endif #endif
void applyEncryptionSettings(pe_settings se); void applyEncryptionSettings(libtorrent::pe_settings se);
void setDownloadLimit(QString hash, long val); void setDownloadLimit(QString hash, long val);
void setUploadLimit(QString hash, long val); void setUploadLimit(QString hash, long val);
void enableUPnP(bool b); void enableUPnP(bool b);
@ -169,7 +167,7 @@ protected:
bool loadFastResumeData(QString hash, std::vector<char> &buf); bool loadFastResumeData(QString hash, std::vector<char> &buf);
void loadTorrentSettings(QTorrentHandle h); void loadTorrentSettings(QTorrentHandle h);
void loadTorrentTempData(QTorrentHandle h, QString savePath, bool magnet); void loadTorrentTempData(QTorrentHandle h, QString savePath, bool magnet);
add_torrent_params initializeAddTorrentParams(QString hash); libtorrent::add_torrent_params initializeAddTorrentParams(QString hash);
protected slots: protected slots:
void addTorrentsFromScanFolder(QStringList&); void addTorrentsFromScanFolder(QStringList&);
@ -181,7 +179,7 @@ protected slots:
void sendNotificationEmail(QTorrentHandle h); void sendNotificationEmail(QTorrentHandle h);
void autoRunExternalProgram(QTorrentHandle h, bool async=true); void autoRunExternalProgram(QTorrentHandle h, bool async=true);
void cleanUpAutoRunProcess(int); 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); void exportTorrentFile(QTorrentHandle h);
signals: signals:
@ -211,7 +209,7 @@ private:
private: private:
// Bittorrent // Bittorrent
session *s; libtorrent::session *s;
QPointer<QTimer> timerAlerts; QPointer<QTimer> timerAlerts;
QPointer<BandwidthScheduler> bd_scheduler; QPointer<BandwidthScheduler> bd_scheduler;
QMap<QUrl, QPair<QString, QString> > savepathLabel_fromurl; QMap<QUrl, QPair<QString, QString> > savepathLabel_fromurl;

2
src/qtlibtorrent/qtorrenthandle.cpp

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

40
src/qtlibtorrent/qtorrenthandle.h

@ -35,14 +35,12 @@
#include <libtorrent/torrent_handle.hpp> #include <libtorrent/torrent_handle.hpp>
#include <libtorrent/torrent_info.hpp> #include <libtorrent/torrent_info.hpp>
using namespace libtorrent;
#include <QString> #include <QString>
class QStringList; class QStringList;
// A wrapper for torrent_handle in libtorrent // A wrapper for torrent_handle in libtorrent
// to interact well with Qt types // to interact well with Qt types
class QTorrentHandle : public torrent_handle { class QTorrentHandle : public libtorrent::torrent_handle {
public: public:
@ -51,7 +49,7 @@ class QTorrentHandle : public torrent_handle {
// //
QTorrentHandle() {} QTorrentHandle() {}
explicit QTorrentHandle(torrent_handle h); explicit QTorrentHandle(libtorrent::torrent_handle h);
// //
// Getters // Getters
@ -59,15 +57,15 @@ class QTorrentHandle : public torrent_handle {
QString hash() const; QString hash() const;
QString name() const; QString name() const;
float progress() const; float progress() const;
bitfield pieces() const; libtorrent::bitfield pieces() const;
QString current_tracker() const; QString current_tracker() const;
bool is_paused() const; bool is_paused() const;
bool has_filtered_pieces() const; bool has_filtered_pieces() const;
size_type total_size() const; libtorrent::size_type total_size() const;
size_type piece_length() const; libtorrent::size_type piece_length() const;
int num_pieces() const; int num_pieces() const;
size_type total_wanted_done() const; libtorrent::size_type total_wanted_done() const;
size_type total_wanted() const; libtorrent::size_type total_wanted() const;
float download_payload_rate() const; float download_payload_rate() const;
float upload_payload_rate() const; float upload_payload_rate() const;
int num_connections() const; int num_connections() const;
@ -78,22 +76,22 @@ class QTorrentHandle : public torrent_handle {
int num_incomplete() const; int num_incomplete() const;
QString save_path() const; QString save_path() const;
QStringList url_seeds() const; QStringList url_seeds() const;
size_type actual_size() const; libtorrent::size_type actual_size() const;
int num_files() const; int num_files() const;
int queue_position() const; int queue_position() const;
bool is_queued() const; bool is_queued() const;
QString filename_at(unsigned int index) const; QString filename_at(unsigned int index) const;
size_type filesize_at(unsigned int index) const; libtorrent::size_type filesize_at(unsigned int index) const;
torrent_status::state_t state() const; libtorrent::torrent_status::state_t state() const;
QString creator() const; QString creator() const;
QString comment() const; QString comment() const;
size_type total_failed_bytes() const; libtorrent::size_type total_failed_bytes() const;
size_type total_redundant_bytes() const; libtorrent::size_type total_redundant_bytes() const;
size_type total_payload_download() const; libtorrent::size_type total_payload_download() const;
size_type total_payload_upload() const; libtorrent::size_type total_payload_upload() const;
size_type all_time_upload() const; libtorrent::size_type all_time_upload() const;
size_type all_time_download() const; libtorrent::size_type all_time_download() const;
size_type total_done() const; libtorrent::size_type total_done() const;
QStringList files_path() const; QStringList files_path() const;
QStringList uneeded_files_path() const; QStringList uneeded_files_path() const;
bool has_missing_files() const; bool has_missing_files() const;
@ -112,7 +110,7 @@ class QTorrentHandle : public torrent_handle {
QString firstFileSavePath() const; QString firstFileSavePath() const;
bool has_error() const; bool has_error() const;
QString error() const; QString error() const;
void downloading_pieces(bitfield &bf) const; void downloading_pieces(libtorrent::bitfield &bf) const;
// //
// Setters // Setters
@ -125,7 +123,7 @@ class QTorrentHandle : public torrent_handle {
void file_priority(int index, int priority) const; void file_priority(int index, int priority) const;
void set_tracker_login(QString username, QString password); void set_tracker_login(QString username, QString password);
void move_storage(QString path) const; 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 prioritize_first_last_piece(bool b);
void rename_file(int index, QString name); void rename_file(int index, QString name);
bool save_torrent_file(QString path); bool save_torrent_file(QString path);

2
src/reverseresolution.h

@ -46,8 +46,6 @@
#include <boost/asio/ip/tcp.hpp> #include <boost/asio/ip/tcp.hpp>
#endif #endif
using namespace libtorrent;
const int MAX_THREADS = 20; const int MAX_THREADS = 20;
const int CACHE_SIZE = 500; const int CACHE_SIZE = 500;

2
src/speedlimitdlg.h

@ -37,8 +37,6 @@
#include "misc.h" #include "misc.h"
#include "qbtsession.h" #include "qbtsession.h"
using namespace libtorrent;
class SpeedLimitDialog : public QDialog, private Ui_bandwidth_dlg { class SpeedLimitDialog : public QDialog, private Ui_bandwidth_dlg {
Q_OBJECT Q_OBJECT

1
src/src.pro

@ -25,6 +25,7 @@ ICONS_PATH = Icons
# use "CONFIG -= debug" to disable debug # use "CONFIG -= debug" to disable debug
CONFIG += debug CONFIG += debug
#CONFIG += release
# Disable debug output in release mode # Disable debug output in release mode
!debug { !debug {

2
src/statusbar.h

@ -177,7 +177,7 @@ public slots:
void refreshStatusBar() { void refreshStatusBar() {
// Update connection status // Update connection status
const session_status sessionStatus = QBtSession::instance()->getSessionStatus(); const libtorrent::session_status sessionStatus = QBtSession::instance()->getSessionStatus();
if(!QBtSession::instance()->getSession()->is_listening()) { if(!QBtSession::instance()->getSession()->is_listening()) {
connecStatusLblIcon->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/disconnected.png"))); connecStatusLblIcon->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/disconnected.png")));
connecStatusLblIcon->setToolTip(QString::fromUtf8("<b>")+tr("Connection Status:")+QString::fromUtf8("</b><br>")+tr("Offline. This usually means that qBittorrent failed to listen on the selected port for incoming connections.")); connecStatusLblIcon->setToolTip(QString::fromUtf8("<b>")+tr("Connection Status:")+QString::fromUtf8("</b><br>")+tr("Offline. This usually means that qBittorrent failed to listen on the selected port for incoming connections."));

2
src/torrentadditiondlg.cpp

@ -54,6 +54,8 @@
#include "torrentadditiondlg.h" #include "torrentadditiondlg.h"
using namespace libtorrent;
torrentAdditionDialog::torrentAdditionDialog(QWidget *parent) : torrentAdditionDialog::torrentAdditionDialog(QWidget *parent) :
QDialog(parent), old_label(""), hidden_height(0) { QDialog(parent), old_label(""), hidden_height(0) {
const Preferences pref; const Preferences pref;

4
src/torrentadditiondlg.h

@ -37,8 +37,6 @@
#include <libtorrent/torrent_info.hpp> #include <libtorrent/torrent_info.hpp>
using namespace libtorrent;
class TorrentFilesModel; class TorrentFilesModel;
class PropListDelegate; class PropListDelegate;
@ -84,7 +82,7 @@ private:
TorrentFilesModel *PropListModel; TorrentFilesModel *PropListModel;
PropListDelegate *PropDelegate; PropListDelegate *PropDelegate;
unsigned int nbFiles; unsigned int nbFiles;
boost::intrusive_ptr<torrent_info> t; boost::intrusive_ptr<libtorrent::torrent_info> t;
QStringList files_path; QStringList files_path;
bool is_magnet; bool is_magnet;
int hidden_height; int hidden_height;

2
src/torrentcreator/torrentcreatordlg.cpp

@ -41,6 +41,8 @@
const uint NB_PIECES_MIN = 1200; const uint NB_PIECES_MIN = 1200;
const uint NB_PIECES_MAX = 2200; const uint NB_PIECES_MAX = 2200;
using namespace libtorrent;
TorrentCreatorDlg::TorrentCreatorDlg(QWidget *parent): QDialog(parent), creatorThread(0) { TorrentCreatorDlg::TorrentCreatorDlg(QWidget *parent): QDialog(parent), creatorThread(0) {
setupUi(this); setupUi(this);
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);

9
src/torrentfilesmodel.h

@ -40,7 +40,6 @@
#include <libtorrent/torrent_info.hpp> #include <libtorrent/torrent_info.hpp>
#include "proplistdelegate.h" #include "proplistdelegate.h"
#include "misc.h" #include "misc.h"
using namespace libtorrent;
enum FilePriority {IGNORED=0, NORMAL=1, HIGH=2, MAXIMUM=7, PARTIAL=-1}; enum FilePriority {IGNORED=0, NORMAL=1, HIGH=2, MAXIMUM=7, PARTIAL=-1};
enum TreeItemType {TFILE, FOLDER, ROOT}; enum TreeItemType {TFILE, FOLDER, ROOT};
@ -60,7 +59,7 @@ private:
public: public:
// File Construction // File Construction
TreeItem(file_entry f, TreeItem *parent, int _file_index) { TreeItem(libtorrent::file_entry f, TreeItem *parent, int _file_index) {
Q_ASSERT(parent); Q_ASSERT(parent);
parentItem = parent; parentItem = parent;
type = TFILE; type = TFILE;
@ -333,7 +332,7 @@ public:
delete rootItem; delete rootItem;
} }
void updateFilesProgress(std::vector<size_type> fp) { void updateFilesProgress(std::vector<libtorrent::size_type> fp) {
for(unsigned int i=0; i<fp.size(); ++i) { for(unsigned int i=0; i<fp.size(); ++i) {
Q_ASSERT(fp[i] >= 0); Q_ASSERT(fp[i] >= 0);
files_index[i]->setProgress(fp[i]); files_index[i]->setProgress(fp[i]);
@ -519,7 +518,7 @@ public:
emit layoutChanged(); emit layoutChanged();
} }
void setupModelData(torrent_info const& t) { void setupModelData(libtorrent::torrent_info const& t) {
qDebug("setup model data called"); qDebug("setup model data called");
if(t.num_files() == 0) return; if(t.num_files() == 0) return;
// Initialize files_index array // Initialize files_index array
@ -551,7 +550,7 @@ public:
// Iterate over files // Iterate over files
int i = 0; 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()) { while(fi != t.end_files()) {
current_parent = root_folder; current_parent = root_folder;
QString path = QDir::cleanPath(misc::toQStringU(fi->path.string())).replace("\\", "/"); QString path = QDir::cleanPath(misc::toQStringU(fi->path.string())).replace("\\", "/");

14
src/tracker/qpeer.h

@ -4,8 +4,6 @@
#include <libtorrent/entry.hpp> #include <libtorrent/entry.hpp>
#include <QString> #include <QString>
using namespace libtorrent;
struct QPeer { struct QPeer {
bool operator!=(const QPeer &other) const { bool operator!=(const QPeer &other) const {
@ -20,13 +18,13 @@ struct QPeer {
return ip+":"+QString::number(port); return ip+":"+QString::number(port);
} }
entry toEntry(bool no_peer_id) const { libtorrent::entry toEntry(bool no_peer_id) const {
entry::dictionary_type peer_map; libtorrent::entry::dictionary_type peer_map;
if(!no_peer_id) if(!no_peer_id)
peer_map["id"] = entry(peer_id.toStdString()); peer_map["id"] = libtorrent::entry(peer_id.toStdString());
peer_map["ip"] = entry(ip.toStdString()); peer_map["ip"] = libtorrent::entry(ip.toStdString());
peer_map["port"] = entry(port); peer_map["port"] = libtorrent::entry(port);
return entry(peer_map); return libtorrent::entry(peer_map);
} }
QString ip; QString ip;

2
src/trackerlogin.h

@ -37,8 +37,6 @@
#include "ui_login.h" #include "ui_login.h"
#include "qtorrenthandle.h" #include "qtorrenthandle.h"
using namespace libtorrent;
class trackerLogin : public QDialog, private Ui::authentication{ class trackerLogin : public QDialog, private Ui::authentication{
Q_OBJECT Q_OBJECT

2
src/webui/eventmanager.cpp

@ -40,6 +40,8 @@
#include <QDebug> #include <QDebug>
#include <QTranslator> #include <QTranslator>
using namespace libtorrent;
EventManager::EventManager(QObject *parent) EventManager::EventManager(QObject *parent)
: QObject(parent) : QObject(parent)
{ {

2
src/webui/httpconnection.cpp

@ -46,6 +46,8 @@
#include <QRegExp> #include <QRegExp>
#include <QTemporaryFile> #include <QTemporaryFile>
using namespace libtorrent;
HttpConnection::HttpConnection(QTcpSocket *socket, HttpServer *parent) HttpConnection::HttpConnection(QTcpSocket *socket, HttpServer *parent)
: QObject(parent), socket(socket), httpserver(parent) : QObject(parent), socket(socket), httpserver(parent)
{ {

25
winconf.pri

@ -5,15 +5,26 @@ INCLUDEPATH += $$quote(C:/qBittorrent/RC_0_15/zlib)
INCLUDEPATH += $$quote(C:/OpenSSL/include) INCLUDEPATH += $$quote(C:/OpenSSL/include)
LIBS += $$quote(-LC:/OpenSSL/lib/VC) LIBS += $$quote(-LC:/OpenSSL/lib/VC)
LIBS += $$quote(-L$C:/qBittorrent/libs) LIBS += $$quote(-LC:/qBittorrent/libs)
# LIBTORRENT DEFINES # LIBTORRENT DEFINES
DEFINES += BOOST_ALL_NO_LIB BOOST_ASIO_HASH_MAP_BUCKETS=1021 BOOST_EXCEPTION_DISABLE DEFINES += BOOST_ALL_NO_LIB
DEFINES += BOOST_FILESYSTEM_STATIC_LINK=1 BOOST_MULTI_INDEX_DISABLE_SERIALIZATION DEFINES += BOOST_ASIO_HASH_MAP_BUCKETS=1021
DEFINES += BOOST_SYSTEM_STATIC_LINK=1 BOOST_THREAD_USE_LIB BOOST_THREAD_USE_LIB=1 DEFINES += BOOST_EXCEPTION_DISABLE
DEFINES += TORRENT_USE_OPENSSL UNICODE WIN32 WIN32_LEAN_AND_MEAN DEFINES += BOOST_SYSTEM_STATIC_LINK=1
DEFINES += _CRT_SECURE_NO_DEPRECATE _FILE_OFFSET_BITS=64 _SCL_SECURE_NO_DEPRECATE DEFINES += BOOST_THREAD_USE_LIB
DEFINES += _UNICODE _WIN32 _WIN32_WINNT=0x0500 __USE_W32_SOCKETS 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 DEFINES += WITH_SHIPPED_GEOIP_H
debug { debug {

Loading…
Cancel
Save