mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-14 06:02:31 +00:00
* Fixed an overflow in rak::partial_queue, and added some exceptions.
* Changed to configure script so --disable-mincore must be called explicitly to disable it. * API and core::Download cleanup. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@660 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+10
-15
@@ -62,7 +62,7 @@ Download::Download(DPtr d, Control* c) :
|
||||
m_download(d),
|
||||
m_state(DISPLAY_MAX_SIZE),
|
||||
|
||||
m_windowTitle(new WTitle(d->get_download().name())),
|
||||
m_windowTitle(new WTitle(d->download()->name())),
|
||||
m_windowDownloadStatus(new WDownloadStatus(d)),
|
||||
|
||||
m_window(c->display()->end()),
|
||||
@@ -80,10 +80,10 @@ Download::Download(DPtr d, Control* c) :
|
||||
|
||||
bind_keys();
|
||||
|
||||
m_download->get_download().peer_list(m_peers);
|
||||
m_download->download()->peer_list(m_peers);
|
||||
|
||||
m_connPeerConnected = m_download->get_download().signal_peer_connected(sigc::mem_fun(*this, &Download::receive_peer_connected));
|
||||
m_connPeerDisconnected = m_download->get_download().signal_peer_disconnected(sigc::mem_fun(*this, &Download::receive_peer_disconnected));
|
||||
m_connPeerConnected = m_download->download()->signal_peer_connected(sigc::mem_fun(*this, &Download::receive_peer_connected));
|
||||
m_connPeerDisconnected = m_download->download()->signal_peer_disconnected(sigc::mem_fun(*this, &Download::receive_peer_disconnected));
|
||||
}
|
||||
|
||||
Download::~Download() {
|
||||
@@ -179,7 +179,7 @@ Download::receive_disconnect_peer() {
|
||||
if (m_focus == m_peers.end())
|
||||
return;
|
||||
|
||||
m_download->get_download().disconnect_peer(*m_focus);
|
||||
m_download->download()->disconnect_peer(*m_focus);
|
||||
|
||||
mark_dirty();
|
||||
}
|
||||
@@ -206,21 +206,21 @@ void
|
||||
Download::receive_max_uploads(int t) {
|
||||
m_windowDownloadStatus->mark_dirty();
|
||||
|
||||
m_download->get_download().set_uploads_max(std::max(m_download->get_download().uploads_max() + t, (uint32_t)2));
|
||||
m_download->download()->set_uploads_max(std::max(m_download->download()->uploads_max() + t, (uint32_t)2));
|
||||
}
|
||||
|
||||
void
|
||||
Download::receive_min_peers(int t) {
|
||||
m_windowDownloadStatus->mark_dirty();
|
||||
|
||||
m_download->get_download().set_peers_min(std::max(m_download->get_download().peers_min() + t, (uint32_t)5));
|
||||
m_download->download()->set_peers_min(std::max(m_download->download()->peers_min() + t, (uint32_t)5));
|
||||
}
|
||||
|
||||
void
|
||||
Download::receive_max_peers(int t) {
|
||||
m_windowDownloadStatus->mark_dirty();
|
||||
|
||||
m_download->get_download().set_peers_max(std::max(m_download->get_download().peers_max() + t, (uint32_t)5));
|
||||
m_download->download()->set_peers_max(std::max(m_download->download()->peers_max() + t, (uint32_t)5));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -252,11 +252,6 @@ Download::receive_prev_priority() {
|
||||
m_download->set_priority((m_download->priority() - 1) % 4);
|
||||
}
|
||||
|
||||
void
|
||||
Download::receive_manual_request(bool force) {
|
||||
m_download->get_download().tracker_list().manual_request(force);
|
||||
}
|
||||
|
||||
void
|
||||
Download::bind_keys() {
|
||||
(*m_bindings)['1'] = sigc::bind(sigc::mem_fun(this, &Download::receive_max_uploads), -1);
|
||||
@@ -270,8 +265,8 @@ Download::bind_keys() {
|
||||
|
||||
(*m_bindings)['k'] = sigc::mem_fun(this, &Download::receive_disconnect_peer);
|
||||
|
||||
(*m_bindings)['t'] = sigc::bind(sigc::mem_fun(this, &Download::receive_manual_request), false);
|
||||
(*m_bindings)['T'] = sigc::bind(sigc::mem_fun(this, &Download::receive_manual_request), true);
|
||||
(*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::receive_change), DISPLAY_PEER_INFO);
|
||||
(*m_bindings)['o'] = sigc::bind(sigc::mem_fun(this, &Download::receive_change), DISPLAY_TRACKER_LIST);
|
||||
|
||||
@@ -110,7 +110,6 @@ private:
|
||||
void receive_change(Display d);
|
||||
|
||||
void receive_snub_peer();
|
||||
void receive_manual_request(bool force);
|
||||
|
||||
void bind_keys();
|
||||
|
||||
|
||||
@@ -200,7 +200,7 @@ DownloadList::receive_stop_download() {
|
||||
if (m_downloadList.get_focus() == m_downloadList.end())
|
||||
return;
|
||||
|
||||
if ((*m_downloadList.get_focus())->get_download().is_active())
|
||||
if ((*m_downloadList.get_focus())->download()->is_active())
|
||||
m_control->core()->download_list().stop(*m_downloadList.get_focus());
|
||||
else
|
||||
m_downloadList.set_focus(m_control->core()->download_list().erase(m_downloadList.get_focus()));
|
||||
@@ -282,7 +282,7 @@ DownloadList::receive_view_input(Input type) {
|
||||
m_windowTextInput->set_focus(true);
|
||||
|
||||
if (type == INPUT_CHANGE_DIRECTORY) {
|
||||
m_windowTextInput->get_input()->str() = m_control->variables()->get_string("directory");
|
||||
m_windowTextInput->get_input()->str() = m_control->variable()->get_string("directory");
|
||||
m_windowTextInput->get_input()->set_pos(m_windowTextInput->get_input()->str().length());
|
||||
}
|
||||
|
||||
@@ -315,12 +315,12 @@ DownloadList::receive_exit_input(Input type) {
|
||||
if (m_downloadList.get_focus() == m_downloadList.end())
|
||||
throw torrent::input_error("No download in focus to change root directory.");
|
||||
|
||||
(*m_downloadList.get_focus())->variables()->set("directory", rak::trim(m_windowTextInput->get_input()->str()));
|
||||
m_control->core()->push_log("New root dir \"" + (*m_downloadList.get_focus())->variables()->get_string("directory") + "\" for torrent.");
|
||||
(*m_downloadList.get_focus())->variable()->set("directory", rak::trim(m_windowTextInput->get_input()->str()));
|
||||
m_control->core()->push_log("New root dir \"" + (*m_downloadList.get_focus())->variable()->get_string("directory") + "\" for torrent.");
|
||||
break;
|
||||
|
||||
case INPUT_COMMAND:
|
||||
m_control->variables()->process_command(m_windowTextInput->get_input()->str());
|
||||
m_control->variable()->process_command(m_windowTextInput->get_input()->str());
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -82,10 +82,10 @@ ElementChunksSeen::disable(Control* c) {
|
||||
// if (m_window == NULL)
|
||||
// throw std::logic_error("ui::ElementChunksSeen::receive_disable(...) called on a disabled object");
|
||||
|
||||
// if (m_download->get_download().tracker(m_focus).is_enabled())
|
||||
// m_download->get_download().tracker(m_focus).disable();
|
||||
// if (m_download->download()->tracker(m_focus).is_enabled())
|
||||
// m_download->download()->tracker(m_focus).disable();
|
||||
// else
|
||||
// m_download->get_download().tracker(m_focus).enable();
|
||||
// m_download->download()->tracker(m_focus).enable();
|
||||
|
||||
// m_window->mark_dirty();
|
||||
// }
|
||||
|
||||
@@ -84,7 +84,7 @@ ElementFileList::receive_next() {
|
||||
if (m_window == NULL)
|
||||
throw torrent::internal_error("ui::ElementFileList::receive_next(...) called on a disabled object");
|
||||
|
||||
if (++m_focus >= m_download->get_download().file_list().size())
|
||||
if (++m_focus >= m_download->download()->file_list().size())
|
||||
m_focus = 0;
|
||||
|
||||
m_window->mark_dirty();
|
||||
@@ -95,7 +95,7 @@ ElementFileList::receive_prev() {
|
||||
if (m_window == NULL)
|
||||
throw torrent::internal_error("ui::ElementFileList::receive_prev(...) called on a disabled object");
|
||||
|
||||
torrent::FileList fl = m_download->get_download().file_list();
|
||||
torrent::FileList fl = m_download->download()->file_list();
|
||||
|
||||
if (fl.size() == 0)
|
||||
return;
|
||||
@@ -113,7 +113,7 @@ ElementFileList::receive_priority() {
|
||||
if (m_window == NULL)
|
||||
throw torrent::internal_error("ui::ElementFileList::receive_prev(...) called on a disabled object");
|
||||
|
||||
torrent::FileList fl = m_download->get_download().file_list();
|
||||
torrent::FileList fl = m_download->download()->file_list();
|
||||
|
||||
if (m_focus >= fl.size())
|
||||
return;
|
||||
@@ -122,7 +122,7 @@ ElementFileList::receive_priority() {
|
||||
|
||||
file.set_priority(next_priority(file.priority()));
|
||||
|
||||
m_download->get_download().update_priorities();
|
||||
m_download->download()->update_priorities();
|
||||
m_window->mark_dirty();
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ ElementFileList::receive_change_all() {
|
||||
if (m_window == NULL)
|
||||
throw torrent::internal_error("ui::ElementFileList::receive_prev(...) called on a disabled object");
|
||||
|
||||
torrent::FileList fl = m_download->get_download().file_list();
|
||||
torrent::FileList fl = m_download->download()->file_list();
|
||||
|
||||
if (m_focus >= fl.size())
|
||||
return;
|
||||
@@ -141,7 +141,7 @@ ElementFileList::receive_change_all() {
|
||||
for (int i = 0, last = fl.size(); i != last; ++i)
|
||||
fl.get(i).set_priority(p);
|
||||
|
||||
m_download->get_download().update_priorities();
|
||||
m_download->download()->update_priorities();
|
||||
m_window->mark_dirty();
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ ElementTrackerList::receive_disable() {
|
||||
if (m_window == NULL)
|
||||
throw torrent::internal_error("ui::ElementTrackerList::receive_disable(...) called on a disabled object");
|
||||
|
||||
torrent::Tracker t = m_download->get_download().tracker_list().get(m_focus);
|
||||
torrent::Tracker t = m_download->download()->tracker_list().get(m_focus);
|
||||
|
||||
if (t.is_enabled())
|
||||
t.disable();
|
||||
@@ -100,7 +100,7 @@ ElementTrackerList::receive_next() {
|
||||
if (m_window == NULL)
|
||||
throw torrent::internal_error("ui::ElementTrackerList::receive_next(...) called on a disabled object");
|
||||
|
||||
if (++m_focus >= m_download->get_download().tracker_list().size())
|
||||
if (++m_focus >= m_download->download()->tracker_list().size())
|
||||
m_focus = 0;
|
||||
|
||||
m_window->mark_dirty();
|
||||
@@ -111,13 +111,13 @@ ElementTrackerList::receive_prev() {
|
||||
if (m_window == NULL)
|
||||
throw torrent::internal_error("ui::ElementTrackerList::receive_prev(...) called on a disabled object");
|
||||
|
||||
if (m_download->get_download().tracker_list().size() == 0)
|
||||
if (m_download->download()->tracker_list().size() == 0)
|
||||
return;
|
||||
|
||||
if (m_focus != 0)
|
||||
--m_focus;
|
||||
else
|
||||
m_focus = m_download->get_download().tracker_list().size() - 1;
|
||||
m_focus = m_download->download()->tracker_list().size() - 1;
|
||||
|
||||
m_window->mark_dirty();
|
||||
}
|
||||
@@ -127,7 +127,7 @@ ElementTrackerList::receive_cycle_group() {
|
||||
if (m_window == NULL)
|
||||
throw torrent::internal_error("ui::ElementTrackerList::receive_group_cycle(...) called on a disabled object");
|
||||
|
||||
torrent::TrackerList tl = m_download->get_download().tracker_list();
|
||||
torrent::TrackerList tl = m_download->download()->tracker_list();
|
||||
|
||||
if (m_focus >= tl.size())
|
||||
throw torrent::internal_error("ui::ElementTrackerList::receive_group_cycle(...) called with an invalid focus");
|
||||
|
||||
Reference in New Issue
Block a user