X-Git-Url: http://git.maemo.org/git/?p=qtrapids;a=blobdiff_plain;f=src%2Fserver%2FTorrentHandle.hpp;fp=src%2Fserver%2FTorrentHandle.hpp;h=bf4423e58ea39185e055a1d6b05048b3efdbf7cd;hp=c84c17426b923164db9dd0a64ac4b4365c93e240;hb=d27c2db830de9a65d6a419479ee598cbf3697746;hpb=6c325f6d191739f115b2df64b7b83949e355e8d6 diff --git a/src/server/TorrentHandle.hpp b/src/server/TorrentHandle.hpp index c84c174..bf4423e 100644 --- a/src/server/TorrentHandle.hpp +++ b/src/server/TorrentHandle.hpp @@ -29,58 +29,58 @@ namespace qtrapids { - typedef libtorrent::torrent_info const& torrent_info_cref; - typedef libtorrent::torrent_handle torrent_handle_t; - typedef libtorrent::sha1_hash Sha1Hash; +typedef libtorrent::torrent_info const& torrent_info_cref; +typedef libtorrent::torrent_handle torrent_handle_t; +typedef libtorrent::sha1_hash Sha1Hash; - inline QString Hash2QStr(Sha1Hash const& hash) +inline QString Hash2QStr(Sha1Hash const& hash) +{ + return QString(hash.to_string().c_str()); +} + +/** + @author Lassi Väätämöinen +*/ +class TorrentHandle +{ +public: + + TorrentHandle(libtorrent::torrent_handle handle); + ~TorrentHandle(); + + + + torrent_info_cref getTorrentInfo() const; + + bool isValid() const; + + Sha1Hash hash() const { - return QString(hash.to_string().c_str()); + return torrentHandle_.info_hash(); } - /** - @author Lassi Väätämöinen - */ - class TorrentHandle - { - public: - - TorrentHandle(libtorrent::torrent_handle handle); - ~TorrentHandle(); - - - - torrent_info_cref getTorrentInfo() const; - - bool isValid() const; - - Sha1Hash hash() const - { - return torrentHandle_.info_hash(); - } - - QString name() const; - size_t getTotalSize() const; - TorrentStatus::Id state() const; - float progress() const; - float uploadRate() const; - float downloadRate() const; - qint32 numSeeds() const; - qint32 numLeeches() const; - qint32 ratio() const; - - torrent_handle_t getHandle() const; - bool operator==(TorrentHandle const& h) const; - bool operator<(TorrentHandle const& h) const; - - private: - TorrentHandle(); // Prevent default construct. - torrent_handle_t torrentHandle_; - - TorrentStatus_t status() const; - - }; + QString name() const; + size_t getTotalSize() const; + TorrentStatus::Id state() const; + float progress() const; + float uploadRate() const; + float downloadRate() const; + qint32 numSeeds() const; + qint32 numLeeches() const; + qint32 ratio() const; + + torrent_handle_t getHandle() const; + bool operator==(TorrentHandle const& h) const; + bool operator<(TorrentHandle const& h) const; + +private: + TorrentHandle(); // Prevent default construct. + torrent_handle_t torrentHandle_; + + TorrentStatus_t status() const; + +}; }