mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-17 15:42:30 +00:00
* Moved Timer to rak/timer.h.
* Added position affinity to ChunkSelector, still needs more work to make it move forward without needing to finish all pieces. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@604 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -38,10 +38,10 @@
|
||||
|
||||
#include <stdexcept>
|
||||
#include <algorithm>
|
||||
|
||||
#include "rak/functional.h"
|
||||
#include <rak/functional.h>
|
||||
|
||||
#include "canvas.h"
|
||||
#include "globals.h"
|
||||
#include "manager.h"
|
||||
#include "window.h"
|
||||
|
||||
@@ -98,7 +98,7 @@ void
|
||||
Manager::do_update() {
|
||||
Canvas::refresh_std();
|
||||
|
||||
utils::displayScheduler.execute(utils::Timer::cache());
|
||||
displayScheduler.execute(cachedTime);
|
||||
std::for_each(begin(), end(), rak::if_then(std::mem_fun(&Window::is_active), std::mem_fun(&Window::refresh)));
|
||||
|
||||
Canvas::do_update();
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#include <torrent/tracker.h>
|
||||
|
||||
#include "core/download.h"
|
||||
#include "utils/timer.h"
|
||||
#include <rak/timer.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
|
||||
@@ -50,12 +50,12 @@ Window::Window(Canvas* c, bool d, int h) :
|
||||
m_dynamic(d),
|
||||
m_minHeight(h) {
|
||||
|
||||
m_taskUpdate.set_iterator(utils::displayScheduler.end());
|
||||
m_taskUpdate.set_iterator(displayScheduler.end());
|
||||
m_taskUpdate.set_slot(sigc::mem_fun(*this, &Window::redraw));
|
||||
}
|
||||
|
||||
Window::~Window() {
|
||||
utils::displayScheduler.erase(&m_taskUpdate);
|
||||
displayScheduler.erase(&m_taskUpdate);
|
||||
delete m_canvas;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ Window::set_active(bool a) {
|
||||
if (a)
|
||||
mark_dirty();
|
||||
else
|
||||
utils::displayScheduler.erase(&m_taskUpdate);
|
||||
displayScheduler.erase(&m_taskUpdate);
|
||||
|
||||
m_active = a;
|
||||
}
|
||||
|
||||
@@ -37,11 +37,11 @@
|
||||
#ifndef RTORRENT_WINDOW_BASE_H
|
||||
#define RTORRENT_WINDOW_BASE_H
|
||||
|
||||
#include <rak/timer.h>
|
||||
#include <sigc++/slot.h>
|
||||
|
||||
#include "canvas.h"
|
||||
#include "utils/task.h"
|
||||
#include "utils/timer.h"
|
||||
#include "globals.h"
|
||||
|
||||
namespace display {
|
||||
|
||||
@@ -57,9 +57,9 @@ public:
|
||||
|
||||
bool is_active() { return m_active; }
|
||||
bool is_dynamic() { return m_dynamic; }
|
||||
bool is_dirty() { return utils::displayScheduler.is_scheduled(&m_taskUpdate); }
|
||||
bool is_dirty() { return displayScheduler.is_scheduled(&m_taskUpdate); }
|
||||
|
||||
//utils::Timer get_next_draw() { return m_nextDraw; }
|
||||
//utils::rak::timer get_next_draw() { return m_nextDraw; }
|
||||
|
||||
int get_min_height() { return m_minHeight; }
|
||||
|
||||
@@ -92,8 +92,8 @@ protected:
|
||||
|
||||
inline void
|
||||
Window::mark_dirty() {
|
||||
utils::displayScheduler.erase(&m_taskUpdate);
|
||||
utils::displayScheduler.insert(&m_taskUpdate, utils::Timer::cache());
|
||||
displayScheduler.erase(&m_taskUpdate);
|
||||
displayScheduler.insert(&m_taskUpdate, cachedTime);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,10 +36,12 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <rak/algorithm.h>
|
||||
|
||||
#include "core/download.h"
|
||||
#include "rak/algorithm.h"
|
||||
|
||||
#include "canvas.h"
|
||||
#include "globals.h"
|
||||
#include "utils.h"
|
||||
#include "window_download_list.h"
|
||||
|
||||
@@ -58,7 +60,7 @@ WindowDownloadList::~WindowDownloadList() {
|
||||
|
||||
void
|
||||
WindowDownloadList::redraw() {
|
||||
utils::displayScheduler.insert(&m_taskUpdate, (utils::Timer::cache() + 1000000).round_seconds());
|
||||
displayScheduler.insert(&m_taskUpdate, (cachedTime + 1000000).round_seconds());
|
||||
|
||||
m_canvas->erase();
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <torrent/rate.h>
|
||||
|
||||
#include "canvas.h"
|
||||
#include "globals.h"
|
||||
#include "utils.h"
|
||||
#include "window_download_statusbar.h"
|
||||
|
||||
@@ -53,7 +54,7 @@ WindowDownloadStatusbar::WindowDownloadStatusbar(core::Download* d) :
|
||||
|
||||
void
|
||||
WindowDownloadStatusbar::redraw() {
|
||||
utils::displayScheduler.insert(&m_taskUpdate, (utils::Timer::cache() + 1000000).round_seconds());
|
||||
displayScheduler.insert(&m_taskUpdate, (cachedTime + 1000000).round_seconds());
|
||||
|
||||
m_canvas->erase();
|
||||
|
||||
|
||||
@@ -37,10 +37,10 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <stdexcept>
|
||||
#include <rak/algorithm.h>
|
||||
#include <torrent/path.h>
|
||||
|
||||
#include "core/download.h"
|
||||
#include "rak/algorithm.h"
|
||||
|
||||
#include "window_file_list.h"
|
||||
|
||||
@@ -54,7 +54,7 @@ WindowFileList::WindowFileList(core::Download* d, unsigned int* focus) :
|
||||
|
||||
void
|
||||
WindowFileList::redraw() {
|
||||
utils::displayScheduler.insert(&m_taskUpdate, (utils::Timer::cache() + 10 * 1000000).round_seconds());
|
||||
displayScheduler.insert(&m_taskUpdate, (cachedTime + 10 * 1000000).round_seconds());
|
||||
m_canvas->erase();
|
||||
|
||||
if (m_download->get_download().size_file_entries() == 0 ||
|
||||
|
||||
@@ -58,7 +58,7 @@ WindowHttpQueue::WindowHttpQueue(core::HttpQueue* q) :
|
||||
|
||||
void
|
||||
WindowHttpQueue::redraw() {
|
||||
utils::displayScheduler.insert(&m_taskUpdate, (utils::Timer::cache() + 1000000).round_seconds());
|
||||
displayScheduler.insert(&m_taskUpdate, (cachedTime + 1000000).round_seconds());
|
||||
|
||||
cleanup_list();
|
||||
|
||||
@@ -95,7 +95,7 @@ WindowHttpQueue::redraw() {
|
||||
void
|
||||
WindowHttpQueue::cleanup_list() {
|
||||
for (Container::iterator itr = m_container.begin(); itr != m_container.end();)
|
||||
if (itr->m_http == NULL && itr->m_timer < utils::Timer::cache())
|
||||
if (itr->m_http == NULL && itr->m_timer < cachedTime)
|
||||
itr = m_container.erase(itr);
|
||||
else
|
||||
++itr;
|
||||
@@ -147,7 +147,7 @@ WindowHttpQueue::receive_erase(core::CurlGet* h) {
|
||||
throw std::logic_error("WindowHttpQueue::receive_erase(...) tried to remove an object we don't have");
|
||||
|
||||
itr->m_http = NULL;
|
||||
itr->m_timer = utils::Timer::cache() + 10000000;
|
||||
itr->m_timer = cachedTime + 10000000;
|
||||
|
||||
mark_dirty();
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ private:
|
||||
|
||||
core::CurlGet* m_http;
|
||||
std::string m_name;
|
||||
utils::Timer m_timer;
|
||||
rak::timer m_timer;
|
||||
};
|
||||
|
||||
typedef std::list<Node> Container;
|
||||
|
||||
@@ -60,7 +60,7 @@ WindowLog::~WindowLog() {
|
||||
|
||||
WindowLog::iterator
|
||||
WindowLog::find_older() {
|
||||
return m_log->find_older(utils::Timer::cache() - 60*1000000);
|
||||
return m_log->find_older(cachedTime - 60*1000000);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -58,7 +58,7 @@ WindowLogComplete::~WindowLogComplete() {
|
||||
|
||||
WindowLogComplete::iterator
|
||||
WindowLogComplete::find_older() {
|
||||
return m_log->find_older(utils::Timer::cache() - 60*1000000);
|
||||
return m_log->find_older(cachedTime - 60*1000000);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -57,7 +57,7 @@ WindowPeerInfo::WindowPeerInfo(core::Download* d, PList* l, PList::iterator* f)
|
||||
|
||||
void
|
||||
WindowPeerInfo::redraw() {
|
||||
utils::displayScheduler.insert(&m_taskUpdate, (utils::Timer::cache() + 1000000).round_seconds());
|
||||
displayScheduler.insert(&m_taskUpdate, (cachedTime + 1000000).round_seconds());
|
||||
m_canvas->erase();
|
||||
|
||||
int y = 0;
|
||||
|
||||
@@ -56,7 +56,7 @@ WindowPeerList::WindowPeerList(core::Download* d, PList* l, PList::iterator* f)
|
||||
|
||||
void
|
||||
WindowPeerList::redraw() {
|
||||
utils::displayScheduler.insert(&m_taskUpdate, (utils::Timer::cache() + 1000000).round_seconds());
|
||||
displayScheduler.insert(&m_taskUpdate, (cachedTime + 1000000).round_seconds());
|
||||
m_canvas->erase();
|
||||
|
||||
int x = 2;
|
||||
|
||||
@@ -56,7 +56,7 @@ WindowStatusbar::WindowStatusbar(core::Manager* c) :
|
||||
|
||||
void
|
||||
WindowStatusbar::redraw() {
|
||||
utils::displayScheduler.insert(&m_taskUpdate, (utils::Timer::cache() + 1000000).round_seconds());
|
||||
displayScheduler.insert(&m_taskUpdate, (cachedTime + 1000000).round_seconds());
|
||||
|
||||
m_canvas->erase();
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ WindowTitle::WindowTitle(const std::string& s) :
|
||||
|
||||
void
|
||||
WindowTitle::redraw() {
|
||||
utils::displayScheduler.insert(&m_taskUpdate, (utils::Timer::cache() + 1000000).round_seconds());
|
||||
displayScheduler.insert(&m_taskUpdate, (cachedTime + 1000000).round_seconds());
|
||||
m_canvas->erase();
|
||||
|
||||
m_canvas->print(std::max(0, (m_canvas->get_width() - (int)m_title.size()) / 2 - 4), 0,
|
||||
|
||||
@@ -55,7 +55,7 @@ WindowTrackerList::WindowTrackerList(core::Download* d, unsigned int* focus) :
|
||||
void
|
||||
WindowTrackerList::redraw() {
|
||||
// TODO: Make this depend on tracker signal.
|
||||
utils::displayScheduler.insert(&m_taskUpdate, (utils::Timer::cache() + 10 * 1000000).round_seconds());
|
||||
displayScheduler.insert(&m_taskUpdate, (cachedTime + 10 * 1000000).round_seconds());
|
||||
m_canvas->erase();
|
||||
|
||||
int pos = 0;
|
||||
|
||||
Reference in New Issue
Block a user