mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-10 08:09:21 +00:00
Moved over to a next time based display update.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@320 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -9,10 +9,10 @@ libsub_display_a_SOURCES = \
|
||||
utils.h \
|
||||
window.cc \
|
||||
window.h \
|
||||
window_download_statusbar.cc \
|
||||
window_download_statusbar.h \
|
||||
window_download_list.cc \
|
||||
window_download_list.h \
|
||||
window_download_statusbar.cc \
|
||||
window_download_statusbar.h \
|
||||
window_http_queue.cc \
|
||||
window_http_queue.h \
|
||||
window_input.cc \
|
||||
|
||||
@@ -56,7 +56,8 @@ void
|
||||
Manager::do_update() {
|
||||
Canvas::refresh_std();
|
||||
|
||||
std::for_each(begin(), end(), func::if_then(std::mem_fun(&Window::is_active), std::mem_fun(&Window::redraw)));
|
||||
std::for_each(begin(), end(), func::if_then(std::mem_fun(&Window::is_active), func::if_then(std::mem_fun(&Window::is_dirty),
|
||||
std::mem_fun(&Window::redraw))));
|
||||
std::for_each(begin(), end(), func::if_then(std::mem_fun(&Window::is_active), std::mem_fun(&Window::refresh)));
|
||||
|
||||
Canvas::do_update();
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include "canvas.h"
|
||||
#include "window.h"
|
||||
|
||||
namespace display {
|
||||
@@ -13,11 +12,6 @@ Window::~Window() {
|
||||
delete m_canvas;
|
||||
}
|
||||
|
||||
void
|
||||
Window::refresh() {
|
||||
m_canvas->refresh();
|
||||
}
|
||||
|
||||
void
|
||||
Window::resize(int x, int y, int w, int h) {
|
||||
if (x < 0 || y < 0)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <sigc++/slot.h>
|
||||
|
||||
#include "canvas.h"
|
||||
#include "utils/timer.h"
|
||||
|
||||
namespace display {
|
||||
@@ -20,17 +21,19 @@ public:
|
||||
|
||||
bool is_active() { return m_active; }
|
||||
bool is_dynamic() { return m_dynamic; }
|
||||
bool is_dirty() { return m_lastDraw == 0; }
|
||||
bool is_dirty() { return m_nextDraw <= utils::Timer::cache(); }
|
||||
|
||||
utils::Timer get_next_draw() { return m_nextDraw; }
|
||||
|
||||
int get_min_height() { return m_minHeight; }
|
||||
|
||||
bool get_active() { return m_active; }
|
||||
void set_active(bool a) { m_active = a; }
|
||||
|
||||
void refresh();
|
||||
void refresh() { m_canvas->refresh(); }
|
||||
void resize(int x, int y, int w, int h);
|
||||
|
||||
void mark_dirty() { m_lastDraw = 0; }
|
||||
void mark_dirty() { m_nextDraw = utils::Timer::min(); }
|
||||
|
||||
virtual void redraw() = 0;
|
||||
|
||||
@@ -48,7 +51,7 @@ protected:
|
||||
bool m_dynamic;
|
||||
int m_minHeight;
|
||||
|
||||
utils::Timer m_lastDraw;
|
||||
utils::Timer m_nextDraw;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -16,10 +16,7 @@ WindowDownloadList::WindowDownloadList(DList* l, DList::iterator* f) :
|
||||
|
||||
void
|
||||
WindowDownloadList::redraw() {
|
||||
if (utils::Timer::cache() - m_lastDraw < 1000000)
|
||||
return;
|
||||
|
||||
m_lastDraw = utils::Timer::cache();
|
||||
m_nextDraw = utils::Timer::cache().round_seconds() + 1000000;
|
||||
|
||||
m_canvas->erase();
|
||||
|
||||
|
||||
@@ -15,10 +15,7 @@ WindowDownloadStatusbar::WindowDownloadStatusbar(core::Download* d) :
|
||||
|
||||
void
|
||||
WindowDownloadStatusbar::redraw() {
|
||||
if (utils::Timer::cache() - m_lastDraw < 1000000)
|
||||
return;
|
||||
|
||||
m_lastDraw = utils::Timer::cache();
|
||||
m_nextDraw = utils::Timer::cache().round_seconds() + 1000000;
|
||||
|
||||
m_canvas->erase();
|
||||
|
||||
|
||||
@@ -22,10 +22,7 @@ WindowHttpQueue::WindowHttpQueue(core::HttpQueue* q) :
|
||||
|
||||
void
|
||||
WindowHttpQueue::redraw() {
|
||||
if (utils::Timer::cache() - m_lastDraw < 1000000)
|
||||
return;
|
||||
|
||||
m_lastDraw = utils::Timer::cache();
|
||||
m_nextDraw = utils::Timer::cache().round_seconds() + 1000000;
|
||||
|
||||
cleanup_list();
|
||||
|
||||
|
||||
@@ -15,10 +15,7 @@ WindowInput::WindowInput(input::TextInput* input) :
|
||||
|
||||
void
|
||||
WindowInput::redraw() {
|
||||
if (!is_dirty())
|
||||
return;
|
||||
|
||||
m_lastDraw = utils::Timer::cache();
|
||||
m_nextDraw = utils::Timer::max();
|
||||
m_canvas->erase();
|
||||
|
||||
m_canvas->print(0, 0, "> %s", m_input->c_str());
|
||||
|
||||
@@ -26,10 +26,7 @@ WindowLog::find_older() {
|
||||
|
||||
void
|
||||
WindowLog::redraw() {
|
||||
if (!is_dirty())
|
||||
return;
|
||||
|
||||
m_lastDraw = utils::Timer::cache();
|
||||
m_nextDraw = utils::Timer::max();
|
||||
|
||||
m_canvas->erase();
|
||||
|
||||
|
||||
@@ -19,10 +19,7 @@ WindowPeerInfo::WindowPeerInfo(core::Download* d, PList* l, PList::iterator* f)
|
||||
|
||||
void
|
||||
WindowPeerInfo::redraw() {
|
||||
if (utils::Timer::cache() - m_lastDraw < 1000000)
|
||||
return;
|
||||
|
||||
m_lastDraw = utils::Timer::cache();
|
||||
m_nextDraw = utils::Timer::cache().round_seconds() + 1000000;
|
||||
m_canvas->erase();
|
||||
|
||||
int y = 0;
|
||||
|
||||
@@ -15,10 +15,7 @@ WindowPeerList::WindowPeerList(PList* l, PList::iterator* f) :
|
||||
|
||||
void
|
||||
WindowPeerList::redraw() {
|
||||
if (utils::Timer::cache() - m_lastDraw < 1000000)
|
||||
return;
|
||||
|
||||
m_lastDraw = utils::Timer::cache();
|
||||
m_nextDraw = utils::Timer::cache().round_seconds() + 1000000;
|
||||
m_canvas->erase();
|
||||
|
||||
int x = 2;
|
||||
|
||||
@@ -17,20 +17,14 @@ WindowStatusbar::WindowStatusbar(core::Manager* c) :
|
||||
|
||||
void
|
||||
WindowStatusbar::redraw() {
|
||||
m_counter++;
|
||||
|
||||
if (utils::Timer::cache() - m_lastDraw < 10000000)
|
||||
return;
|
||||
|
||||
m_lastDraw = utils::Timer::cache();
|
||||
m_nextDraw = utils::Timer::cache().round_seconds() + 1000000;
|
||||
|
||||
m_canvas->erase();
|
||||
m_canvas->print(0, 0, "Throttle: %i Listen: %s:%i Handshakes: %i Select: %u",
|
||||
m_canvas->print(0, 0, "Throttle: %i Listen: %s:%i Handshakes: %i",
|
||||
(int)torrent::get(torrent::THROTTLE_ROOT_CONST_RATE) / 1024,
|
||||
m_core->get_dns().empty() ? "<default>" : m_core->get_dns().c_str(),
|
||||
(int)torrent::get(torrent::LISTEN_PORT),
|
||||
(int)torrent::get(torrent::HANDSHAKES_TOTAL),
|
||||
m_counter);
|
||||
(int)torrent::get(torrent::HANDSHAKES_TOTAL));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,10 +12,7 @@ WindowTitle::WindowTitle(const std::string& s) :
|
||||
|
||||
void
|
||||
WindowTitle::redraw() {
|
||||
if (utils::Timer::cache() - m_lastDraw < 10000000)
|
||||
return;
|
||||
|
||||
m_lastDraw = utils::Timer::cache();
|
||||
m_nextDraw = utils::Timer::cache().round_seconds() + 1000000;
|
||||
m_canvas->erase();
|
||||
|
||||
m_canvas->print(std::max(0, (m_canvas->get_width() - (int)m_title.size()) / 2 - 4), 0,
|
||||
|
||||
Reference in New Issue
Block a user