Merge pull request #3481 from Chocobo1/moveOption

Move option "Ignore transfer limits on local network" to Speed page
This commit is contained in:
sledgehammer999 2015-08-30 07:58:30 -05:00
commit 45cbf4bf25
6 changed files with 300 additions and 263 deletions

View file

@ -402,8 +402,8 @@ void Session::setSessionSettings()
// Outgoing ports // Outgoing ports
sessionSettings.outgoing_ports = std::make_pair(pref->outgoingPortsMin(), pref->outgoingPortsMax()); sessionSettings.outgoing_ports = std::make_pair(pref->outgoingPortsMin(), pref->outgoingPortsMax());
// Ignore limits on LAN // Ignore limits on LAN
qDebug() << "Ignore limits on LAN" << pref->ignoreLimitsOnLAN(); qDebug() << "Ignore limits on LAN" << pref->getIgnoreLimitsOnLAN();
sessionSettings.ignore_limits_on_local_network = pref->ignoreLimitsOnLAN(); sessionSettings.ignore_limits_on_local_network = pref->getIgnoreLimitsOnLAN();
// Include overhead in transfer limits // Include overhead in transfer limits
sessionSettings.rate_limit_ip_overhead = pref->includeOverheadInLimits(); sessionSettings.rate_limit_ip_overhead = pref->includeOverheadInLimits();
// IP address to announce to trackers // IP address to announce to trackers

View file

@ -1418,12 +1418,12 @@ void Preferences::setOutgoingPortsMax(uint val)
setValue("Preferences/Advanced/OutgoingPortsMax", val); setValue("Preferences/Advanced/OutgoingPortsMax", val);
} }
bool Preferences::ignoreLimitsOnLAN() const bool Preferences::getIgnoreLimitsOnLAN() const
{ {
return value("Preferences/Advanced/IgnoreLimitsLAN", true).toBool(); return value("Preferences/Advanced/IgnoreLimitsLAN", true).toBool();
} }
void Preferences::ignoreLimitsOnLAN(bool ignore) void Preferences::setIgnoreLimitsOnLAN(bool ignore)
{ {
setValue("Preferences/Advanced/IgnoreLimitsLAN", ignore); setValue("Preferences/Advanced/IgnoreLimitsLAN", ignore);
} }

View file

@ -361,8 +361,8 @@ public:
void setOutgoingPortsMin(uint val); void setOutgoingPortsMin(uint val);
uint outgoingPortsMax() const; uint outgoingPortsMax() const;
void setOutgoingPortsMax(uint val); void setOutgoingPortsMax(uint val);
bool ignoreLimitsOnLAN() const; bool getIgnoreLimitsOnLAN() const;
void ignoreLimitsOnLAN(bool ignore); void setIgnoreLimitsOnLAN(bool ignore);
bool includeOverheadInLimits() const; bool includeOverheadInLimits() const;
void includeOverheadInLimits(bool include); void includeOverheadInLimits(bool include);
bool trackerExchangeEnabled() const; bool trackerExchangeEnabled() const;

View file

