mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-06 22:29:23 +00:00
* Show "Hashing:" for torrents that are queued for hashing.
* Allow different min/max peers setting for seeding. Patch by Josef Drexler. * Man page entry for "safe_sync" and "max/min_peers_seed". * The p,o,i,u keys are now bound so they change ElementMenu directly. * Bound ^P and ^N for moving up/down. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@758 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+7
-7
@@ -115,7 +115,7 @@ Download::create_menu() {
|
||||
element->push_back("File list",
|
||||
sigc::bind(sigc::mem_fun(this, &Download::activate_display_focus), DISPLAY_FILE_LIST),
|
||||
sigc::bind(sigc::mem_fun(this, &Download::activate_display_menu), DISPLAY_FILE_LIST));
|
||||
element->push_back("Tracker kist",
|
||||
element->push_back("Tracker list",
|
||||
sigc::bind(sigc::mem_fun(this, &Download::activate_display_focus), DISPLAY_TRACKER_LIST),
|
||||
sigc::bind(sigc::mem_fun(this, &Download::activate_display_menu), DISPLAY_TRACKER_LIST));
|
||||
element->push_back("Chunks seen",
|
||||
@@ -125,7 +125,12 @@ Download::create_menu() {
|
||||
sigc::bind(sigc::mem_fun(this, &Download::activate_display_focus), DISPLAY_TRANSFER_LIST),
|
||||
sigc::bind(sigc::mem_fun(this, &Download::activate_display_menu), DISPLAY_TRANSFER_LIST));
|
||||
|
||||
element->set_entry(0);
|
||||
element->set_entry(0, false);
|
||||
|
||||
m_bindings['p'] = sigc::bind(sigc::mem_fun(element, &ElementMenu::set_entry_trigger), 0);
|
||||
m_bindings['o'] = sigc::bind(sigc::mem_fun(element, &ElementMenu::set_entry_trigger), 1);
|
||||
m_bindings['i'] = sigc::bind(sigc::mem_fun(element, &ElementMenu::set_entry_trigger), 2);
|
||||
m_bindings['u'] = sigc::bind(sigc::mem_fun(element, &ElementMenu::set_entry_trigger), 3);
|
||||
|
||||
return element;
|
||||
}
|
||||
@@ -314,11 +319,6 @@ Download::bind_keys() {
|
||||
|
||||
m_bindings['t'] = sigc::bind(sigc::mem_fun(m_download->tracker_list(), &torrent::TrackerList::manual_request), false);
|
||||
m_bindings['T'] = sigc::bind(sigc::mem_fun(m_download->tracker_list(), &torrent::TrackerList::manual_request), true);
|
||||
|
||||
m_bindings['p'] = sigc::bind(sigc::mem_fun(this, &Download::activate_display_focus), DISPLAY_PEER_LIST);
|
||||
m_bindings['o'] = sigc::bind(sigc::mem_fun(this, &Download::activate_display_focus), DISPLAY_TRACKER_LIST);
|
||||
m_bindings['i'] = sigc::bind(sigc::mem_fun(this, &Download::activate_display_focus), DISPLAY_CHUNKS_SEEN);
|
||||
m_bindings['u'] = sigc::bind(sigc::mem_fun(this, &Download::activate_display_focus), DISPLAY_TRANSFER_LIST);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -78,8 +78,8 @@ ElementDownloadList::ElementDownloadList() :
|
||||
m_bindings['6'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_change_view), "incomplete");
|
||||
m_bindings['7'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_change_view), "hashing");
|
||||
|
||||
m_bindings[KEY_UP] = sigc::mem_fun(*this, &ElementDownloadList::receive_prev);
|
||||
m_bindings[KEY_DOWN] = sigc::mem_fun(*this, &ElementDownloadList::receive_next);
|
||||
m_bindings[KEY_UP] = m_bindings['P' - '@'] = sigc::mem_fun(*this, &ElementDownloadList::receive_prev);
|
||||
m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = sigc::mem_fun(*this, &ElementDownloadList::receive_next);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -57,10 +57,11 @@ ElementFileList::ElementFileList(core::Download* d) :
|
||||
|
||||
m_bindings[' '] = sigc::mem_fun(*this, &ElementFileList::receive_priority);
|
||||
m_bindings['*'] = sigc::mem_fun(*this, &ElementFileList::receive_change_all);
|
||||
m_bindings[KEY_DOWN] = sigc::mem_fun(*this, &ElementFileList::receive_next);
|
||||
m_bindings[KEY_UP] = sigc::mem_fun(*this, &ElementFileList::receive_prev);
|
||||
m_bindings[KEY_NPAGE] = sigc::mem_fun(*this, &ElementFileList::receive_pagenext);
|
||||
m_bindings[KEY_PPAGE] = sigc::mem_fun(*this, &ElementFileList::receive_pageprev);
|
||||
|
||||
m_bindings[KEY_DOWN] = m_bindings['P' - '@'] = sigc::mem_fun(*this, &ElementFileList::receive_next);
|
||||
m_bindings[KEY_UP] = m_bindings['N' - '@'] = sigc::mem_fun(*this, &ElementFileList::receive_prev);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
+30
-24
@@ -55,16 +55,35 @@ struct ElementMenuEntry {
|
||||
ElementMenu::slot_type m_slotSelect;
|
||||
};
|
||||
|
||||
inline void
|
||||
ElementMenu::focus_entry(size_type idx) {
|
||||
if (idx >= size())
|
||||
return;
|
||||
|
||||
if (m_focus)
|
||||
base_type::operator[](idx)->m_element->set_attributes(display::Attributes::a_reverse);
|
||||
else
|
||||
base_type::operator[](idx)->m_element->set_attributes(display::Attributes::a_bold);
|
||||
}
|
||||
|
||||
inline void
|
||||
ElementMenu::unfocus_entry(size_type idx) {
|
||||
if (idx >= size())
|
||||
return;
|
||||
|
||||
base_type::operator[](idx)->m_element->set_attributes(display::Attributes::a_normal);
|
||||
}
|
||||
|
||||
ElementMenu::ElementMenu() :
|
||||
m_window(new WindowText(NULL, 2)),
|
||||
m_entry(entry_invalid) {
|
||||
|
||||
// Move bindings into a function that defines default bindings.
|
||||
m_bindings[KEY_LEFT] = sigc::mem_fun(&m_slotExit, &slot_type::operator());
|
||||
|
||||
m_bindings[KEY_UP] = sigc::mem_fun(this, &ElementMenu::entry_prev);
|
||||
m_bindings[KEY_DOWN] = sigc::mem_fun(this, &ElementMenu::entry_next);
|
||||
m_bindings[KEY_RIGHT] = sigc::mem_fun(this, &ElementMenu::entry_select);
|
||||
|
||||
m_bindings[KEY_UP] = m_bindings['P' - '@'] = sigc::mem_fun(this, &ElementMenu::entry_prev);
|
||||
m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = sigc::mem_fun(this, &ElementMenu::entry_next);
|
||||
}
|
||||
|
||||
ElementMenu::~ElementMenu() {
|
||||
@@ -80,13 +99,12 @@ ElementMenu::activate(display::Frame* frame, bool focus) {
|
||||
control->input()->push_back(&m_bindings);
|
||||
|
||||
m_focus = focus;
|
||||
focus_entry(m_entry);
|
||||
|
||||
m_frame = frame;
|
||||
m_frame->initialize_window(m_window);
|
||||
|
||||
m_window->set_active(true);
|
||||
|
||||
focus_entry(m_entry);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -158,35 +176,23 @@ ElementMenu::entry_select() {
|
||||
return;
|
||||
|
||||
base_type::operator[](m_entry)->m_slotSelect();
|
||||
|
||||
m_window->mark_dirty();
|
||||
}
|
||||
|
||||
void
|
||||
ElementMenu::set_entry(size_type idx) {
|
||||
ElementMenu::set_entry(size_type idx, bool triggerSlot) {
|
||||
if (idx == m_entry)
|
||||
return;
|
||||
|
||||
unfocus_entry(m_entry);
|
||||
|
||||
m_entry = idx;
|
||||
focus_entry(m_entry);
|
||||
}
|
||||
|
||||
inline void
|
||||
ElementMenu::focus_entry(size_type idx) {
|
||||
if (idx >= size())
|
||||
return;
|
||||
if (triggerSlot)
|
||||
base_type::operator[](m_entry)->m_slotFocus();
|
||||
|
||||
if (m_focus)
|
||||
base_type::operator[](idx)->m_element->set_attributes(display::Attributes::a_reverse);
|
||||
else
|
||||
base_type::operator[](idx)->m_element->set_attributes(display::Attributes::a_bold);
|
||||
}
|
||||
|
||||
inline void
|
||||
ElementMenu::unfocus_entry(size_type idx) {
|
||||
if (idx >= size())
|
||||
return;
|
||||
|
||||
base_type::operator[](idx)->m_element->set_attributes(display::Attributes::a_normal);
|
||||
m_window->mark_dirty();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -91,12 +91,12 @@ public:
|
||||
|
||||
void entry_select();
|
||||
|
||||
// Does not trigger the callback.
|
||||
void set_entry(size_type idx);
|
||||
void set_entry(size_type idx, bool triggerSlot);
|
||||
void set_entry_trigger(size_type idx) { set_entry(idx, true); }
|
||||
|
||||
private:
|
||||
inline void focus_entry(size_type idx);
|
||||
inline void unfocus_entry(size_type idx);
|
||||
void focus_entry(size_type idx);
|
||||
void unfocus_entry(size_type idx);
|
||||
|
||||
WindowText* m_window;
|
||||
|
||||
|
||||
@@ -72,10 +72,11 @@ ElementPeerList::ElementPeerList(core::Download* d) :
|
||||
|
||||
m_bindings['k'] = sigc::mem_fun(this, &ElementPeerList::receive_disconnect_peer);
|
||||
m_bindings['*'] = sigc::mem_fun(this, &ElementPeerList::receive_snub_peer);
|
||||
m_bindings[KEY_UP] = sigc::mem_fun(this, &ElementPeerList::receive_prev);
|
||||
m_bindings[KEY_DOWN] = sigc::mem_fun(this, &ElementPeerList::receive_next);
|
||||
m_bindings[KEY_LEFT] = sigc::mem_fun(&m_slotExit, &slot_type::operator());
|
||||
m_bindings[KEY_RIGHT] = sigc::bind(sigc::mem_fun(this, &ElementPeerList::activate_display), DISPLAY_INFO);
|
||||
|
||||
m_bindings[KEY_UP] = m_bindings['P' - '@'] = sigc::mem_fun(this, &ElementPeerList::receive_prev);
|
||||
m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = sigc::mem_fun(this, &ElementPeerList::receive_next);
|
||||
}
|
||||
|
||||
ElementPeerList::~ElementPeerList() {
|
||||
@@ -113,11 +114,11 @@ ElementPeerList::create_info() {
|
||||
element->push_column("Snubbed:", display::text_element_branch(std::mem_fun(&torrent::Peer::is_snubbed), te_string("yes"), te_string("no")));
|
||||
element->push_column("Done:", display::text_element_value_slot(rak::on(std::mem_fun(&torrent::Peer::bitfield), std::ptr_fun(&te_bitfield_percentage))));
|
||||
element->push_column("Rate:",
|
||||
display::text_element_value_slot(rak::on(std::mem_fun(&torrent::Peer::up_rate), std::mem_fun(&torrent::Rate::rate)), value_base::flag_kb), " / ",
|
||||
display::text_element_value_slot(rak::on(std::mem_fun(&torrent::Peer::up_rate), std::mem_fun(&torrent::Rate::rate)), value_base::flag_kb), " KB / ",
|
||||
display::text_element_value_slot(rak::on(std::mem_fun(&torrent::Peer::down_rate), std::mem_fun(&torrent::Rate::rate)), value_base::flag_kb), " KB");
|
||||
element->push_column("Total:",
|
||||
display::text_element_value_slot(rak::on(std::mem_fun(&torrent::Peer::up_rate), std::mem_fun(&torrent::Rate::total)), value_base::flag_mb), " / ",
|
||||
display::text_element_value_slot(rak::on(std::mem_fun(&torrent::Peer::down_rate), std::mem_fun(&torrent::Rate::total)), value_base::flag_mb), " MB");
|
||||
display::text_element_value_slot(rak::on(std::mem_fun(&torrent::Peer::up_rate), std::mem_fun(&torrent::Rate::total)), value_base::flag_xb), " / ",
|
||||
display::text_element_value_slot(rak::on(std::mem_fun(&torrent::Peer::down_rate), std::mem_fun(&torrent::Rate::total)), value_base::flag_xb));
|
||||
|
||||
element->set_column_width(element->column_width() + 1);
|
||||
|
||||
|
||||
@@ -56,10 +56,11 @@ ElementTrackerList::ElementTrackerList(core::Download* d) :
|
||||
|
||||
m_bindings[KEY_LEFT] = sigc::mem_fun(&m_slotExit, &slot_type::operator());
|
||||
|
||||
m_bindings[KEY_DOWN] = sigc::mem_fun(*this, &ElementTrackerList::receive_next);
|
||||
m_bindings[KEY_UP] = sigc::mem_fun(*this, &ElementTrackerList::receive_prev);
|
||||
m_bindings[' '] = sigc::mem_fun(*this, &ElementTrackerList::receive_cycle_group);
|
||||
m_bindings['*'] = sigc::mem_fun(*this, &ElementTrackerList::receive_disable);
|
||||
|
||||
m_bindings[KEY_DOWN] = m_bindings['P' - '@'] = sigc::mem_fun(*this, &ElementTrackerList::receive_next);
|
||||
m_bindings[KEY_UP] = m_bindings['N' - '@'] = sigc::mem_fun(*this, &ElementTrackerList::receive_prev);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user