mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 12:34:19 +00:00
Clean up torrent addition dialog code a little
This commit is contained in:
parent
0e425d6a04
commit
ef6c3f5a64
@ -1,4 +1,5 @@
|
|||||||
* Unreleased - Christophe Dumez <chris@qbittorrent.org> - v3.0.0
|
* Unreleased - Christophe Dumez <chris@qbittorrent.org> - v3.0.0
|
||||||
|
- FEATURE: Add the ability to choose the save path when using magnet links (mutoso)
|
||||||
- OTHER: Drop support for libtorrent v0.14.x
|
- OTHER: Drop support for libtorrent v0.14.x
|
||||||
- OTHER: Drop support for Qt 4.5
|
- OTHER: Drop support for Qt 4.5
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
|
|
||||||
torrentAdditionDialog::torrentAdditionDialog(QWidget *parent) :
|
torrentAdditionDialog::torrentAdditionDialog(QWidget *parent) :
|
||||||
QDialog(parent), old_label(""), hidden_height(0), m_showContentList(true) {
|
QDialog(parent), m_oldLabel(""), m_hiddenHeight(0), m_showContentList(true) {
|
||||||
Preferences pref;
|
Preferences pref;
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
@ -68,33 +68,33 @@ torrentAdditionDialog::torrentAdditionDialog(QWidget *parent) :
|
|||||||
CancelButton->setIcon(IconProvider::instance()->getIcon("dialog-cancel"));
|
CancelButton->setIcon(IconProvider::instance()->getIcon("dialog-cancel"));
|
||||||
OkButton->setIcon(IconProvider::instance()->getIcon("list-add"));
|
OkButton->setIcon(IconProvider::instance()->getIcon("list-add"));
|
||||||
// Set Properties list model
|
// Set Properties list model
|
||||||
PropListModel = new TorrentContentFilterModel(this);
|
m_propListModel = new TorrentContentFilterModel(this);
|
||||||
connect(PropListModel, SIGNAL(filteredFilesChanged()), SLOT(updateDiskSpaceLabels()));
|
connect(m_propListModel, SIGNAL(filteredFilesChanged()), SLOT(updateDiskSpaceLabels()));
|
||||||
torrentContentList->setModel(PropListModel);
|
torrentContentList->setModel(m_propListModel);
|
||||||
torrentContentList->hideColumn(PROGRESS);
|
torrentContentList->hideColumn(PROGRESS);
|
||||||
PropDelegate = new PropListDelegate();
|
m_propListDelegate = new PropListDelegate();
|
||||||
torrentContentList->setItemDelegate(PropDelegate);
|
torrentContentList->setItemDelegate(m_propListDelegate);
|
||||||
connect(torrentContentList, SIGNAL(clicked(const QModelIndex&)), torrentContentList, SLOT(edit(const QModelIndex&)));
|
connect(torrentContentList, SIGNAL(clicked(const QModelIndex&)), torrentContentList, SLOT(edit(const QModelIndex&)));
|
||||||
connect(torrentContentList, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayContentListMenu(const QPoint&)));
|
connect(torrentContentList, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayContentListMenu(const QPoint&)));
|
||||||
connect(selectAllButton, SIGNAL(clicked()), PropListModel, SLOT(selectAll()));
|
connect(selectAllButton, SIGNAL(clicked()), m_propListModel, SLOT(selectAll()));
|
||||||
connect(selectNoneButton, SIGNAL(clicked()), PropListModel, SLOT(selectNone()));
|
connect(selectNoneButton, SIGNAL(clicked()), m_propListModel, SLOT(selectNone()));
|
||||||
connect(comboLabel, SIGNAL(editTextChanged(QString)), this, SLOT(resetComboLabelIndex(QString)));
|
connect(comboLabel, SIGNAL(editTextChanged(QString)), this, SLOT(resetComboLabelIndex(QString)));
|
||||||
connect(comboLabel, SIGNAL(editTextChanged(QString)), this, SLOT(updateLabelInSavePath(QString)));
|
connect(comboLabel, SIGNAL(editTextChanged(QString)), this, SLOT(updateLabelInSavePath(QString)));
|
||||||
connect(comboLabel, SIGNAL(currentIndexChanged(QString)), this, SLOT(updateLabelInSavePath(QString)));
|
connect(comboLabel, SIGNAL(currentIndexChanged(QString)), this, SLOT(updateLabelInSavePath(QString)));
|
||||||
LineEdit *contentFilterLine = new LineEdit(this);
|
LineEdit *contentFilterLine = new LineEdit(this);
|
||||||
connect(contentFilterLine, SIGNAL(textChanged(QString)), PropListModel, SLOT(setFilterFixedString(QString)));
|
connect(contentFilterLine, SIGNAL(textChanged(QString)), m_propListModel, SLOT(setFilterFixedString(QString)));
|
||||||
contentFilterLayout->insertWidget(1, contentFilterLine);
|
contentFilterLayout->insertWidget(1, contentFilterLine);
|
||||||
// Important: as a default, it inserts at the bottom which is not desirable
|
// Important: as a default, it inserts at the bottom which is not desirable
|
||||||
savePathTxt->setInsertPolicy(QComboBox::InsertAtCurrent);
|
savePathTxt->setInsertPolicy(QComboBox::InsertAtCurrent);
|
||||||
//torrentContentList->header()->setResizeMode(0, QHeaderView::Stretch);
|
//torrentContentList->header()->setResizeMode(0, QHeaderView::Stretch);
|
||||||
defaultSavePath = pref.getSavePath();
|
m_defaultSavePath = pref.getSavePath();
|
||||||
//In case of the LastLocationPath doesn't exist anymore, empty the string
|
//In case of the LastLocationPath doesn't exist anymore, empty the string
|
||||||
|
|
||||||
appendLabelToSavePath = pref.appendTorrentLabel();
|
m_appendLabelToSavePath = pref.appendTorrentLabel();
|
||||||
QString display_path = defaultSavePath.replace("\\", "/");
|
QString display_path = m_defaultSavePath.replace("\\", "/");
|
||||||
if (!display_path.endsWith("/"))
|
if (!display_path.endsWith("/"))
|
||||||
display_path += "/";
|
display_path += "/";
|
||||||
path_history << display_path;
|
m_pathHistory << display_path;
|
||||||
#if defined(Q_WS_WIN) || defined(Q_OS_OS2)
|
#if defined(Q_WS_WIN) || defined(Q_OS_OS2)
|
||||||
display_path.replace("/", "\\");
|
display_path.replace("/", "\\");
|
||||||
#endif
|
#endif
|
||||||
@ -118,8 +118,8 @@ torrentAdditionDialog::torrentAdditionDialog(QWidget *parent) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
torrentAdditionDialog::~torrentAdditionDialog() {
|
torrentAdditionDialog::~torrentAdditionDialog() {
|
||||||
delete PropDelegate;
|
delete m_propListDelegate;
|
||||||
delete PropListModel;
|
delete m_propListModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrentAdditionDialog::closeEvent(QCloseEvent *event)
|
void torrentAdditionDialog::closeEvent(QCloseEvent *event)
|
||||||
@ -193,28 +193,23 @@ void torrentAdditionDialog::hideTorrentContent() {
|
|||||||
m_showContentList = false;
|
m_showContentList = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrentAdditionDialog::showLoadMagnetURI(QString magnet_uri) {
|
void torrentAdditionDialog::showLoadMagnetURI(const QString& magnet_uri) {
|
||||||
is_magnet = true;
|
m_isMagnet = true;
|
||||||
this->from_url = magnet_uri;
|
this->m_fromUrl = magnet_uri;
|
||||||
checkLastFolder->setEnabled(false);
|
checkLastFolder->setEnabled(false);
|
||||||
|
|
||||||
// Disable Save path combox and browse button
|
|
||||||
// Save path should be default for magnet links
|
|
||||||
savePathTxt->setEnabled(true);
|
|
||||||
browseButton->setEnabled(true);
|
|
||||||
|
|
||||||
// Get torrent hash
|
// Get torrent hash
|
||||||
hash = misc::magnetUriToHash(magnet_uri);
|
m_hash = misc::magnetUriToHash(magnet_uri);
|
||||||
if (hash.isEmpty()) {
|
if (m_hash.isEmpty()) {
|
||||||
QBtSession::instance()->addConsoleMessage(tr("Unable to decode magnet link:")+QString::fromUtf8(" '")+from_url+QString::fromUtf8("'"), QString::fromUtf8("red"));
|
QBtSession::instance()->addConsoleMessage(tr("Unable to decode magnet link:")+QString::fromUtf8(" '")+m_fromUrl+QString::fromUtf8("'"), QString::fromUtf8("red"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Set torrent name
|
// Set torrent name
|
||||||
fileName = misc::magnetUriToName(magnet_uri);
|
m_fileName = misc::magnetUriToName(magnet_uri);
|
||||||
if (fileName.isEmpty()) {
|
if (m_fileName.isEmpty()) {
|
||||||
fileName = tr("Magnet Link");
|
m_fileName = tr("Magnet Link");
|
||||||
}
|
}
|
||||||
fileNameLbl->setText(QString::fromUtf8("<center><b>")+fileName+QString::fromUtf8("</b></center>"));
|
fileNameLbl->setText(QString::fromUtf8("<center><b>")+m_fileName+QString::fromUtf8("</b></center>"));
|
||||||
// Update display
|
// Update display
|
||||||
updateDiskSpaceLabels();
|
updateDiskSpaceLabels();
|
||||||
|
|
||||||
@ -231,73 +226,73 @@ void torrentAdditionDialog::showLoadMagnetURI(QString magnet_uri) {
|
|||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrentAdditionDialog::showLoad(QString filePath, QString from_url) {
|
void torrentAdditionDialog::showLoad(const QString& filePath, const QString& from_url) {
|
||||||
is_magnet = false;
|
m_isMagnet = false;
|
||||||
|
|
||||||
// This is an URL to a local file, switch to local path
|
// This is an URL to a local file, switch to local path
|
||||||
if (filePath.startsWith("file:", Qt::CaseInsensitive))
|
if (filePath.startsWith("file:", Qt::CaseInsensitive))
|
||||||
filePath = QUrl::fromEncoded(filePath.toLocal8Bit()).toLocalFile();
|
m_filePath = QUrl::fromEncoded(filePath.toLocal8Bit()).toLocalFile();
|
||||||
|
else
|
||||||
|
m_filePath = filePath;
|
||||||
|
|
||||||
if (!QFile::exists(filePath)) {
|
if (!QFile::exists(m_filePath)) {
|
||||||
close();
|
close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << Q_FUNC_INFO << filePath;
|
qDebug() << Q_FUNC_INFO << filePath;
|
||||||
|
|
||||||
this->filePath = filePath;
|
this->m_fromUrl = from_url;
|
||||||
this->from_url = from_url;
|
|
||||||
// Getting torrent file informations
|
// Getting torrent file informations
|
||||||
try {
|
try {
|
||||||
t = new torrent_info(filePath.toUtf8().data());
|
m_torrentInfo = new torrent_info(m_filePath.toUtf8().data());
|
||||||
if (!t->is_valid())
|
if (!m_torrentInfo->is_valid())
|
||||||
throw std::exception();
|
throw std::exception();
|
||||||
} catch(std::exception&) {
|
} catch(std::exception&) {
|
||||||
qDebug("Caught error loading torrent");
|
qDebug("Caught error loading torrent");
|
||||||
if (!from_url.isNull()) {
|
if (!from_url.isNull()) {
|
||||||
QBtSession::instance()->addConsoleMessage(tr("Unable to decode torrent file:")+QString::fromUtf8(" '")+from_url+QString::fromUtf8("'"), QString::fromUtf8("red"));
|
QBtSession::instance()->addConsoleMessage(tr("Unable to decode torrent file:")+QString::fromUtf8(" '")+from_url+QString::fromUtf8("'"), QString::fromUtf8("red"));
|
||||||
QFile::remove(filePath);
|
QFile::remove(m_filePath);
|
||||||
}else{
|
}else{
|
||||||
QBtSession::instance()->addConsoleMessage(tr("Unable to decode torrent file:")+QString::fromUtf8(" '")+filePath+QString::fromUtf8("'"), QString::fromUtf8("red"));
|
QBtSession::instance()->addConsoleMessage(tr("Unable to decode torrent file:")+QString::fromUtf8(" '")+m_filePath+QString::fromUtf8("'"), QString::fromUtf8("red"));
|
||||||
}
|
}
|
||||||
close();
|
close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
nbFiles = t->num_files();
|
m_nbFiles = m_torrentInfo->num_files();
|
||||||
if (nbFiles == 0) {
|
if (m_nbFiles == 0) {
|
||||||
// Empty torrent file!?
|
// Empty torrent file!?
|
||||||
close();
|
close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if LIBTORRENT_VERSION_MINOR >= 16
|
#if LIBTORRENT_VERSION_MINOR >= 16
|
||||||
file_storage fs = t->files();
|
file_storage fs = m_torrentInfo->files();
|
||||||
#endif
|
#endif
|
||||||
// Truncate root folder
|
// Truncate root folder
|
||||||
QString root_folder = misc::truncateRootFolder(t);
|
QString root_folder = misc::truncateRootFolder(m_torrentInfo);
|
||||||
// Setting file name
|
// Setting file name
|
||||||
fileName = misc::toQStringU(t->name());
|
m_fileName = misc::toQStringU(m_torrentInfo->name());
|
||||||
hash = misc::toQString(t->info_hash());
|
m_hash = misc::toQString(m_torrentInfo->info_hash());
|
||||||
// Use left() to remove .old extension
|
// Use left() to remove .old extension
|
||||||
QString newFileName;
|
QString newFileName;
|
||||||
if (fileName.endsWith(QString::fromUtf8(".old"))) {
|
if (m_fileName.endsWith(QString::fromUtf8(".old"))) {
|
||||||
newFileName = fileName.left(fileName.size()-4);
|
newFileName = m_fileName.left(m_fileName.size()-4);
|
||||||
}else{
|
}else{
|
||||||
newFileName = fileName;
|
newFileName = m_fileName;
|
||||||
}
|
}
|
||||||
fileNameLbl->setText(QString::fromUtf8("<center><b>")+newFileName+QString::fromUtf8("</b></center>"));
|
fileNameLbl->setText(QString::fromUtf8("<center><b>")+newFileName+QString::fromUtf8("</b></center>"));
|
||||||
if (t->num_files() > 1) {
|
if (m_torrentInfo->num_files() > 1) {
|
||||||
// List files in torrent
|
// List files in torrent
|
||||||
PropListModel->model()->setupModelData(*t);
|
m_propListModel->model()->setupModelData(*m_torrentInfo);
|
||||||
connect(PropDelegate, SIGNAL(filteredFilesChanged()), this, SLOT(updateDiskSpaceLabels()));
|
connect(m_propListDelegate, SIGNAL(filteredFilesChanged()), this, SLOT(updateDiskSpaceLabels()));
|
||||||
// Loads files path in the torrent
|
// Loads files path in the torrent
|
||||||
for (uint i=0; i<nbFiles; ++i) {
|
for (uint i=0; i<m_nbFiles; ++i) {
|
||||||
#if LIBTORRENT_VERSION_MINOR >= 16
|
#if LIBTORRENT_VERSION_MINOR >= 16
|
||||||
files_path << misc::toQStringU(fs.file_path(t->file_at(i)));
|
m_filesPath << misc::toQStringU(fs.file_path(m_torrentInfo->file_at(i)));
|
||||||
#else
|
#else
|
||||||
files_path << misc::toQStringU(t->file_at(i).path.string());
|
m_filesPath << misc::toQStringU(m_torrentInfo->file_at(i).path.string());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load save path history
|
// Load save path history
|
||||||
@ -317,12 +312,12 @@ void torrentAdditionDialog::showLoad(QString filePath, QString from_url) {
|
|||||||
if (!root_folder.isEmpty()) {
|
if (!root_folder.isEmpty()) {
|
||||||
save_path += root_folder;
|
save_path += root_folder;
|
||||||
}
|
}
|
||||||
if (nbFiles == 1) {
|
if (m_nbFiles == 1) {
|
||||||
// single file torrent
|
// single file torrent
|
||||||
#if LIBTORRENT_VERSION_MINOR >= 16
|
#if LIBTORRENT_VERSION_MINOR >= 16
|
||||||
QString single_file_relpath = misc::toQStringU(fs.file_path(t->file_at(0)));
|
QString single_file_relpath = misc::toQStringU(fs.file_path(m_torrentInfo->file_at(0)));
|
||||||
#else
|
#else
|
||||||
QString single_file_relpath = misc::toQStringU(t->file_at(0).path.string());
|
QString single_file_relpath = misc::toQStringU(m_torrentInfo->file_at(0).path.string());
|
||||||
#endif
|
#endif
|
||||||
#if defined(Q_WS_WIN) || defined(Q_OS_OS2)
|
#if defined(Q_WS_WIN) || defined(Q_OS_OS2)
|
||||||
single_file_relpath.replace("/", "\\");
|
single_file_relpath.replace("/", "\\");
|
||||||
@ -335,7 +330,7 @@ void torrentAdditionDialog::showLoad(QString filePath, QString from_url) {
|
|||||||
updateDiskSpaceLabels();
|
updateDiskSpaceLabels();
|
||||||
|
|
||||||
// Hide useless widgets
|
// Hide useless widgets
|
||||||
if (t->num_files() <= 1)
|
if (m_torrentInfo->num_files() <= 1)
|
||||||
hideTorrentContent();
|
hideTorrentContent();
|
||||||
|
|
||||||
// Remember dialog geometry
|
// Remember dialog geometry
|
||||||
@ -349,11 +344,11 @@ void torrentAdditionDialog::showLoad(QString filePath, QString from_url) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void torrentAdditionDialog::displayContentListMenu(const QPoint&) {
|
void torrentAdditionDialog::displayContentListMenu(const QPoint&) {
|
||||||
Q_ASSERT(!is_magnet && t->num_files() > 1);
|
Q_ASSERT(!m_isMagnet && m_torrentInfo->num_files() > 1);
|
||||||
QMenu myFilesLlistMenu;
|
QMenu myFilesLlistMenu;
|
||||||
const QModelIndexList selectedRows = torrentContentList->selectionModel()->selectedRows(0);
|
const QModelIndexList selectedRows = torrentContentList->selectionModel()->selectedRows(0);
|
||||||
QAction *actRename = 0;
|
QAction *actRename = 0;
|
||||||
if (selectedRows.size() == 1 && t->num_files() > 1) {
|
if (selectedRows.size() == 1 && m_torrentInfo->num_files() > 1) {
|
||||||
actRename = myFilesLlistMenu.addAction(IconProvider::instance()->getIcon("edit-rename"), tr("Rename..."));
|
actRename = myFilesLlistMenu.addAction(IconProvider::instance()->getIcon("edit-rename"), tr("Rename..."));
|
||||||
myFilesLlistMenu.addSeparator();
|
myFilesLlistMenu.addSeparator();
|
||||||
}
|
}
|
||||||
@ -385,14 +380,14 @@ void torrentAdditionDialog::displayContentListMenu(const QPoint&) {
|
|||||||
qDebug("Setting files priority");
|
qDebug("Setting files priority");
|
||||||
foreach (const QModelIndex &index, selectedRows) {
|
foreach (const QModelIndex &index, selectedRows) {
|
||||||
qDebug("Setting priority(%d) for file at row %d", prio, index.row());
|
qDebug("Setting priority(%d) for file at row %d", prio, index.row());
|
||||||
PropListModel->setData(PropListModel->index(index.row(), PRIORITY, index.parent()), prio);
|
m_propListModel->setData(m_propListModel->index(index.row(), PRIORITY, index.parent()), prio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrentAdditionDialog::renameSelectedFile() {
|
void torrentAdditionDialog::renameSelectedFile() {
|
||||||
Q_ASSERT(!is_magnet && t->num_files() > 1);
|
Q_ASSERT(!m_isMagnet && m_torrentInfo->num_files() > 1);
|
||||||
const QModelIndexList selectedIndexes = torrentContentList->selectionModel()->selectedRows(0);
|
const QModelIndexList selectedIndexes = torrentContentList->selectionModel()->selectedRows(0);
|
||||||
Q_ASSERT(selectedIndexes.size() == 1);
|
Q_ASSERT(selectedIndexes.size() == 1);
|
||||||
const QModelIndex &index = selectedIndexes.first();
|
const QModelIndex &index = selectedIndexes.first();
|
||||||
@ -408,10 +403,10 @@ void torrentAdditionDialog::renameSelectedFile() {
|
|||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (PropListModel->getType(index) == TorrentContentModelItem::TFILE) {
|
if (m_propListModel->getType(index) == TorrentContentModelItem::TFILE) {
|
||||||
// File renaming
|
// File renaming
|
||||||
const uint file_index = PropListModel->getFileIndex(index);
|
const uint file_index = m_propListModel->getFileIndex(index);
|
||||||
QString old_name = files_path.at(file_index);
|
QString old_name = m_filesPath.at(file_index);
|
||||||
old_name.replace("\\", "/");
|
old_name.replace("\\", "/");
|
||||||
qDebug("Old name: %s", qPrintable(old_name));
|
qDebug("Old name: %s", qPrintable(old_name));
|
||||||
QStringList path_items = old_name.split("/");
|
QStringList path_items = old_name.split("/");
|
||||||
@ -425,12 +420,12 @@ void torrentAdditionDialog::renameSelectedFile() {
|
|||||||
new_name = QDir::cleanPath(new_name);
|
new_name = QDir::cleanPath(new_name);
|
||||||
qDebug("New name: %s", qPrintable(new_name));
|
qDebug("New name: %s", qPrintable(new_name));
|
||||||
// Check if that name is already used
|
// Check if that name is already used
|
||||||
for (uint i=0; i<nbFiles; ++i) {
|
for (uint i=0; i<m_nbFiles; ++i) {
|
||||||
if (i == file_index) continue;
|
if (i == file_index) continue;
|
||||||
#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
|
#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
|
||||||
if (files_path.at(i).compare(new_name, Qt::CaseSensitive) == 0) {
|
if (m_filesPath.at(i).compare(new_name, Qt::CaseSensitive) == 0) {
|
||||||
#else
|
#else
|
||||||
if (files_path.at(i).compare(new_name, Qt::CaseInsensitive) == 0) {
|
if (m_filesPath.at(i).compare(new_name, Qt::CaseInsensitive) == 0) {
|
||||||
#endif
|
#endif
|
||||||
// Display error message
|
// Display error message
|
||||||
QMessageBox::warning(this, tr("The file could not be renamed"),
|
QMessageBox::warning(this, tr("The file could not be renamed"),
|
||||||
@ -442,17 +437,17 @@ void torrentAdditionDialog::renameSelectedFile() {
|
|||||||
new_name = QDir::cleanPath(new_name);
|
new_name = QDir::cleanPath(new_name);
|
||||||
qDebug("Renaming %s to %s", qPrintable(old_name), qPrintable(new_name));
|
qDebug("Renaming %s to %s", qPrintable(old_name), qPrintable(new_name));
|
||||||
// Rename file in files_path
|
// Rename file in files_path
|
||||||
files_path.replace(file_index, new_name);
|
m_filesPath.replace(file_index, new_name);
|
||||||
// Rename in torrent files model too
|
// Rename in torrent files model too
|
||||||
PropListModel->setData(index, new_name_last);
|
m_propListModel->setData(index, new_name_last);
|
||||||
} else {
|
} else {
|
||||||
// Folder renaming
|
// Folder renaming
|
||||||
QStringList path_items;
|
QStringList path_items;
|
||||||
path_items << index.data().toString();
|
path_items << index.data().toString();
|
||||||
QModelIndex parent = PropListModel->parent(index);
|
QModelIndex parent = m_propListModel->parent(index);
|
||||||
while(parent.isValid()) {
|
while(parent.isValid()) {
|
||||||
path_items.prepend(parent.data().toString());
|
path_items.prepend(parent.data().toString());
|
||||||
parent = PropListModel->parent(parent);
|
parent = m_propListModel->parent(parent);
|
||||||
}
|
}
|
||||||
const QString old_path = path_items.join("/");
|
const QString old_path = path_items.join("/");
|
||||||
path_items.removeLast();
|
path_items.removeLast();
|
||||||
@ -460,8 +455,8 @@ void torrentAdditionDialog::renameSelectedFile() {
|
|||||||
QString new_path = path_items.join("/");
|
QString new_path = path_items.join("/");
|
||||||
if (!new_path.endsWith("/")) new_path += "/";
|
if (!new_path.endsWith("/")) new_path += "/";
|
||||||
// Check for overwriting
|
// Check for overwriting
|
||||||
for (uint i=0; i<nbFiles; ++i) {
|
for (uint i=0; i<m_nbFiles; ++i) {
|
||||||
const QString ¤t_name = files_path.at(i);
|
const QString ¤t_name = m_filesPath.at(i);
|
||||||
#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
|
#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
|
||||||
if (current_name.startsWith(new_path, Qt::CaseSensitive)) {
|
if (current_name.startsWith(new_path, Qt::CaseSensitive)) {
|
||||||
#else
|
#else
|
||||||
@ -474,19 +469,19 @@ void torrentAdditionDialog::renameSelectedFile() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Replace path in all files
|
// Replace path in all files
|
||||||
for (uint i=0; i<nbFiles; ++i) {
|
for (uint i=0; i<m_nbFiles; ++i) {
|
||||||
const QString ¤t_name = files_path.at(i);
|
const QString ¤t_name = m_filesPath.at(i);
|
||||||
if (current_name.startsWith(old_path)) {
|
if (current_name.startsWith(old_path)) {
|
||||||
QString new_name = current_name;
|
QString new_name = current_name;
|
||||||
new_name.replace(0, old_path.length(), new_path);
|
new_name.replace(0, old_path.length(), new_path);
|
||||||
new_name = QDir::cleanPath(new_name);
|
new_name = QDir::cleanPath(new_name);
|
||||||
qDebug("Rename %s to %s", qPrintable(current_name), qPrintable(new_name));
|
qDebug("Rename %s to %s", qPrintable(current_name), qPrintable(new_name));
|
||||||
// Rename in files_path
|
// Rename in files_path
|
||||||
files_path.replace(i, new_name);
|
m_filesPath.replace(i, new_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Rename folder in torrent files model too
|
// Rename folder in torrent files model too
|
||||||
PropListModel->setData(index, new_name_last);
|
m_propListModel->setData(index, new_name_last);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -495,19 +490,19 @@ void torrentAdditionDialog::updateDiskSpaceLabels() {
|
|||||||
qDebug("Updating disk space label...");
|
qDebug("Updating disk space label...");
|
||||||
const long long available = misc::freeDiskSpaceOnPath(misc::expandPath(savePathTxt->currentText()));
|
const long long available = misc::freeDiskSpaceOnPath(misc::expandPath(savePathTxt->currentText()));
|
||||||
lbl_disk_space->setText(misc::friendlyUnit(available));
|
lbl_disk_space->setText(misc::friendlyUnit(available));
|
||||||
if (!is_magnet) {
|
if (!m_isMagnet) {
|
||||||
// Determine torrent size
|
// Determine torrent size
|
||||||
qulonglong torrent_size = 0;
|
qulonglong torrent_size = 0;
|
||||||
if (t->num_files() > 1) {
|
if (m_torrentInfo->num_files() > 1) {
|
||||||
const std::vector<int> priorities = PropListModel->model()->getFilesPriorities();
|
const std::vector<int> priorities = m_propListModel->model()->getFilesPriorities();
|
||||||
Q_ASSERT(priorities.size() == t->num_files());
|
Q_ASSERT(priorities.size() == m_torrentInfo->num_files());
|
||||||
|
|
||||||
for (unsigned int i=0; i<priorities.size(); ++i) {
|
for (unsigned int i=0; i<priorities.size(); ++i) {
|
||||||
if (priorities[i] > 0)
|
if (priorities[i] > 0)
|
||||||
torrent_size += t->file_at(i).size;
|
torrent_size += m_torrentInfo->file_at(i).size;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
torrent_size = t->total_size();
|
torrent_size = m_torrentInfo->total_size();
|
||||||
}
|
}
|
||||||
lbl_torrent_size->setText(misc::friendlyUnit(torrent_size));
|
lbl_torrent_size->setText(misc::friendlyUnit(torrent_size));
|
||||||
|
|
||||||
@ -531,14 +526,14 @@ void torrentAdditionDialog::on_browseButton_clicked() {
|
|||||||
QString new_path;
|
QString new_path;
|
||||||
QString root_folder;
|
QString root_folder;
|
||||||
const QString label_name = comboLabel->currentText();
|
const QString label_name = comboLabel->currentText();
|
||||||
if (!is_magnet) {
|
if (!m_isMagnet) {
|
||||||
if (t->num_files() == 1) {
|
if (m_torrentInfo->num_files() == 1) {
|
||||||
new_path = QFileDialog::getSaveFileName(this, tr("Choose save path"), savePathTxt->currentText(), QString(), 0, QFileDialog::DontConfirmOverwrite);
|
new_path = QFileDialog::getSaveFileName(this, tr("Choose save path"), savePathTxt->currentText(), QString(), 0, QFileDialog::DontConfirmOverwrite);
|
||||||
if (!new_path.isEmpty()) {
|
if (!new_path.isEmpty()) {
|
||||||
QStringList path_parts = new_path.replace("\\", "/").split("/");
|
QStringList path_parts = new_path.replace("\\", "/").split("/");
|
||||||
const QString filename = path_parts.takeLast();
|
const QString filename = path_parts.takeLast();
|
||||||
// Append label
|
// Append label
|
||||||
if (QDir(path_parts.join(QDir::separator())) == QDir(defaultSavePath) && !label_name.isEmpty())
|
if (QDir(path_parts.join(QDir::separator())) == QDir(m_defaultSavePath) && !label_name.isEmpty())
|
||||||
path_parts << label_name;
|
path_parts << label_name;
|
||||||
// Append file name
|
// Append file name
|
||||||
path_parts << filename;
|
path_parts << filename;
|
||||||
@ -558,7 +553,7 @@ void torrentAdditionDialog::on_browseButton_clicked() {
|
|||||||
if (path_parts.last().isEmpty())
|
if (path_parts.last().isEmpty())
|
||||||
path_parts.removeLast();
|
path_parts.removeLast();
|
||||||
// Append label
|
// Append label
|
||||||
if (QDir(new_path) == QDir(defaultSavePath) && !label_name.isEmpty())
|
if (QDir(new_path) == QDir(m_defaultSavePath) && !label_name.isEmpty())
|
||||||
path_parts << label_name;
|
path_parts << label_name;
|
||||||
// Append root folder
|
// Append root folder
|
||||||
if (!root_folder.isEmpty())
|
if (!root_folder.isEmpty())
|
||||||
@ -571,9 +566,9 @@ void torrentAdditionDialog::on_browseButton_clicked() {
|
|||||||
// Check if this new path already exists in the list
|
// Check if this new path already exists in the list
|
||||||
QString new_truncated_path = getTruncatedSavePath(new_path);
|
QString new_truncated_path = getTruncatedSavePath(new_path);
|
||||||
#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
|
#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
|
||||||
const int cur_index = path_history.indexOf(QRegExp(new_truncated_path, Qt::CaseInsensitive));
|
const int cur_index = m_pathHistory.indexOf(QRegExp(new_truncated_path, Qt::CaseInsensitive));
|
||||||
#else
|
#else
|
||||||
const int cur_index = path_history.indexOf(QRegExp(new_truncated_path, Qt::CaseSensitive));
|
const int cur_index = m_pathHistory.indexOf(QRegExp(new_truncated_path, Qt::CaseSensitive));
|
||||||
#endif
|
#endif
|
||||||
if (cur_index >= 0) {
|
if (cur_index >= 0) {
|
||||||
savePathTxt->setCurrentIndex(cur_index);
|
savePathTxt->setCurrentIndex(cur_index);
|
||||||
@ -590,15 +585,15 @@ void torrentAdditionDialog::on_CancelButton_clicked() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool torrentAdditionDialog::allFiltered() const {
|
bool torrentAdditionDialog::allFiltered() const {
|
||||||
Q_ASSERT(!is_magnet);
|
Q_ASSERT(!m_isMagnet);
|
||||||
return PropListModel->model()->allFiltered();
|
return m_propListModel->model()->allFiltered();
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrentAdditionDialog::savePiecesPriorities() {
|
void torrentAdditionDialog::savePiecesPriorities() {
|
||||||
qDebug("Saving pieces priorities");
|
qDebug("Saving pieces priorities");
|
||||||
Q_ASSERT(!is_magnet);
|
Q_ASSERT(!m_isMagnet);
|
||||||
const std::vector<int> priorities = PropListModel->model()->getFilesPriorities();
|
const std::vector<int> priorities = m_propListModel->model()->getFilesPriorities();
|
||||||
TorrentTempData::setFilesPriority(hash, priorities);
|
TorrentTempData::setFilesPriority(m_hash, priorities);
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrentAdditionDialog::on_OkButton_clicked() {
|
void torrentAdditionDialog::on_OkButton_clicked() {
|
||||||
@ -614,12 +609,12 @@ void torrentAdditionDialog::on_OkButton_clicked() {
|
|||||||
#endif
|
#endif
|
||||||
save_path = misc::expandPath(save_path);
|
save_path = misc::expandPath(save_path);
|
||||||
qDebug("Save path is %s", qPrintable(save_path));
|
qDebug("Save path is %s", qPrintable(save_path));
|
||||||
if (!is_magnet && t->num_files() == 1) {
|
if (!m_isMagnet && m_torrentInfo->num_files() == 1) {
|
||||||
// Remove file name
|
// Remove file name
|
||||||
QStringList parts = save_path.split("/");
|
QStringList parts = save_path.split("/");
|
||||||
const QString single_file_name = parts.takeLast();
|
const QString single_file_name = parts.takeLast();
|
||||||
Q_ASSERT(files_path.isEmpty());
|
Q_ASSERT(m_filesPath.isEmpty());
|
||||||
files_path << single_file_name;
|
m_filesPath << single_file_name;
|
||||||
save_path = parts.join("/");
|
save_path = parts.join("/");
|
||||||
}
|
}
|
||||||
qDebug("Save path dir is %s", qPrintable(save_path));
|
qDebug("Save path dir is %s", qPrintable(save_path));
|
||||||
@ -631,27 +626,27 @@ void torrentAdditionDialog::on_OkButton_clicked() {
|
|||||||
}
|
}
|
||||||
// Save savepath
|
// Save savepath
|
||||||
qDebug("Saving save path to temp data: %s", qPrintable(savePath.absolutePath()));
|
qDebug("Saving save path to temp data: %s", qPrintable(savePath.absolutePath()));
|
||||||
TorrentTempData::setSavePath(hash, savePath.absolutePath());
|
TorrentTempData::setSavePath(m_hash, savePath.absolutePath());
|
||||||
qDebug("Torrent label is: %s", qPrintable(comboLabel->currentText().trimmed()));
|
qDebug("Torrent label is: %s", qPrintable(comboLabel->currentText().trimmed()));
|
||||||
if (!current_label.isEmpty())
|
if (!current_label.isEmpty())
|
||||||
TorrentTempData::setLabel(hash, current_label);
|
TorrentTempData::setLabel(m_hash, current_label);
|
||||||
// Is download sequential?
|
// Is download sequential?
|
||||||
TorrentTempData::setSequential(hash, checkIncrementalDL->isChecked());
|
TorrentTempData::setSequential(m_hash, checkIncrementalDL->isChecked());
|
||||||
// Save files path
|
// Save files path
|
||||||
// Loads files path in the torrent
|
// Loads files path in the torrent
|
||||||
if (!is_magnet) {
|
if (!m_isMagnet) {
|
||||||
bool path_changed = false;
|
bool path_changed = false;
|
||||||
for (uint i=0; i<nbFiles; ++i) {
|
for (uint i=0; i<m_nbFiles; ++i) {
|
||||||
#if LIBTORRENT_VERSION_MINOR >= 16
|
#if LIBTORRENT_VERSION_MINOR >= 16
|
||||||
file_storage fs = t->files();
|
file_storage fs = m_torrentInfo->files();
|
||||||
QString old_path = misc::toQStringU(fs.file_path(t->file_at(i)));
|
QString old_path = misc::toQStringU(fs.file_path(m_torrentInfo->file_at(i)));
|
||||||
#else
|
#else
|
||||||
QString old_path = misc::toQStringU(t->file_at(i).path.string());
|
QString old_path = misc::toQStringU(m_torrentInfo->file_at(i).path.string());
|
||||||
#endif
|
#endif
|
||||||
#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
|
#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
|
||||||
if (files_path.at(i).compare(old_path, Qt::CaseSensitive) != 0) {
|
if (m_filesPath.at(i).compare(old_path, Qt::CaseSensitive) != 0) {
|
||||||
#else
|
#else
|
||||||
if (files_path.at(i).compare(old_path, Qt::CaseInsensitive) != 0) {
|
if (m_filesPath.at(i).compare(old_path, Qt::CaseInsensitive) != 0) {
|
||||||
#endif
|
#endif
|
||||||
path_changed = true;
|
path_changed = true;
|
||||||
break;
|
break;
|
||||||
@ -659,21 +654,21 @@ void torrentAdditionDialog::on_OkButton_clicked() {
|
|||||||
}
|
}
|
||||||
if (path_changed) {
|
if (path_changed) {
|
||||||
qDebug("Changing files paths");
|
qDebug("Changing files paths");
|
||||||
TorrentTempData::setFilesPath(hash, files_path);
|
TorrentTempData::setFilesPath(m_hash, m_filesPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Skip file checking and directly start seeding
|
// Skip file checking and directly start seeding
|
||||||
if (addInSeed->isChecked()) {
|
if (addInSeed->isChecked()) {
|
||||||
// Check if local file(s) actually exist
|
// Check if local file(s) actually exist
|
||||||
if (is_magnet || QFile::exists(savePathTxt->currentText())) {
|
if (m_isMagnet || QFile::exists(savePathTxt->currentText())) {
|
||||||
TorrentTempData::setSeedingMode(hash, true);
|
TorrentTempData::setSeedingMode(m_hash, true);
|
||||||
} else {
|
} else {
|
||||||
QMessageBox::warning(0, tr("Seeding mode error"), tr("You chose to skip file checking. However, local files do not seem to exist in the current destionation folder. Please disable this feature or update the save path."));
|
QMessageBox::warning(0, tr("Seeding mode error"), tr("You chose to skip file checking. However, local files do not seem to exist in the current destionation folder. Please disable this feature or update the save path."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check if there is at least one selected file
|
// Check if there is at least one selected file
|
||||||
if (!is_magnet && t->num_files() > 1 && allFiltered()) {
|
if (!m_isMagnet && m_torrentInfo->num_files() > 1 && allFiltered()) {
|
||||||
QMessageBox::warning(0, tr("Invalid file selection"), tr("You must select at least one file in the torrent"));
|
QMessageBox::warning(0, tr("Invalid file selection"), tr("You must select at least one file in the torrent"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -693,14 +688,14 @@ void torrentAdditionDialog::on_OkButton_clicked() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// save filtered files
|
// save filtered files
|
||||||
if (!is_magnet && t->num_files() > 1)
|
if (!m_isMagnet && m_torrentInfo->num_files() > 1)
|
||||||
savePiecesPriorities();
|
savePiecesPriorities();
|
||||||
// Add to download list
|
// Add to download list
|
||||||
QTorrentHandle h;
|
QTorrentHandle h;
|
||||||
if (is_magnet)
|
if (m_isMagnet)
|
||||||
h = QBtSession::instance()->addMagnetUri(from_url, false);
|
h = QBtSession::instance()->addMagnetUri(m_fromUrl, false);
|
||||||
else
|
else
|
||||||
h = QBtSession::instance()->addTorrent(filePath, false, from_url);
|
h = QBtSession::instance()->addTorrent(m_filePath, false, m_fromUrl);
|
||||||
if (addInPause->isChecked() && h.is_valid()) {
|
if (addInPause->isChecked() && h.is_valid()) {
|
||||||
h.pause();
|
h.pause();
|
||||||
}
|
}
|
||||||
@ -719,30 +714,30 @@ void torrentAdditionDialog::resetComboLabelIndex(QString text) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void torrentAdditionDialog::updateLabelInSavePath(QString label) {
|
void torrentAdditionDialog::updateLabelInSavePath(QString label) {
|
||||||
if (appendLabelToSavePath) {
|
if (m_appendLabelToSavePath) {
|
||||||
// Update Label in combobox
|
// Update Label in combobox
|
||||||
savePathTxt->setItemText(0, misc::updateLabelInSavePath(defaultSavePath, savePathTxt->itemText(0), old_label, label));
|
savePathTxt->setItemText(0, misc::updateLabelInSavePath(m_defaultSavePath, savePathTxt->itemText(0), m_oldLabel, label));
|
||||||
// update edit text
|
// update edit text
|
||||||
savePathTxt->setEditText(misc::updateLabelInSavePath(defaultSavePath, savePathTxt->currentText(), old_label, label));
|
savePathTxt->setEditText(misc::updateLabelInSavePath(m_defaultSavePath, savePathTxt->currentText(), m_oldLabel, label));
|
||||||
old_label = label;
|
m_oldLabel = label;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrentAdditionDialog::updateSavePathCurrentText() {
|
void torrentAdditionDialog::updateSavePathCurrentText() {
|
||||||
qDebug("updateSavePathCurrentText() - ENTER");
|
qDebug("updateSavePathCurrentText() - ENTER");
|
||||||
savePathTxt->setItemText(savePathTxt->currentIndex(), savePathTxt->currentText());
|
savePathTxt->setItemText(savePathTxt->currentIndex(), savePathTxt->currentText());
|
||||||
qDebug("path_history.size() == %d", path_history.size());
|
qDebug("path_history.size() == %d", m_pathHistory.size());
|
||||||
qDebug("savePathTxt->currentIndex() == %d", savePathTxt->currentIndex());
|
qDebug("savePathTxt->currentIndex() == %d", savePathTxt->currentIndex());
|
||||||
path_history.replace(savePathTxt->currentIndex(), getCurrentTruncatedSavePath());
|
m_pathHistory.replace(savePathTxt->currentIndex(), getCurrentTruncatedSavePath());
|
||||||
QString root_folder_or_file_name = "";
|
QString root_folder_or_file_name = "";
|
||||||
getCurrentTruncatedSavePath(&root_folder_or_file_name);
|
getCurrentTruncatedSavePath(&root_folder_or_file_name);
|
||||||
// Update other combo items
|
// Update other combo items
|
||||||
for (int i=0; i<savePathTxt->count(); ++i) {
|
for (int i=0; i<savePathTxt->count(); ++i) {
|
||||||
if (i == savePathTxt->currentIndex()) continue;
|
if (i == savePathTxt->currentIndex()) continue;
|
||||||
QString item_path = path_history.at(i);
|
QString item_path = m_pathHistory.at(i);
|
||||||
if (item_path.isEmpty()) continue;
|
if (item_path.isEmpty()) continue;
|
||||||
// Append label
|
// Append label
|
||||||
if (i == 0 && appendLabelToSavePath && QDir(item_path) == QDir(defaultSavePath) && !comboLabel->currentText().isEmpty())
|
if (i == 0 && m_appendLabelToSavePath && QDir(item_path) == QDir(m_defaultSavePath) && !comboLabel->currentText().isEmpty())
|
||||||
item_path += comboLabel->currentText() + "/";
|
item_path += comboLabel->currentText() + "/";
|
||||||
// Append root_folder or filename
|
// Append root_folder or filename
|
||||||
if (!root_folder_or_file_name.isEmpty())
|
if (!root_folder_or_file_name.isEmpty())
|
||||||
@ -765,13 +760,13 @@ QString torrentAdditionDialog::getTruncatedSavePath(QString save_path, QString*
|
|||||||
save_path = misc::expandPath(save_path);
|
save_path = misc::expandPath(save_path);
|
||||||
QStringList parts = save_path.replace("\\", "/").split("/");
|
QStringList parts = save_path.replace("\\", "/").split("/");
|
||||||
// Remove torrent root folder
|
// Remove torrent root folder
|
||||||
if (!QDir(save_path).exists() || (!is_magnet && t->num_files() == 1)) {
|
if (!QDir(save_path).exists() || (!m_isMagnet && m_torrentInfo->num_files() == 1)) {
|
||||||
QString tmp = parts.takeLast();
|
QString tmp = parts.takeLast();
|
||||||
if (root_folder_or_file_name)
|
if (root_folder_or_file_name)
|
||||||
*root_folder_or_file_name = tmp;
|
*root_folder_or_file_name = tmp;
|
||||||
}
|
}
|
||||||
// Remove label
|
// Remove label
|
||||||
if (appendLabelToSavePath && savePathTxt->currentIndex() == 0 && parts.last() == comboLabel->currentText()) {
|
if (m_appendLabelToSavePath && savePathTxt->currentIndex() == 0 && parts.last() == comboLabel->currentText()) {
|
||||||
parts.removeLast();
|
parts.removeLast();
|
||||||
}
|
}
|
||||||
QString truncated_path = parts.join("/");
|
QString truncated_path = parts.join("/");
|
||||||
@ -806,12 +801,12 @@ void torrentAdditionDialog::loadSavePathHistory() {
|
|||||||
// Load save path history
|
// Load save path history
|
||||||
QStringList raw_path_history = settings.value("TorrentAdditionDlg/save_path_history").toStringList();
|
QStringList raw_path_history = settings.value("TorrentAdditionDlg/save_path_history").toStringList();
|
||||||
foreach (const QString &sp, raw_path_history) {
|
foreach (const QString &sp, raw_path_history) {
|
||||||
if (QDir(sp) != QDir(defaultSavePath)) {
|
if (QDir(sp) != QDir(m_defaultSavePath)) {
|
||||||
QString dsp = sp;
|
QString dsp = sp;
|
||||||
#if defined(Q_WS_WIN) || defined(Q_OS_OS2)
|
#if defined(Q_WS_WIN) || defined(Q_OS_OS2)
|
||||||
dsp.replace("/", "\\");
|
dsp.replace("/", "\\");
|
||||||
#endif
|
#endif
|
||||||
path_history << sp;
|
m_pathHistory << sp;
|
||||||
savePathTxt->addItem(dsp);
|
savePathTxt->addItem(dsp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,8 +46,8 @@ class torrentAdditionDialog : public QDialog, private Ui_addTorrentDialog{
|
|||||||
public:
|
public:
|
||||||
torrentAdditionDialog(QWidget *parent);
|
torrentAdditionDialog(QWidget *parent);
|
||||||
~torrentAdditionDialog();
|
~torrentAdditionDialog();
|
||||||
void showLoadMagnetURI(QString magnet_uri);
|
void showLoadMagnetURI(const QString& magnet_uri);
|
||||||
void showLoad(QString filePath, QString from_url=QString::null);
|
void showLoad(const QString& m_filePath, const QString& m_fromUrl = QString());
|
||||||
QString getCurrentTruncatedSavePath(QString* root_folder_or_file_name = 0) const;
|
QString getCurrentTruncatedSavePath(QString* root_folder_or_file_name = 0) const;
|
||||||
QString getTruncatedSavePath(QString save_path, QString* root_folder_or_file_name = 0) const;
|
QString getTruncatedSavePath(QString save_path, QString* root_folder_or_file_name = 0) const;
|
||||||
bool allFiltered() const;
|
bool allFiltered() const;
|
||||||
@ -76,21 +76,21 @@ private:
|
|||||||
void saveSettings();
|
void saveSettings();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString fileName;
|
QString m_fileName;
|
||||||
QString hash;
|
QString m_hash;
|
||||||
QString filePath;
|
QString m_filePath;
|
||||||
QString from_url;
|
QString m_fromUrl;
|
||||||
QString defaultSavePath;
|
QString m_defaultSavePath;
|
||||||
QString old_label;
|
QString m_oldLabel;
|
||||||
bool appendLabelToSavePath;
|
bool m_appendLabelToSavePath;
|
||||||
TorrentContentFilterModel *PropListModel;
|
TorrentContentFilterModel *m_propListModel;
|
||||||
PropListDelegate *PropDelegate;
|
PropListDelegate *m_propListDelegate;
|
||||||
unsigned int nbFiles;
|
unsigned int m_nbFiles;
|
||||||
boost::intrusive_ptr<libtorrent::torrent_info> t;
|
boost::intrusive_ptr<libtorrent::torrent_info> m_torrentInfo;
|
||||||
QStringList files_path;
|
QStringList m_filesPath;
|
||||||
bool is_magnet;
|
bool m_isMagnet;
|
||||||
int hidden_height;
|
int m_hiddenHeight;
|
||||||
QStringList path_history;
|
QStringList m_pathHistory;
|
||||||
bool m_showContentList;
|
bool m_showContentList;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user