mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-15 13:46:17 +00:00
Prefixed ui element classes with Element.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@359 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -22,3 +22,4 @@ Make accumulate return the value, no refs please...
|
|||||||
> - being able to delete not just the torrent file, but the files it
|
> - being able to delete not just the torrent file, but the files it
|
||||||
> created from rtorrent. Like when you start a torrent, but it is too
|
> created from rtorrent. Like when you start a torrent, but it is too
|
||||||
> slow or broken or for various reasons you don't want to download it.
|
> slow or broken or for various reasons you don't want to download it.
|
||||||
|
|
||||||
+4
-3
@@ -75,9 +75,10 @@ advance_bidirectional(_InputIter __first, _InputIter __middle1, _InputIter __las
|
|||||||
return std::make_pair(__middle1, __middle2);
|
return std::make_pair(__middle1, __middle2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename _Value>
|
||||||
struct
|
struct
|
||||||
string_starts_with : public std::binary_function<std::string, std::string, bool> {
|
compare_base : public std::binary_function<_Value, _Value, bool> {
|
||||||
bool operator () (const std::string& complete, const std::string& base) const {
|
bool operator () (const _Value& complete, const _Value& base) const {
|
||||||
return !complete.compare(0, base.size(), base);
|
return !complete.compare(0, base.size(), base);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -110,7 +111,7 @@ make_base(_InputIter __first, _InputIter __last) {
|
|||||||
typename std::iterator_traits<_InputIter>::difference_type __pos = count_base(__base.begin(), __base.end(),
|
typename std::iterator_traits<_InputIter>::difference_type __pos = count_base(__base.begin(), __base.end(),
|
||||||
__first->begin(), __first->end());
|
__first->begin(), __first->end());
|
||||||
|
|
||||||
if (__pos < __base.size())
|
if (__pos < (typename std::iterator_traits<_InputIter>::difference_type)__base.size())
|
||||||
__base.resize(__pos);
|
__base.resize(__pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ PathInput::receive_do_complete() {
|
|||||||
if (r.first == r.second)
|
if (r.first == r.second)
|
||||||
return; // Show some nice colors here.
|
return; // Show some nice colors here.
|
||||||
|
|
||||||
std::string base = make_base(r.first, r.second);
|
std::string base = rak::make_base(r.first, r.second);
|
||||||
|
|
||||||
// Clear the path after the cursor to make this code cleaner. It's
|
// Clear the path after the cursor to make this code cleaner. It's
|
||||||
// not really nessesary to add the complexity just because someone
|
// not really nessesary to add the complexity just because someone
|
||||||
@@ -89,8 +89,8 @@ PathInput::Range
|
|||||||
PathInput::find_incomplete(utils::Directory& d, const std::string& f) {
|
PathInput::find_incomplete(utils::Directory& d, const std::string& f) {
|
||||||
Range r;
|
Range r;
|
||||||
|
|
||||||
r.first = std::find_if(d.begin(), d.end(), std::bind2nd(string_starts_with(), f));
|
r.first = std::find_if(d.begin(), d.end(), std::bind2nd(rak::compare_base<std::string>(), f));
|
||||||
r.second = std::find_if(r.first, d.end(), std::not1(std::bind2nd(string_starts_with(), f)));
|
r.second = std::find_if(r.first, d.end(), std::not1(std::bind2nd(rak::compare_base<std::string>(), f)));
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-9
@@ -7,15 +7,17 @@ libsub_ui_a_SOURCES = \
|
|||||||
download.h \
|
download.h \
|
||||||
download_list.cc \
|
download_list.cc \
|
||||||
download_list.h \
|
download_list.h \
|
||||||
file_list.cc \
|
element_download_list.cc \
|
||||||
file_list.h \
|
element_download_list.h \
|
||||||
peer_info.cc \
|
element_file_list.cc \
|
||||||
peer_info.h \
|
element_file_list.h \
|
||||||
peer_list.cc \
|
element_peer_info.cc \
|
||||||
peer_list.h \
|
element_peer_info.h \
|
||||||
|
element_peer_list.cc \
|
||||||
|
element_peer_list.h \
|
||||||
|
element_tracker_list.cc \
|
||||||
|
element_tracker_list.h \
|
||||||
root.cc \
|
root.cc \
|
||||||
root.h \
|
root.h
|
||||||
tracker_list.cc \
|
|
||||||
tracker_list.h
|
|
||||||
|
|
||||||
INCLUDES = -I$(srcdir) -I$(srcdir)/.. -I$(top_srcdir)
|
INCLUDES = -I$(srcdir) -I$(srcdir)/.. -I$(top_srcdir)
|
||||||
|
|||||||
+9
-9
@@ -35,10 +35,10 @@
|
|||||||
|
|
||||||
#include "control.h"
|
#include "control.h"
|
||||||
#include "download.h"
|
#include "download.h"
|
||||||
#include "file_list.h"
|
#include "element_file_list.h"
|
||||||
#include "peer_info.h"
|
#include "element_peer_info.h"
|
||||||
#include "peer_list.h"
|
#include "element_peer_list.h"
|
||||||
#include "tracker_list.h"
|
#include "element_tracker_list.h"
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
@@ -57,10 +57,10 @@ Download::Download(DPtr d, Control* c) :
|
|||||||
|
|
||||||
m_focus = m_peers.end();
|
m_focus = m_peers.end();
|
||||||
|
|
||||||
m_uiArray[DISPLAY_PEER_LIST] = new PeerList(d, &m_peers, &m_focus);
|
m_uiArray[DISPLAY_PEER_LIST] = new ElementPeerList(d, &m_peers, &m_focus);
|
||||||
m_uiArray[DISPLAY_PEER_INFO] = new PeerInfo(d, &m_peers, &m_focus);
|
m_uiArray[DISPLAY_PEER_INFO] = new ElementPeerInfo(d, &m_peers, &m_focus);
|
||||||
m_uiArray[DISPLAY_FILE_LIST] = new FileList(d);
|
m_uiArray[DISPLAY_FILE_LIST] = new ElementFileList(d);
|
||||||
m_uiArray[DISPLAY_TRACKER_LIST] = new TrackerList(d);
|
m_uiArray[DISPLAY_TRACKER_LIST] = new ElementTrackerList(d);
|
||||||
|
|
||||||
bind_keys();
|
bind_keys();
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ Download::~Download() {
|
|||||||
if (m_window != m_control->get_display().end())
|
if (m_window != m_control->get_display().end())
|
||||||
throw std::logic_error("ui::Download::~Download() called on an active object");
|
throw std::logic_error("ui::Download::~Download() called on an active object");
|
||||||
|
|
||||||
std::for_each(m_uiArray, m_uiArray + DISPLAY_MAX_SIZE, rak::call_delete<BaseElement>());
|
std::for_each(m_uiArray, m_uiArray + DISPLAY_MAX_SIZE, rak::call_delete<ElementBase>());
|
||||||
|
|
||||||
delete m_windowTitle;
|
delete m_windowTitle;
|
||||||
delete m_windowDownloadStatus;
|
delete m_windowDownloadStatus;
|
||||||
|
|||||||
+2
-2
@@ -40,7 +40,7 @@ namespace core {
|
|||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
class Control;
|
class Control;
|
||||||
class BaseElement;
|
class ElementBase;
|
||||||
|
|
||||||
class Download {
|
class Download {
|
||||||
public:
|
public:
|
||||||
@@ -100,7 +100,7 @@ private:
|
|||||||
|
|
||||||
Display m_state;
|
Display m_state;
|
||||||
|
|
||||||
BaseElement* m_uiArray[DISPLAY_MAX_SIZE];
|
ElementBase* m_uiArray[DISPLAY_MAX_SIZE];
|
||||||
|
|
||||||
WTitle* m_windowTitle;
|
WTitle* m_windowTitle;
|
||||||
WDownloadStatus* m_windowDownloadStatus;
|
WDownloadStatus* m_windowDownloadStatus;
|
||||||
|
|||||||
@@ -20,19 +20,19 @@
|
|||||||
// Skomakerveien 33
|
// Skomakerveien 33
|
||||||
// 3185 Skoppum, NORWAY
|
// 3185 Skoppum, NORWAY
|
||||||
|
|
||||||
#ifndef RTORRENT_UI_BASE_ELEMENT_H
|
#ifndef RTORRENT_UI_ELEMENT_BASE_H
|
||||||
#define RTORRENT_UI_BASE_ELEMENT_H
|
#define RTORRENT_UI_ELEMENT_BASE_H
|
||||||
|
|
||||||
#include "display/manager.h"
|
#include "display/manager.h"
|
||||||
#include "input/bindings.h"
|
#include "input/bindings.h"
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
class BaseElement {
|
class ElementBase {
|
||||||
public:
|
public:
|
||||||
typedef display::Manager::iterator MItr;
|
typedef display::Manager::iterator MItr;
|
||||||
|
|
||||||
virtual ~BaseElement() {}
|
virtual ~ElementBase() {}
|
||||||
|
|
||||||
virtual void activate(Control* c, MItr mItr) = 0;
|
virtual void activate(Control* c, MItr mItr) = 0;
|
||||||
virtual void disable(Control* c) = 0;
|
virtual void disable(Control* c) = 0;
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
// rTorrent - BitTorrent client
|
||||||
|
// Copyright (C) 2005, Jari Sundell
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation; either version 2 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
//
|
||||||
|
// Contact: Jari Sundell <jaris@ifi.uio.no>
|
||||||
|
//
|
||||||
|
// Skomakerveien 33
|
||||||
|
// 3185 Skoppum, NORWAY
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
|
#include "display/window_peer_list.h"
|
||||||
|
|
||||||
|
#include "control.h"
|
||||||
|
#include "element_download_list.h"
|
||||||
|
|
||||||
|
namespace ui {
|
||||||
|
|
||||||
|
ElementDownloadList::ElementDownloadList(DList* l, DList::iterator* f) :
|
||||||
|
m_window(NULL),
|
||||||
|
m_list(l),
|
||||||
|
m_focus(f) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ElementDownloadList::activate(Control* c, MItr mItr) {
|
||||||
|
if (m_window != NULL)
|
||||||
|
throw std::logic_error("ui::ElementDownloadList::activate(...) called on an object in the wrong state");
|
||||||
|
|
||||||
|
// c->get_input().push_front(&m_bindings);
|
||||||
|
|
||||||
|
// *mItr = m_window = new WDownloadList(m_download, m_list, m_focus);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ElementDownloadList::disable(Control* c) {
|
||||||
|
if (m_window == NULL)
|
||||||
|
throw std::logic_error("ui::ElementDownloadList::disable(...) called on an object in the wrong state");
|
||||||
|
|
||||||
|
// c->get_input().erase(&m_bindings);
|
||||||
|
|
||||||
|
// delete m_window;
|
||||||
|
// m_window = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
// rTorrent - BitTorrent client
|
||||||
|
// Copyright (C) 2005, Jari Sundell
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation; either version 2 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
//
|
||||||
|
// Contact: Jari Sundell <jaris@ifi.uio.no>
|
||||||
|
//
|
||||||
|
// Skomakerveien 33
|
||||||
|
// 3185 Skoppum, NORWAY
|
||||||
|
|
||||||
|
#ifndef RTORRENT_UI_ELEMENT_DOWNLOAD_LIST_H
|
||||||
|
#define RTORRENT_UI_ELEMENT_DOWNLOAD_LIST_H
|
||||||
|
|
||||||
|
#include "core/download_list.h"
|
||||||
|
|
||||||
|
#include "element_base.h"
|
||||||
|
|
||||||
|
namespace display {
|
||||||
|
class WindowDownloadList;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace ui {
|
||||||
|
|
||||||
|
class Control;
|
||||||
|
|
||||||
|
class ElementDownloadList : public ElementBase {
|
||||||
|
public:
|
||||||
|
typedef display::WindowDownloadList WDownloadList;
|
||||||
|
typedef core::DownloadList DList;
|
||||||
|
|
||||||
|
ElementDownloadList(DList* l, DList::iterator* f);
|
||||||
|
|
||||||
|
void activate(Control* c, MItr mItr);
|
||||||
|
void disable(Control* c);
|
||||||
|
|
||||||
|
private:
|
||||||
|
WDownloadList* m_window;
|
||||||
|
|
||||||
|
DList* m_list;
|
||||||
|
DList::iterator* m_focus;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -27,24 +27,24 @@
|
|||||||
#include "display/window_file_list.h"
|
#include "display/window_file_list.h"
|
||||||
|
|
||||||
#include "control.h"
|
#include "control.h"
|
||||||
#include "file_list.h"
|
#include "element_file_list.h"
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
FileList::FileList(core::Download* d) :
|
ElementFileList::ElementFileList(core::Download* d) :
|
||||||
m_download(d),
|
m_download(d),
|
||||||
m_window(NULL),
|
m_window(NULL),
|
||||||
m_focus(0) {
|
m_focus(0) {
|
||||||
|
|
||||||
m_bindings[' '] = sigc::mem_fun(*this, &FileList::receive_priority);
|
m_bindings[' '] = sigc::mem_fun(*this, &ElementFileList::receive_priority);
|
||||||
m_bindings[KEY_DOWN] = sigc::mem_fun(*this, &FileList::receive_next);
|
m_bindings[KEY_DOWN] = sigc::mem_fun(*this, &ElementFileList::receive_next);
|
||||||
m_bindings[KEY_UP] = sigc::mem_fun(*this, &FileList::receive_prev);
|
m_bindings[KEY_UP] = sigc::mem_fun(*this, &ElementFileList::receive_prev);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FileList::activate(Control* c, MItr mItr) {
|
ElementFileList::activate(Control* c, MItr mItr) {
|
||||||
if (m_window != NULL)
|
if (m_window != NULL)
|
||||||
throw std::logic_error("ui::FileList::activate(...) called on an object in the wrong state");
|
throw std::logic_error("ui::ElementFileList::activate(...) called on an object in the wrong state");
|
||||||
|
|
||||||
c->get_input().push_front(&m_bindings);
|
c->get_input().push_front(&m_bindings);
|
||||||
|
|
||||||
@@ -52,9 +52,9 @@ FileList::activate(Control* c, MItr mItr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FileList::disable(Control* c) {
|
ElementFileList::disable(Control* c) {
|
||||||
if (m_window == NULL)
|
if (m_window == NULL)
|
||||||
throw std::logic_error("ui::FileList::disable(...) called on an object in the wrong state");
|
throw std::logic_error("ui::ElementFileList::disable(...) called on an object in the wrong state");
|
||||||
|
|
||||||
c->get_input().erase(&m_bindings);
|
c->get_input().erase(&m_bindings);
|
||||||
|
|
||||||
@@ -63,9 +63,9 @@ FileList::disable(Control* c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FileList::receive_next() {
|
ElementFileList::receive_next() {
|
||||||
if (m_window == NULL)
|
if (m_window == NULL)
|
||||||
throw std::logic_error("ui::FileList::receive_next(...) called on a disabled object");
|
throw std::logic_error("ui::ElementFileList::receive_next(...) called on a disabled object");
|
||||||
|
|
||||||
if (++m_focus >= m_download->get_download().get_entry_size())
|
if (++m_focus >= m_download->get_download().get_entry_size())
|
||||||
m_focus = 0;
|
m_focus = 0;
|
||||||
@@ -74,9 +74,9 @@ FileList::receive_next() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FileList::receive_prev() {
|
ElementFileList::receive_prev() {
|
||||||
if (m_window == NULL)
|
if (m_window == NULL)
|
||||||
throw std::logic_error("ui::FileList::receive_prev(...) called on a disabled object");
|
throw std::logic_error("ui::ElementFileList::receive_prev(...) called on a disabled object");
|
||||||
|
|
||||||
if (m_download->get_download().get_entry_size() == 0)
|
if (m_download->get_download().get_entry_size() == 0)
|
||||||
return;
|
return;
|
||||||
@@ -90,9 +90,9 @@ FileList::receive_prev() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FileList::receive_priority() {
|
ElementFileList::receive_priority() {
|
||||||
if (m_window == NULL)
|
if (m_window == NULL)
|
||||||
throw std::logic_error("ui::FileList::receive_prev(...) called on a disabled object");
|
throw std::logic_error("ui::ElementFileList::receive_prev(...) called on a disabled object");
|
||||||
|
|
||||||
if (m_focus >= m_download->get_download().get_entry_size())
|
if (m_focus >= m_download->get_download().get_entry_size())
|
||||||
return;
|
return;
|
||||||
@@ -20,12 +20,12 @@
|
|||||||
// Skomakerveien 33
|
// Skomakerveien 33
|
||||||
// 3185 Skoppum, NORWAY
|
// 3185 Skoppum, NORWAY
|
||||||
|
|
||||||
#ifndef RTORRENT_UI_FILE_LIST_H
|
#ifndef RTORRENT_UI_ELEMENT_FILE_LIST_H
|
||||||
#define RTORRENT_UI_FILE_LIST_H
|
#define RTORRENT_UI_ELEMENT_FILE_LIST_H
|
||||||
|
|
||||||
#include "core/download.h"
|
#include "core/download.h"
|
||||||
|
|
||||||
#include "base_element.h"
|
#include "element_base.h"
|
||||||
|
|
||||||
namespace display {
|
namespace display {
|
||||||
class WindowFileList;
|
class WindowFileList;
|
||||||
@@ -35,11 +35,11 @@ namespace ui {
|
|||||||
|
|
||||||
class Control;
|
class Control;
|
||||||
|
|
||||||
class FileList : public BaseElement {
|
class ElementFileList : public ElementBase {
|
||||||
public:
|
public:
|
||||||
typedef display::WindowFileList WFileList;
|
typedef display::WindowFileList WFileList;
|
||||||
|
|
||||||
FileList(core::Download* d);
|
ElementFileList(core::Download* d);
|
||||||
|
|
||||||
void activate(Control* c, MItr mItr);
|
void activate(Control* c, MItr mItr);
|
||||||
void disable(Control* c);
|
void disable(Control* c);
|
||||||
@@ -27,11 +27,11 @@
|
|||||||
#include "display/window_peer_info.h"
|
#include "display/window_peer_info.h"
|
||||||
|
|
||||||
#include "control.h"
|
#include "control.h"
|
||||||
#include "peer_info.h"
|
#include "element_peer_info.h"
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
PeerInfo::PeerInfo(core::Download* d, PList* l, PList::iterator* f) :
|
ElementPeerInfo::ElementPeerInfo(core::Download* d, PList* l, PList::iterator* f) :
|
||||||
m_download(d),
|
m_download(d),
|
||||||
m_window(NULL),
|
m_window(NULL),
|
||||||
m_list(l),
|
m_list(l),
|
||||||
@@ -40,9 +40,9 @@ PeerInfo::PeerInfo(core::Download* d, PList* l, PList::iterator* f) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PeerInfo::activate(Control* c, MItr mItr) {
|
ElementPeerInfo::activate(Control* c, MItr mItr) {
|
||||||
if (m_window != NULL)
|
if (m_window != NULL)
|
||||||
throw std::logic_error("ui::PeerInfo::activate(...) called on an object in the wrong state");
|
throw std::logic_error("ui::ElementPeerInfo::activate(...) called on an object in the wrong state");
|
||||||
|
|
||||||
c->get_input().push_front(&m_bindings);
|
c->get_input().push_front(&m_bindings);
|
||||||
|
|
||||||
@@ -50,9 +50,9 @@ PeerInfo::activate(Control* c, MItr mItr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PeerInfo::disable(Control* c) {
|
ElementPeerInfo::disable(Control* c) {
|
||||||
if (m_window == NULL)
|
if (m_window == NULL)
|
||||||
throw std::logic_error("ui::PeerInfo::disable(...) called on an object in the wrong state");
|
throw std::logic_error("ui::ElementPeerInfo::disable(...) called on an object in the wrong state");
|
||||||
|
|
||||||
c->get_input().erase(&m_bindings);
|
c->get_input().erase(&m_bindings);
|
||||||
|
|
||||||
@@ -20,12 +20,12 @@
|
|||||||
// Skomakerveien 33
|
// Skomakerveien 33
|
||||||
// 3185 Skoppum, NORWAY
|
// 3185 Skoppum, NORWAY
|
||||||
|
|
||||||
#ifndef RTORRENT_UI_PEER_INFO_H
|
#ifndef RTORRENT_UI_ELEMENT_PEER_INFO_H
|
||||||
#define RTORRENT_UI_PEER_INFO_H
|
#define RTORRENT_UI_ELEMENT_PEER_INFO_H
|
||||||
|
|
||||||
#include "core/download.h"
|
#include "core/download.h"
|
||||||
|
|
||||||
#include "base_element.h"
|
#include "element_base.h"
|
||||||
|
|
||||||
namespace display {
|
namespace display {
|
||||||
class WindowPeerInfo;
|
class WindowPeerInfo;
|
||||||
@@ -35,12 +35,12 @@ namespace ui {
|
|||||||
|
|
||||||
class Control;
|
class Control;
|
||||||
|
|
||||||
class PeerInfo : public BaseElement {
|
class ElementPeerInfo : public ElementBase {
|
||||||
public:
|
public:
|
||||||
typedef display::WindowPeerInfo WPeerInfo;
|
typedef display::WindowPeerInfo WPeerInfo;
|
||||||
typedef std::list<torrent::Peer> PList;
|
typedef std::list<torrent::Peer> PList;
|
||||||
|
|
||||||
PeerInfo(core::Download* d, PList* l, PList::iterator* f);
|
ElementPeerInfo(core::Download* d, PList* l, PList::iterator* f);
|
||||||
|
|
||||||
void activate(Control* c, MItr mItr);
|
void activate(Control* c, MItr mItr);
|
||||||
void disable(Control* c);
|
void disable(Control* c);
|
||||||
@@ -27,11 +27,11 @@
|
|||||||
#include "display/window_peer_list.h"
|
#include "display/window_peer_list.h"
|
||||||
|
|
||||||
#include "control.h"
|
#include "control.h"
|
||||||
#include "peer_list.h"
|
#include "element_peer_list.h"
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
PeerList::PeerList(core::Download* d, PList* l, PList::iterator* f) :
|
ElementPeerList::ElementPeerList(core::Download* d, PList* l, PList::iterator* f) :
|
||||||
m_download(d),
|
m_download(d),
|
||||||
m_window(NULL),
|
m_window(NULL),
|
||||||
m_list(l),
|
m_list(l),
|
||||||
@@ -40,9 +40,9 @@ PeerList::PeerList(core::Download* d, PList* l, PList::iterator* f) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PeerList::activate(Control* c, MItr mItr) {
|
ElementPeerList::activate(Control* c, MItr mItr) {
|
||||||
if (m_window != NULL)
|
if (m_window != NULL)
|
||||||
throw std::logic_error("ui::PeerList::activate(...) called on an object in the wrong state");
|
throw std::logic_error("ui::ElementPeerList::activate(...) called on an object in the wrong state");
|
||||||
|
|
||||||
c->get_input().push_front(&m_bindings);
|
c->get_input().push_front(&m_bindings);
|
||||||
|
|
||||||
@@ -50,9 +50,9 @@ PeerList::activate(Control* c, MItr mItr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PeerList::disable(Control* c) {
|
ElementPeerList::disable(Control* c) {
|
||||||
if (m_window == NULL)
|
if (m_window == NULL)
|
||||||
throw std::logic_error("ui::PeerList::disable(...) called on an object in the wrong state");
|
throw std::logic_error("ui::ElementPeerList::disable(...) called on an object in the wrong state");
|
||||||
|
|
||||||
c->get_input().erase(&m_bindings);
|
c->get_input().erase(&m_bindings);
|
||||||
|
|
||||||
@@ -20,12 +20,12 @@
|
|||||||
// Skomakerveien 33
|
// Skomakerveien 33
|
||||||
// 3185 Skoppum, NORWAY
|
// 3185 Skoppum, NORWAY
|
||||||
|
|
||||||
#ifndef RTORRENT_UI_PEER_LIST_H
|
#ifndef RTORRENT_UI_ELEMENT_PEER_LIST_H
|
||||||
#define RTORRENT_UI_PEER_LIST_H
|
#define RTORRENT_UI_ELEMENT_PEER_LIST_H
|
||||||
|
|
||||||
#include "core/download.h"
|
#include "core/download.h"
|
||||||
|
|
||||||
#include "base_element.h"
|
#include "element_base.h"
|
||||||
|
|
||||||
namespace display {
|
namespace display {
|
||||||
class WindowPeerList;
|
class WindowPeerList;
|
||||||
@@ -35,12 +35,12 @@ namespace ui {
|
|||||||
|
|
||||||
class Control;
|
class Control;
|
||||||
|
|
||||||
class PeerList : public BaseElement {
|
class ElementPeerList : public ElementBase {
|
||||||
public:
|
public:
|
||||||
typedef display::WindowPeerList WPeerList;
|
typedef display::WindowPeerList WPeerList;
|
||||||
typedef std::list<torrent::Peer> PList;
|
typedef std::list<torrent::Peer> PList;
|
||||||
|
|
||||||
PeerList(core::Download* d, PList* l, PList::iterator* f);
|
ElementPeerList(core::Download* d, PList* l, PList::iterator* f);
|
||||||
|
|
||||||
void activate(Control* c, MItr mItr);
|
void activate(Control* c, MItr mItr);
|
||||||
void disable(Control* c);
|
void disable(Control* c);
|
||||||
@@ -27,23 +27,23 @@
|
|||||||
#include "display/window_tracker_list.h"
|
#include "display/window_tracker_list.h"
|
||||||
|
|
||||||
#include "control.h"
|
#include "control.h"
|
||||||
#include "tracker_list.h"
|
#include "element_tracker_list.h"
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
TrackerList::TrackerList(core::Download* d) :
|
ElementTrackerList::ElementTrackerList(core::Download* d) :
|
||||||
m_download(d),
|
m_download(d),
|
||||||
m_window(NULL),
|
m_window(NULL),
|
||||||
m_focus(0) {
|
m_focus(0) {
|
||||||
|
|
||||||
m_bindings[KEY_DOWN] = sigc::mem_fun(*this, &TrackerList::receive_next);
|
m_bindings[KEY_DOWN] = sigc::mem_fun(*this, &ElementTrackerList::receive_next);
|
||||||
m_bindings[KEY_UP] = sigc::mem_fun(*this, &TrackerList::receive_prev);
|
m_bindings[KEY_UP] = sigc::mem_fun(*this, &ElementTrackerList::receive_prev);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackerList::activate(Control* c, MItr mItr) {
|
ElementTrackerList::activate(Control* c, MItr mItr) {
|
||||||
if (m_window != NULL)
|
if (m_window != NULL)
|
||||||
throw std::logic_error("ui::TrackerList::activate(...) called on an object in the wrong state");
|
throw std::logic_error("ui::ElementTrackerList::activate(...) called on an object in the wrong state");
|
||||||
|
|
||||||
c->get_input().push_front(&m_bindings);
|
c->get_input().push_front(&m_bindings);
|
||||||
|
|
||||||
@@ -51,9 +51,9 @@ TrackerList::activate(Control* c, MItr mItr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackerList::disable(Control* c) {
|
ElementTrackerList::disable(Control* c) {
|
||||||
if (m_window == NULL)
|
if (m_window == NULL)
|
||||||
throw std::logic_error("ui::TrackerList::disable(...) called on an object in the wrong state");
|
throw std::logic_error("ui::ElementTrackerList::disable(...) called on an object in the wrong state");
|
||||||
|
|
||||||
c->get_input().erase(&m_bindings);
|
c->get_input().erase(&m_bindings);
|
||||||
|
|
||||||
@@ -62,9 +62,9 @@ TrackerList::disable(Control* c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackerList::receive_next() {
|
ElementTrackerList::receive_next() {
|
||||||
if (m_window == NULL)
|
if (m_window == NULL)
|
||||||
throw std::logic_error("ui::TrackerList::receive_next(...) called on a disabled object");
|
throw std::logic_error("ui::ElementTrackerList::receive_next(...) called on a disabled object");
|
||||||
|
|
||||||
if (++m_focus >= m_download->get_download().get_tracker_size())
|
if (++m_focus >= m_download->get_download().get_tracker_size())
|
||||||
m_focus = 0;
|
m_focus = 0;
|
||||||
@@ -73,9 +73,9 @@ TrackerList::receive_next() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackerList::receive_prev() {
|
ElementTrackerList::receive_prev() {
|
||||||
if (m_window == NULL)
|
if (m_window == NULL)
|
||||||
throw std::logic_error("ui::TrackerList::receive_prev(...) called on a disabled object");
|
throw std::logic_error("ui::ElementTrackerList::receive_prev(...) called on a disabled object");
|
||||||
|
|
||||||
if (m_download->get_download().get_tracker_size() == 0)
|
if (m_download->get_download().get_tracker_size() == 0)
|
||||||
return;
|
return;
|
||||||
@@ -20,12 +20,12 @@
|
|||||||
// Skomakerveien 33
|
// Skomakerveien 33
|
||||||
// 3185 Skoppum, NORWAY
|
// 3185 Skoppum, NORWAY
|
||||||
|
|
||||||
#ifndef RTORRENT_UI_TRACKER_LIST_H
|
#ifndef RTORRENT_UI_ELEMENT_TRACKER_LIST_H
|
||||||
#define RTORRENT_UI_TRACKER_LIST_H
|
#define RTORRENT_UI_ELEMENT_TRACKER_LIST_H
|
||||||
|
|
||||||
#include "core/download.h"
|
#include "core/download.h"
|
||||||
|
|
||||||
#include "base_element.h"
|
#include "element_base.h"
|
||||||
|
|
||||||
namespace display {
|
namespace display {
|
||||||
class WindowTrackerList;
|
class WindowTrackerList;
|
||||||
@@ -35,11 +35,11 @@ namespace ui {
|
|||||||
|
|
||||||
class Control;
|
class Control;
|
||||||
|
|
||||||
class TrackerList : public BaseElement {
|
class ElementTrackerList : public ElementBase {
|
||||||
public:
|
public:
|
||||||
typedef display::WindowTrackerList WTrackerList;
|
typedef display::WindowTrackerList WTrackerList;
|
||||||
|
|
||||||
TrackerList(core::Download* d);
|
ElementTrackerList(core::Download* d);
|
||||||
|
|
||||||
void activate(Control* c, MItr mItr);
|
void activate(Control* c, MItr mItr);
|
||||||
void disable(Control* c);
|
void disable(Control* c);
|
||||||
Reference in New Issue
Block a user