Added Q_FUNC_INFO macros to some functions.
[qtrapids] / src / engine / QTorrentHandle.h
1 /***************************************************************************
2  *   Copyright (C) 2010 by Ixonos Plc   *
3  *                                                                         *
4  *   This program is free software; you can redistribute it and/or modify  *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; version 2 of the License.               *
7  *                                                                         *
8  *   This program is distributed in the hope that it will be useful,       *
9  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
10  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
11  *   GNU General Public License for more details.                          *
12  *                                                                         *
13  *   You should have received a copy of the GNU General Public License     *
14  *   along with this program; if not, write to the                         *
15  *   Free Software Foundation, Inc.,                                       *
16  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
17  ***************************************************************************/
18 #ifndef QTORRENTHANDLE_H
19 #define QTORRENTHANDLE_H
20
21 #include <QtGlobal>
22
23 #include <libtorrent/torrent_handle.hpp>
24
25
26 typedef libtorrent::torrent_status TorrentStatus;
27 typedef libtorrent::torrent_info TorrentInfo;
28 typedef libtorrent::torrent_handle TorrentHandle;
29
30
31 /**
32         @author Lassi Väätämöinen <lassi.vaatamoinen@ixonos.com>
33 */
34
35 namespace qtrapids
36 {
37
38 class QTorrentHandle
39 {
40 public:
41
42         enum State {
43                 QUEUED_FOR_CHECKING = TorrentStatus::queued_for_checking,
44                 CHECKING_FILES,
45                 DOWNLOADING_METADATA,
46                 DOWNLOADING,
47                 FINISHED,
48                 SEEDING,
49                 ALLOCATING,
50                 UNSPECIFIED
51         };
52
53         QTorrentHandle(libtorrent::torrent_handle handle);
54         ~QTorrentHandle();
55
56
57
58         TorrentInfo const& getTorrentInfo() const;
59
60         bool isValid() const;
61
62         QString name() const;
63         size_t getTotalSize() const;
64         QTorrentHandle::State state() const;
65         float progress() const;
66         float uploadRate() const;
67         float downloadRate() const;
68         qint32 numSeeds() const;
69         qint32 numLeeches() const;
70         qint32 ratio() const;
71
72         TorrentHandle getHandle() const;
73
74         bool operator==(QTorrentHandle const& h) const;
75         bool operator<(QTorrentHandle const& h) const;
76
77 private:
78         QTorrentHandle(); // Prevent default construct.
79         TorrentHandle torrentHandle_;
80
81         TorrentStatus status() const;
82
83 };
84
85 } // namespace qtrapids
86 #endif