1 /***************************************************************************
2 * Copyright (C) 2010 by Ixonos Plc *
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. *
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. *
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 QBITTORRENTSESSION_H
19 #define QBITTORRENTSESSION_H
25 #include <libtorrent/session.hpp>
26 #include <libtorrent/torrent_info.hpp>
27 #include <libtorrent/alert_types.hpp>
29 #include "QTorrentHandle.h"
32 // Forward declarations and typedefs
33 class AlertWaiterThread;
34 typedef libtorrent::session TorrentSession;
35 typedef libtorrent::session_settings SessionSettings;
36 typedef libtorrent::add_torrent_params AddTorrentParams;
37 typedef libtorrent::alert Alert;
38 typedef libtorrent::torrent_alert TorrentAlert;
39 typedef libtorrent::sha1_hash Sha1Hash;
46 @author Lassi Väätämöinen <lassi.vaatamoinen@ixonos.com>
48 class QBittorrentSession : public QObject
51 // class BitTorrentSession;
54 QBittorrentSession(QObject *parent = 0);
55 ~QBittorrentSession();
57 /// @brief Add torrent to session.
58 qtrapids::QTorrentHandle addTorrent(AddTorrentParams const& params);
59 void removeTorrent(qtrapids::QTorrentHandle const& handle);
61 void setUploadRateLimit(int rate);
62 void setDownloadRateLimit(int rate);
63 int getUploadRateLimt() const;
64 int getDownloadRateLimit() const;
67 void alert(std::auto_ptr<Alert> al);
70 void on_alert(Alert const *al);
73 TorrentSession btSession_;
74 AlertWaiterThread *alertWaiter_;
78 } //namespace qtrapids