mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-14 13:16:17 +00:00
* UI refactoring, added display::Frame and started cleaning up the
code. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@747 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+156
-163
@@ -36,7 +36,6 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdexcept>
|
||||
#include <rak/functional.h>
|
||||
#include <rak/string_manip.h>
|
||||
#include <sigc++/bind.h>
|
||||
@@ -54,8 +53,6 @@
|
||||
#include "input/manager.h"
|
||||
#include "input/path_input.h"
|
||||
|
||||
#include "display/window_http_queue.h"
|
||||
#include "display/window_input.h"
|
||||
#include "display/window_log.h"
|
||||
#include "display/window_title.h"
|
||||
#include "display/window_statusbar.h"
|
||||
@@ -70,22 +67,16 @@
|
||||
|
||||
namespace ui {
|
||||
|
||||
DownloadList::DownloadList(Control* c) :
|
||||
m_state(DISPLAY_MAX_SIZE),
|
||||
DownloadList::DownloadList() :
|
||||
m_state(DISPLAY_NONE),
|
||||
|
||||
m_window(c->display()->end()),
|
||||
m_uiDownload(NULL) {
|
||||
|
||||
m_windowTitle(new WTitle("rTorrent " VERSION " - libTorrent " + std::string(torrent::version()))),
|
||||
m_windowHttpQueue(new WHttp(c->core()->http_queue())),
|
||||
|
||||
m_uiDownload(NULL),
|
||||
|
||||
m_control(c),
|
||||
m_bindings(new input::Bindings)
|
||||
{
|
||||
m_uiArray[DISPLAY_DOWNLOAD_LIST] = new ElementDownloadList();
|
||||
m_uiArray[DISPLAY_LOG] = new ElementLogComplete(&m_control->core()->get_log_complete());
|
||||
m_windowLog = new WLog(&m_control->core()->get_log_important());
|
||||
m_uiArray[DISPLAY_LOG] = new ElementLogComplete(&control->core()->get_log_complete());
|
||||
m_uiArray[DISPLAY_STRING_LIST] = new ElementStringList();
|
||||
|
||||
m_windowLog = new WLog(&control->core()->get_log_important());
|
||||
|
||||
receive_change_view("main");
|
||||
|
||||
@@ -95,7 +86,6 @@ DownloadList::DownloadList(Control* c) :
|
||||
m_taskUpdate.set_slot(rak::mem_fn(this, &DownloadList::task_update)),
|
||||
|
||||
setup_keys();
|
||||
setup_input();
|
||||
}
|
||||
|
||||
DownloadList::~DownloadList() {
|
||||
@@ -104,33 +94,20 @@ DownloadList::~DownloadList() {
|
||||
|
||||
std::for_each(m_uiArray, m_uiArray + DISPLAY_MAX_SIZE, rak::call_delete<ElementBase>());
|
||||
|
||||
delete m_windowTitle;
|
||||
delete m_bindings;
|
||||
|
||||
delete m_windowLog;
|
||||
delete m_windowTextInput->get_input();
|
||||
delete m_windowTextInput;
|
||||
delete m_windowHttpQueue;
|
||||
}
|
||||
|
||||
void
|
||||
DownloadList::activate() {
|
||||
DownloadList::activate(display::Frame* frame) {
|
||||
if (is_active())
|
||||
throw std::logic_error("ui::Download::activate() called on an already activated object");
|
||||
throw torrent::client_error("ui::DownloadList::activate() called on an already activated object");
|
||||
|
||||
priority_queue_insert(&taskScheduler, &m_taskUpdate, cachedTime);
|
||||
|
||||
m_windowTextInput->set_active(false);
|
||||
m_frame = frame;
|
||||
|
||||
m_control->display()->push_front(m_windowTextInput);
|
||||
m_control->display()->push_front(m_windowHttpQueue);
|
||||
m_control->display()->push_front(m_windowLog);
|
||||
m_window = m_control->display()->insert(m_control->display()->begin(), NULL);
|
||||
m_control->display()->push_front(m_windowTitle);
|
||||
|
||||
m_control->input()->push_front(m_bindings);
|
||||
|
||||
m_control->core()->download_list()->slot_map_erase()["0_download_list"] = sigc::mem_fun(this, &DownloadList::receive_download_erased);
|
||||
control->input()->push_front(&m_bindings);
|
||||
control->core()->download_list()->slot_map_erase()["0_download_list"] = sigc::mem_fun(this, &DownloadList::receive_download_erased);
|
||||
|
||||
activate_display(DISPLAY_DOWNLOAD_LIST);
|
||||
}
|
||||
@@ -138,49 +115,74 @@ DownloadList::activate() {
|
||||
void
|
||||
DownloadList::disable() {
|
||||
if (!is_active())
|
||||
throw std::logic_error("ui::Download::disable() called on an already disabled object");
|
||||
throw std::logic_error("ui::DownloadList::disable() called on an already disabled object");
|
||||
|
||||
if (m_windowTextInput->is_active()) {
|
||||
m_windowTextInput->get_input()->clear();
|
||||
receive_exit_input(INPUT_NONE);
|
||||
}
|
||||
// if (m_windowTextInput->is_active()) {
|
||||
// m_windowTextInput->get_input()->clear();
|
||||
// receive_exit_input(INPUT_NONE);
|
||||
// }
|
||||
|
||||
disable_display();
|
||||
activate_display(DISPLAY_NONE);
|
||||
|
||||
m_frame = NULL;
|
||||
|
||||
priority_queue_erase(&taskScheduler, &m_taskUpdate);
|
||||
|
||||
m_control->display()->erase(m_window);
|
||||
m_control->display()->erase(m_windowTitle);
|
||||
m_control->display()->erase(m_windowTextInput);
|
||||
m_control->display()->erase(m_windowLog);
|
||||
m_control->display()->erase(m_windowHttpQueue);
|
||||
|
||||
m_window = m_control->display()->end();
|
||||
|
||||
m_control->input()->erase(m_bindings);
|
||||
control->input()->erase(&m_bindings);
|
||||
}
|
||||
|
||||
void
|
||||
DownloadList::activate_display(Display d) {
|
||||
DownloadList::activate_display(Display displayType) {
|
||||
if (!is_active())
|
||||
throw std::logic_error("ui::DownloadList::activate_display(...) could not find previous display iterator");
|
||||
throw std::logic_error("ui::DownloadList::activate_display(...) !is_active().");
|
||||
|
||||
if (d >= DISPLAY_MAX_SIZE)
|
||||
if (displayType >= DISPLAY_MAX_SIZE)
|
||||
throw std::logic_error("ui::DownloadList::activate_display(...) out of bounds");
|
||||
|
||||
m_state = d;
|
||||
m_uiArray[d]->activate(m_control, m_window);
|
||||
if (displayType == m_state)
|
||||
return;
|
||||
|
||||
m_control->display()->adjust_layout();
|
||||
// Don't use default.
|
||||
|
||||
// Cleanup previous state.
|
||||
switch (m_state) {
|
||||
case DISPLAY_DOWNLOAD_LIST:
|
||||
case DISPLAY_LOG:
|
||||
m_uiArray[m_state]->disable();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
m_state = displayType;
|
||||
|
||||
// Initialize new state.
|
||||
switch (displayType) {
|
||||
case DISPLAY_NONE:
|
||||
break;
|
||||
|
||||
case DISPLAY_DOWNLOAD_LIST:
|
||||
control->ui()->window_title()->set_title("rTorrent " VERSION " - libTorrent " + std::string(torrent::version()));
|
||||
|
||||
m_uiArray[displayType]->activate(m_frame);
|
||||
break;
|
||||
|
||||
case DISPLAY_LOG:
|
||||
control->ui()->window_title()->set_title("Log");
|
||||
|
||||
m_uiArray[displayType]->activate(m_frame);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
control->display()->adjust_layout();
|
||||
}
|
||||
|
||||
// Does not delete disabled window.
|
||||
void
|
||||
DownloadList::disable_display() {
|
||||
m_uiArray[m_state]->disable(m_control);
|
||||
|
||||
m_state = DISPLAY_MAX_SIZE;
|
||||
*m_window = NULL;
|
||||
display::Window*
|
||||
DownloadList::window() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -200,7 +202,7 @@ DownloadList::receive_start_download() {
|
||||
if (m_view->focus() == m_view->end_visible())
|
||||
return;
|
||||
|
||||
m_control->core()->download_list()->start_normal(*m_view->focus());
|
||||
control->core()->download_list()->start_normal(*m_view->focus());
|
||||
m_view->set_last_changed();
|
||||
}
|
||||
|
||||
@@ -210,9 +212,9 @@ DownloadList::receive_stop_download() {
|
||||
return;
|
||||
|
||||
if ((*m_view->focus())->variable()->get_value("state") == 1)
|
||||
m_control->core()->download_list()->stop_normal(*m_view->focus());
|
||||
control->core()->download_list()->stop_normal(*m_view->focus());
|
||||
else
|
||||
m_control->core()->download_list()->erase(*m_view->focus());
|
||||
control->core()->download_list()->erase(*m_view->focus());
|
||||
|
||||
m_view->set_last_changed();
|
||||
}
|
||||
@@ -222,8 +224,8 @@ DownloadList::receive_close_download() {
|
||||
if (m_view->focus() == m_view->end_visible())
|
||||
return;
|
||||
|
||||
m_control->core()->download_list()->stop_normal(*m_view->focus());
|
||||
m_control->core()->download_list()->close(*m_view->focus());
|
||||
control->core()->download_list()->stop_normal(*m_view->focus());
|
||||
control->core()->download_list()->close(*m_view->focus());
|
||||
m_view->set_last_changed();
|
||||
}
|
||||
|
||||
@@ -237,7 +239,7 @@ DownloadList::receive_view_download() {
|
||||
|
||||
disable();
|
||||
|
||||
m_uiDownload = new Download(*m_view->focus(), m_control);
|
||||
m_uiDownload = new Download(*m_view->focus(), control);
|
||||
|
||||
m_uiDownload->activate();
|
||||
m_uiDownload->get_bindings()[KEY_LEFT] = sigc::mem_fun(*this, &DownloadList::receive_exit_download);
|
||||
@@ -253,9 +255,9 @@ DownloadList::receive_exit_download() {
|
||||
m_uiDownload = NULL;
|
||||
|
||||
m_view->set_last_changed();
|
||||
activate();
|
||||
activate(m_frame);
|
||||
|
||||
m_control->display()->adjust_layout();
|
||||
control->display()->adjust_layout();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -264,7 +266,7 @@ DownloadList::receive_next_priority() {
|
||||
return;
|
||||
|
||||
(*m_view->focus())->set_priority(((*m_view->focus())->priority() + 1) % 4);
|
||||
(*m_window)->mark_dirty();
|
||||
// (*m_window)->mark_dirty();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -273,7 +275,7 @@ DownloadList::receive_prev_priority() {
|
||||
return;
|
||||
|
||||
(*m_view->focus())->set_priority(((*m_view->focus())->priority() - 1) % 4);
|
||||
(*m_window)->mark_dirty();
|
||||
// (*m_window)->mark_dirty();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -282,7 +284,7 @@ DownloadList::receive_check_hash() {
|
||||
return;
|
||||
|
||||
// Catch here?
|
||||
m_control->core()->download_list()->check_hash(*m_view->focus());
|
||||
control->core()->download_list()->check_hash(*m_view->focus());
|
||||
}
|
||||
|
||||
void
|
||||
@@ -292,10 +294,10 @@ DownloadList::receive_ignore_ratio() {
|
||||
|
||||
if ((*m_view->focus())->variable()->get_value("ignore_commands") != 0) {
|
||||
(*m_view->focus())->variable()->set("ignore_commands", (int64_t)0);
|
||||
m_control->core()->push_log("Torrent set to heed commands.");
|
||||
control->core()->push_log("Torrent set to heed commands.");
|
||||
} else {
|
||||
(*m_view->focus())->variable()->set("ignore_commands", (int64_t)1);
|
||||
m_control->core()->push_log("Torrent set to ignore commands");
|
||||
control->core()->push_log("Torrent set to ignore commands.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,44 +310,56 @@ DownloadList::receive_clear_tied() {
|
||||
|
||||
if (!tiedFile.empty()) {
|
||||
// Move this into core?
|
||||
m_control->core()->delete_tied(*m_view->focus());
|
||||
control->core()->delete_tied(*m_view->focus());
|
||||
|
||||
m_control->core()->push_log("Cleared tied to file association for download.");
|
||||
control->core()->push_log("Cleared tied to file association for download.");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DownloadList::receive_view_input(Input type) {
|
||||
if (m_windowTextInput->get_active())
|
||||
if (control->ui()->current_input() != NULL)
|
||||
return;
|
||||
|
||||
m_control->ui()->window_statusbar()->set_active(false);
|
||||
m_windowTextInput->set_active(true);
|
||||
m_control->display()->adjust_layout();
|
||||
input::PathInput* input = new input::PathInput;
|
||||
|
||||
m_control->input()->set_text_input(m_windowTextInput->get_input());
|
||||
switch (type) {
|
||||
case INPUT_CHANGE_DIRECTORY:
|
||||
input->str() = control->variable()->get_string("directory");
|
||||
input->set_pos(input->str().length());
|
||||
|
||||
m_windowTextInput->set_focus(true);
|
||||
break;
|
||||
|
||||
if (type == INPUT_CHANGE_DIRECTORY) {
|
||||
m_windowTextInput->get_input()->str() = m_control->variable()->get_string("directory");
|
||||
m_windowTextInput->get_input()->set_pos(m_windowTextInput->get_input()->str().length());
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
(*m_bindings)['\n'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_exit_input), type);
|
||||
(*m_bindings)[KEY_ENTER] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_exit_input), type);
|
||||
(*m_bindings)['\x07'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_exit_input), INPUT_NONE);
|
||||
control->ui()->enable_input(input);
|
||||
|
||||
// These bindings should be moved to f.ex TextInput?
|
||||
m_bindings['\n'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_exit_input), type);
|
||||
m_bindings[KEY_ENTER] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_exit_input), type);
|
||||
m_bindings['\x07'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_exit_input), INPUT_NONE);
|
||||
}
|
||||
|
||||
void
|
||||
DownloadList::receive_exit_input(Input type) {
|
||||
if (!m_windowTextInput->get_active())
|
||||
input::TextInput* input = control->ui()->current_input();
|
||||
|
||||
// We should check that this object is the one holding the input.
|
||||
if (input == NULL)
|
||||
return;
|
||||
|
||||
m_control->ui()->window_statusbar()->set_active(true);
|
||||
m_windowTextInput->set_active(false);
|
||||
m_control->input()->set_text_input();
|
||||
|
||||
control->ui()->disable_input();
|
||||
|
||||
// Urgh... this is ugly...
|
||||
m_bindings.erase('\n');
|
||||
m_bindings.erase(KEY_ENTER);
|
||||
m_bindings.erase('\x07');
|
||||
|
||||
m_bindings['\n'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), INPUT_LOAD_MODIFIED);
|
||||
m_bindings[KEY_ENTER] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), INPUT_LOAD_MODIFIED);
|
||||
|
||||
try {
|
||||
|
||||
switch (type) {
|
||||
@@ -354,47 +368,27 @@ DownloadList::receive_exit_input(Input type) {
|
||||
|
||||
case INPUT_LOAD_DEFAULT:
|
||||
case INPUT_LOAD_MODIFIED:
|
||||
m_control->core()->try_create_download_expand(m_windowTextInput->get_input()->str(), type == INPUT_LOAD_DEFAULT);
|
||||
control->core()->try_create_download_expand(input->str(), type == INPUT_LOAD_DEFAULT);
|
||||
break;
|
||||
|
||||
case INPUT_CHANGE_DIRECTORY:
|
||||
if (m_view->focus() == m_view->end_visible())
|
||||
throw torrent::input_error("No download in focus to change root directory.");
|
||||
|
||||
(*m_view->focus())->variable()->set("directory", rak::trim(m_windowTextInput->get_input()->str()));
|
||||
m_control->core()->push_log("New root dir \"" + (*m_view->focus())->variable()->get_string("directory") + "\" for torrent.");
|
||||
(*m_view->focus())->variable()->set("directory", rak::trim(input->str()));
|
||||
control->core()->push_log("New root directory \"" + (*m_view->focus())->variable()->get_string("directory") + "\" for torrent.");
|
||||
break;
|
||||
|
||||
case INPUT_COMMAND:
|
||||
m_control->variable()->process_command(m_windowTextInput->get_input()->str());
|
||||
control->variable()->process_command(input->str());
|
||||
break;
|
||||
}
|
||||
|
||||
} catch (torrent::input_error& e) {
|
||||
m_control->core()->push_log(e.what());
|
||||
control->core()->push_log(e.what());
|
||||
}
|
||||
|
||||
// Clean up.
|
||||
m_windowTextInput->get_input()->clear();
|
||||
m_windowTextInput->set_focus(false);
|
||||
|
||||
m_bindings->erase('\n');
|
||||
m_bindings->erase(KEY_ENTER);
|
||||
|
||||
// Urgh... this is ugly...
|
||||
(*m_bindings)['\n'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), INPUT_LOAD_MODIFIED);
|
||||
(*m_bindings)[KEY_ENTER] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), INPUT_LOAD_MODIFIED);
|
||||
|
||||
receive_change(DISPLAY_DOWNLOAD_LIST);
|
||||
}
|
||||
|
||||
void
|
||||
DownloadList::receive_change(Display d) {
|
||||
if (d == m_state)
|
||||
return;
|
||||
|
||||
disable_display();
|
||||
activate_display(d);
|
||||
delete input;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -410,10 +404,10 @@ DownloadList::receive_download_erased(core::Download* d) {
|
||||
|
||||
void
|
||||
DownloadList::receive_change_view(const std::string& name) {
|
||||
core::ViewManager::iterator itr = m_control->view_manager()->find(name);
|
||||
core::ViewManager::iterator itr = control->view_manager()->find(name);
|
||||
|
||||
if (itr == m_control->view_manager()->end()) {
|
||||
m_control->core()->push_log("Could not find view \"" + name + "\".");
|
||||
if (itr == control->view_manager()->end()) {
|
||||
control->core()->push_log("Could not find view \"" + name + "\".");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -437,53 +431,52 @@ DownloadList::task_update() {
|
||||
|
||||
void
|
||||
DownloadList::setup_keys() {
|
||||
(*m_bindings)['\x13'] = sigc::mem_fun(*this, &DownloadList::receive_start_download);
|
||||
(*m_bindings)['\x04'] = sigc::mem_fun(*this, &DownloadList::receive_stop_download);
|
||||
(*m_bindings)['\x0B'] = sigc::mem_fun(*this, &DownloadList::receive_close_download);
|
||||
(*m_bindings)['\x12'] = sigc::mem_fun(*this, &DownloadList::receive_check_hash);
|
||||
(*m_bindings)['+'] = sigc::mem_fun(*this, &DownloadList::receive_next_priority);
|
||||
(*m_bindings)['-'] = sigc::mem_fun(*this, &DownloadList::receive_prev_priority);
|
||||
(*m_bindings)['I'] = sigc::mem_fun(*this, &DownloadList::receive_ignore_ratio);
|
||||
(*m_bindings)['U'] = sigc::mem_fun(*this, &DownloadList::receive_clear_tied);
|
||||
m_bindings['\x13'] = sigc::mem_fun(*this, &DownloadList::receive_start_download);
|
||||
m_bindings['\x04'] = sigc::mem_fun(*this, &DownloadList::receive_stop_download);
|
||||
m_bindings['\x0B'] = sigc::mem_fun(*this, &DownloadList::receive_close_download);
|
||||
m_bindings['\x12'] = sigc::mem_fun(*this, &DownloadList::receive_check_hash);
|
||||
m_bindings['+'] = sigc::mem_fun(*this, &DownloadList::receive_next_priority);
|
||||
m_bindings['-'] = sigc::mem_fun(*this, &DownloadList::receive_prev_priority);
|
||||
m_bindings['I'] = sigc::mem_fun(*this, &DownloadList::receive_ignore_ratio);
|
||||
m_bindings['U'] = sigc::mem_fun(*this, &DownloadList::receive_clear_tied);
|
||||
|
||||
(*m_bindings)['\x7f'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), INPUT_LOAD_DEFAULT);
|
||||
(*m_bindings)[KEY_BACKSPACE] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), INPUT_LOAD_DEFAULT);
|
||||
(*m_bindings)['\n'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), INPUT_LOAD_MODIFIED);
|
||||
(*m_bindings)[KEY_ENTER] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), INPUT_LOAD_MODIFIED);
|
||||
(*m_bindings)['\x0F'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), INPUT_CHANGE_DIRECTORY);
|
||||
(*m_bindings)['\x10'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), INPUT_COMMAND);
|
||||
m_bindings['\x7f'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), INPUT_LOAD_DEFAULT);
|
||||
m_bindings[KEY_BACKSPACE] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), INPUT_LOAD_DEFAULT);
|
||||
m_bindings['\n'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), INPUT_LOAD_MODIFIED);
|
||||
m_bindings[KEY_ENTER] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), INPUT_LOAD_MODIFIED);
|
||||
m_bindings['\x0F'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), INPUT_CHANGE_DIRECTORY);
|
||||
m_bindings['\x10'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), INPUT_COMMAND);
|
||||
|
||||
(*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)['l'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_change), DISPLAY_LOG);
|
||||
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['l'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::activate_display), DISPLAY_LOG);
|
||||
|
||||
(*m_bindings)['1'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_change_view), "main");
|
||||
(*m_bindings)['2'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_change_view), "name");
|
||||
(*m_bindings)['3'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_change_view), "started");
|
||||
(*m_bindings)['4'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_change_view), "stopped");
|
||||
(*m_bindings)['5'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_change_view), "complete");
|
||||
(*m_bindings)['6'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_change_view), "incomplete");
|
||||
(*m_bindings)['7'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_change_view), "hashing");
|
||||
m_bindings['1'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_change_view), "main");
|
||||
m_bindings['2'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_change_view), "name");
|
||||
m_bindings['3'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_change_view), "started");
|
||||
m_bindings['4'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_change_view), "stopped");
|
||||
m_bindings['5'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_change_view), "complete");
|
||||
m_bindings['6'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_change_view), "incomplete");
|
||||
m_bindings['7'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_change_view), "hashing");
|
||||
|
||||
m_uiArray[DISPLAY_LOG]->get_bindings()[' '] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_change), DISPLAY_DOWNLOAD_LIST);
|
||||
m_uiArray[DISPLAY_LOG]->bindings()[' '] = sigc::bind(sigc::mem_fun(*this, &DownloadList::activate_display), DISPLAY_DOWNLOAD_LIST);
|
||||
m_uiArray[DISPLAY_LOG]->bindings()[KEY_RIGHT] = sigc::bind(sigc::mem_fun(*this, &DownloadList::activate_display), DISPLAY_DOWNLOAD_LIST);
|
||||
}
|
||||
|
||||
void
|
||||
DownloadList::setup_input() {
|
||||
input::PathInput* p = new input::PathInput;
|
||||
ElementStringList* esl = new ElementStringList();
|
||||
m_windowTextInput = new WInput(p);
|
||||
// void
|
||||
// DownloadList::setup_input() {
|
||||
// input::PathInput* p = new input::PathInput;
|
||||
// m_windowTextInput = new WInput(p);
|
||||
|
||||
p->slot_dirty(sigc::mem_fun(*m_windowTextInput, &WInput::mark_dirty));
|
||||
// p->slot_dirty(sigc::mem_fun(*m_windowTextInput, &WInput::mark_dirty));
|
||||
|
||||
p->signal_show_next().connect(sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_change), DISPLAY_STRING_LIST));
|
||||
p->signal_show_next().connect(sigc::mem_fun(*esl, &ElementStringList::next_screen));
|
||||
// p->signal_show_next().connect(sigc::bind(sigc::mem_fun(*this, &DownloadList::activate_display), DISPLAY_STRING_LIST));
|
||||
// p->signal_show_next().connect(sigc::mem_fun(*esl, &ElementStringList::next_screen));
|
||||
|
||||
p->signal_show_range().connect(sigc::hide(sigc::hide(sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_change), DISPLAY_STRING_LIST))));
|
||||
p->signal_show_range().connect(sigc::mem_fun(*esl, &ElementStringList::set_range<utils::Directory::iterator>));
|
||||
// p->signal_show_range().connect(sigc::hide(sigc::hide(sigc::bind(sigc::mem_fun(*this, &DownloadList::activate_display), DISPLAY_STRING_LIST))));
|
||||
// p->signal_show_range().connect(sigc::mem_fun(*esl, &ElementStringList::set_range<utils::Directory::iterator>));
|
||||
|
||||
m_uiArray[DISPLAY_STRING_LIST] = esl;
|
||||
}
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user