From 8938d7d21d9e2c82d6aa6a2f33377c1944d103b5 Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Wed, 30 May 2007 08:33:12 +0000 Subject: [PATCH] enc stuff --- encryption/glade/delugegtk.glade | 6 +++--- .../include/libtorrent/piece_picker.hpp | 2 ++ .../libtorrent/include/libtorrent/torrent.hpp | 2 ++ .../include/libtorrent/torrent_handle.hpp | 2 ++ encryption/libtorrent/src/piece_picker.cpp | 11 +++++++++++ encryption/libtorrent/src/torrent.cpp | 13 +++++++++++++ encryption/libtorrent/src/torrent_handle.cpp | 7 +++++++ encryption/msgfmt.pyc | Bin 4965 -> 4954 bytes encryption/po/POTFILES.in | 3 +-- 9 files changed, 41 insertions(+), 5 deletions(-) diff --git a/encryption/glade/delugegtk.glade b/encryption/glade/delugegtk.glade index 197083d5d..ef56e2394 100644 --- a/encryption/glade/delugegtk.glade +++ b/encryption/glade/delugegtk.glade @@ -138,7 +138,7 @@ True 0 - <b>Estimated Time Remaining:</b> + <b>ETA:</b> True @@ -476,7 +476,7 @@ True 0 - <b>Use compact storage allocation:</b> + <b>Use compact allocation:</b> True @@ -892,7 +892,7 @@ True - Time Remaining + ETA True True diff --git a/encryption/libtorrent/include/libtorrent/piece_picker.hpp b/encryption/libtorrent/include/libtorrent/piece_picker.hpp index 7b8612909..ecbe2df4b 100755 --- a/encryption/libtorrent/include/libtorrent/piece_picker.hpp +++ b/encryption/libtorrent/include/libtorrent/piece_picker.hpp @@ -125,6 +125,8 @@ namespace libtorrent piece_picker(int blocks_per_piece , int total_num_blocks); + void get_availability(std::vector& avail) const; + void set_sequenced_download_threshold(int sequenced_download_threshold); // the vector tells which pieces we already have diff --git a/encryption/libtorrent/include/libtorrent/torrent.hpp b/encryption/libtorrent/include/libtorrent/torrent.hpp index 8943b0db9..1fd14ae26 100755 --- a/encryption/libtorrent/include/libtorrent/torrent.hpp +++ b/encryption/libtorrent/include/libtorrent/torrent.hpp @@ -184,6 +184,8 @@ namespace libtorrent void filter_files(std::vector const& files); // ============ end deprecation ============= + void piece_availability(std::vector& avail) const; + void set_piece_priority(int index, int priority); int piece_priority(int index) const; diff --git a/encryption/libtorrent/include/libtorrent/torrent_handle.hpp b/encryption/libtorrent/include/libtorrent/torrent_handle.hpp index cb4b892d2..3713729d6 100755 --- a/encryption/libtorrent/include/libtorrent/torrent_handle.hpp +++ b/encryption/libtorrent/include/libtorrent/torrent_handle.hpp @@ -269,6 +269,8 @@ namespace libtorrent // ================ end deprecation ============ + void piece_availability(std::vector& avail) const; + // priority must be within the range [0, 7] void piece_priority(int index, int priority) const; int piece_priority(int index) const; diff --git a/encryption/libtorrent/src/piece_picker.cpp b/encryption/libtorrent/src/piece_picker.cpp index cf6eb4a0e..6ec697755 100755 --- a/encryption/libtorrent/src/piece_picker.cpp +++ b/encryption/libtorrent/src/piece_picker.cpp @@ -1292,6 +1292,17 @@ namespace libtorrent } } + void piece_picker::get_availability(std::vector& avail) const + { + TORRENT_PIECE_PICKER_INVARIANT_CHECK; + + avail.resize(m_piece_map.size()); + std::vector::iterator j = avail.begin(); + for (std::vector::const_iterator i = m_piece_map.begin() + , end(m_piece_map.end()); i != end; ++i, ++j) + *j = i->peer_count; + } + void piece_picker::mark_as_finished(piece_block block, const tcp::endpoint& peer) { TORRENT_PIECE_PICKER_INVARIANT_CHECK; diff --git a/encryption/libtorrent/src/torrent.cpp b/encryption/libtorrent/src/torrent.cpp index 6678a756e..1001cd2b0 100755 --- a/encryption/libtorrent/src/torrent.cpp +++ b/encryption/libtorrent/src/torrent.cpp @@ -981,7 +981,20 @@ namespace libtorrent return m_username + ":" + m_password; } + void torrent::piece_availability(std::vector& avail) const + { + INVARIANT_CHECK; + assert(valid_metadata()); + if (is_seed()) + { + avail.clear(); + return; + } + + m_picker->get_availability(avail); + } + void torrent::set_piece_priority(int index, int priority) { diff --git a/encryption/libtorrent/src/torrent_handle.cpp b/encryption/libtorrent/src/torrent_handle.cpp index da571ab63..b1dcdc9b9 100755 --- a/encryption/libtorrent/src/torrent_handle.cpp +++ b/encryption/libtorrent/src/torrent_handle.cpp @@ -351,6 +351,13 @@ namespace libtorrent , bind(&torrent::name, _1)); } + void torrent_handle::piece_availability(std::vector& avail) const + { + INVARIANT_CHECK; + + call_member(m_ses, m_chk, m_info_hash + , bind(&torrent::piece_availability, _1, boost::ref(avail))); + } void torrent_handle::piece_priority(int index, int priority) const { diff --git a/encryption/msgfmt.pyc b/encryption/msgfmt.pyc index d4d793735b9a52be125cb360ef37b6e27c03c37e..386e797dde9bf4adf2771e9f8f374cbfbfa09bf1 100644 GIT binary patch delta 31 mcmaE=c1w*t_Y*HyvRLd!c4Zbu<;mJClFX@j$(w^%g!uuUxCo&D delta 42 ycmcbm_Ee2M_Y*Id#lh%}?8+>RdXu$TB>76yQ}t8xl8Y(}N;32FHoLP3^8)}fyA7`Z diff --git a/encryption/po/POTFILES.in b/encryption/po/POTFILES.in index 41e8c396d..7d2c9f30e 100644 --- a/encryption/po/POTFILES.in +++ b/encryption/po/POTFILES.in @@ -1,9 +1,8 @@ glade/delugegtk.glade glade/dgtkpopups.glade -glade/dgtkpref.glade glade/preferences_dialog.glade glade/torrent_menu.glade src/common.py src/core.py src/interface.py -src/dialogs.py \ No newline at end of file +src/dialogs.py