Browse Source

Merge pull request #12689 from thalieht/subfolder

Rename "Create subfolder" option to "Keep subfolder"
adaptive-webui-19844
Mike Tzou 5 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)
, m_globalMaxRatio(BITTORRENT_SESSION_KEY("GlobalMaxRatio"), -1, [](qreal r) { return r < 0 ? -1. : r;}) , m_globalMaxRatio(BITTORRENT_SESSION_KEY("GlobalMaxRatio"), -1, [](qreal r) { return r < 0 ? -1. : r;})
, m_globalMaxSeedingMinutes(BITTORRENT_SESSION_KEY("GlobalMaxSeedingMinutes"), -1, lowerLimited(-1)) , m_globalMaxSeedingMinutes(BITTORRENT_SESSION_KEY("GlobalMaxSeedingMinutes"), -1, lowerLimited(-1))
, m_isAddTorrentPaused(BITTORRENT_SESSION_KEY("AddTorrentPaused"), false) , 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_isAppendExtensionEnabled(BITTORRENT_SESSION_KEY("AddExtensionToIncompleteFiles"), false)
, m_refreshInterval(BITTORRENT_SESSION_KEY("RefreshInterval"), 1500) , m_refreshInterval(BITTORRENT_SESSION_KEY("RefreshInterval"), 1500)
, m_isPreallocationEnabled(BITTORRENT_SESSION_KEY("Preallocation"), false) , m_isPreallocationEnabled(BITTORRENT_SESSION_KEY("Preallocation"), false)
@ -4392,14 +4392,14 @@ std::vector<lt::alert *> Session::getPendingAlerts(const lt::time_duration time)
return alerts; 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 // Read alerts sent by the BitTorrent session

6
src/base/bittorrent/session.h

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

2
src/base/bittorrent/torrenthandleimpl.cpp

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

8
src/gui/addnewtorrentdialog.cpp

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

4
src/gui/addnewtorrentdialog.ui

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

6
src/gui/optionsdialog.cpp

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

4
src/gui/optionsdialog.ui

@ -769,9 +769,9 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="checkCreateSubfolder"> <widget class="QCheckBox" name="checkKeepTopLevelFolder">
<property name="text"> <property name="text">
<string>Create subfolder for torrents with multiple files</string> <string>Keep top-level folder</string>
</property> </property>
<property name="checked"> <property name="checked">
<bool>true</bool> <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
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_10"> <layout class="QHBoxLayout" name="horizontalLayout_10">
<item> <item>
<widget class="QLabel" name="lblCreateSubfolder"> <widget class="QLabel" name="lblKeepTopLevelFolder">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -333,7 +333,7 @@ Supports the formats: S01E01, 1x1, 2017.01.01 and 01.01.2017 (Date formats also
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>Create Subfolder:</string> <string>Keep top-level folder:</string>
</property> </property>
</widget> </widget>
</item> </item>

4
src/webui/api/appcontroller.cpp

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

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

@ -89,7 +89,7 @@
</tr> </tr>
<tr> <tr>
<td> <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>
<td> <td>
<input type="hidden" id="rootFolderHidden" name="root_folder" /> <input type="hidden" id="rootFolderHidden" name="root_folder" />

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

@ -77,7 +77,7 @@
</tr> </tr>
<tr> <tr>
<td> <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>
<td> <td>
<input type="hidden" id="rootFolderHidden" name="root_folder" /> <input type="hidden" id="rootFolderHidden" name="root_folder" />

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

@ -3,7 +3,7 @@
<legend>QBT_TR(When adding a torrent)QBT_TR[CONTEXT=OptionsDialog]</legend> <legend>QBT_TR(When adding a torrent)QBT_TR[CONTEXT=OptionsDialog]</legend>
<div class="formRow"> <div class="formRow">
<input type="checkbox" id="createsubfolder_checkbox" /> <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>
<div class="formRow"> <div class="formRow">
<input type="checkbox" id="dontstartdownloads_checkbox" /> <input type="checkbox" id="dontstartdownloads_checkbox" />

Loading…
Cancel
Save