|
|
@ -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); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|