From aa97b5a27327e50396bbeb1989ece985f69f21d7 Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Thu, 20 Aug 2009 23:50:59 +0000 Subject: [PATCH] allow the preferences config panel to overflow and tweak the pages so only the ones required to overflow do so --- .../ui/web/js/Deluge.Preferences.Bandwidth.js | 1 + .../ui/web/js/Deluge.Preferences.Downloads.js | 178 +++++++++--------- .../ui/web/js/Deluge.Preferences.Interface.js | 6 +- deluge/ui/web/js/Deluge.Preferences.Proxy.js | 126 ++++++++++++- deluge/ui/web/js/Deluge.Preferences.Queue.js | 1 + deluge/ui/web/js/Deluge.Preferences.js | 1 + 6 files changed, 215 insertions(+), 98 deletions(-) diff --git a/deluge/ui/web/js/Deluge.Preferences.Bandwidth.js b/deluge/ui/web/js/Deluge.Preferences.Bandwidth.js index 3f4d2d65d..92514e74e 100644 --- a/deluge/ui/web/js/Deluge.Preferences.Bandwidth.js +++ b/deluge/ui/web/js/Deluge.Preferences.Bandwidth.js @@ -121,6 +121,7 @@ Ext.deluge.preferences.Bandwidth = Ext.extend(Ext.form.FormPanel, { xtype: 'fieldset', border: false, title: _('Per Torrent Bandwidth Usage'), + style: 'margin-bottom: 0px; padding-bottom: 0px;', defaultType: 'uxspinner', labelWidth: 200, autoHeight: true diff --git a/deluge/ui/web/js/Deluge.Preferences.Downloads.js b/deluge/ui/web/js/Deluge.Preferences.Downloads.js index b18c1313e..e28a71d4a 100644 --- a/deluge/ui/web/js/Deluge.Preferences.Downloads.js +++ b/deluge/ui/web/js/Deluge.Preferences.Downloads.js @@ -1,90 +1,92 @@ -(function() { - DownloadPanel = Ext.extend(Ext.FormPanel, { - constructor: function(config) { - config = Ext.apply({ - border: false, - title: _('Downloads'), - layout: 'form' - }, config); - DownloadPanel.superclass.constructor.call(this, config); - }, +Ext.namespace('Ext.deluge.preferences'); +Ext.deluge.preferences.Downloads = Ext.extend(Ext.FormPanel, { + constructor: function(config) { + config = Ext.apply({ + border: false, + title: _('Downloads'), + layout: 'form', + autoHeight: true + }, config); + Ext.deluge.preferences.Downloads.superclass.constructor.call(this, config); + }, + + initComponent: function() { + Ext.deluge.preferences.Downloads.superclass.initComponent.call(this); - initComponent: function() { - DownloadPanel.superclass.initComponent.call(this); - - var optMan = Deluge.Preferences.getOptionsManager(); - var fieldset = this.add({ - xtype: 'fieldset', - border: false, - title: _('Folders'), - labelWidth: 150, - defaultType: 'textfield', - autoHeight: true - }); - optMan.bind('download_location', fieldset.add({ - name: 'download_location', - fieldLabel: _('Download to'), - width: 150 - })); - optMan.bind('move_completed_path', fieldset.add({ - name: 'move_completed_path', - fieldLabel: _('Move completed to'), - width: 150, - disabled: true - })); - optMan.bind('torrentfiles_location', fieldset.add({ - name: 'torrentfiles_location', - fieldLabel: _('Copy of .torrent files to'), - width: 150, - disabled: true - })); - optMan.bind('autoadd_location', fieldset.add({ - name: 'autoadd_location', - fieldLabel: _('Auto add .torrent files from'), - width: 150, - disabled: true - })); - - fieldset = this.add({ - xtype: 'fieldset', - border: false, - title: _('Allocation'), - autoHeight: true, - labelWidth: 1, - defaultType: 'radiogroup' - }); - optMan.bind('compact_allocation', fieldset.add({ - name: 'compact_allocation', - labelSeparator: '', - items: [ - {boxLabel: _('Compact') + ' ', inputValue: true}, - {boxLabel: _('Full'), inputValue: false} - ] - })); - - fieldset = this.add({ - xtype: 'fieldset', - border: false, - title: _('Options'), - autoHeight: true, - labelWidth: 1, - defaultType: 'checkbox' - }); - optMan.bind('prioritize_first_last_pieces', fieldset.add({ - name: 'prioritize_first_last_pieces', - labelSeparator: '', - boxLabel: _('Prioritize first and last pieces of torrent') - })); - optMan.bind('add_paused', fieldset.add({ - name: 'add_paused', - labelSeparator: '', - boxLabel: _('Add torrents in Paused state') - })); - }, + var optMan = Deluge.Preferences.getOptionsManager(); + var fieldset = this.add({ + xtype: 'fieldset', + border: false, + title: _('Folders'), + labelWidth: 150, + defaultType: 'textfield', + autoHeight: true + }); + optMan.bind('download_location', fieldset.add({ + name: 'download_location', + fieldLabel: _('Download to'), + width: 140 + })); + optMan.bind('move_completed_path', fieldset.add({ + name: 'move_completed_path', + fieldLabel: _('Move completed to'), + width: 140, + disabled: true + })); + optMan.bind('torrentfiles_location', fieldset.add({ + name: 'torrentfiles_location', + fieldLabel: _('Copy of .torrent files to'), + width: 140, + disabled: true + })); + optMan.bind('autoadd_location', fieldset.add({ + name: 'autoadd_location', + fieldLabel: _('Autoadd .torrent files from'), + width: 140, + disabled: true + })); - onShow: function() { - DownloadPanel.superclass.onShow.call(this); - } - }); - Deluge.Preferences.addPage(new DownloadPanel()); -})(); \ No newline at end of file + fieldset = this.add({ + xtype: 'fieldset', + border: false, + title: _('Allocation'), + autoHeight: true, + labelWidth: 1, + defaultType: 'radiogroup' + }); + optMan.bind('compact_allocation', fieldset.add({ + name: 'compact_allocation', + labelSeparator: '', + items: [ + {boxLabel: _('Compact') + ' ', inputValue: true}, + {boxLabel: _('Full'), inputValue: false} + ] + })); + + fieldset = this.add({ + xtype: 'fieldset', + border: false, + title: _('Options'), + autoHeight: true, + labelWidth: 1, + defaultType: 'checkbox' + }); + optMan.bind('prioritize_first_last_pieces', fieldset.add({ + name: 'prioritize_first_last_pieces', + labelSeparator: '', + boxLabel: _('Prioritize first and last pieces of torrent') + })); + optMan.bind('add_paused', fieldset.add({ + name: 'add_paused', + labelSeparator: '', + boxLabel: _('Add torrents in Paused state') + })); + + this.on('show', this.onShow, this); + }, + + onShow: function() { + Ext.deluge.preferences.Downloads.superclass.onShow.call(this); + } +}); +Deluge.Preferences.addPage(new Ext.deluge.preferences.Downloads()); \ No newline at end of file diff --git a/deluge/ui/web/js/Deluge.Preferences.Interface.js b/deluge/ui/web/js/Deluge.Preferences.Interface.js index 8a19642cc..79c740d6c 100644 --- a/deluge/ui/web/js/Deluge.Preferences.Interface.js +++ b/deluge/ui/web/js/Deluge.Preferences.Interface.js @@ -19,7 +19,7 @@ Ext.deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, { xtype: 'fieldset', border: false, title: _('Interface'), - style: 'margin-bottom: 5px; padding-bottom: 5px;', + style: 'margin-bottom: 5px; padding-bottom: 5px; padding-top: 5px', autoHeight: true, labelWidth: 1, defaultType: 'checkbox' @@ -47,7 +47,7 @@ Ext.deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, { xtype: 'fieldset', border: false, title: _('Password'), - style: 'margin-bottom: 0px; padding-bottom: 0px;', + style: 'margin-bottom: 0px; padding-bottom: 0px; padding-top: 5px', autoHeight: true, labelWidth: 110, defaultType: 'textfield', @@ -92,7 +92,7 @@ Ext.deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, { xtype: 'fieldset', border: false, title: _('Server'), - style: 'margin-top: 5px; padding-top: 5px;', + style: 'margin-top: 5px; padding-top: 5px; margin-bottom: 0px; padding-bottom: 0px', autoHeight: true, labelWidth: 110, defaultType: 'uxspinner', diff --git a/deluge/ui/web/js/Deluge.Preferences.Proxy.js b/deluge/ui/web/js/Deluge.Preferences.Proxy.js index ea9b78aac..523b83680 100644 --- a/deluge/ui/web/js/Deluge.Preferences.Proxy.js +++ b/deluge/ui/web/js/Deluge.Preferences.Proxy.js @@ -1,8 +1,120 @@ -/* -Deluge.Preferences.addPage(_('Proxy'), { - border: false, - xtype: 'form', - layout: 'form', - items: [] +Ext.namespace('Ext.deluge.preferences'); +Ext.deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, { + + constructor: function(config) { + config = Ext.apply({ + border: false, + autoHeight: true, + labelWidth: 70 + }, config); + Ext.deluge.preferences.ProxyField.superclass.constructor.call(this, config); + }, + + initComponent: function() { + Ext.deluge.preferences.ProxyField.superclass.initComponent.call(this); + this.type = this.add({ + xtype: 'combo', + fieldLabel: _('Type'), + mode: 'local', + width: 150, + store: new Ext.data.SimpleStore({ + fields: ['id', 'text'], + data: [ + [0, _('None')], + [1, _('Socksv4')], + [2, _('Socksv5')], + [3, _('Socksv5 with Auth')], + [4, _('HTTP')], + [5, _('HTTP with Auth')], + ] + }), + value: 0, + triggerAction: 'all', + valueField: 'id', + displayField: 'text' + }) + this.host = this.add({ + xtype: 'textfield', + fieldLabel: _('Host'), + disabled: true, + width: 220 + }); + this.port = this.add({ + xtype: 'uxspinner', + fieldLabel: _('Port'), + width: 80, + strategy: { + xtype: 'number', + decimalPrecision: 0, + minValue: -1, + maxValue: 99999 + }, + disabled: true + }); + this.username = this.add({ + xtype: 'textfield', + fieldLabel: _('Username'), + disabled: true, + width: 220 + }); + this.password = this.add({ + xtype: 'textfield', + fieldLabel: _('Password'), + inputType: 'password', + disabled: true, + width: 220 + }); + this.type.on('select', this.onTypeSelect, this); + }, + + onTypeSelect: function(combo, record, index) { + var typeId = record.get('id'); + if (typeId > 0) { + this.host.setDisabled(false); + this.port.setDisabled(false); + } else { + this.host.setDisabled(true); + this.port.setDisabled(true); + } + + if (typeId == 3 || typeId == 5) { + this.username.setDisabled(false); + this.password.setDisabled(false); + } else { + this.username.setDisabled(true); + this.password.setDisabled(true); + } + } }); -*/ \ No newline at end of file + + +Ext.deluge.preferences.Proxy = Ext.extend(Ext.form.FormPanel, { + constructor: function(config) { + config = Ext.apply({ + border: false, + title: _('Proxy'), + layout: 'form' + }, config); + Ext.deluge.preferences.Proxy.superclass.constructor.call(this, config); + }, + + initComponent: function() { + Ext.deluge.preferences.Proxy.superclass.initComponent.call(this); + + var optMan = Deluge.Preferences.getOptionsManager(); + + this.add(new Ext.deluge.preferences.ProxyField({ + title: _('Peer') + })); + this.add(new Ext.deluge.preferences.ProxyField({ + title: _('Web Seed') + })); + this.add(new Ext.deluge.preferences.ProxyField({ + title: _('Tracker') + })); + this.add(new Ext.deluge.preferences.ProxyField({ + title: _('DHT') + })); + } +}); +Deluge.Preferences.addPage(new Ext.deluge.preferences.Proxy()); \ No newline at end of file diff --git a/deluge/ui/web/js/Deluge.Preferences.Queue.js b/deluge/ui/web/js/Deluge.Preferences.Queue.js index 60e7bbb8f..0077bcbba 100644 --- a/deluge/ui/web/js/Deluge.Preferences.Queue.js +++ b/deluge/ui/web/js/Deluge.Preferences.Queue.js @@ -18,6 +18,7 @@ Ext.deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, { xtype: 'fieldset', border: false, title: _('General'), + style: 'padding-top: 5px;', autoHeight: true, labelWidth: 1, defaultType: 'checkbox' diff --git a/deluge/ui/web/js/Deluge.Preferences.js b/deluge/ui/web/js/Deluge.Preferences.js index 929c0ed76..5db73ae4e 100644 --- a/deluge/ui/web/js/Deluge.Preferences.js +++ b/deluge/ui/web/js/Deluge.Preferences.js @@ -82,6 +82,7 @@ Ext.deluge.PreferencesWindow = Ext.extend(Ext.Window, { header: false, layout: 'fit', height: 400, + autoScroll: true, margins: '5 5 5 5', cmargins: '5 5 5 5' });