Build deluge-all.js

This commit is contained in:
Calum Lind 2011-12-07 00:54:10 +00:00
commit 75b9fd5cb4
2 changed files with 6722 additions and 6619 deletions

View file

@ -419,7 +419,7 @@ Deluge.details.DetailsTab = Ext.extend(Ext.Panel, {
path: torrent.save_path, path: torrent.save_path,
size: fsize(torrent.total_size), size: fsize(torrent.total_size),
files: torrent.num_files, files: torrent.num_files,
status: torrent.tracker_status, status: torrent.message,
tracker: torrent.tracker, tracker: torrent.tracker,
comment: torrent.comment comment: torrent.comment
}; };
@ -727,7 +727,8 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
'stop_at_ratio': false, 'stop_at_ratio': false,
'stop_ratio': 2.0, 'stop_ratio': 2.0,
'remove_at_ratio': false, 'remove_at_ratio': false,
'move_completed': null, 'move_completed': false,
'move_completed_path': '',
'private': false, 'private': false,
'prioritize_first_last': false 'prioritize_first_last': false
} }
@ -921,7 +922,19 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
labelSeparator: '', labelSeparator: '',
id: 'move_completed', id: 'move_completed',
boxLabel: _('Move Completed'), boxLabel: _('Move Completed'),
colspan: 2 colspan: 2,
handler: this.onMoveCompletedChecked,
scope: this
});
this.fields.move_completed_path = this.fieldsets.queue.add({
xtype: 'textfield',
fieldLabel: '',
id: 'move_completed_path',
colspan: 3,
bodyStyle: 'margin-left: 20px',
width: 180,
disabled: true
}); });
@ -1059,6 +1072,13 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
deluge.editTrackers.show(); deluge.editTrackers.show();
}, },
onMoveCompletedChecked: function(checkbox, checked) {
this.fields.move_completed_path.setDisabled(!checked);
if (!checked) return;
this.fields.move_completed_path.focus();
},
onStopRatioChecked: function(checkbox, checked) { onStopRatioChecked: function(checkbox, checked) {
this.fields.remove_at_ratio.setDisabled(!checked); this.fields.remove_at_ratio.setDisabled(!checked);
this.fields.stop_ratio.setDisabled(!checked); this.fields.stop_ratio.setDisabled(!checked);
@ -1073,6 +1093,7 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
var stop_at_ratio = this.optionsManager.get('stop_at_ratio'); var stop_at_ratio = this.optionsManager.get('stop_at_ratio');
this.fields.remove_at_ratio.setDisabled(!stop_at_ratio); this.fields.remove_at_ratio.setDisabled(!stop_at_ratio);
this.fields.stop_ratio.setDisabled(!stop_at_ratio); this.fields.stop_ratio.setDisabled(!stop_at_ratio);
this.fields.move_completed_path.setDisabled(!this.optionsManager.get('move_completed'));
} }
}); });
/*! /*!
@ -1109,11 +1130,18 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
(function() { (function() {
function flagRenderer(value) { function flagRenderer(value) {
if (!value) return ''; if (!value.replace(' ', '').replace(' ', '')){
return '';
}
return String.format('<img src="flag/{0}" />', value); return String.format('<img src="flag/{0}" />', value);
} }
function peerAddressRenderer(value, p, record) { function peerAddressRenderer(value, p, record) {
var seed = (record.data['seed'] == 1024) ? 'x-deluge-seed' : 'x-deluge-peer' var seed = (record.data['seed'] == 1024) ? 'x-deluge-seed' : 'x-deluge-peer';
if (peer_ip.length > 2) {
var port = peer_ip.pop();
var ip = peer_ip.join(":");
value = "[" + ip + "]:" + port;
}
return String.format('<div class="{0}">{1}</div>', seed, value); return String.format('<div class="{0}">{1}</div>', seed, value);
} }
function peerProgressRenderer(value) { function peerProgressRenderer(value) {
@ -1202,6 +1230,14 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
// Go through the peers updating and creating peer records // Go through the peers updating and creating peer records
Ext.each(torrent.peers, function(peer) { Ext.each(torrent.peers, function(peer) {
if (this.peers[peer.ip]) { if (this.peers[peer.ip]) {
var record = store.getById(peer.ip);
record.beginEdit();
for (var k in peer) {
if (record.get(k) != peer[k]) {
record.set(k, peer[k]);
}
}
record.endEdit();
} else { } else {
this.peers[peer.ip] = 1; this.peers[peer.ip] = 1;
newPeers.push(new Deluge.data.Peer(peer, peer.ip)); newPeers.push(new Deluge.data.Peer(peer, peer.ip));
@ -1318,8 +1354,9 @@ Deluge.details.StatusTab = Ext.extend(Ext.Panel, {
}, },
onRequestComplete: function(status) { onRequestComplete: function(status) {
seeders = status.total_seeds > -1 ? status.num_seeds + ' (' + status.total_seeds + ')' : status.num_seeds seeders = status.total_seeds > -1 ? status.num_seeds + ' (' + status.total_seeds + ')' : status.num_seeds;
peers = status.total_peers > -1 ? status.num_peers + ' (' + status.total_peers + ')' : status.num_peers peers = status.total_peers > -1 ? status.num_peers + ' (' + status.total_peers + ')' : status.num_peers;
last_seen_complete = status.last_seen_complete > 0.0 ? fdate(status.last_seen_complete) : "Never";
var data = { var data = {
downloaded: fsize(status.total_done, true), downloaded: fsize(status.total_done, true),
uploaded: fsize(status.total_uploaded, true), uploaded: fsize(status.total_uploaded, true),
@ -1336,12 +1373,13 @@ Deluge.details.StatusTab = Ext.extend(Ext.Panel, {
active_time: ftime(status.active_time), active_time: ftime(status.active_time),
seeding_time: ftime(status.seeding_time), seeding_time: ftime(status.seeding_time),
seed_rank: status.seed_rank, seed_rank: status.seed_rank,
time_added: fdate(status.time_added) time_added: fdate(status.time_added),
last_seen_complete: last_seen_complete
} }
data.auto_managed = _((status.is_auto_managed) ? 'True' : 'False'); data.auto_managed = _((status.is_auto_managed) ? 'True' : 'False');
data.downloaded += ' (' + ((status.total_payload_download) ? fsize(status.total_payload_download) : '0.0 KiB') + ')'; data.downloaded += ' (' + ((status.total_payload_download) ? fsize(status.total_payload_download) : '0.0 KiB') + ')';
data.uploaded += ' (' + ((status.total_payload_download) ? fsize(status.total_payload_download): '0.0 KiB') + ')'; data.uploaded += ' (' + ((status.total_payload_upload) ? fsize(status.total_payload_upload): '0.0 KiB') + ')';
for (var field in this.fields) { for (var field in this.fields) {
this.fields[field].innerHTML = data[field]; this.fields[field].innerHTML = data[field];
@ -2299,7 +2337,7 @@ Deluge.add.UrlWindow = Ext.extend(Deluge.add.Window, {
fieldLabel: _('Url'), fieldLabel: _('Url'),
id: 'url', id: 'url',
name: 'url', name: 'url',
anchor: '100%' width: '97%'
}); });
this.urlField.on('specialkey', this.onAdd, this); this.urlField.on('specialkey', this.onAdd, this);
@ -2307,7 +2345,7 @@ Deluge.add.UrlWindow = Ext.extend(Deluge.add.Window, {
fieldLabel: _('Cookies'), fieldLabel: _('Cookies'),
id: 'cookies', id: 'cookies',
name: 'cookies', name: 'cookies',
anchor: '100%' width: '97%'
}); });
this.cookieField.on('specialkey', this.onAdd, this); this.cookieField.on('specialkey', this.onAdd, this);
}, },
@ -2576,7 +2614,7 @@ Deluge.preferences.Cache = Ext.extend(Ext.form.FormPanel, {
defaults: { defaults: {
decimalPrecision: 0, decimalPrecision: 0,
minValue: -1, minValue: -1,
maxValue: 99999 maxValue: 999999
} }
}); });
om.bind('cache_size', fieldset.add({ om.bind('cache_size', fieldset.add({
@ -3903,6 +3941,7 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, {
}, },
onPluginSelect: function(dv, selections) { onPluginSelect: function(dv, selections) {
if (selections.length == 0) return;
var r = dv.getRecords(selections)[0]; var r = dv.getRecords(selections)[0];
deluge.client.web.get_plugin_info(r.get('plugin'), { deluge.client.web.get_plugin_info(r.get('plugin'), {
success: this.onGotPluginInfo, success: this.onGotPluginInfo,
@ -4527,10 +4566,17 @@ Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, {
om.bind('dont_count_slow_torrents', fieldset.add({ om.bind('dont_count_slow_torrents', fieldset.add({
xtype: 'checkbox', xtype: 'checkbox',
name: 'dont_count_slow_torrents', name: 'dont_count_slow_torrents',
height: 40, height: 22,
hideLabel: true, hideLabel: true,
boxLabel: _('Do not count slow torrents') boxLabel: _('Do not count slow torrents')
})); }));
om.bind('auto_manage_prefer_seeds', fieldset.add({
xtype: 'checkbox',
name: 'auto_manage_prefer_seeds',
height: 40,
hideLabel: true,
boxLabel: _('Prefer Seeding over Downloading')
}));
fieldset = this.add({ fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
@ -5758,6 +5804,7 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
} }
}, },
// FIXME: Find out why this is being fired twice
// private // private
onShow: function() { onShow: function() {
if (!this.addHostButton) { if (!this.addHostButton) {
@ -5767,6 +5814,7 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
this.stopHostButton = bbar.items.get('cm-stop'); this.stopHostButton = bbar.items.get('cm-stop');
} }
this.loadHosts(); this.loadHosts();
if (this.running) return;
this.running = window.setInterval(this.update, 2000, this); this.running = window.setInterval(this.update, 2000, this);
}, },
@ -5845,7 +5893,7 @@ Ext.apply(Ext, {
return true; return true;
}, },
isObjectsEqual: function(obj1, obj2) { areObjectsEqual: function(obj1, obj2) {
var equal = true; var equal = true;
if (!obj1 || !obj2) return false; if (!obj1 || !obj2) return false;
for (var i in obj1) { for (var i in obj1) {
@ -5961,12 +6009,13 @@ FILE_PRIORITY = {
0: 'Do Not Download', 0: 'Do Not Download',
1: 'Normal Priority', 1: 'Normal Priority',
2: 'High Priority', 2: 'High Priority',
5: 'Highest Priority', 5: 'High Priority',
7: 'Highest Priority',
'Mixed': 9, 'Mixed': 9,
'Do Not Download': 0, 'Do Not Download': 0,
'Normal Priority': 1, 'Normal Priority': 1,
'High Priority': 2, 'High Priority': 5,
'Highest Priority': 5 'Highest Priority': 7
} }
FILE_PRIORITY_CSS = { FILE_PRIORITY_CSS = {
@ -5974,7 +6023,8 @@ FILE_PRIORITY_CSS = {
0: 'x-no-download', 0: 'x-no-download',
1: 'x-normal-download', 1: 'x-normal-download',
2: 'x-high-download', 2: 'x-high-download',
5: 'x-highest-download' 5: 'x-high-download',
7: 'x-highest-download'
} }
/*! /*!
* Deluge.EditTrackerWindow.js * Deluge.EditTrackerWindow.js
@ -6115,7 +6165,7 @@ Deluge.EditTrackersWindow = Ext.extend(Ext.Window, {
height: 220, height: 220,
plain: true, plain: true,
closable: true, closable: true,
resizable: false, resizable: true,
bodyStyle: 'padding: 5px', bodyStyle: 'padding: 5px',
buttonAlign: 'right', buttonAlign: 'right',
@ -6158,7 +6208,6 @@ Deluge.EditTrackersWindow = Ext.extend(Ext.Window, {
}, },
stripeRows: true, stripeRows: true,
singleSelect: true, singleSelect: true,
autoScroll: true,
listeners: { listeners: {
'dblclick': {fn: this.onListNodeDblClicked, scope: this}, 'dblclick': {fn: this.onListNodeDblClicked, scope: this},
'selectionchange': {fn: this.onSelect, scope: this} 'selectionchange': {fn: this.onSelect, scope: this}
@ -6168,6 +6217,7 @@ Deluge.EditTrackersWindow = Ext.extend(Ext.Window, {
this.panel = this.add({ this.panel = this.add({
margins: '0 0 0 0', margins: '0 0 0 0',
items: [this.list], items: [this.list],
autoScroll: true,
bbar: new Ext.Toolbar({ bbar: new Ext.Toolbar({
items: [ items: [
{ {
@ -6288,17 +6338,25 @@ Deluge.EditTrackersWindow = Ext.extend(Ext.Window, {
onDownClick: function() { onDownClick: function() {
var r = this.list.getSelectedRecords()[0]; var r = this.list.getSelectedRecords()[0];
if (!r) return;
r.set('tier', r.get('tier') + 1); r.set('tier', r.get('tier') + 1);
r.commit();
r.store.sort('tier', 'ASC'); r.store.sort('tier', 'ASC');
r.store.commitChanges();
this.list.select(r.store.indexOf(r));
}, },
onUpClick: function() { onUpClick: function() {
var r = this.list.getSelectedRecords()[0]; var r = this.list.getSelectedRecords()[0];
if (!r) return;
if (r.get('tier') == 0) return; if (r.get('tier') == 0) return;
r.set('tier', r.get('tier') - 1); r.set('tier', r.get('tier') - 1);
r.commit();
r.store.sort('tier', 'ASC'); r.store.sort('tier', 'ASC');
r.store.commitChanges();
this.list.select(r.store.indexOf(r));
} }
}); });
/*! /*!
@ -6529,6 +6587,8 @@ Ext.ns('Deluge');
*/ */
Deluge.FilterPanel = Ext.extend(Ext.Panel, { Deluge.FilterPanel = Ext.extend(Ext.Panel, {
autoScroll: true,
border: false, border: false,
show_zero: null, show_zero: null,
@ -6864,7 +6924,7 @@ Deluge.Keys = {
'queue', 'name', 'total_size', 'state', 'progress', 'num_seeds', 'queue', 'name', 'total_size', 'state', 'progress', 'num_seeds',
'total_seeds', 'num_peers', 'total_peers', 'download_payload_rate', 'total_seeds', 'num_peers', 'total_peers', 'download_payload_rate',
'upload_payload_rate', 'eta', 'ratio', 'distributed_copies', 'upload_payload_rate', 'eta', 'ratio', 'distributed_copies',
'is_auto_managed', 'time_added', 'tracker_host', 'save_path' 'is_auto_managed', 'time_added', 'tracker_host', 'save_path', 'last_seen_complete'
], ],
/** /**
@ -6879,7 +6939,7 @@ Deluge.Keys = {
'total_done', 'total_payload_download', 'total_uploaded', 'total_done', 'total_payload_download', 'total_uploaded',
'total_payload_upload', 'next_announce', 'tracker_status', 'num_pieces', 'total_payload_upload', 'next_announce', 'tracker_status', 'num_pieces',
'piece_length', 'is_auto_managed', 'active_time', 'seeding_time', 'piece_length', 'is_auto_managed', 'active_time', 'seeding_time',
'seed_rank' 'seed_rank', 'last_seen_complete', 'owner', 'public', 'shared'
], ],
/** /**
@ -6902,7 +6962,7 @@ Deluge.Keys = {
* Keys used in the details tab of the statistics panel. * Keys used in the details tab of the statistics panel.
*/ */
Details: [ Details: [
'name', 'save_path', 'total_size', 'num_files', 'tracker_status', 'name', 'save_path', 'total_size', 'num_files', 'message',
'tracker', 'comment' 'tracker', 'comment'
], ],
@ -6915,7 +6975,8 @@ Deluge.Keys = {
Options: [ Options: [
'max_download_speed', 'max_upload_speed', 'max_connections', 'max_download_speed', 'max_upload_speed', 'max_connections',
'max_upload_slots','is_auto_managed', 'stop_at_ratio', 'stop_ratio', 'max_upload_slots','is_auto_managed', 'stop_at_ratio', 'stop_ratio',
'remove_at_ratio', 'private', 'prioritize_first_last' 'remove_at_ratio', 'private', 'prioritize_first_last',
'move_completed', 'move_completed_path'
] ]
}; };
@ -7329,22 +7390,22 @@ deluge.menus.filePriorities = new Ext.menu.Menu({
id: 'no_download', id: 'no_download',
text: _('Do Not Download'), text: _('Do Not Download'),
iconCls: 'icon-do-not-download', iconCls: 'icon-do-not-download',
filePriority: 0 filePriority: FILE_PRIORITY['Do Not Download']
}, { }, {
id: 'normal', id: 'normal',
text: _('Normal Priority'), text: _('Normal Priority'),
iconCls: 'icon-normal', iconCls: 'icon-normal',
filePriority: 1 filePriority: FILE_PRIORITY['Normal Priority']
}, { }, {
id: 'high', id: 'high',
text: _('High Priority'), text: _('High Priority'),
iconCls: 'icon-high', iconCls: 'icon-high',
filePriority: 2 filePriority: FILE_PRIORITY['High Priority']
}, { }, {
id: 'highest', id: 'highest',
text: _('Highest Priority'), text: _('Highest Priority'),
iconCls: 'icon-highest', iconCls: 'icon-highest',
filePriority: 5 filePriority: FILE_PRIORITY['Highest Priority']
}] }]
}); });
/*! /*!
@ -8736,6 +8797,10 @@ Deluge.Toolbar = Ext.extend(Ext.Toolbar, {
return eta * -1; return eta * -1;
} }
function dateOrNever(date) {
return date > 0.0 ? fdate(date) : "Never"
}
/** /**
* Deluge.TorrentGrid Class * Deluge.TorrentGrid Class
* *
@ -8826,6 +8891,12 @@ Deluge.Toolbar = Ext.extend(Ext.Toolbar, {
sortable: true, sortable: true,
renderer: fdate, renderer: fdate,
dataIndex: 'time_added' dataIndex: 'time_added'
}, {
header: _('Last Seen Complete'),
width: 80,
sortable: true,
renderer: dateOrNever,
dataIndex: 'last_seen_complete'
}, { }, {
header: _('Tracker'), header: _('Tracker'),
width: 120, width: 120,
@ -8838,6 +8909,24 @@ Deluge.Toolbar = Ext.extend(Ext.Toolbar, {
sortable: true, sortable: true,
renderer: fplain, renderer: fplain,
dataIndex: 'save_path' 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: { meta: {
@ -8945,8 +9034,15 @@ Deluge.Toolbar = Ext.extend(Ext.Toolbar, {
return ids; return ids;
}, },
update: function(torrents) { update: function(torrents, wipe) {
var store = this.getStore(); var store = this.getStore();
// Need to perform a complete reload of the torrent grid.
if (wipe) {
store.removeAll();
this.torrents = {};
}
var newTorrents = []; var newTorrents = [];
// Update and add any new torrents. // Update and add any new torrents.
@ -9122,6 +9218,9 @@ deluge.ui = {
update: function() { update: function() {
var filters = deluge.sidebar.getFilterStates(); var filters = deluge.sidebar.getFilterStates();
this.oldFilters = this.filters;
this.filters = filters;
deluge.client.web.update_ui(Deluge.Keys.Grid, filters, { deluge.client.web.update_ui(Deluge.Keys.Grid, filters, {
success: this.onUpdate, success: this.onUpdate,
failure: this.onUpdateError, failure: this.onUpdateError,
@ -9178,7 +9277,11 @@ deluge.ui = {
' (Down: ' + fspeed(data['stats'].download_rate, true) + ' (Down: ' + fspeed(data['stats'].download_rate, true) +
' Up: ' + fspeed(data['stats'].upload_rate, true) + ')'; ' Up: ' + fspeed(data['stats'].upload_rate, true) + ')';
} }
if (Ext.areObjectsEqual(this.filters, this.oldFilters)) {
deluge.torrents.update(data['torrents']); deluge.torrents.update(data['torrents']);
} else {
deluge.torrents.update(data['torrents'], true);
}
deluge.statusbar.update(data['stats']); deluge.statusbar.update(data['stats']);
deluge.sidebar.update(data['filters']); deluge.sidebar.update(data['filters']);
this.errorCount = 0; this.errorCount = 0;
@ -9233,7 +9336,7 @@ deluge.ui = {
var scripts = (Deluge.debug) ? resources.debug_scripts : resources.scripts; var scripts = (Deluge.debug) ? resources.debug_scripts : resources.scripts;
Ext.each(scripts, function(script) { Ext.each(scripts, function(script) {
Ext.ux.JSLoader({ Ext.ux.JSLoader({
url: script, url: deluge.config.base + script,
onLoad: this.onPluginLoaded, onLoad: this.onPluginLoaded,
pluginName: resources.name pluginName: resources.name
}); });

File diff suppressed because one or more lines are too long