diff --git a/TODO b/TODO index ad0b38f0..1503a7fa 100644 --- a/TODO +++ b/TODO @@ -8,9 +8,6 @@ allowed since the tracker set a min interval. Make accumulate return the value, no refs please... -> - listing the total upload / download bandwidth at the bottom of the -> screen; - > - seeing the number of seeds / leechers of a torrent on the main > screen (and the level of distribution between leechers); @@ -19,12 +16,6 @@ Make accumulate return the value, no refs please... > slow or broken or for various reasons you don't want to download it. -Show torrent creation date? - -Recheck hash key. - Seperate download management from core::management. -Allow switching/cycling of tracker. - -Remember to add virtual dtor to OptionHandlerBase +Recheck hash key. diff --git a/src/core/manager.h b/src/core/manager.h index b8ab1c81..33e37524 100644 --- a/src/core/manager.h +++ b/src/core/manager.h @@ -67,6 +67,8 @@ public: void start(Download* d); void stop(Download* d); + void check_hash(Download* d); + void set_port_range(int a, int b) { m_portFirst = a; m_portLast = b; } void debug_tracker() { m_debugTracker = 0; } diff --git a/src/display/utils.cc b/src/display/utils.cc index 13ee9f51..6ab8e146 100644 --- a/src/display/utils.cc +++ b/src/display/utils.cc @@ -22,7 +22,6 @@ #include "config.h" -#include #include #include @@ -68,4 +67,21 @@ print_hhmmss(utils::Timer t) { return str.str(); } +std::string +print_ddmmyyyy(time_t t) { + std::tm *u = std::gmtime(&t); + + if (u == NULL) + return "inv_time"; + + std::stringstream str; + str.fill('0'); + + str << std::setw(2) << u->tm_mday << '/' + << std::setw(2) << u->tm_mon << '/' + << std::setw(4) << (1900 + u->tm_year); + + return str.str(); +} + } diff --git a/src/display/utils.h b/src/display/utils.h index a105dfdc..d12ddcbc 100644 --- a/src/display/utils.h +++ b/src/display/utils.h @@ -23,6 +23,7 @@ #ifndef RTORRENT_DISPLAY_UTILS_H #define RTORRENT_DISPLAY_UTILS_H +#include #include namespace core { @@ -38,6 +39,7 @@ namespace display { std::string print_download_status(core::Download* d); std::string print_hhmmss(utils::Timer t); +std::string print_ddmmyyyy(time_t t); } diff --git a/src/display/window_peer_info.cc b/src/display/window_peer_info.cc index 03558817..91dfb227 100644 --- a/src/display/window_peer_info.cc +++ b/src/display/window_peer_info.cc @@ -28,6 +28,7 @@ #include "utils/parse.h" #include "canvas.h" +#include "utils.h" #include "window_peer_info.h" namespace display { @@ -47,12 +48,14 @@ WindowPeerInfo::redraw() { int y = 0; torrent::Download d = m_download->get_download(); - m_canvas->print(0, y++, "Hash: %s", utils::string_to_hex(d.get_hash()).c_str()); - m_canvas->print(0, y++, "Id: %s", utils::escape_string(d.get_id()).c_str()); - m_canvas->print(0, y++, "Chunks: %u / %u * %u", + m_canvas->print(0, y++, "Hash: %s", utils::string_to_hex(d.get_hash()).c_str()); + m_canvas->print(0, y++, "Id: %s", utils::escape_string(d.get_id()).c_str()); + m_canvas->print(0, y++, "Chunks: %u / %u * %u", d.get_chunks_done(), d.get_chunks_total(), d.get_chunks_size()); + m_canvas->print(0, y++, "Created: %s", + print_ddmmyyyy(static_cast(d.get_creation_date())).c_str()); y++; diff --git a/src/option_handler.h b/src/option_handler.h index d5eea8bd..06ecae06 100644 --- a/src/option_handler.h +++ b/src/option_handler.h @@ -28,6 +28,8 @@ // No members with dtor's allowed. struct OptionHandlerBase { + virtual ~OptionHandlerBase() {} + virtual void process(const std::string& key, const std::string& arg) = 0; }; diff --git a/src/ui/download.cc b/src/ui/download.cc index 2464bb26..dbc0ec1e 100644 --- a/src/ui/download.cc +++ b/src/ui/download.cc @@ -267,11 +267,12 @@ Download::bind_keys() { (*m_bindings)[KEY_DOWN] = sigc::mem_fun(*this, &Download::receive_next); // Key bindings for sub-ui's. - m_uiArray[DISPLAY_PEER_LIST]->get_bindings()[KEY_RIGHT] = sigc::bind(sigc::mem_fun(*this, &Download::receive_change), DISPLAY_FILE_LIST); - m_uiArray[DISPLAY_PEER_INFO]->get_bindings()[' '] = sigc::bind(sigc::mem_fun(*this, &Download::receive_change), DISPLAY_PEER_LIST); - m_uiArray[DISPLAY_FILE_LIST]->get_bindings()[KEY_LEFT] = sigc::bind(sigc::mem_fun(*this, &Download::receive_change), DISPLAY_PEER_LIST); - m_uiArray[DISPLAY_TRACKER_LIST]->get_bindings()[' '] = sigc::bind(sigc::mem_fun(*this, &Download::receive_change), DISPLAY_PEER_LIST); + m_uiArray[DISPLAY_PEER_LIST]->get_bindings()[KEY_RIGHT] = sigc::bind(sigc::mem_fun(*this, &Download::receive_change), DISPLAY_FILE_LIST); + m_uiArray[DISPLAY_PEER_INFO]->get_bindings()[KEY_LEFT] = sigc::bind(sigc::mem_fun(*this, &Download::receive_change), DISPLAY_PEER_LIST); + m_uiArray[DISPLAY_FILE_LIST]->get_bindings()[KEY_LEFT] = sigc::bind(sigc::mem_fun(*this, &Download::receive_change), DISPLAY_PEER_LIST); + m_uiArray[DISPLAY_TRACKER_LIST]->get_bindings()[KEY_LEFT] = sigc::bind(sigc::mem_fun(*this, &Download::receive_change), DISPLAY_PEER_LIST); + // Doesn't belong here. m_uiArray[DISPLAY_PEER_LIST]->get_bindings()['*'] = sigc::mem_fun(*this, &Download::receive_snub_peer); m_uiArray[DISPLAY_PEER_INFO]->get_bindings()['*'] = sigc::mem_fun(*this, &Download::receive_snub_peer); } diff --git a/src/ui/element_tracker_list.cc b/src/ui/element_tracker_list.cc index 6e3fed04..b0eb8315 100644 --- a/src/ui/element_tracker_list.cc +++ b/src/ui/element_tracker_list.cc @@ -37,7 +37,8 @@ ElementTrackerList::ElementTrackerList(core::Download* d) : m_focus(0) { m_bindings[KEY_DOWN] = sigc::mem_fun(*this, &ElementTrackerList::receive_next); - m_bindings[KEY_UP] = sigc::mem_fun(*this, &ElementTrackerList::receive_prev); + m_bindings[KEY_UP] = sigc::mem_fun(*this, &ElementTrackerList::receive_prev); + m_bindings[' '] = sigc::mem_fun(*this, &ElementTrackerList::receive_cycle_group); } void @@ -88,4 +89,17 @@ ElementTrackerList::receive_prev() { m_window->mark_dirty(); } +void +ElementTrackerList::receive_cycle_group() { + if (m_window == NULL) + throw std::logic_error("ui::ElementTrackerList::receive_group_cycle(...) called on a disabled object"); + + if (m_focus >= m_download->get_download().get_tracker_size()) + throw std::logic_error("ui::ElementTrackerList::receive_group_cycle(...) called with an invalid focus"); + + m_download->get_download().cycle_tracker_group(m_download->get_download().get_tracker(m_focus).get_group()); + + m_window->mark_dirty(); +} + } diff --git a/src/ui/element_tracker_list.h b/src/ui/element_tracker_list.h index f6d23fd2..2c2f8595 100644 --- a/src/ui/element_tracker_list.h +++ b/src/ui/element_tracker_list.h @@ -48,6 +48,8 @@ private: void receive_next(); void receive_prev(); + void receive_cycle_group(); + core::Download* m_download; WTrackerList* m_window;