2006-10-24 01:42:37 +04:00
|
|
|
/*
|
|
|
|
* Bittorrent Client using Qt4 and libtorrent.
|
2007-07-14 18:31:59 +04:00
|
|
|
* Copyright (C) 2006 Christophe Dumez
|
2006-10-24 01:42:37 +04:00
|
|
|
*
|
2007-07-14 18:31:59 +04:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2006-10-24 01:42:37 +04:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2007-07-14 18:31:59 +04:00
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* Contact : chris@qbittorrent.org
|
2006-10-24 01:42:37 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef TORRENTADDITION_H
|
|
|
|
#define TORRENTADDITION_H
|
|
|
|
|
|
|
|
#include <QDir>
|
|
|
|
#include <QFileDialog>
|
|
|
|
#include <QFile>
|
|
|
|
#include <fstream>
|
|
|
|
#include <QMessageBox>
|
2006-10-24 02:18:06 +04:00
|
|
|
#include <QMenu>
|
2006-11-15 00:17:51 +03:00
|
|
|
#include <QSettings>
|
2007-04-13 00:22:42 +04:00
|
|
|
#include <QStandardItemModel>
|
2007-04-13 00:28:10 +04:00
|
|
|
#include <QHeaderView>
|
2006-10-24 01:42:37 +04:00
|
|
|
|
|
|
|
#include <libtorrent/session.hpp>
|
|
|
|
#include <libtorrent/bencode.hpp>
|
|
|
|
#include "misc.h"
|
2007-04-13 00:22:42 +04:00
|
|
|
#include "PropListDelegate.h"
|
2006-10-24 01:42:37 +04:00
|
|
|
#include "ui_addTorrentDialog.h"
|
|
|
|
|
|
|
|
using namespace libtorrent;
|
|
|
|
|
|
|
|
class torrentAdditionDialog : public QDialog, private Ui_addTorrentDialog{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2006-10-29 12:32:28 +03:00
|
|
|
signals:
|
2007-07-22 13:47:27 +04:00
|
|
|
void setInfoBarGUI(QString info, QString color);
|
2007-08-17 06:03:13 +04:00
|
|
|
void torrentAddition(QString filePath, bool fromScanDir, QString from_url);
|
2006-10-29 12:32:28 +03:00
|
|
|
|
2006-10-24 01:42:37 +04:00
|
|
|
private:
|
|
|
|
QString fileName;
|
2007-08-20 10:29:18 +04:00
|
|
|
QString hash;
|
2006-10-24 01:42:37 +04:00
|
|
|
QString filePath;
|
|
|
|
bool fromScanDir;
|
|
|
|
QString from_url;
|
2007-04-13 00:22:42 +04:00
|
|
|
QStandardItemModel *PropListModel;
|
|
|
|
PropListDelegate *PropDelegate;
|
2006-10-24 01:42:37 +04:00
|
|
|
|
|
|
|
public:
|
2006-10-29 12:32:28 +03:00
|
|
|
torrentAdditionDialog(QWidget *parent) : QDialog(parent) {
|
2006-10-24 01:42:37 +04:00
|
|
|
setupUi(this);
|
|
|
|
setAttribute(Qt::WA_DeleteOnClose);
|
2007-04-13 00:22:42 +04:00
|
|
|
// Set Properties list model
|
|
|
|
PropListModel = new QStandardItemModel(0,4);
|
|
|
|
PropListModel->setHeaderData(NAME, Qt::Horizontal, tr("File name"));
|
|
|
|
PropListModel->setHeaderData(SIZE, Qt::Horizontal, tr("Size"));
|
|
|
|
PropListModel->setHeaderData(PROGRESS, Qt::Horizontal, tr("Progress"));
|
|
|
|
PropListModel->setHeaderData(PRIORITY, Qt::Horizontal, tr("Priority"));
|
|
|
|
torrentContentList->setModel(PropListModel);
|
|
|
|
torrentContentList->hideColumn(PROGRESS);
|
|
|
|
PropDelegate = new PropListDelegate();
|
|
|
|
torrentContentList->setItemDelegate(PropDelegate);
|
|
|
|
connect(torrentContentList, SIGNAL(clicked(const QModelIndex&)), torrentContentList, SLOT(edit(const QModelIndex&)));
|
2007-07-20 17:21:46 +04:00
|
|
|
connect(torrentContentList, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayFilesListMenu(const QPoint&)));
|
|
|
|
connect(actionIgnored, SIGNAL(triggered()), this, SLOT(ignoreSelection()));
|
|
|
|
connect(actionNormal, SIGNAL(triggered()), this, SLOT(normalSelection()));
|
|
|
|
connect(actionHigh, SIGNAL(triggered()), this, SLOT(highSelection()));
|
|
|
|
connect(actionMaximum, SIGNAL(triggered()), this, SLOT(maximumSelection()));
|
2007-04-13 00:28:10 +04:00
|
|
|
torrentContentList->header()->resizeSection(0, 200);
|
2006-10-24 01:42:37 +04:00
|
|
|
QString home = QDir::homePath();
|
|
|
|
if(home[home.length()-1] != QDir::separator()){
|
|
|
|
home += QDir::separator();
|
|
|
|
}
|
2007-08-20 10:29:18 +04:00
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
|
|
|
savePathTxt->setText(settings.value(QString::fromUtf8("LastDirTorrentAdd"), home+QString::fromUtf8("qBT_dir")).toString());
|
2006-10-29 12:32:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void showLoad(QString filePath, bool fromScanDir=false, QString from_url=QString::null){
|
|
|
|
this->filePath = filePath;
|
|
|
|
this->fromScanDir = fromScanDir;
|
|
|
|
this->from_url = from_url;
|
2007-08-20 10:29:18 +04:00
|
|
|
std::ifstream in(filePath.toUtf8().data(), std::ios_base::binary);
|
2006-10-24 01:42:37 +04:00
|
|
|
in.unsetf(std::ios_base::skipws);
|
|
|
|
try{
|
|
|
|
// Decode torrent file
|
|
|
|
entry e = bdecode(std::istream_iterator<char>(in), std::istream_iterator<char>());
|
|
|
|
// Getting torrent file informations
|
|
|
|
torrent_info t(e);
|
|
|
|
// Setting file name
|
2007-08-20 10:29:18 +04:00
|
|
|
fileName = misc::toQString(t.name());
|
|
|
|
hash = misc::toQString(t.info_hash());
|
2007-03-08 01:36:01 +03:00
|
|
|
// Use left() to remove .old extension
|
|
|
|
QString newFileName;
|
2007-08-20 10:29:18 +04:00
|
|
|
if(fileName.endsWith(QString::fromUtf8(".old"))){
|
2007-03-08 01:36:01 +03:00
|
|
|
newFileName = fileName.left(fileName.size()-4);
|
|
|
|
}else{
|
|
|
|
newFileName = fileName;
|
|
|
|
}
|
2007-08-20 10:29:18 +04:00
|
|
|
fileNameLbl->setText(QString::fromUtf8("<center><b>")+newFileName+QString::fromUtf8("</b></center>"));
|
2006-10-24 01:42:37 +04:00
|
|
|
// List files in torrent
|
2007-04-13 00:22:42 +04:00
|
|
|
unsigned int nbFiles = t.num_files();
|
|
|
|
for(unsigned int i=0; i<nbFiles; ++i){
|
|
|
|
unsigned int row = PropListModel->rowCount();
|
|
|
|
PropListModel->insertRow(row);
|
2007-08-20 10:29:18 +04:00
|
|
|
PropListModel->setData(PropListModel->index(row, NAME), QVariant(misc::toQString(t.file_at(i).path.leaf())));
|
2007-04-13 00:22:42 +04:00
|
|
|
PropListModel->setData(PropListModel->index(row, SIZE), QVariant((qlonglong)t.file_at(i).size));
|
|
|
|
PropListModel->setData(PropListModel->index(i, PRIORITY), QVariant(NORMAL));
|
2007-08-20 10:29:18 +04:00
|
|
|
setRowColor(i, QString::fromUtf8("green"));
|
2006-10-24 01:42:37 +04:00
|
|
|
}
|
|
|
|
}catch (invalid_torrent_file&){ // Raised by torrent_info constructor
|
|
|
|
// Display warning to tell user we can't decode the torrent file
|
|
|
|
if(!from_url.isNull()){
|
2007-08-20 10:29:18 +04:00
|
|
|
emit setInfoBarGUI(tr("Unable to decode torrent file:")+QString::fromUtf8(" '")+from_url+QString::fromUtf8("'"), QString::fromUtf8("red"));
|
2006-10-24 01:42:37 +04:00
|
|
|
}else{
|
2007-08-20 10:29:18 +04:00
|
|
|
emit setInfoBarGUI(tr("Unable to decode torrent file:")+QString::fromUtf8(" '")+filePath+QString::fromUtf8("'"), QString::fromUtf8("red"));
|
2006-10-24 01:42:37 +04:00
|
|
|
}
|
2007-08-20 10:29:18 +04:00
|
|
|
emit setInfoBarGUI(tr("This file is either corrupted or this isn't a torrent."), QString::fromUtf8("red"));
|
2006-10-24 01:42:37 +04:00
|
|
|
if(fromScanDir){
|
2006-10-26 02:17:26 +04:00
|
|
|
// Remove .corrupt file in case it already exists
|
2007-08-20 10:29:18 +04:00
|
|
|
QFile::remove(filePath+QString::fromUtf8(".corrupt"));
|
2006-10-26 02:17:26 +04:00
|
|
|
//Rename file extension so that it won't display error message more than once
|
2007-08-20 10:29:18 +04:00
|
|
|
QFile::rename(filePath,filePath+QString::fromUtf8(".corrupt"));
|
2006-10-26 02:17:26 +04:00
|
|
|
}
|
|
|
|
close();
|
|
|
|
}
|
|
|
|
catch(invalid_encoding& e){
|
|
|
|
std::cerr << "Could not decode file, reason: " << e.what() << '\n';
|
|
|
|
// Display warning to tell user we can't decode the torrent file
|
|
|
|
if(!from_url.isNull()){
|
2007-08-20 10:29:18 +04:00
|
|
|
emit setInfoBarGUI(tr("Unable to decode torrent file:")+QString::fromUtf8(" '")+from_url+QString::fromUtf8("'"), QString::fromUtf8("red"));
|
2006-10-26 02:17:26 +04:00
|
|
|
}else{
|
2007-08-20 10:29:18 +04:00
|
|
|
emit setInfoBarGUI(tr("Unable to decode torrent file:")+QString::fromUtf8(" '")+filePath+QString::fromUtf8("'"), QString::fromUtf8("red"));
|
2006-10-26 02:17:26 +04:00
|
|
|
}
|
2007-08-20 10:29:18 +04:00
|
|
|
emit setInfoBarGUI(tr("This file is either corrupted or this isn't a torrent."), QString::fromUtf8("red"));
|
2006-10-26 02:17:26 +04:00
|
|
|
if(fromScanDir){
|
|
|
|
// Remove .corrupt file in case it already exists
|
2007-08-20 10:29:18 +04:00
|
|
|
QFile::remove(filePath+QString::fromUtf8(".corrupt"));
|
2006-10-24 01:42:37 +04:00
|
|
|
//Rename file extension so that it won't display error message more than once
|
2007-08-20 10:29:18 +04:00
|
|
|
QFile::rename(filePath,filePath+QString::fromUtf8(".corrupt"));
|
2006-10-24 01:42:37 +04:00
|
|
|
}
|
|
|
|
close();
|
|
|
|
}
|
|
|
|
show();
|
|
|
|
}
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void on_browseButton_clicked(){
|
2006-10-29 12:46:38 +03:00
|
|
|
QString dir;
|
|
|
|
QDir saveDir(savePathTxt->text());
|
|
|
|
if(saveDir.exists()){
|
|
|
|
dir = QFileDialog::getExistingDirectory(this, tr("Choose save path"), savePathTxt->text());
|
|
|
|
}else{
|
|
|
|
dir = QFileDialog::getExistingDirectory(this, tr("Choose save path"), QDir::homePath());
|
|
|
|
}
|
2006-10-24 01:42:37 +04:00
|
|
|
if(!dir.isNull()){
|
|
|
|
savePathTxt->setText(dir);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void on_CancelButton_clicked(){
|
|
|
|
close();
|
|
|
|
}
|
|
|
|
|
2007-04-13 00:22:42 +04:00
|
|
|
// Set the color of a row in data model
|
|
|
|
void setRowColor(int row, QString color){
|
|
|
|
for(int i=0; i<PropListModel->columnCount(); ++i){
|
2007-07-31 14:39:03 +04:00
|
|
|
PropListModel->setData(PropListModel->index(row, i), QVariant(QColor(color)), Qt::ForegroundRole);
|
2006-10-24 01:42:37 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-09-04 02:52:58 +04:00
|
|
|
bool allFiltered() const {
|
2007-07-31 19:37:14 +04:00
|
|
|
unsigned int nbRows = PropListModel->rowCount();
|
|
|
|
for(unsigned int i=0; i<nbRows; ++i){
|
2007-09-04 02:52:58 +04:00
|
|
|
if(PropListModel->data(PropListModel->index(i, PRIORITY)).toInt() != IGNORED)
|
|
|
|
return false;
|
2007-07-31 19:37:14 +04:00
|
|
|
}
|
2007-09-04 02:52:58 +04:00
|
|
|
return true;
|
2007-07-31 19:37:14 +04:00
|
|
|
}
|
|
|
|
|
2007-07-20 17:21:46 +04:00
|
|
|
void displayFilesListMenu(const QPoint& pos){
|
2007-07-31 19:37:14 +04:00
|
|
|
unsigned int nbRows = PropListModel->rowCount();
|
|
|
|
if(nbRows == 1) return;
|
2007-07-20 17:21:46 +04:00
|
|
|
QMenu myFilesLlistMenu(this);
|
|
|
|
QModelIndex index;
|
2007-07-31 19:37:14 +04:00
|
|
|
// Enable/disable pause/start action given the DL state
|
2007-07-20 17:21:46 +04:00
|
|
|
QModelIndexList selectedIndexes = torrentContentList->selectionModel()->selectedIndexes();
|
|
|
|
myFilesLlistMenu.setTitle(tr("Priority"));
|
2007-09-04 02:52:58 +04:00
|
|
|
myFilesLlistMenu.addAction(actionIgnored);
|
2007-07-20 17:21:46 +04:00
|
|
|
myFilesLlistMenu.addAction(actionNormal);
|
|
|
|
myFilesLlistMenu.addAction(actionHigh);
|
|
|
|
myFilesLlistMenu.addAction(actionMaximum);
|
2007-07-31 19:37:14 +04:00
|
|
|
// Call menu
|
|
|
|
// XXX: why mapToGlobal() is not enough?
|
2007-07-20 17:30:30 +04:00
|
|
|
myFilesLlistMenu.exec(mapToGlobal(pos)+QPoint(10,145));
|
2007-07-20 17:21:46 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void ignoreSelection(){
|
|
|
|
QModelIndexList selectedIndexes = torrentContentList->selectionModel()->selectedIndexes();
|
|
|
|
QModelIndex index;
|
|
|
|
foreach(index, selectedIndexes){
|
|
|
|
if(index.column() == PRIORITY){
|
|
|
|
PropListModel->setData(index, QVariant(IGNORED));
|
|
|
|
}
|
2007-07-31 17:59:03 +04:00
|
|
|
for(int i=0; i<PropListModel->columnCount(); ++i){
|
2007-08-20 10:29:18 +04:00
|
|
|
PropListModel->setData(PropListModel->index(index.row(), i), QVariant(QColor(QString::fromUtf8("red"))), Qt::ForegroundRole);
|
2007-07-31 17:59:03 +04:00
|
|
|
}
|
2007-07-20 17:21:46 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void normalSelection(){
|
|
|
|
QModelIndexList selectedIndexes = torrentContentList->selectionModel()->selectedIndexes();
|
|
|
|
QModelIndex index;
|
|
|
|
foreach(index, selectedIndexes){
|
|
|
|
if(index.column() == PRIORITY){
|
|
|
|
PropListModel->setData(index, QVariant(NORMAL));
|
|
|
|
}
|
2007-07-31 17:59:03 +04:00
|
|
|
for(int i=0; i<PropListModel->columnCount(); ++i){
|
2007-08-20 10:29:18 +04:00
|
|
|
PropListModel->setData(PropListModel->index(index.row(), i), QVariant(QColor(QString::fromUtf8("green"))), Qt::ForegroundRole);
|
2007-07-31 17:59:03 +04:00
|
|
|
}
|
2007-07-20 17:21:46 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void highSelection(){
|
|
|
|
QModelIndexList selectedIndexes = torrentContentList->selectionModel()->selectedIndexes();
|
|
|
|
QModelIndex index;
|
|
|
|
foreach(index, selectedIndexes){
|
|
|
|
if(index.column() == PRIORITY){
|
|
|
|
PropListModel->setData(index, QVariant(HIGH));
|
|
|
|
}
|
2007-07-31 17:59:03 +04:00
|
|
|
for(int i=0; i<PropListModel->columnCount(); ++i){
|
|
|
|
PropListModel->setData(PropListModel->index(index.row(), i), QVariant(QColor("green")), Qt::ForegroundRole);
|
|
|
|
}
|
2007-07-20 17:21:46 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void maximumSelection(){
|
|
|
|
QModelIndexList selectedIndexes = torrentContentList->selectionModel()->selectedIndexes();
|
|
|
|
QModelIndex index;
|
|
|
|
foreach(index, selectedIndexes){
|
|
|
|
if(index.column() == PRIORITY){
|
|
|
|
PropListModel->setData(index, QVariant(MAXIMUM));
|
|
|
|
}
|
2007-07-31 17:59:03 +04:00
|
|
|
for(int i=0; i<PropListModel->columnCount(); ++i){
|
2007-08-20 10:29:18 +04:00
|
|
|
PropListModel->setData(PropListModel->index(index.row(), i), QVariant(QColor(QString::fromUtf8("green"))), Qt::ForegroundRole);
|
2007-07-31 17:59:03 +04:00
|
|
|
}
|
2007-07-20 17:21:46 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-04-13 00:22:42 +04:00
|
|
|
void savePiecesPriorities(){
|
|
|
|
qDebug("Saving pieces priorities");
|
2007-08-20 10:29:18 +04:00
|
|
|
QFile pieces_file(misc::qBittorrentPath()+QString::fromUtf8("BT_backup")+QDir::separator()+hash+QString::fromUtf8(".priorities"));
|
2006-10-24 01:42:37 +04:00
|
|
|
// First, remove old file
|
|
|
|
pieces_file.remove();
|
|
|
|
// Write new files
|
|
|
|
if(!pieces_file.open(QIODevice::WriteOnly | QIODevice::Text)){
|
2007-04-13 00:22:42 +04:00
|
|
|
std::cerr << "Error: Could not save pieces priorities\n";
|
2006-10-24 01:42:37 +04:00
|
|
|
return;
|
|
|
|
}
|
2007-04-13 00:22:42 +04:00
|
|
|
unsigned int nbRows = PropListModel->rowCount();
|
|
|
|
for(unsigned int i=0; i<nbRows; ++i){
|
|
|
|
QStandardItem *item = PropListModel->item(i, PRIORITY);
|
|
|
|
unsigned short priority = item->text().toInt();
|
2007-08-20 10:29:18 +04:00
|
|
|
pieces_file.write((misc::toQByteArray(priority)+misc::toQByteArray("\n")));
|
2006-10-24 01:42:37 +04:00
|
|
|
}
|
|
|
|
pieces_file.close();
|
|
|
|
}
|
|
|
|
|
|
|
|
void on_OkButton_clicked(){
|
|
|
|
QDir savePath(savePathTxt->text());
|
|
|
|
if(savePathTxt->text().trimmed().isEmpty()){
|
|
|
|
QMessageBox::critical(0, tr("Empty save path"), tr("Please enter a save path"));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// Check if savePath exists
|
|
|
|
if(!savePath.exists()){
|
|
|
|
if(!savePath.mkpath(savePath.path())){
|
|
|
|
QMessageBox::critical(0, tr("Save path creation error"), tr("Could not create the save path"));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Save savepath
|
2007-08-20 10:29:18 +04:00
|
|
|
QFile savepath_file(misc::qBittorrentPath()+QString::fromUtf8("BT_backup")+QDir::separator()+hash+QString::fromUtf8(".savepath"));
|
2006-10-24 01:42:37 +04:00
|
|
|
savepath_file.open(QIODevice::WriteOnly | QIODevice::Text);
|
2006-10-26 00:35:41 +04:00
|
|
|
savepath_file.write(savePath.path().toUtf8());
|
2006-10-24 01:42:37 +04:00
|
|
|
savepath_file.close();
|
2006-10-29 12:46:38 +03:00
|
|
|
// Save last dir to remember it
|
2007-08-20 10:29:18 +04:00
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
|
|
|
settings.setValue(QString::fromUtf8("LastDirTorrentAdd"), savePathTxt->text());
|
2006-10-24 01:42:37 +04:00
|
|
|
// Create .incremental file if necessary
|
|
|
|
if(checkIncrementalDL->isChecked()){
|
2007-08-20 10:29:18 +04:00
|
|
|
QFile incremental_file(misc::qBittorrentPath()+QString::fromUtf8("BT_backup")+QDir::separator()+hash+QString::fromUtf8(".incremental"));
|
2006-10-24 01:42:37 +04:00
|
|
|
incremental_file.open(QIODevice::WriteOnly | QIODevice::Text);
|
|
|
|
incremental_file.close();
|
|
|
|
}else{
|
2007-08-20 10:29:18 +04:00
|
|
|
QFile::remove(misc::qBittorrentPath()+QString::fromUtf8("BT_backup")+QDir::separator()+hash+QString::fromUtf8(".incremental"));
|
2006-10-24 01:42:37 +04:00
|
|
|
}
|
|
|
|
// Create .paused file if necessary
|
|
|
|
if(addInPause->isChecked()){
|
2007-08-20 10:29:18 +04:00
|
|
|
QFile paused_file(misc::qBittorrentPath()+QString::fromUtf8("BT_backup")+QDir::separator()+hash+QString::fromUtf8(".paused"));
|
2006-10-24 01:42:37 +04:00
|
|
|
paused_file.open(QIODevice::WriteOnly | QIODevice::Text);
|
|
|
|
paused_file.close();
|
|
|
|
}else{
|
2007-08-20 10:29:18 +04:00
|
|
|
QFile::remove(misc::qBittorrentPath()+QString::fromUtf8("BT_backup")+QDir::separator()+hash+QString::fromUtf8(".paused"));
|
2006-10-24 01:42:37 +04:00
|
|
|
}
|
|
|
|
// Check if there is at least one selected file
|
2007-09-04 02:52:58 +04:00
|
|
|
if(allFiltered()){
|
|
|
|
QMessageBox::warning(0, tr("Invalid file selection"), tr("You must select at least one file in the torrent"));
|
2006-10-24 01:42:37 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
// save filtered files
|
2007-04-13 00:22:42 +04:00
|
|
|
savePiecesPriorities();
|
2006-10-24 01:42:37 +04:00
|
|
|
// Add to download list
|
2007-08-17 06:03:13 +04:00
|
|
|
emit torrentAddition(filePath, fromScanDir, from_url);
|
2006-10-24 01:42:37 +04:00
|
|
|
close();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|