mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-29 16:04:21 +00:00
- Keep on working on trackers edition
This commit is contained in:
parent
db7c7bd21a
commit
3467d68020
@ -796,6 +796,19 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
@ -980,8 +993,8 @@
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>278</x>
|
||||
<y>253</y>
|
||||
<x>306</x>
|
||||
<y>556</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>96</x>
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "properties_imp.h"
|
||||
#include "misc.h"
|
||||
#include "PropListDelegate.h"
|
||||
#include <QInputDialog>
|
||||
|
||||
// Constructor
|
||||
properties::properties(QWidget *parent, torrent_handle h, QStringList trackerErrors): QDialog(parent), h(h){
|
||||
@ -44,6 +45,7 @@ properties::properties(QWidget *parent, torrent_handle h, QStringList trackerErr
|
||||
PropDelegate = new PropListDelegate();
|
||||
filesList->setItemDelegate(PropDelegate);
|
||||
connect(filesList, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(toggleSelectedState(const QModelIndex&)));
|
||||
connect(addTracker_button, SIGNAL(clicked()), this, SLOT(askForTracker()));
|
||||
// get Infos from torrent handle
|
||||
fileHash = QString(misc::toString(h.info_hash()).c_str());
|
||||
torrent_status torrentStatus = h.status();
|
||||
@ -55,16 +57,7 @@ properties::properties(QWidget *parent, torrent_handle h, QStringList trackerErr
|
||||
hash_lbl->setText(fileHash);
|
||||
comment_txt->setText(QString(torrentInfo.comment().c_str()));
|
||||
//Trackers
|
||||
QString tracker = QString(torrentStatus.current_tracker.c_str()).trimmed();
|
||||
if(!tracker.isEmpty()){
|
||||
trackerURL->setText(tracker);
|
||||
}else{
|
||||
trackerURL->setText(tr("None - Unreachable?"));
|
||||
}
|
||||
std::vector<announce_entry> trackers = torrentInfo.trackers();
|
||||
for(unsigned int i=0; i<trackers.size(); ++i){
|
||||
trackersURLS->addItem(QString(trackers[i].url.c_str()));
|
||||
}
|
||||
loadTrackers();
|
||||
// Session infos
|
||||
char tmp[MAX_CHAR_TMP];
|
||||
failed->setText(misc::friendlyUnit(torrentStatus.total_failed_bytes));
|
||||
@ -154,6 +147,45 @@ void properties::loadFilteredFiles(){
|
||||
}
|
||||
}
|
||||
|
||||
void properties::loadTrackers(){
|
||||
torrent_status torrentStatus = h.status();
|
||||
torrent_info torrentInfo = h.get_torrent_info();
|
||||
//Trackers
|
||||
std::vector<announce_entry> trackers = torrentInfo.trackers();
|
||||
trackersURLS->clear();
|
||||
for(unsigned int i=0; i<trackers.size(); ++i){
|
||||
trackersURLS->addItem(QString(trackers[i].url.c_str()));
|
||||
}
|
||||
QString tracker = QString(torrentStatus.current_tracker.c_str()).trimmed();
|
||||
if(!tracker.isEmpty()){
|
||||
trackerURL->setText(tracker);
|
||||
}else{
|
||||
trackerURL->setText(tr("None - Unreachable?"));
|
||||
}
|
||||
}
|
||||
|
||||
// Ask the user for a new tracker
|
||||
// and add it to the download list
|
||||
// if it is not already in it
|
||||
void properties::askForTracker(){
|
||||
bool ok;
|
||||
// Ask user for a new tracker
|
||||
QString trackerUrl = QInputDialog::getText(this, tr("New tracker"),
|
||||
tr("New tracker url:"), QLineEdit::Normal,
|
||||
"http://www.", &ok);
|
||||
if(!ok) return;
|
||||
// Checking if it already exists in the list
|
||||
torrent_info torrentInfo = h.get_torrent_info();
|
||||
// std::vector<announce_entry> trackers = torrentInfo.trackers();
|
||||
// for(unsigned int i=0; i<trackers.size(); ++i){
|
||||
// if(QString(trackers[i].url.c_str())
|
||||
// }
|
||||
torrentInfo.add_tracker(trackerUrl.toStdString(), trackersURLS->count());
|
||||
h.force_reannounce();
|
||||
// Reload Trackers
|
||||
loadTrackers();
|
||||
}
|
||||
|
||||
void properties::updateProgress(){
|
||||
std::vector<float> fp;
|
||||
try{
|
||||
|
@ -53,6 +53,8 @@ class properties : public QDialog, private Ui::properties{
|
||||
void updateProgress();
|
||||
void loadFilteredFiles();
|
||||
void setAllPiecesState(bool selected);
|
||||
void askForTracker();
|
||||
void loadTrackers();
|
||||
|
||||
signals:
|
||||
void changedFilteredFiles(torrent_handle h, bool compact_mode);
|
||||
|
Loading…
x
Reference in New Issue
Block a user