mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 04:24:23 +00:00
-FEATURE: Url seeds are now displayed in torrent properties and are editable
- Broke compatibility with Qt4.2. Will fix this a bit later (in the meantime, edit properties.ui)
This commit is contained in:
parent
676f30d9a1
commit
9cbab8d63e
@ -27,6 +27,7 @@
|
||||
- FEATURE: Improved a lot downloading from urls (using libcommoncpp2 instead of libcurl)
|
||||
- FEATURE: A search request can now be terminated by another
|
||||
- FEATURE: User is now warned when fast resume data was rejected
|
||||
- FEATURE: Url seeds are now displayed in torrent properties and are editable
|
||||
- I18N: Added Hungarian translation
|
||||
- BUGFIX: Progress of paused torrents is now correct on restart
|
||||
- BUGFIX: Progress column gets sorted on restart it is was during last execution
|
||||
|
2
TODO
2
TODO
@ -31,7 +31,6 @@
|
||||
// in v1.0.0 (partial) - WIP
|
||||
- Check storage st creation + hasher in torrent creation
|
||||
- test IPv6 support (How? Who uses IPv6?)
|
||||
- Display Url seeds in torrent properties and allow to edit them
|
||||
- Sorting in Download Status column should be smarter than just an alphabetical sort
|
||||
- Allow to scan multiple directories?
|
||||
- Fix all (or almost all) opened bugs in bug tracker
|
||||
@ -43,6 +42,7 @@
|
||||
- Windows port (Chris - Peerkoel)
|
||||
- Translations update
|
||||
- Optimize and cleanup code
|
||||
- Improve trackers edition code
|
||||
- Wait for some bug fixes in libtorrent :
|
||||
- upload/download limit per torrent
|
||||
- double free or corruption on exit
|
||||
|
@ -147,6 +147,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){
|
||||
connect(BTSession, SIGNAL(newDownloadedTorrent(QString, QString)), this, SLOT(processDownloadedFiles(QString, QString)));
|
||||
connect(BTSession, SIGNAL(downloadFromUrlFailure(QString, QString)), this, SLOT(handleDownloadFromUrlFailure(QString, QString)));
|
||||
connect(BTSession, SIGNAL(aboutToDownloadFromUrl(QString)), this, SLOT(displayDownloadingUrlInfos(QString)));
|
||||
connect(BTSession, SIGNAL(urlSeedProblem(QString, QString)), this, SLOT(addUrlSeedError(QString, QString)));
|
||||
// creating options
|
||||
options = new options_imp(this);
|
||||
connect(options, SIGNAL(status_changed(QString, bool)), this, SLOT(OptionsSaved(QString, bool)));
|
||||
@ -324,7 +325,11 @@ void GUI::setInfoBar(QString info, QString color){
|
||||
}
|
||||
|
||||
void GUI::addFastResumeRejectedAlert(QString name){
|
||||
setInfoBar(tr("Fast resume data was rejected for torrent %1, checking again...").arg(name));
|
||||
setInfoBar(tr("Fast resume data was rejected for torrent %1, checking again...").arg(name), "red");
|
||||
}
|
||||
|
||||
void GUI::addUrlSeedError(QString url, QString msg){
|
||||
setInfoBar(tr("Url seed lookup failed for url: %1, message: %2").arg(url).arg(msg), "red");
|
||||
}
|
||||
|
||||
void GUI::balloonClicked(){
|
||||
|
@ -190,6 +190,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
||||
void setTabText(int index, QString text);
|
||||
void updateFileSize(QString hash);
|
||||
void sortProgressColumnDelayed();
|
||||
void addUrlSeedError(QString url, QString msg);
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *);
|
||||
|
@ -163,6 +163,7 @@ void bittorrent::deleteTorrent(QString hash, bool permanent){
|
||||
torrentBackup.remove(hash+".trackers");
|
||||
torrentBackup.remove(hash+".speedLimits");
|
||||
torrentBackup.remove(hash+".ratio");
|
||||
torrentBackup.remove(hash+".urlseeds");
|
||||
// Remove it from ETAs hash tables
|
||||
ETAstats.take(hash);
|
||||
ETAs.take(hash);
|
||||
@ -213,6 +214,22 @@ void bittorrent::resumeTorrent(QString hash){
|
||||
}
|
||||
}
|
||||
|
||||
void bittorrent::loadWebSeeds(QString fileHash){
|
||||
QFile urlseeds_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+fileHash+".urlseeds");
|
||||
if(!urlseeds_file.open(QIODevice::ReadOnly | QIODevice::Text)) return;
|
||||
QByteArray urlseeds_lines = urlseeds_file.readAll();
|
||||
urlseeds_file.close();
|
||||
QList<QByteArray> url_seeds = urlseeds_lines.split('\n');
|
||||
QByteArray url_seed;
|
||||
torrent_handle h = getTorrentHandle(fileHash);
|
||||
torrent_info torrentInfo = h.get_torrent_info();
|
||||
foreach(url_seed, url_seeds){
|
||||
if(!url_seed.isEmpty())
|
||||
qDebug("Loading custom url seed: %s", (const char*)url_seed.data());
|
||||
torrentInfo.add_url_seed(misc::toString((const char*)url_seed.data()));
|
||||
}
|
||||
}
|
||||
|
||||
// Add a torrent to the bittorrent session
|
||||
void bittorrent::addTorrent(QString path, bool fromScanDir, bool onStartup, QString from_url){
|
||||
torrent_handle h;
|
||||
@ -311,6 +328,8 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, bool onStartup, QStr
|
||||
qDebug("Torrent hash is " + hash.toUtf8());
|
||||
// Load filtered files
|
||||
loadFilesPriorities(h);
|
||||
// Load custom url seeds
|
||||
loadWebSeeds(hash);
|
||||
// Load speed limit from hard drive
|
||||
loadTorrentSpeedLimits(hash);
|
||||
// Load ratio data
|
||||
@ -894,6 +913,9 @@ void bittorrent::readAlerts(){
|
||||
else if (fastresume_rejected_alert* p = dynamic_cast<fastresume_rejected_alert*>(a.get())){
|
||||
emit fastResumeDataRejected(QString(p->handle.name().c_str()));
|
||||
}
|
||||
else if (url_seed_alert* p = dynamic_cast<url_seed_alert*>(a.get())){
|
||||
emit urlSeedProblem(QString(p->url.c_str()), QString(p->msg().c_str()));
|
||||
}
|
||||
a = s->pop_alert();
|
||||
}
|
||||
}
|
||||
@ -951,6 +973,8 @@ void bittorrent::reloadTorrent(const torrent_handle &h){
|
||||
loadFilesPriorities(new_h);
|
||||
// Load speed limit from hard drive
|
||||
loadTorrentSpeedLimits(fileHash);
|
||||
// Load custom url seeds
|
||||
loadWebSeeds(fileHash);
|
||||
// Load ratio data
|
||||
loadDownloadUploadForTorrent(fileHash);
|
||||
// Pause torrent if it was paused last time
|
||||
|
@ -106,6 +106,7 @@ class bittorrent : public QObject{
|
||||
void saveDownloadUploadForTorrent(QString hash);
|
||||
void loadDownloadUploadForTorrent(QString hash);
|
||||
void HandleDownloadFailure(QString url, QString reason);
|
||||
void loadWebSeeds(QString fileHash);
|
||||
// Session configuration - Setters
|
||||
void setListeningPortsRange(std::pair<unsigned short, unsigned short> ports);
|
||||
void setMaxConnections(int maxConnec);
|
||||
@ -147,6 +148,7 @@ class bittorrent : public QObject{
|
||||
void peerBlocked(QString);
|
||||
void downloadFromUrlFailure(QString url, QString reason);
|
||||
void fastResumeDataRejected(QString name);
|
||||
void urlSeedProblem(QString url, QString msg);
|
||||
|
||||
};
|
||||
|
||||
|
@ -13,28 +13,46 @@
|
||||
<string>Torrent Properties</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="torrentContent" >
|
||||
<property name="currentIndex" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab" >
|
||||
<widget class="QWidget" name="tab_1" >
|
||||
<attribute name="title" >
|
||||
<string>Main infos</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="fileName" >
|
||||
<property name="maximumSize" >
|
||||
@ -81,28 +99,55 @@
|
||||
<string>Torrent infos</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="savePath_lbl" >
|
||||
<property name="minimumSize" >
|
||||
@ -189,12 +234,21 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="save_path" >
|
||||
<property name="minimumSize" >
|
||||
@ -276,9 +330,7 @@
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>0</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -304,28 +356,55 @@
|
||||
<string>Current session</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5" >
|
||||
<property name="font" >
|
||||
@ -402,12 +481,21 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="upTotal" >
|
||||
<property name="text" >
|
||||
@ -476,23 +564,30 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3" >
|
||||
<widget class="QWidget" name="tab_2" >
|
||||
<attribute name="title" >
|
||||
<string>Trackers</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>0</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -518,20 +613,38 @@
|
||||
<string>Tracker</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_9" >
|
||||
<property name="font" >
|
||||
@ -552,18 +665,25 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QListWidget" name="trackersURLS" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>0</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -572,12 +692,21 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
@ -648,12 +777,21 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
@ -724,12 +862,21 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_10" >
|
||||
<property name="font" >
|
||||
@ -759,12 +906,21 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="maximumSize" >
|
||||
@ -822,17 +978,118 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2" >
|
||||
<widget class="QWidget" name="tab_3" >
|
||||
<attribute name="title" >
|
||||
<string>Url seeds</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<widget class="QLabel" name="webSeeds_lbl" >
|
||||
<property name="font" >
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>The following web seeds are available for this torrent:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWebSeeds" />
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="deleteWS_button" >
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addWS_button" >
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</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>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_4" >
|
||||
<attribute name="title" >
|
||||
<string>Torrent content</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4" >
|
||||
<property name="font" >
|
||||
@ -906,12 +1163,21 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
|
@ -41,6 +41,8 @@ properties::properties(QWidget *parent, bittorrent *BTSession, torrent_handle &h
|
||||
removeTracker_button->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/remove.png")));
|
||||
lowerTracker_button->setIcon(QIcon(QString::fromUtf8(":/Icons/downarrow.png")));
|
||||
riseTracker_button->setIcon(QIcon(QString::fromUtf8(":/Icons/uparrow.png")));
|
||||
addWS_button->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/add.png")));
|
||||
deleteWS_button->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/remove.png")));
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
// Set Properties list model
|
||||
PropListModel = new QStandardItemModel(0,4);
|
||||
@ -61,6 +63,8 @@ properties::properties(QWidget *parent, bittorrent *BTSession, torrent_handle &h
|
||||
connect(actionNormal, SIGNAL(triggered()), this, SLOT(normalSelection()));
|
||||
connect(actionHigh, SIGNAL(triggered()), this, SLOT(highSelection()));
|
||||
connect(actionMaximum, SIGNAL(triggered()), this, SLOT(maximumSelection()));
|
||||
connect(addWS_button, SIGNAL(clicked()), this, SLOT(askWebSeed()));
|
||||
connect(deleteWS_button, SIGNAL(clicked()), this, SLOT(deleteSelectedUrlSeeds()));
|
||||
// get Infos from torrent handle
|
||||
fileHash = QString(misc::toString(h.info_hash()).c_str());
|
||||
torrent_status torrentStatus = h.status();
|
||||
@ -112,6 +116,9 @@ properties::properties(QWidget *parent, bittorrent *BTSession, torrent_handle &h
|
||||
PropListModel->setData(PropListModel->index(row, PROGRESS), QVariant((double)fp[i]));
|
||||
}
|
||||
loadPiecesPriorities();
|
||||
// List web seeds
|
||||
loadWebSeedsFromFile();
|
||||
loadWebSeeds();
|
||||
// Incremental download
|
||||
if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+fileHash+".incremental")){
|
||||
incrementalDownload->setChecked(true);
|
||||
@ -130,6 +137,27 @@ properties::~properties(){
|
||||
delete PropListModel;
|
||||
}
|
||||
|
||||
void properties::loadWebSeeds(){
|
||||
QString url_seed;
|
||||
torrent_info torrentInfo = h.get_torrent_info();
|
||||
std::vector<std::string> url_seeds = torrentInfo.url_seeds();
|
||||
unsigned int nbSeeds = url_seeds.size();
|
||||
// Clear url seeds list
|
||||
listWebSeeds->clear();
|
||||
// Add hard coded url seeds
|
||||
for(unsigned int i=0; i<nbSeeds; ++i){
|
||||
url_seed = QString(url_seeds[i].c_str());
|
||||
if(manualUrlSeeds.indexOf(url_seed) == -1)
|
||||
qDebug("Added hard-coded url seed to list: %s", (const char*)url_seed.toUtf8());
|
||||
listWebSeeds->addItem(url_seed);
|
||||
}
|
||||
// Add manually added url seeds
|
||||
foreach(url_seed, manualUrlSeeds){
|
||||
listWebSeeds->addItem(url_seed);
|
||||
qDebug("Added custom url seed to list: %s", (const char*)url_seed.toUtf8());
|
||||
}
|
||||
}
|
||||
|
||||
void properties::loadPiecesPriorities(){
|
||||
torrent_info torrentInfo = h.get_torrent_info();
|
||||
unsigned int nbFiles = torrentInfo.num_files();
|
||||
@ -238,6 +266,28 @@ void properties::loadTrackers(){
|
||||
}
|
||||
}
|
||||
|
||||
void properties::askWebSeed(){
|
||||
bool ok;
|
||||
// Ask user for a new url seed
|
||||
QString url_seed = QInputDialog::getText(this, tr("New url seed"),
|
||||
tr("New url seed:"), QLineEdit::Normal,
|
||||
"http://www.", &ok);
|
||||
if(!ok) return;
|
||||
torrent_info torrentInfo = h.get_torrent_info();
|
||||
qDebug("Adding %s web seed", (const char*)url_seed.toUtf8());
|
||||
if(manualUrlSeeds.indexOf(url_seed) != -1) {
|
||||
QMessageBox::warning(this, tr("qBittorrent"),
|
||||
tr("This url seed is already in the list."),
|
||||
QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
manualUrlSeeds << url_seed;
|
||||
torrentInfo.add_url_seed(url_seed.toStdString());
|
||||
saveWebSeeds();
|
||||
// Refresh the seeds list
|
||||
loadWebSeeds();
|
||||
}
|
||||
|
||||
// Ask the user for a new tracker
|
||||
// and add it to the download list
|
||||
// if it is not already in it
|
||||
@ -259,18 +309,44 @@ void properties::askForTracker(){
|
||||
loadTrackers();
|
||||
}
|
||||
|
||||
void properties::deleteSelectedUrlSeeds(){
|
||||
QList<QListWidgetItem *> selectedItems;
|
||||
selectedItems = listWebSeeds->selectedItems();
|
||||
QListWidgetItem *item;
|
||||
bool error = false;
|
||||
foreach(item, selectedItems){
|
||||
QString url_seed = item->text();
|
||||
int index = manualUrlSeeds.indexOf(url_seed);
|
||||
if(index != -1){
|
||||
manualUrlSeeds.removeAt(index);
|
||||
qDebug("Removed an url seeds from manualUrlSeeds list");
|
||||
}else{
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
// Save them to disk
|
||||
saveWebSeeds();
|
||||
// Refresh list
|
||||
loadWebSeeds();
|
||||
if(error){
|
||||
QMessageBox::warning(this, tr("qBittorrent"),
|
||||
tr("Hard-coded url seeds cannot be deleted."),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
}
|
||||
|
||||
void properties::deleteSelectedTrackers(){
|
||||
std::vector<announce_entry> trackers = h.trackers();
|
||||
QList<QListWidgetItem *> selectedItems;
|
||||
selectedItems = trackersURLS->selectedItems();
|
||||
QListWidgetItem *item;
|
||||
unsigned int nbTrackers = trackers.size();
|
||||
if(nbTrackers == (unsigned int) selectedItems.size()){
|
||||
QMessageBox::warning(this, tr("qBittorrent"),
|
||||
tr("Trackers list can't be empty."),
|
||||
QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
unsigned int nbTrackers = trackers.size();
|
||||
if(nbTrackers == (unsigned int) selectedItems.size()){
|
||||
QMessageBox::warning(this, tr("qBittorrent"),
|
||||
tr("Trackers list can't be empty."),
|
||||
QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
foreach(item, selectedItems){
|
||||
QString url = item->text();
|
||||
for(unsigned int i=0; i<nbTrackers; ++i){
|
||||
@ -401,6 +477,34 @@ void properties::on_okButton_clicked(){
|
||||
close();
|
||||
}
|
||||
|
||||
void properties::loadWebSeedsFromFile(){
|
||||
QFile urlseeds_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+fileHash+".urlseeds");
|
||||
if(!urlseeds_file.open(QIODevice::ReadOnly | QIODevice::Text)) return;
|
||||
QByteArray urlseeds_lines = urlseeds_file.readAll();
|
||||
urlseeds_file.close();
|
||||
QList<QByteArray> url_seeds = urlseeds_lines.split('\n');
|
||||
manualUrlSeeds.clear();
|
||||
QByteArray url_seed;
|
||||
foreach(url_seed, url_seeds){
|
||||
if(!url_seed.isEmpty())
|
||||
manualUrlSeeds << url_seed;
|
||||
}
|
||||
}
|
||||
|
||||
void properties::saveWebSeeds(){
|
||||
QFile urlseeds_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+fileHash+".urlseeds");
|
||||
if(!urlseeds_file.open(QIODevice::WriteOnly | QIODevice::Text)){
|
||||
std::cerr << "Error: Could not save url seeds\n";
|
||||
return;
|
||||
}
|
||||
QString url_seed;
|
||||
foreach(url_seed, manualUrlSeeds){
|
||||
urlseeds_file.write(QByteArray((const char*)(url_seed+"\n").toUtf8()));
|
||||
}
|
||||
urlseeds_file.close();
|
||||
qDebug("url seeds were saved");
|
||||
}
|
||||
|
||||
void properties::savePiecesPriorities(){
|
||||
if(!changedFilteredfiles) return;
|
||||
qDebug("Saving pieces priorities");
|
||||
|
@ -43,6 +43,7 @@ class properties : public QDialog, private Ui::properties{
|
||||
bool has_filtered_files;
|
||||
bool changedFilteredfiles;
|
||||
bittorrent *BTSession;
|
||||
QStringList manualUrlSeeds;
|
||||
|
||||
protected slots:
|
||||
void on_okButton_clicked();
|
||||
@ -62,6 +63,11 @@ class properties : public QDialog, private Ui::properties{
|
||||
void normalSelection();
|
||||
void highSelection();
|
||||
void maximumSelection();
|
||||
void loadWebSeeds();
|
||||
void askWebSeed();
|
||||
void saveWebSeeds();
|
||||
void loadWebSeedsFromFile();
|
||||
void deleteSelectedUrlSeeds();
|
||||
|
||||
signals:
|
||||
void filteredFilesChanged(QString fileHash);
|
||||
|
Loading…
x
Reference in New Issue
Block a user