Converted sigc++ slots to std::tr1::function.

This commit is contained in:
rakshasa
2013-08-24 00:14:25 +09:00
parent 629ebcbd54
commit 529eda5aab
39 changed files with 267 additions and 290 deletions
+51 -52
View File
@@ -36,7 +36,6 @@
#include "config.h"
#include <sigc++/adaptors/bind.h>
#include <rak/functional.h>
#include <rak/string_manip.h>
#include <torrent/exceptions.h>
@@ -85,13 +84,13 @@ Download::Download(core::Download* d) :
m_uiArray[DISPLAY_CHUNKS_SEEN] = new ElementChunksSeen(d);
m_uiArray[DISPLAY_TRANSFER_LIST] = new ElementTransferList(d);
m_uiArray[DISPLAY_MENU]->slot_exit(sigc::mem_fun(&m_slotExit, &slot_type::operator()));
m_uiArray[DISPLAY_PEER_LIST]->slot_exit(sigc::bind(sigc::mem_fun(this, &Download::activate_display_menu), DISPLAY_PEER_LIST));
m_uiArray[DISPLAY_INFO]->slot_exit(sigc::bind(sigc::mem_fun(this, &Download::activate_display_menu), DISPLAY_INFO));
m_uiArray[DISPLAY_FILE_LIST]->slot_exit(sigc::bind(sigc::mem_fun(this, &Download::activate_display_menu), DISPLAY_FILE_LIST));
m_uiArray[DISPLAY_TRACKER_LIST]->slot_exit(sigc::bind(sigc::mem_fun(this, &Download::activate_display_menu), DISPLAY_TRACKER_LIST));
m_uiArray[DISPLAY_CHUNKS_SEEN]->slot_exit(sigc::bind(sigc::mem_fun(this, &Download::activate_display_menu), DISPLAY_CHUNKS_SEEN));
m_uiArray[DISPLAY_TRANSFER_LIST]->slot_exit(sigc::bind(sigc::mem_fun(this, &Download::activate_display_menu), DISPLAY_TRANSFER_LIST));
m_uiArray[DISPLAY_MENU]->slot_exit(std::tr1::bind(&slot_type::operator(), &m_slot_exit));
m_uiArray[DISPLAY_PEER_LIST]->slot_exit(std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_PEER_LIST));
m_uiArray[DISPLAY_INFO]->slot_exit(std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_INFO));
m_uiArray[DISPLAY_FILE_LIST]->slot_exit(std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_FILE_LIST));
m_uiArray[DISPLAY_TRACKER_LIST]->slot_exit(std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_TRACKER_LIST));
m_uiArray[DISPLAY_CHUNKS_SEEN]->slot_exit(std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_CHUNKS_SEEN));
m_uiArray[DISPLAY_TRANSFER_LIST]->slot_exit(std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_TRANSFER_LIST));
bind_keys();
}
@@ -110,30 +109,30 @@ Download::create_menu() {
ElementMenu* element = new ElementMenu;
element->push_back("Peer list",
sigc::bind(sigc::mem_fun(this, &Download::activate_display_focus), DISPLAY_PEER_LIST),
sigc::bind(sigc::mem_fun(this, &Download::activate_display_menu), DISPLAY_PEER_LIST));
std::tr1::bind(&Download::activate_display_focus, this, DISPLAY_PEER_LIST),
std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_PEER_LIST));
element->push_back("Info",
sigc::bind(sigc::mem_fun(this, &Download::activate_display_focus), DISPLAY_INFO),
sigc::bind(sigc::mem_fun(this, &Download::activate_display_menu), DISPLAY_INFO));
std::tr1::bind(&Download::activate_display_focus, this, DISPLAY_INFO),
std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_INFO));
element->push_back("File list",
sigc::bind(sigc::mem_fun(this, &Download::activate_display_focus), DISPLAY_FILE_LIST),
sigc::bind(sigc::mem_fun(this, &Download::activate_display_menu), DISPLAY_FILE_LIST));
std::tr1::bind(&Download::activate_display_focus, this, DISPLAY_FILE_LIST),
std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_FILE_LIST));
element->push_back("Tracker list",
sigc::bind(sigc::mem_fun(this, &Download::activate_display_focus), DISPLAY_TRACKER_LIST),
sigc::bind(sigc::mem_fun(this, &Download::activate_display_menu), DISPLAY_TRACKER_LIST));
std::tr1::bind(&Download::activate_display_focus, this, DISPLAY_TRACKER_LIST),
std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_TRACKER_LIST));
element->push_back("Chunks seen",
sigc::bind(sigc::mem_fun(this, &Download::activate_display_focus), DISPLAY_CHUNKS_SEEN),
sigc::bind(sigc::mem_fun(this, &Download::activate_display_menu), DISPLAY_CHUNKS_SEEN));
std::tr1::bind(&Download::activate_display_focus, this, DISPLAY_CHUNKS_SEEN),
std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_CHUNKS_SEEN));
element->push_back("Transfer list",
sigc::bind(sigc::mem_fun(this, &Download::activate_display_focus), DISPLAY_TRANSFER_LIST),
sigc::bind(sigc::mem_fun(this, &Download::activate_display_menu), DISPLAY_TRANSFER_LIST));
std::tr1::bind(&Download::activate_display_focus, this, DISPLAY_TRANSFER_LIST),
std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_TRANSFER_LIST));
element->set_entry(0, false);
m_bindings['p'] = sigc::bind(sigc::mem_fun(element, &ElementMenu::set_entry_trigger), 0);
m_bindings['o'] = sigc::bind(sigc::mem_fun(element, &ElementMenu::set_entry_trigger), 1);
m_bindings['i'] = sigc::bind(sigc::mem_fun(element, &ElementMenu::set_entry_trigger), 2);
m_bindings['u'] = sigc::bind(sigc::mem_fun(element, &ElementMenu::set_entry_trigger), 3);
m_bindings['p'] = std::tr1::bind(&ElementMenu::set_entry_trigger, element, 0);
m_bindings['o'] = std::tr1::bind(&ElementMenu::set_entry_trigger, element, 1);
m_bindings['i'] = std::tr1::bind(&ElementMenu::set_entry_trigger, element, 2);
m_bindings['u'] = std::tr1::bind(&ElementMenu::set_entry_trigger, element, 3);
return element;
}
@@ -376,40 +375,40 @@ Download::adjust_up_throttle(int throttle) {
void
Download::bind_keys() {
m_bindings['1'] = sigc::bind(sigc::mem_fun(this, &Download::receive_min_uploads), -1);
m_bindings['2'] = sigc::bind(sigc::mem_fun(this, &Download::receive_min_uploads), 1);
m_bindings['3'] = sigc::bind(sigc::mem_fun(this, &Download::receive_max_uploads), -1);
m_bindings['4'] = sigc::bind(sigc::mem_fun(this, &Download::receive_max_uploads), 1);
m_bindings['!'] = sigc::bind(sigc::mem_fun(this, &Download::receive_min_downloads), -1);
m_bindings['@'] = sigc::bind(sigc::mem_fun(this, &Download::receive_min_downloads), 1);
m_bindings['#'] = sigc::bind(sigc::mem_fun(this, &Download::receive_max_downloads), -1);
m_bindings['$'] = sigc::bind(sigc::mem_fun(this, &Download::receive_max_downloads), 1);
m_bindings['5'] = sigc::bind(sigc::mem_fun(this, &Download::receive_min_peers), -5);
m_bindings['6'] = sigc::bind(sigc::mem_fun(this, &Download::receive_min_peers), 5);
m_bindings['7'] = sigc::bind(sigc::mem_fun(this, &Download::receive_max_peers), -5);
m_bindings['8'] = sigc::bind(sigc::mem_fun(this, &Download::receive_max_peers), 5);
m_bindings['+'] = sigc::mem_fun(this, &Download::receive_next_priority);
m_bindings['-'] = sigc::mem_fun(this, &Download::receive_prev_priority);
m_bindings['1'] = std::tr1::bind(&Download::receive_min_uploads, this, -1);
m_bindings['2'] = std::tr1::bind(&Download::receive_min_uploads, this, 1);
m_bindings['3'] = std::tr1::bind(&Download::receive_max_uploads, this, -1);
m_bindings['4'] = std::tr1::bind(&Download::receive_max_uploads, this, 1);
m_bindings['!'] = std::tr1::bind(&Download::receive_min_downloads, this, -1);
m_bindings['@'] = std::tr1::bind(&Download::receive_min_downloads, this, 1);
m_bindings['#'] = std::tr1::bind(&Download::receive_max_downloads, this, -1);
m_bindings['$'] = std::tr1::bind(&Download::receive_max_downloads, this, 1);
m_bindings['5'] = std::tr1::bind(&Download::receive_min_peers, this, -5);
m_bindings['6'] = std::tr1::bind(&Download::receive_min_peers, this, 5);
m_bindings['7'] = std::tr1::bind(&Download::receive_max_peers, this, -5);
m_bindings['8'] = std::tr1::bind(&Download::receive_max_peers, this, 5);
m_bindings['+'] = std::tr1::bind(&Download::receive_next_priority, this);
m_bindings['-'] = std::tr1::bind(&Download::receive_prev_priority, this);
m_bindings['t'] = sigc::bind(sigc::mem_fun(m_download->download(), &torrent::Download::manual_request), false);
m_bindings['T'] = sigc::bind(sigc::mem_fun(m_download->download(), &torrent::Download::manual_request), true);
m_bindings['t'] = std::tr1::bind(&torrent::Download::manual_request, m_download->download(), false);
m_bindings['T'] = std::tr1::bind(&torrent::Download::manual_request, m_download->download(), true);
const char* keys = control->ui()->get_throttle_keys();
m_bindings[keys[ 0]] = sigc::bind(sigc::mem_fun(this, &Download::adjust_up_throttle), 1);
m_bindings[keys[ 1]] = sigc::bind(sigc::mem_fun(this, &Download::adjust_up_throttle), -1);
m_bindings[keys[ 2]] = sigc::bind(sigc::mem_fun(this, &Download::adjust_down_throttle), 1);
m_bindings[keys[ 3]] = sigc::bind(sigc::mem_fun(this, &Download::adjust_down_throttle), -1);
m_bindings[keys[ 0]] = std::tr1::bind(&Download::adjust_up_throttle, this, 1);
m_bindings[keys[ 1]] = std::tr1::bind(&Download::adjust_up_throttle, this, -1);
m_bindings[keys[ 2]] = std::tr1::bind(&Download::adjust_down_throttle, this, 1);
m_bindings[keys[ 3]] = std::tr1::bind(&Download::adjust_down_throttle, this, -1);
m_bindings[keys[ 4]] = sigc::bind(sigc::mem_fun(this, &Download::adjust_up_throttle), 5);
m_bindings[keys[ 5]] = sigc::bind(sigc::mem_fun(this, &Download::adjust_up_throttle), -5);
m_bindings[keys[ 6]] = sigc::bind(sigc::mem_fun(this, &Download::adjust_down_throttle), 5);
m_bindings[keys[ 7]] = sigc::bind(sigc::mem_fun(this, &Download::adjust_down_throttle), -5);
m_bindings[keys[ 4]] = std::tr1::bind(&Download::adjust_up_throttle, this, 5);
m_bindings[keys[ 5]] = std::tr1::bind(&Download::adjust_up_throttle, this, -5);
m_bindings[keys[ 6]] = std::tr1::bind(&Download::adjust_down_throttle, this, 5);
m_bindings[keys[ 7]] = std::tr1::bind(&Download::adjust_down_throttle, this, -5);
m_bindings[keys[ 8]] = sigc::bind(sigc::mem_fun(this, &Download::adjust_up_throttle), 50);
m_bindings[keys[ 9]] = sigc::bind(sigc::mem_fun(this, &Download::adjust_up_throttle), -50);
m_bindings[keys[10]] = sigc::bind(sigc::mem_fun(this, &Download::adjust_down_throttle), 50);
m_bindings[keys[11]] = sigc::bind(sigc::mem_fun(this, &Download::adjust_down_throttle), -50);
m_bindings[keys[ 8]] = std::tr1::bind(&Download::adjust_up_throttle, this, 50);
m_bindings[keys[ 9]] = std::tr1::bind(&Download::adjust_up_throttle, this, -50);
m_bindings[keys[10]] = std::tr1::bind(&Download::adjust_down_throttle, this, 50);
m_bindings[keys[11]] = std::tr1::bind(&Download::adjust_down_throttle, this, -50);
}
}
+16 -16
View File
@@ -193,7 +193,7 @@ DownloadList::activate_display(Display displayType) {
Download* download = new Download(*current_view()->focus());
download->activate(m_frame);
download->slot_exit(sigc::bind(sigc::mem_fun(*this, &DownloadList::activate_display), DISPLAY_DOWNLOAD_LIST));
download->slot_exit(std::tr1::bind(&DownloadList::activate_display, this, DISPLAY_DOWNLOAD_LIST));
m_uiArray[DISPLAY_DOWNLOAD] = download;
break;
@@ -270,15 +270,15 @@ DownloadList::receive_view_input(Input type) {
ElementStringList* esl = dynamic_cast<ElementStringList*>(m_uiArray[DISPLAY_STRING_LIST]);
input->signal_show_next().connect(sigc::bind(sigc::mem_fun(*this, &DownloadList::activate_display), DISPLAY_STRING_LIST));
input->signal_show_next().connect(sigc::mem_fun(*esl, &ElementStringList::next_screen));
input->signal_show_next().connect(std::tr1::bind(&DownloadList::activate_display, this, DISPLAY_STRING_LIST));
input->signal_show_next().connect(std::tr1::bind(&ElementStringList::next_screen, *esl));
input->signal_show_range().connect(sigc::hide(sigc::hide(sigc::bind(sigc::mem_fun(*this, &DownloadList::activate_display), DISPLAY_STRING_LIST))));
input->signal_show_range().connect(sigc::hide(sigc::hide(std::tr1::bind(&DownloadList::activate_display, this, DISPLAY_STRING_LIST))));
input->signal_show_range().connect(sigc::mem_fun(*esl, &ElementStringList::set_range_dirent<utils::Directory::iterator>));
input->bindings()['\n'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_exit_input), type);
input->bindings()[KEY_ENTER] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_exit_input), type);
input->bindings()['\x07'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_exit_input), INPUT_NONE);
input->bindings()['\n'] = std::tr1::bind(&DownloadList::receive_exit_input, this, type);
input->bindings()[KEY_ENTER] = std::tr1::bind(&DownloadList::receive_exit_input, this, type);
input->bindings()['\x07'] = std::tr1::bind(&DownloadList::receive_exit_input, this, INPUT_NONE);
control->ui()->enable_input(title, input);
}
@@ -339,20 +339,20 @@ DownloadList::receive_exit_input(Input type) {
void
DownloadList::setup_keys() {
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['X' - '@'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), INPUT_COMMAND);
m_bindings['\x7f'] = std::tr1::bind(&DownloadList::receive_view_input, this, INPUT_LOAD_DEFAULT);
m_bindings[KEY_BACKSPACE] = std::tr1::bind(&DownloadList::receive_view_input, this, INPUT_LOAD_DEFAULT);
m_bindings['\n'] = std::tr1::bind(&DownloadList::receive_view_input, this, INPUT_LOAD_MODIFIED);
m_bindings[KEY_ENTER] = std::tr1::bind(&DownloadList::receive_view_input, this, INPUT_LOAD_MODIFIED);
m_bindings['\x0F'] = std::tr1::bind(&DownloadList::receive_view_input, this, INPUT_CHANGE_DIRECTORY);
m_bindings['X' - '@'] = std::tr1::bind(&DownloadList::receive_view_input, this, INPUT_COMMAND);
m_uiArray[DISPLAY_LOG]->bindings()[KEY_LEFT] =
m_uiArray[DISPLAY_LOG]->bindings()['B' - '@'] =
m_uiArray[DISPLAY_LOG]->bindings()[' '] = sigc::bind(sigc::mem_fun(*this, &DownloadList::activate_display), DISPLAY_DOWNLOAD_LIST);
m_uiArray[DISPLAY_LOG]->bindings()[' '] = std::tr1::bind(&DownloadList::activate_display, this, DISPLAY_DOWNLOAD_LIST);
m_uiArray[DISPLAY_DOWNLOAD_LIST]->bindings()[KEY_RIGHT] =
m_uiArray[DISPLAY_DOWNLOAD_LIST]->bindings()['F' - '@'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::activate_display), DISPLAY_DOWNLOAD);
m_uiArray[DISPLAY_DOWNLOAD_LIST]->bindings()['l'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::activate_display), DISPLAY_LOG);
m_uiArray[DISPLAY_DOWNLOAD_LIST]->bindings()['F' - '@'] = std::tr1::bind(&DownloadList::activate_display, this, DISPLAY_DOWNLOAD);
m_uiArray[DISPLAY_DOWNLOAD_LIST]->bindings()['l'] = std::tr1::bind(&DownloadList::activate_display, this, DISPLAY_LOG);
}
}
+4 -7
View File
@@ -37,12 +37,9 @@
#ifndef RTORRENT_UI_DOWNLOAD_LIST_H
#define RTORRENT_UI_DOWNLOAD_LIST_H
#include <sigc++/functors/slot.h>
#include "display/manager.h"
#include "element_base.h"
#include "globals.h"
#include "display/manager.h"
class Control;
@@ -74,7 +71,7 @@ public:
typedef display::WindowLog WLog;
typedef display::WindowLogComplete WLogComplete;
typedef sigc::slot1<void, const std::string&> SlotOpenUri;
typedef std::tr1::function<void (const std::string&)> slot_string;
typedef enum {
DISPLAY_DOWNLOAD,
@@ -103,7 +100,7 @@ public:
core::View* current_view();
void set_current_view(const std::string& name);
void slot_open_uri(SlotOpenUri s) { m_slotOpenUri = s; }
void slot_open_uri(slot_string s) { m_slot_open_uri = s; }
void unfocus_download(core::Download* d);
@@ -122,7 +119,7 @@ private:
ElementBase* m_uiArray[DISPLAY_MAX_SIZE];
WLog* m_windowLog;
SlotOpenUri m_slotOpenUri;
slot_string m_slot_open_uri;
};
}
+3 -3
View File
@@ -48,7 +48,7 @@ namespace ui {
class ElementBase {
public:
typedef sigc::slot0<void> slot_type;
typedef std::tr1::function<void ()> slot_type;
ElementBase() : m_frame(NULL), m_focus(false) {}
virtual ~ElementBase() {}
@@ -60,7 +60,7 @@ public:
virtual void activate(display::Frame* frame, bool focus = true) = 0;
virtual void disable() = 0;
void slot_exit(const slot_type& s) { m_slotExit = s; }
void slot_exit(const slot_type& s) { m_slot_exit = s; }
void mark_dirty();
@@ -69,7 +69,7 @@ protected:
bool m_focus;
input::Bindings m_bindings;
slot_type m_slotExit;
slot_type m_slot_exit;
};
}
+5 -5
View File
@@ -52,12 +52,12 @@ ElementChunksSeen::ElementChunksSeen(core::Download* d) :
m_window(NULL),
m_focus(0) {
m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = sigc::mem_fun(&m_slotExit, &slot_type::operator());
m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = std::tr1::bind(&slot_type::operator(), &m_slot_exit);
m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = sigc::mem_fun(*this, &ElementChunksSeen::receive_next);
m_bindings[KEY_UP] = m_bindings['P' - '@'] = sigc::mem_fun(*this, &ElementChunksSeen::receive_prev);
m_bindings[KEY_NPAGE] = sigc::mem_fun(*this, &ElementChunksSeen::receive_pagenext);
m_bindings[KEY_PPAGE] = sigc::mem_fun(*this, &ElementChunksSeen::receive_pageprev);
m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = std::tr1::bind(&ElementChunksSeen::receive_next, this);
m_bindings[KEY_UP] = m_bindings['P' - '@'] = std::tr1::bind(&ElementChunksSeen::receive_prev, this);
m_bindings[KEY_NPAGE] = std::tr1::bind(&ElementChunksSeen::receive_pagenext, this);
m_bindings[KEY_PPAGE] = std::tr1::bind(&ElementChunksSeen::receive_pageprev, this);
}
void
+25 -25
View File
@@ -36,7 +36,6 @@
#include "config.h"
#include <sigc++/adaptors/bind.h>
#include <torrent/exceptions.h>
#include <torrent/object.h>
#include <torrent/utils/log.h>
@@ -64,41 +63,42 @@ ElementDownloadList::ElementDownloadList() :
if (m_view == NULL)
throw torrent::internal_error("View \"main\" must be present to initialize the main display.");
m_bindings['\x13'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_command), "d.start=");
m_bindings['\x04'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_command), "branch=d.state=,d.stop=,d.erase=");
m_bindings['\x0B'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_command), "d.ignore_commands.set=1; d.stop=; d.close=");
m_bindings['\x12'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_command), "d.complete.set=0; d.check_hash=");
m_bindings['\x05'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_command),
"f.multicall=,f.set_create_queued=0,f.set_resize_queued=0; print=\"Queued create/resize of files in torrent.\"");
m_bindings['\x13'] = std::tr1::bind(&ElementDownloadList::receive_command, this, "d.start=");
m_bindings['\x04'] = std::tr1::bind(&ElementDownloadList::receive_command, this, "branch=d.state=,d.stop=,d.erase=");
m_bindings['\x0B'] = std::tr1::bind(&ElementDownloadList::receive_command, this, "d.ignore_commands.set=1; d.stop=; d.close=");
m_bindings['\x12'] = std::tr1::bind(&ElementDownloadList::receive_command, this, "d.complete.set=0; d.check_hash=");
m_bindings['\x05'] = std::tr1::bind(&ElementDownloadList::receive_command, this,
"f.multicall=,f.set_create_queued=0,f.set_resize_queued=0; print=\"Queued create/resize of files in torrent.\"");
m_bindings['+'] = sigc::mem_fun(*this, &ElementDownloadList::receive_next_priority);
m_bindings['-'] = sigc::mem_fun(*this, &ElementDownloadList::receive_prev_priority);
m_bindings['T'-'@']= sigc::mem_fun(*this, &ElementDownloadList::receive_cycle_throttle);
m_bindings['I'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_command),
m_bindings['+'] = std::tr1::bind(&ElementDownloadList::receive_next_priority, this);
m_bindings['-'] = std::tr1::bind(&ElementDownloadList::receive_prev_priority, this);
m_bindings['T'-'@']= std::tr1::bind(&ElementDownloadList::receive_cycle_throttle, this);
m_bindings['I'] = std::tr1::bind(&ElementDownloadList::receive_command, this,
"branch=d.ignore_commands=,"
"{d.ignore_commands.set=0, print=\"Torrent set to heed commands.\"},"
"{d.ignore_commands.set=1, print=\"Torrent set to ignore commands.\"}");
m_bindings['B'-'@']= sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_command),
m_bindings['B'-'@']= std::tr1::bind(&ElementDownloadList::receive_command, this,
"branch=d.is_active=,"
"{print=\"Cannot enable initial seeding on an active download.\"},"
"{d.connection_seed.set=initial_seed, print=\"Enabled initial seeding for the selected download.\"}");
m_bindings['U'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_command), "d.delete_tied=; print=\"Cleared tied to file association for the selected download.\"");
m_bindings['U'] = std::tr1::bind(&ElementDownloadList::receive_command, this,
"d.delete_tied=; print=\"Cleared tied to file association for the selected download.\"");
// These should also be commands.
m_bindings['1'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_change_view), "main");
m_bindings['2'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_change_view), "name");
m_bindings['3'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_change_view), "started");
m_bindings['4'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_change_view), "stopped");
m_bindings['5'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_change_view), "complete");
m_bindings['6'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_change_view), "incomplete");
m_bindings['7'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_change_view), "hashing");
m_bindings['8'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_change_view), "seeding");
m_bindings['9'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_change_view), "leeching");
m_bindings['0'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_change_view), "active");
m_bindings['1'] = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "main");
m_bindings['2'] = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "name");
m_bindings['3'] = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "started");
m_bindings['4'] = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "stopped");
m_bindings['5'] = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "complete");
m_bindings['6'] = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "incomplete");
m_bindings['7'] = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "hashing");
m_bindings['8'] = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "seeding");
m_bindings['9'] = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "leeching");
m_bindings['0'] = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "active");
m_bindings[KEY_UP] = m_bindings['P' - '@'] = sigc::mem_fun(*this, &ElementDownloadList::receive_prev);
m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = sigc::mem_fun(*this, &ElementDownloadList::receive_next);
m_bindings[KEY_UP] = m_bindings['P' - '@'] = std::tr1::bind(&ElementDownloadList::receive_prev, this);
m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = std::tr1::bind(&ElementDownloadList::receive_next, this);
}
void
+10 -11
View File
@@ -36,7 +36,6 @@
#include "config.h"
#include <sigc++/adaptors/bind.h>
#include <rak/algorithm.h>
#include <torrent/exceptions.h>
#include <torrent/data/file.h>
@@ -64,17 +63,17 @@ ElementFileList::ElementFileList(core::Download* d) :
m_selected(iterator(d->download()->file_list()->begin())),
m_collapsed(false) {
m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = sigc::mem_fun(&m_slotExit, &slot_type::operator());
m_bindings[KEY_RIGHT] = m_bindings['F' - '@'] = sigc::mem_fun(*this, &ElementFileList::receive_select);
m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = std::tr1::bind(&slot_type::operator(), &m_slot_exit);
m_bindings[KEY_RIGHT] = m_bindings['F' - '@'] = std::tr1::bind(&ElementFileList::receive_select, this);
m_bindings[' '] = sigc::mem_fun(*this, &ElementFileList::receive_priority);
m_bindings['*'] = sigc::mem_fun(*this, &ElementFileList::receive_change_all);
m_bindings['/'] = sigc::mem_fun(*this, &ElementFileList::receive_collapse);
m_bindings[KEY_NPAGE] = sigc::mem_fun(*this, &ElementFileList::receive_pagenext);
m_bindings[KEY_PPAGE] = sigc::mem_fun(*this, &ElementFileList::receive_pageprev);
m_bindings[' '] = std::tr1::bind(&ElementFileList::receive_priority, this);
m_bindings['*'] = std::tr1::bind(&ElementFileList::receive_change_all, this);
m_bindings['/'] = std::tr1::bind(&ElementFileList::receive_collapse, this);
m_bindings[KEY_NPAGE] = std::tr1::bind(&ElementFileList::receive_pagenext, this);
m_bindings[KEY_PPAGE] = std::tr1::bind(&ElementFileList::receive_pageprev, this);
m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = sigc::mem_fun(*this, &ElementFileList::receive_next);
m_bindings[KEY_UP] = m_bindings['P' - '@'] = sigc::mem_fun(*this, &ElementFileList::receive_prev);
m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = std::tr1::bind(&ElementFileList::receive_next, this);
m_bindings[KEY_UP] = m_bindings['P' - '@'] = std::tr1::bind(&ElementFileList::receive_prev, this);
}
inline ElementText*
@@ -118,7 +117,7 @@ ElementFileList::activate(display::Frame* frame, bool focus) {
m_window->set_focused(focus);
m_elementInfo = element_file_list_create_info();
m_elementInfo->slot_exit(sigc::bind(sigc::mem_fun(this, &ElementFileList::activate_display), DISPLAY_LIST));
m_elementInfo->slot_exit(std::tr1::bind(&ElementFileList::activate_display, this, DISPLAY_LIST));
m_elementInfo->set_target(rpc::make_target(&m_selected));
m_frame = frame;
+4 -4
View File
@@ -72,11 +72,11 @@ ElementMenu::ElementMenu() :
m_entry(entry_invalid) {
// Move bindings into a function that defines default bindings.
m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = sigc::mem_fun(&m_slotExit, &slot_type::operator());
m_bindings[KEY_RIGHT] = m_bindings['F' - '@'] = sigc::mem_fun(this, &ElementMenu::entry_select);
m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = std::tr1::bind(&slot_type::operator(), &m_slot_exit);
m_bindings[KEY_RIGHT] = m_bindings['F' - '@'] = std::tr1::bind(&ElementMenu::entry_select, this);
m_bindings[KEY_UP] = m_bindings['P' - '@'] = sigc::mem_fun(this, &ElementMenu::entry_prev);
m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = sigc::mem_fun(this, &ElementMenu::entry_next);
m_bindings[KEY_UP] = m_bindings['P' - '@'] = std::tr1::bind(&ElementMenu::entry_prev, this);
m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = std::tr1::bind(&ElementMenu::entry_next, this);
}
ElementMenu::~ElementMenu() {
+2 -5
View File
@@ -37,8 +37,6 @@
#ifndef RTORRENT_UI_ELEMENT_MENU_H
#define RTORRENT_UI_ELEMENT_MENU_H
#include <sigc++/functors/slot.h>
#include "core/download.h"
#include "element_base.h"
@@ -53,14 +51,13 @@ namespace ui {
struct ElementMenuEntry {
display::TextElementStringBase* m_element;
sigc::slot0<void> m_slotFocus;
sigc::slot0<void> m_slotSelect;
std::tr1::function<void ()> m_slotFocus;
std::tr1::function<void ()> m_slotSelect;
};
class ElementMenu : public ElementBase, public std::vector<ElementMenuEntry> {
public:
typedef std::vector<ElementMenuEntry> base_type;
typedef sigc::slot0<void> slot_type;
typedef display::WindowText WindowText;
+8 -9
View File
@@ -36,7 +36,6 @@
#include "config.h"
#include <sigc++/adaptors/bind.h>
#include <torrent/exceptions.h>
#include <torrent/rate.h>
#include <torrent/hash_string.h>
@@ -75,16 +74,16 @@ ElementPeerList::ElementPeerList(core::Download* d) :
m_windowList = new display::WindowPeerList(m_download, &m_list, &m_listItr);
m_elementInfo = create_info();
m_elementInfo->slot_exit(sigc::bind(sigc::mem_fun(this, &ElementPeerList::activate_display), DISPLAY_LIST));
m_elementInfo->slot_exit(std::tr1::bind(&ElementPeerList::activate_display, this, DISPLAY_LIST));
m_bindings['k'] = sigc::mem_fun(this, &ElementPeerList::receive_disconnect_peer);
m_bindings['*'] = sigc::mem_fun(this, &ElementPeerList::receive_snub_peer);
m_bindings['B'] = sigc::mem_fun(this, &ElementPeerList::receive_ban_peer);
m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = sigc::mem_fun(&m_slotExit, &slot_type::operator());
m_bindings[KEY_RIGHT] = m_bindings['F' - '@'] = sigc::bind(sigc::mem_fun(this, &ElementPeerList::activate_display), DISPLAY_INFO);
m_bindings['k'] = std::tr1::bind(&ElementPeerList::receive_disconnect_peer, this);
m_bindings['*'] = std::tr1::bind(&ElementPeerList::receive_snub_peer, this);
m_bindings['B'] = std::tr1::bind(&ElementPeerList::receive_ban_peer, this);
m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = std::tr1::bind(&slot_type::operator(), &m_slot_exit);
m_bindings[KEY_RIGHT] = m_bindings['F' - '@'] = std::tr1::bind(&ElementPeerList::activate_display, this, DISPLAY_INFO);
m_bindings[KEY_UP] = m_bindings['P' - '@'] = sigc::mem_fun(this, &ElementPeerList::receive_prev);
m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = sigc::mem_fun(this, &ElementPeerList::receive_next);
m_bindings[KEY_UP] = m_bindings['P' - '@'] = std::tr1::bind(&ElementPeerList::receive_prev, this);
m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = std::tr1::bind(&ElementPeerList::receive_next, this);
}
ElementPeerList::~ElementPeerList() {
+4 -4
View File
@@ -54,11 +54,11 @@ ElementText::ElementText(rpc::target_type target) :
m_columnWidth(0) {
// Move bindings into a function that defines default bindings.
m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = sigc::mem_fun(&m_slotExit, &slot_type::operator());
m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = std::tr1::bind(&slot_type::operator(), &m_slot_exit);
// m_bindings[KEY_UP] = sigc::mem_fun(this, &ElementText::entry_prev);
// m_bindings[KEY_DOWN] = sigc::mem_fun(this, &ElementText::entry_next);
// m_bindings[KEY_RIGHT] = m_bindings['F' - '@'] = sigc::mem_fun(this, &ElementText::entry_select);
// m_bindings[KEY_UP] = std::tr1::bind(this, &ElementText::entry_prev);
// m_bindings[KEY_DOWN] = std::tr1::bind(this, &ElementText::entry_next);
// m_bindings[KEY_RIGHT] = m_bindings['F' - '@'] = std::tr1::bind(this, &ElementText::entry_select);
}
ElementText::~ElementText() {
-2
View File
@@ -37,8 +37,6 @@
#ifndef RTORRENT_UI_ELEMENT_TEXT_H
#define RTORRENT_UI_ELEMENT_TEXT_H
#include <sigc++/functors/slot.h>
#include "core/download.h"
#include "display/text_element_string.h"
#include "display/window_text.h"
+5 -5
View File
@@ -54,13 +54,13 @@ ElementTrackerList::ElementTrackerList(core::Download* d) :
m_window(NULL),
m_focus(0) {
m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = sigc::mem_fun(&m_slotExit, &slot_type::operator());
m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = std::tr1::bind(&slot_type::operator(), &m_slot_exit);
m_bindings[' '] = sigc::mem_fun(*this, &ElementTrackerList::receive_cycle_group);
m_bindings['*'] = sigc::mem_fun(*this, &ElementTrackerList::receive_disable);
m_bindings[' '] = std::tr1::bind(&ElementTrackerList::receive_cycle_group, this);
m_bindings['*'] = std::tr1::bind(&ElementTrackerList::receive_disable, this);
m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = sigc::mem_fun(*this, &ElementTrackerList::receive_next);
m_bindings[KEY_UP] = m_bindings['P' - '@'] = sigc::mem_fun(*this, &ElementTrackerList::receive_prev);
m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = std::tr1::bind(&ElementTrackerList::receive_next, this);
m_bindings[KEY_UP] = m_bindings['P' - '@'] = std::tr1::bind(&ElementTrackerList::receive_prev, this);
}
void
+5 -5
View File
@@ -52,12 +52,12 @@ ElementTransferList::ElementTransferList(core::Download* d) :
m_window(NULL),
m_focus(0) {
m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = sigc::mem_fun(&m_slotExit, &slot_type::operator());
m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = std::tr1::bind(&slot_type::operator(), &m_slot_exit);
m_bindings[KEY_DOWN] = sigc::mem_fun(*this, &ElementTransferList::receive_next);
m_bindings[KEY_UP] = sigc::mem_fun(*this, &ElementTransferList::receive_prev);
m_bindings[KEY_NPAGE] = sigc::mem_fun(*this, &ElementTransferList::receive_pagenext);
m_bindings[KEY_PPAGE] = sigc::mem_fun(*this, &ElementTransferList::receive_pageprev);
m_bindings[KEY_DOWN] = std::tr1::bind(&ElementTransferList::receive_next, this);
m_bindings[KEY_UP] = std::tr1::bind(&ElementTransferList::receive_prev, this);
m_bindings[KEY_NPAGE] = std::tr1::bind(&ElementTransferList::receive_pagenext, this);
m_bindings[KEY_PPAGE] = std::tr1::bind(&ElementTransferList::receive_pageprev, this);
}
void
+18 -19
View File
@@ -38,7 +38,6 @@
#include <stdexcept>
#include <string.h>
#include <sigc++/adaptors/bind.h>
#include <torrent/throttle.h>
#include <torrent/torrent.h>
#include <torrent/download/resource_manager.h>
@@ -141,23 +140,23 @@ Root::setup_keys() {
const char* keys = get_throttle_keys();
m_bindings[keys[ 0]] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), 1);
m_bindings[keys[ 1]] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), -1);
m_bindings[keys[ 2]] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), 1);
m_bindings[keys[ 3]] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), -1);
m_bindings[keys[ 0]] = std::tr1::bind(&Root::adjust_up_throttle, this, 1);
m_bindings[keys[ 1]] = std::tr1::bind(&Root::adjust_up_throttle, this, -1);
m_bindings[keys[ 2]] = std::tr1::bind(&Root::adjust_down_throttle, this, 1);
m_bindings[keys[ 3]] = std::tr1::bind(&Root::adjust_down_throttle, this, -1);
m_bindings[keys[ 4]] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), 5);
m_bindings[keys[ 5]] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), -5);
m_bindings[keys[ 6]] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), 5);
m_bindings[keys[ 7]] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), -5);
m_bindings[keys[ 4]] = std::tr1::bind(&Root::adjust_up_throttle, this, 5);
m_bindings[keys[ 5]] = std::tr1::bind(&Root::adjust_up_throttle, this, -5);
m_bindings[keys[ 6]] = std::tr1::bind(&Root::adjust_down_throttle, this, 5);
m_bindings[keys[ 7]] = std::tr1::bind(&Root::adjust_down_throttle, this, -5);
m_bindings[keys[ 8]] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), 50);
m_bindings[keys[ 9]] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), -50);
m_bindings[keys[10]] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), 50);
m_bindings[keys[11]] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), -50);
m_bindings[keys[ 8]] = std::tr1::bind(&Root::adjust_up_throttle, this, 50);
m_bindings[keys[ 9]] = std::tr1::bind(&Root::adjust_up_throttle, this, -50);
m_bindings[keys[10]] = std::tr1::bind(&Root::adjust_down_throttle, this, 50);
m_bindings[keys[11]] = std::tr1::bind(&Root::adjust_down_throttle, this, -50);
m_bindings['\x0C'] = sigc::mem_fun(m_control->display(), &display::Manager::force_redraw); // ^L
m_bindings['\x11'] = sigc::mem_fun(m_control, &Control::receive_normal_shutdown); // ^Q
m_bindings['\x0C'] = std::tr1::bind(&display::Manager::force_redraw, m_control->display()); // ^L
m_bindings['\x11'] = std::tr1::bind(&Control::receive_normal_shutdown, m_control); // ^Q
}
void
@@ -235,7 +234,7 @@ Root::enable_input(const std::string& title, input::TextInput* input) {
if (m_windowInput->input() != NULL)
throw torrent::internal_error("Root::enable_input(...) m_windowInput->input() != NULL.");
input->slot_dirty(sigc::mem_fun(m_windowInput, &WInput::mark_dirty));
input->slot_dirty(std::tr1::bind(&WInput::mark_dirty, m_windowInput));
m_windowStatusbar->set_active(false);
@@ -244,8 +243,8 @@ Root::enable_input(const std::string& title, input::TextInput* input) {
m_windowInput->set_title(title);
m_windowInput->set_focus(true);
input->bindings()['\x0C'] = sigc::mem_fun(m_control->display(), &display::Manager::force_redraw); // ^L
input->bindings()['\x11'] = sigc::mem_fun(m_control, &Control::receive_normal_shutdown); // ^Q
input->bindings()['\x0C'] = std::tr1::bind(&display::Manager::force_redraw, m_control->display()); // ^L
input->bindings()['\x11'] = std::tr1::bind(&Control::receive_normal_shutdown, m_control); // ^Q
control->input()->set_text_input(input);
control->display()->adjust_layout();
@@ -256,7 +255,7 @@ Root::disable_input() {
if (m_windowInput->input() == NULL)
throw torrent::internal_error("Root::disable_input() m_windowInput->input() == NULL.");
m_windowInput->input()->slot_dirty(sigc::slot0<void>());
m_windowInput->input()->slot_dirty(ElementBase::slot_type());
m_windowStatusbar->set_active(true);