+ qDebug() << "addTorrent: " << path << " save to " << save_path;
+ boost::intrusive_ptr<libtorrent::torrent_info> tiTmp
+ = new libtorrent::torrent_info
+ (boost::filesystem::path(path.toStdString()));
+ addParams.ti = tiTmp;
+
+ // save_path is the only mandatory parameter, rest are optional.
+ addParams.save_path = boost::filesystem::path(save_path.toStdString());
+ //addParams.storage_mode = libtorrent::storage_mode_allocate;
+
+ TorrentHandlePtr handle(new TorrentHandle(btSession_.add_torrent(addParams)));
+ QString hash = Hash2QStr(handle->hash());
+
+ TorrentState state;
+
+ state.hash = hash;
+ state.name = handle->name();
+ state.action = TorrentState::action_add;
+ state.state = handle->state();
+ state.progress = handle->progress() * torrent_progress_max;
+ state.down_rate = handle->downloadRate();
+ state.up_rate = handle->uploadRate();
+ state.seeds = handle->numSeeds();
+ state.leeches = handle->numLeeches();
+ state.total_size = handle->getTotalSize();
+
+ torrents_[hash] = handle;
+
+ emit alert(state, ParamsMap_t());
+}
+
+void TorrentSession::removeTorrent(const QString &hash)
+{
+ torrents_t::iterator p = torrents_.find(hash);
+
+ if (p == torrents_.end())
+ {
+ qDebug() << "Invalid request to remove torrent with hash " << hash;
+ return;