Browse Source

Show tracker tier in tracker list

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
984e6f9927
  1. 14
      src/properties/trackerlist.cpp
  2. 2
      src/properties/trackerlist.h

14
src/properties/trackerlist.cpp

@ -47,7 +47,6 @@
using namespace libtorrent; using namespace libtorrent;
TrackerList::TrackerList(PropertiesWidget *properties): QTreeWidget(), properties(properties) { TrackerList::TrackerList(PropertiesWidget *properties): QTreeWidget(), properties(properties) {
loadSettings();
// Graphical settings // Graphical settings
setRootIsDecorated(false); setRootIsDecorated(false);
setAllColumnsShowFocus(true); setAllColumnsShowFocus(true);
@ -58,20 +57,23 @@ TrackerList::TrackerList(PropertiesWidget *properties): QTreeWidget(), propertie
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showTrackerListMenu(QPoint))); connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showTrackerListMenu(QPoint)));
// Set header // Set header
QStringList header; QStringList header;
header << "#";
header << tr("URL"); header << tr("URL");
header << tr("Status"); header << tr("Status");
header << tr("Peers"); header << tr("Peers");
header << tr("Message"); header << tr("Message");
setHeaderItem(new QTreeWidgetItem(header)); setHeaderItem(new QTreeWidgetItem(header));
dht_item = new QTreeWidgetItem(QStringList("** "+tr("[DHT]")+" **")); dht_item = new QTreeWidgetItem(QStringList() << "" << "** "+tr("[DHT]")+" **");
insertTopLevelItem(0, dht_item); insertTopLevelItem(0, dht_item);
setRowColor(0, QColor("grey")); setRowColor(0, QColor("grey"));
pex_item = new QTreeWidgetItem(QStringList("** "+tr("[PeX]")+" **")); pex_item = new QTreeWidgetItem(QStringList() << "" << "** "+tr("[PeX]")+" **");
insertTopLevelItem(1, pex_item); insertTopLevelItem(1, pex_item);
setRowColor(1, QColor("grey")); setRowColor(1, QColor("grey"));
lsd_item = new QTreeWidgetItem(QStringList("** "+tr("[LSD]")+" **")); lsd_item = new QTreeWidgetItem(QStringList() << "" << "** "+tr("[LSD]")+" **");
insertTopLevelItem(2, lsd_item); insertTopLevelItem(2, lsd_item);
setRowColor(2, QColor("grey")); setRowColor(2, QColor("grey"));
loadSettings();
} }
TrackerList::~TrackerList() { TrackerList::~TrackerList() {
@ -240,6 +242,7 @@ 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;
@ -369,7 +372,8 @@ void TrackerList::showTrackerListMenu(QPoint) {
void TrackerList::loadSettings() { void TrackerList::loadSettings() {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
if(!header()->restoreState(settings.value("TorrentProperties/Trackers/TrackerListState").toByteArray())) { if(!header()->restoreState(settings.value("TorrentProperties/Trackers/TrackerListState").toByteArray())) {
setColumnWidth(0, 300); setColumnWidth(0, 30);
setColumnWidth(1, 300);
} }
} }

2
src/properties/trackerlist.h

@ -38,7 +38,7 @@
#include "qtorrenthandle.h" #include "qtorrenthandle.h"
#include "propertieswidget.h" #include "propertieswidget.h"
enum TrackerListColumn {COL_URL, COL_STATUS, COL_PEERS, COL_MSG}; enum TrackerListColumn {COL_TIER, COL_URL, COL_STATUS, COL_PEERS, COL_MSG};
#define NB_STICKY_ITEM 3 #define NB_STICKY_ITEM 3
class TrackerList: public QTreeWidget { class TrackerList: public QTreeWidget {

Loading…
Cancel
Save