Revert "Fix libtorrent 1.0.0 compilation. Closes #1659"

This reverts commit f4a9597ae8.
This commit is contained in:
sledgehammer999 2014-05-13 19:29:44 +03:00
commit 1af271653a
2 changed files with 8 additions and 17 deletions

View file

@ -382,7 +382,7 @@ QStandardItem* PeerListWidget::addPeer(const QString& ip, const peer_info& peer)
m_missingFlags.insert(ip); m_missingFlags.insert(ip);
} }
} }
m_listModel->setData(m_listModel->index(row, PeerListDelegate::CONNECTION), getConnectionString(peer)); m_listModel->setData(m_listModel->index(row, PeerListDelegate::CONNECTION), getConnectionString(peer.connection_type));
QString flags, tooltip; QString flags, tooltip;
getFlags(peer, flags, tooltip); getFlags(peer, flags, tooltip);
m_listModel->setData(m_listModel->index(row, PeerListDelegate::FLAGS), flags); m_listModel->setData(m_listModel->index(row, PeerListDelegate::FLAGS), flags);
@ -408,7 +408,7 @@ void PeerListWidget::updatePeer(const QString& ip, const peer_info& peer) {
m_missingFlags.remove(ip); m_missingFlags.remove(ip);
} }
} }
m_listModel->setData(m_listModel->index(row, PeerListDelegate::CONNECTION), getConnectionString(peer)); m_listModel->setData(m_listModel->index(row, PeerListDelegate::CONNECTION), getConnectionString(peer.connection_type));
QString flags, tooltip; QString flags, tooltip;
getFlags(peer, flags, tooltip); getFlags(peer, flags, tooltip);
m_listModel->setData(m_listModel->index(row, PeerListDelegate::FLAGS), flags); m_listModel->setData(m_listModel->index(row, PeerListDelegate::FLAGS), flags);
@ -439,19 +439,14 @@ void PeerListWidget::handleSortColumnChanged(int col)
} }
} }
QString PeerListWidget::getConnectionString(const peer_info& peer) QString PeerListWidget::getConnectionString(int connection_type)
{ {
#if LIBTORRENT_VERSION_NUM < 10000
if (peer.connection_type & peer_info::bittorrent_utp) {
#else
if (peer.flags & peer_info::utp_socket) {
#endif
return QString::fromUtf8("μTP");
}
QString connection; QString connection;
switch(peer.connection_type) { switch(connection_type) {
#if LIBTORRENT_VERSION_NUM >= 1600 #if LIBTORRENT_VERSION_NUM >= 1600
case peer_info::bittorrent_utp:
connection = "uTP";
break;
case peer_info::http_seed: case peer_info::http_seed:
#endif #endif
case peer_info::web_seed: case peer_info::web_seed:
@ -560,11 +555,7 @@ void PeerListWidget::getFlags(const peer_info& peer, QString& flags, QString& to
} }
#if LIBTORRENT_VERSION_NUM > 1500 //P = Peer is using uTorrent uTP #if LIBTORRENT_VERSION_NUM > 1500 //P = Peer is using uTorrent uTP
#if LIBTORRENT_VERSION_NUM < 10000
if (peer.connection_type & peer_info::bittorrent_utp) { if (peer.connection_type & peer_info::bittorrent_utp) {
#else
if (peer.flags & peer_info::utp_socket) {
#endif
flags += "P "; flags += "P ";
tooltip += QString::fromUtf8("μTP"); tooltip += QString::fromUtf8("μTP");
tooltip += ", "; tooltip += ", ";

View file

@ -83,7 +83,7 @@ protected slots:
void handleSortColumnChanged(int col); void handleSortColumnChanged(int col);
private: private:
static QString getConnectionString(const libtorrent::peer_info &peer); static QString getConnectionString(int connection_type);
static void getFlags(const libtorrent::peer_info& peer, QString& flags, QString& tooltip); static void getFlags(const libtorrent::peer_info& peer, QString& flags, QString& tooltip);
private: private: