* Cleanup of TextElement.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@838 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2007-01-01 06:52:56 +00:00
parent 0854e65775
commit fe7adfc999
12 changed files with 98 additions and 97 deletions
+1 -1
View File
@@ -169,7 +169,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("Safe sync:", display::text_element_branch_void(rak::make_mem_fun(torrent::chunk_manager(), &torrent::ChunkManager::safe_sync), te_string("yes"), te_string("no")));
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");
+5 -25
View File
@@ -99,10 +99,10 @@ element_file_list_create_info() {
element->push_back("File info:");
element->push_back("");
element->push_column("Filename:", display::text_element_string_slot(std::ptr_fun(&element_file_list_filename)));
element->push_column("Filename:", te_string(&element_file_list_filename));
element->push_back("");
element->push_column("Size:", te_value(&torrent::File::size_bytes, value_base::flag_xb));
element->push_column("Size:", te_branch(&torrent::FileListIterator::is_file, te_value(&torrent::File::size_bytes, value_base::flag_xb), te_string("---")));
element->push_column("Chunks:", te_value(&torrent::File::completed_chunks), " / ", te_value(&torrent::File::size_chunks));
element->push_column("Range:", te_value(&torrent::File::range_first), " - ", te_value(&torrent::File::range_second));
@@ -265,12 +265,11 @@ ElementFileList::receive_priority() {
throw torrent::internal_error("ui::ElementFileList::receive_prev(...) called on a disabled object");
torrent::FileList* fl = m_download->download()->file_list();
torrent::priority_t priority = torrent::priority_t((m_selected.file()->priority() + 2) % 3);
iterator first = m_selected;
iterator last = next_current_depth(m_selected, iterator(fl->end()));
Priority priority = next_priority(m_selected.file()->priority());
while (first != last) {
if (first.is_file())
first.file()->set_priority(priority);
@@ -287,35 +286,16 @@ ElementFileList::receive_change_all() {
if (m_window == NULL)
throw torrent::internal_error("ui::ElementFileList::receive_prev(...) called on a disabled object");
Priority p = next_priority(m_selected.file()->priority());
torrent::FileList* fl = m_download->download()->file_list();
torrent::priority_t priority = torrent::priority_t((m_selected.file()->priority() + 2) % 3);
for (torrent::FileList::iterator itr = fl->begin(), last = fl->end(); itr != last; ++itr)
(*itr)->set_priority(p);
(*itr)->set_priority(priority);
m_download->download()->update_priorities();
update_itr();
}
ElementFileList::Priority
ElementFileList::next_priority(Priority p) {
// Ahh... do +1 modulo.
switch(p) {
case torrent::PRIORITY_OFF:
return torrent::PRIORITY_HIGH;
case torrent::PRIORITY_NORMAL:
return torrent::PRIORITY_OFF;
case torrent::PRIORITY_HIGH:
return torrent::PRIORITY_NORMAL;
default:
return torrent::PRIORITY_NORMAL;
};
}
void
ElementFileList::update_itr() {
m_window->mark_dirty();
+1 -5
View File
@@ -56,9 +56,7 @@ class ElementText;
class ElementFileList : public ElementBase {
public:
typedef torrent::priority_t Priority;
typedef display::WindowFileList WFileList;
typedef display::WindowFileList WFileList;
typedef torrent::FileListIterator iterator;
typedef enum {
@@ -83,8 +81,6 @@ private:
void receive_priority();
void receive_change_all();
Priority next_priority(Priority p);
void update_itr();
core::Download* m_download;