diff --git a/Changelog b/Changelog index c6cce34e1..b94377a6d 100644 --- a/Changelog +++ b/Changelog @@ -9,6 +9,7 @@ - FEATURE: User can choose to include the protocol overhead in transfer limits - FEATURE: Torrents can be automatically rechecked on completion - FEATURE: If 2 torrents have the same hash, add new trackers to the existing torrent + - FEATURE: Trackers can be added from Web UI - COSMETIC: Improved style management * Mon Jan 18 2010 - Christophe Dumez - v2.1.0 diff --git a/src/httpconnection.cpp b/src/httpconnection.cpp index 61993c2e9..3ce963052 100644 --- a/src/httpconnection.cpp +++ b/src/httpconnection.cpp @@ -103,7 +103,7 @@ void HttpConnection::write() } QString HttpConnection::translateDocument(QString data) { - std::string contexts[] = {"TransferListFiltersWidget", "TransferListWidget", "PropertiesWidget", "GUI", "MainWindow", "HttpServer", "confirmDeletionDlg", "TrackerList", "TorrentFilesModel", "options_imp", "Preferences"}; + std::string contexts[] = {"TransferListFiltersWidget", "TransferListWidget", "PropertiesWidget", "GUI", "MainWindow", "HttpServer", "confirmDeletionDlg", "TrackerList", "TorrentFilesModel", "options_imp", "Preferences", "TrackersAdditionDlg"}; int i=0; bool found = false; do { @@ -118,7 +118,7 @@ QString HttpConnection::translateDocument(QString data) { do { translation = qApp->translate(contexts[context_index].c_str(), word.toLocal8Bit().data(), 0, QCoreApplication::UnicodeUTF8, 1); ++context_index; - }while(translation == word && context_index < 11); + }while(translation == word && context_index < 12); //qDebug("Translation is %s", translation.toUtf8().data()); data = data.replace(i, regex.matchedLength(), translation); i += translation.length(); @@ -317,6 +317,20 @@ void HttpConnection::respondCommand(QString command) } return; } + if(command == "addTrackers") { + QString hash = parser.post("hash"); + if(!hash.isEmpty()) { + QTorrentHandle h = BTSession->getTorrentHandle(hash); + if(h.is_valid() && h.has_metadata()) { + QString urls = parser.post("urls"); + QStringList list = urls.split('\n'); + foreach(QString url, list) { + announce_entry e(url.toStdString()); + h.add_tracker(e); + } + } + } + } if(command == "upload") { QByteArray torrentfile = parser.torrent(); diff --git a/src/webui.qrc b/src/webui.qrc index 62ffbf4e8..635fcc17f 100644 --- a/src/webui.qrc +++ b/src/webui.qrc @@ -2,6 +2,7 @@ webui/index.html webui/download.html + webui/addtrackers.html webui/upload.html webui/uploadframe.html webui/about.html diff --git a/src/webui/addtrackers.html b/src/webui/addtrackers.html new file mode 100644 index 000000000..64a5264b0 --- /dev/null +++ b/src/webui/addtrackers.html @@ -0,0 +1,32 @@ + + + + + _(Trackers addition dialog) + + + + + + +
+

_(List of trackers to add (one per line):)


+ +
+ _(Add) +
+ + diff --git a/src/webui/css/style.css b/src/webui/css/style.css index 992561017..116e4d21b 100644 --- a/src/webui/css/style.css +++ b/src/webui/css/style.css @@ -120,6 +120,11 @@ hr { height:100%; } +#trackersUrls { + width:90%; + height:100%; +} + #Filters ul { list-style-type: none; } diff --git a/src/webui/download.html b/src/webui/download.html index 9607b2cb9..911a2b332 100644 --- a/src/webui/download.html +++ b/src/webui/download.html @@ -9,6 +9,7 @@
+

_(Download Torrents from their URL or Magnet link)

_(Only one link per line)

_(Download)
diff --git a/src/webui/prop-trackers.html b/src/webui/prop-trackers.html index 4c7815fdc..fc01d9520 100644 --- a/src/webui/prop-trackers.html +++ b/src/webui/prop-trackers.html @@ -2,7 +2,7 @@ - + @@ -125,4 +125,22 @@ var trackersDynTable = new Class ({ tTable.setup($('trackersTable')); // Initial loading loadTrackersData(); + // Add trackers code + $('addTrackersPlus').addEvent('click', function addTrackerDlg() { + if(current_hash.length == 0) return; + new MochaUI.Window({ + id: 'trackersPage', + title: "_(Trackers addition dialog)", + loadMethod: 'iframe', + contentURL:'addtrackers.html?hash='+current_hash, + scrollbars: true, + resizable: false, + maximizable: false, + closable: true, + paddingVertical: 0, + paddingHorizontal: 0, + width: 500, + height: 250 + }); + });
_(URL)_(URL) _(Status) _(Peers) _(Message)