* Fix TextElement* to use rpc::target_type.

* Moved most of src/ui/download.cc to use commands for TextElements.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@967 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2007-08-30 16:33:52 +00:00
parent 32b74ffc48
commit 73c41074ec
28 changed files with 476 additions and 115 deletions
+15 -15
View File
@@ -140,48 +140,48 @@ inline ElementBase*
Download::create_info() {
using namespace display::helpers;
ElementText* element = new ElementText(m_download);
ElementText* element = new ElementText(rpc::make_target(m_download));
element->set_column(1);
element->set_interval(1);
// Get these bindings with some kind of string map.
element->push_column("Name:", te_string(&torrent::Download::name));
element->push_column("Local id:", te_string(&torrent::Download::local_id, string_base::flag_escape_html));
element->push_column("Info hash:", te_string(&torrent::Download::info_hash, string_base::flag_escape_hex));
element->push_column("Created:", te_value(&torrent::Download::creation_date, value_base::flag_date), " ", te_value(&torrent::Download::creation_date, value_base::flag_time));
element->push_column("Name:", te_variable_string("d.get_name"));
element->push_column("Local id:", te_variable_string("d.get_local_id_html"));
element->push_column("Info hash:", te_variable_string("d.get_hash"));
element->push_column("Created:", te_variable_value("d.get_creation_date", value_base::flag_date), " ", te_variable_value("d.get_creation_date", value_base::flag_time));
element->push_back("");
element->push_column("Directory:", te_string(&torrent::FileList::root_dir));
element->push_column("Directory:", te_variable_string("d.get_base_path"));
element->push_column("Tied to file:", te_variable_string("d.get_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");
" ", te_variable_value("d.get_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("Chunks:", te_variable_value("d.get_completed_chunks"), " / ", te_variable_value("d.get_size_chunks"), " * ", te_variable_value("d.get_chunk_size"));
element->push_column("Priority:", te_variable_value("d.get_priority"));
element->push_column("State changed:", te_variable_value("d.get_state_changed", value_base::flag_timer | value_base::flag_elapsed));
element->push_back("");
element->push_column("Memory usage:", te_value(&torrent::ChunkManager::memory_usage, value_base::flag_mb), " MB");
element->push_column("Max memory usage:", te_value(&torrent::ChunkManager::max_memory_usage, value_base::flag_mb), " MB");
element->push_column("Free diskspace:", te_value(&torrent::FileList::free_diskspace, value_base::flag_mb), " MB");
element->push_column("Safe diskspace:", te_value(&torrent::ChunkManager::safe_free_diskspace, value_base::flag_mb), " MB");
element->push_column("Memory usage:", te_variable_value("get_memory_usage", value_base::flag_mb), " MB");
element->push_column("Max memory usage:", te_variable_value("get_max_memory_usage", value_base::flag_mb), " MB");
element->push_column("Free diskspace:", te_variable_value("d.get_free_diskspace", value_base::flag_mb), " MB");
element->push_column("Safe diskspace:", te_variable_value("get_safe_free_diskspace", value_base::flag_mb), " MB");
element->push_back("");
element->push_column("Connection type:", te_variable_string("d.get_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");
element->push_column("Send buffer:", te_variable_value("get_send_buffer_size", value_base::flag_kb), " KB");
element->push_column("Receive buffer:", te_variable_value("get_receive_buffer_size", value_base::flag_kb), " KB");
element->push_back("");
element->push_column("Upload:", te_variable_value("d.get_up_rate", value_base::flag_kb), " KB / ", te_variable_value("d.get_up_total", value_base::flag_xb));
element->push_column("Download:", te_variable_value("d.get_down_rate", value_base::flag_kb), " KB / ", te_variable_value("d.get_down_total", value_base::flag_xb));
element->push_column("Skipped:", te_variable_value("d.get_skip_rate", value_base::flag_kb), " KB / ", te_variable_value("d.get_skip_total", value_base::flag_xb));
element->push_column("Preload:", te_value(&torrent::ChunkManager::preload_type), " / ", te_value(&torrent::ChunkManager::stats_preloaded), " / ", te_value(&torrent::ChunkManager::stats_not_preloaded));
element->push_column("Preload:", te_variable_value("get_preload_type"), " / ", te_variable_value("get_stats_preloaded"), " / ", te_variable_value("get_stats_not_preloaded"));
element->set_column_width(element->column_width() + 1);
+2 -2
View File
@@ -93,7 +93,7 @@ inline ElementText*
element_file_list_create_info() {
using namespace display::helpers;
ElementText* element = new ElementText(NULL);
ElementText* element = new ElementText(rpc::make_target());
element->set_column(1);
element->set_interval(1);
@@ -127,7 +127,7 @@ ElementFileList::activate(display::Frame* frame, bool focus) {
m_elementInfo = element_file_list_create_info();
m_elementInfo->slot_exit(sigc::bind(sigc::mem_fun(this, &ElementFileList::activate_display), DISPLAY_LIST));
m_elementInfo->set_object(&m_selected);
m_elementInfo->set_target(rpc::make_target(&m_selected));
m_frame = frame;
+1 -1
View File
@@ -68,7 +68,7 @@ ElementMenu::unfocus_entry(size_type idx) {
}
ElementMenu::ElementMenu() :
m_window(new WindowText(NULL, 2)),
m_window(new WindowText(rpc::make_target(), 2)),
m_entry(entry_invalid) {
// Move bindings into a function that defines default bindings.
+2 -2
View File
@@ -101,7 +101,7 @@ inline ElementText*
ElementPeerList::create_info() {
using namespace display::helpers;
ElementText* element = new ElementText(NULL);
ElementText* element = new ElementText(rpc::make_target());
element->set_column(1);
element->set_interval(1);
@@ -263,7 +263,7 @@ ElementPeerList::receive_snub_peer() {
void
ElementPeerList::update_itr() {
m_windowList->mark_dirty();
m_elementInfo->set_object(m_listItr != m_list.end() ? &*m_listItr : NULL);
m_elementInfo->set_target(m_listItr != m_list.end() ? rpc::make_target(&*m_listItr) : rpc::make_target());
}
}
+2 -2
View File
@@ -48,8 +48,8 @@
namespace ui {
ElementText::ElementText(void *object) :
m_window(new WindowText(object)),
ElementText::ElementText(rpc::target_type target) :
m_window(new WindowText(target)),
m_column(0),
m_columnWidth(0) {
+3 -3
View File
@@ -60,11 +60,11 @@ public:
typedef uint32_t size_type;
typedef uint32_t extent_type;
ElementText(void *object);
ElementText(rpc::target_type target);
~ElementText();
void* object() const { return m_window->object(); }
void set_object(void* object) { m_window->set_object(object); m_window->mark_dirty(); }
rpc::target_type target() const { return m_window->target(); }
void set_target(rpc::target_type target) { m_window->set_target(target); m_window->mark_dirty(); }
uint32_t interval() const { return m_window->interval(); }
void set_interval(uint32_t i) { m_window->set_interval(i); m_window->mark_dirty(); }