* Cleaned up torrent::Rate and moved it to the API. Changed various

parts of the API to return torrent::Rate instead of specific functions
for each stat.

* Use 600 second time span for peer rates.

* Added core::DownloadFactory which allows for an async http get and
changing of settings. This will allow the implementation of a
configuration screen when pressing "return", while the client is
downloading or finished downloading a torrent file.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@491 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2005-07-09 15:28:56 +00:00
parent a195933a2a
commit 26a7907f0a
20 changed files with 376 additions and 92 deletions
+18 -8
View File
@@ -43,6 +43,7 @@
#include <torrent/torrent.h>
#include "core/download.h"
#include "core/download_factory.h"
#include "input/bindings.h"
#include "input/path_input.h"
@@ -130,7 +131,7 @@ DownloadList::disable() {
if (m_windowTextInput->is_active()) {
m_windowTextInput->get_input()->clear();
receive_exit_input();
receive_exit_input(true);
}
disable_display();
@@ -239,7 +240,7 @@ DownloadList::receive_check_hash() {
}
void
DownloadList::receive_view_input() {
DownloadList::receive_view_input(bool useDefault) {
m_control->get_ui().window_statusbar()->set_active(false);
m_windowTextInput->set_active(true);
m_control->get_display().adjust_layout();
@@ -248,19 +249,26 @@ DownloadList::receive_view_input() {
m_windowTextInput->set_focus(true);
(*m_bindings)['\n'] = sigc::mem_fun(*this, &DownloadList::receive_exit_input);
(*m_bindings)[KEY_ENTER] = sigc::mem_fun(*this, &DownloadList::receive_exit_input);
(*m_bindings)['\n'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_exit_input), useDefault);
(*m_bindings)[KEY_ENTER] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_exit_input), useDefault);
}
void
DownloadList::receive_exit_input() {
DownloadList::receive_exit_input(bool useDefault) {
m_control->get_ui().window_statusbar()->set_active(true);
m_windowTextInput->set_active(false);
m_control->get_input().set_text_input();
m_slotOpenUri(m_windowTextInput->get_input()->str());
// Adding download.
core::DownloadFactory* f = new core::DownloadFactory(m_windowTextInput->get_input()->str(), &m_control->get_core());
f->set_start(useDefault);
f->slot_finished(sigc::bind(sigc::ptr_fun(&rak::call_delete_func<core::DownloadFactory>), f));
f->load();
f->commit();
// Clean up.
m_windowTextInput->get_input()->clear();
m_windowTextInput->set_focus(false);
@@ -292,8 +300,10 @@ DownloadList::setup_keys() {
(*m_bindings)['\x04'] = sigc::mem_fun(*this, &DownloadList::receive_stop_download);
(*m_bindings)['\x12'] = sigc::mem_fun(*this, &DownloadList::receive_check_hash);
(*m_bindings)['\x7f'] = sigc::mem_fun(*this, &DownloadList::receive_view_input);
(*m_bindings)[KEY_BACKSPACE] = sigc::mem_fun(*this, &DownloadList::receive_view_input);
(*m_bindings)['\x7f'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), true);
(*m_bindings)[KEY_BACKSPACE] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), true);
(*m_bindings)['\n'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), false);
(*m_bindings)[KEY_ENTER] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), false);
(*m_bindings)[KEY_UP] = sigc::mem_fun(*this, &DownloadList::receive_prev);
(*m_bindings)[KEY_DOWN] = sigc::mem_fun(*this, &DownloadList::receive_next);
+2 -2
View File
@@ -114,8 +114,8 @@ private:
void receive_check_hash();
void receive_view_input();
void receive_exit_input();
void receive_view_input(bool useDefault);
void receive_exit_input(bool useDefault);
void receive_change(Display d);
+1 -1
View File
@@ -68,7 +68,7 @@ Root::init(Control* c) {
m_control->get_display().push_back(m_windowStatusbar);
m_downloadList->activate();
m_downloadList->slot_open_uri(sigc::mem_fun(m_control->get_core(), &core::Manager::insert));
// m_downloadList->slot_open_uri(sigc::mem_fun(m_control->get_core(), &core::Manager::insert));
}
void