|
|
@ -438,7 +438,6 @@ void GUI::readParamsInFile(){ |
|
|
|
if(params.size()){ |
|
|
|
if(params.size()){ |
|
|
|
qDebug("Received parameters from another instance"); |
|
|
|
qDebug("Received parameters from another instance"); |
|
|
|
processParams(params); |
|
|
|
processParams(params); |
|
|
|
// addTorrents(params);
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
paramsFile.close(); |
|
|
|
paramsFile.close(); |
|
|
|
paramsFile.remove(); |
|
|
|
paramsFile.remove(); |
|
|
@ -1056,12 +1055,12 @@ void GUI::dropEvent(QDropEvent *event){ |
|
|
|
event->acceptProposedAction(); |
|
|
|
event->acceptProposedAction(); |
|
|
|
QStringList files=event->mimeData()->text().split('\n'); |
|
|
|
QStringList files=event->mimeData()->text().split('\n'); |
|
|
|
// Add file to download list
|
|
|
|
// Add file to download list
|
|
|
|
// addTorrents(files);
|
|
|
|
|
|
|
|
QString file; |
|
|
|
QString file; |
|
|
|
foreach(file, files){ |
|
|
|
foreach(file, files){ |
|
|
|
if(options->useAdditionDialog()){ |
|
|
|
if(options->useAdditionDialog()){ |
|
|
|
torrentAdditionDialog *dialog = new torrentAdditionDialog(this, file.trimmed().replace("file://", "")); |
|
|
|
torrentAdditionDialog *dialog = new torrentAdditionDialog(this, file.trimmed().replace("file://", "")); |
|
|
|
connect(dialog, SIGNAL(torrentAddition(QString, bool, QString)), this, SLOT(addTorrent(QString, bool, QString()))); |
|
|
|
connect(dialog, SIGNAL(torrentAddition(QString, bool, QString)), this, SLOT(addTorrent(QString, bool, QString()))); |
|
|
|
|
|
|
|
connect(dialog, SIGNAL(setInfoBarGUI(const QString&, const QString&)), this, SLOT(setInfoBar(const QString&, const QString&))); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
addTorrent(file.trimmed().replace("file://", "")); |
|
|
|
addTorrent(file.trimmed().replace("file://", "")); |
|
|
|
} |
|
|
|
} |
|
|
@ -1104,12 +1103,11 @@ void GUI::askForTorrents(){ |
|
|
|
if(options->useAdditionDialog()){ |
|
|
|
if(options->useAdditionDialog()){ |
|
|
|
torrentAdditionDialog *dialog = new torrentAdditionDialog(this, pathsList.at(i)); |
|
|
|
torrentAdditionDialog *dialog = new torrentAdditionDialog(this, pathsList.at(i)); |
|
|
|
connect(dialog, SIGNAL(torrentAddition(const QString&, bool, const QString&)), this, SLOT(addTorrent(const QString&, bool, const QString&))); |
|
|
|
connect(dialog, SIGNAL(torrentAddition(const QString&, bool, const QString&)), this, SLOT(addTorrent(const QString&, bool, const QString&))); |
|
|
|
|
|
|
|
connect(dialog, SIGNAL(setInfoBarGUI(const QString&, const QString&)), this, SLOT(setInfoBar(const QString&, const QString&))); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
addTorrent(pathsList.at(i)); |
|
|
|
addTorrent(pathsList.at(i)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//Add torrents to download list
|
|
|
|
|
|
|
|
// addTorrents(pathsList);
|
|
|
|
|
|
|
|
// Save last dir to remember it
|
|
|
|
// Save last dir to remember it
|
|
|
|
lastDirFile.open(QIODevice::WriteOnly | QIODevice::Text); |
|
|
|
lastDirFile.open(QIODevice::WriteOnly | QIODevice::Text); |
|
|
|
QStringList top_dir = pathsList.at(0).split(QDir::separator()); |
|
|
|
QStringList top_dir = pathsList.at(0).split(QDir::separator()); |
|
|
@ -1138,13 +1136,11 @@ void GUI::scanDirectory(){ |
|
|
|
if(options->useAdditionDialog()){ |
|
|
|
if(options->useAdditionDialog()){ |
|
|
|
torrentAdditionDialog *dialog = new torrentAdditionDialog(this, file, true); |
|
|
|
torrentAdditionDialog *dialog = new torrentAdditionDialog(this, file, true); |
|
|
|
connect(dialog, SIGNAL(torrentAddition(const QString&, bool, const QString&)), this, SLOT(addTorrent(const QString&, bool, const QString&))); |
|
|
|
connect(dialog, SIGNAL(torrentAddition(const QString&, bool, const QString&)), this, SLOT(addTorrent(const QString&, bool, const QString&))); |
|
|
|
|
|
|
|
connect(dialog, SIGNAL(setInfoBarGUI(const QString&, const QString&)), this, SLOT(setInfoBar(const QString&, const QString&))); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
addTorrent(file, true); |
|
|
|
addTorrent(file, true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// if(!to_add.empty()){
|
|
|
|
|
|
|
|
// addTorrents(to_add, true);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1309,7 +1305,6 @@ void GUI::resumeUnfinished(){ |
|
|
|
foreach(fileName, filePaths){ |
|
|
|
foreach(fileName, filePaths){ |
|
|
|
addTorrent(fileName); |
|
|
|
addTorrent(fileName); |
|
|
|
} |
|
|
|
} |
|
|
|
// addTorrents(filePaths);
|
|
|
|
|
|
|
|
qDebug("Unfinished torrents resumed"); |
|
|
|
qDebug("Unfinished torrents resumed"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1481,6 +1476,8 @@ void GUI::addTorrent(const QString& path, bool fromScanDir, const QString& from_ |
|
|
|
} |
|
|
|
} |
|
|
|
setInfoBar(tr("This file is either corrupted or this isn't a torrent."),"red"); |
|
|
|
setInfoBar(tr("This file is either corrupted or this isn't a torrent."),"red"); |
|
|
|
if(fromScanDir){ |
|
|
|
if(fromScanDir){ |
|
|
|
|
|
|
|
// Remove .corrupt file in case it already exists
|
|
|
|
|
|
|
|
QFile::remove(file+".corrupt"); |
|
|
|
//Rename file extension so that it won't display error message more than once
|
|
|
|
//Rename file extension so that it won't display error message more than once
|
|
|
|
QFile::rename(file,file+".corrupt"); |
|
|
|
QFile::rename(file,file+".corrupt"); |
|
|
|
} |
|
|
|
} |
|
|
@ -1608,6 +1605,7 @@ void GUI::processParams(const QStringList& params){ |
|
|
|
if(options->useAdditionDialog()){ |
|
|
|
if(options->useAdditionDialog()){ |
|
|
|
torrentAdditionDialog *dialog = new torrentAdditionDialog(this, param); |
|
|
|
torrentAdditionDialog *dialog = new torrentAdditionDialog(this, param); |
|
|
|
connect(dialog, SIGNAL(torrentAddition(const QString&, bool, const QString&)), this, SLOT(addTorrent(const QString&, bool, const QString&))); |
|
|
|
connect(dialog, SIGNAL(torrentAddition(const QString&, bool, const QString&)), this, SLOT(addTorrent(const QString&, bool, const QString&))); |
|
|
|
|
|
|
|
connect(dialog, SIGNAL(setInfoBarGUI(const QString&, const QString&)), this, SLOT(setInfoBar(const QString&, const QString&))); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
addTorrent(param); |
|
|
|
addTorrent(param); |
|
|
|
} |
|
|
|
} |
|
|
@ -2401,6 +2399,7 @@ void GUI::processDownloadedFile(QString url, QString file_path, int return_code, |
|
|
|
if(options->useAdditionDialog()){ |
|
|
|
if(options->useAdditionDialog()){ |
|
|
|
torrentAdditionDialog *dialog = new torrentAdditionDialog(this, file_path, false, url); |
|
|
|
torrentAdditionDialog *dialog = new torrentAdditionDialog(this, file_path, false, url); |
|
|
|
connect(dialog, SIGNAL(torrentAddition(const QString&, bool, const QString&)), this, SLOT(addTorrent(const QString&, bool, const QString&))); |
|
|
|
connect(dialog, SIGNAL(torrentAddition(const QString&, bool, const QString&)), this, SLOT(addTorrent(const QString&, bool, const QString&))); |
|
|
|
|
|
|
|
connect(dialog, SIGNAL(setInfoBarGUI(const QString&, const QString&)), this, SLOT(setInfoBar(const QString&, const QString&))); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
addTorrent(file_path, false, url); |
|
|
|
addTorrent(file_path, false, url); |
|
|
|
} |
|
|
|
} |
|
|
|