#2218 #2254 : Re-enable utpex control and add lt_tex (tracker exchange)

This commit is contained in:
Calum Lind 2013-05-03 01:15:38 +01:00
parent 53db149b12
commit 6e8e7a63cc
10 changed files with 88 additions and 52 deletions

View File

@ -80,10 +80,7 @@ class Core(component.Component):
while len(version) < 4: while len(version) < 4:
version.append(0) version.append(0)
# Note: All libtorrent python bindings to set plugins/extensions need to be disabled self.session = lt.session(lt.fingerprint("DE", *version), flags=0)
# due to GIL issue. https://code.google.com/p/libtorrent/issues/detail?id=369
# Setting session flags to 1 enables all libtorrent default plugins
self.session = lt.session(lt.fingerprint("DE", *version), flags=1)
# Load the session state if available # Load the session state if available
self.__load_session_state() self.__load_session_state()
@ -105,12 +102,9 @@ class Core(component.Component):
lt.io_buffer_mode_t.disable_os_cache lt.io_buffer_mode_t.disable_os_cache
self.session.set_settings(self.settings) self.session.set_settings(self.settings)
# Load metadata extension self.session.add_extension("metadata_transfer")
# Note: All libtorrent python bindings to set plugins/extensions need to be disabled self.session.add_extension("ut_metadata")
# due to GIL issue. https://code.google.com/p/libtorrent/issues/detail?id=369 self.session.add_extension("smart_ban")
# self.session.add_extension(lt.create_metadata_plugin)
# self.session.add_extension(lt.create_ut_metadata_plugin)
# self.session.add_extension(lt.create_smart_ban_plugin)
# Create the components # Create the components
self.eventmanager = EventManager() self.eventmanager = EventManager()

View File

