Allow to add new torrents to queue top

PR #18518.
Closes #11599.
This commit is contained in:
Vladimir Golovnev
2023-02-10 17:15:41 +03:00
committed by GitHub
parent 72ac92ec68
commit 5d4766edbe
14 changed files with 81 additions and 1 deletions

View File

@@ -217,6 +217,7 @@ AddNewTorrentDialog::AddNewTorrentDialog(const BitTorrent::AddTorrentParams &inP
m_ui->downloadPath->setDialogCaption(tr("Choose save path"));
m_ui->downloadPath->setMaxVisibleItems(20);
m_ui->addToQueueTopCheckBox->setChecked(m_torrentParams.addToQueueTop.value_or(session->isAddTorrentToQueueTop()));
m_ui->startTorrentCheckBox->setChecked(!m_torrentParams.addPaused.value_or(session->isAddTorrentPaused()));
m_ui->stopConditionComboBox->setToolTip(
u"<html><body><p><b>" + tr("None") + u"</b> - " + tr("No stop condition is set.") + u"</p><p><b>" +
@@ -889,6 +890,7 @@ void AddNewTorrentDialog::accept()
if (m_contentModel)
m_torrentParams.filePriorities = m_contentModel->model()->getFilePriorities();
m_torrentParams.addToQueueTop = m_ui->addToQueueTopCheckBox->isChecked();
m_torrentParams.addPaused = !m_ui->startTorrentCheckBox->isChecked();
m_torrentParams.stopCondition = m_ui->stopConditionComboBox->currentData().value<BitTorrent::Torrent::StopCondition>();
m_torrentParams.contentLayout = static_cast<BitTorrent::TorrentContentLayout>(m_ui->contentLayoutComboBox->currentIndex());

View File

@@ -257,6 +257,13 @@
</spacer>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="addToQueueTopCheckBox">
<property name="text">
<string>Add to top of queue</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="skipCheckingCheckBox">
<property name="text">
<string>Skip hash check</string>

View File

@@ -466,6 +466,7 @@ void OptionsDialog::loadDownloadsTabOptions()
m_ui->checkAdditionDialogFront->setChecked(AddNewTorrentDialog::isTopLevel());
m_ui->contentLayoutComboBox->setCurrentIndex(static_cast<int>(session->torrentContentLayout()));
m_ui->checkAddToQueueTop->setChecked(session->isAddTorrentToQueueTop());
m_ui->checkStartPaused->setChecked(session->isAddTorrentPaused());
m_ui->stopConditionComboBox->setToolTip(
@@ -588,6 +589,7 @@ void OptionsDialog::loadDownloadsTabOptions()
connect(m_ui->contentLayoutComboBox, qComboBoxCurrentIndexChanged, this, &ThisType::enableApplyButton);
connect(m_ui->checkAddToQueueTop, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkStartPaused, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkStartPaused, &QAbstractButton::toggled, this, [this](const bool checked)
{
@@ -653,6 +655,7 @@ void OptionsDialog::saveDownloadsTabOptions() const
session->setTorrentContentLayout(static_cast<BitTorrent::TorrentContentLayout>(m_ui->contentLayoutComboBox->currentIndex()));
session->setAddTorrentToQueueTop(m_ui->checkAddToQueueTop->isChecked());
session->setAddTorrentPaused(addTorrentsInPause());
session->setTorrentStopCondition(m_ui->stopConditionComboBox->currentData().value<BitTorrent::Torrent::StopCondition>());
TorrentFileGuard::setAutoDeleteMode(!m_ui->deleteTorrentBox->isChecked() ? TorrentFileGuard::Never

View File

@@ -857,6 +857,16 @@
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkAddToQueueTop">
<property name="toolTip">
<string>The torrent will be added to the top of the download queue</string>
</property>
<property name="text">
<string extracomment="The torrent will be added to the top of the download queue">Add to top of queue</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkStartPaused">
<property name="toolTip">

View File

@@ -65,6 +65,7 @@ WatchedFolderOptionsDialog::WatchedFolderOptionsDialog(
populateSavePaths();
const BitTorrent::AddTorrentParams &torrentParams = watchedFolderOptions.addTorrentParams;
m_ui->addToQueueTopCheckBox->setChecked(torrentParams.addToQueueTop.value_or(session->isAddTorrentToQueueTop()));
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()));
@@ -116,6 +117,7 @@ TorrentFilesWatcher::WatchedFolderOptions WatchedFolderOptionsDialog::watchedFol
}
params.useAutoTMM = useAutoTMM;
params.category = m_ui->categoryComboBox->currentText();
params.addToQueueTop = m_ui->addToQueueTopCheckBox->isChecked();
params.addPaused = !m_ui->startTorrentCheckBox->isChecked();
params.skipChecking = m_ui->skipCheckingCheckBox->isChecked();
params.contentLayout = static_cast<BitTorrent::TorrentContentLayout>(m_ui->contentLayoutComboBox->currentIndex());

View File

@@ -204,6 +204,30 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="addToQueueTopLayout">
<item>
<widget class="QCheckBox" name="addToQueueTopCheckBox">
<property name="text">
<string>Add to top of queue</string>
</property>
</widget>
</item>
<item>
<spacer name="addToQueueTopSpacer">
<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>
<layout class="QHBoxLayout" name="skipCheckingLayout">
<item>