Task Scheduler, log viewer pops up and disapperes. good good

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@308 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2005-02-26 21:58:59 +00:00
parent 9fe97ee490
commit ef3a8fcd83
15 changed files with 221 additions and 49 deletions
+4 -1
View File
@@ -21,8 +21,11 @@ print_download_status(core::Download* d) {
} else if (!d->get_download().is_active()) {
str << "Inactive";
} else {
} else if (!d->get_tracker_msg().empty()) {
str << "Tracker: " << d->get_tracker_msg();
} else {
str << "---";
}
return str.str();
+2 -2
View File
@@ -34,13 +34,13 @@ WindowDownloadList::redraw() {
int i = 0;
itr = last = *m_focus;
while (i < m_canvas->get_height() - y && !(itr == m_list->begin() && last == m_list->end())) {
while (i < m_canvas->get_height() - y - 3 && !(itr == m_list->begin() && last == m_list->end())) {
if (last != m_list->end()) {
++last;
i += 3;
}
if (itr != m_list->begin() && i < m_canvas->get_height() - y) {
if (itr != m_list->begin() && i < m_canvas->get_height() - y - 3) {
--itr;
i += 3;
}
+17 -9
View File
@@ -1,7 +1,5 @@
#include "config.h"
#include "core/log.h"
#include "canvas.h"
#include "window_log.h"
@@ -13,13 +11,19 @@ WindowLog::WindowLog(core::Log* l) :
set_active(false);
m_connUpdate = l->signal_update().connect(sigc::mem_fun(*this, &WindowLog::receive_update));
// We're trying out scheduled tasks instead.
//m_connUpdate = l->signal_update().connect(sigc::mem_fun(*this, &WindowLog::receive_update));
}
WindowLog::~WindowLog() {
m_connUpdate.disconnect();
}
WindowLog::iterator
WindowLog::find_older() {
return m_log->find_older(utils::Timer::cache() - 10*1000000);
}
void
WindowLog::redraw() {
if (!is_dirty())
@@ -31,18 +35,22 @@ WindowLog::redraw() {
int pos = 0;
for (core::Log::iterator itr = m_log->begin(), end = m_log->end(); itr != end; ++itr)
m_canvas->print(0, pos++, "Log: %s", itr->second.c_str());
//m_canvas->print(std::max(0, (int)m_canvas->get_width() / 2 - 5), pos++, "*** Log ***");
m_canvas->print(0, 0, "___");
for (core::Log::iterator itr = m_log->begin(), end = find_older(); itr != end && pos < m_minHeight; ++itr)
m_canvas->print(0, pos++, "<date>: %s", itr->second.c_str());
}
void
WindowLog::receive_update() {
int newHeight = std::min<size_t>(m_log->size(), 5);
iterator itr = find_older();
int h = std::distance(m_log->begin(), itr);
if (newHeight != m_minHeight) {
m_minHeight = newHeight;
if (h != m_minHeight) {
set_active(h != 0);
set_active(m_minHeight != 0);
m_minHeight = h;
m_slotAdjust();
}
+7 -5
View File
@@ -3,24 +3,26 @@
#include <sigc++/connection.h>
#include "window.h"
#include "core/log.h"
namespace core {
class Log;
}
#include "window.h"
namespace display {
class WindowLog : public Window {
public:
typedef core::Log::iterator iterator;
WindowLog(core::Log* l);
~WindowLog();
virtual void redraw();
private:
void receive_update();
private:
inline iterator find_older();
core::Log* m_log;
sigc::connection m_connUpdate;
};