mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-05 15:12:32 -06:00
Code clean up
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user