libktorrent  2.2.0
torrentstats.h
1 /***************************************************************************
2  * Copyright (C) 2009 by *
3  * Joris Guisson <joris.guisson@gmail.com> *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 
21 #ifndef BT_TORRENTSTATS_H
22 #define BT_TORRENTSTATS_H
23 
24 #include <QString>
25 #include <util/constants.h>
26 #include <ktorrent_export.h>
27 #include <qdatetime.h>
28 
29 #if defined ERROR
30 #undef ERROR
31 #endif
32 
33 namespace bt
34 {
35  enum TorrentStatus
36  {
37  NOT_STARTED,
38  SEEDING_COMPLETE,
39  DOWNLOAD_COMPLETE,
40  SEEDING,
41  DOWNLOADING,
42  STALLED,
43  STOPPED,
44  ALLOCATING_DISKSPACE,
45  ERROR,
46  QUEUED,
47  CHECKING_DATA,
48  NO_SPACE_LEFT,
49  PAUSED,
50  SUPERSEEDING,
51  INVALID_STATUS
52  };
53 
54  struct KTORRENT_EXPORT TorrentStats
55  {
57  QString error_msg;
59  QDateTime time_added;
61  QString torrent_name;
63  QString output_path;
71  Uint64 bytes_left;
75  Uint64 total_bytes;
79  Uint32 download_rate;
81  Uint32 upload_rate;
83  Uint32 num_peers;
87  Uint32 total_chunks;
95  Uint32 chunk_size;
97  Uint32 seeders_total;
105  TorrentStatus status;
111  bool running;
113  bool started;
115  bool queued;
117  bool autostart;
121  bool completed;
123  bool paused;
144 
145  TorrentStats();
146 
148  float shareRatio() const;
149 
151  bool overMaxRatio() const;
152 
154  QString statusToString() const;
155  };
156 }
157 
158 #endif // BT_TORRENTSTATS_H
bt::TorrentStats::superseeding
bool superseeding
Set to true if superseeding is enabled.
Definition: torrentstats.h:127
bt::TorrentStats::seeders_total
Uint32 seeders_total
Total seeders in swarm.
Definition: torrentstats.h:97
bt::TorrentStats::overMaxRatio
bool overMaxRatio() const
Are we over the max share ratio.
bt::TorrentStats::leechers_connected_to
Uint32 leechers_connected_to
Num leechers connected to.
Definition: torrentstats.h:103
bt::TorrentStats::time_added
QDateTime time_added
QDateTime when the torrent was added.
Definition: torrentstats.h:59
bt::TorrentStats::chunk_size
Uint32 chunk_size
Size of each chunk.
Definition: torrentstats.h:95
bt::TorrentStats::num_chunks_left
Uint32 num_chunks_left
Get the number of chunks left.
Definition: torrentstats.h:93
bt::TorrentStats::total_chunks
Uint32 total_chunks
The total number of chunks.
Definition: torrentstats.h:87
bt::TorrentStats::qm_can_start
bool qm_can_start
Whether or not the QM can start this torrent.
Definition: torrentstats.h:129
bt::TorrentStats::imported_bytes
Uint64 imported_bytes
The number of bytes imported (igore these for average speed)
Definition: torrentstats.h:65
bt::TorrentStats::statusToString
QString statusToString() const
Convert the status into a human readable string.
bt::TorrentStats::status
TorrentStatus status
Status of the download.
Definition: torrentstats.h:105
bt::TorrentStats::seeders_connected_to
Uint32 seeders_connected_to
Num seeders connected to.
Definition: torrentstats.h:99
bt::TorrentStats::completed
bool completed
See if the download is completed.
Definition: torrentstats.h:121
bt::TorrentStats::max_seed_time
float max_seed_time
Maximum seed time in hours.
Definition: torrentstats.h:137
bt::TorrentStats::download_rate
Uint32 download_rate
The download rate in bytes per sec.
Definition: torrentstats.h:79
bt::TorrentStats::bytes_downloaded
Uint64 bytes_downloaded
Total number of bytes downloaded.
Definition: torrentstats.h:67
bt::TorrentStats::bytes_left
Uint64 bytes_left
The number of bytes left (gets sent to the tracker)
Definition: torrentstats.h:71
bt::TorrentStats::paused
bool paused
See if this torrent is paused.
Definition: torrentstats.h:123
bt::TorrentStats
Definition: torrentstats.h:55
bt::TorrentStats::session_bytes_downloaded
Uint64 session_bytes_downloaded
The number of bytes downloaded in this session.
Definition: torrentstats.h:107
bt::TorrentStats::bytes_uploaded
Uint64 bytes_uploaded
Total number of bytes uploaded.
Definition: torrentstats.h:69
bt::TorrentStats::last_download_activity_time
TimeStamp last_download_activity_time
TimeStamp when we last saw download activity.
Definition: torrentstats.h:141
bt::TorrentStats::output_path
QString output_path
Path of the dir or file where the data will get saved.
Definition: torrentstats.h:63
bt::TorrentStats::num_corrupted_chunks
Uint32 num_corrupted_chunks
Number of corrupted chunks found since the last check.
Definition: torrentstats.h:139
bt::TorrentStats::max_share_ratio
float max_share_ratio
Maximum share ratio.
Definition: torrentstats.h:135
bt::TorrentStats::last_upload_activity_time
TimeStamp last_upload_activity_time
TimeStamp when we last saw upload activity.
Definition: torrentstats.h:143
bt::TorrentStats::autostart
bool autostart
See if we are allowed to startup this torrent automatically.
Definition: torrentstats.h:117
bt::TorrentStats::bytes_left_to_download
Uint64 bytes_left_to_download
The number of bytes left to download (bytes_left - excluded bytes)
Definition: torrentstats.h:73
bt::TorrentStats::error_msg
QString error_msg
Error message for the user.
Definition: torrentstats.h:57
bt::TorrentStats::num_chunks_downloading
Uint32 num_chunks_downloading
The number of chunks we are currently downloading.
Definition: torrentstats.h:85
bt::TorrentStats::stopped_by_error
bool stopped_by_error
See if the torrent is stopped by error.
Definition: torrentstats.h:119
bt::TorrentStats::auto_stopped
bool auto_stopped
Set to true if torrent was stopped due to reaching max share ration or max seed time.
Definition: torrentstats.h:125
bt::TorrentStats::num_chunks_excluded
Uint32 num_chunks_excluded
Get the number of chunks which have been excluded.
Definition: torrentstats.h:91
bt::TorrentStats::shareRatio
float shareRatio() const
Calculate the share ratio.
bt::TorrentStats::total_bytes_to_download
Uint64 total_bytes_to_download
The total number of bytes which need to be downloaded.
Definition: torrentstats.h:77
bt::TorrentStats::torrent_name
QString torrent_name
Name of the torrent.
Definition: torrentstats.h:61
bt::TorrentStats::session_bytes_uploaded
Uint64 session_bytes_uploaded
The number of bytes uploaded in this session.
Definition: torrentstats.h:109
bt::TorrentStats::multi_file_torrent
bool multi_file_torrent
See if we have a multi file torrent.
Definition: torrentstats.h:131
bt::TorrentStats::queued
bool queued
Whether or not the torrent is queued.
Definition: torrentstats.h:115
bt::TorrentStats::upload_rate
Uint32 upload_rate
The upload rate in bytes per sec.
Definition: torrentstats.h:81
bt::TorrentStats::priv_torrent
bool priv_torrent
Private torrent (i.e. no use of DHT)
Definition: torrentstats.h:133
bt::TorrentStats::num_chunks_downloaded
Uint32 num_chunks_downloaded
The number of chunks which have been downloaded.
Definition: torrentstats.h:89
bt::TorrentStats::running
bool running
See if we are running.
Definition: torrentstats.h:111
bt::TorrentStats::started
bool started
See if the torrent has been started.
Definition: torrentstats.h:113
bt::TorrentStats::leechers_total
Uint32 leechers_total
Total leechers in swarm.
Definition: torrentstats.h:101
bt::TorrentStats::num_peers
Uint32 num_peers
The number of peers we are connected to.
Definition: torrentstats.h:83
bt::TorrentStats::total_bytes
Uint64 total_bytes
total number of bytes in torrent
Definition: torrentstats.h:75