mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-13 05:32:31 +00:00
Added changed signal to list_focus and connected it to
WindowDownloadList. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@361 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+14
-22
@@ -58,11 +58,13 @@ DownloadList::DownloadList(Control* c) :
|
||||
|
||||
m_taskUpdate(sigc::mem_fun(*this, &DownloadList::task_update)),
|
||||
m_uiDownload(NULL),
|
||||
m_focus(c->get_core().get_download_list().end()),
|
||||
|
||||
m_downloadList(&c->get_core().get_download_list()),
|
||||
|
||||
m_control(c),
|
||||
m_bindings(new input::Bindings) {
|
||||
|
||||
m_uiArray[DISPLAY_DOWNLOAD_LIST] = new ElementDownloadList(&m_control->get_core().get_download_list(), &m_focus);
|
||||
m_uiArray[DISPLAY_DOWNLOAD_LIST] = new ElementDownloadList(&m_downloadList);
|
||||
m_uiArray[DISPLAY_LOG] = new ElementLogComplete(&m_control->get_core().get_log_complete());
|
||||
|
||||
m_windowLog = new WLog(&m_control->get_core().get_log_important());
|
||||
@@ -158,22 +160,12 @@ DownloadList::disable_display() {
|
||||
|
||||
void
|
||||
DownloadList::receive_next() {
|
||||
if (m_focus != m_control->get_core().get_download_list().end())
|
||||
++m_focus;
|
||||
else
|
||||
m_focus = m_control->get_core().get_download_list().begin();
|
||||
|
||||
//mark_dirty();
|
||||
m_downloadList.inc_focus();
|
||||
}
|
||||
|
||||
void
|
||||
DownloadList::receive_prev() {
|
||||
if (m_focus != m_control->get_core().get_download_list().begin())
|
||||
--m_focus;
|
||||
else
|
||||
m_focus = m_control->get_core().get_download_list().end();
|
||||
|
||||
//mark_dirty();
|
||||
m_downloadList.dec_focus();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -185,26 +177,26 @@ DownloadList::receive_throttle(int t) {
|
||||
|
||||
void
|
||||
DownloadList::receive_start_download() {
|
||||
if (m_focus == m_control->get_core().get_download_list().end())
|
||||
if (m_downloadList.get_focus() == m_downloadList.end())
|
||||
return;
|
||||
|
||||
m_control->get_core().start(*m_focus);
|
||||
m_control->get_core().start(*m_downloadList.get_focus());
|
||||
}
|
||||
|
||||
void
|
||||
DownloadList::receive_stop_download() {
|
||||
if (m_focus == m_control->get_core().get_download_list().end())
|
||||
if (m_downloadList.get_focus() == m_downloadList.end())
|
||||
return;
|
||||
|
||||
if ((*m_focus)->get_download().is_active())
|
||||
m_control->get_core().stop(*m_focus);
|
||||
if ((*m_downloadList.get_focus())->get_download().is_active())
|
||||
m_control->get_core().stop(*m_downloadList.get_focus());
|
||||
else
|
||||
m_focus = m_control->get_core().erase(m_focus);
|
||||
m_downloadList.set_focus(m_control->get_core().erase(m_downloadList.get_focus()));
|
||||
}
|
||||
|
||||
void
|
||||
DownloadList::receive_view_download() {
|
||||
if (m_focus == m_control->get_core().get_download_list().end())
|
||||
if (m_downloadList.get_focus() == m_downloadList.end())
|
||||
return;
|
||||
|
||||
if (m_uiDownload != NULL)
|
||||
@@ -212,7 +204,7 @@ DownloadList::receive_view_download() {
|
||||
|
||||
disable();
|
||||
|
||||
m_uiDownload = new Download(*m_focus, m_control);
|
||||
m_uiDownload = new Download(*m_downloadList.get_focus(), m_control);
|
||||
|
||||
m_uiDownload->activate();
|
||||
m_uiDownload->get_bindings()[KEY_LEFT] = sigc::mem_fun(*this, &DownloadList::receive_exit_download);
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "core/download_list.h"
|
||||
#include "utils/task.h"
|
||||
#include "utils/list_focus.h"
|
||||
|
||||
namespace input {
|
||||
class Bindings;
|
||||
@@ -58,7 +59,7 @@ public:
|
||||
typedef display::WindowStatusbar WStatus;
|
||||
typedef display::WindowTitle WTitle;
|
||||
|
||||
typedef core::DownloadList DList;
|
||||
typedef utils::ListFocus<core::DownloadList> DList;
|
||||
|
||||
typedef sigc::slot1<void, const std::string&> SlotOpenUri;
|
||||
|
||||
@@ -122,8 +123,7 @@ private:
|
||||
|
||||
Download* m_uiDownload;
|
||||
|
||||
DList* m_list;
|
||||
DList::iterator m_focus;
|
||||
DList m_downloadList;
|
||||
|
||||
Control* m_control;
|
||||
input::Bindings* m_bindings;
|
||||
|
||||
@@ -31,11 +31,9 @@
|
||||
|
||||
namespace ui {
|
||||
|
||||
ElementDownloadList::ElementDownloadList(DList* l, DList::iterator* f) :
|
||||
ElementDownloadList::ElementDownloadList(DList* l) :
|
||||
m_window(NULL),
|
||||
m_list(l),
|
||||
m_focus(f) {
|
||||
|
||||
m_list(l) {
|
||||
}
|
||||
|
||||
void
|
||||
@@ -45,7 +43,7 @@ ElementDownloadList::activate(Control* c, MItr mItr) {
|
||||
|
||||
c->get_input().push_front(&m_bindings);
|
||||
|
||||
*mItr = m_window = new WDownloadList(m_list, m_focus);
|
||||
*mItr = m_window = new WDownloadList(m_list);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#define RTORRENT_UI_ELEMENT_DOWNLOAD_LIST_H
|
||||
|
||||
#include "core/download_list.h"
|
||||
#include "utils/list_focus.h"
|
||||
|
||||
#include "element_base.h"
|
||||
|
||||
@@ -37,10 +38,10 @@ class Control;
|
||||
|
||||
class ElementDownloadList : public ElementBase {
|
||||
public:
|
||||
typedef display::WindowDownloadList WDownloadList;
|
||||
typedef core::DownloadList DList;
|
||||
typedef display::WindowDownloadList WDownloadList;
|
||||
typedef utils::ListFocus<core::DownloadList> DList;
|
||||
|
||||
ElementDownloadList(DList* l, DList::iterator* f);
|
||||
ElementDownloadList(DList* l);
|
||||
|
||||
void activate(Control* c, MItr mItr);
|
||||
void disable(Control* c);
|
||||
@@ -49,7 +50,6 @@ private:
|
||||
WDownloadList* m_window;
|
||||
|
||||
DList* m_list;
|
||||
DList::iterator* m_focus;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user