Added changing of the file priorities.

Seperated the algorithm extensions from functional.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@326 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2005-03-05 20:56:12 +00:00
parent 2dc7ffdb8f
commit ddf619f934
17 changed files with 105 additions and 40 deletions
+4 -4
View File
@@ -26,8 +26,8 @@ Manager::adjust_layout() {
int countDynamic = 0;
int staticHeight = 0;
std::for_each(begin(), end(), func::if_then(std::mem_fun(&Window::is_active), func::accumulate(staticHeight, std::mem_fun(&Window::get_min_height))));
std::for_each(begin(), end(), func::if_then(std::mem_fun(&Window::is_active), func::accumulate(countDynamic, std::mem_fun(&Window::is_dynamic))));
std::for_each(begin(), end(), utils::if_then(std::mem_fun(&Window::is_active), utils::accumulate(staticHeight, std::mem_fun(&Window::get_min_height))));
std::for_each(begin(), end(), utils::if_then(std::mem_fun(&Window::is_active), utils::accumulate(countDynamic, std::mem_fun(&Window::is_dynamic))));
int dynamic = std::max(0, Canvas::get_screen_height() - staticHeight);
int height = 0, h;
@@ -56,9 +56,9 @@ void
Manager::do_update() {
Canvas::refresh_std();
std::for_each(begin(), end(), func::if_then(std::mem_fun(&Window::is_active), func::if_then(std::mem_fun(&Window::is_dirty),
std::for_each(begin(), end(), utils::if_then(std::mem_fun(&Window::is_active), utils::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)));
std::for_each(begin(), end(), utils::if_then(std::mem_fun(&Window::is_active), std::mem_fun(&Window::refresh)));
Canvas::do_update();
}
+3 -3
View File
@@ -6,7 +6,7 @@
namespace display {
WindowFileList::WindowFileList(core::Download* d, int* focus) :
WindowFileList::WindowFileList(core::Download* d, unsigned int* focus) :
Window(new Canvas, true),
m_download(d),
m_focus(focus) {
@@ -27,8 +27,8 @@ WindowFileList::redraw() {
++y1;
int files = m_download->get_download().get_entry_size();
int index = std::min<unsigned>(std::max<signed>(*m_focus - (y2 - y1) / 2, 0), files - (y2 - y1));
unsigned int files = m_download->get_download().get_entry_size();
unsigned int index = std::min<unsigned>(std::max((int)*m_focus - (y2 - y1) / 2, 0), (int)files - (y2 - y1));
while (index < files && y1 < y2) {
torrent::Entry e = m_download->get_download().get_entry(index);
+2 -2
View File
@@ -17,7 +17,7 @@ namespace display {
class WindowFileList : public Window {
public:
WindowFileList(core::Download* d, int* focus);
WindowFileList(core::Download* d, unsigned int* focus);
virtual void redraw();
@@ -26,7 +26,7 @@ private:
core::Download* m_download;
int* m_focus;
unsigned int* m_focus;
};
}
+1 -1
View File
@@ -105,7 +105,7 @@ WindowHttpQueue::receive_insert(core::CurlGet* h) {
void
WindowHttpQueue::receive_erase(core::CurlGet* h) {
Container::iterator itr = std::find_if(m_container.begin(), m_container.end(),
func::equal(h, std::mem_fun_ref(&Node::get_http)));
utils::equal(h, std::mem_fun_ref(&Node::get_http)));
if (itr == m_container.end())
throw std::logic_error("WindowHttpQueue::receive_erase(...) tried to remove an object we don't have");
+1
View File
@@ -3,6 +3,7 @@
#include <stdexcept>
#include "core/download.h"
#include "utils/algorithm.h"
#include "canvas.h"
#include "window_peer_list.h"