Browse Source

Correctly update tracker tier number in the trackers tab. Closes #1075.

adaptive-webui-19844
sledgehammer999 11 years ago
parent
commit
3d9f3eb1b3
  1. 9
      src/properties/trackerlist.cpp

9
src/properties/trackerlist.cpp

@ -141,6 +141,7 @@ void TrackerList::moveSelectionUp() {
h.replace_trackers(trackers); h.replace_trackers(trackers);
// Reannounce // Reannounce
h.force_reannounce(); h.force_reannounce();
loadTrackers();
} }
void TrackerList::moveSelectionDown() { void TrackerList::moveSelectionDown() {
@ -177,6 +178,7 @@ void TrackerList::moveSelectionDown() {
h.replace_trackers(trackers); h.replace_trackers(trackers);
// Reannounce // Reannounce
h.force_reannounce(); h.force_reannounce();
loadTrackers();
} }
void TrackerList::clear() { void TrackerList::clear() {
@ -252,13 +254,13 @@ void TrackerList::loadTrackers() {
QTreeWidgetItem *item = tracker_items.value(tracker_url, 0); QTreeWidgetItem *item = tracker_items.value(tracker_url, 0);
if (!item) { if (!item) {
item = new QTreeWidgetItem(); item = new QTreeWidgetItem();
item->setText(COL_TIER, QString::number(it->tier));
item->setText(COL_URL, tracker_url); item->setText(COL_URL, tracker_url);
addTopLevelItem(item); addTopLevelItem(item);
tracker_items[tracker_url] = item; tracker_items[tracker_url] = item;
} else { } else {
old_trackers_urls.removeOne(tracker_url); old_trackers_urls.removeOne(tracker_url);
} }
item->setText(COL_TIER, QString::number(it->tier));
TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url)); TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url));
QString error_message = data.last_message.trimmed(); QString error_message = data.last_message.trimmed();
if (it->verified) { if (it->verified) {
@ -292,10 +294,11 @@ void TrackerList::askForTrackers() {
if (!h.is_valid()) return; if (!h.is_valid()) return;
QStringList trackers = TrackersAdditionDlg::askForTrackers(h); QStringList trackers = TrackersAdditionDlg::askForTrackers(h);
if (!trackers.empty()) { if (!trackers.empty()) {
foreach (const QString& tracker, trackers) { for (int i=0; i<trackers.count(); i++) {
const QString& tracker = trackers[i];
if (tracker.trimmed().isEmpty()) continue; if (tracker.trimmed().isEmpty()) continue;
announce_entry url(tracker.toStdString()); announce_entry url(tracker.toStdString());
url.tier = 0; url.tier = (topLevelItemCount() - NB_STICKY_ITEM) + i;
h.add_tracker(url); h.add_tracker(url);
} }
// Reannounce to new trackers // Reannounce to new trackers

Loading…
Cancel
Save