* Cleaned up obsolete scheduler framework.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1071 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2008-10-04 10:06:47 +00:00
parent 07b9616ef6
commit db4ba9fe68
13 changed files with 35 additions and 281 deletions
+8 -17
View File
@@ -116,10 +116,7 @@ View::~View() {
if (m_name.empty())
return;
for (int i = 0; i < DownloadList::SLOTS_MAX_SIZE; i++)
rpc::commands.call("system.method.set_key", rpc::make_target(),
rpc::create_object_list(control->core()->download_list()->slot_name(i), "0_view_" + m_name));
clear_filter_on();
priority_queue_erase(&taskScheduler, &m_delayChanged);
}
@@ -131,13 +128,8 @@ View::initialize(const std::string& name) {
if (name.empty())
throw torrent::internal_error("View::initialize(...) called with an empty name.");
std::string key = "0_view_" + name;
core::DownloadList* dlist = control->core()->download_list();
if (rpc::commands.call("system.method.has_key", rpc::make_target(), rpc::create_object_list("event.download.inserted", key)).as_value() ||
rpc::commands.call("system.method.has_key", rpc::make_target(), rpc::create_object_list("event.download.erased", key)).as_value())
throw torrent::internal_error("View::initialize(...) duplicate key name found in DownloadList.");
m_name = name;
// Urgh, wrong. No filtering being done.
@@ -297,21 +289,20 @@ View::filter_download(core::Download* download) {
}
void
View::set_filter_on(int event) {
if (event == DownloadList::D_SLOTS_INSERT || event == DownloadList::D_SLOTS_ERASE || event >= DownloadList::SLOTS_MAX_SIZE)
throw torrent::internal_error("View::filter_on(...) invalid event.");
View::set_filter_on_event(const std::string& event) {
if (std::find(m_events.begin(), m_events.end(), event) != m_events.end())
return;
rpc::commands.call("system.method.set_key", rpc::make_target(),
rpc::create_object_list(control->core()->download_list()->slot_name(event), "0_view_" + m_name, "view.filter_download=" + m_name));
rpc::commands.call_catch("system.method.set_key", rpc::make_target(), rpc::create_object_list(event, "!view_" + m_name, "view.filter_download=" + m_name));
m_events.push_back(event);
}
void
View::clear_filter_on() {
// Don't clear insert and erase as these are required to keep the
// View up-to-date with the available downloads.
for (int i = DownloadList::D_SLOTS_OPEN; i < DownloadList::SLOTS_MAX_SIZE; i++)
rpc::commands.call("system.method.set_key", rpc::make_target(),
rpc::create_object_list(control->core()->download_list()->slot_name(i), "0_view_" + m_name));
for (event_list_type::const_iterator itr = m_events.begin(); itr != m_events.end(); itr++)
rpc::commands.call_catch("system.method.set_key", rpc::make_target(), rpc::create_object_list(*itr, "!view_" + m_name));
}
inline void