* 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:
rakshasa
2005-12-04 21:08:17 +00:00
parent a1a07c47aa
commit 32a3619cd8
39 changed files with 175 additions and 143 deletions
+3 -3
View File
@@ -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();
+1 -1
View File
@@ -43,7 +43,7 @@
#include <torrent/tracker.h>
#include "core/download.h"
#include "utils/timer.h"
#include <rak/timer.h>
#include "utils.h"
+3 -3
View File
@@ -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;
}
+6 -6
View File
@@ -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);
}
}
+4 -2
View File
@@ -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();
+2 -1
View File
@@ -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();
+2 -2
View File
@@ -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 ||
+3 -3
View File
@@ -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();
}
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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();
+1 -1
View File
@@ -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,
+1 -1
View File
@@ -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;