Merge pull request #11241 from thalieht/delfolder

Add "Remove torrent and its files" option to share ratio limiting
This commit is contained in:
Mike Tzou
2019-09-29 09:51:41 +08:00
committed by GitHub
7 changed files with 104 additions and 46 deletions

View File

@@ -747,7 +747,14 @@ void OptionsDialog::saveOptions()
session->setAdditionalTrackers(m_ui->textTrackers->toPlainText());
session->setGlobalMaxRatio(getMaxRatio());
session->setGlobalMaxSeedingMinutes(getMaxSeedingMinutes());
session->setMaxRatioAction(static_cast<MaxRatioAction>(m_ui->comboRatioLimitAct->currentIndex()));
const QVector<MaxRatioAction> actIndex = {
Pause,
Remove,
DeleteFiles,
EnableSuperSeeding
};
session->setMaxRatioAction(actIndex.value(m_ui->comboRatioLimitAct->currentIndex()));
// End Bittorrent preferences
// Misc preferences
@@ -1130,7 +1137,14 @@ void OptionsDialog::loadOptions()
m_ui->spinMaxSeedingMinutes->setEnabled(false);
}
m_ui->comboRatioLimitAct->setEnabled((session->globalMaxSeedingMinutes() >= 0) || (session->globalMaxRatio() >= 0.));
m_ui->comboRatioLimitAct->setCurrentIndex(session->maxRatioAction());
const QHash<MaxRatioAction, int> actIndex = {
{Pause, 0},
{Remove, 1},
{DeleteFiles, 2},
{EnableSuperSeeding, 3}
};
m_ui->comboRatioLimitAct->setCurrentIndex(actIndex.value(session->maxRatioAction()));
// End Bittorrent preferences
// Web UI preferences

View File

@@ -2440,9 +2440,9 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="ratioBox">
<widget class="QGroupBox" name="seedingLimitsBox">
<property name="title">
<string>Share Ratio Limiting</string>
<string>Seeding Limits</string>
</property>
<layout class="QGridLayout" name="gridLayout_91">
<item row="2" column="1">
@@ -2464,7 +2464,7 @@
<item row="2" column="0">
<widget class="QCheckBox" name="checkMaxSeedingMinutes">
<property name="text">
<string>Seed torrents until their seeding time reaches</string>
<string>When seeding time reaches</string>
</property>
</widget>
</item>
@@ -2485,17 +2485,22 @@
</property>
<item>
<property name="text">
<string>Pause them</string>
<string>Pause torrent</string>
</property>
</item>
<item>
<property name="text">
<string>Remove them</string>
<string>Remove torrent</string>
</property>
</item>
<item>
<property name="text">
<string>Enable super seeding for them</string>
<string>Remove torrent and its files</string>
</property>
</item>
<item>
<property name="text">
<string>Enable super seeding for torrent</string>
</property>
</item>
</widget>
@@ -2503,7 +2508,7 @@
<item row="1" column="0">
<widget class="QCheckBox" name="checkMaxRatio">
<property name="text">
<string>Seed torrents until their ratio reaches</string>
<string>When ratio reaches</string>
</property>
</widget>
</item>

View File

@@ -373,8 +373,9 @@ void TransferListWidget::deleteSelectedTorrents(bool deleteLocalFiles)
if (Preferences::instance()->confirmTorrentDeletion()
&& !DeletionConfirmationDialog::askForDeletionConfirmation(this, deleteLocalFiles, torrents.size(), torrents[0]->name()))
return;
for (BitTorrent::TorrentHandle *const torrent : torrents)
BitTorrent::Session::instance()->deleteTorrent(torrent->hash(), deleteLocalFiles);
const DeleteOption deleteOption = deleteLocalFiles ? TorrentAndFiles : Torrent;
for (const BitTorrent::TorrentHandle *torrent : torrents)
BitTorrent::Session::instance()->deleteTorrent(torrent->hash(), deleteOption);
}
void TransferListWidget::deleteVisibleTorrents()
@@ -390,8 +391,9 @@ void TransferListWidget::deleteVisibleTorrents()
&& !DeletionConfirmationDialog::askForDeletionConfirmation(this, deleteLocalFiles, torrents.size(), torrents[0]->name()))
return;
for (BitTorrent::TorrentHandle *const torrent : asConst(torrents))
BitTorrent::Session::instance()->deleteTorrent(torrent->hash(), deleteLocalFiles);
const DeleteOption deleteOption = deleteLocalFiles ? TorrentAndFiles : Torrent;
for (const BitTorrent::TorrentHandle *torrent : asConst(torrents))
BitTorrent::Session::instance()->deleteTorrent(torrent->hash(), deleteOption);
}
void TransferListWidget::increaseQueuePosSelectedTorrents()