enc stuff

This commit is contained in:
Marcos Pinto 2007-05-30 08:33:12 +00:00
parent 09367b9798
commit 8938d7d21d
9 changed files with 41 additions and 5 deletions

View File

@ -138,7 +138,7 @@
<widget class="GtkLabel" id="label21">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;b&gt;Estimated Time Remaining:&lt;/b&gt;</property>
<property name="label" translatable="yes">&lt;b&gt;ETA:&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
@ -476,7 +476,7 @@
<widget class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;b&gt;Use compact storage allocation:&lt;/b&gt;</property>
<property name="label" translatable="yes">&lt;b&gt;Use compact allocation:&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
@ -892,7 +892,7 @@
<child>
<widget class="GtkCheckMenuItem" id="chk_eta">
<property name="visible">True</property>
<property name="label" translatable="yes">Time Remaining</property>
<property name="label" translatable="yes">ETA</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<signal name="toggled" handler="eta_toggle"/>

View File

@ -125,6 +125,8 @@ namespace libtorrent
piece_picker(int blocks_per_piece
, int total_num_blocks);
void get_availability(std::vector<int>& avail) const;
void set_sequenced_download_threshold(int sequenced_download_threshold);
// the vector tells which pieces we already have

View File

@ -184,6 +184,8 @@ namespace libtorrent
void filter_files(std::vector<bool> const& files);
// ============ end deprecation =============
void piece_availability(std::vector<int>& avail) const;
void set_piece_priority(int index, int priority);
int piece_priority(int index) const;

View File

@ -269,6 +269,8 @@ namespace libtorrent
// ================ end deprecation ============
void piece_availability(std::vector<int>& avail) const;
// priority must be within the range [0, 7]
void piece_priority(int index, int priority) const;
int piece_priority(int index) const;

View File

@ -1292,6 +1292,17 @@ namespace libtorrent
}
}
void piece_picker::get_availability(std::vector<int>& avail) const
{
TORRENT_PIECE_PICKER_INVARIANT_CHECK;
avail.resize(m_piece_map.size());
std::vector<int>::iterator j = avail.begin();
for (std::vector<piece_pos>::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;

View File

@ -981,7 +981,20 @@ namespace libtorrent
return m_username + ":" + m_password;
}
void torrent::piece_availability(std::vector<int>& 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)
{

View File

@ -351,6 +351,13 @@ namespace libtorrent
, bind(&torrent::name, _1));
}
void torrent_handle::piece_availability(std::vector<int>& avail) const
{
INVARIANT_CHECK;
call_member<void>(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
{

Binary file not shown.

View File

@ -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
src/dialogs.py