1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-11 15:27:54 +00:00

Add option to ignore global share ratio limits for torrents created in qBt.

This commit is contained in:
Nick Tiskov 2013-07-29 14:11:43 +04:00
parent f276ad568e
commit a1298fbf58
2 changed files with 37 additions and 1 deletions

View File

@ -241,6 +241,19 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="checkIgnoreShareLimits">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Ignore share ratio limits for this torrent</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item> <item>
<widget class="QLabel" name="progressLbl"> <widget class="QLabel" name="progressLbl">
<property name="text"> <property name="text">
@ -302,5 +315,22 @@
</layout> </layout>
</widget> </widget>
<resources/> <resources/>
<connections/> <connections>
<connection>
<sender>checkStartSeeding</sender>
<signal>clicked(bool)</signal>
<receiver>checkIgnoreShareLimits</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>295</x>
<y>532</y>
</hint>
<hint type="destinationlabel">
<x>295</x>
<y>555</y>
</hint>
</hints>
</connection>
</connections>
</ui> </ui>

View File

@ -38,6 +38,7 @@
#include "qinisettings.h" #include "qinisettings.h"
#include "torrentcreatorthread.h" #include "torrentcreatorthread.h"
#include "iconprovider.h" #include "iconprovider.h"
#include "qbtsession.h"
const uint NB_PIECES_MIN = 1200; const uint NB_PIECES_MIN = 1200;
const uint NB_PIECES_MAX = 2200; const uint NB_PIECES_MAX = 2200;
@ -169,6 +170,8 @@ void TorrentCreatorDlg::handleCreationSuccess(QString path, QString branch_path)
// Enable seeding mode (do not recheck the files) // Enable seeding mode (do not recheck the files)
TorrentTempData::setSeedingMode(hash, true); TorrentTempData::setSeedingMode(hash, true);
emit torrent_to_seed(path); emit torrent_to_seed(path);
if (checkIgnoreShareLimits->isChecked())
QBtSession::instance()->setMaxRatioPerTorrent(hash, -1);
} }
QMessageBox::information(0, tr("Torrent creation"), tr("Torrent was created successfully:")+" "+path); QMessageBox::information(0, tr("Torrent creation"), tr("Torrent was created successfully:")+" "+path);
close(); close();
@ -202,6 +205,7 @@ void TorrentCreatorDlg::setInteractionEnabled(bool enabled)
check_private->setEnabled(enabled); check_private->setEnabled(enabled);
checkStartSeeding->setEnabled(enabled); checkStartSeeding->setEnabled(enabled);
createButton->setEnabled(enabled); createButton->setEnabled(enabled);
checkIgnoreShareLimits->setEnabled(enabled && checkStartSeeding->isChecked());
//cancelButton->setEnabled(!enabled); //cancelButton->setEnabled(!enabled);
} }
@ -259,12 +263,14 @@ void TorrentCreatorDlg::saveSettings()
{ {
QIniSettings settings; QIniSettings settings;
settings.setValue("CreateTorrent/dimensions", saveGeometry()); settings.setValue("CreateTorrent/dimensions", saveGeometry());
settings.setValue("CreateTorrent/IgnoreRatio", checkIgnoreShareLimits->isChecked());
} }
void TorrentCreatorDlg::loadSettings() void TorrentCreatorDlg::loadSettings()
{ {
QIniSettings settings; QIniSettings settings;
restoreGeometry(settings.value("CreateTorrent/dimensions").toByteArray()); restoreGeometry(settings.value("CreateTorrent/dimensions").toByteArray());
checkIgnoreShareLimits->setChecked(settings.value("CreateTorrent/IgnoreRatio").toBool());
} }
void TorrentCreatorDlg::closeEvent(QCloseEvent *event) void TorrentCreatorDlg::closeEvent(QCloseEvent *event)