Browse Source

Merge pull request #12689 from thalieht/subfolder

Rename "Create subfolder" option to "Keep subfolder"
adaptive-webui-19844
Mike Tzou 4 years ago committed by GitHub
parent
commit
2aa80fe9ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      src/base/bittorrent/session.cpp
  2. 6
      src/base/bittorrent/session.h
  3. 2
      src/base/bittorrent/torrenthandleimpl.cpp
  4. 8
      src/gui/addnewtorrentdialog.cpp
  5. 4
      src/gui/addnewtorrentdialog.ui
  6. 6
      src/gui/optionsdialog.cpp
  7. 4
      src/gui/optionsdialog.ui
  8. 4
      src/gui/rss/automatedrssdownloader.ui
  9. 4
      src/webui/api/appcontroller.cpp
  10. 2
      src/webui/www/private/download.html
  11. 2
      src/webui/www/private/upload.html
  12. 2
      src/webui/www/private/views/preferences.html

10
src/base/bittorrent/session.cpp

@ -492,7 +492,7 @@ Session::Session(QObject *parent) @@ -492,7 +492,7 @@ Session::Session(QObject *parent)
, m_globalMaxRatio(BITTORRENT_SESSION_KEY("GlobalMaxRatio"), -1, [](qreal r) { return r < 0 ? -1. : r;})
, m_globalMaxSeedingMinutes(BITTORRENT_SESSION_KEY("GlobalMaxSeedingMinutes"), -1, lowerLimited(-1))
, m_isAddTorrentPaused(BITTORRENT_SESSION_KEY("AddTorrentPaused"), false)
, m_isCreateTorrentSubfolder(BITTORRENT_SESSION_KEY("CreateTorrentSubfolder"), true)
, m_isKeepTorrentTopLevelFolder(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)
@ -4392,14 +4392,14 @@ std::vector<lt::alert *> Session::getPendingAlerts(const lt::time_duration time) @@ -4392,14 +4392,14 @@ std::vector<lt::alert *> Session::getPendingAlerts(const lt::time_duration time)
return alerts;
}
bool Session::isCreateTorrentSubfolder() const
bool Session::isKeepTorrentTopLevelFolder() const
{
return m_isCreateTorrentSubfolder;
return m_isKeepTorrentTopLevelFolder;
}
void Session::setCreateTorrentSubfolder(const bool value)
void Session::setKeepTorrentTopLevelFolder(const bool value)
{
m_isCreateTorrentSubfolder = value;
m_isKeepTorrentTopLevelFolder = value;
}
// Read alerts sent by the BitTorrent session

6
src/base/bittorrent/session.h

@ -267,8 +267,8 @@ namespace BitTorrent @@ -267,8 +267,8 @@ namespace BitTorrent
void setPeXEnabled(bool enabled);
bool isAddTorrentPaused() const;
void setAddTorrentPaused(bool value);
bool isCreateTorrentSubfolder() const;
void setCreateTorrentSubfolder(bool value);
bool isKeepTorrentTopLevelFolder() const;
void setKeepTorrentTopLevelFolder(bool value);
bool isTrackerEnabled() const;
void setTrackerEnabled(bool enabled);
bool isAppendExtensionEnabled() const;
@ -677,7 +677,7 @@ namespace BitTorrent @@ -677,7 +677,7 @@ namespace BitTorrent
CachedSettingValue<qreal> m_globalMaxRatio;
CachedSettingValue<int> m_globalMaxSeedingMinutes;
CachedSettingValue<bool> m_isAddTorrentPaused;
CachedSettingValue<bool> m_isCreateTorrentSubfolder;
CachedSettingValue<bool> m_isKeepTorrentTopLevelFolder;
CachedSettingValue<bool> m_isAppendExtensionEnabled;
CachedSettingValue<uint> m_refreshInterval;
CachedSettingValue<bool> m_isPreallocationEnabled;

2
src/base/bittorrent/torrenthandleimpl.cpp

