update the copyright header year for all the js files

implement a new update method that will be compatible with the torrent status deltas
add a new script containing a record for a Torrent
This commit is contained in:
Damien Churchill 2010-02-10 22:15:29 +00:00
parent 0e9a691954
commit eef9d8ec13
43 changed files with 187 additions and 47 deletions

View File

@ -38,5 +38,6 @@ add_file "Deluge.Remove.js"
add_file "Deluge.Sidebar.js"
add_file "Deluge.Statusbar.js"
add_file "Deluge.Toolbar.js"
add_file "Deluge.Torrent.js"
add_file "Deluge.Torrents.js"
add_file "Deluge.UI.js"

View File

@ -3,7 +3,7 @@ Script: Deluge.Add.File.js
Contains the Add Torrent by file window.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: Deluge.Add.Infohash.js
Contains the Add Torrent by infohash window.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: Deluge.Add.Url.js
Contains the Add Torrent by url window.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: Deluge.Add.js
Contains the Add Torrent window.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: Deluge.Client.js
A JSON-RPC proxy built on top of ext-core.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: deluge-connections.js
Contains all objects and functions related to the connection manager.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: Deluge.Details.Details.js
The details tab displayed in the details panel.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: Deluge.Details.Files.js
The files tab displayed in the details panel.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: Deluge.Details.Options.js
The options tab displayed in the details panel.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: Deluge.Details.Peers.js
The peers tab displayed in the details panel.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: Deluge.Details.Status.js
The status tab displayed in the details panel.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -4,7 +4,7 @@ Script: Deluge.Details.js
it's containing tabs.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: Deluge.EditTrackers.js
Contains the edit trackers window.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: Deluge.Events.js
Class for holding global events that occur within the UI.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script:
Deluge.Formatters.js
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: Deluge.Keys.js
The torrent status keys that are commonly used around the UI.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: Deluge.Login.js
Contains all objects and functions related to the login system.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: deluge-menus.js
Contains all the menus contained within the UI for easy access and editing.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: Deluge.MoveStorage.js
Contains the move storage window.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script:
Deluge.MultiOptionsManager.js
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script:
Deluge.OptionsManager.js
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: Deluge.Plugin.js
Contains a base class for plugins to extend.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: Deluge.Preferences.Bandwidth.js
The bandwidth preferences page.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: Deluge.Preferences.Cache.js
The cache preferences page.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: Deluge.Preferences.Daemon.js
The daemon preferences page.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: Deluge.Preferences.Downloads.js
The downloads preferences page.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: Deluge.Preferences.Encryption.js
The encryption preferences page.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: Deluge.Preferences.Interface.js
The interface preferences page.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: Deluge.Preferences.Network.js
The network preferences page.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: Deluge.Preferences.Other.js
The other preferences page.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: Deluge.Preferences.Plugins.js
The plugins preferences page.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: Deluge.Preferences.Proxy.js
The proxy preferences page.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: Deluge.Preferences.Queue.js
The queue preferences page.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: Deluge.Preferences.js
Contains the preferences window.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script:
Deluge.Remove.js
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -4,7 +4,7 @@ Script: deluge-bars.js
sidebar.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -3,7 +3,7 @@ Script: Deluge.Toolbar.js
Contains the Deluge toolbar.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)

View File

@ -0,0 +1,94 @@
/*
Script: Deluge.Torrent.js
Contains the Deluge.Torrent record.
Copyright:
(C) Damien Churchill 2009-2010 <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.Torrent record
*
* @author Damien Churchill <damoxc@gmail.com>
* @version 1.3
*
* @class Deluge.Torrent
* @extends Ext.data.Record
* @constructor
* @param {Object} data The torrents data
*/
Deluge.Torrent = Ext.data.Record.create([{
name: 'queue',
type: 'int'
}, {
name: 'name',
type: 'string'
}, {
name: 'total_size',
type: 'int'
}, {
name: 'state',
type: 'string'
}, {
name: 'progress',
type: 'int'
}, {
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_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

@ -3,7 +3,7 @@ Script: Deluge.Torrents.js
Contains all objects and functions related to the torrent grid.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)
@ -33,6 +33,7 @@ Copyright:
*/
(function() {
/* Renderers for the Torrent Grid */
function queueRenderer(value) {
return (value == 99999) ? '' : value + 1;
@ -88,6 +89,10 @@ Copyright:
* @param {Object} config Configuration options
*/
Ext.deluge.TorrentGrid = Ext.extend(Ext.grid.GridPanel, {
// object to store contained torrent ids
torrents: {},
constructor: function(config) {
config = Ext.apply({
id: 'torrentGrid',
@ -236,7 +241,7 @@ Copyright:
},
/**
* Returns the currently selected records.
* Returns the currently selected record.
* @ return {Array/Ext.data.Record} The record(s) representing the rows
*/
getSelected: function() {
@ -248,12 +253,38 @@ Copyright:
},
update: function(torrents) {
// NOTE: this isn't published in the API docs so may disappear unexpectedly
// when upgrading Ext Js.
var scroller = this.getView().scroller.dom;
var scrollTop = scroller.scrollTop;
this.getStore().loadData({"torrents": Ext.values(torrents)});
scroller.scrollTop = scrollTop;
var store = this.getStore();
var newTorrents = [];
// Update and add any new torrents.
for (var t in torrents) {
var torrent = torrents[t];
if (this.torrents[t]) {
var record = store.getById(t);
record.beginEdit();
for (var k in torrent) {
if (record.get(k) != torrent[k]) {
record.set(k, torrent[k]);
}
}
record.endEdit();
} else {
var record = new Deluge.Torrent(torrent);
record.id = t;
this.torrents[t] = 1;
newTorrents.push(record);
}
}
store.add(newTorrents);
// Remove any torrents that should not be in the store.
store.each(function(record) {
if (!torrents[record.id]) {
store.remove(record);
}
});
store.commitChanges();
},
// private

View File

@ -4,7 +4,7 @@ Script: Deluge.UI.js
of the server.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)
@ -42,6 +42,8 @@ Deluge.UI = {
errorCount: 0,
filters: null,
/**
* @description Create all the interface components, the json-rpc client
* and set up various events that the UI will utilise.

View File

@ -3,7 +3,7 @@ Script: Deluge.js
Contains the keys for get_torrent(s)_status.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
(C) Damien Churchill 2009-2010 <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)
@ -48,6 +48,17 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
for(var i in obj) { return false; }
return true;
},
isObjectsEqual: function(obj1, obj2) {
var equal = true;
if (!obj1 || !obj2) return false;
for (var i in obj1) {
if (obj1[i] != obj2[i]) {
equal = false;
}
}
return equal;
},
keys: function(obj) {
var keys = [];

View File

@ -374,6 +374,7 @@ class TopLevel(resource.Resource):
"/js/deluge-all/Deluge.Sidebar.js",
"/js/deluge-all/Deluge.Statusbar.js",
"/js/deluge-all/Deluge.Toolbar.js",
"/js/deluge-all/Deluge.Torrent.js",
"/js/deluge-all/Deluge.Torrents.js",
"/js/deluge-all/Deluge.UI.js"
]