webui: first commit where the interface loads

At this point the interface loads, but it is misshapen and needs a lot more
work to get it fully extjs 4.0 compatible.
This commit is contained in:
Damien Churchill 2011-06-13 00:02:53 +01:00
commit 5b45670a85
46 changed files with 851 additions and 873 deletions

View file

@ -19,7 +19,7 @@
author: 'Damien Churchill <damoxc@gmail.com>', author: 'Damien Churchill <damoxc@gmail.com>',
version: '${version}', version: '${version}',
config: ${js_config} config: ${js_config}
} };
</script> </script>
<!-- Javascript --> <!-- Javascript -->
@ -31,7 +31,7 @@
</script> </script>
</head> </head>
<body> <body>
<div style="background-image: url('${base}themes/images/default/tree/loading.gif');"></div> <div style="background-image: url('${base}resources/themes/images/default/tree/loading.gif');"></div>
<!-- Preload icon classes --> <!-- Preload icon classes -->
<div class="ext-mb-error"></div> <div class="ext-mb-error"></div>

View file

@ -1,2 +1,3 @@
+ OptionsManager.js + OptionsManager.js
+ StatusbarMenu.js + StatusbarMenu.js
+ Formatters.js

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.AddConnectionWindow.js * Deluge.AddConnectionWindow.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,13 +29,13 @@
* 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.ns('Deluge');
/** /**
* @class Deluge.AddConnectionWindow * @class Deluge.AddConnectionWindow
* @extends Ext.Window * @extends Ext.Window
*/ */
Deluge.AddConnectionWindow = Ext.extend(Ext.Window, { Ext.define('Deluge.AddConnectionWindow', {
extend: 'Ext.Window',
title: _('Add Connection'), title: _('Add Connection'),
iconCls: 'x-deluge-add-window-icon', iconCls: 'x-deluge-add-window-icon',
@ -48,7 +48,7 @@ Deluge.AddConnectionWindow = Ext.extend(Ext.Window, {
closeAction: 'hide', closeAction: 'hide',
initComponent: function() { initComponent: function() {
Deluge.AddConnectionWindow.superclass.initComponent.call(this); this.callParent(arguments);
this.addEvents('hostadded'); this.addEvents('hostadded');

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.AddTrackerWindow.js * Deluge.AddTrackerWindow.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,13 +29,13 @@
* 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.ns('Deluge');
/** /**
* @class Deluge.AddTrackerWindow * @class Deluge.AddTrackerWindow
* @extends Ext.Window * @extends Ext.Window
*/ */
Deluge.AddTrackerWindow = Ext.extend(Ext.Window, { Ext.define('Deluge.AddTrackerWindow', {
extend: 'Ext.Window',
title: _('Add Tracker'), title: _('Add Tracker'),
layout: 'fit', layout: 'fit',
@ -51,10 +51,10 @@ Deluge.AddTrackerWindow = Ext.extend(Ext.Window, {
iconCls: 'x-deluge-edit-trackers', iconCls: 'x-deluge-edit-trackers',
initComponent: function() { initComponent: function() {
Deluge.AddTrackerWindow.superclass.initComponent.call(this); this.callParent(arguments);
this.addButton(_('Cancel'), this.onCancelClick, this); //this.addButton(_('Cancel'), this.onCancelClick, this);
this.addButton(_('Add'), this.onAddClick, this); //this.addButton(_('Add'), this.onAddClick, this);
this.addEvents('add'); this.addEvents('add');
this.form = this.add({ this.form = this.add({

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.Client.js * Deluge.Client.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,7 +29,6 @@
* 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('Ext.ux.util');
/** /**
* A class that connects to a json-rpc resource and adds the available * A class that connects to a json-rpc resource and adds the available
@ -37,7 +36,8 @@ Ext.namespace('Ext.ux.util');
* @class Ext.ux.util.RpcClient * @class Ext.ux.util.RpcClient
* @namespace Ext.ux.util * @namespace Ext.ux.util
*/ */
Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, { Ext.define('Ext.ux.util.RpcClient', {
extend: 'Ext.util.Observable',
_components: [], _components: [],
@ -159,7 +159,7 @@ Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, {
}); });
if (isOption) { if (isOption) {
params.remove(options) params.pop(-1)
} else { } else {
options = {} options = {}
} }

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.ConnectionManager.js * Deluge.ConnectionManager.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -30,7 +30,8 @@
* 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.
*/ */
Deluge.ConnectionManager = Ext.extend(Ext.Window, { Ext.define('Deluge.ConnectionManager', {
extend: 'Ext.Window',
layout: 'fit', layout: 'fit',
width: 300, width: 300,
@ -44,15 +45,15 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
iconCls: 'x-deluge-connect-window-icon', iconCls: 'x-deluge-connect-window-icon',
initComponent: function() { initComponent: function() {
Deluge.ConnectionManager.superclass.initComponent.call(this); this.callParent(arguments);
this.on('hide', this.onHide, this); this.on('hide', this.onHide, this);
this.on('show', this.onShow, this); this.on('show', this.onShow, this);
deluge.events.on('login', this.onLogin, this); deluge.events.on('login', this.onLogin, this);
deluge.events.on('logout', this.onLogout, this); deluge.events.on('logout', this.onLogout, this);
this.addButton(_('Close'), this.onClose, this); //this.addButton(_('Close'), this.onClose, this);
this.addButton(_('Connect'), this.onConnect, this); //this.addButton(_('Connect'), this.onConnect, this);
this.list = new Ext.list.ListView({ this.list = new Ext.list.ListView({
store: new Ext.data.ArrayStore({ store: new Ext.data.ArrayStore({
@ -121,7 +122,7 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
] ]
}) })
}); });
this.update = this.update.createDelegate(this); this.update = this.update.bind(this);
}, },
/** /**
@ -337,7 +338,7 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
// private // private
onShow: function() { onShow: function() {
if (!this.addHostButton) { if (!this.addHostButton) {
var bbar = this.panel.getBottomToolbar(); var bbar = this.panel.getDockedItems()[0];
this.addHostButton = bbar.items.get('cm-add'); this.addHostButton = bbar.items.get('cm-add');
this.removeHostButton = bbar.items.get('cm-remove'); this.removeHostButton = bbar.items.get('cm-remove');
this.stopHostButton = bbar.items.get('cm-stop'); this.stopHostButton = bbar.items.get('cm-stop');

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.EditTrackerWindow.js * Deluge.EditTrackerWindow.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,13 +29,13 @@
* 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.ns('Deluge');
/** /**
* @class Deluge.EditTrackerWindow * @class Deluge.EditTrackerWindow
* @extends Ext.Window * @extends Ext.Window
*/ */
Deluge.EditTrackerWindow = Ext.extend(Ext.Window, { Ext.define('Deluge.EditTrackerWindow', {
extend: 'Ext.Window',
title: _('Edit Tracker'), title: _('Edit Tracker'),
layout: 'fit', layout: 'fit',
@ -51,10 +51,10 @@ Deluge.EditTrackerWindow = Ext.extend(Ext.Window, {
iconCls: 'x-deluge-edit-trackers', iconCls: 'x-deluge-edit-trackers',
initComponent: function() { initComponent: function() {
Deluge.EditTrackerWindow.superclass.initComponent.call(this); this.callParent(arguments);
this.addButton(_('Cancel'), this.onCancelClick, this); //this.addButton(_('Cancel'), this.onCancelClick, this);
this.addButton(_('Save'), this.onSaveClick, this); //this.addButton(_('Save'), this.onSaveClick, this);
this.on('hide', this.onHide, this); this.on('hide', this.onHide, this);
this.form = this.add({ this.form = this.add({
@ -71,7 +71,7 @@ Deluge.EditTrackerWindow = Ext.extend(Ext.Window, {
}, },
show: function(record) { show: function(record) {
Deluge.EditTrackerWindow.superclass.show.call(this); this.callParent(arguments);
this.record = record; this.record = record;
this.form.getForm().findField('tracker').setValue(record.data['url']); this.form.getForm().findField('tracker').setValue(record.data['url']);

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.EditTrackers.js * Deluge.EditTrackers.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -35,7 +35,8 @@ Ext.ns('Deluge');
* @class Deluge.EditTrackerWindow * @class Deluge.EditTrackerWindow
* @extends Ext.Window * @extends Ext.Window
*/ */
Deluge.EditTrackersWindow = Ext.extend(Ext.Window, { Ext.define('Deluge.EditTrackersWindow', {
extend: 'Ext.Window',
title: _('Edit Trackers'), title: _('Edit Trackers'),
layout: 'fit', layout: 'fit',
@ -51,18 +52,17 @@ Deluge.EditTrackersWindow = Ext.extend(Ext.Window, {
iconCls: 'x-deluge-edit-trackers', iconCls: 'x-deluge-edit-trackers',
initComponent: function() { initComponent: function() {
Deluge.EditTrackersWindow.superclass.initComponent.call(this); this.callParent(arguments);
this.addButton(_('Cancel'), this.onCancelClick, this); //this.addButton(_('Cancel'), this.onCancelClick, this);
this.addButton(_('Ok'), this.onOkClick, this); //this.addButton(_('Ok'), this.onOkClick, this);
this.addEvents('save'); this.addEvents('save');
this.on('show', this.onShow, this); this.on('show', this.onShow, this);
this.on('save', this.onSave, this);
this.addWindow = new Deluge.AddTrackerWindow(); this.addWindow = Ext.create('Deluge.AddTrackerWindow');
this.addWindow.on('add', this.onAddTrackers, this); this.addWindow.on('add', this.onAddTrackers, this);
this.editWindow = new Deluge.EditTrackerWindow(); this.editWindow = Ext.create('Deluge.EditTrackerWindow');
this.list = new Ext.list.ListView({ this.list = new Ext.list.ListView({
store: new Ext.data.JsonStore({ store: new Ext.data.JsonStore({
@ -194,6 +194,10 @@ Deluge.EditTrackersWindow = Ext.extend(Ext.Window, {
this.list.getStore().sort('tier', 'ASC'); this.list.getStore().sort('tier', 'ASC');
}, },
onSave: function() {
// What am I meant to do here?
},
onSaveFail: function() { onSaveFail: function() {
}, },

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.EventsManager.js * Deluge.EventsManager.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -37,10 +37,11 @@
* Class for holding global events that occur within the UI. * Class for holding global events that occur within the UI.
*/ */
Deluge.EventsManager = Ext.extend(Ext.util.Observable, { Deluge.EventsManager = Ext.extend(Ext.util.Observable, {
constructor: function() { constructor: function() {
this.toRegister = []; this.toRegister = [];
this.on('login', this.onLogin, this); this.on('login', this.onLogin, this);
Deluge.EventsManager.superclass.constructor.call(this); this.callParent(arguments);
}, },
/** /**
@ -55,7 +56,7 @@ Deluge.EventsManager = Ext.extend(Ext.util.Observable, {
deluge.client.web.register_event_listener(eventName); deluge.client.web.register_event_listener(eventName);
} }
} }
Deluge.EventsManager.superclass.addListener.call(this, eventName, fn, scope, o); this.callParent(arguments);
}, },
getEvents: function() { getEvents: function() {
@ -124,4 +125,3 @@ Deluge.EventsManager.prototype.on = Deluge.EventsManager.prototype.addListener
* @method * @method
*/ */
Deluge.EventsManager.prototype.fire = Deluge.EventsManager.prototype.fireEvent Deluge.EventsManager.prototype.fire = Deluge.EventsManager.prototype.fireEvent
deluge.events = new Deluge.EventsManager();

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.LoginWindow.js * Deluge.LoginWindow.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -30,7 +30,9 @@
* 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.
*/ */
Deluge.LoginWindow = Ext.extend(Ext.Window, { Ext.define('Deluge.LoginWindow', {
extend: 'Ext.Window',
firstShow: true, firstShow: true,
bodyStyle: 'padding: 10px 5px;', bodyStyle: 'padding: 10px 5px;',
@ -47,14 +49,14 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, {
height: 120, height: 120,
initComponent: function() { initComponent: function() {
Deluge.LoginWindow.superclass.initComponent.call(this); this.callParent(arguments);
this.on('show', this.onShow, this); this.on('show', this.onShow, this);
this.addButton({ // this.addButton({
text: _('Login'), // text: _('Login'),
handler: this.onLogin, // handler: this.onLogin,
scope: this // scope: this
}); // });
this.form = this.add({ this.form = this.add({
xtype: 'form', xtype: 'form',
@ -92,7 +94,7 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, {
} }
if (skipCheck) { if (skipCheck) {
return Deluge.LoginWindow.superclass.show.call(this); return this.callParent(arguments);
} }
deluge.client.auth.check_session({ deluge.client.auth.check_session({

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.MoveStorage.js * Deluge.MoveStorage.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -30,30 +30,26 @@
* 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'); Ext.define('Deluge.MoveStorage', {
Deluge.MoveStorage = Ext.extend(Ext.Window, { extend: 'Ext.Window',
constructor: function(config) { title: _('Move Storage'),
config = Ext.apply({ width: 375,
title: _('Move Storage'), height: 110,
width: 375, layout: 'fit',
height: 110, buttonAlign: 'right',
layout: 'fit', closeAction: 'hide',
buttonAlign: 'right', closable: true,
closeAction: 'hide', iconCls: 'x-deluge-move-storage',
closable: true, plain: true,
iconCls: 'x-deluge-move-storage', resizable: false,
plain: true,
resizable: false
}, config);
Deluge.MoveStorage.superclass.constructor.call(this, config);
},
initComponent: function() { initComponent: function() {
Deluge.MoveStorage.superclass.initComponent.call(this); this.callParent(arguments);
this.addButton(_('Cancel'), this.onCancel, this); // FIXME: Replace the buttons
this.addButton(_('Move'), this.onMove, this); //this.addButton(_('Cancel'), this.onCancel, this);
//this.addButton(_('Move'), this.onMove, this);
this.form = this.add({ this.form = this.add({
xtype: 'form', xtype: 'form',
@ -82,12 +78,12 @@ Deluge.MoveStorage = Ext.extend(Ext.Window, {
}, },
hide: function() { hide: function() {
Deluge.MoveStorage.superclass.hide.call(this); this.callParent(arguments);
this.torrentIds = null; this.torrentIds = null;
}, },
show: function(torrentIds) { show: function(torrentIds) {
Deluge.MoveStorage.superclass.show.call(this); this.callParent(arguments);
this.torrentIds = torrentIds; this.torrentIds = torrentIds;
}, },

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.Plugin.js * Deluge.Plugin.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,13 +29,13 @@
* 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.ns('Deluge');
/** /**
* @class Deluge.Plugin * @class Deluge.Plugin
* @extends Ext.util.Observable * @extends Ext.util.Observable
*/ */
Deluge.Plugin = Ext.extend(Ext.util.Observable, { Ext.define('Deluge.Plugin', {
extend: 'Ext.util.Observable',
/** /**
* The plugins name * The plugins name
@ -59,7 +59,7 @@ Deluge.Plugin = Ext.extend(Ext.util.Observable, {
*/ */
"disabled": true "disabled": true
}); });
Deluge.Plugin.superclass.constructor.call(this, config); this.callParent(arguments);
}, },
/** /**

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.RemoveWindow.js * Deluge.RemoveWindow.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -34,7 +34,8 @@
* @class Deluge.RemoveWindow * @class Deluge.RemoveWindow
* @extends Ext.Window * @extends Ext.Window
*/ */
Deluge.RemoveWindow = Ext.extend(Ext.Window, { Ext.define('Deluge.RemoveWindow', {
extend: 'Ext.Window',
title: _('Remove Torrent'), title: _('Remove Torrent'),
layout: 'fit', layout: 'fit',
@ -51,10 +52,11 @@ Deluge.RemoveWindow = Ext.extend(Ext.Window, {
html: 'Are you sure you wish to remove the torrent (s)?', html: 'Are you sure you wish to remove the torrent (s)?',
initComponent: function() { initComponent: function() {
Deluge.RemoveWindow.superclass.initComponent.call(this); this.callParent(arguments);
this.addButton(_('Cancel'), this.onCancel, this); // FIXME: Replace with docked toolbar
this.addButton(_('Remove With Data'), this.onRemoveData, this); //this.addButton(_('Cancel'), this.onCancel, this);
this.addButton(_('Remove Torrent'), this.onRemove, this); //this.addButton(_('Remove With Data'), this.onRemoveData, this);
//this.addButton(_('Remove Torrent'), this.onRemove, this);
}, },
remove: function(removeData) { remove: function(removeData) {
@ -71,7 +73,7 @@ Deluge.RemoveWindow = Ext.extend(Ext.Window, {
}, },
show: function(ids) { show: function(ids) {
Deluge.RemoveWindow.superclass.show.call(this); this.callParent(arguments);
this.torrentIds = ids; this.torrentIds = ids;
}, },

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.Sidebar.js * Deluge.Sidebar.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -39,7 +39,8 @@
* @author Damien Churchill <damoxc@gmail.com> * @author Damien Churchill <damoxc@gmail.com>
* @version 1.3 * @version 1.3
*/ */
Deluge.Sidebar = Ext.extend(Ext.Panel, { Ext.define('Deluge.Sidebar', {
extend: 'Ext.Panel',
// private // private
panels: {}, panels: {},
@ -61,12 +62,12 @@ Deluge.Sidebar = Ext.extend(Ext.Panel, {
margins: '5 0 0 5', margins: '5 0 0 5',
cmargins: '5 0 0 5' cmargins: '5 0 0 5'
}, config); }, config);
Deluge.Sidebar.superclass.constructor.call(this, config); this.callParent(arguments);
}, },
// private // private
initComponent: function() { initComponent: function() {
Deluge.Sidebar.superclass.initComponent.call(this); this.callParent(arguments);
deluge.events.on("disconnect", this.onDisconnect, this); deluge.events.on("disconnect", this.onDisconnect, this);
}, },

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.TorrentGrid.js * Deluge.TorrentGrid.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -30,230 +30,229 @@
* 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.
*/ */
(function() { /* Renderers for the Torrent Grid */
function queueRenderer(value) {
return (value == -1) ? '' : value + 1;
}
function torrentNameRenderer(value, p, r) {
return String.format('<div class="torrent-name x-deluge-{0}">{1}</div>', r.data['state'].toLowerCase(), value);
}
function torrentSpeedRenderer(value) {
if (!value) return;
return fspeed(value);
}
function torrentProgressRenderer(value, p, r) {
value = new Number(value);
var progress = value;
var text = r.data['state'] + ' ' + value.toFixed(2) + '%';
var width = new Number(this.style.match(/\w+:\s*(\d+)\w+/)[1]);
return Deluge.progressBar(value, width - 8, text);
}
function seedsRenderer(value, p, r) {
if (r.data['total_seeds'] > -1) {
return String.format('{0} ({1})', value, r.data['total_seeds']);
} else {
return value;
}
}
function peersRenderer(value, p, r) {
if (r.data['total_peers'] > -1) {
return String.format('{0} ({1})', value, r.data['total_peers']);
} else {
return value;
}
}
function availRenderer(value, p, r) {
return (value < 0) ? '&infin;' : new Number(value).toFixed(3);
}
function trackerRenderer(value, p, r) {
return String.format('<div style="background: url(' + deluge.config.base + 'tracker/{0}) no-repeat; padding-left: 20px;">{0}</div>', value);
}
/* Renderers for the Torrent Grid */ function etaSorter(eta) {
function queueRenderer(value) { return eta * -1;
return (value == -1) ? '' : value + 1; }
}
function torrentNameRenderer(value, p, r) { function dateOrNever(date) {
return String.format('<div class="torrent-name x-deluge-{0}">{1}</div>', r.data['state'].toLowerCase(), value); return date > 0.0 ? fdate(date) : "Never"
} }
function torrentSpeedRenderer(value) {
if (!value) return; /**
return fspeed(value); * Deluge.TorrentGrid Class
} *
function torrentProgressRenderer(value, p, r) { * @author Damien Churchill <damoxc@gmail.com>
value = new Number(value); * @version 1.3
var progress = value; *
var text = r.data['state'] + ' ' + value.toFixed(2) + '%'; * @class Deluge.TorrentGrid
var width = new Number(this.style.match(/\w+:\s*(\d+)\w+/)[1]); * @extends Ext.grid.GridPanel
return Deluge.progressBar(value, width - 8, text); * @constructor
} * @param {Object} config Configuration options
function seedsRenderer(value, p, r) { */
if (r.data['total_seeds'] > -1) { Ext.define('Deluge.TorrentGrid', {
return String.format('{0} ({1})', value, r.data['total_seeds']); extend: 'Ext.grid.Panel',
} else {
return value; // object to store contained torrent ids
torrents: {},
columns: [{
id:'queue',
header: _('#'),
width: 30,
sortable: true,
renderer: queueRenderer,
dataIndex: 'queue'
}, {
id:'name',
header: _('Name'),
width: 150,
sortable: true,
renderer: torrentNameRenderer,
dataIndex: 'name'
}, {
header: _('Size'),
width: 75,
sortable: true,
renderer: fsize,
dataIndex: 'total_size'
}, {
header: _('Progress'),
width: 150,
sortable: true,
renderer: torrentProgressRenderer,
dataIndex: 'progress'
}, {
header: _('Seeders'),
width: 60,
sortable: true,
renderer: seedsRenderer,
dataIndex: 'num_seeds'
}, {
header: _('Peers'),
width: 60,
sortable: true,
renderer: peersRenderer,
dataIndex: 'num_peers'
}, {
header: _('Down Speed'),
width: 80,
sortable: true,
renderer: torrentSpeedRenderer,
dataIndex: 'download_payload_rate'
}, {
header: _('Up Speed'),
width: 80,
sortable: true,
renderer: torrentSpeedRenderer,
dataIndex: 'upload_payload_rate'
}, {
header: _('ETA'),
width: 60,
sortable: true,
renderer: ftime,
dataIndex: 'eta'
}, {
header: _('Ratio'),
width: 60,
sortable: true,
renderer: availRenderer,
dataIndex: 'ratio'
}, {
header: _('Avail'),
width: 60,
sortable: true,
renderer: availRenderer,
dataIndex: 'distributed_copies'
}, {
header: _('Added'),
width: 80,
sortable: true,
renderer: fdate,
dataIndex: 'time_added'
}, {
header: _('Last Seen Complete'),
width: 80,
sortable: true,
renderer: dateOrNever,
dataIndex: 'last_seen_complete'
}, {
header: _('Tracker'),
width: 120,
sortable: true,
renderer: trackerRenderer,
dataIndex: 'tracker_host'
}, {
header: _('Save Path'),
width: 120,
sortable: true,
renderer: fplain,
dataIndex: 'save_path'
}, {
header: _('Owner'),
width: 80,
sortable: true,
renderer: fplain,
dataIndex: 'owner'
}, {
header: _('Public'),
width: 80,
sortable: true,
renderer: fplain,
dataIndex: 'public'
}, {
header: _('Shared'),
width: 80,
sortable: true,
renderer: fplain,
dataIndex: 'shared'
}],
meta: {
root: 'torrents',
idProperty: 'id',
fields: [
{name: 'queue', sortType: Deluge.data.SortTypes.asQueuePosition},
{name: 'name'},
{name: 'total_size', type: 'int'},
{name: 'state'},
{name: 'progress', type: 'float'},
{name: 'num_seeds', type: 'int'},
{name: 'total_seeds', type: 'int'},
{name: 'num_peers', type: 'int'},
{name: 'total_peers', type: 'int'},
{name: 'download_payload_rate', type: 'int'},
{name: 'upload_payload_speed', type: 'int'},
{name: 'eta', type: 'int', sortType: etaSorter},
{name: 'ratio', type: 'float'},
{name: 'distributed_copies', type: 'float'},
{name: 'time_added', type: 'int'},
{name: 'tracker_host'},
{name: 'save_path'}
]
},
store: Ext.create('Ext.data.Store', {
model: 'Deluge.data.TorrentRecord',
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'torrents'
}
} }
} }),
function peersRenderer(value, p, r) {
if (r.data['total_peers'] > -1) {
return String.format('{0} ({1})', value, r.data['total_peers']);
} else {
return value;
}
}
function availRenderer(value, p, r) {
return (value < 0) ? '&infin;' : new Number(value).toFixed(3);
}
function trackerRenderer(value, p, r) {
return String.format('<div style="background: url(' + deluge.config.base + 'tracker/{0}) no-repeat; padding-left: 20px;">{0}</div>', value);
}
function etaSorter(eta) { id: 'torrentGrid',
return eta * -1; region: 'center',
} cls: 'deluge-torrents',
stripeRows: true,
function dateOrNever(date) { autoExpandColumn: 'name',
return date > 0.0 ? fdate(date) : "Never" deferredRender:false,
} autoScroll:true,
margins: '5 5 0 0',
/** stateful: true,
* Deluge.TorrentGrid Class
*
* @author Damien Churchill <damoxc@gmail.com>
* @version 1.3
*
* @class Deluge.TorrentGrid
* @extends Ext.grid.GridPanel
* @constructor
* @param {Object} config Configuration options
*/
Deluge.TorrentGrid = Ext.extend(Ext.grid.GridPanel, {
// object to store contained torrent ids
torrents: {},
columns: [{
id:'queue',
header: _('#'),
width: 30,
sortable: true,
renderer: queueRenderer,
dataIndex: 'queue'
}, {
id:'name',
header: _('Name'),
width: 150,
sortable: true,
renderer: torrentNameRenderer,
dataIndex: 'name'
}, {
header: _('Size'),
width: 75,
sortable: true,
renderer: fsize,
dataIndex: 'total_size'
}, {
header: _('Progress'),
width: 150,
sortable: true,
renderer: torrentProgressRenderer,
dataIndex: 'progress'
}, {
header: _('Seeders'),
width: 60,
sortable: true,
renderer: seedsRenderer,
dataIndex: 'num_seeds'
}, {
header: _('Peers'),
width: 60,
sortable: true,
renderer: peersRenderer,
dataIndex: 'num_peers'
}, {
header: _('Down Speed'),
width: 80,
sortable: true,
renderer: torrentSpeedRenderer,
dataIndex: 'download_payload_rate'
}, {
header: _('Up Speed'),
width: 80,
sortable: true,
renderer: torrentSpeedRenderer,
dataIndex: 'upload_payload_rate'
}, {
header: _('ETA'),
width: 60,
sortable: true,
renderer: ftime,
dataIndex: 'eta'
}, {
header: _('Ratio'),
width: 60,
sortable: true,
renderer: availRenderer,
dataIndex: 'ratio'
}, {
header: _('Avail'),
width: 60,
sortable: true,
renderer: availRenderer,
dataIndex: 'distributed_copies'
}, {
header: _('Added'),
width: 80,
sortable: true,
renderer: fdate,
dataIndex: 'time_added'
}, {
header: _('Last Seen Complete'),
width: 80,
sortable: true,
renderer: dateOrNever,
dataIndex: 'last_seen_complete'
}, {
header: _('Tracker'),
width: 120,
sortable: true,
renderer: trackerRenderer,
dataIndex: 'tracker_host'
}, {
header: _('Save Path'),
width: 120,
sortable: true,
renderer: fplain,
dataIndex: 'save_path'
}, {
header: _('Owner'),
width: 80,
sortable: true,
renderer: fplain,
dataIndex: 'owner'
}, {
header: _('Public'),
width: 80,
sortable: true,
renderer: fplain,
dataIndex: 'public'
}, {
header: _('Shared'),
width: 80,
sortable: true,
renderer: fplain,
dataIndex: 'shared'
}],
meta: {
root: 'torrents',
idProperty: 'id',
fields: [
{name: 'queue', sortType: Deluge.data.SortTypes.asQueuePosition},
{name: 'name'},
{name: 'total_size', type: 'int'},
{name: 'state'},
{name: 'progress', type: 'float'},
{name: 'num_seeds', type: 'int'},
{name: 'total_seeds', type: 'int'},
{name: 'num_peers', type: 'int'},
{name: 'total_peers', type: 'int'},
{name: 'download_payload_rate', type: 'int'},
{name: 'upload_payload_speed', type: 'int'},
{name: 'eta', type: 'int', sortType: etaSorter},
{name: 'ratio', type: 'float'},
{name: 'distributed_copies', type: 'float'},
{name: 'time_added', type: 'int'},
{name: 'tracker_host'},
{name: 'save_path'}
]
},
constructor: function(config) {
config = Ext.apply({
id: 'torrentGrid',
store: new Ext.data.JsonStore(this.meta),
columns: this.columns,
region: 'center',
cls: 'deluge-torrents',
stripeRows: true,
autoExpandColumn: 'name',
deferredRender:false,
autoScroll:true,
margins: '5 5 0 0',
stateful: true,
view: new Ext.ux.grid.BufferView({
rowHeight: 26,
scrollDelay: false
})
}, config);
Deluge.TorrentGrid.superclass.constructor.call(this, config);
},
initComponent: function() { initComponent: function() {
Deluge.TorrentGrid.superclass.initComponent.call(this); this.callParent(arguments);
deluge.events.on('torrentRemoved', this.onTorrentRemoved, this); deluge.events.on('torrentRemoved', this.onTorrentRemoved, this);
deluge.events.on('disconnect', this.onDisconnect, this); deluge.events.on('disconnect', this.onDisconnect, this);
@ -378,5 +377,3 @@
}, this); }, this);
} }
}); });
deluge.torrents = new Deluge.TorrentGrid();
})();

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.UI.js * Deluge.UI.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -47,15 +47,18 @@ deluge.ui = {
* and set up various events that the UI will utilise. * and set up various events that the UI will utilise.
*/ */
initialize: function() { initialize: function() {
deluge.add = new Deluge.add.AddWindow();
deluge.details = new Deluge.details.DetailsPanel(); deluge.events = Ext.create('Deluge.EventsManager');
deluge.connectionManager = new Deluge.ConnectionManager(); deluge.add = Ext.create('Deluge.add.AddWindow');
deluge.editTrackers = new Deluge.EditTrackersWindow(); deluge.details = Ext.create('Deluge.details.DetailsPanel');
deluge.login = new Deluge.LoginWindow(); deluge.connectionManager = Ext.create('Deluge.ConnectionManager');
deluge.preferences = new Deluge.preferences.PreferencesWindow(); deluge.editTrackers = Ext.create('Deluge.EditTrackersWindow');
deluge.sidebar = new Deluge.Sidebar(); deluge.login = Ext.create('Deluge.LoginWindow');
deluge.statusbar = new Deluge.Statusbar(); deluge.preferences = Ext.create('Deluge.preferences.PreferencesWindow');
deluge.toolbar = new Deluge.Toolbar(); deluge.sidebar = Ext.create('Deluge.Sidebar');
deluge.statusbar = Ext.create('Deluge.Statusbar');
deluge.toolbar = Ext.create('Deluge.Toolbar');
deluge.torrents = Ext.create('Deluge.TorrentGrid');
this.MainPanel = new Ext.Panel({ this.MainPanel = new Ext.Panel({
id: 'mainPanel', id: 'mainPanel',
@ -98,8 +101,8 @@ deluge.ui = {
deluge.login.show(); deluge.login.show();
}, this, {single: true}); }, this, {single: true});
this.update = this.update.createDelegate(this); this.update = Ext.bind(this.update, this);
this.checkConnection = this.checkConnection.createDelegate(this); this.checkConnection = Ext.bind(this.checkConnection, this);
this.originalTitle = document.title; this.originalTitle = document.title;
}, },

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.add.AddWindow.js * Deluge.add.AddWindow.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -30,9 +30,8 @@
* 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.add'); Ext.define('Deluge.add.AddWindow', {
extend: 'Deluge.add.Window',
Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
title: _('Add Torrents'), title: _('Add Torrents'),
layout: 'border', layout: 'border',
@ -46,10 +45,10 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
iconCls: 'x-deluge-add-window-icon', iconCls: 'x-deluge-add-window-icon',
initComponent: function() { initComponent: function() {
Deluge.add.AddWindow.superclass.initComponent.call(this); this.callParent(arguments);
// FIXME: replace with docked toolbar
this.addButton(_('Cancel'), this.onCancelClick, this); //this.addButton(_('Cancel'), this.onCancelClick, this);
this.addButton(_('Add'), this.onAddClick, this); //this.addButton(_('Add'), this.onAddClick, this);
function torrentRenderer(value, p, r) { function torrentRenderer(value, p, r) {
if (r.data['info_hash']) { if (r.data['info_hash']) {

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.add.File.js * Deluge.add.File.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,13 +29,13 @@
* 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.ns('Deluge.add');
/** /**
* @class Deluge.add.FileWindow * @class Deluge.add.FileWindow
* @extends Deluge.add.Window * @extends Deluge.add.Window
*/ */
Deluge.add.FileWindow = Ext.extend(Deluge.add.Window, { Ext.define('Deluge.add.FileWindow', {
extend: 'Deluge.add.Window',
title: _('Add from File'), title: _('Add from File'),
layout: 'fit', layout: 'fit',
@ -49,7 +49,7 @@ Deluge.add.FileWindow = Ext.extend(Deluge.add.Window, {
iconCls: 'x-deluge-add-file', iconCls: 'x-deluge-add-file',
initComponent: function() { initComponent: function() {
Deluge.add.FileWindow.superclass.initComponent.call(this); this.callParent(arguments);
this.addButton(_('Add'), this.onAddClick, this); this.addButton(_('Add'), this.onAddClick, this);
this.form = this.add({ this.form = this.add({

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.add.FilesTab.js * Deluge.add.FilesTab.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,13 +29,13 @@
* 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.ns('Deluge.add');
/** /**
* @class Deluge.add.FilesTab * @class Deluge.add.FilesTab
* @extends Ext.ux.tree.TreeGrid * @extends Ext.ux.tree.TreeGrid
*/ */
Deluge.add.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { Ext.define('Deluge.add.FilesTab', {
extend: 'Ext.tree.Panel',
layout: 'fit', layout: 'fit',
title: _('Files'), title: _('Files'),
@ -71,7 +71,7 @@ Deluge.add.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, {
}], }],
initComponent: function() { initComponent: function() {
Deluge.add.FilesTab.superclass.initComponent.call(this); this.callParent(arguments);
this.on('click', this.onNodeClick, this); this.on('click', this.onNodeClick, this);
}, },

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.add.Infohash.js * Deluge.add.Infohash.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,4 +29,3 @@
* 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('Ext.deluge.add');

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.add.OptionsPanel.js * Deluge.add.OptionsPanel.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,9 +29,9 @@
* 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.ns('Deluge.add');
Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, { Ext.define('Deluge.add.OptionsPanel', {
extend: 'Ext.TabPanel',
torrents: {}, torrents: {},
@ -42,7 +42,7 @@ Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, {
height: 220, height: 220,
initComponent: function() { initComponent: function() {
Deluge.add.OptionsPanel.superclass.initComponent.call(this); this.callParent(arguments);
this.files = this.add(new Deluge.add.FilesTab()); this.files = this.add(new Deluge.add.FilesTab());
this.form = this.add(new Deluge.add.OptionsTab()); this.form = this.add(new Deluge.add.OptionsTab());

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.add.OptionsPanel.js * Deluge.add.OptionsPanel.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,13 +29,13 @@
* 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.ns('Deluge.add');
/** /**
* @class Deluge.add.OptionsTab * @class Deluge.add.OptionsTab
* @extends Ext.form.FormPanel * @extends Ext.form.FormPanel
*/ */
Deluge.add.OptionsTab = Ext.extend(Ext.form.FormPanel, { Ext.define('Deluge.add.OptionsTab', {
extend: 'Ext.form.Panel',
title: _('Options'), title: _('Options'),
height: 170, height: 170,
@ -46,7 +46,7 @@ Deluge.add.OptionsTab = Ext.extend(Ext.form.FormPanel, {
labelWidth: 1, labelWidth: 1,
initComponent: function() { initComponent: function() {
Deluge.add.OptionsTab.superclass.initComponent.call(this); this.callParent(arguments);
this.optionsManager = new Deluge.MultiOptionsManager(); this.optionsManager = new Deluge.MultiOptionsManager();

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.add.UrlWindow.js * Deluge.add.UrlWindow.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -30,8 +30,8 @@
* 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.add'); Ext.define('Deluge.add.UrlWindow', {
Deluge.add.UrlWindow = Ext.extend(Deluge.add.Window, { extend: 'Deluge.add.Window',
title: _('Add from Url'), title: _('Add from Url'),
modal: true, modal: true,
@ -46,7 +46,7 @@ Deluge.add.UrlWindow = Ext.extend(Deluge.add.Window, {
iconCls: 'x-deluge-add-url-window-icon', iconCls: 'x-deluge-add-url-window-icon',
initComponent: function() { initComponent: function() {
Deluge.add.UrlWindow.superclass.initComponent.call(this); this.callParent(arguments);
this.addButton(_('Add'), this.onAddClick, this); this.addButton(_('Add'), this.onAddClick, this);
var form = this.add({ var form = this.add({

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.add.Window.js * Deluge.add.Window.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,16 +29,17 @@
* 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.ns('Deluge.add');
/** /**
* @class Deluge.add.Window * @class Deluge.add.Window
* @extends Ext.Window * @extends Ext.Window
* Base class for an add Window * Base class for an add Window
*/ */
Deluge.add.Window = Ext.extend(Ext.Window, { Ext.define('Deluge.add.Window', {
extend: 'Ext.Window',
initComponent: function() { initComponent: function() {
Deluge.add.Window.superclass.initComponent.call(this); this.callParent(arguments);
this.addEvents( this.addEvents(
'beforeadd', 'beforeadd',
'add' 'add'

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.data.PeerRecord.js * Deluge.data.PeerRecord.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,7 +29,6 @@
* 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.data');
/** /**
* Deluge.data.Peer record * Deluge.data.Peer record
@ -38,32 +37,19 @@ Ext.namespace('Deluge.data');
* @version 1.3 * @version 1.3
* *
* @class Deluge.data.Peer * @class Deluge.data.Peer
* @extends Ext.data.Record * @extends Ext.data.Model
* @constructor * @constructor
* @param {Object} data The peer data * @param {Object} data The peer data
*/ */
Deluge.data.Peer = Ext.data.Record.create([ Ext.define('Deluge.data.Peer', {
{ extend: 'Ext.data.Model',
name: 'country', fields: [
type: 'string' {name: 'country', type: 'string'},
}, { {name: 'ip', type: 'string', sortType: Deluge.data.SortTypes.asIPAddress},
name: 'ip', {name: 'client', type: 'string'},
type: 'string', {name: 'progress', type: 'float'},
sortType: Deluge.data.SortTypes.asIPAddress {name: 'down_speed', type: 'int'},
}, { {name: 'up_speed', type: 'int'},
name: 'client', {name: 'seed', type: 'int'}
type: 'string' ]
}, { });
name: 'progress',
type: 'float'
}, {
name: 'down_speed',
type: 'int'
}, {
name: 'up_speed',
type: 'int'
}, {
name: 'seed',
type: 'int'
}
]);

View file

@ -0,0 +1,50 @@
/*!
* Deluge.data.PluginRecord.js
*
* Copyright (c) Damien Churchill 2011 <damoxc@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
*
* In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the OpenSSL
* library.
* You must obey the GNU General Public License in all respects for all of
* the code used other than OpenSSL. If you modify file(s) with this
* exception, you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete
* this exception statement from your version. If you delete this exception
* statement from all source files in the program, then also delete it here.
*/
/**
* Deluge.data.Plugin record
*
* @author Damien Churchill <damoxc@gmail.com>
* @version 1.4
*
* @class Deluge.data.Plugin
* @extends Ext.data.Model
* @constructor
* @param {Object} data The plugin data
*/
Ext.define('Deluge.data.Plugin', {
extend: 'Ext.data.Model',
fields: [
{name: 'enabled', type: 'boolean'},
{name: 'plugin', type: 'string'}
]
});

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.data.SortTypes.js * Deluge.data.SortTypes.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.data.TorrentRecord.js * Deluge.data.TorrentRecord.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,7 +29,6 @@
* 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.data');
/** /**
* Deluge.data.Torrent record * Deluge.data.Torrent record
@ -38,57 +37,28 @@ Ext.namespace('Deluge.data');
* @version 1.3 * @version 1.3
* *
* @class Deluge.data.Torrent * @class Deluge.data.Torrent
* @extends Ext.data.Record * @extends Ext.data.Model
* @constructor * @constructor
* @param {Object} data The torrents data * @param {Object} data The torrents data
*/ */
Deluge.data.Torrent = Ext.data.Record.create([{ Ext.define('Deluge.data.Torrent', {
name: 'queue', extend: 'Ext.data.Model',
type: 'int' fields: [
}, { {name: 'queue', type: 'int', sortType: Deluge.data.SortTypes.asQueuePosition},
name: 'name', {name: 'name', type: 'string'},
type: 'string' {name: 'total_size', type: 'int'},
}, { {name: 'state', type: 'string'},
name: 'total_size', {name: 'progress', type: 'int'},
type: 'int' {name: 'num_seeds', type: 'int'},
}, { {name: 'total_seeds', type: 'int'},
name: 'state', {name: 'num_peers', type: 'int'},
type: 'string' {name: 'total_peers', type: 'int'},
}, { {name: 'download_payload_rate', type: 'int'},
name: 'progress', {name: 'upload_payload_rate', type: 'int'},
type: 'int' {name: 'eta', type: 'int'},
}, { {name: 'ratio', type: 'float'},
name: 'num_seeds', {name: 'distributed_copies', type: 'float'},
type: 'int' {name: 'time_added', type: 'int'},
}, { {name: 'tracker_host', type: 'string'}
name: 'total_seeds', ]
type: 'int' });
}, {
name: 'num_peers',
type: 'int'
}, {
name: 'total_peers',
type: 'int'
}, {
name: 'download_payload_rate',
type: 'int'
}, {
name: 'upload_payload_rate',
type: 'int'
}, {
name: 'eta',
type: 'int'
}, {
name: 'ratio',
type: 'float'
}, {
name: 'distributed_copies',
type: 'float'
}, {
name: 'time_added',
type: 'int'
}, {
name: 'tracker_host',
type: 'string'
}
]);

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.details.DetailsPanel.js * Deluge.details.DetailsPanel.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,12 +29,12 @@
* 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.details');
/** /**
* @class Deluge.details.DetailsPanel * @class Deluge.details.DetailsPanel
*/ */
Deluge.details.DetailsPanel = Ext.extend(Ext.TabPanel, { Ext.define('Deluge.details.DetailsPanel', {
extend: 'Ext.tab.Panel',
region: 'south', region: 'south',
id: 'torrentDetails', id: 'torrentDetails',
@ -46,7 +46,7 @@ Deluge.details.DetailsPanel = Ext.extend(Ext.TabPanel, {
activeTab: 0, activeTab: 0,
initComponent: function() { initComponent: function() {
Deluge.details.DetailsPanel.superclass.initComponent.call(this); this.callParent(arguments);
this.add(new Deluge.details.StatusTab()); this.add(new Deluge.details.StatusTab());
this.add(new Deluge.details.DetailsTab()); this.add(new Deluge.details.DetailsTab());
this.add(new Deluge.details.FilesTab()); this.add(new Deluge.details.FilesTab());
@ -84,7 +84,7 @@ Deluge.details.DetailsPanel = Ext.extend(Ext.TabPanel, {
// We need to add the events in onRender since Deluge.Torrents hasn't // We need to add the events in onRender since Deluge.Torrents hasn't
// been created yet. // been created yet.
onRender: function(ct, position) { onRender: function(ct, position) {
Deluge.details.DetailsPanel.superclass.onRender.call(this, ct, position); this.callParent(arguments);
deluge.events.on('disconnect', this.clear, this); deluge.events.on('disconnect', this.clear, this);
deluge.torrents.on('rowclick', this.onTorrentsClick, this); deluge.torrents.on('rowclick', this.onTorrentsClick, this);
this.on('tabchange', this.onTabChange, this); this.on('tabchange', this.onTabChange, this);

View file

@ -32,17 +32,16 @@ Copyright:
*/ */
Deluge.details.DetailsTab = Ext.extend(Ext.Panel, { Ext.define('Deluge.details.DetailsTab', {
extend: 'Ext.Panel',
title: _('Details'), title: _('Details'),
fields: {}, fields: {},
queuedItems: {}, queuedItems: {},
oldData: {}, oldData: {},
initComponent: function() { initComponent: function() {
Deluge.details.DetailsTab.superclass.initComponent.call(this); this.callParent(arguments);
this.addItem('torrent_name', _('Name')); this.addItem('torrent_name', _('Name'));
this.addItem('hash', _('Hash')); this.addItem('hash', _('Hash'));
this.addItem('path', _('Path')); this.addItem('path', _('Path'));
@ -54,7 +53,7 @@ Deluge.details.DetailsTab = Ext.extend(Ext.Panel, {
}, },
onRender: function(ct, position) { onRender: function(ct, position) {
Deluge.details.DetailsTab.superclass.onRender.call(this, ct, position); this.callParent(arguments);
this.body.setStyle('padding', '10px'); this.body.setStyle('padding', '10px');
this.dl = Ext.DomHelper.append(this.body, {tag: 'dl'}, true); this.dl = Ext.DomHelper.append(this.body, {tag: 'dl'}, true);

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.details.FilesTab.js * Deluge.details.FilesTab.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -30,7 +30,18 @@
* 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.
*/ */
Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { Ext.define('Deluge.data.File', {
extend: 'Ext.data.Model',
fields: [
{name: 'filename', type: 'string'},
{name: 'size', type: 'int'},
{name: 'progress', type: 'float'}
]
});
Ext.define('Deluge.details.FilesTab', {
extend: 'Ext.tree.Panel',
title: _('Files'), title: _('Files'),
@ -45,18 +56,19 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, {
header: _('Size'), header: _('Size'),
width: 150, width: 150,
dataIndex: 'size', dataIndex: 'size',
tpl: new Ext.XTemplate('{size:this.fsize}', { tpl: Ext.create('Ext.XTemplate', '{size:this.fsize}', {
fsize: function(v) { return fsize(v); } fsize: function(v) { return fsize(v); }
}) })
}, { }, {
xtype: 'tgrendercolumn',
header: _('Progress'), header: _('Progress'),
width: 150, width: 150,
dataIndex: 'progress', dataIndex: 'progress',
renderer: function(v) { tpl: Ext.create('Ext.XTemplate', '{progress:this.progress}', {
var progress = v * 100; progress: function(v) {
return Deluge.progressBar(progress, this.col.width, progress.toFixed(2) + '%', 0); var progress = v * 100;
} return Deluge.progressBar(progress, this.col.width, progress.toFixed(2) + '%', 0);
}
})
}, { }, {
header: _('Priority'), header: _('Priority'),
width: 150, width: 150,
@ -75,12 +87,7 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, {
}) })
}], }],
selModel: new Ext.tree.MultiSelectionModel(), multiSelect: true,
initComponent: function() {
Deluge.details.FilesTab.superclass.initComponent.call(this);
this.setRootNode(new Ext.tree.TreeNode({text: 'Files'}));
},
clear: function() { clear: function() {
var root = this.getRootNode(); var root = this.getRootNode();

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.details.OptionsTab.js * Deluge.details.OptionsTab.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -30,29 +30,24 @@
* 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.define('Deluge.details.OptionsTab', {
extend: 'Ext.form.Panel',
Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, { title: _('Options'),
autoScroll: true,
constructor: function(config) { bodyStyle: 'padding: 5px;',
config = Ext.apply({ border: false,
autoScroll: true, cls: 'x-deluge-options',
bodyStyle: 'padding: 5px;', defaults: {
border: false, autoHeight: true,
cls: 'x-deluge-options', labelWidth: 1,
defaults: { defaultType: 'checkbox'
autoHeight: true,
labelWidth: 1,
defaultType: 'checkbox'
},
deferredRender: false,
layout: 'column',
title: _('Options')
}, config);
Deluge.details.OptionsTab.superclass.constructor.call(this, config);
}, },
deferredRender: false,
layout: 'column',
initComponent: function() { initComponent: function() {
Deluge.details.OptionsTab.superclass.initComponent.call(this); this.callParent(arguments);
this.fieldsets = {}, this.fields = {}; this.fieldsets = {}, this.fields = {};
this.optionsManager = new Deluge.MultiOptionsManager({ this.optionsManager = new Deluge.MultiOptionsManager({
@ -291,7 +286,7 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
autoHeight: true, autoHeight: true,
defaultType: 'checkbox', defaultType: 'checkbox',
title: _('General'), title: _('General'),
layout: 'form' layout: 'anchor'
}); });
this.fields['private'] = this.fieldsets.general.add({ this.fields['private'] = this.fieldsets.general.add({
@ -354,7 +349,7 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
}, },
onRender: function(ct, position) { onRender: function(ct, position) {
Deluge.details.OptionsTab.superclass.onRender.call(this, ct, position); this.callParent(arguments);
// This is another hack I think, so keep an eye out here when upgrading. // This is another hack I think, so keep an eye out here when upgrading.
this.layout = new Ext.layout.ColumnLayout(); this.layout = new Ext.layout.ColumnLayout();

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.details.PeersTab.js * Deluge.details.PeersTab.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -51,65 +51,60 @@
return Deluge.progressBar(progress, this.width - 8, progress + '%'); return Deluge.progressBar(progress, this.width - 8, progress + '%');
} }
Deluge.details.PeersTab = Ext.extend(Ext.grid.GridPanel, { Ext.define('Deluge.details.PeersTab', {
extend: 'Ext.grid.Panel',
title: _('Peers'),
cls: 'x-deluge-peers',
store: Ext.create('Ext.data.Store', {
model: 'Deluge.data.Peer'
}),
columns: [{
header: '&nbsp;',
width: 30,
sortable: true,
renderer: flagRenderer,
dataIndex: 'country'
}, {
header: 'Address',
width: 125,
sortable: true,
renderer: peerAddressRenderer,
dataIndex: 'ip'
}, {
header: 'Client',
width: 125,
sortable: true,
renderer: function(v) { return fplain(v) },
dataIndex: 'client'
}, {
header: 'Progress',
width: 150,
sortable: true,
renderer: peerProgressRenderer,
dataIndex: 'progress'
}, {
header: 'Down Speed',
width: 100,
sortable: true,
renderer: function(v) { return fspeed(v) },
dataIndex: 'down_speed'
}, {
header: 'Up Speed',
width: 100,
sortable: true,
renderer: function(v) { return fspeed(v) },
dataIndex: 'up_speed'
}],
stripeRows: true,
deferredRender: false,
autoScroll: true,
// fast way to figure out if we have a peer already. // fast way to figure out if we have a peer already.
peers: {}, peers: {},
constructor: function(config) {
config = Ext.apply({
title: _('Peers'),
cls: 'x-deluge-peers',
store: new Ext.data.Store({
reader: new Ext.data.JsonReader({
idProperty: 'ip',
root: 'peers'
}, Deluge.data.Peer)
}),
columns: [{
header: '&nbsp;',
width: 30,
sortable: true,
renderer: flagRenderer,
dataIndex: 'country'
}, {
header: 'Address',
width: 125,
sortable: true,
renderer: peerAddressRenderer,
dataIndex: 'ip'
}, {
header: 'Client',
width: 125,
sortable: true,
renderer: fplain,
dataIndex: 'client'
}, {
header: 'Progress',
width: 150,
sortable: true,
renderer: peerProgressRenderer,
dataIndex: 'progress'
}, {
header: 'Down Speed',
width: 100,
sortable: true,
renderer: fspeed,
dataIndex: 'down_speed'
}, {
header: 'Up Speed',
width: 100,
sortable: true,
renderer: fspeed,
dataIndex: 'up_speed'
}],
stripeRows: true,
deferredRender:false,
autoScroll:true
}, config);
Deluge.details.PeersTab.superclass.constructor.call(this, config);
},
clear: function() { clear: function() {
this.getStore().removeAll(); this.getStore().removeAll();
this.peers = {}; this.peers = {};

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.details.StatusTab.js * Deluge.details.StatusTab.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,21 +29,22 @@
* 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.ns('Deluge.details');
/** /**
* @class Deluge.details.StatusTab * @class Deluge.details.StatusTab
* @extends Ext.Panel * @extends Ext.Panel
*/ */
Deluge.details.StatusTab = Ext.extend(Ext.Panel, { Ext.define('Deluge.details.StatusTab', {
extend: 'Ext.Panel',
title: _('Status'), title: _('Status'),
autoScroll: true, autoScroll: true,
onRender: function(ct, position) { onRender: function(ct, position) {
Deluge.details.StatusTab.superclass.onRender.call(this, ct, position); this.callParent(arguments);
this.progressBar = this.add({ this.progressBar = this.add({
xtype: 'progress', xtype: 'progressbar',
cls: 'x-deluge-status-progressbar' cls: 'x-deluge-status-progressbar'
}); });
@ -53,17 +54,11 @@ Deluge.details.StatusTab = Ext.extend(Ext.Panel, {
border: false, border: false,
width: 1000, width: 1000,
listeners: { loader: {
'render': { url: deluge.config.base + 'render/tab_status.html',
fn: function(panel) { loadMask: true,
panel.load({ success: this.onPanelUpdate,
url: deluge.config.base + 'render/tab_status.html', scope: this
text: _('Loading') + '...'
});
panel.getUpdater().on('update', this.onPanelUpdate, this);
},
scope: this
}
} }
}); });
}, },

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.preferences.BandwidthPage.js * Deluge.preferences.BandwidthPage.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,25 +29,20 @@
* 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');
/** /**
* @class Deluge.preferences.Bandwidth * @class Deluge.preferences.Bandwidth
* @extends Ext.form.FormPanel * @extends Ext.form.FormPanel
*/ */
Deluge.preferences.Bandwidth = Ext.extend(Ext.form.FormPanel, { Ext.define('Deluge.preferences.Bandwidth', {
constructor: function(config) { extend: 'Ext.form.Panel',
config = Ext.apply({
border: false, border: false,
title: _('Bandwidth'), title: _('Bandwidth'),
layout: 'form', labelWidth: 10,
labelWidth: 10
}, config);
Deluge.preferences.Bandwidth.superclass.constructor.call(this, config);
},
initComponent: function() { initComponent: function() {
Deluge.preferences.Bandwidth.superclass.initComponent.call(this); this.callParent(arguments);
var om = deluge.preferences.getOptionsManager(); var om = deluge.preferences.getOptionsManager();
var fieldset = this.add({ var fieldset = this.add({

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.preferences.CachePage.js * Deluge.preferences.CachePage.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,20 +29,19 @@
* 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');
/** /**
* @class Deluge.preferences.Cache * @class Deluge.preferences.Cache
* @extends Ext.form.FormPanel * @extends Ext.form.FormPanel
*/ */
Deluge.preferences.Cache = Ext.extend(Ext.form.FormPanel, { Ext.define('Deluge.preferences.Cache', {
extend: 'Ext.form.Panel',
border: false, border: false,
title: _('Cache'), title: _('Cache'),
layout: 'form',
initComponent: function() { initComponent: function() {
Deluge.preferences.Cache.superclass.initComponent.call(this); this.callParent(arguments);
var om = deluge.preferences.getOptionsManager(); var om = deluge.preferences.getOptionsManager();

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.preferences.DaemonPage.js * Deluge.preferences.DaemonPage.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,20 +29,19 @@
* 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');
/** /**
* @class Deluge.preferences.Daemon * @class Deluge.preferences.Daemon
* @extends Ext.form.FormPanel * @extends Ext.form.FormPanel
*/ */
Deluge.preferences.Daemon = Ext.extend(Ext.form.FormPanel, { Ext.define('Deluge.preferences.Daemon', {
extend: 'Ext.form.Panel',
border: false, border: false,
title: _('Daemon'), title: _('Daemon'),
layout: 'form',
initComponent: function() { initComponent: function() {
Deluge.preferences.Daemon.superclass.initComponent.call(this); this.callParent(arguments);
var om = deluge.preferences.getOptionsManager(); var om = deluge.preferences.getOptionsManager();

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.preferences.DownloadsPage.js * Deluge.preferences.DownloadsPage.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,26 +29,21 @@
* 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');
/** /**
* @class Deluge.preferences.Downloads * @class Deluge.preferences.Downloads
* @extends Ext.form.FormPanel * @extends Ext.form.FormPanel
*/ */
Deluge.preferences.Downloads = Ext.extend(Ext.FormPanel, { Ext.define('Deluge.preferences.Downloads', {
constructor: function(config) { extend: 'Ext.form.Panel',
config = Ext.apply({ border: false,
border: false, title: _('Downloads'),
title: _('Downloads'), layout: 'anchor',
layout: 'form', autoHeight: true,
autoHeight: true, width: 320,
width: 320
}, config);
Deluge.preferences.Downloads.superclass.constructor.call(this, config);
},
initComponent: function() { initComponent: function() {
Deluge.preferences.Downloads.superclass.initComponent.call(this); this.callParent(arguments);
var optMan = deluge.preferences.getOptionsManager(); var optMan = deluge.preferences.getOptionsManager();
var fieldset = this.add({ var fieldset = this.add({

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.preferences.InterfacePage.js * Deluge.preferences.InterfacePage.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,20 +29,19 @@
* 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');
/** /**
* @class Deluge.preferences.Interface * @class Deluge.preferences.Interface
* @extends Ext.form.FormPanel * @extends Ext.form.FormPanel
*/ */
Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, { Ext.define('Deluge.preferences.Interface', {
extend: 'Ext.form.Panel',
border: false, border: false,
title: _('Interface'), title: _('Interface'),
layout: 'form',
initComponent: function() { initComponent: function() {
Deluge.preferences.Interface.superclass.initComponent.call(this); this.callParent(arguments);
var om = this.optionsManager = new Deluge.OptionsManager(); var om = this.optionsManager = new Deluge.OptionsManager();
this.on('show', this.onPageShow, this); this.on('show', this.onPageShow, this);

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.preferences.NetworkPage.js * Deluge.preferences.NetworkPage.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,20 +29,19 @@
* 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');
/** /**
* @class Deluge.preferences.Network * @class Deluge.preferences.Network
* @extends Ext.form.FormPanel * @extends Ext.form.FormPanel
*/ */
Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, { Ext.define('Deluge.preferences.Network', {
extend: 'Ext.form.Panel',
border: false, border: false,
layout: 'form',
title: _('Network'), title: _('Network'),
initComponent: function() { initComponent: function() {
Deluge.preferences.Network.superclass.initComponent.call(this); this.callParent(arguments);
var optMan = deluge.preferences.getOptionsManager(); var optMan = deluge.preferences.getOptionsManager();
var fieldset = this.add({ var fieldset = this.add({

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.preferences.OtherPage.js * Deluge.preferences.OtherPage.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,24 +29,18 @@
* 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');
/** /**
* @class Deluge.preferences.Other * @class Deluge.preferences.Other
* @extends Ext.form.FormPanel * @extends Ext.form.FormPanel
*/ */
Deluge.preferences.Other = Ext.extend(Ext.form.FormPanel, { Ext.define('Deluge.preferences.Other', {
constructor: function(config) { extend: 'Ext.form.Panel',
config = Ext.apply({ border: false,
border: false, title: _('Other'),
title: _('Other'),
layout: 'form'
}, config);
Deluge.preferences.Other.superclass.constructor.call(this, config);
},
initComponent: function() { initComponent: function() {
Deluge.preferences.Other.superclass.initComponent.call(this); this.callParent(arguments);
var optMan = deluge.preferences.getOptionsManager(); var optMan = deluge.preferences.getOptionsManager();

View file

@ -54,7 +54,7 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, {
), ),
initComponent: function() { initComponent: function() {
Deluge.preferences.Plugins.superclass.initComponent.call(this); this.callParent(arguments);
this.defaultValues = { this.defaultValues = {
'version': '', 'version': '',
'email': '', 'email': '',
@ -68,14 +68,12 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, {
return '<div class="x-grid3-check-col'+(v?'-on':'')+'"> </div>'; return '<div class="x-grid3-check-col'+(v?'-on':'')+'"> </div>';
} }
this.list = this.add({ this.grid = this.add({
xtype: 'listview', xtype: 'grid',
store: new Ext.data.ArrayStore({ store: Ext.create('Ext.data.JsonStore', {
fields: [ model: 'Deluge.data.PluginRecord'
{name: 'enabled', mapping: 0},
{name: 'plugin', mapping: 1}
]
}), }),
singleSelect: true,
columns: [{ columns: [{
id: 'enabled', id: 'enabled',
header: _('Enabled'), header: _('Enabled'),
@ -94,8 +92,6 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, {
sortable: true, sortable: true,
dataIndex: 'plugin' dataIndex: 'plugin'
}], }],
singleSelect: true,
autoExpandColumn: 'plugin',
listeners: { listeners: {
selectionchange: {fn: this.onPluginSelect, scope: this} selectionchange: {fn: this.onPluginSelect, scope: this}
} }
@ -105,7 +101,7 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, {
region: 'center', region: 'center',
autoScroll: true, autoScroll: true,
margins: '5 5 5 5', margins: '5 5 5 5',
items: [this.list], items: [this.grid],
bbar: new Ext.Toolbar({ bbar: new Ext.Toolbar({
items: [{ items: [{
cls: 'x-btn-text-icon', cls: 'x-btn-text-icon',
@ -147,7 +143,7 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, {
}); });
this.pluginInfo.on('render', this.onPluginInfoRender, this); this.pluginInfo.on('render', this.onPluginInfoRender, this);
this.list.on('click', this.onNodeClick, this); this.grid.on('click', this.onNodeClick, this);
deluge.preferences.on('show', this.onPreferencesShow, this); deluge.preferences.on('show', this.onPreferencesShow, this);
deluge.events.on('PluginDisabledEvent', this.onPluginDisabled, this); deluge.events.on('PluginDisabledEvent', this.onPluginDisabled, this);
deluge.events.on('PluginEnabledEvent', this.onPluginEnabled, this); deluge.events.on('PluginEnabledEvent', this.onPluginEnabled, this);

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.preferences.PreferencesWindow.js * Deluge.preferences.PreferencesWindow.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,15 +29,18 @@
* 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');
PreferencesRecord = Ext.data.Record.create([{name:'name', type:'string'}]); Ext.define('PreferencesRecord', {
extend: 'Ext.data.Model',
fields: [{name: 'name', type: 'string'}]
});
/** /**
* @class Deluge.preferences.PreferencesWindow * @class Deluge.preferences.PreferencesWindow
* @extends Ext.Window * @extends Ext.Window
*/ */
Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, { Ext.define('Deluge.preferences.PreferencesWindow', {
extend: 'Ext.Window',
/** /**
* @property {String} currentPage The currently selected page. * @property {String} currentPage The currently selected page.
@ -59,10 +62,12 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, {
pages: {}, pages: {},
initComponent: function() { initComponent: function() {
Deluge.preferences.PreferencesWindow.superclass.initComponent.call(this); this.callParent(arguments);
this.list = new Ext.list.ListView({ this.list = new Ext.list.ListView({
store: new Ext.data.Store(), store: Ext.create('Ext.data.Store', {
model: 'PreferencesRecord'
}),
columns: [{ columns: [{
id: 'name', id: 'name',
renderer: fplain, renderer: fplain,
@ -103,9 +108,9 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, {
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.on('afterrender', this.onAfterRender, this); this.on('afterrender', this.onAfterRender, this);

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.preferences.ProxyPage.js * Deluge.preferences.ProxyPage.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,24 +29,19 @@
* 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');
/** /**
* @class Deluge.preferences.Proxy * @class Deluge.preferences.Proxy
* @extends Ext.form.FormPanel * @extends Ext.form.FormPanel
*/ */
Deluge.preferences.Proxy = Ext.extend(Ext.form.FormPanel, { Ext.define('Deluge.preferences.Proxy', {
constructor: function(config) { extend: 'Ext.form.Panel',
config = Ext.apply({
border: false, border: false,
title: _('Proxy'), title: _('Proxy'),
layout: 'form'
}, config);
Deluge.preferences.Proxy.superclass.constructor.call(this, config);
},
initComponent: function() { initComponent: function() {
Deluge.preferences.Proxy.superclass.initComponent.call(this); this.callParent(arguments);
this.peer = this.add(new Deluge.preferences.ProxyField({ this.peer = this.add(new Deluge.preferences.ProxyField({
title: _('Peer'), title: _('Peer'),
name: 'peer' name: 'peer'

View file

@ -1,7 +1,7 @@
/*! /*!
* Deluge.preferences.QueuePage.js * Deluge.preferences.QueuePage.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2011 <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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,20 +29,19 @@
* 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');
/** /**
* @class Deluge.preferences.Queue * @class Deluge.preferences.Queue
* @extends Ext.form.FormPanel * @extends Ext.form.FormPanel
*/ */
Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, { Ext.define('Deluge.preferences.Queue', {
extend: 'Ext.form.Panel',
border: false, border: false,
title: _('Queue'), title: _('Queue'),
layout: 'form',
initComponent: function() { initComponent: function() {
Deluge.preferences.Queue.superclass.initComponent.call(this); this.callParent(arguments);
var om = deluge.preferences.getOptionsManager(); var om = deluge.preferences.getOptionsManager();

View file

@ -427,7 +427,7 @@ class TopLevel(resource.Resource):
__stylesheets = [ __stylesheets = [
"resources/css/ext-all-gray.css", "resources/css/ext-all-gray.css",
# "css/ext-extensions.css", # "css/ext-extensions.css",
# "css/deluge.css" "css/deluge.css"
] ]
def __init__(self): def __init__(self):