mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-06 22:29:23 +00:00
Reorganized, moing stuff to src/utils subdir.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@290 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+2
-1
@@ -1,4 +1,4 @@
|
||||
AC_INIT(rtorrent, 0.0.2, jaris@ifi.uio.no)
|
||||
AC_INIT(rtorrent, 0.0.3, jaris@ifi.uio.no)
|
||||
|
||||
AM_INIT_AUTOMAKE
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
@@ -52,4 +52,5 @@ AC_OUTPUT([
|
||||
src/display/Makefile
|
||||
src/input/Makefile
|
||||
src/ui/Makefile
|
||||
src/utils/Makefile
|
||||
])
|
||||
|
||||
+5
-7
@@ -2,7 +2,8 @@ SUBDIRS = \
|
||||
core \
|
||||
display \
|
||||
input \
|
||||
ui
|
||||
ui \
|
||||
utils
|
||||
|
||||
bin_PROGRAMS = rtorrent
|
||||
|
||||
@@ -10,15 +11,12 @@ rtorrent_LDADD = \
|
||||
$(top_srcdir)/src/ui/libsub_ui.a \
|
||||
$(top_srcdir)/src/core/libsub_core.a \
|
||||
$(top_srcdir)/src/display/libsub_display.a \
|
||||
$(top_srcdir)/src/input/libsub_input.a
|
||||
$(top_srcdir)/src/input/libsub_input.a \
|
||||
$(top_srcdir)/src/utils/libsub_utils.a
|
||||
|
||||
rtorrent_SOURCES = \
|
||||
functional.h \
|
||||
main.cc \
|
||||
option_parser.cc \
|
||||
option_parser.h \
|
||||
parse.cc \
|
||||
parse.h \
|
||||
signal_handler.cc \
|
||||
signal_handler.h \
|
||||
timer.h
|
||||
signal_handler.h
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <curl/multi.h>
|
||||
#include <torrent/exceptions.h>
|
||||
|
||||
#include "functional.h"
|
||||
#include "utils/functional.h"
|
||||
#include "curl_get.h"
|
||||
#include "curl_stack.h"
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <sigc++/bind.h>
|
||||
|
||||
#include "download.h"
|
||||
#include "functional.h"
|
||||
#include "utils/functional.h"
|
||||
#include "hash_queue.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <functional.h>
|
||||
#include <sigc++/bind.h>
|
||||
#include <sigc++/hide.h>
|
||||
#include <torrent/http.h>
|
||||
|
||||
#include "functional.h"
|
||||
#include "utils/functional.h"
|
||||
#include "http_queue.h"
|
||||
#include "curl_get.h"
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <stdexcept>
|
||||
#include <algorithm>
|
||||
|
||||
#include "functional.h"
|
||||
#include "utils/functional.h"
|
||||
|
||||
#include "canvas.h"
|
||||
#include "manager.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef RTORRENT_WINDOW_BASE_H
|
||||
#define RTORRENT_WINDOW_BASE_H
|
||||
|
||||
#include "timer.h"
|
||||
#include "utils/timer.h"
|
||||
|
||||
namespace display {
|
||||
|
||||
@@ -40,7 +40,7 @@ protected:
|
||||
bool m_dynamic;
|
||||
int m_minHeight;
|
||||
|
||||
Timer m_lastDraw;
|
||||
utils::Timer m_lastDraw;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -14,10 +14,10 @@ WindowDownloadList::WindowDownloadList(DList* l, DList::iterator* f) :
|
||||
|
||||
void
|
||||
WindowDownloadList::redraw() {
|
||||
if (Timer::cache() - m_lastDraw < 1000000)
|
||||
if (utils::Timer::cache() - m_lastDraw < 1000000)
|
||||
return;
|
||||
|
||||
m_lastDraw = Timer::cache();
|
||||
m_lastDraw = utils::Timer::cache();
|
||||
|
||||
m_canvas->erase();
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@ WindowDownloadStatusbar::WindowDownloadStatusbar(core::Download* d) :
|
||||
|
||||
void
|
||||
WindowDownloadStatusbar::redraw() {
|
||||
if (Timer::cache() - m_lastDraw < 1000000)
|
||||
if (utils::Timer::cache() - m_lastDraw < 1000000)
|
||||
return;
|
||||
|
||||
m_lastDraw = Timer::cache();
|
||||
m_lastDraw = utils::Timer::cache();
|
||||
|
||||
m_canvas->erase();
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "core/http_queue.h"
|
||||
|
||||
#include "canvas.h"
|
||||
#include "functional.h"
|
||||
#include "utils/functional.h"
|
||||
#include "window_http_queue.h"
|
||||
|
||||
namespace display {
|
||||
@@ -22,10 +22,10 @@ WindowHttpQueue::WindowHttpQueue(core::HttpQueue* q) :
|
||||
|
||||
void
|
||||
WindowHttpQueue::redraw() {
|
||||
if (Timer::cache() - m_lastDraw < 1000000)
|
||||
if (utils::Timer::cache() - m_lastDraw < 1000000)
|
||||
return;
|
||||
|
||||
m_lastDraw = Timer::cache();
|
||||
m_lastDraw = utils::Timer::cache();
|
||||
|
||||
cleanup_list();
|
||||
|
||||
@@ -62,7 +62,7 @@ WindowHttpQueue::redraw() {
|
||||
void
|
||||
WindowHttpQueue::cleanup_list() {
|
||||
for (Container::iterator itr = m_container.begin(); itr != m_container.end();)
|
||||
if (itr->m_http == NULL && itr->m_timer < Timer::cache())
|
||||
if (itr->m_http == NULL && itr->m_timer < utils::Timer::cache())
|
||||
itr = m_container.erase(itr);
|
||||
else
|
||||
++itr;
|
||||
@@ -112,7 +112,7 @@ WindowHttpQueue::receive_erase(core::CurlGet* h) {
|
||||
throw std::logic_error("WindowHttpQueue::receive_erase(...) tried to remove an object we don't have");
|
||||
|
||||
itr->m_http = NULL;
|
||||
itr->m_timer = Timer::cache() + 10000000;
|
||||
itr->m_timer = utils::Timer::cache() + 10000000;
|
||||
|
||||
mark_dirty();
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ private:
|
||||
|
||||
core::CurlGet* m_http;
|
||||
std::string m_name;
|
||||
Timer m_timer;
|
||||
utils::Timer m_timer;
|
||||
};
|
||||
|
||||
typedef std::list<Node> Container;
|
||||
|
||||
@@ -18,7 +18,7 @@ WindowInput::redraw() {
|
||||
if (!is_dirty())
|
||||
return;
|
||||
|
||||
m_lastDraw = Timer::cache();
|
||||
m_lastDraw = utils::Timer::cache();
|
||||
m_canvas->erase();
|
||||
|
||||
m_canvas->print(0, 0, "> %s", m_input->c_str());
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "core/download.h"
|
||||
|
||||
#include "parse.h"
|
||||
#include "utils/parse.h"
|
||||
#include "canvas.h"
|
||||
#include "window_peer_info.h"
|
||||
|
||||
@@ -19,15 +19,15 @@ WindowPeerInfo::WindowPeerInfo(core::Download* d, PList* l, PList::iterator* f)
|
||||
|
||||
void
|
||||
WindowPeerInfo::redraw() {
|
||||
if (Timer::cache() - m_lastDraw < 1000000)
|
||||
if (utils::Timer::cache() - m_lastDraw < 1000000)
|
||||
return;
|
||||
|
||||
m_lastDraw = Timer::cache();
|
||||
m_lastDraw = utils::Timer::cache();
|
||||
m_canvas->erase();
|
||||
|
||||
int y = 0;
|
||||
|
||||
m_canvas->print(0, y++, "Hash: %s", escape_string(m_download->get_download().get_hash()).c_str());
|
||||
m_canvas->print(0, y++, "Hash: %s", utils::escape_string(m_download->get_download().get_hash()).c_str());
|
||||
m_canvas->print(0, y++, "Chunks: %u / %u * %u",
|
||||
m_download->get_download().get_chunks_done(),
|
||||
m_download->get_download().get_chunks_total(),
|
||||
@@ -42,7 +42,7 @@ WindowPeerInfo::redraw() {
|
||||
}
|
||||
|
||||
m_canvas->print(0, y++, "DNS: %s:%hu", (*m_focus)->get_dns().c_str(), (*m_focus)->get_port());
|
||||
m_canvas->print(0, y++, "Id: %s" , escape_string((*m_focus)->get_id()).c_str());
|
||||
m_canvas->print(0, y++, "Id: %s" , utils::escape_string((*m_focus)->get_id()).c_str());
|
||||
m_canvas->print(0, y++, "Snubbed: %s", (*m_focus)->get_snubbed() ? "Yes" : "No");
|
||||
m_canvas->print(0, y++, "Done: %i%", (*m_focus)->get_chunks_done());
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@ WindowPeerList::WindowPeerList(PList* l, PList::iterator* f) :
|
||||
|
||||
void
|
||||
WindowPeerList::redraw() {
|
||||
if (Timer::cache() - m_lastDraw < 1000000)
|
||||
if (utils::Timer::cache() - m_lastDraw < 1000000)
|
||||
return;
|
||||
|
||||
m_lastDraw = Timer::cache();
|
||||
m_lastDraw = utils::Timer::cache();
|
||||
m_canvas->erase();
|
||||
|
||||
int x = 2;
|
||||
|
||||
@@ -16,10 +16,10 @@ void
|
||||
WindowStatusbar::redraw() {
|
||||
m_counter++;
|
||||
|
||||
if (Timer::cache() - m_lastDraw < 10000000)
|
||||
if (utils::Timer::cache() - m_lastDraw < 10000000)
|
||||
return;
|
||||
|
||||
m_lastDraw = Timer::cache();
|
||||
m_lastDraw = utils::Timer::cache();
|
||||
|
||||
m_canvas->erase();
|
||||
m_canvas->print(0, 0, "Throttle: %i Listen: %s:%i Handshakes: %i Select: %u",
|
||||
|
||||
@@ -12,10 +12,10 @@ WindowTitle::WindowTitle(const std::string& s) :
|
||||
|
||||
void
|
||||
WindowTitle::redraw() {
|
||||
if (Timer::cache() - m_lastDraw < 10000000)
|
||||
if (utils::Timer::cache() - m_lastDraw < 10000000)
|
||||
return;
|
||||
|
||||
m_lastDraw = Timer::cache();
|
||||
m_lastDraw = utils::Timer::cache();
|
||||
m_canvas->erase();
|
||||
|
||||
m_canvas->print(std::max(0, (m_canvas->get_width() - (int)m_title.size()) / 2 - 4), 0,
|
||||
|
||||
+3
-3
@@ -17,12 +17,12 @@
|
||||
#include "ui/control.h"
|
||||
#include "ui/download_list.h"
|
||||
#include "input/bindings.h"
|
||||
#include "utils/timer.h"
|
||||
|
||||
#include "timer.h"
|
||||
#include "signal_handler.h"
|
||||
#include "option_parser.h"
|
||||
|
||||
int64_t Timer::m_cache;
|
||||
int64_t utils::Timer::m_cache;
|
||||
|
||||
bool start_shutdown = false;
|
||||
bool is_shutting_down = false;
|
||||
@@ -114,7 +114,7 @@ main(int argc, char** argv) {
|
||||
if (start_shutdown)
|
||||
do_shutdown(&uiControl);
|
||||
|
||||
Timer::update();
|
||||
utils::Timer::update();
|
||||
|
||||
uiControl.get_display().do_update();
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
noinst_LIBRARIES = libsub_utils.a
|
||||
|
||||
libsub_utils_a_SOURCES = \
|
||||
functional.h \
|
||||
parse.cc \
|
||||
parse.h \
|
||||
timer.h
|
||||
|
||||
INCLUDES = -I$(srcdir) -I$(srcdir)/.. -I$(top_srcdir)
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "parse.h"
|
||||
#include "utils/parse.h"
|
||||
|
||||
namespace utils {
|
||||
|
||||
std::string
|
||||
escape_string(const std::string& src) {
|
||||
@@ -22,3 +24,5 @@ escape_string(const std::string& src) {
|
||||
|
||||
return stream.str();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +1,14 @@
|
||||
#ifndef RTORRENT_PARSE_H
|
||||
#define RTORRENT_PARSE_H
|
||||
#ifndef RTORRENT_UTILS_PARSE_H
|
||||
#define RTORRENT_UTILS_PARSE_H
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace utils {
|
||||
|
||||
// Various functinos for manipulating strings.
|
||||
|
||||
std::string escape_string(const std::string& src);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -4,6 +4,8 @@
|
||||
#include <inttypes.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
namespace utils {
|
||||
|
||||
// Don't convert negative Timer to timeval.
|
||||
class Timer {
|
||||
public:
|
||||
@@ -53,4 +55,6 @@ class Timer {
|
||||
static int64_t m_cache;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // LIBTORRENT_TIMER_H
|
||||
Reference in New Issue
Block a user