Add choking_algorithm & seed_choking_algorithm knob

This commit is contained in:
Chocobo1
2017-08-11 17:06:31 +08:00
committed by sledgehammer999
parent d3b4c7bec4
commit 6f54c170ab
4 changed files with 73 additions and 3 deletions

View File

@@ -89,6 +89,8 @@ enum AdvSettingsRows
TRACKER_STATUS,
TRACKER_PORT,
// seeding
CHOKING_ALGORITHM,
SEED_CHOKING_ALGORITHM,
SUPER_SEEDING,
// tracker
ANNOUNCE_ALL_TRACKERS,
@@ -187,6 +189,11 @@ void AdvancedSettings::saveAdvancedSettings()
// Tracker
session->setTrackerEnabled(cb_tracker_status.isChecked());
pref->setTrackerPort(spin_tracker_port.value());
// Choking algorithm
session->setChokingAlgorithm(comboChokingAlgorithm.currentIndex());
// Seed choking algorithm
session->setSeedChokingAlgorithm(comboSeedChokingAlgorithm.currentIndex());
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
pref->setUpdateCheckEnabled(cb_update_check.isChecked());
#endif
@@ -390,6 +397,15 @@ void AdvancedSettings::loadAdvancedSettings()
spin_tracker_port.setMaximum(65535);
spin_tracker_port.setValue(pref->getTrackerPort());
addRow(TRACKER_PORT, tr("Embedded tracker port"), &spin_tracker_port);
// Choking algorithm
comboChokingAlgorithm.addItems({"Fixed slots", "Upload rate based"});
comboChokingAlgorithm.setCurrentIndex(session->chokingAlgorithm());
addRow(CHOKING_ALGORITHM, tr("Upload slots behavior"), &comboChokingAlgorithm);
// Seed choking algorithm
comboSeedChokingAlgorithm.addItems({"Round-robin", "Fastest upload", "Anti-leech"});
comboSeedChokingAlgorithm.setCurrentIndex(session->seedChokingAlgorithm());
addRow(SEED_CHOKING_ALGORITHM, tr("Upload choking algorithm"), &comboSeedChokingAlgorithm);
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
cb_update_check.setChecked(pref->isUpdateCheckEnabled());
addRow(UPDATE_CHECK, tr("Check for software updates"), &cb_update_check);

View File

@@ -79,7 +79,7 @@ private:
QCheckBox cb_os_cache, cb_recheck_completed, cb_resolve_countries, cb_resolve_hosts, cb_super_seeding,
cb_program_notifications, cb_torrent_added_notifications, cb_tracker_favicon, cb_tracker_status,
cb_confirm_torrent_recheck, cb_confirm_remove_all_tags, cb_listen_ipv6, cb_announce_all_trackers, cbGuidedReadCache, cbMultiConnectionsPerIp;
QComboBox combo_iface, combo_iface_address, comboUtpMixedMode;
QComboBox combo_iface, combo_iface_address, comboUtpMixedMode, comboChokingAlgorithm, comboSeedChokingAlgorithm;
QLineEdit txtAnnounceIP;
// OS dependent settings