X-Git-Url: http://git.maemo.org/git/?p=qtrapids;a=blobdiff_plain;f=src%2Fserver%2FTorrentHandle.cpp;h=5cb7b72c2808d5feed77dc95b7151a41a7e8b983;hp=d4b5533f30b21aef80854b3e28a20a9e516d0e8c;hb=6ae61ea5faec84289c549193b680c32c9d0bf395;hpb=06410091b1e07c443849f0fe71050654c6fb9710 diff --git a/src/server/TorrentHandle.cpp b/src/server/TorrentHandle.cpp index d4b5533..5cb7b72 100644 --- a/src/server/TorrentHandle.cpp +++ b/src/server/TorrentHandle.cpp @@ -25,119 +25,119 @@ namespace qtrapids { - TorrentHandle::TorrentHandle(libtorrent::torrent_handle handle) : +TorrentHandle::TorrentHandle(libtorrent::torrent_handle handle) : torrentHandle_(handle) - { - } - +{ +} - TorrentHandle::~TorrentHandle() - { - } +TorrentHandle::~TorrentHandle() +{ +} - TorrentStatus_t TorrentHandle::status() const - { - return torrentHandle_.status(); - } +TorrentStatus_t TorrentHandle::status() const +{ + return torrentHandle_.status(); +} - torrent_info_cref TorrentHandle::getTorrentInfo() const - { - return torrentHandle_.get_torrent_info(); - } +torrent_info_cref TorrentHandle::getTorrentInfo() const +{ + return torrentHandle_.get_torrent_info(); +} - bool TorrentHandle::isValid() const - { - return torrentHandle_.is_valid(); - } +bool TorrentHandle::isValid() const +{ + return torrentHandle_.is_valid(); +} - QString TorrentHandle::name() const - { - return QString::fromStdString(torrentHandle_.name()); - } - size_t TorrentHandle::getTotalSize() const - { - torrent_info_cref info = getTorrentInfo(); - return static_cast (info.total_size()); - } +QString TorrentHandle::name() const +{ + return QString::fromStdString(torrentHandle_.name()); +} +size_t TorrentHandle::getTotalSize() const +{ + torrent_info_cref info = getTorrentInfo(); + return static_cast (info.total_size()); +} - TorrentStatus::Id TorrentHandle::state() const - { - TorrentStatus::Id s = (TorrentStatus::Id)(status().state); - return ( (s < TorrentStatus::UNSPECIFIED) - ? s : TorrentStatus::UNSPECIFIED ); - } +TorrentStatus::Id TorrentHandle::state() const +{ + TorrentStatus::Id s = (TorrentStatus::Id)(status().state); + return ( (s < TorrentStatus::UNSPECIFIED) + ? s : TorrentStatus::UNSPECIFIED ); +} - float TorrentHandle::progress() const - { - TorrentStatus_t statusTmp = status(); - return statusTmp.progress; - } - float TorrentHandle::uploadRate() const - { - TorrentStatus_t statusTmp = status(); - return statusTmp.upload_rate; - } +float TorrentHandle::progress() const +{ + TorrentStatus_t statusTmp = status(); + return statusTmp.progress; +} +float TorrentHandle::uploadRate() const +{ + TorrentStatus_t statusTmp = status(); + return statusTmp.upload_rate; +} - float TorrentHandle::downloadRate() const - { - TorrentStatus_t statusTmp = status(); - return statusTmp.download_rate; - } +float TorrentHandle::downloadRate() const +{ + TorrentStatus_t statusTmp = status(); + return statusTmp.download_rate; +} - qint32 TorrentHandle::numSeeds() const - { - TorrentStatus_t statusTmp = status(); - return statusTmp.list_seeds; - } +qint32 TorrentHandle::numSeeds() const +{ + TorrentStatus_t statusTmp = status(); + return statusTmp.list_seeds; +} - qint32 TorrentHandle::numLeeches() const - { - TorrentStatus_t statusTmp = status(); - return (statusTmp.list_peers - statusTmp.list_seeds); - } +qint32 TorrentHandle::numLeeches() const +{ + TorrentStatus_t statusTmp = status(); + return (statusTmp.list_peers - statusTmp.list_seeds); +} - qint32 TorrentHandle::ratio() const - { - TorrentStatus_t statusTmp = status(); - size_t ratio; - if (statusTmp.total_payload_download == 0) { - ratio = 0; - } else { - ratio = static_cast (statusTmp.total_payload_upload / statusTmp.total_payload_download); - } - return ratio; - } +qint32 TorrentHandle::ratio() const +{ + TorrentStatus_t statusTmp = status(); + size_t ratio; + if (statusTmp.total_payload_download == 0) { + ratio = 0; + } else { + ratio = static_cast (statusTmp.total_payload_upload / statusTmp.total_payload_download); + } + + return ratio; +} - torrent_handle_t TorrentHandle::getHandle() const - { - return torrentHandle_; - } +torrent_handle_t TorrentHandle::getHandle() const +{ + return torrentHandle_; +} - bool TorrentHandle::operator==(TorrentHandle const& h) const - { - return torrentHandle_ == h.torrentHandle_; - } +bool TorrentHandle::operator==(TorrentHandle const& h) const +{ + return torrentHandle_ == h.torrentHandle_; +} - bool TorrentHandle::operator<(TorrentHandle const& h) const - { - return torrentHandle_ < h.torrentHandle_; - } +bool TorrentHandle::operator<(TorrentHandle const& h) const +{ + return torrentHandle_ < h.torrentHandle_; +} }