Browse Source

Add "Skip hash check" option for watched folders

Closes #15388.
PR #15433.
adaptive-webui-19844
Vladimir Golovnev 3 years ago committed by GitHub
parent
commit
90296b3ef0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      src/base/torrentfileswatcher.cpp
  2. 2
      src/gui/watchedfolderoptionsdialog.cpp
  3. 26
      src/gui/watchedfolderoptionsdialog.ui

3
src/base/torrentfileswatcher.cpp

@ -76,6 +76,7 @@ const QString PARAM_TAGS {QStringLiteral("tags")}; @@ -76,6 +76,7 @@ const QString PARAM_TAGS {QStringLiteral("tags")};
const QString PARAM_SAVEPATH {QStringLiteral("save_path")};
const QString PARAM_OPERATINGMODE {QStringLiteral("operating_mode")};
const QString PARAM_STOPPED {QStringLiteral("stopped")};
const QString PARAM_SKIPCHECKING {QStringLiteral("skip_checking")};
const QString PARAM_CONTENTLAYOUT {QStringLiteral("content_layout")};
const QString PARAM_AUTOTMM {QStringLiteral("use_auto_tmm")};
const QString PARAM_UPLOADLIMIT {QStringLiteral("upload_limit")};
@ -137,6 +138,7 @@ namespace @@ -137,6 +138,7 @@ namespace
params.savePath = jsonObj.value(PARAM_SAVEPATH).toString();
params.addForced = (getEnum<BitTorrent::TorrentOperatingMode>(jsonObj, PARAM_OPERATINGMODE) == BitTorrent::TorrentOperatingMode::Forced);
params.addPaused = getOptionalBool(jsonObj, PARAM_STOPPED);
params.skipChecking = jsonObj.value(PARAM_SKIPCHECKING).toBool();
params.contentLayout = getOptionalEnum<BitTorrent::TorrentContentLayout>(jsonObj, PARAM_CONTENTLAYOUT);
params.useAutoTMM = getOptionalBool(jsonObj, PARAM_AUTOTMM);
params.uploadLimit = jsonObj.value(PARAM_UPLOADLIMIT).toInt(-1);
@ -155,6 +157,7 @@ namespace @@ -155,6 +157,7 @@ namespace
{PARAM_SAVEPATH, params.savePath},
{PARAM_OPERATINGMODE, Utils::String::fromEnum(params.addForced
? BitTorrent::TorrentOperatingMode::Forced : BitTorrent::TorrentOperatingMode::AutoManaged)},
{PARAM_SKIPCHECKING, params.skipChecking},
{PARAM_UPLOADLIMIT, params.uploadLimit},
{PARAM_DOWNLOADLIMIT, params.downloadLimit},
{PARAM_SEEDINGTIMELIMIT, params.seedingTimeLimit},

2
src/gui/watchedfolderoptionsdialog.cpp

@ -61,6 +61,7 @@ WatchedFolderOptionsDialog::WatchedFolderOptionsDialog( @@ -61,6 +61,7 @@ WatchedFolderOptionsDialog::WatchedFolderOptionsDialog(
const auto *session = BitTorrent::Session::instance();
const BitTorrent::AddTorrentParams &torrentParams = watchedFolderOptions.addTorrentParams;
m_ui->startTorrentCheckBox->setChecked(!torrentParams.addPaused.value_or(session->isAddTorrentPaused()));
m_ui->skipCheckingCheckBox->setChecked(torrentParams.skipChecking);
m_ui->comboTTM->setCurrentIndex(torrentParams.useAutoTMM.value_or(!session->isAutoTMMDisabledByDefault()));
m_ui->contentLayoutComboBox->setCurrentIndex(
static_cast<int>(torrentParams.contentLayout.value_or(session->torrentContentLayout())));
@ -101,6 +102,7 @@ TorrentFilesWatcher::WatchedFolderOptions WatchedFolderOptionsDialog::watchedFol @@ -101,6 +102,7 @@ TorrentFilesWatcher::WatchedFolderOptions WatchedFolderOptionsDialog::watchedFol
params.savePath = m_ui->savePath->selectedPath();
params.category = m_ui->categoryComboBox->currentText();;
params.addPaused = !m_ui->startTorrentCheckBox->isChecked();
params.skipChecking = m_ui->skipCheckingCheckBox->isChecked();
params.contentLayout = static_cast<BitTorrent::TorrentContentLayout>(m_ui->contentLayoutComboBox->currentIndex());
return watchedFolderOptions;

26
src/gui/watchedfolderoptionsdialog.ui

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>462</width>
<height>306</height>
<height>325</height>
</rect>
</property>
<property name="windowTitle">
@ -162,8 +162,6 @@ @@ -162,8 +162,6 @@
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
@ -188,6 +186,28 @@ @@ -188,6 +186,28 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="skipCheckingLayout">
<item>
<widget class="QCheckBox" name="skipCheckingCheckBox">
<property name="text">
<string>Skip hash check</string>
</property>
</widget>
</item>
<item>
<spacer name="skipCheckingSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>

Loading…
Cancel
Save