* Using the new rlookup commands for views.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1232 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2011-05-26 05:12:47 +00:00
parent d2f328cc8e
commit ff477d3f7a
3 changed files with 6 additions and 12 deletions
+4 -10
View File
@@ -40,11 +40,12 @@
#include <functional>
#include <rak/functional.h>
#include <rak/functional_fun.h>
#include <rpc/parse_commands.h>
#include <sigc++/adaptors/bind.h>
#include <torrent/download.h>
#include <torrent/exceptions.h>
#include "rpc/parse_commands.h"
#include "rpc/object_storage.h"
#include "control.h"
#include "download.h"
#include "download_list.h"
@@ -322,19 +323,12 @@ View::filter_download(core::Download* download) {
void
View::set_filter_on_event(const std::string& event) {
if (std::find(m_events.begin(), m_events.end(), event) != m_events.end())
return;
rpc::commands.call_catch("method.set_key", rpc::make_target(), rpc::create_object_list(event, "!view." + m_name, "view.filter_download=" + m_name));
m_events.push_back(event);
control->object_storage()->set_str_multi_key(event, "!view." + m_name, "view.filter_download=" + m_name);
}
void
View::clear_filter_on() {
// Don't clear insert and erase as these are required to keep the
// View up-to-date with the available downloads.
for (event_list_type::const_iterator itr = m_events.begin(); itr != m_events.end(); itr++)
rpc::commands.call_catch("method.set_key", rpc::make_target(), rpc::create_object_list(*itr, "!view." + m_name));
control->object_storage()->rlookup_clear("!view." + m_name);
}
inline void
-2
View File
@@ -65,7 +65,6 @@ class Download;
class View : private std::vector<Download*> {
public:
typedef std::vector<Download*> base_type;
typedef std::vector<std::string> event_list_type;
typedef sigc::signal0<void> signal_type;
using base_type::iterator;
@@ -172,7 +171,6 @@ private:
torrent::Object m_sortCurrent;
torrent::Object m_filter;
event_list_type m_events;
std::string m_eventAdded;
std::string m_eventRemoved;
+2
View File
@@ -115,6 +115,8 @@ ViewManager::set_filter_on(const std::string& name, const filter_args& args) {
(*viewItr)->clear_filter_on();
// TODO: Ensure the filter keys are rlookup.
for (filter_args::const_iterator itr = args.begin(); itr != args.end(); ++itr)
(*viewItr)->set_filter_on_event(*itr);
}