mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-10 20:22:31 +00:00
* torrent::FileList::is_multi_file() now indicates whether the torrent
loaded was a multi-file torrent, not whether it contains more than one file. * Ignore attempts to load an empty URI in the client. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@925 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 <typename Return1, typename Return2, typename Object1, typename Object2>
|
||||
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
|
||||
|
||||
+4
-1
@@ -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");
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user