mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 15:37:26 -06:00
Setting for creating subfolder on multifile torrents. Closes #588.
This commit is contained in:
committed by
Vladimir Golovnev (Glassez)
parent
07af8c9648
commit
4b2d8a7941
@@ -35,6 +35,7 @@
|
||||
#include <QMenu>
|
||||
#include <QFileDialog>
|
||||
|
||||
#include "base/preferences.h"
|
||||
#include "base/settingsstorage.h"
|
||||
#include "base/net/downloadmanager.h"
|
||||
#include "base/net/downloadhandler.h"
|
||||
@@ -95,6 +96,7 @@ AddNewTorrentDialog::AddNewTorrentDialog(QWidget *parent)
|
||||
connect(ui->savePathComboBox, SIGNAL(currentIndexChanged(int)), SLOT(onSavePathChanged(int)));
|
||||
connect(ui->browseButton, SIGNAL(clicked()), SLOT(browseButton_clicked()));
|
||||
ui->defaultSavePathCheckBox->setVisible(false); // Default path is selected by default
|
||||
ui->createSubfolderComboBox->setChecked(Preferences::instance()->getTorrentCreateSubfolder());
|
||||
|
||||
ui->doNotDeleteTorrentCheckBox->setVisible(TorrentFileGuard::autoDeleteMode() != TorrentFileGuard::Never);
|
||||
|
||||
@@ -624,9 +626,8 @@ void AddNewTorrentDialog::accept()
|
||||
|
||||
BitTorrent::AddTorrentParams params;
|
||||
|
||||
if (ui->skip_check_cb->isChecked())
|
||||
// TODO: Check if destination actually exists
|
||||
params.skipChecking = true;
|
||||
// TODO: Check if destination actually exists
|
||||
params.skipChecking = ui->skip_check_cb->isChecked();
|
||||
|
||||
// Category
|
||||
params.category = ui->categoryComboBox->currentText();
|
||||
@@ -639,6 +640,7 @@ void AddNewTorrentDialog::accept()
|
||||
params.filePriorities = m_contentModel->model()->getFilePriorities();
|
||||
|
||||
params.addPaused = !ui->startTorrentCheckBox->isChecked();
|
||||
params.createSubfolder = ui->createSubfolderComboBox->isChecked();
|
||||
|
||||
QString savePath = ui->savePathComboBox->itemData(ui->savePathComboBox->currentIndex()).toString();
|
||||
if (ui->comboTTM->currentIndex() != 1) { // 0 is Manual mode and 1 is Automatic mode. Handle all non 1 values as manual mode.
|
||||
|
||||
@@ -192,6 +192,26 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="start_torrent_cb">
|
||||
<property name="text">
|
||||
<string>Start torrent</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="createSubfolderComboBox">
|
||||
<property name="text">
|
||||
<string>Create subfolder</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -214,6 +214,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
||||
connect(m_ui->checkAdditionDialog, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(m_ui->checkAdditionDialogFront, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(m_ui->checkStartPaused, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(m_ui->checkCreateSubfolder, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(m_ui->deleteTorrentBox, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(m_ui->deleteCancelledTorrentBox, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(m_ui->checkExportDir, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
@@ -515,6 +516,7 @@ void OptionsDialog::saveOptions()
|
||||
AddNewTorrentDialog::setEnabled(useAdditionDialog());
|
||||
AddNewTorrentDialog::setTopLevel(m_ui->checkAdditionDialogFront->isChecked());
|
||||
session->setAddTorrentPaused(addTorrentsInPause());
|
||||
pref->setTorrentCreateSubfolder(m_ui->checkCreateSubfolder->isChecked());
|
||||
ScanFoldersModel::instance()->removeFromFSWatcher(removedScanDirs);
|
||||
ScanFoldersModel::instance()->addToFSWatcher(addedScanDirs);
|
||||
ScanFoldersModel::instance()->makePersistent();
|
||||
@@ -716,6 +718,7 @@ void OptionsDialog::loadOptions()
|
||||
m_ui->checkAdditionDialog->setChecked(AddNewTorrentDialog::isEnabled());
|
||||
m_ui->checkAdditionDialogFront->setChecked(AddNewTorrentDialog::isTopLevel());
|
||||
m_ui->checkStartPaused->setChecked(session->isAddTorrentPaused());
|
||||
m_ui->checkCreateSubfolder->setChecked(pref->getTorrentCreateSubfolder());
|
||||
const TorrentFileGuard::AutoDeleteMode autoDeleteMode = TorrentFileGuard::autoDeleteMode();
|
||||
m_ui->deleteTorrentBox->setChecked(autoDeleteMode != TorrentFileGuard::Never);
|
||||
m_ui->deleteCancelledTorrentBox->setChecked(autoDeleteMode == TorrentFileGuard::Always);
|
||||
|
||||
@@ -709,6 +709,16 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="checkCreateSubfolder">
|
||||
<property name="text">
|
||||
<string>Create subfolder for torrents with multiple files</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkStartPaused">
|
||||
<property name="text">
|
||||
|
||||
@@ -315,8 +315,11 @@ void PropertiesWidget::loadTorrentInfos(BitTorrent::TorrentHandle *const torrent
|
||||
label_created_by_val->setText(m_torrent->creator().toHtmlEscaped());
|
||||
|
||||
// List files in torrent
|
||||
PropListModel->model()->setupModelData(m_torrent->info());
|
||||
filesList->setExpanded(PropListModel->index(0, 0), true);
|
||||
BitTorrent::TorrentInfo info = m_torrent->info();
|
||||
libtorrent::file_storage files = info.files();
|
||||
PropListModel->model()->setupModelData(info);
|
||||
if (!(info.filesCount() > 1 && files.name().empty()))
|
||||
filesList->setExpanded(PropListModel->index(0, 0), true);
|
||||
|
||||
// Load file priorities
|
||||
PropListModel->model()->updateFilesPriorities(m_torrent->filePriorities());
|
||||
|
||||
Reference in New Issue
Block a user