Rearrange the Network tab in GTK and Web UIs

Also applied the suggestions in #2055 including removing 'Encrypt Entire Stream'
and default it (prefer_rc4) to True
This commit is contained in:
Calum Lind 2013-05-11 16:15:17 +01:00
parent 8d63ce3ce5
commit 7bd53903a4
6 changed files with 515 additions and 598 deletions

View File

@ -73,7 +73,6 @@ DEFAULT_PREFS = {
"enc_in_policy": 1,
"enc_out_policy": 1,
"enc_level": 2,
"enc_prefer_rc4": True,
"max_connections_global": 200,
"max_upload_speed": -1.0,
"max_download_speed": -1.0,
@ -305,18 +304,16 @@ class PreferencesManager(component.Component):
def _on_set_enc_level(self, key, value):
self._on_set_encryption(key, value)
def _on_set_enc_prefer_rc4(self, key, value):
self._on_set_encryption(key, value)
def _on_set_encryption(self, key, value):
log.debug("encryption value %s set to %s..", key, value)
pe_enc_level = {0: lt.enc_level.plaintext, 1: lt.enc_level.rc4, 2: lt.enc_level.both}
pe_settings = lt.pe_settings()
pe_settings.out_enc_policy = \
lt.enc_policy(self.config["enc_out_policy"])
pe_settings.in_enc_policy = lt.enc_policy(self.config["enc_in_policy"])
pe_settings.allowed_enc_level = lt.enc_level(pe_enc_level[self.config["enc_level"]])
pe_settings.prefer_rc4 = self.config["enc_prefer_rc4"]
pe_settings.prefer_rc4 = True
self.session.set_pe_settings(pe_settings)
set = self.session.get_pe_settings()
log.debug("encryption settings:\n\t\t\tout_policy: %s\n\t\t\

View File

@ -287,7 +287,6 @@ class NetworkPane(BasePane):
self.add_select_input("enc_in_policy","Inbound:",["Forced","Enabled","Disabled"],[0,1,2],parent.core_config["enc_in_policy"])
self.add_select_input("enc_out_policy","Outbound:",["Forced","Enabled","Disabled"],[0,1,2],parent.core_config["enc_out_policy"])
self.add_select_input("enc_level","Level:",["Handshake","Full Stream","Either"],[0,1,2],parent.core_config["enc_level"])
self.add_checked_input("enc_prefer_rc4","Encrypt Entire Stream",parent.core_config["enc_prefer_rc4"])
class BandwidthPane(BasePane):

File diff suppressed because it is too large Load Diff

View File

@ -161,6 +161,7 @@ class Preferences(component.Component):
"on_button_rescan_plugins_clicked": self._on_button_rescan_plugins_clicked,
"on_button_find_plugins_clicked": self._on_button_find_plugins_clicked,
"on_button_cache_refresh_clicked": self._on_button_cache_refresh_clicked,
"on_combo_encryption_changed": self._on_combo_encryption_changed,
"on_combo_proxy_type_changed": self._on_combo_proxy_type_changed,
"on_button_associate_magnet_clicked": self._on_button_associate_magnet_clicked,
"on_accounts_add_clicked": self._on_accounts_add_clicked,
@ -337,7 +338,6 @@ class Preferences(component.Component):
"combo_encin": ("active", self.core_config["enc_in_policy"]),
"combo_encout": ("active", self.core_config["enc_out_policy"]),
"combo_enclevel": ("active", self.core_config["enc_level"]),
"chk_pref_rc4": ("active", self.core_config["enc_prefer_rc4"]),
"spin_max_connections_global": \
("value", self.core_config["max_connections_global"]),
"spin_max_download": \
@ -493,7 +493,6 @@ class Preferences(component.Component):
"combo_encin",
"combo_encout",
"combo_enclevel",
"chk_pref_rc4",
"spin_max_connections_global",
"spin_max_download",
"spin_max_upload",
@ -696,8 +695,6 @@ class Preferences(component.Component):
self.builder.get_object("combo_encout").get_active()
new_core_config["enc_level"] = \
self.builder.get_object("combo_enclevel").get_active()
new_core_config["enc_prefer_rc4"] = \
self.builder.get_object("chk_pref_rc4").get_active()
## Bandwidth tab ##
new_core_config["max_connections_global"] = \
@ -1077,6 +1074,17 @@ class Preferences(component.Component):
def _on_button_find_plugins_clicked(self, widget):
deluge.common.open_url_in_browser("http://dev.deluge-torrent.org/wiki/Plugins")
def _on_combo_encryption_changed(self, widget):
combo_encin = self.builder.get_object("combo_encin").get_active()
combo_encout = self.builder.get_object("combo_encout").get_active()
combo_enclevel = self.builder.get_object("combo_enclevel")
# If incoming and outgoing both set to disabled, disable level combobox
if combo_encin == 2 and combo_encout == 2:
combo_enclevel.set_sensitive(False)
else:
combo_enclevel.set_sensitive(True)
def _on_combo_proxy_type_changed(self, widget):
name = widget.get_name().replace("combo_proxy_type_", "")
proxy_type = widget.get_model()[widget.get_active()][0]

View File

@ -1,6 +1,6 @@
/*!
* Deluge.preferences.EncryptionPage.js
*
*
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
@ -39,12 +39,12 @@ Deluge.preferences.Encryption = Ext.extend(Ext.form.FormPanel, {
border: false,
title: _('Encryption'),
initComponent: function() {
Deluge.preferences.Encryption.superclass.initComponent.call(this);
var optMan = deluge.preferences.getOptionsManager();
var fieldset = this.add({
xtype: 'fieldset',
border: false,
@ -54,7 +54,8 @@ Deluge.preferences.Encryption = Ext.extend(Ext.form.FormPanel, {
width: 300
});
optMan.bind('enc_in_policy', fieldset.add({
fieldLabel: _('Inbound'),
fieldLabel: _('Incoming:'),
labelSeparator : '',
mode: 'local',
width: 150,
store: new Ext.data.ArrayStore({
@ -71,7 +72,8 @@ Deluge.preferences.Encryption = Ext.extend(Ext.form.FormPanel, {
displayField: 'text'
}));
optMan.bind('enc_out_policy', fieldset.add({
fieldLabel: _('Outbound'),
fieldLabel: _('Outgoing:'),
labelSeparator : '',
mode: 'local',
width: 150,
store: new Ext.data.SimpleStore({
@ -88,7 +90,8 @@ Deluge.preferences.Encryption = Ext.extend(Ext.form.FormPanel, {
displayField: 'text'
}));
optMan.bind('enc_level', fieldset.add({
fieldLabel: _('Level'),
fieldLabel: _('Level:'),
labelSeparator : '',
mode: 'local',
width: 150,
store: new Ext.data.SimpleStore({
@ -104,12 +107,5 @@ Deluge.preferences.Encryption = Ext.extend(Ext.form.FormPanel, {
valueField: 'id',
displayField: 'text'
}));
optMan.bind('enc_prefer_rc4', fieldset.add({
xtype: 'checkbox',
name: 'enc_prefer_rc4',
height: 40,
hideLabel: true,
boxLabel: _('Encrypt entire stream')
}));
}
});

View File

@ -45,6 +45,22 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
Deluge.preferences.Network.superclass.initComponent.call(this);
var optMan = deluge.preferences.getOptionsManager();
fieldset = this.add({
xtype: 'fieldset',
border: false,
title: _('Incoming Address'),
style: 'margin-bottom: 5px; padding-bottom: 0px;',
autoHeight: true,
labelWidth: 1,
defaultType: 'textfield'
});
optMan.bind('listen_interface', fieldset.add({
name: 'listen_interface',
fieldLabel: '',
labelSeparator: '',
width: 200
}));
var fieldset = this.add({
xtype: 'fieldset',
border: false,
@ -79,7 +95,8 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
style: 'margin-right: 10px;'
},
items: [{
fieldLabel: 'From',
fieldLabel: 'From:',
labelSeparator: '',
strategy: {
xtype: 'number',
decimalPrecision: 0,
@ -87,7 +104,8 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
maxValue: 99999
}
}, {
fieldLabel: 'To',
fieldLabel: 'To:',
labelSeparator: '',
strategy: {
xtype: 'number',
decimalPrecision: 0,
@ -132,7 +150,8 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
style: 'margin-right: 10px;'
},
items: [{
fieldLabel: 'From',
fieldLabel: 'From:',
labelSeparator: '',
strategy: {
xtype: 'number',
decimalPrecision: 0,
@ -140,7 +159,8 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
maxValue: 99999
}
}, {
fieldLabel: 'To',
fieldLabel: 'To:',
labelSeparator: '',
strategy: {
xtype: 'number',
decimalPrecision: 0,
@ -151,37 +171,6 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
});
optMan.bind('outgoing_ports', this.outgoingPorts);
fieldset = this.add({
xtype: 'fieldset',
border: false,
title: _('Network Interface'),
style: 'margin-bottom: 5px; padding-bottom: 0px;',
autoHeight: true,
labelWidth: 1,
defaultType: 'textfield'
});
optMan.bind('listen_interface', fieldset.add({
name: 'listen_interface',
fieldLabel: '',
labelSeparator: '',
width: 200
}));
fieldset = this.add({
xtype: 'fieldset',
border: false,
title: _('TOS'),
style: 'margin-bottom: 5px; padding-bottom: 0px;',
bodyStyle: 'margin: 0px; padding: 0px',
autoHeight: true,
defaultType: 'textfield'
});
optMan.bind('peer_tos', fieldset.add({
name: 'peer_tos',
fieldLabel: _('Peer TOS Byte'),
width: 80
}));
fieldset = this.add({
xtype: 'fieldset',
border: false,
@ -233,5 +222,21 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
ctCls: 'x-deluge-indent-checkbox',
name: 'lt_tex'
}));
fieldset = this.add({
xtype: 'fieldset',
border: false,
title: _('Type Of Service'),
style: 'margin-bottom: 5px; padding-bottom: 0px;',
bodyStyle: 'margin: 0px; padding: 0px',
autoHeight: true,
defaultType: 'textfield'
});
optMan.bind('peer_tos', fieldset.add({
name: 'peer_tos',
fieldLabel: _('Peer TOS Byte:'),
labelSeparator: '',
width: 40
}));
}
});