mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +00:00
Fix strip torrent root folder
This commit is contained in:
parent
6d7d566cdf
commit
22178f9997
@ -244,6 +244,7 @@ Session::Session(QObject *parent)
|
||||
, m_additionalTrackers(BITTORRENT_SESSION_KEY("AdditionalTrackers"))
|
||||
, m_globalMaxRatio(BITTORRENT_SESSION_KEY("GlobalMaxRatio"), -1, [](qreal r) { return r < 0 ? -1. : r;})
|
||||
, m_isAddTorrentPaused(BITTORRENT_SESSION_KEY("AddTorrentPaused"), false)
|
||||
, m_isCreateTorrentSubfolder(BITTORRENT_SESSION_KEY("CreateTorrentSubfolder"), true)
|
||||
, m_isAppendExtensionEnabled(BITTORRENT_SESSION_KEY("AddExtensionToIncompleteFiles"), false)
|
||||
, m_refreshInterval(BITTORRENT_SESSION_KEY("RefreshInterval"), 1500)
|
||||
, m_isPreallocationEnabled(BITTORRENT_SESSION_KEY("Preallocation"), false)
|
||||
@ -3253,6 +3254,16 @@ void Session::getPendingAlerts(std::vector<libt::alert *> &out, ulong time)
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Session::isCreateTorrentSubfolder() const
|
||||
{
|
||||
return m_isCreateTorrentSubfolder;
|
||||
}
|
||||
|
||||
void Session::setCreateTorrentSubfolder(bool value)
|
||||
{
|
||||
m_isCreateTorrentSubfolder = value;
|
||||
}
|
||||
|
||||
// Read alerts sent by the BitTorrent session
|
||||
void Session::readAlerts()
|
||||
{
|
||||
|
@ -222,6 +222,8 @@ namespace BitTorrent
|
||||
void setPeXEnabled(bool enabled);
|
||||
bool isAddTorrentPaused() const;
|
||||
void setAddTorrentPaused(bool value);
|
||||
bool isCreateTorrentSubfolder() const;
|
||||
void setCreateTorrentSubfolder(bool value);
|
||||
bool isTrackerEnabled() const;
|
||||
void setTrackerEnabled(bool enabled);
|
||||
bool isAppendExtensionEnabled() const;
|
||||
@ -539,6 +541,7 @@ namespace BitTorrent
|
||||
CachedSettingValue<QString> m_additionalTrackers;
|
||||
CachedSettingValue<qreal> m_globalMaxRatio;
|
||||
CachedSettingValue<bool> m_isAddTorrentPaused;
|
||||
CachedSettingValue<bool> m_isCreateTorrentSubfolder;
|
||||
CachedSettingValue<bool> m_isAppendExtensionEnabled;
|
||||
CachedSettingValue<uint> m_refreshInterval;
|
||||
CachedSettingValue<bool> m_isPreallocationEnabled;
|
||||
|
@ -263,16 +263,6 @@ void Preferences::setLastLocationPath(const QString &path)
|
||||
setValue("Preferences/Downloads/LastLocationPath", Utils::Fs::fromNativePath(path));
|
||||
}
|
||||
|
||||
bool Preferences::getTorrentCreateSubfolder() const
|
||||
{
|
||||
return value("Preferences/Downloads/CreateSubfolder", true).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setTorrentCreateSubfolder(bool b)
|
||||
{
|
||||
setValue("Preferences/Downloads/CreateSubfolder", b);
|
||||
}
|
||||
|
||||
QVariantHash Preferences::getScanDirs() const
|
||||
{
|
||||
return value("Preferences/Downloads/ScanDirsV2").toHash();
|
||||
|
@ -138,8 +138,6 @@ public:
|
||||
void setLastLocationPath(const QString &path);
|
||||
QVariantHash getScanDirs() const;
|
||||
void setScanDirs(const QVariantHash &dirs);
|
||||
bool getTorrentCreateSubfolder() const;
|
||||
void setTorrentCreateSubfolder(bool b);
|
||||
QString getScanDirsLastPath() const;
|
||||
void setScanDirsLastPath(const QString &path);
|
||||
bool isMailNotificationEnabled() const;
|
||||
|
@ -96,7 +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->createSubfolderCheckBox->setChecked(session->isCreateTorrentSubfolder());
|
||||
|
||||
ui->doNotDeleteTorrentCheckBox->setVisible(TorrentFileGuard::autoDeleteMode() != TorrentFileGuard::Never);
|
||||
|
||||
@ -627,7 +627,7 @@ void AddNewTorrentDialog::accept()
|
||||
BitTorrent::AddTorrentParams params;
|
||||
|
||||
// TODO: Check if destination actually exists
|
||||
params.skipChecking = ui->skip_check_cb->isChecked();
|
||||
params.skipChecking = ui->skipCheckingCheckBox->isChecked();
|
||||
|
||||
// Category
|
||||
params.category = ui->categoryComboBox->currentText();
|
||||
@ -640,7 +640,7 @@ void AddNewTorrentDialog::accept()
|
||||
params.filePriorities = m_contentModel->model()->getFilePriorities();
|
||||
|
||||
params.addPaused = !ui->startTorrentCheckBox->isChecked();
|
||||
params.createSubfolder = ui->createSubfolderComboBox->isChecked();
|
||||
params.createSubfolder = ui->createSubfolderCheckBox->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.
|
||||
|
@ -170,7 +170,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="skip_check_cb">
|
||||
<widget class="QCheckBox" name="skipCheckingCheckBox">
|
||||
<property name="text">
|
||||
<string>Skip hash check</string>
|
||||
</property>
|
||||
@ -193,7 +193,7 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="start_torrent_cb">
|
||||
<widget class="QCheckBox" name="startTorrentCheckBox_2">
|
||||
<property name="text">
|
||||
<string>Start torrent</string>
|
||||
</property>
|
||||
@ -203,7 +203,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="createSubfolderComboBox">
|
||||
<widget class="QCheckBox" name="createSubfolderCheckBox">
|
||||
<property name="text">
|
||||
<string>Create subfolder</string>
|
||||
</property>
|
||||
@ -305,8 +305,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>308</width>
|
||||
<height>74</height>
|
||||
<width>321</width>
|
||||
<height>69</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
@ -423,7 +423,7 @@
|
||||
<tabstop>never_show_cb</tabstop>
|
||||
<tabstop>adv_button</tabstop>
|
||||
<tabstop>startTorrentCheckBox</tabstop>
|
||||
<tabstop>skip_check_cb</tabstop>
|
||||
<tabstop>skipCheckingCheckBox</tabstop>
|
||||
<tabstop>categoryComboBox</tabstop>
|
||||
<tabstop>defaultCategoryCheckbox</tabstop>
|
||||
<tabstop>scrollArea</tabstop>
|
||||
|
@ -516,7 +516,7 @@ void OptionsDialog::saveOptions()
|
||||
AddNewTorrentDialog::setEnabled(useAdditionDialog());
|
||||
AddNewTorrentDialog::setTopLevel(m_ui->checkAdditionDialogFront->isChecked());
|
||||
session->setAddTorrentPaused(addTorrentsInPause());
|
||||
pref->setTorrentCreateSubfolder(m_ui->checkCreateSubfolder->isChecked());
|
||||
session->setCreateTorrentSubfolder(m_ui->checkCreateSubfolder->isChecked());
|
||||
ScanFoldersModel::instance()->removeFromFSWatcher(removedScanDirs);
|
||||
ScanFoldersModel::instance()->addToFSWatcher(addedScanDirs);
|
||||
ScanFoldersModel::instance()->makePersistent();
|
||||
@ -718,7 +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());
|
||||
m_ui->checkCreateSubfolder->setChecked(session->isCreateTorrentSubfolder());
|
||||
const TorrentFileGuard::AutoDeleteMode autoDeleteMode = TorrentFileGuard::autoDeleteMode();
|
||||
m_ui->deleteTorrentBox->setChecked(autoDeleteMode != TorrentFileGuard::Never);
|
||||
m_ui->deleteCancelledTorrentBox->setChecked(autoDeleteMode == TorrentFileGuard::Always);
|
||||
|
Loading…
Reference in New Issue
Block a user