Hooked the input to the torrent loader.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@274 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2005-02-14 18:24:21 +00:00
parent 73b1c58f4c
commit 1f58b0074b
6 changed files with 51 additions and 28 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
AC_INIT(rtorrent, 0.0.0, jaris@ifi.uio.no)
AC_INIT(rtorrent, 0.0.1, jaris@ifi.uio.no)
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)
@@ -39,7 +39,7 @@ TORRENT_CHECK_EXECINFO()
TORRENT_CHECK_CURL()
TORRENT_OTFD()
PKG_CHECK_MODULES(STUFF, sigc++-2.0 libtorrent >= 0.4.8,
PKG_CHECK_MODULES(STUFF, sigc++-2.0 libtorrent >= 0.4.9,
CXXFLAGS="$CXXFLAGS $STUFF_CFLAGS $CURL_CFLAGS";
LIBS="$LIBS $STUFF_LIBS $CURL_LIBS")
+26 -16
View File
@@ -9,13 +9,19 @@ namespace input {
bool
TextInput::pressed(int key) {
// std::stringstream str;
if (m_alt) {
m_alt = false;
switch (key) {
case 'p':
Base::insert(m_pos, "M^p");
break;
// case 'b':
// Base::insert(m_pos, "M^b");
// break;
// case 'f':
// Base::insert(m_pos, "M^f");
// break;
default:
return false;
@@ -52,8 +58,25 @@ TextInput::pressed(int key) {
break;
case 0x1B:
m_alt = true;
break;
default:
return false;
// Testcode.
// if (key == KEY_ENTER || key == '\n')
// return false;
// str << "\\x" << std::hex << key;
// Base::insert(m_pos, str.str());
// m_pos += str.str().length();
// return true;
}
}
@@ -61,19 +84,6 @@ TextInput::pressed(int key) {
return true;
// Testcode.
// if (key == KEY_ENTER || key == '\n')
// return false;
// std::stringstream str;
// str << "\\x" << std::hex << key;
// Base::insert(m_pos, str.str());
// m_pos += str.str().length();
// return true;
}
}
+5 -3
View File
@@ -17,13 +17,15 @@ public:
TextInput() : m_pos(0), m_alt(false) {}
size_type get_pos() { return m_pos; }
size_type get_pos() { return m_pos; }
bool pressed(int key);
void clear() { m_pos = 0; m_alt = false; Base::clear(); }
void clear() { m_pos = 0; m_alt = false; Base::clear(); }
void slot_dirty(SlotDirty s) { m_slotDirty = s; }
void slot_dirty(SlotDirty s) { m_slotDirty = s; }
const std::string& str() { return *this; }
private:
size_type m_pos;
+1
View File
@@ -110,6 +110,7 @@ main(int argc, char** argv) {
ui::DownloadList uiDownloadList(&coreManager.get_download_list(), &uiControl);
uiDownloadList.activate();
uiDownloadList.slot_open_uri(sigc::mem_fun(coreManager, &core::Manager::insert));
// Register main key events.
input::Bindings inputMain;
+2
View File
@@ -133,6 +133,8 @@ void
DownloadList::receive_exit_input() {
m_control->get_input().set_text_input();
m_slotOpenUri(m_windowInput->get_input()->str());
m_windowInput->get_input()->clear();
m_windowInput->set_focus(false);
+15 -7
View File
@@ -1,6 +1,8 @@
#ifndef RTORRENT_UI_DOWNLOAD_LIST_H
#define RTORRENT_UI_DOWNLOAD_LIST_H
#include <sigc++/slot.h>
namespace display {
class WindowTitle;
class WindowDownloadList;
@@ -15,22 +17,26 @@ class Download;
class DownloadList {
public:
typedef display::WindowDownloadList WList;
typedef display::WindowTitle WTitle;
typedef display::WindowStatusbar WStatus;
typedef display::WindowInput WInput;
typedef core::DownloadList DList;
typedef display::WindowDownloadList WList;
typedef display::WindowTitle WTitle;
typedef display::WindowStatusbar WStatus;
typedef display::WindowInput WInput;
typedef core::DownloadList DList;
typedef sigc::slot1<void, const std::string&> SlotOpenUri;
// We own 'window'.
DownloadList(DList* l, Control* c);
~DownloadList();
WList& get_window() { return *m_window; }
input::Bindings& get_bindings() { return *m_bindings; }
WList& get_window() { return *m_window; }
input::Bindings& get_bindings() { return *m_bindings; }
void activate();
void disable();
void slot_open_uri(SlotOpenUri s) { m_slotOpenUri = s; }
private:
DownloadList(const DownloadList&);
void operator = (const DownloadList&);
@@ -62,6 +68,8 @@ private:
Control* m_control;
input::Bindings* m_bindings;
SlotOpenUri m_slotOpenUri;
// Test
WInput* m_windowInput;
};