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.pages = {};
this.optionsManager = new Deluge.OptionsManager();
this.on('show', this.onShow, this);
},
onApply: function(e) { this.optionsManager = new Deluge.OptionsManager();
var changed = this.optionsManager.getDirty();
Deluge.Client.core.set_config(changed, {
success: this.onSetConfig,
scope: this
});
},
onClose: function() { this.pages = {};
this.hide(); this.optionsManager = new Deluge.OptionsManager();
}, this.on('show', this.onShow, this);
},
addPage: function(page) {
var store = this.categoriesGrid.getStore(); onApply: function(e) {
var name = page.title; var changed = this.optionsManager.getDirty();
store.loadData([[name]], true); Deluge.Client.core.set_config(changed, {
page['bodyStyle'] = 'margin: 5px'; success: this.onSetConfig,
this.pages[name] = this.configPanel.add(page); scope: this
this.pages[name].hide(); });
}, },
/** onClose: function() {
* Return the options manager for the preferences window. this.hide();
* @returns {Deluge.OptionsManager} the options manager },
*/
getOptionsManager: function() { addPage: function(page) {
return this.optionsManager; var store = this.categoriesGrid.getStore();
}, var name = page.title;
store.loadData([[name]], true);
onGotConfig: function(config) { page['bodyStyle'] = 'margin: 5px';
this.getOptionsManager().set(config); this.pages[name] = this.configPanel.add(page);
}, this.pages[name].setWidth(365);
this.pages[name].setHeight(410);
onPageSelect: function(selModel, rowIndex, r) { },
if (this.currentPage) {
this.currentPage.hide(); /**
} * Return the options manager for the preferences window.
var name = r.get('name'); * @returns {Deluge.OptionsManager} the options manager
*/
this.pages[name].show(); getOptionsManager: function() {
this.currentPage = this.pages[name]; return this.optionsManager;
this.configPanel.doLayout(); },
},
onGotConfig: function(config) {
onSetConfig: function() { this.getOptionsManager().set(config);
this.getOptionsManager().commit(); },
},
onPageSelect: function(selModel, rowIndex, r) {
onShow: function() { if (this.currentPage) {
if (!this.categoriesGrid.getSelectionModel().hasSelection()) { this.currentPage.hide();
this.categoriesGrid.getSelectionModel().selectFirstRow();
}
Deluge.Client.core.get_config({
success: this.onGotConfig,
scope: this
})
} }
}); 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
})
}
});
Deluge.Preferences = new Ext.deluge.PreferencesWindow(); Deluge.Preferences = new Ext.deluge.PreferencesWindow();
})();