* Saves file priorities along with fast-resume data.

* Cleaned up the shutdown code, moved some unnessesary stuff out of
the main loop.

* Made a TrackerBase and an empty TrackerUdp class. The proper
Tracker* class is selected based on the url.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@492 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2005-07-09 18:28:57 +00:00
parent 26a7907f0a
commit 8ca61a79ac
8 changed files with 80 additions and 39 deletions
+1
View File
@@ -1,6 +1,7 @@
noinst_LIBRARIES = libsub_ui.a
libsub_ui_a_SOURCES = \
control.cc \
control.h \
download.cc \
download.h \
+54
View File
@@ -0,0 +1,54 @@
// rTorrent - BitTorrent client
// Copyright (C) 2005, Jari Sundell
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations
// including the two.
//
// You must obey the GNU General Public License in all respects for
// all of the code used other than OpenSSL. If you modify file(s)
// with this exception, you may extend this exception to your version
// of the file(s), but you are not obligated to do so. If you do not
// wish to do so, delete this exception statement from your version.
// If you delete this exception statement from all source files in the
// program, then also delete it here.
//
// Contact: Jari Sundell <jaris@ifi.uio.no>
//
// Skomakerveien 33
// 3185 Skoppum, NORWAY
#include "config.h"
#include "control.h"
namespace ui {
// I think it should be safe to initiate the shutdown from anywhere,
// but if it isn't, use a delay task.
void
Control::receive_shutdown() {
if (!m_shutdownReceived)
torrent::listen_close();
m_core.shutdown(m_shutdownReceived);
m_shutdownReceived = true;
}
}
+6 -2
View File
@@ -37,6 +37,8 @@
#ifndef RTORRENT_UI_CONTROL_H
#define RTORRENT_UI_CONTROL_H
#include <torrent/torrent.h>
#include "core/manager.h"
#include "display/manager.h"
#include "input/manager.h"
@@ -49,14 +51,16 @@ class Control {
public:
Control() : m_shutdownReceived(false) {}
bool get_shutdown_received() { return m_shutdownReceived; }
void set_shutdown_received(bool v) { m_shutdownReceived = v; }
bool is_shutdown_completed() { return m_shutdownReceived && torrent::is_inactive(); }
bool is_shutdown_received() { return m_shutdownReceived; }
Root& get_ui() { return m_ui; }
core::Manager& get_core() { return m_core; }
display::Manager& get_display() { return m_display; }
input::Manager& get_input() { return m_input; }
void receive_shutdown();
private:
Control(const Control&);
void operator = (const Control&);
+4
View File
@@ -275,6 +275,10 @@ DownloadList::receive_exit_input(bool useDefault) {
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), false);
(*m_bindings)[KEY_ENTER] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), false);
receive_change(DISPLAY_DOWNLOAD_LIST);
}
+1 -1
View File
@@ -107,7 +107,7 @@ Root::setup_keys() {
m_bindings['C'] = sigc::bind(sigc::mem_fun(*this, &Root::receive_read_throttle), -50);
m_bindings[KEY_RESIZE] = sigc::mem_fun(m_control->get_display(), &display::Manager::adjust_layout);
m_bindings['\x11'] = sigc::bind(sigc::mem_fun(*m_control, &Control::set_shutdown_received), true);
m_bindings['\x11'] = sigc::mem_fun(*m_control, &Control::receive_shutdown);
}
void