mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-14 14:12:31 +00:00
Removed all dependencies on sigc++.
This commit is contained in:
@@ -67,7 +67,8 @@ PathInput::pressed(int key) {
|
||||
return TextInput::pressed(key);
|
||||
|
||||
} else if (m_showNext) {
|
||||
m_signalShowNext.emit();
|
||||
for (signal_void::iterator itr = m_signal_show_next.begin(), last = m_signal_show_next.end(); itr != last; itr++)
|
||||
(*itr)();
|
||||
|
||||
} else {
|
||||
receive_do_complete();
|
||||
@@ -101,7 +102,7 @@ PathInput::receive_do_complete() {
|
||||
|
||||
std::for_each(dir.begin(), dir.end(), _transform_filename());
|
||||
|
||||
Range r = find_incomplete(dir, str().substr(dirEnd, get_pos()));
|
||||
range_type r = find_incomplete(dir, str().substr(dirEnd, get_pos()));
|
||||
|
||||
if (r.first == r.second)
|
||||
return; // Show some nice colors here.
|
||||
@@ -121,8 +122,10 @@ PathInput::receive_do_complete() {
|
||||
// Only emit if there are more than one option.
|
||||
m_showNext = ++utils::Directory::iterator(r.first) != r.second;
|
||||
|
||||
if (m_showNext)
|
||||
m_signalShowRange.emit(r.first, r.second);
|
||||
if (m_showNext) {
|
||||
for (signal_itr_itr::iterator itr = m_signal_show_range.begin(), last = m_signal_show_range.end(); itr != last; itr++)
|
||||
(*itr)(r.first, r.second);
|
||||
}
|
||||
}
|
||||
|
||||
PathInput::size_type
|
||||
@@ -147,9 +150,9 @@ find_complete_not_compare(const utils::directory_entry& complete, const std::str
|
||||
return !complete.d_name.compare(0, base.size(), base);
|
||||
}
|
||||
|
||||
PathInput::Range
|
||||
PathInput::range_type
|
||||
PathInput::find_incomplete(utils::Directory& d, const std::string& f) {
|
||||
Range r;
|
||||
range_type r;
|
||||
|
||||
r.first = std::find_if(d.begin(), d.end(), rak::bind2nd(std::ptr_fun(&find_complete_not_compare), f));
|
||||
r.second = std::find_if(r.first, d.end(), rak::bind2nd(std::ptr_fun(&find_complete_compare), f));
|
||||
|
||||
+14
-9
@@ -37,7 +37,8 @@
|
||||
#ifndef RTORRENT_INPUT_PATH_INPUT_H
|
||||
#define RTORRENT_INPUT_PATH_INPUT_H
|
||||
|
||||
#include <sigc++/signal.h>
|
||||
#include <list>
|
||||
#include <tr1/functional>
|
||||
|
||||
#include "utils/directory.h"
|
||||
#include "text_input.h"
|
||||
@@ -46,15 +47,19 @@ namespace input {
|
||||
|
||||
class PathInput : public TextInput {
|
||||
public:
|
||||
typedef std::pair<utils::Directory::iterator, utils::Directory::iterator> Range;
|
||||
typedef sigc::signal0<void> Signal;
|
||||
typedef sigc::signal2<void, utils::Directory::iterator, utils::Directory::iterator> SignalShowRange;
|
||||
typedef utils::Directory::iterator directory_itr;
|
||||
typedef std::pair<directory_itr, directory_itr> range_type;
|
||||
|
||||
typedef std::tr1::function<void ()> slot_void;
|
||||
typedef std::tr1::function<void (directory_itr, directory_itr)> slot_itr_itr;
|
||||
typedef std::list<slot_void> signal_void;
|
||||
typedef std::list<slot_itr_itr> signal_itr_itr;
|
||||
|
||||
PathInput();
|
||||
virtual ~PathInput() {}
|
||||
|
||||
Signal& signal_show_next() { return m_signalShowNext; }
|
||||
SignalShowRange& signal_show_range() { return m_signalShowRange; }
|
||||
signal_void& signal_show_next() { return m_signal_show_next; }
|
||||
signal_itr_itr& signal_show_range() { return m_signal_show_range; }
|
||||
|
||||
virtual bool pressed(int key);
|
||||
|
||||
@@ -62,12 +67,12 @@ private:
|
||||
void receive_do_complete();
|
||||
|
||||
size_type find_last_delim();
|
||||
Range find_incomplete(utils::Directory& d, const std::string& f);
|
||||
range_type find_incomplete(utils::Directory& d, const std::string& f);
|
||||
|
||||
bool m_showNext;
|
||||
|
||||
Signal m_signalShowNext;
|
||||
SignalShowRange m_signalShowRange;
|
||||
signal_void m_signal_show_next;
|
||||
signal_itr_itr m_signal_show_range;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user