mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
- Use torrent addition dialog for Magnet URIs too
This commit is contained in:
parent
a1dd724220
commit
ba0c7334b7
5 changed files with 132 additions and 43 deletions
13
src/misc.h
13
src/misc.h
|
@ -41,6 +41,7 @@
|
|||
#include <QList>
|
||||
#include <QPair>
|
||||
#include <QThread>
|
||||
#include <QUrl>
|
||||
#include <ctime>
|
||||
#include <QDateTime>
|
||||
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
||||
|
@ -435,6 +436,18 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
static QString magnetUriToName(QString magnet_uri) {
|
||||
QString name = "";
|
||||
QRegExp regHex("dn=([^&]+)");
|
||||
int pos = regHex.indexIn(magnet_uri);
|
||||
if(pos > -1) {
|
||||
QString found = regHex.cap(1);
|
||||
// URL decode
|
||||
name = QUrl::fromPercentEncoding(found.toLocal8Bit()).replace("+", " ");
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
static QString magnetUriToHash(QString magnet_uri) {
|
||||
QString hash = "";
|
||||
QRegExp regHex("urn:btih:([0-9A-Za-z]+)");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue