mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-29 13:58:51 +03:00
Fixed downloadFromUrl
This commit is contained in:
parent
e2427a4ce2
commit
b1ed521d6b
4 changed files with 20 additions and 17 deletions
|
@ -13,8 +13,8 @@
|
||||||
<ignoreparts/>
|
<ignoreparts/>
|
||||||
<projectdirectory>.</projectdirectory>
|
<projectdirectory>.</projectdirectory>
|
||||||
<absoluteprojectpath>false</absoluteprojectpath>
|
<absoluteprojectpath>false</absoluteprojectpath>
|
||||||
<description></description>
|
<description/>
|
||||||
<defaultencoding></defaultencoding>
|
<defaultencoding/>
|
||||||
<versioncontrol>kdevsubversion</versioncontrol>
|
<versioncontrol>kdevsubversion</versioncontrol>
|
||||||
</general>
|
</general>
|
||||||
<kdevfileview>
|
<kdevfileview>
|
||||||
|
@ -72,11 +72,11 @@
|
||||||
</kdevdoctreeview>
|
</kdevdoctreeview>
|
||||||
<kdevdebugger>
|
<kdevdebugger>
|
||||||
<general>
|
<general>
|
||||||
<dbgshell></dbgshell>
|
<dbgshell/>
|
||||||
<gdbpath></gdbpath>
|
<gdbpath/>
|
||||||
<configGdbScript></configGdbScript>
|
<configGdbScript/>
|
||||||
<runShellScript></runShellScript>
|
<runShellScript/>
|
||||||
<runGdbScript></runGdbScript>
|
<runGdbScript/>
|
||||||
<breakonloadinglibs>true</breakonloadinglibs>
|
<breakonloadinglibs>true</breakonloadinglibs>
|
||||||
<separatetty>false</separatetty>
|
<separatetty>false</separatetty>
|
||||||
<floatingtoolbar>false</floatingtoolbar>
|
<floatingtoolbar>false</floatingtoolbar>
|
||||||
|
@ -154,8 +154,8 @@
|
||||||
<run>
|
<run>
|
||||||
<directoryradio>executable</directoryradio>
|
<directoryradio>executable</directoryradio>
|
||||||
<mainprogram>/home/chris/qbittorrent_svn/trunk/src/qbittorrent</mainprogram>
|
<mainprogram>/home/chris/qbittorrent_svn/trunk/src/qbittorrent</mainprogram>
|
||||||
<programargs></programargs>
|
<programargs/>
|
||||||
<globaldebugarguments></globaldebugarguments>
|
<globaldebugarguments/>
|
||||||
<globalcwd>/home/chris/qbittorrent_svn/trunk</globalcwd>
|
<globalcwd>/home/chris/qbittorrent_svn/trunk</globalcwd>
|
||||||
<useglobalprogram>true</useglobalprogram>
|
<useglobalprogram>true</useglobalprogram>
|
||||||
<terminal>false</terminal>
|
<terminal>false</terminal>
|
||||||
|
@ -169,7 +169,7 @@
|
||||||
<runmultiplejobs>false</runmultiplejobs>
|
<runmultiplejobs>false</runmultiplejobs>
|
||||||
<numberofjobs>1</numberofjobs>
|
<numberofjobs>1</numberofjobs>
|
||||||
<dontact>false</dontact>
|
<dontact>false</dontact>
|
||||||
<makebin></makebin>
|
<makebin/>
|
||||||
<prio>0</prio>
|
<prio>0</prio>
|
||||||
<envvars/>
|
<envvars/>
|
||||||
</make>
|
</make>
|
||||||
|
@ -186,7 +186,7 @@
|
||||||
</filetemplates>
|
</filetemplates>
|
||||||
</cppsupportpart>
|
</cppsupportpart>
|
||||||
<ctagspart>
|
<ctagspart>
|
||||||
<customArguments></customArguments>
|
<customArguments/>
|
||||||
<customTagfilePath>/home/chris/qbittorrent_svn/trunk/tags</customTagfilePath>
|
<customTagfilePath>/home/chris/qbittorrent_svn/trunk/tags</customTagfilePath>
|
||||||
<activeTagsFiles/>
|
<activeTagsFiles/>
|
||||||
</ctagspart>
|
</ctagspart>
|
||||||
|
|
|
@ -1618,5 +1618,5 @@ void GUI::OptionsSaved(const QString& info, bool deleteOptions){
|
||||||
// an url
|
// an url
|
||||||
void GUI::on_actionDownload_from_URL_triggered(){
|
void GUI::on_actionDownload_from_URL_triggered(){
|
||||||
downloadFromURLDialog = new downloadFromURL(this);
|
downloadFromURLDialog = new downloadFromURL(this);
|
||||||
connect(downloadFromURLDialog, SIGNAL(downloadFinished(QString, QString, int, QString)), &BTSession, SLOT(processDownloadedFile(QString, QString, int, QString)));
|
connect(downloadFromURLDialog, SIGNAL(urlsReadyToBeDownloaded(const QStringList&)), &BTSession, SLOT(downloadFromURLList(const QStringList&)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -408,7 +408,7 @@ void bittorrent::disableDHT(){
|
||||||
// and ask torrent_handle to consider them
|
// and ask torrent_handle to consider them
|
||||||
void bittorrent::loadFilteredFiles(torrent_handle &h){
|
void bittorrent::loadFilteredFiles(torrent_handle &h){
|
||||||
torrent_info torrentInfo = h.get_torrent_info();
|
torrent_info torrentInfo = h.get_torrent_info();
|
||||||
unsigned int nbTorrents = torrentInfo.num_files();
|
unsigned int nbFiles = torrentInfo.num_files();
|
||||||
if(!h.is_valid()){
|
if(!h.is_valid()){
|
||||||
qDebug("/!\\ Error: Invalid handle");
|
qDebug("/!\\ Error: Invalid handle");
|
||||||
return;
|
return;
|
||||||
|
@ -417,20 +417,22 @@ void bittorrent::loadFilteredFiles(torrent_handle &h){
|
||||||
QFile pieces_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+fileHash+".priorities");
|
QFile pieces_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+fileHash+".priorities");
|
||||||
// Read saved file
|
// Read saved file
|
||||||
if(!pieces_file.open(QIODevice::ReadOnly | QIODevice::Text)){
|
if(!pieces_file.open(QIODevice::ReadOnly | QIODevice::Text)){
|
||||||
|
qDebug("* Error: Couldn't open priorities file");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QByteArray pieces_priorities = pieces_file.readAll();
|
QByteArray pieces_priorities = pieces_file.readAll();
|
||||||
pieces_file.close();
|
pieces_file.close();
|
||||||
QList<QByteArray> pieces_priorities_list = pieces_priorities.split('\n');
|
QList<QByteArray> pieces_priorities_list = pieces_priorities.split('\n');
|
||||||
if((unsigned int)pieces_priorities_list.size() != nbTorrents+1){
|
if((unsigned int)pieces_priorities_list.size() != nbFiles+1){
|
||||||
std::cerr << "Error: Corrupted pieces file\n";
|
std::cerr << "* Error: Corrupted priorities file\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for(unsigned int i=0; i<nbTorrents; ++i){
|
for(unsigned int i=0; i<nbFiles; ++i){
|
||||||
int priority = pieces_priorities_list.at(i).toInt();
|
int priority = pieces_priorities_list.at(i).toInt();
|
||||||
if( priority < 0 || priority > 7){
|
if( priority < 0 || priority > 7){
|
||||||
priority = 1;
|
priority = 1;
|
||||||
}
|
}
|
||||||
|
qDebug("Setting piece piority to %d", priority);
|
||||||
h.piece_priority(i, priority);
|
h.piece_priority(i, priority);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -836,6 +838,7 @@ void bittorrent::processDownloadedFile(const QString& url, const QString& file_p
|
||||||
|
|
||||||
void bittorrent::downloadFromURLList(const QStringList& url_list){
|
void bittorrent::downloadFromURLList(const QStringList& url_list){
|
||||||
QString url;
|
QString url;
|
||||||
|
qDebug("DownloadFromUrlList");
|
||||||
foreach(url, url_list){
|
foreach(url, url_list){
|
||||||
downloadFromUrl(url);
|
downloadFromUrl(url);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,6 @@ class downloadFromURL : public QDialog, private Ui::downloadFromURL{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
icon_lbl->setPixmap(QPixmap(QString::fromUtf8(":/Icons/skin/url.png")));
|
icon_lbl->setPixmap(QPixmap(QString::fromUtf8(":/Icons/skin/url.png")));
|
||||||
connect(this, SIGNAL(urlsReadyToBeDownloaded(const QStringList&)), parent, SLOT(downloadFromURLList(const QStringList&)));
|
|
||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +64,7 @@ class downloadFromURL : public QDialog, private Ui::downloadFromURL{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
emit urlsReadyToBeDownloaded(url_list_cleaned);
|
emit urlsReadyToBeDownloaded(url_list_cleaned);
|
||||||
|
qDebug("Emitted urlsReadytobedownloaded signal");
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue