1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-22 20:44:15 +00:00

Fix torrent import

This commit is contained in:
Christophe Dumez 2011-01-12 17:12:24 +00:00
parent e931209860
commit bf5c1951ba

View File

@ -184,7 +184,10 @@ void TorrentImportDlg::on_browseContentBtn_clicked()
void TorrentImportDlg::on_importBtn_clicked() void TorrentImportDlg::on_importBtn_clicked()
{ {
close(); saveSettings();
// Has to be accept() and not close()
// or the torrent won't be imported
accept();
} }
QString TorrentImportDlg::getTorrentPath() const QString TorrentImportDlg::getTorrentPath() const
@ -199,15 +202,21 @@ QString TorrentImportDlg::getContentPath() const
void TorrentImportDlg::importTorrent() void TorrentImportDlg::importTorrent()
{ {
qDebug() << Q_FUNC_INFO << "ENTER";
TorrentImportDlg dlg; TorrentImportDlg dlg;
if(dlg.exec()) { if(dlg.exec()) {
qDebug() << "Loading the torrent file...";
boost::intrusive_ptr<libtorrent::torrent_info> t = dlg.torrent(); boost::intrusive_ptr<libtorrent::torrent_info> t = dlg.torrent();
if(!t->is_valid()) if(!t->is_valid())
return; return;
QString torrent_path = dlg.getTorrentPath(); QString torrent_path = dlg.getTorrentPath();
QString content_path = dlg.getContentPath(); QString content_path = dlg.getContentPath();
if(torrent_path.isEmpty() || content_path.isEmpty() || !QFile(torrent_path).exists()) return; if(torrent_path.isEmpty() || content_path.isEmpty() || !QFile(torrent_path).exists()) {
qWarning() << "Incorrect input, aborting." << torrent_path << content_path;
return;
}
const QString hash = misc::toQString(t->info_hash()); const QString hash = misc::toQString(t->info_hash());
qDebug() << "Torrent hash is" << hash;
TorrentTempData::setSavePath(hash, content_path); TorrentTempData::setSavePath(hash, content_path);
#if LIBTORRENT_VERSION_MINOR >= 15 #if LIBTORRENT_VERSION_MINOR >= 15
TorrentTempData::setSeedingMode(hash, dlg.skipFileChecking()); TorrentTempData::setSeedingMode(hash, dlg.skipFileChecking());
@ -220,6 +229,7 @@ void TorrentImportDlg::importTorrent()
settings.setValue("TorrentImport/LastContentDir", content_path); settings.setValue("TorrentImport/LastContentDir", content_path);
return; return;
} }
qDebug() << Q_FUNC_INFO << "EXIT";
return; return;
} }