mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-22 00:56:18 +00:00
* Added VariableBool.
* Added views for downloads, that can be sorted. * Added options "view_add", "view_sort" and "view_new". git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@671 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
#include <rak/algorithm.h>
|
||||
|
||||
#include "core/download.h"
|
||||
#include "core/view_downloads.h"
|
||||
|
||||
#include "canvas.h"
|
||||
#include "globals.h"
|
||||
@@ -47,11 +48,11 @@
|
||||
|
||||
namespace display {
|
||||
|
||||
WindowDownloadList::WindowDownloadList(DList* l) :
|
||||
WindowDownloadList::WindowDownloadList(core::ViewDownloads* l) :
|
||||
Window(new Canvas, true),
|
||||
m_list(l) {
|
||||
m_view(l) {
|
||||
|
||||
m_connChanged = m_list->signal_changed().connect(sigc::mem_fun(*this, &Window::mark_dirty));
|
||||
m_connChanged = m_view->signal_changed().connect(sigc::mem_fun(*this, &Window::mark_dirty));
|
||||
}
|
||||
|
||||
WindowDownloadList::~WindowDownloadList() {
|
||||
@@ -64,20 +65,20 @@ WindowDownloadList::redraw() {
|
||||
|
||||
m_canvas->erase();
|
||||
|
||||
if (m_list->base().empty() || m_canvas->get_width() < 5)
|
||||
if (m_view->empty() || m_canvas->get_width() < 5)
|
||||
return;
|
||||
|
||||
typedef std::pair<DList::iterator, DList::iterator> Range;
|
||||
typedef std::pair<core::ViewDownloads::iterator, core::ViewDownloads::iterator> Range;
|
||||
|
||||
Range range = rak::advance_bidirectional(m_list->begin(),
|
||||
m_list->get_focus() != m_list->end() ? m_list->get_focus() : m_list->begin(),
|
||||
m_list->end(),
|
||||
Range range = rak::advance_bidirectional(m_view->begin(),
|
||||
m_view->focus() != m_view->end() ? m_view->focus() : m_view->begin(),
|
||||
m_view->end(),
|
||||
m_canvas->get_height() / 3);
|
||||
|
||||
// Make sure we properly fill out the last lines so it looks like
|
||||
// there are more torrents, yet don't hide it if we got the last one
|
||||
// in focus.
|
||||
if (range.second != m_list->end())
|
||||
if (range.second != m_view->end())
|
||||
++range.second;
|
||||
|
||||
int pos = 0;
|
||||
@@ -88,13 +89,13 @@ WindowDownloadList::redraw() {
|
||||
char* last = buffer + m_canvas->get_width() - 2;
|
||||
|
||||
position = print_download_title(buffer, last, *range.first);
|
||||
m_canvas->print(0, pos++, "%c %s", range.first == m_list->get_focus() ? '*' : ' ', buffer);
|
||||
m_canvas->print(0, pos++, "%c %s", range.first == m_view->focus() ? '*' : ' ', buffer);
|
||||
|
||||
position = print_download_info(buffer, last, *range.first);
|
||||
m_canvas->print(0, pos++, "%c %s", range.first == m_list->get_focus() ? '*' : ' ', buffer);
|
||||
m_canvas->print(0, pos++, "%c %s", range.first == m_view->focus() ? '*' : ' ', buffer);
|
||||
|
||||
position = print_download_status(buffer, last, *range.first);
|
||||
m_canvas->print(0, pos++, "%c %s", range.first == m_list->get_focus() ? '*' : ' ', buffer);
|
||||
m_canvas->print(0, pos++, "%c %s", range.first == m_view->focus() ? '*' : ' ', buffer);
|
||||
|
||||
++range.first;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user