@ -68,6 +68,7 @@ DEFAULT_PREFS = {
"upnp": True, "upnp": True,
"natpmp": True, "natpmp": True,
"utpex": True, "utpex": True,
"lt_tex": True,
"lsd": True, "lsd": True,
"enc_in_policy": 1, "enc_in_policy": 1,
"enc_out_policy": 1, "enc_out_policy": 1,
@ -288,10 +289,12 @@ class PreferencesManager(component.Component):
def _on_set_utpex(self, key, value): def _on_set_utpex(self, key, value):
log.debug("utpex value set to %s", value) log.debug("utpex value set to %s", value)
if value: if value:
# Note: All libtorrent python bindings to set plugins/extensions need to be disabled self.session.add_extension("ut_pex")
# due to GIL issue. https://code.google.com/p/libtorrent/issues/detail?id=369
#self.session.add_extension(lt.create_ut_pex_plugin) def _on_set_lt_tex(self, key, value):
pass log.debug("lt_tex value set to %s", value)
if value:
self.session.add_extension("lt_trackers")
def _on_set_enc_in_policy(self, key, value): def _on_set_enc_in_policy(self, key, value):
self._on_set_encryption(key, value) self._on_set_encryption(key, value)

View File

@ -184,9 +184,6 @@ class TorrentResumedEvent(DelugeEvent):
class TorrentFileCompletedEvent(DelugeEvent): class TorrentFileCompletedEvent(DelugeEvent):
""" """
Emitted when a file completes. Emitted when a file completes.
This will only work with libtorrent 0.15 or greater.
""" """
def __init__(self, torrent_id, index): def __init__(self, torrent_id, index):
""" """

View File

@ -279,6 +279,7 @@ class NetworkPane(BasePane):
self.add_checked_input("upnp","UPnP",parent.core_config["upnp"]) self.add_checked_input("upnp","UPnP",parent.core_config["upnp"])
self.add_checked_input("natpmp","NAT-PMP",parent.core_config["natpmp"]) self.add_checked_input("natpmp","NAT-PMP",parent.core_config["natpmp"])
self.add_checked_input("utpex","Peer Exchange",parent.core_config["utpex"]) self.add_checked_input("utpex","Peer Exchange",parent.core_config["utpex"])
self.add_checked_input("lt_tex","Tracker Exchange",parent.core_config["lt_tex"])
self.add_checked_input("lsd","LSD",parent.core_config["lsd"]) self.add_checked_input("lsd","LSD",parent.core_config["lsd"])
self.add_checked_input("dht","DHT",parent.core_config["dht"]) self.add_checked_input("dht","DHT",parent.core_config["dht"])

View File

@ -1505,7 +1505,7 @@ used sparingly.</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">False</property> <property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Peer Exchange</property> <property name="tooltip_text" translatable="yes">Exchanges peers between clients. (Changing setting requires restart)</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">True</property> <property name="active">True</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
@ -1516,6 +1516,26 @@ used sparingly.</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkCheckButton" id="chk_lt_tex">
<property name="label" translatable="yes">Tracker Exchange</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Exchanges trackers between clients. (Changing setting requires restart)</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child> <child>
<object class="GtkCheckButton" id="chk_lsd"> <object class="GtkCheckButton" id="chk_lsd">
<property name="label" translatable="yes">LSD</property> <property name="label" translatable="yes">LSD</property>

View File

@ -323,6 +323,7 @@ class Preferences(component.Component):
"chk_upnp": ("active", self.core_config["upnp"]), "chk_upnp": ("active", self.core_config["upnp"]),
"chk_natpmp": ("active", self.core_config["natpmp"]), "chk_natpmp": ("active", self.core_config["natpmp"]),
"chk_utpex": ("active", self.core_config["utpex"]), "chk_utpex": ("active", self.core_config["utpex"]),
"chk_lt_tex": ("active", self.core_config["lt_tex"]),
"chk_lsd": ("active", self.core_config["lsd"]), "chk_lsd": ("active", self.core_config["lsd"]),
"chk_new_releases": ("active", self.core_config["new_release_check"]), "chk_new_releases": ("active", self.core_config["new_release_check"]),
"chk_send_info": ("active", self.core_config["send_info"]), "chk_send_info": ("active", self.core_config["send_info"]),
@ -478,6 +479,7 @@ class Preferences(component.Component):
"chk_upnp", "chk_upnp",
"chk_natpmp", "chk_natpmp",
"chk_utpex", "chk_utpex",
"chk_lt_tex",
"chk_lsd", "chk_lsd",
"chk_send_info", "chk_send_info",
"chk_new_releases", "chk_new_releases",
@ -678,6 +680,8 @@ class Preferences(component.Component):
self.builder.get_object("chk_natpmp").get_active() self.builder.get_object("chk_natpmp").get_active()
new_core_config["utpex"] = \ new_core_config["utpex"] = \
self.builder.get_object("chk_utpex").get_active() self.builder.get_object("chk_utpex").get_active()
new_core_config["lt_tex"] = \
self.builder.get_object("chk_lt_tex").get_active()
new_core_config["lsd"] = \ new_core_config["lsd"] = \
self.builder.get_object("chk_lsd").get_active() self.builder.get_object("chk_lsd").get_active()
new_core_config["enc_in_policy"] = \ new_core_config["enc_in_policy"] = \

View File

@ -755,6 +755,9 @@ GetText.add('Total Size', '${escape(_("Total Size"))}')
// EditTrackersWindow.js:80, TorrentGrid.js:193, EditTrackerWindow.js:66, DetailsTab.js:53, ProxyPage.js:64 // EditTrackersWindow.js:80, TorrentGrid.js:193, EditTrackerWindow.js:66, DetailsTab.js:53, ProxyPage.js:64
GetText.add('Tracker', '${escape(_("Tracker"))}') GetText.add('Tracker', '${escape(_("Tracker"))}')
// NetworkPage.js:232
GetText.add('Tracker Exchange', '${escape(_("Tracker Exchange"))}')
// Sidebar.js:35 // Sidebar.js:35
GetText.add('Tracker Host', '${escape(_("Tracker Host"))}') GetText.add('Tracker Host', '${escape(_("Tracker Host"))}')

View File

@ -3388,7 +3388,7 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, {
}); });
/*! /*!
* Deluge.preferences.NetworkPage.js * Deluge.preferences.NetworkPage.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -3424,7 +3424,7 @@ Ext.namespace('Deluge.preferences');
* @extends Ext.form.FormPanel * @extends Ext.form.FormPanel
*/ */
Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, { Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
border: false, border: false,
layout: 'form', layout: 'form',
title: _('Network'), title: _('Network'),
@ -3432,7 +3432,7 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
initComponent: function() { initComponent: function() {
Deluge.preferences.Network.superclass.initComponent.call(this); Deluge.preferences.Network.superclass.initComponent.call(this);
var optMan = deluge.preferences.getOptionsManager(); var optMan = deluge.preferences.getOptionsManager();
var fieldset = this.add({ var fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
border: false, border: false,
@ -3485,7 +3485,7 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
}] }]
}); });
optMan.bind('listen_ports', this.listenPorts); optMan.bind('listen_ports', this.listenPorts);
fieldset = this.add({ fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
border: false, border: false,
@ -3538,7 +3538,7 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
}] }]
}); });
optMan.bind('outgoing_ports', this.outgoingPorts); optMan.bind('outgoing_ports', this.outgoingPorts);
fieldset = this.add({ fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
border: false, border: false,
@ -3554,7 +3554,7 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
labelSeparator: '', labelSeparator: '',
width: 200 width: 200
})); }));
fieldset = this.add({ fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
border: false, border: false,
@ -3569,7 +3569,7 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
fieldLabel: _('Peer TOS Byte'), fieldLabel: _('Peer TOS Byte'),
width: 80 width: 80
})); }));
fieldset = this.add({ fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
border: false, border: false,
@ -3578,7 +3578,7 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
layout: 'table', layout: 'table',
layoutConfig: { layoutConfig: {
columns: 3 columns: 3
}, },
defaultType: 'checkbox' defaultType: 'checkbox'
}); });
optMan.bind('upnp', fieldset.add({ optMan.bind('upnp', fieldset.add({
@ -3614,11 +3614,18 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
ctCls: 'x-deluge-indent-checkbox', ctCls: 'x-deluge-indent-checkbox',
name: 'dht' name: 'dht'
})); }));
optMan.bind('lt_tex', fieldset.add({
fieldLabel: '',
labelSeparator: '',
boxLabel: _('Tracker Exchange'),
ctCls: 'x-deluge-indent-checkbox',
name: 'lt_tex'
}));
} }
}); });
/*! /*!
* Deluge.preferences.OtherPage.js * Deluge.preferences.OtherPage.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -3662,12 +3669,12 @@ Deluge.preferences.Other = Ext.extend(Ext.form.FormPanel, {
}, config); }, config);
Deluge.preferences.Other.superclass.constructor.call(this, config); Deluge.preferences.Other.superclass.constructor.call(this, config);
}, },
initComponent: function() { initComponent: function() {
Deluge.preferences.Other.superclass.initComponent.call(this); Deluge.preferences.Other.superclass.initComponent.call(this);
var optMan = deluge.preferences.getOptionsManager(); var optMan = deluge.preferences.getOptionsManager();
var fieldset = this.add({ var fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
border: false, border: false,
@ -3683,7 +3690,7 @@ Deluge.preferences.Other = Ext.extend(Ext.form.FormPanel, {
name: 'new_release_check', name: 'new_release_check',
boxLabel: _('Be alerted about new releases') boxLabel: _('Be alerted about new releases')
})); }));
fieldset = this.add({ fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
border: false, border: false,
@ -3696,9 +3703,9 @@ Deluge.preferences.Other = Ext.extend(Ext.form.FormPanel, {
xtype: 'panel', xtype: 'panel',
border: false, border: false,
bodyCfg: { bodyCfg: {
html: _('Help us improve Deluge by sending us your ' html: _('Help us improve Deluge by sending us your \
+ 'Python version, PyGTK version, OS and processor ' Python version, PyGTK version, OS and processor \
+ 'types. Absolutely no other information is sent.') types. Absolutely no other information is sent.')
} }
}); });
optMan.bind('send_info', fieldset.add({ optMan.bind('send_info', fieldset.add({
@ -3708,7 +3715,7 @@ Deluge.preferences.Other = Ext.extend(Ext.form.FormPanel, {
boxLabel: _('Yes, please send anonymous statistics'), boxLabel: _('Yes, please send anonymous statistics'),
name: 'send_info' name: 'send_info'
})); }));
fieldset = this.add({ fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
border: false, border: false,
@ -4827,7 +4834,7 @@ Deluge.StatusbarMenu = Ext.extend(Ext.menu.Menu, {
}); });
/*! /*!
* Deluge.OptionsManager.js * Deluge.OptionsManager.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -4867,7 +4874,7 @@ Ext.namespace('Deluge');
* @param {Object} config Configuration options * @param {Object} config Configuration options
*/ */
Deluge.OptionsManager = Ext.extend(Ext.util.Observable, { Deluge.OptionsManager = Ext.extend(Ext.util.Observable, {
constructor: function(config) { constructor: function(config) {
config = config || {}; config = config || {};
this.binds = {}; this.binds = {};
@ -4909,7 +4916,7 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, {
addOptions: function(options) { addOptions: function(options) {
this.options = Ext.applyIf(this.options, options); this.options = Ext.applyIf(this.options, options);
}, },
/** /**
* Binds a form field to the specified option. * Binds a form field to the specified option.
* @param {String} option * @param {String} option
@ -5089,7 +5096,7 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, {
* @private * @private
*/ */
onFieldChange: function(field, event) { onFieldChange: function(field, event) {
if (field.field) field = field.field // fix for spinners if (field.field) field = field.field; // fix for spinners
this.update(field._doption, field.getValue()); this.update(field._doption, field.getValue());
}, },
@ -5106,7 +5113,7 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, {
// If we don't have a bind there's nothing to do. // If we don't have a bind there's nothing to do.
if (Ext.isEmpty(this.binds[option])) return; if (Ext.isEmpty(this.binds[option])) return;
Ext.each(this.binds[option], function(bind) { Ext.each(this.binds[option], function(bind) {
// The field is currently focused so we don't want to // The field is currently focused so we don't want to
// change it. // change it.
if (bind == this.focused) return; if (bind == this.focused) return;
// Set the form field to the new value. // Set the form field to the new value.

View File

@ -736,7 +736,7 @@ Ext.namespace("Deluge.preferences");Deluge.preferences.InstallPluginWindow=Ext.e
Ext.namespace("Deluge.preferences");Deluge.preferences.Interface=Ext.extend(Ext.form.FormPanel,{border:false,title:_("Interface"),layout:"form",initComponent:function(){Deluge.preferences.Interface.superclass.initComponent.call(this);var c=this.optionsManager=new Deluge.OptionsManager();this.on("show",this.onPageShow,this);var a=this.add({xtype:"fieldset",border:false,title:_("Interface"),style:"margin-bottom: 0px; padding-bottom: 5px; padding-top: 5px",autoHeight:true,labelWidth:1,defaultType:"checkbox"});c.bind("show_session_speed",a.add({name:"show_session_speed",height:22,fieldLabel:"",labelSeparator:"",boxLabel:_("Show session speed in titlebar")}));c.bind("sidebar_show_zero",a.add({name:"sidebar_show_zero",height:22,fieldLabel:"",labelSeparator:"",boxLabel:_("Show filters with zero torrents")}));c.bind("sidebar_multiple_filters",a.add({name:"sidebar_multiple_filters",height:22,fieldLabel:"",labelSeparator:"",boxLabel:_("Allow the use of multiple filters at once")}));a=this.add({xtype:"fieldset",border:false,title:_("Password"),style:"margin-bottom: 0px; padding-bottom: 0px; padding-top: 5px",autoHeight:true,labelWidth:110,defaultType:"textfield",defaults:{width:180,inputType:"password"}});this.oldPassword=a.add({name:"old_password",fieldLabel:_("Old Password")});this.newPassword=a.add({name:"new_password",fieldLabel:_("New Password")});this.confirmPassword=a.add({name:"confirm_password",fieldLabel:_("Confirm Password")});var b=a.add({xtype:"panel",autoHeight:true,border:false,width:320,bodyStyle:"padding-left: 230px"});b.add({xtype:"button",text:_("Change"),listeners:{click:{fn:this.onPasswordChange,scope:this}}});a=this.add({xtype:"fieldset",border:false,title:_("Server"),style:"margin-top: 0px; padding-top: 0px; margin-bottom: 0px; padding-bottom: 0px",autoHeight:true,labelWidth:110,defaultType:"spinnerfield",defaults:{width:80}});c.bind("session_timeout",a.add({name:"session_timeout",fieldLabel:_("Session Timeout"),decimalPrecision:0,minValue:-1,maxValue:99999}));c.bind("port",a.add({name:"port",fieldLabel:_("Port"),decimalPrecision:0,minValue:-1,maxValue:99999}));this.httpsField=c.bind("https",a.add({xtype:"checkbox",name:"https",hideLabel:true,width:280,height:22,boxLabel:_("Use SSL (paths relative to Deluge config folder)")}));this.httpsField.on("check",this.onSSLCheck,this);this.pkeyField=c.bind("pkey",a.add({xtype:"textfield",disabled:true,name:"pkey",width:180,fieldLabel:_("Private Key")}));this.certField=c.bind("cert",a.add({xtype:"textfield",disabled:true,name:"cert",width:180,fieldLabel:_("Certificate")}))},onApply:function(){var b=this.optionsManager.getDirty();if(!Ext.isObjectEmpty(b)){deluge.client.web.set_config(b,{success:this.onSetConfig,scope:this});for(var a in deluge.config){deluge.config[a]=this.optionsManager.get(a)}}},onGotConfig:function(a){this.optionsManager.set(a)},onPasswordChange:function(){var b=this.newPassword.getValue();if(b!=this.confirmPassword.getValue()){Ext.MessageBox.show({title:_("Invalid Password"),msg:_("Your passwords don't match!"),buttons:Ext.MessageBox.OK,modal:false,icon:Ext.MessageBox.ERROR,iconCls:"x-deluge-icon-error"});return}var a=this.oldPassword.getValue();deluge.client.auth.change_password(a,b,{success:function(c){if(!c){Ext.MessageBox.show({title:_("Password"),msg:_("Your old password was incorrect!"),buttons:Ext.MessageBox.OK,modal:false,icon:Ext.MessageBox.ERROR,iconCls:"x-deluge-icon-error"});this.oldPassword.setValue("")}else{Ext.MessageBox.show({title:_("Change Successful"),msg:_("Your password was successfully changed!"),buttons:Ext.MessageBox.OK,modal:false,icon:Ext.MessageBox.INFO,iconCls:"x-deluge-icon-info"});this.oldPassword.setValue("");this.newPassword.setValue("");this.confirmPassword.setValue("")}},scope:this})},onSetConfig:function(){this.optionsManager.commit()},onPageShow:function(){deluge.client.web.get_config({success:this.onGotConfig,scope:this})},onSSLCheck:function(b,a){this.pkeyField.setDisabled(!a);this.certField.setDisabled(!a)}}); Ext.namespace("Deluge.preferences");Deluge.preferences.Interface=Ext.extend(Ext.form.FormPanel,{border:false,title:_("Interface"),layout:"form",initComponent:function(){Deluge.preferences.Interface.superclass.initComponent.call(this);var c=this.optionsManager=new Deluge.OptionsManager();this.on("show",this.onPageShow,this);var a=this.add({xtype:"fieldset",border:false,title:_("Interface"),style:"margin-bottom: 0px; padding-bottom: 5px; padding-top: 5px",autoHeight:true,labelWidth:1,defaultType:"checkbox"});c.bind("show_session_speed",a.add({name:"show_session_speed",height:22,fieldLabel:"",labelSeparator:"",boxLabel:_("Show session speed in titlebar")}));c.bind("sidebar_show_zero",a.add({name:"sidebar_show_zero",height:22,fieldLabel:"",labelSeparator:"",boxLabel:_("Show filters with zero torrents")}));c.bind("sidebar_multiple_filters",a.add({name:"sidebar_multiple_filters",height:22,fieldLabel:"",labelSeparator:"",boxLabel:_("Allow the use of multiple filters at once")}));a=this.add({xtype:"fieldset",border:false,title:_("Password"),style:"margin-bottom: 0px; padding-bottom: 0px; padding-top: 5px",autoHeight:true,labelWidth:110,defaultType:"textfield",defaults:{width:180,inputType:"password"}});this.oldPassword=a.add({name:"old_password",fieldLabel:_("Old Password")});this.newPassword=a.add({name:"new_password",fieldLabel:_("New Password")});this.confirmPassword=a.add({name:"confirm_password",fieldLabel:_("Confirm Password")});var b=a.add({xtype:"panel",autoHeight:true,border:false,width:320,bodyStyle:"padding-left: 230px"});b.add({xtype:"button",text:_("Change"),listeners:{click:{fn:this.onPasswordChange,scope:this}}});a=this.add({xtype:"fieldset",border:false,title:_("Server"),style:"margin-top: 0px; padding-top: 0px; margin-bottom: 0px; padding-bottom: 0px",autoHeight:true,labelWidth:110,defaultType:"spinnerfield",defaults:{width:80}});c.bind("session_timeout",a.add({name:"session_timeout",fieldLabel:_("Session Timeout"),decimalPrecision:0,minValue:-1,maxValue:99999}));c.bind("port",a.add({name:"port",fieldLabel:_("Port"),decimalPrecision:0,minValue:-1,maxValue:99999}));this.httpsField=c.bind("https",a.add({xtype:"checkbox",name:"https",hideLabel:true,width:280,height:22,boxLabel:_("Use SSL (paths relative to Deluge config folder)")}));this.httpsField.on("check",this.onSSLCheck,this);this.pkeyField=c.bind("pkey",a.add({xtype:"textfield",disabled:true,name:"pkey",width:180,fieldLabel:_("Private Key")}));this.certField=c.bind("cert",a.add({xtype:"textfield",disabled:true,name:"cert",width:180,fieldLabel:_("Certificate")}))},onApply:function(){var b=this.optionsManager.getDirty();if(!Ext.isObjectEmpty(b)){deluge.client.web.set_config(b,{success:this.onSetConfig,scope:this});for(var a in deluge.config){deluge.config[a]=this.optionsManager.get(a)}}},onGotConfig:function(a){this.optionsManager.set(a)},onPasswordChange:function(){var b=this.newPassword.getValue();if(b!=this.confirmPassword.getValue()){Ext.MessageBox.show({title:_("Invalid Password"),msg:_("Your passwords don't match!"),buttons:Ext.MessageBox.OK,modal:false,icon:Ext.MessageBox.ERROR,iconCls:"x-deluge-icon-error"});return}var a=this.oldPassword.getValue();deluge.client.auth.change_password(a,b,{success:function(c){if(!c){Ext.MessageBox.show({title:_("Password"),msg:_("Your old password was incorrect!"),buttons:Ext.MessageBox.OK,modal:false,icon:Ext.MessageBox.ERROR,iconCls:"x-deluge-icon-error"});this.oldPassword.setValue("")}else{Ext.MessageBox.show({title:_("Change Successful"),msg:_("Your password was successfully changed!"),buttons:Ext.MessageBox.OK,modal:false,icon:Ext.MessageBox.INFO,iconCls:"x-deluge-icon-info"});this.oldPassword.setValue("");this.newPassword.setValue("");this.confirmPassword.setValue("")}},scope:this})},onSetConfig:function(){this.optionsManager.commit()},onPageShow:function(){deluge.client.web.get_config({success:this.onGotConfig,scope:this})},onSSLCheck:function(b,a){this.pkeyField.setDisabled(!a);this.certField.setDisabled(!a)}});
/* /*
* Deluge.preferences.NetworkPage.js * Deluge.preferences.NetworkPage.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -765,10 +765,10 @@ Ext.namespace("Deluge.preferences");Deluge.preferences.Interface=Ext.extend(Ext.
* this exception statement from your version. If you delete this exception * this exception statement from your version. If you delete this exception
* statement from all source files in the program, then also delete it here. * statement from all source files in the program, then also delete it here.
*/ */
Ext.namespace("Deluge.preferences");Deluge.preferences.Network=Ext.extend(Ext.form.FormPanel,{border:false,layout:"form",title:_("Network"),initComponent:function(){Deluge.preferences.Network.superclass.initComponent.call(this);var b=deluge.preferences.getOptionsManager();var a=this.add({xtype:"fieldset",border:false,title:_("Incoming Ports"),style:"margin-bottom: 5px; padding-bottom: 0px;",autoHeight:true,labelWidth:1,defaultType:"checkbox"});b.bind("random_port",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("Use Random Ports"),name:"random_port",height:22,listeners:{check:{fn:function(d,c){this.listenPorts.setDisabled(c)},scope:this}}}));this.listenPorts=a.add({xtype:"spinnergroup",name:"listen_ports",fieldLabel:"",labelSeparator:"",colCfg:{labelWidth:40,style:"margin-right: 10px;"},items:[{fieldLabel:"From",strategy:{xtype:"number",decimalPrecision:0,minValue:-1,maxValue:99999}},{fieldLabel:"To",strategy:{xtype:"number",decimalPrecision:0,minValue:-1,maxValue:99999}}]});b.bind("listen_ports",this.listenPorts);a=this.add({xtype:"fieldset",border:false,title:_("Outgoing Ports"),style:"margin-bottom: 5px; padding-bottom: 0px;",autoHeight:true,labelWidth:1,defaultType:"checkbox"});b.bind("random_outgoing_ports",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("Use Random Ports"),name:"random_outgoing_ports",height:22,listeners:{check:{fn:function(d,c){this.outgoingPorts.setDisabled(c)},scope:this}}}));this.outgoingPorts=a.add({xtype:"spinnergroup",name:"outgoing_ports",fieldLabel:"",labelSeparator:"",colCfg:{labelWidth:40,style:"margin-right: 10px;"},items:[{fieldLabel:"From",strategy:{xtype:"number",decimalPrecision:0,minValue:-1,maxValue:99999}},{fieldLabel:"To",strategy:{xtype:"number",decimalPrecision:0,minValue:-1,maxValue:99999}}]});b.bind("outgoing_ports",this.outgoingPorts);a=this.add({xtype:"fieldset",border:false,title:_("Network Interface"),style:"margin-bottom: 5px; padding-bottom: 0px;",autoHeight:true,labelWidth:1,defaultType:"textfield"});b.bind("listen_interface",a.add({name:"listen_interface",fieldLabel:"",labelSeparator:"",width:200}));a=this.add({xtype:"fieldset",border:false,title:_("TOS"),style:"margin-bottom: 5px; padding-bottom: 0px;",bodyStyle:"margin: 0px; padding: 0px",autoHeight:true,defaultType:"textfield"});b.bind("peer_tos",a.add({name:"peer_tos",fieldLabel:_("Peer TOS Byte"),width:80}));a=this.add({xtype:"fieldset",border:false,title:_("Network Extras"),autoHeight:true,layout:"table",layoutConfig:{columns:3},defaultType:"checkbox"});b.bind("upnp",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("UPnP"),name:"upnp"}));b.bind("natpmp",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("NAT-PMP"),ctCls:"x-deluge-indent-checkbox",name:"natpmp"}));b.bind("utpex",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("Peer Exchange"),ctCls:"x-deluge-indent-checkbox",name:"utpex"}));b.bind("lsd",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("LSD"),name:"lsd"}));b.bind("dht",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("DHT"),ctCls:"x-deluge-indent-checkbox",name:"dht"}))}}); Ext.namespace("Deluge.preferences");Deluge.preferences.Network=Ext.extend(Ext.form.FormPanel,{border:false,layout:"form",title:_("Network"),initComponent:function(){Deluge.preferences.Network.superclass.initComponent.call(this);var b=deluge.preferences.getOptionsManager();var a=this.add({xtype:"fieldset",border:false,title:_("Incoming Ports"),style:"margin-bottom: 5px; padding-bottom: 0px;",autoHeight:true,labelWidth:1,defaultType:"checkbox"});b.bind("random_port",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("Use Random Ports"),name:"random_port",height:22,listeners:{check:{fn:function(d,c){this.listenPorts.setDisabled(c)},scope:this}}}));this.listenPorts=a.add({xtype:"spinnergroup",name:"listen_ports",fieldLabel:"",labelSeparator:"",colCfg:{labelWidth:40,style:"margin-right: 10px;"},items:[{fieldLabel:"From",strategy:{xtype:"number",decimalPrecision:0,minValue:-1,maxValue:99999}},{fieldLabel:"To",strategy:{xtype:"number",decimalPrecision:0,minValue:-1,maxValue:99999}}]});b.bind("listen_ports",this.listenPorts);a=this.add({xtype:"fieldset",border:false,title:_("Outgoing Ports"),style:"margin-bottom: 5px; padding-bottom: 0px;",autoHeight:true,labelWidth:1,defaultType:"checkbox"});b.bind("random_outgoing_ports",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("Use Random Ports"),name:"random_outgoing_ports",height:22,listeners:{check:{fn:function(d,c){this.outgoingPorts.setDisabled(c)},scope:this}}}));this.outgoingPorts=a.add({xtype:"spinnergroup",name:"outgoing_ports",fieldLabel:"",labelSeparator:"",colCfg:{labelWidth:40,style:"margin-right: 10px;"},items:[{fieldLabel:"From",strategy:{xtype:"number",decimalPrecision:0,minValue:-1,maxValue:99999}},{fieldLabel:"To",strategy:{xtype:"number",decimalPrecision:0,minValue:-1,maxValue:99999}}]});b.bind("outgoing_ports",this.outgoingPorts);a=this.add({xtype:"fieldset",border:false,title:_("Network Interface"),style:"margin-bottom: 5px; padding-bottom: 0px;",autoHeight:true,labelWidth:1,defaultType:"textfield"});b.bind("listen_interface",a.add({name:"listen_interface",fieldLabel:"",labelSeparator:"",width:200}));a=this.add({xtype:"fieldset",border:false,title:_("TOS"),style:"margin-bottom: 5px; padding-bottom: 0px;",bodyStyle:"margin: 0px; padding: 0px",autoHeight:true,defaultType:"textfield"});b.bind("peer_tos",a.add({name:"peer_tos",fieldLabel:_("Peer TOS Byte"),width:80}));a=this.add({xtype:"fieldset",border:false,title:_("Network Extras"),autoHeight:true,layout:"table",layoutConfig:{columns:3},defaultType:"checkbox"});b.bind("upnp",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("UPnP"),name:"upnp"}));b.bind("natpmp",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("NAT-PMP"),ctCls:"x-deluge-indent-checkbox",name:"natpmp"}));b.bind("utpex",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("Peer Exchange"),ctCls:"x-deluge-indent-checkbox",name:"utpex"}));b.bind("lsd",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("LSD"),name:"lsd"}));b.bind("dht",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("DHT"),ctCls:"x-deluge-indent-checkbox",name:"dht"}));b.bind("lt_tex",a.add({fieldLabel:"",labelSeparator:"",boxLabel:_("Tracker Exchange"),ctCls:"x-deluge-indent-checkbox",name:"lt_tex"}))}});
/* /*
* Deluge.preferences.OtherPage.js * Deluge.preferences.OtherPage.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -992,7 +992,7 @@ Ext.namespace("Deluge.preferences");Deluge.preferences.Queue=Ext.extend(Ext.form
Ext.ns("Deluge");Deluge.StatusbarMenu=Ext.extend(Ext.menu.Menu,{initComponent:function(){Deluge.StatusbarMenu.superclass.initComponent.call(this);this.otherWin=new Deluge.OtherLimitWindow(this.initialConfig.otherWin||{});this.items.each(function(a){if(a.getXType()!="menucheckitem"){return}if(a.value=="other"){a.on("click",this.onOtherClicked,this)}else{a.on("checkchange",this.onLimitChanged,this)}},this)},setValue:function(b){var c=false;this.value=b=(b==0)?-1:b;var a=null;this.items.each(function(d){if(d.setChecked){d.suspendEvents();if(d.value==b){d.setChecked(true);c=true}else{d.setChecked(false)}d.resumeEvents()}if(d.value=="other"){a=d}});if(c){return}a.suspendEvents();a.setChecked(true);a.resumeEvents()},onLimitChanged:function(c,b){if(!b||c.value=="other"){return}var a={};a[c.group]=c.value;deluge.client.core.set_config(a,{success:function(){deluge.ui.update()}})},onOtherClicked:function(a,b){this.otherWin.group=a.group;this.otherWin.setValue(this.value);this.otherWin.show()}}); Ext.ns("Deluge");Deluge.StatusbarMenu=Ext.extend(Ext.menu.Menu,{initComponent:function(){Deluge.StatusbarMenu.superclass.initComponent.call(this);this.otherWin=new Deluge.OtherLimitWindow(this.initialConfig.otherWin||{});this.items.each(function(a){if(a.getXType()!="menucheckitem"){return}if(a.value=="other"){a.on("click",this.onOtherClicked,this)}else{a.on("checkchange",this.onLimitChanged,this)}},this)},setValue:function(b){var c=false;this.value=b=(b==0)?-1:b;var a=null;this.items.each(function(d){if(d.setChecked){d.suspendEvents();if(d.value==b){d.setChecked(true);c=true}else{d.setChecked(false)}d.resumeEvents()}if(d.value=="other"){a=d}});if(c){return}a.suspendEvents();a.setChecked(true);a.resumeEvents()},onLimitChanged:function(c,b){if(!b||c.value=="other"){return}var a={};a[c.group]=c.value;deluge.client.core.set_config(a,{success:function(){deluge.ui.update()}})},onOtherClicked:function(a,b){this.otherWin.group=a.group;this.otherWin.setValue(this.value);this.otherWin.show()}});
/* /*
* Deluge.OptionsManager.js * Deluge.OptionsManager.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*! /*!
* Deluge.preferences.NetworkPage.js * Deluge.preferences.NetworkPage.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -36,7 +36,7 @@ Ext.namespace('Deluge.preferences');
* @extends Ext.form.FormPanel * @extends Ext.form.FormPanel
*/ */
Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, { Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
border: false, border: false,
layout: 'form', layout: 'form',
title: _('Network'), title: _('Network'),
@ -44,7 +44,7 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
initComponent: function() { initComponent: function() {
Deluge.preferences.Network.superclass.initComponent.call(this); Deluge.preferences.Network.superclass.initComponent.call(this);
var optMan = deluge.preferences.getOptionsManager(); var optMan = deluge.preferences.getOptionsManager();
var fieldset = this.add({ var fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
border: false, border: false,
@ -97,7 +97,7 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
}] }]
}); });
optMan.bind('listen_ports', this.listenPorts); optMan.bind('listen_ports', this.listenPorts);
fieldset = this.add({ fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
border: false, border: false,
@ -150,7 +150,7 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
}] }]
}); });
optMan.bind('outgoing_ports', this.outgoingPorts); optMan.bind('outgoing_ports', this.outgoingPorts);
fieldset = this.add({ fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
border: false, border: false,
@ -166,7 +166,7 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
labelSeparator: '', labelSeparator: '',
width: 200 width: 200
})); }));
fieldset = this.add({ fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
border: false, border: false,
@ -181,7 +181,7 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
fieldLabel: _('Peer TOS Byte'), fieldLabel: _('Peer TOS Byte'),
width: 80 width: 80
})); }));
fieldset = this.add({ fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
border: false, border: false,
@ -190,7 +190,7 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
layout: 'table', layout: 'table',
layoutConfig: { layoutConfig: {
columns: 3 columns: 3
}, },
defaultType: 'checkbox' defaultType: 'checkbox'
}); });
optMan.bind('upnp', fieldset.add({ optMan.bind('upnp', fieldset.add({
@ -226,5 +226,12 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
ctCls: 'x-deluge-indent-checkbox', ctCls: 'x-deluge-indent-checkbox',
name: 'dht' name: 'dht'
})); }));
optMan.bind('lt_tex', fieldset.add({
fieldLabel: '',
labelSeparator: '',
boxLabel: _('Tracker Exchange'),
ctCls: 'x-deluge-indent-checkbox',
name: 'lt_tex'
}));
} }
}); });