diff --git a/src/command_events.cc b/src/command_events.cc index a38b83b8..8d2b5dae 100644 --- a/src/command_events.cc +++ b/src/command_events.cc @@ -229,7 +229,7 @@ apply_download_list(const torrent::Object& rawArgs) { core::ViewManager* viewManager = control->view_manager(); core::ViewManager::iterator viewItr; - if (argsItr != args.end() && !(argsItr++)->as_string().empty()) + if (argsItr != args.end() && !argsItr->as_string().empty()) viewItr = viewManager->find((argsItr++)->as_string()); else viewItr = viewManager->find("main"); diff --git a/src/core/download.cc b/src/core/download.cc index 11d57c6f..8e22b501 100644 --- a/src/core/download.cc +++ b/src/core/download.cc @@ -158,14 +158,14 @@ Download::set_root_directory(const std::string& path) { torrent::FileList* fileList = m_download.file_list(); if (path.empty()) { - fileList->set_root_dir("./" + (fileList->size_files() > 1 ? m_download.name() : std::string())); + fileList->set_root_dir("./" + (fileList->is_multi_file() ? m_download.name() : std::string())); } else { std::string fullPath = rak::path_expand(path); fileList->set_root_dir(fullPath + (*fullPath.rbegin() != '/' ? "/" : "") + - (fileList->size_files() > 1 ? m_download.name() : "")); + (fileList->is_multi_file() ? m_download.name() : std::string())); } bencode()->get_key("rtorrent").insert_key("directory", path); diff --git a/src/display/text_element_helpers.h b/src/display/text_element_helpers.h index 16f6c16e..2f9d574f 100644 --- a/src/display/text_element_helpers.h +++ b/src/display/text_element_helpers.h @@ -177,6 +177,12 @@ te_branch(Return (Object::*fptr)() const, const Object* object, TextElement* bra return text_element_branch_void(rak::make_mem_fun(object, fptr), branch1, branch2); } +template +inline TextElement* +te_branch(Return1 (Object1::*fptr1)() const, Return2 (Object2::*fptr2)() const, TextElement* branch1, TextElement* branch2) { + return text_element_branch(rak::on(std::mem_fun(fptr1), std::mem_fun(fptr2)), branch1, branch2); +} + } } #endif diff --git a/src/ui/download.cc b/src/ui/download.cc index 17186151..29e899d4 100644 --- a/src/ui/download.cc +++ b/src/ui/download.cc @@ -155,13 +155,15 @@ Download::create_info() { element->push_back(""); element->push_column("Directory:", te_string(&torrent::FileList::root_dir)); element->push_column("Tied to file:", te_variable_string("get_d_tied_to_file")); + element->push_column("File stats:", + te_branch(&core::Download::c_file_list, &torrent::FileList::is_multi_file, te_string("multi"), te_string("single")), + " ", te_value(&torrent::FileList::size_files), " files"); element->push_back(""); element->push_column("Chunks:", te_value(&torrent::FileList::completed_chunks), " / ", te_value(&torrent::FileList::size_chunks), " * ", te_value(&torrent::FileList::chunk_size)); element->push_column("Priority:", te_variable_value("get_d_priority")); element->push_column("State changed:", te_variable_value("get_d_state_changed", value_base::flag_timer | value_base::flag_elapsed)); - element->push_column("Connection type:", te_variable_string("get_d_connection_current")); element->push_back(""); element->push_column("Memory usage:", te_value(&torrent::ChunkManager::memory_usage, value_base::flag_mb), " MB"); @@ -170,6 +172,7 @@ Download::create_info() { element->push_column("Safe diskspace:", te_value(&torrent::ChunkManager::safe_free_diskspace, value_base::flag_mb), " MB"); element->push_back(""); + element->push_column("Connection type:", te_variable_string("get_d_connection_current")); element->push_column("Safe sync:", te_branch(&torrent::ChunkManager::safe_sync, torrent::chunk_manager(), te_string("yes"), te_string("no"))); element->push_column("Send buffer:", te_value(&torrent::ConnectionManager::send_buffer_size, value_base::flag_kb), " KB"); element->push_column("Receive buffer:", te_value(&torrent::ConnectionManager::receive_buffer_size, value_base::flag_kb), " KB"); diff --git a/src/ui/download_list.cc b/src/ui/download_list.cc index 5a0ea75b..fb85914f 100644 --- a/src/ui/download_list.cc +++ b/src/ui/download_list.cc @@ -278,7 +278,9 @@ DownloadList::receive_exit_input(Input type) { case INPUT_LOAD_DEFAULT: case INPUT_LOAD_MODIFIED: - control->core()->try_create_download_expand(input->str(), type == INPUT_LOAD_DEFAULT); + if (!input->str().empty()) + control->core()->try_create_download_expand(input->str(), type == INPUT_LOAD_DEFAULT); + break; case INPUT_CHANGE_DIRECTORY: