added missing files
This commit is contained in:
parent
34440224fc
commit
ef2b52f06b
|
@ -0,0 +1,60 @@
|
|||
#ifndef SESSION_VIEW_HPP_
|
||||
#define SESSION_VIEW_HPP_
|
||||
|
||||
#include "libtorrent/session.hpp"
|
||||
|
||||
namespace lt = libtorrent;
|
||||
|
||||
struct session_view
|
||||
{
|
||||
session_view();
|
||||
|
||||
void set_pos(int pos);
|
||||
|
||||
int pos() const;
|
||||
|
||||
int height() const;
|
||||
|
||||
void render();
|
||||
|
||||
void update_counters(std::vector<boost::uint64_t>& stats_counters
|
||||
, boost::uint64_t t);
|
||||
|
||||
private:
|
||||
|
||||
int m_position;
|
||||
|
||||
// there are two sets of counters. the current one and the last one. This
|
||||
// is used to calculate rates
|
||||
std::vector<boost::uint64_t> m_cnt[2];
|
||||
|
||||
// the timestamps of the counters in m_cnt[0] and m_cnt[1]
|
||||
// respectively. The timestamps are microseconds since session start
|
||||
boost::uint64_t m_timestamp[2];
|
||||
|
||||
int m_queued_bytes_idx;
|
||||
int m_wasted_bytes_idx;
|
||||
int m_failed_bytes_idx;
|
||||
int m_num_peers_idx;
|
||||
int m_recv_payload_idx;
|
||||
int m_sent_payload_idx;
|
||||
int m_unchoked_idx;
|
||||
int m_unchoke_slots_idx;
|
||||
int m_limiter_up_queue_idx;
|
||||
int m_limiter_down_queue_idx;
|
||||
int m_limiter_up_bytes_idx;
|
||||
int m_limiter_down_bytes_idx;
|
||||
int m_queued_writes_idx;
|
||||
int m_queued_reads_idx;
|
||||
int m_writes_cache_idx;
|
||||
int m_reads_cache_idx;
|
||||
int m_pinned_idx;
|
||||
int m_num_blocks_read_idx;
|
||||
int m_cache_hit_idx;
|
||||
int m_blocks_in_use_idx;
|
||||
int m_blocks_written_idx;
|
||||
int m_write_ops_idx;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
#ifndef TORRENT_VIEW_HPP_
|
||||
#define TORRENT_VIEW_HPP_
|
||||
|
||||
#include <set>
|
||||
|
||||
#include "libtorrent/torrent_handle.hpp"
|
||||
|
||||
namespace lt = libtorrent;
|
||||
|
||||
struct torrent_view
|
||||
{
|
||||
torrent_view();
|
||||
|
||||
void set_size(int width, int height);
|
||||
|
||||
enum {
|
||||
torrents_all,
|
||||
torrents_downloading,
|
||||
torrents_not_paused,
|
||||
torrents_seeding,
|
||||
torrents_queued,
|
||||
torrents_stopped,
|
||||
torrents_checking,
|
||||
torrents_loaded,
|
||||
|
||||
torrents_max
|
||||
};
|
||||
|
||||
int filter() const;
|
||||
|
||||
void set_filter(int filter);
|
||||
|
||||
// returns the lt::torrent_status of the currently selected torrent.
|
||||
lt::torrent_status const& get_active_torrent() const;
|
||||
lt::torrent_handle get_active_handle() const;
|
||||
|
||||
void update_torrents(std::vector<lt::torrent_status> const& st);
|
||||
|
||||
int height() const;
|
||||
|
||||
void arrow_up();
|
||||
void arrow_down();
|
||||
|
||||
void render();
|
||||
|
||||
private:
|
||||
|
||||
void print_tabs();
|
||||
|
||||
void print_headers();
|
||||
|
||||
void print_torrent(lt::torrent_status const& s, bool selected);
|
||||
|
||||
bool show_torrent(lt::torrent_status const& st);
|
||||
|
||||
// refresh all pointers in m_filtered_handles. This must be done when
|
||||
// inserting or removing elements from m_all_handles, since pointers may
|
||||
// be invalidated or when a torrent changes status to either become
|
||||
// visible or filtered
|
||||
void update_filtered_torrents();
|
||||
|
||||
// all torrents
|
||||
boost::unordered_set<lt::torrent_status> m_all_handles;
|
||||
|
||||
// pointers into m_all_handles of the remaining torrents after filtering
|
||||
std::vector<lt::torrent_status const*> m_filtered_handles;
|
||||
|
||||
mutable int m_active_torrent; // index into m_filtered_handles
|
||||
int m_scroll_position;
|
||||
int m_torrent_filter;
|
||||
int m_width;
|
||||
int m_height;
|
||||
};
|
||||
|
||||
#endif // TORRENT_VIEW_HPP_
|
||||
|
Loading…
Reference in New Issue