@ -12,24 +12,51 @@
#include "core/preferences.h" #include "core/preferences.h"
enum AdvSettingsCols {PROPERTY, VALUE}; enum AdvSettingsCols
enum AdvSettingsRows {DISK_CACHE, DISK_CACHE_TTL, OS_CACHE, SAVE_RESUME_DATA_INTERVAL, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX, IGNORE_LIMIT_LAN, RECHECK_COMPLETED, LIST_REFRESH, RESOLVE_COUNTRIES, RESOLVE_HOSTS, MAX_HALF_OPEN, SUPER_SEEDING, NETWORK_IFACE, NETWORK_LISTEN_IPV6, NETWORK_ADDRESS, PROGRAM_NOTIFICATIONS, TRACKER_STATUS, TRACKER_PORT, {
#if defined(Q_OS_WIN) || defined(Q_OS_MAC) PROPERTY,
VALUE
};
enum AdvSettingsRows
{
DISK_CACHE,
DISK_CACHE_TTL,
OS_CACHE,
SAVE_RESUME_DATA_INTERVAL,
OUTGOING_PORT_MIN,
OUTGOING_PORT_MAX,
RECHECK_COMPLETED,
LIST_REFRESH,
RESOLVE_COUNTRIES,
RESOLVE_HOSTS,
MAX_HALF_OPEN,
SUPER_SEEDING,
NETWORK_IFACE,
NETWORK_LISTEN_IPV6,
NETWORK_ADDRESS,
PROGRAM_NOTIFICATIONS,
TRACKER_STATUS,
TRACKER_PORT,
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
UPDATE_CHECK, UPDATE_CHECK,
#endif #endif
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) #if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
USE_ICON_THEME, USE_ICON_THEME,
#endif #endif
CONFIRM_DELETE_TORRENT, CONFIRM_RECHECK_TORRENT, TRACKER_EXCHANGE, CONFIRM_DELETE_TORRENT,
CONFIRM_RECHECK_TORRENT,
TRACKER_EXCHANGE,
ANNOUNCE_ALL_TRACKERS, ANNOUNCE_ALL_TRACKERS,
ROW_COUNT}; ROW_COUNT
};
class AdvancedSettings: public QTableWidget { class AdvancedSettings: public QTableWidget
{
Q_OBJECT Q_OBJECT
private: private:
QSpinBox spin_cache, spin_save_resume_data_interval, outgoing_ports_min, outgoing_ports_max, spin_list_refresh, spin_maxhalfopen, spin_tracker_port; QSpinBox spin_cache, spin_save_resume_data_interval, outgoing_ports_min, outgoing_ports_max, spin_list_refresh, spin_maxhalfopen, spin_tracker_port;
QCheckBox cb_os_cache, cb_ignore_limits_lan, cb_recheck_completed, cb_resolve_countries, cb_resolve_hosts, QCheckBox cb_os_cache, cb_recheck_completed, cb_resolve_countries, cb_resolve_hosts,
cb_super_seeding, cb_program_notifications, cb_tracker_status, cb_confirm_torrent_deletion, cb_super_seeding, cb_program_notifications, cb_tracker_status, cb_confirm_torrent_deletion,
cb_confirm_torrent_recheck, cb_enable_tracker_ext, cb_listen_ipv6; cb_confirm_torrent_recheck, cb_enable_tracker_ext, cb_listen_ipv6;
QComboBox combo_iface; QComboBox combo_iface;
@ -44,7 +71,8 @@ private:
QLineEdit txt_network_address; QLineEdit txt_network_address;
public: public:
AdvancedSettings(QWidget *parent=0): QTableWidget(parent) { AdvancedSettings(QWidget *parent=0): QTableWidget(parent)
{
// Set visual appearance // Set visual appearance
setEditTriggers(QAbstractItemView::NoEditTriggers); setEditTriggers(QAbstractItemView::NoEditTriggers);
setAlternatingRowColors(true); setAlternatingRowColors(true);
@ -62,11 +90,11 @@ public:
loadAdvancedSettings(); loadAdvancedSettings();
} }
~AdvancedSettings() { ~AdvancedSettings() {}
}
public slots: public slots:
void saveAdvancedSettings() { void saveAdvancedSettings()
{
Preferences* const pref = Preferences::instance(); Preferences* const pref = Preferences::instance();
// Disk write cache // Disk write cache
pref->setDiskCacheSize(spin_cache.value()); pref->setDiskCacheSize(spin_cache.value());
@ -78,8 +106,6 @@ public slots:
// Outgoing ports // Outgoing ports
pref->setOutgoingPortsMin(outgoing_ports_min.value()); pref->setOutgoingPortsMin(outgoing_ports_min.value());
pref->setOutgoingPortsMax(outgoing_ports_max.value()); pref->setOutgoingPortsMax(outgoing_ports_max.value());
// Ignore limits on LAN
pref->ignoreLimitsOnLAN(cb_ignore_limits_lan.isChecked());
// Recheck torrents on completion // Recheck torrents on completion
pref->recheckTorrentsOnCompletion(cb_recheck_completed.isChecked()); pref->recheckTorrentsOnCompletion(cb_recheck_completed.isChecked());
// Transfer list refresh interval // Transfer list refresh interval
@ -96,7 +122,8 @@ public slots:
// All interfaces (default) // All interfaces (default)
pref->setNetworkInterface(QString::null); pref->setNetworkInterface(QString::null);
pref->setNetworkInterfaceName(QString::null); pref->setNetworkInterfaceName(QString::null);
} else { }
else {
pref->setNetworkInterface(combo_iface.itemData(combo_iface.currentIndex()).toString()); pref->setNetworkInterface(combo_iface.itemData(combo_iface.currentIndex()).toString());
pref->setNetworkInterfaceName(combo_iface.currentText()); pref->setNetworkInterfaceName(combo_iface.currentText());
} }
@ -131,7 +158,8 @@ signals:
void settingsChanged(); void settingsChanged();
private: private:
void setRow(int row, const QString &property, QSpinBox* editor) { void setRow(int row, const QString &property, QSpinBox* editor)
{
setItem(row, PROPERTY, new QTableWidgetItem(property)); setItem(row, PROPERTY, new QTableWidgetItem(property));
bool ok; Q_UNUSED(ok); bool ok; Q_UNUSED(ok);
ok = connect(editor, SIGNAL(valueChanged(int)), SIGNAL(settingsChanged())); ok = connect(editor, SIGNAL(valueChanged(int)), SIGNAL(settingsChanged()));
@ -139,7 +167,8 @@ private:
setCellWidget(row, VALUE, editor); setCellWidget(row, VALUE, editor);
} }
void setRow(int row, const QString &property, QComboBox* editor) { void setRow(int row, const QString &property, QComboBox* editor)
{
setItem(row, PROPERTY, new QTableWidgetItem(property)); setItem(row, PROPERTY, new QTableWidgetItem(property));
bool ok; Q_UNUSED(ok); bool ok; Q_UNUSED(ok);
ok = connect(editor, SIGNAL(currentIndexChanged(int)), SIGNAL(settingsChanged())); ok = connect(editor, SIGNAL(currentIndexChanged(int)), SIGNAL(settingsChanged()));
@ -147,7 +176,8 @@ private:
setCellWidget(row, VALUE, editor); setCellWidget(row, VALUE, editor);
} }
void setRow(int row, const QString &property, QCheckBox* editor) { void setRow(int row, const QString &property, QCheckBox* editor)
{
setItem(row, PROPERTY, new QTableWidgetItem(property)); setItem(row, PROPERTY, new QTableWidgetItem(property));
bool ok; Q_UNUSED(ok); bool ok; Q_UNUSED(ok);
ok = connect(editor, SIGNAL(stateChanged(int)), SIGNAL(settingsChanged())); ok = connect(editor, SIGNAL(stateChanged(int)), SIGNAL(settingsChanged()));
@ -155,7 +185,8 @@ private:
setCellWidget(row, VALUE, editor); setCellWidget(row, VALUE, editor);
} }
void setRow(int row, const QString &property, QLineEdit* editor) { void setRow(int row, const QString &property, QLineEdit* editor)
{
setItem(row, PROPERTY, new QTableWidgetItem(property)); setItem(row, PROPERTY, new QTableWidgetItem(property));
bool ok; Q_UNUSED(ok); bool ok; Q_UNUSED(ok);
ok = connect(editor, SIGNAL(textChanged(QString)), SIGNAL(settingsChanged())); ok = connect(editor, SIGNAL(textChanged(QString)), SIGNAL(settingsChanged()));
@ -214,9 +245,6 @@ private slots:
outgoing_ports_max.setMaximum(65535); outgoing_ports_max.setMaximum(65535);
outgoing_ports_max.setValue(pref->outgoingPortsMax()); outgoing_ports_max.setValue(pref->outgoingPortsMax());
setRow(OUTGOING_PORT_MAX, tr("Outgoing ports (Max) [0: Disabled]"), &outgoing_ports_max); setRow(OUTGOING_PORT_MAX, tr("Outgoing ports (Max) [0: Disabled]"), &outgoing_ports_max);
// Ignore transfer limits on local network
cb_ignore_limits_lan.setChecked(pref->ignoreLimitsOnLAN());
setRow(IGNORE_LIMIT_LAN, tr("Ignore transfer limits on local network"), &cb_ignore_limits_lan);
// Recheck completed torrents // Recheck completed torrents
cb_recheck_completed.setChecked(pref->recheckTorrentsOnCompletion()); cb_recheck_completed.setChecked(pref->recheckTorrentsOnCompletion());
setRow(RECHECK_COMPLETED, tr("Recheck torrents on completion"), &cb_recheck_completed); setRow(RECHECK_COMPLETED, tr("Recheck torrents on completion"), &cb_recheck_completed);
@ -298,7 +326,6 @@ private slots:
cb_announce_all_trackers.setChecked(pref->announceToAllTrackers()); cb_announce_all_trackers.setChecked(pref->announceToAllTrackers());
setRow(ANNOUNCE_ALL_TRACKERS, tr("Always announce to all trackers"), &cb_announce_all_trackers); setRow(ANNOUNCE_ALL_TRACKERS, tr("Always announce to all trackers"), &cb_announce_all_trackers);
} }
}; };
#endif // ADVANCEDSETTINGS_H #endif // ADVANCEDSETTINGS_H

