Proper handling of resize events.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@256 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2005-02-06 00:09:47 +00:00
parent ecb2fc7d57
commit 11506c5a61
8 changed files with 67 additions and 26 deletions
+22 -2
View File
@@ -1,6 +1,7 @@
#include "config.h"
#include <stdexcept>
#include <sigc++/bind.h>
#include <torrent/torrent.h>
#include "input/bindings.h"
@@ -25,8 +26,7 @@ Download::Download(DPtr d, Control* c) :
m_window = new WPeerList(&m_peers, &m_focus);
m_window->slot_chunks_total(sigc::mem_fun(m_download->get_download(), &torrent::Download::get_chunks_total));
(*m_bindings)[KEY_UP] = sigc::mem_fun(*this, &Download::receive_prev);
(*m_bindings)[KEY_DOWN] = sigc::mem_fun(*this, &Download::receive_next);
bind_keys(m_bindings);
m_download->get_download().peer_list(m_peers);
@@ -98,6 +98,26 @@ Download::receive_peer_disconnected(torrent::Peer p) {
m_peers.erase(itr);
}
void
Download::receive_throttle(int t) {
m_status->mark_dirty();
torrent::set(torrent::THROTTLE_ROOT_CONST_RATE, torrent::get(torrent::THROTTLE_ROOT_CONST_RATE) + t * 1024);
}
void
Download::bind_keys(input::Bindings* b) {
(*b)['a'] = sigc::bind(sigc::mem_fun(*this, &Download::receive_throttle), 1);
(*b)['z'] = sigc::bind(sigc::mem_fun(*this, &Download::receive_throttle), -1);
(*b)['s'] = sigc::bind(sigc::mem_fun(*this, &Download::receive_throttle), 5);
(*b)['x'] = sigc::bind(sigc::mem_fun(*this, &Download::receive_throttle), -5);
(*b)['d'] = sigc::bind(sigc::mem_fun(*this, &Download::receive_throttle), 50);
(*b)['c'] = sigc::bind(sigc::mem_fun(*this, &Download::receive_throttle), -50);
(*b)[KEY_UP] = sigc::mem_fun(*this, &Download::receive_prev);
(*b)[KEY_DOWN] = sigc::mem_fun(*this, &Download::receive_next);
}
void
Download::mark_dirty() {
m_window->mark_dirty();
+4
View File
@@ -42,6 +42,10 @@ private:
void receive_peer_connected(torrent::Peer p);
void receive_peer_disconnected(torrent::Peer p);
void receive_throttle(int t);
void bind_keys(input::Bindings* b);
void mark_dirty();
DPtr m_download;
+16 -10
View File
@@ -26,16 +26,7 @@ DownloadList::DownloadList(core::DownloadList* l, Control* c) :
m_window = new WList(m_list, &m_focus);
(*m_bindings)[KEY_UP] = sigc::mem_fun(*this, &DownloadList::receive_prev);
(*m_bindings)[KEY_DOWN] = sigc::mem_fun(*this, &DownloadList::receive_next);
(*m_bindings)[KEY_RIGHT] = sigc::mem_fun(*this, &DownloadList::receive_view_download);
(*m_bindings)['a'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_throttle), 1);
(*m_bindings)['z'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_throttle), -1);
(*m_bindings)['s'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_throttle), 5);
(*m_bindings)['x'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_throttle), -5);
(*m_bindings)['d'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_throttle), 50);
(*m_bindings)['c'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_throttle), -50);
bind_keys(m_bindings);
}
DownloadList::~DownloadList() {
@@ -117,6 +108,21 @@ DownloadList::receive_throttle(int t) {
torrent::set(torrent::THROTTLE_ROOT_CONST_RATE, torrent::get(torrent::THROTTLE_ROOT_CONST_RATE) + t * 1024);
}
void
DownloadList::bind_keys(input::Bindings* b) {
(*b)['a'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_throttle), 1);
(*b)['z'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_throttle), -1);
(*b)['s'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_throttle), 5);
(*b)['x'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_throttle), -5);
(*b)['d'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_throttle), 50);
(*b)['c'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_throttle), -50);
(*b)[KEY_UP] = sigc::mem_fun(*this, &DownloadList::receive_prev);
(*b)[KEY_DOWN] = sigc::mem_fun(*this, &DownloadList::receive_next);
(*b)[KEY_RIGHT] = sigc::mem_fun(*this, &DownloadList::receive_view_download);
}
void
DownloadList::mark_dirty() {
m_window->mark_dirty();
+2
View File
@@ -38,6 +38,8 @@ private:
void receive_throttle(int t);
void bind_keys(input::Bindings* b);
void mark_dirty();
WList* m_window;