4 #include "TorrentHandle.hpp"
9 #include <QSharedPointer>
10 #include <QWeakPointer>
12 #include <qtrapids/dbus.hpp>
14 #include <libtorrent/session.hpp>
15 #include <libtorrent/torrent_info.hpp>
16 #include <libtorrent/alert_types.hpp>
17 #include <libtorrent/error_code.hpp>
26 typedef QWeakPointer<QSettings> settings_weak_ptr;
28 class AlertWaiterThread;
29 typedef libtorrent::session session_t;
30 typedef libtorrent::session const* session_cptr;
31 typedef libtorrent::session_settings session_settings_t;
33 typedef libtorrent::add_torrent_params add_torrent_params_t;
34 typedef libtorrent::alert alert_t;
35 // typedef libtorrent::alert const* alert_cptr;
36 typedef libtorrent::torrent_alert torrent_alert_t;
37 typedef libtorrent::libtorrent_exception torrent_exception_t;
39 typedef QSharedPointer<TorrentHandle> TorrentHandlePtr;
40 typedef QHash<QString, TorrentHandlePtr > torrents_t;
41 typedef std::pair<int, int> ports_range_t;
46 class TorrentSession : public QObject
50 Q_CLASSINFO("D-Bus Interface", "com.ixonos.qtrapids");
53 TorrentSession(QObject *parent, QSettings *);
57 void addTorrent(const QString &path, const QString &save_path
58 , qtrapids::ParamsMap_t other_params);
59 void removeTorrent(const QString &hash);
60 void setOptions(qtrapids::ParamsMap_t options);
61 qtrapids::ParamsMap_t getOptions();
62 void terminateSession();
65 void alert(qtrapids::TorrentState info, qtrapids::ParamsMap_t other_info);
74 void addTorrent_(const QString &, const QString &, const qtrapids::ParamsMap_t &, bool);
77 AlertWaiterThread *alertWaiter_;
79 std::auto_ptr<ServerSettings> settings_;
80 std::auto_ptr<ServerDb> db_;
83 } // namespace qtrapids