From 025f4f9737680940fa2e5fca9981439a50e27d46 Mon Sep 17 00:00:00 2001 From: Nick Tiskov Date: Sun, 3 Mar 2013 17:22:11 +0400 Subject: [PATCH 1/4] Support tracker mirrors in torrent creator --- src/torrentcreator/torrentcreatorthread.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/torrentcreator/torrentcreatorthread.cpp b/src/torrentcreator/torrentcreatorthread.cpp index 6bbaa8472..2179def46 100644 --- a/src/torrentcreator/torrentcreatorthread.cpp +++ b/src/torrentcreator/torrentcreatorthread.cpp @@ -113,8 +113,13 @@ void TorrentCreatorThread::run() { foreach (const QString &seed, url_seeds) { t.add_url_seed(seed.trimmed().toStdString()); } + qint32 tier = 0; foreach (const QString &tracker, trackers) { - t.add_tracker(tracker.trimmed().toStdString()); + if (tracker.isEmpty()) { + ++tier; + continue; + } + t.add_tracker(tracker.trimmed().toStdString(), tier); } if (abort) return; // calculate the hash for all pieces From dec726c0aeafd6c2643ee42bc805cd5ee57f70f0 Mon Sep 17 00:00:00 2001 From: Nick Tiskov Date: Sun, 3 Mar 2013 20:03:11 +0400 Subject: [PATCH 2/4] Add tooltip in torrent creation dialog as a hint on tracker tiers --- src/torrentcreator/createtorrent.ui | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/torrentcreator/createtorrent.ui b/src/torrentcreator/createtorrent.ui index 7d13dff05..9a31ae4e0 100644 --- a/src/torrentcreator/createtorrent.ui +++ b/src/torrentcreator/createtorrent.ui @@ -123,6 +123,9 @@ 0 + + You can separate tracker tiers with newlines + false From 964b3214587abc96f1774832df94ada4fbf726c4 Mon Sep 17 00:00:00 2001 From: Nick Tiskov Date: Sun, 3 Mar 2013 20:04:17 +0400 Subject: [PATCH 3/4] Ignore multiple sequential newlines in torrent creator --- src/torrentcreator/torrentcreatorthread.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/torrentcreator/torrentcreatorthread.cpp b/src/torrentcreator/torrentcreatorthread.cpp index 2179def46..84553b50d 100644 --- a/src/torrentcreator/torrentcreatorthread.cpp +++ b/src/torrentcreator/torrentcreatorthread.cpp @@ -114,12 +114,17 @@ void TorrentCreatorThread::run() { t.add_url_seed(seed.trimmed().toStdString()); } qint32 tier = 0; + bool newline = false; foreach (const QString &tracker, trackers) { if (tracker.isEmpty()) { + if (newline) + continue; ++tier; + newline = true; continue; } t.add_tracker(tracker.trimmed().toStdString(), tier); + newline = false; } if (abort) return; // calculate the hash for all pieces From a8f29e51c594178350a7f5050222f8fea0a713f2 Mon Sep 17 00:00:00 2001 From: Nick Tiskov Date: Sun, 10 Mar 2013 20:58:23 +0400 Subject: [PATCH 4/4] Cosmetic fixes to torrent creator --- src/torrentcreator/createtorrent.ui | 2 +- src/torrentcreator/torrentcreatorthread.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/torrentcreator/createtorrent.ui b/src/torrentcreator/createtorrent.ui index 9a31ae4e0..cbda85e75 100644 --- a/src/torrentcreator/createtorrent.ui +++ b/src/torrentcreator/createtorrent.ui @@ -124,7 +124,7 @@ - You can separate tracker tiers with newlines + You can separate tracker tiers / groups with an empty line. false diff --git a/src/torrentcreator/torrentcreatorthread.cpp b/src/torrentcreator/torrentcreatorthread.cpp index 84553b50d..ee238899e 100644 --- a/src/torrentcreator/torrentcreatorthread.cpp +++ b/src/torrentcreator/torrentcreatorthread.cpp @@ -113,7 +113,7 @@ void TorrentCreatorThread::run() { foreach (const QString &seed, url_seeds) { t.add_url_seed(seed.trimmed().toStdString()); } - qint32 tier = 0; + int tier = 0; bool newline = false; foreach (const QString &tracker, trackers) { if (tracker.isEmpty()) {