- Update trackers edition code

- current tracker is now updated regularly when properties are displayed
This commit is contained in:
Christophe Dumez 2007-07-27 14:43:42 +00:00
parent f839d6fe41
commit 3e36cd3c46
3 changed files with 34 additions and 9 deletions

View file

@ -31,6 +31,9 @@
#include <QPair>
#include <QThread>
#include <libtorrent/torrent_info.hpp>
using namespace libtorrent;
#define MAX_CHAR_TMP 128
/* Miscellaneaous functions that can be useful */
@ -144,6 +147,13 @@ class misc : public QObject{
return QString();
}
static void fixTrackersTiers(std::vector<announce_entry> trackers){
unsigned int nbTrackers = trackers.size();
for(unsigned int i=0; i<nbTrackers; ++i){
trackers[i].tier = i;
}
}
// Insertion sort, used instead of bubble sort because it is
// approx. 5 times faster.
template <class T> static void insertSort(QList<QPair<int, T> > &list, const QPair<int, T>& value, Qt::SortOrder sortOrder){