From 90296b3ef09e479a00cd4b2f1969ecdcf8c0d5fe Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Thu, 9 Sep 2021 07:00:51 +0300 Subject: [PATCH] Add "Skip hash check" option for watched folders Closes #15388. PR #15433. --- src/base/torrentfileswatcher.cpp | 3 ++ src/gui/watchedfolderoptionsdialog.cpp | 2 + src/gui/watchedfolderoptionsdialog.ui | 68 +++++++++++++++++--------- 3 files changed, 49 insertions(+), 24 deletions(-) diff --git a/src/base/torrentfileswatcher.cpp b/src/base/torrentfileswatcher.cpp index 9c455aa9b..6c6053a58 100644 --- a/src/base/torrentfileswatcher.cpp +++ b/src/base/torrentfileswatcher.cpp @@ -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 params.savePath = jsonObj.value(PARAM_SAVEPATH).toString(); params.addForced = (getEnum(jsonObj, PARAM_OPERATINGMODE) == BitTorrent::TorrentOperatingMode::Forced); params.addPaused = getOptionalBool(jsonObj, PARAM_STOPPED); + params.skipChecking = jsonObj.value(PARAM_SKIPCHECKING).toBool(); params.contentLayout = getOptionalEnum(jsonObj, PARAM_CONTENTLAYOUT); params.useAutoTMM = getOptionalBool(jsonObj, PARAM_AUTOTMM); params.uploadLimit = jsonObj.value(PARAM_UPLOADLIMIT).toInt(-1); @@ -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}, diff --git a/src/gui/watchedfolderoptionsdialog.cpp b/src/gui/watchedfolderoptionsdialog.cpp index 04bc69b23..ed4b85165 100644 --- a/src/gui/watchedfolderoptionsdialog.cpp +++ b/src/gui/watchedfolderoptionsdialog.cpp @@ -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(torrentParams.contentLayout.value_or(session->torrentContentLayout()))); @@ -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(m_ui->contentLayoutComboBox->currentIndex()); return watchedFolderOptions; diff --git a/src/gui/watchedfolderoptionsdialog.ui b/src/gui/watchedfolderoptionsdialog.ui index 55db4bad8..d4daabab5 100644 --- a/src/gui/watchedfolderoptionsdialog.ui +++ b/src/gui/watchedfolderoptionsdialog.ui @@ -7,7 +7,7 @@ 0 0 462 - 306 + 325 @@ -163,30 +163,50 @@ - + - - - - - Start torrent - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + Start torrent + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Skip hash check + + + + + + + Qt::Horizontal + + + + 40 + 20 + + +