View file

@ -1668,6 +1668,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="checkLimitLocalPeerRate">
<property name="text">
<string>Apply rate limit to peers on LAN</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View file

@ -210,6 +210,7 @@ options_imp::options_imp(QWidget *parent):
connect(checkuTP, SIGNAL(toggled(bool)), SLOT(enableApplyButton())); connect(checkuTP, SIGNAL(toggled(bool)), SLOT(enableApplyButton()));
connect(checkLimituTPConnections, SIGNAL(toggled(bool)), SLOT(enableApplyButton())); connect(checkLimituTPConnections, SIGNAL(toggled(bool)), SLOT(enableApplyButton()));
connect(checkLimitTransportOverhead, SIGNAL(toggled(bool)), SLOT(enableApplyButton())); connect(checkLimitTransportOverhead, SIGNAL(toggled(bool)), SLOT(enableApplyButton()));
connect(checkLimitLocalPeerRate, SIGNAL(toggled(bool)), SLOT(enableApplyButton()));
// Bittorrent tab // Bittorrent tab
connect(checkMaxConnecs, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkMaxConnecs, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkMaxConnecsPerTorrent, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkMaxConnecsPerTorrent, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
@ -429,6 +430,7 @@ void options_imp::saveOptions() {
pref->setuTPEnabled(checkuTP->isChecked()); pref->setuTPEnabled(checkuTP->isChecked());
pref->setuTPRateLimited(checkLimituTPConnections->isChecked()); pref->setuTPRateLimited(checkLimituTPConnections->isChecked());
pref->includeOverheadInLimits(checkLimitTransportOverhead->isChecked()); pref->includeOverheadInLimits(checkLimitTransportOverhead->isChecked());
pref->setIgnoreLimitsOnLAN(!checkLimitLocalPeerRate->isChecked());
const QPair<int, int> alt_down_up_limit = getAltGlobalBandwidthLimits(); const QPair<int, int> alt_down_up_limit = getAltGlobalBandwidthLimits();
pref->setAltGlobalDownloadLimit(alt_down_up_limit.first); pref->setAltGlobalDownloadLimit(alt_down_up_limit.first);
pref->setAltGlobalUploadLimit(alt_down_up_limit.second); pref->setAltGlobalUploadLimit(alt_down_up_limit.second);
@ -665,6 +667,7 @@ void options_imp::loadOptions() {
checkuTP->setChecked(pref->isuTPEnabled()); checkuTP->setChecked(pref->isuTPEnabled());
checkLimituTPConnections->setChecked(pref->isuTPRateLimited()); checkLimituTPConnections->setChecked(pref->isuTPRateLimited());
checkLimitTransportOverhead->setChecked(pref->includeOverheadInLimits()); checkLimitTransportOverhead->setChecked(pref->includeOverheadInLimits());
checkLimitLocalPeerRate->setChecked(!pref->getIgnoreLimitsOnLAN());
// Scheduler // Scheduler
check_schedule->setChecked(pref->isSchedulerEnabled()); check_schedule->setChecked(pref->isSchedulerEnabled());
schedule_from->setTime(pref->getSchedulerStartTime()); schedule_from->setTime(pref->getSchedulerStartTime());