@ -140,7 +140,7 @@ CreateTorrentParams::CreateTorrentParams(const AddTorrentParams &params) @@ -140,7 +140,7 @@ CreateTorrentParams::CreateTorrentParams(const AddTorrentParams &params)
, hasSeedStatus(params.skipChecking) // do not react on 'torrent_finished_alert' when skipping
, skipChecking(params.skipChecking)
, hasRootFolder(params.createSubfolder == TriStateBool::Undefined
? Session::instance()->isCreateTorrentSubfolder()
? Session::instance()->isKeepTorrentTopLevelFolder()
: params.createSubfolder == TriStateBool::True)
, forced(params.addForced == TriStateBool::True)
, paused(params.addPaused == TriStateBool::Undefined

8
src/gui/addnewtorrentdialog.cpp

@ -123,11 +123,11 @@ AddNewTorrentDialog::AddNewTorrentDialog(const BitTorrent::AddTorrentParams &inP @@ -123,11 +123,11 @@ AddNewTorrentDialog::AddNewTorrentDialog(const BitTorrent::AddTorrentParams &inP
m_ui->checkBoxRememberLastSavePath->setChecked(rememberLastSavePath);
if (m_torrentParams.createSubfolder == TriStateBool::True)
m_ui->createSubfolderCheckBox->setChecked(true);
m_ui->keepTopLevelFolderCheckBox->setChecked(true);
else if (m_torrentParams.createSubfolder == TriStateBool::False)
m_ui->createSubfolderCheckBox->setChecked(false);
m_ui->keepTopLevelFolderCheckBox->setChecked(false);
else
m_ui->createSubfolderCheckBox->setChecked(session->isCreateTorrentSubfolder());
m_ui->keepTopLevelFolderCheckBox->setChecked(session->isKeepTorrentTopLevelFolder());
m_ui->sequentialCheckBox->setChecked(m_torrentParams.sequential);
m_ui->firstLastCheckBox->setChecked(m_torrentParams.firstLastPiecePriority);
@ -553,7 +553,7 @@ void AddNewTorrentDialog::accept() @@ -553,7 +553,7 @@ void AddNewTorrentDialog::accept()
m_torrentParams.filePriorities = m_contentModel->model()->getFilePriorities();
m_torrentParams.addPaused = TriStateBool(!m_ui->startTorrentCheckBox->isChecked());
m_torrentParams.createSubfolder = TriStateBool(m_ui->createSubfolderCheckBox->isChecked());
m_torrentParams.createSubfolder = TriStateBool(m_ui->keepTopLevelFolderCheckBox->isChecked());
m_torrentParams.sequential = m_ui->sequentialCheckBox->isChecked();
m_torrentParams.firstLastPiecePriority = m_ui->firstLastCheckBox->isChecked();

4
src/gui/addnewtorrentdialog.ui

@ -167,9 +167,9 @@ @@ -167,9 +167,9 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="createSubfolderCheckBox">
<widget class="QCheckBox" name="keepTopLevelFolderCheckBox">
<property name="text">
<string>Create subfolder</string>
<string>Keep top-level folder</string>
</property>
</widget>
</item>

6
src/gui/optionsdialog.cpp

@ -351,7 +351,7 @@ OptionsDialog::OptionsDialog(QWidget *parent) @@ -351,7 +351,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
connect(m_ui->checkAdditionDialog, &QGroupBox::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkAdditionDialogFront, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkStartPaused, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkCreateSubfolder, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkKeepTopLevelFolder, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->deleteTorrentBox, &QGroupBox::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->deleteCancelledTorrentBox, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkExportDir, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
@ -733,7 +733,7 @@ void OptionsDialog::saveOptions() @@ -733,7 +733,7 @@ void OptionsDialog::saveOptions()
AddNewTorrentDialog::setEnabled(useAdditionDialog());
AddNewTorrentDialog::setTopLevel(m_ui->checkAdditionDialogFront->isChecked());
session->setAddTorrentPaused(addTorrentsInPause());
session->setCreateTorrentSubfolder(m_ui->checkCreateSubfolder->isChecked());
session->setKeepTorrentTopLevelFolder(m_ui->checkKeepTopLevelFolder->isChecked());
ScanFoldersModel::instance()->removeFromFSWatcher(m_removedScanDirs);
ScanFoldersModel::instance()->addToFSWatcher(m_addedScanDirs);
ScanFoldersModel::instance()->makePersistent();
@ -977,7 +977,7 @@ void OptionsDialog::loadOptions() @@ -977,7 +977,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(session->isCreateTorrentSubfolder());
m_ui->checkKeepTopLevelFolder->setChecked(session->isKeepTorrentTopLevelFolder());
const TorrentFileGuard::AutoDeleteMode autoDeleteMode = TorrentFileGuard::autoDeleteMode();
m_ui->deleteTorrentBox->setChecked(autoDeleteMode != TorrentFileGuard::Never);
m_ui->deleteCancelledTorrentBox->setChecked(autoDeleteMode == TorrentFileGuard::Always);

4
src/gui/optionsdialog.ui

@ -769,9 +769,9 @@ @@ -769,9 +769,9 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkCreateSubfolder">
<widget class="QCheckBox" name="checkKeepTopLevelFolder">
<property name="text">
<string>Create subfolder for torrents with multiple files</string>
<string>Keep top-level folder</string>
</property>
<property name="checked">
<bool>true</bool>

4
src/gui/rss/automatedrssdownloader.ui

@ -325,7 +325,7 @@ Supports the formats: S01E01, 1x1, 2017.01.01 and 01.01.2017 (Date formats also @@ -325,7 +325,7 @@ Supports the formats: S01E01, 1x1, 2017.01.01 and 01.01.2017 (Date formats also
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
<widget class="QLabel" name="lblCreateSubfolder">
<widget class="QLabel" name="lblKeepTopLevelFolder">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
@ -333,7 +333,7 @@ Supports the formats: S01E01, 1x1, 2017.01.01 and 01.01.2017 (Date formats also @@ -333,7 +333,7 @@ Supports the formats: S01E01, 1x1, 2017.01.01 and 01.01.2017 (Date formats also
</sizepolicy>
</property>
<property name="text">
<string>Create Subfolder:</string>
<string>Keep top-level folder:</string>
</property>
</widget>
</item>

4
src/webui/api/appcontroller.cpp

@ -99,7 +99,7 @@ void AppController::preferencesAction() @@ -99,7 +99,7 @@ void AppController::preferencesAction()
// Downloads
// When adding a torrent
data["create_subfolder_enabled"] = session->isCreateTorrentSubfolder();
data["create_subfolder_enabled"] = session->isKeepTorrentTopLevelFolder();
data["start_paused_enabled"] = session->isAddTorrentPaused();
data["auto_delete_mode"] = static_cast<int>(TorrentFileGuard::autoDeleteMode());
data["preallocate_all"] = session->isPreallocationEnabled();
@ -344,7 +344,7 @@ void AppController::setPreferencesAction() @@ -344,7 +344,7 @@ void AppController::setPreferencesAction()
// Downloads
// When adding a torrent
if (hasKey("create_subfolder_enabled"))
session->setCreateTorrentSubfolder(it.value().toBool());
session->setKeepTorrentTopLevelFolder(it.value().toBool());
if (hasKey("start_paused_enabled"))
session->setAddTorrentPaused(it.value().toBool());
if (hasKey("auto_delete_mode"))

2
src/webui/www/private/download.html

@ -89,7 +89,7 @@ @@ -89,7 +89,7 @@
</tr>
<tr>
<td>
<label for="rootFolder">QBT_TR(Create subfolder)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
<label for="rootFolder">QBT_TR(Keep top-level folder)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
</td>
<td>
<input type="hidden" id="rootFolderHidden" name="root_folder" />

2
src/webui/www/private/upload.html

@ -77,7 +77,7 @@ @@ -77,7 +77,7 @@
</tr>
<tr>
<td>
<label for="rootFolder">QBT_TR(Create subfolder)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
<label for="rootFolder">QBT_TR(Keep top-level folder)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
</td>
<td>
<input type="hidden" id="rootFolderHidden" name="root_folder" />

2
src/webui/www/private/views/preferences.html

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
<legend>QBT_TR(When adding a torrent)QBT_TR[CONTEXT=OptionsDialog]</legend>
<div class="formRow">
<input type="checkbox" id="createsubfolder_checkbox" />
<label for="createsubfolder_checkbox">QBT_TR(Create subfolder for torrents with multiple files)QBT_TR[CONTEXT=OptionsDialog]</label>
<label for="createsubfolder_checkbox">QBT_TR(Keep top-level folder)QBT_TR[CONTEXT=OptionsDialog]</label>
</div>
<div class="formRow">
<input type="checkbox" id="dontstartdownloads_checkbox" />

Loading…
Cancel
Save