* Added dummy scheduler commands.

* Add/remove downloads from the 'active' view on resume/pause.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1051 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2008-04-11 18:03:27 +00:00
parent aab493caad
commit 41088740bd
4 changed files with 26 additions and 4 deletions
+18
View File
@@ -36,12 +36,28 @@
#include "config.h"
#include "core/manager.h"
#include "core/download_list.h"
#include "rpc/command_variable.h"
#include "globals.h"
#include "control.h"
#include "command_helpers.h"
torrent::Object
cmd_scheduler_simple_added(core::Download* download, const torrent::Object& rawArgs) {
control->core()->download_list()->resume(download);
return torrent::Object();
}
torrent::Object
cmd_scheduler_simple_removed(core::Download* download, const torrent::Object& rawArgs) {
control->core()->download_list()->pause(download);
return torrent::Object();
}
void
initialize_command_scheduler() {
// core::DownloadList* dList = control->core()->download_list();
@@ -50,4 +66,6 @@ initialize_command_scheduler() {
CMD_V("scheduler.", "max_active", value, (int64_t)-1);
CMD_D_ANY("scheduler.simple.added", rak::ptr_fn(&cmd_scheduler_simple_added));
CMD_D_ANY("scheduler.simple.removed", rak::ptr_fn(&cmd_scheduler_simple_removed));
}
+2 -2
View File
@@ -436,8 +436,8 @@ initialize_command_ui() {
ADD_COMMAND_LIST("view_sort_new", rak::bind_ptr_fn(&apply_view_cfilter, &core::ViewManager::set_sort_new));
ADD_COMMAND_LIST("view_sort_current", rak::bind_ptr_fn(&apply_view_cfilter, &core::ViewManager::set_sort_current));
ADD_COMMAND_LIST("view_event_added", rak::bind_ptr_fn(&apply_view_cfilter, &core::ViewManager::set_event_added));
ADD_COMMAND_LIST("view_event_removed", rak::bind_ptr_fn(&apply_view_cfilter, &core::ViewManager::set_event_removed));
ADD_COMMAND_LIST("view.event_added", rak::bind_ptr_fn(&apply_view_cfilter, &core::ViewManager::set_event_added));
ADD_COMMAND_LIST("view.event_removed", rak::bind_ptr_fn(&apply_view_cfilter, &core::ViewManager::set_event_removed));
// Cleanup and add . to view.
+4
View File
@@ -307,6 +307,8 @@ DownloadList::resume(Download* download, int flags) {
if (download->download()->is_active())
return;
rpc::parse_command_single(rpc::make_target(download), "view.set_visible=active");
// We need to make sure the flags aren't reset if someone decideds
// to call resume() while it is hashing, etc.
if (download->resume_flags() == ~uint32_t())
@@ -374,6 +376,8 @@ DownloadList::pause(Download* download, int flags) {
download->set_resume_flags(~uint32_t());
rpc::parse_command_single(rpc::make_target(download), "view.set_not_visible=active");
// Always clear hashing on pause. When a hashing request is added,
// it should have cleared the hash resume data.
if (rpc::call_command_value("d.get_hashing", rpc::make_target(download)) != Download::variable_hashing_stopped) {
+2 -2
View File
@@ -188,8 +188,8 @@ main(int argc, char** argv) {
"view_add = started\n"
"view_filter = started,false=\n"
"view_event_added = started,d.resume=\n"
"view_event_removed = started,d.pause=\n"
"view.event_added = started,scheduler.simple.added=\n"
"view.event_removed = started,scheduler.simple.removed=\n"
"view_add = stopped\n"
"view_filter = stopped,false=\n"