fix the dodgy splitter positions on the spinners

This commit is contained in:
Damien Churchill 2009-07-30 22:26:23 +00:00
parent 8ad774cd3c
commit 0c4cc4d0e2

View File

@ -32,129 +32,128 @@ Copyright:
*/ */
(function() { Ext.deluge.PreferencesWindow = Ext.extend(Ext.Window, {
Ext.deluge.PreferencesWindow = Ext.extend(Ext.Window, { constructor: function(config) {
constructor: function(config) { config = Ext.apply({
config = Ext.apply({ layout: 'border',
layout: 'border', width: 485,
width: 485, height: 500,
height: 500, buttonAlign: 'right',
buttonAlign: 'right', closeAction: 'hide',
closeAction: 'hide', closable: true,
closable: true, iconCls: 'x-deluge-preferences',
iconCls: 'x-deluge-preferences', plain: true,
plain: true, resizable: false,
resizable: true, title: _('Preferences'),
title: _('Preferences'),
currentPage: false, currentPage: false,
items: [{ items: [{
xtype: 'grid', xtype: 'grid',
region: 'west', region: 'west',
title: _('Categories'), title: _('Categories'),
store: new Ext.data.SimpleStore({ store: new Ext.data.SimpleStore({
fields: [{name: 'name', mapping: 0}] fields: [{name: 'name', mapping: 0}]
}), }),
columns: [{id: 'name', renderer: fplain, dataIndex: 'name'}], columns: [{id: 'name', renderer: fplain, dataIndex: 'name'}],
sm: new Ext.grid.RowSelectionModel({ sm: new Ext.grid.RowSelectionModel({
singleSelect: true, singleSelect: true,
listeners: {'rowselect': {fn: this.onPageSelect, scope: this}} listeners: {'rowselect': {fn: this.onPageSelect, scope: this}}
}), }),
hideHeaders: true, hideHeaders: true,
autoExpandColumn: 'name', autoExpandColumn: 'name',
deferredRender: false, deferredRender: false,
autoScroll: true, autoScroll: true,
margins: '5 0 5 5', margins: '5 0 5 5',
cmargins: '5 0 5 5', cmargins: '5 0 5 5',
width: 120, width: 120,
collapsible: true collapsible: true
}, ] }, ]
}, config); }, config);
Ext.deluge.PreferencesWindow.superclass.constructor.call(this, config); Ext.deluge.PreferencesWindow.superclass.constructor.call(this, config);
}, },
initComponent: function() { initComponent: function() {
Ext.deluge.PreferencesWindow.superclass.initComponent.call(this); Ext.deluge.PreferencesWindow.superclass.initComponent.call(this);
this.categoriesGrid = this.items.get(0); this.categoriesGrid = this.items.get(0);
this.configPanel = this.add({ this.configPanel = this.add({
region: 'center', region: 'center',
header: false, header: false,
layout: 'fit', layout: 'fit',
height: 400, height: 400,
margins: '5 5 5 5', margins: '5 5 5 5',
cmargins: '5 5 5 5' cmargins: '5 5 5 5'
}); });
this.addButton(_('Close'), this.onClose, this); this.addButton(_('Close'), this.onClose, this);
this.addButton(_('Apply'), this.onApply, this); this.addButton(_('Apply'), this.onApply, this);
this.addButton(_('Ok'), this.onOk, this); this.addButton(_('Ok'), this.onOk, this);
this.optionsManager = new Deluge.OptionsManager(); this.optionsManager = new Deluge.OptionsManager();
this.pages = {}; this.pages = {};
this.optionsManager = new Deluge.OptionsManager(); this.optionsManager = new Deluge.OptionsManager();
this.on('show', this.onShow, this); this.on('show', this.onShow, this);
}, },
onApply: function(e) { onApply: function(e) {
var changed = this.optionsManager.getDirty(); var changed = this.optionsManager.getDirty();
Deluge.Client.core.set_config(changed, { Deluge.Client.core.set_config(changed, {
success: this.onSetConfig, success: this.onSetConfig,
scope: this scope: this
}); });
}, },
onClose: function() { onClose: function() {
this.hide(); this.hide();
}, },
addPage: function(page) { addPage: function(page) {
var store = this.categoriesGrid.getStore(); var store = this.categoriesGrid.getStore();
var name = page.title; var name = page.title;
store.loadData([[name]], true); store.loadData([[name]], true);
page['bodyStyle'] = 'margin: 5px'; page['bodyStyle'] = 'margin: 5px';
this.pages[name] = this.configPanel.add(page); this.pages[name] = this.configPanel.add(page);
this.pages[name].hide(); this.pages[name].setWidth(365);
}, this.pages[name].setHeight(410);
},
/** /**
* Return the options manager for the preferences window. * Return the options manager for the preferences window.
* @returns {Deluge.OptionsManager} the options manager * @returns {Deluge.OptionsManager} the options manager
*/ */
getOptionsManager: function() { getOptionsManager: function() {
return this.optionsManager; return this.optionsManager;
}, },
onGotConfig: function(config) { onGotConfig: function(config) {
this.getOptionsManager().set(config); this.getOptionsManager().set(config);
}, },
onPageSelect: function(selModel, rowIndex, r) { onPageSelect: function(selModel, rowIndex, r) {
if (this.currentPage) { if (this.currentPage) {
this.currentPage.hide(); this.currentPage.hide();
}
var name = r.get('name');
this.pages[name].show();
this.currentPage = this.pages[name];
this.configPanel.doLayout();
},
onSetConfig: function() {
this.getOptionsManager().commit();
},
onShow: function() {
if (!this.categoriesGrid.getSelectionModel().hasSelection()) {
this.categoriesGrid.getSelectionModel().selectFirstRow();
}
Deluge.Client.core.get_config({
success: this.onGotConfig,
scope: this
})
} }
}); var name = r.get('name');
Deluge.Preferences = new Ext.deluge.PreferencesWindow(); this.pages[name].show();
})(); this.currentPage = this.pages[name];
this.configPanel.doLayout();
},
onSetConfig: function() {
this.getOptionsManager().commit();
},
onShow: function() {
if (!this.categoriesGrid.getSelectionModel().hasSelection()) {
this.categoriesGrid.getSelectionModel().selectFirstRow();
}
Deluge.Client.core.get_config({
success: this.onGotConfig,
scope: this
})
}
});
Deluge.Preferences = new Ext.deluge.PreferencesWindow();