From: lvaatamoinen Date: Tue, 15 Dec 2009 14:04:14 +0000 (+0000) Subject: - Uncommitted files X-Git-Url: http://git.maemo.org/git/?p=qtrapids;a=commitdiff_plain;h=e4db38838b22aa30b506d4a149b4760ba483acb2 - Uncommitted files git-svn-id: file:///svnroot/qtrapids/trunk@54 42ac0dd5-4c8c-4c71-bb3e-ecdfe252ffda --- diff --git a/src/engine/QBittorrentSession.cpp b/src/engine/QBittorrentSession.cpp index 5084f5d..d7e2349 100644 --- a/src/engine/QBittorrentSession.cpp +++ b/src/engine/QBittorrentSession.cpp @@ -35,6 +35,11 @@ QBittorrentSession::QBittorrentSession(QObject *parent): alertWaiter_->allAlerts(); connect(alertWaiter_, SIGNAL(alert(Alert const*)), this, SLOT(on_alert(Alert const*))); alertWaiter_->start(); + + SessionSettings settings; + settings.ignore_limits_on_local_network = false; + btSession_.set_settings(settings); + } @@ -59,6 +64,33 @@ void QBittorrentSession::removeTorrent(qtrapids::QTorrentHandle const& handle) } +void QBittorrentSession::setUploadRateLimit(int rate) +{ + btSession_.set_upload_rate_limit(rate); +} + + +void QBittorrentSession::setDownloadrateLimit(int rate) +{ + btSession_.set_download_rate_limit(rate); +} + + +int QBittorrentSession::getUploadRateLimt() const +{ + return btSession_.upload_rate_limit(); +} + + +int QBittorrentSession::getDownloadRateLimit() const +{ + return btSession_.download_rate_limit(); +} + + + + + // ========================== SLOTS ============================== /// @TODO This function is called when AlertWaiterThread emits alert() /// If connection is direct, as it is now, we need to use QMutex here (if necessary?) @@ -67,8 +99,8 @@ void QBittorrentSession::on_alert(Alert const *al) { #ifdef QTRAPIDS_DEBUG - if (al) - qDebug() << "on_alert():" << QString::fromStdString(al->message()); + //if (al) + // qDebug() << "on_alert():" << QString::fromStdString(al->message()); #endif std::auto_ptr alertPtr = btSession_.pop_alert(); diff --git a/src/engine/QBittorrentSession.h b/src/engine/QBittorrentSession.h index ac2fa8c..badae43 100644 --- a/src/engine/QBittorrentSession.h +++ b/src/engine/QBittorrentSession.h @@ -34,6 +34,7 @@ // Forward declarations and typedefs class AlertWaiterThread; typedef libtorrent::session TorrentSession; +typedef libtorrent::session_settings SessionSettings; typedef libtorrent::add_torrent_params AddTorrentParams; typedef libtorrent::alert Alert; typedef libtorrent::torrent_alert TorrentAlert; @@ -59,6 +60,11 @@ public: qtrapids::QTorrentHandle addTorrent(AddTorrentParams const& params); void removeTorrent(qtrapids::QTorrentHandle const& handle); + void setUploadRateLimit(int rate); + void setDownloadrateLimit(int rate); + int getUploadRateLimt() const; + int getDownloadRateLimit() const; + signals: void alert(std::auto_ptr al);