mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-21 05:43:32 -07:00
Code clean up
This commit is contained in:
parent
84dbb76331
commit
eb7a844099
2 changed files with 2 additions and 10 deletions
|
@ -90,14 +90,6 @@ public:
|
||||||
return tmp.join("/");
|
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) {
|
static inline QString file_extension(const QString &filename) {
|
||||||
QString extension;
|
QString extension;
|
||||||
int point_index = filename.lastIndexOf(".");
|
int point_index = filename.lastIndexOf(".");
|
||||||
|
|
|
@ -779,7 +779,7 @@ void QBtSession::useAlternativeSpeedsLimit(bool alternative) {
|
||||||
|
|
||||||
// Return the torrent handle, given its hash
|
// Return the torrent handle, given its hash
|
||||||
QTorrentHandle QBtSession::getTorrentHandle(const QString &hash) const{
|
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 {
|
bool QBtSession::hasActiveTorrents() const {
|
||||||
|
@ -963,7 +963,7 @@ QTorrentHandle QBtSession::addMagnetUri(QString magnet_uri, bool resumed) {
|
||||||
Q_ASSERT(magnet_uri.startsWith("magnet:", Qt::CaseInsensitive));
|
Q_ASSERT(magnet_uri.startsWith("magnet:", Qt::CaseInsensitive));
|
||||||
|
|
||||||
// Check for duplicate torrent
|
// 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");
|
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));
|
addConsoleMessage(tr("'%1' is already in download list.", "e.g: 'xxx.avi' is already in download list.").arg(magnet_uri));
|
||||||
return h;
|
return h;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue