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 @@ @@ -47,7 +47,6 @@
using namespace libtorrent;
TrackerList::TrackerList(PropertiesWidget *properties): QTreeWidget(), properties(properties) {
loadSettings();
// Graphical settings
setRootIsDecorated(false);
setAllColumnsShowFocus(true);
@ -58,20 +57,23 @@ TrackerList::TrackerList(PropertiesWidget *properties): QTreeWidget(), propertie @@ -58,20 +57,23 @@ TrackerList::TrackerList(PropertiesWidget *properties): QTreeWidget(), propertie
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showTrackerListMenu(QPoint)));
// Set header
QStringList header;
header << "#";
header << tr("URL");
header << tr("Status");
header << tr("Peers");
header << tr("Message");
setHeaderItem(new QTreeWidgetItem(header));
dht_item = new QTreeWidgetItem(QStringList("** "+tr("[DHT]")+" **"));
dht_item = new QTreeWidgetItem(QStringList() << "" << "** "+tr("[DHT]")+" **");
insertTopLevelItem(0, dht_item);
setRowColor(0, QColor("grey"));
pex_item = new QTreeWidgetItem(QStringList("** "+tr("[PeX]")+" **"));
pex_item = new QTreeWidgetItem(QStringList() << "" << "** "+tr("[PeX]")+" **");
insertTopLevelItem(1, pex_item);
setRowColor(1, QColor("grey"));
lsd_item = new QTreeWidgetItem(QStringList("** "+tr("[LSD]")+" **"));
lsd_item = new QTreeWidgetItem(QStringList() << "" << "** "+tr("[LSD]")+" **");
insertTopLevelItem(2, lsd_item);
setRowColor(2, QColor("grey"));
loadSettings();
}
TrackerList::~TrackerList() {
@ -240,6 +242,7 @@ void TrackerList::loadTrackers() { @@ -240,6 +242,7 @@ void TrackerList::loadTrackers() {
QTreeWidgetItem *item = tracker_items.value(tracker_url, 0);
if(!item) {
item = new QTreeWidgetItem();
item->setText(COL_TIER, QString::number(it->tier));
item->setText(COL_URL, tracker_url);
addTopLevelItem(item);
tracker_items[tracker_url] = item;
@ -369,7 +372,8 @@ void TrackerList::showTrackerListMenu(QPoint) { @@ -369,7 +372,8 @@ void TrackerList::showTrackerListMenu(QPoint) {
void TrackerList::loadSettings() {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
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 @@ @@ -38,7 +38,7 @@
#include "qtorrenthandle.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
class TrackerList: public QTreeWidget {

Loading…
Cancel
Save