Code clean up

This commit is contained in:
Christophe Dumez 2012-03-17 17:23:45 +02:00
parent 84dbb76331
commit eb7a844099
2 changed files with 2 additions and 10 deletions

View file

@ -90,14 +90,6 @@ public:
return tmp.join("/");
}
static inline libtorrent::sha1_hash QStringToSha1(const QString& s) {
std::string str(s.toAscii().data());
std::istringstream i(str);
libtorrent::sha1_hash x;
i>>x;
return x;
}
static inline QString file_extension(const QString &filename) {
QString extension;
int point_index = filename.lastIndexOf(".");

View file

@ -779,7 +779,7 @@ void QBtSession::useAlternativeSpeedsLimit(bool alternative) {
// Return the torrent handle, given its hash
QTorrentHandle QBtSession::getTorrentHandle(const QString &hash) const{
return QTorrentHandle(s->find_torrent(misc::QStringToSha1(hash)));
return QTorrentHandle(s->find_torrent(QStringToSha1(hash)));
}
bool QBtSession::hasActiveTorrents() const {
@ -963,7 +963,7 @@ QTorrentHandle QBtSession::addMagnetUri(QString magnet_uri, bool resumed) {
Q_ASSERT(magnet_uri.startsWith("magnet:", Qt::CaseInsensitive));
// Check for duplicate torrent
if(s->find_torrent(misc::QStringToSha1(hash)).is_valid()) {
if(s->find_torrent(QStringToSha1(hash)).is_valid()) {
qDebug("/!\\ Torrent is already in download list");
addConsoleMessage(tr("'%1' is already in download list.", "e.g: 'xxx.avi' is already in download list.").arg(magnet_uri));
return h;