* Refactoring to change the DownloadList events to commands.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1046 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2008-03-23 12:16:18 +00:00
parent 199bd1985c
commit 8fbaca61b1
11 changed files with 127 additions and 48 deletions
+13 -9
View File
@@ -98,7 +98,7 @@ DownloadList::activate(display::Frame* frame, bool focus) {
m_frame = frame;
control->input()->push_back(&m_bindings);
control->core()->download_list()->slot_map_erase()["0_download_list"] = sigc::mem_fun(this, &DownloadList::receive_download_erased);
control->core()->download_list()->slot_map_erase()["0_download_list"] = sigc::bind(&rpc::parse_command_d_single_std, "ui.unfocus_download=");
activate_display(DISPLAY_DOWNLOAD_LIST);
}
@@ -121,6 +121,18 @@ DownloadList::current_view() {
return dynamic_cast<ElementDownloadList*>(m_uiArray[DISPLAY_DOWNLOAD_LIST])->view();
}
// This should also do focus_next() or something.
void
DownloadList::unfocus_download(core::Download* d) {
if (current_view()->focus() >= current_view()->end_visible() || *current_view()->focus() != d)
return;
if (m_state == DISPLAY_DOWNLOAD)
activate_display(DISPLAY_DOWNLOAD_LIST);
current_view()->next_focus();
}
void
DownloadList::activate_display(Display displayType) {
if (!is_active())
@@ -316,14 +328,6 @@ DownloadList::receive_exit_input(Input type) {
delete input;
}
void
DownloadList::receive_download_erased(core::Download* d) {
if (m_state != DISPLAY_DOWNLOAD || current_view()->focus() == current_view()->end_visible() || *current_view()->focus() != d)
return;
activate_display(DISPLAY_DOWNLOAD_LIST);
}
void
DownloadList::setup_keys() {
m_bindings['\x7f'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), INPUT_LOAD_DEFAULT);
+2 -2
View File
@@ -104,6 +104,8 @@ public:
void slot_open_uri(SlotOpenUri s) { m_slotOpenUri = s; }
void unfocus_download(core::Download* d);
private:
DownloadList(const DownloadList&);
void operator = (const DownloadList&);
@@ -111,8 +113,6 @@ private:
void receive_view_input(Input type);
void receive_exit_input(Input type);
void receive_download_erased(core::Download* d);
void setup_keys();
void setup_input();