* Change :rtorrent:state to an integer.

* Split up DownloadList::insert to get proper ordering of slot map
calls and variable initialization.

* Added filtering to ViewDownloads.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@675 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2006-04-26 21:23:37 +00:00
parent c5c9a1ddae
commit 8ae5e51a0f
11 changed files with 224 additions and 64 deletions
+23
View File
@@ -225,6 +225,27 @@ apply_view_sort_new(Control* control, const std::string& arg) {
control->view_manager()->set_sort_new(name, sortArgs);
}
void
apply_view_filter(Control* control, const std::string& arg) {
rak::split_iterator_t<std::string> itr = rak::split_iterator(arg, ',');
std::string name = rak::trim(*itr);
if (name.empty())
throw torrent::input_error("First argument must be a string.");
core::ViewManager::filter_args filterArgs;
while (++itr != rak::split_iterator(arg)) {
filterArgs.push_back(rak::trim(*itr));
if (filterArgs.back().empty())
throw torrent::input_error("One of the arguments is empty.");
}
control->view_manager()->set_filter(name, filterArgs);
}
void
apply_download_scheduler(core::Scheduler* scheduler, __UNUSED const std::string& arg) {
scheduler->update();
@@ -285,6 +306,8 @@ initialize_option_handler(Control* c) {
variables->insert("view_sort_new", new utils::VariableStringSlot(rak::value_fn(std::string()), rak::bind_ptr_fn(&apply_view_sort_new, c)));
variables->insert("view_sort_current", new utils::VariableStringSlot(rak::value_fn(std::string()), rak::bind_ptr_fn(&apply_view_sort_current, c)));
variables->insert("view_filter", new utils::VariableStringSlot(rak::value_fn(std::string()), rak::bind_ptr_fn(&apply_view_filter, c)));
variables->insert("schedule", new utils::VariableStringSlot(rak::value_fn(std::string()),
rak::mem_fn<const std::string&>(c->command_scheduler(), &CommandScheduler::parse)));
variables->insert("schedule_remove", new utils::VariableStringSlot(rak::value_fn(std::string()),