mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-05 08:03:40 +00:00
Build compressed javascript for deluge-all
This commit is contained in:
parent
ea75828f25
commit
3744bdad69
@ -1438,7 +1438,7 @@ Deluge.add.Window = Ext.extend(Ext.Window, {
|
||||
});
|
||||
/*!
|
||||
* Deluge.add.AddWindow.js
|
||||
*
|
||||
*
|
||||
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -1488,7 +1488,7 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
|
||||
|
||||
this.addButton(_('Cancel'), this.onCancelClick, this);
|
||||
this.addButton(_('Add'), this.onAddClick, this);
|
||||
|
||||
|
||||
function torrentRenderer(value, p, r) {
|
||||
if (r.data['info_hash']) {
|
||||
return String.format('<div class="x-deluge-add-torrent-name">{0}</div>', value);
|
||||
@ -1511,7 +1511,7 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
|
||||
sortable: true,
|
||||
renderer: torrentRenderer,
|
||||
dataIndex: 'text'
|
||||
}],
|
||||
}],
|
||||
stripeRows: true,
|
||||
singleSelect: true,
|
||||
listeners: {
|
||||
@ -1552,7 +1552,7 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
|
||||
}]
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
this.optionsPanel = this.add(new Deluge.add.OptionsPanel());
|
||||
this.on('hide', this.onHide, this);
|
||||
this.on('show', this.onShow, this);
|
||||
@ -1603,16 +1603,14 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
|
||||
var torrent = this.list.getSelectedRecords()[0];
|
||||
this.list.getStore().remove(torrent);
|
||||
this.optionsPanel.clear();
|
||||
|
||||
|
||||
if (this.torrents && this.torrents[torrent.id]) delete this.torrents[torrent.id];
|
||||
},
|
||||
|
||||
onSelect: function(list, selections) {
|
||||
if (selections.length) {
|
||||
if (selections.length) {
|
||||
var record = this.list.getRecord(selections[0]);
|
||||
this.optionsPanel.setTorrent(record.get('info_hash'));
|
||||
this.optionsPanel.files.setDisabled(false);
|
||||
this.optionsPanel.form.setDisabled(false);
|
||||
} else {
|
||||
this.optionsPanel.files.setDisabled(true);
|
||||
this.optionsPanel.form.setDisabled(true);
|
||||
@ -1631,7 +1629,7 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
|
||||
this.file.on('beforeadd', this.onTorrentBeforeAdd, this);
|
||||
this.file.on('add', this.onTorrentAdd, this);
|
||||
}
|
||||
|
||||
|
||||
this.optionsPanel.form.getDefaults();
|
||||
},
|
||||
|
||||
@ -1657,6 +1655,7 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
|
||||
r.set('text', info['name']);
|
||||
this.list.getStore().commitChanges();
|
||||
this.optionsPanel.addTorrent(info);
|
||||
this.list.select(r);
|
||||
}
|
||||
},
|
||||
|
||||
@ -1929,7 +1928,7 @@ Deluge.add.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, {
|
||||
Ext.namespace('Ext.deluge.add');
|
||||
/*!
|
||||
* Deluge.add.OptionsPanel.js
|
||||
*
|
||||
*
|
||||
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -1990,7 +1989,7 @@ Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, {
|
||||
Ext.each(Ext.keys(fileIndexes), function(index) {
|
||||
priorities[index] = fileIndexes[index];
|
||||
});
|
||||
|
||||
|
||||
var oldId = this.form.optionsManager.changeId(torrent['info_hash'], true);
|
||||
this.form.optionsManager.setDefault('file_priorities', priorities);
|
||||
this.form.optionsManager.changeId(oldId, true);
|
||||
@ -2020,23 +2019,34 @@ Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, {
|
||||
|
||||
this.torrentId = torrentId;
|
||||
this.form.optionsManager.changeId(torrentId);
|
||||
|
||||
|
||||
this.files.clearFiles();
|
||||
var root = this.files.getRootNode();
|
||||
var priorities = this.form.optionsManager.get('file_priorities');
|
||||
|
||||
this.walkFileTree(this.torrents[torrentId]['files_tree'], function(filename, type, entry, parentNode) {
|
||||
var node = new Ext.tree.TreeNode({
|
||||
download: (entry.index) ? priorities[entry.index] : true,
|
||||
filename: filename,
|
||||
fileindex: entry.index,
|
||||
leaf: type != 'dir',
|
||||
size: entry.length
|
||||
});
|
||||
parentNode.appendChild(node);
|
||||
if (type == 'dir') return node;
|
||||
}, this, root);
|
||||
root.firstChild.expand();
|
||||
this.form.setDisabled(false);
|
||||
|
||||
if (this.torrents[torrentId]['files_tree']) {
|
||||
this.walkFileTree(this.torrents[torrentId]['files_tree'], function(filename, type, entry, parentNode) {
|
||||
var node = new Ext.tree.TreeNode({
|
||||
download: (entry.index) ? priorities[entry.index] : true,
|
||||
filename: filename,
|
||||
fileindex: entry.index,
|
||||
leaf: type != 'dir',
|
||||
size: entry.length
|
||||
});
|
||||
parentNode.appendChild(node);
|
||||
if (type == 'dir') return node;
|
||||
}, this, root);
|
||||
root.firstChild.expand();
|
||||
this.files.setDisabled(false);
|
||||
this.files.show();
|
||||
} else {
|
||||
// Files tab is empty so show options tab
|
||||
this.form.show();
|
||||
this.files.setDisabled(true);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
walkFileTree: function(files, callback, scope, parentNode) {
|
||||
@ -2049,7 +2059,7 @@ Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, {
|
||||
} else {
|
||||
var ret = callback(filename, type, entry, parentNode);
|
||||
}
|
||||
|
||||
|
||||
if (type == 'dir') this.walkFileTree(entry, callback, scope, ret);
|
||||
}
|
||||
},
|
||||
@ -2071,7 +2081,7 @@ Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, {
|
||||
}, this);
|
||||
} else {
|
||||
this.files.setDownload(nodes[0], oldValue, true);
|
||||
}
|
||||
}
|
||||
},
|
||||
scope: this,
|
||||
icon: Ext.MessageBox.QUESTION
|
||||
@ -2353,17 +2363,27 @@ Deluge.add.UrlWindow = Ext.extend(Deluge.add.Window, {
|
||||
var cookies = this.cookieField.getValue();
|
||||
var torrentId = this.createTorrentId();
|
||||
|
||||
deluge.client.web.download_torrent_from_url(url, cookies, {
|
||||
success: this.onDownload,
|
||||
scope: this,
|
||||
torrentId: torrentId
|
||||
});
|
||||
if (url.substring(0,20) == 'magnet:?xt=urn:btih:') {
|
||||
deluge.client.web.get_magnet_info(url, {
|
||||
success: this.onGotInfo,
|
||||
scope: this,
|
||||
filename: url,
|
||||
torrentId: torrentId
|
||||
});
|
||||
} else {
|
||||
deluge.client.web.download_torrent_from_url(url, cookies, {
|
||||
success: this.onDownload,
|
||||
scope: this,
|
||||
torrentId: torrentId
|
||||
});
|
||||
}
|
||||
|
||||
this.hide();
|
||||
this.urlField.setValue('');
|
||||
this.fireEvent('beforeadd', torrentId, url);
|
||||
},
|
||||
|
||||
onDownload: function(filename, obj, resp, req) {
|
||||
this.urlField.setValue('');
|
||||
deluge.client.web.get_torrent_info(filename, {
|
||||
success: this.onGotInfo,
|
||||
scope: this,
|
||||
@ -3954,7 +3974,7 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, {
|
||||
});
|
||||
/*!
|
||||
* Deluge.preferences.PreferencesWindow.js
|
||||
*
|
||||
*
|
||||
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -4060,7 +4080,7 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, {
|
||||
this.addButton(_('Close'), this.onClose, this);
|
||||
this.addButton(_('Apply'), this.onApply, this);
|
||||
this.addButton(_('Ok'), this.onOk, this);
|
||||
|
||||
|
||||
this.optionsManager = new Deluge.OptionsManager();
|
||||
this.on('afterrender', this.onAfterRender, this);
|
||||
this.on('show', this.onShow, this);
|
||||
@ -4082,7 +4102,7 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, {
|
||||
this.addPage(new Deluge.preferences.Cache());
|
||||
this.addPage(new Deluge.preferences.Plugins());
|
||||
},
|
||||
|
||||
|
||||
onApply: function(e) {
|
||||
var changed = this.optionsManager.getDirty();
|
||||
if (!Ext.isObjectEmpty(changed)) {
|
||||
@ -4091,13 +4111,13 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, {
|
||||
scope: this
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
for (var page in this.pages) {
|
||||
if (this.pages[page].onApply) this.pages[page].onApply();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return the options manager for the preferences window.
|
||||
* @returns {Deluge.OptionsManager} the options manager
|
||||
@ -4105,7 +4125,7 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, {
|
||||
getOptionsManager: function() {
|
||||
return this.optionsManager;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Adds a page to the preferences window.
|
||||
* @param {Mixed} page
|
||||
@ -4120,7 +4140,7 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, {
|
||||
this.pages[name].index = -1;
|
||||
return this.pages[name];
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Removes a preferences page from the window.
|
||||
* @param {mixed} name
|
||||
@ -4133,12 +4153,12 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, {
|
||||
delete this.pages[page.title];
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* Select which preferences page is displayed.
|
||||
* @param {String} page The page name to change to
|
||||
*/
|
||||
selectPage: function(page) {
|
||||
if (this.pages[page].index < 0) {
|
||||
if (this.pages[page].index < 0) {
|
||||
this.pages[page].index = this.configPanel.items.indexOf(this.pages[page]);
|
||||
}
|
||||
this.list.select(this.pages[page].index);
|
||||
@ -4146,24 +4166,24 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, {
|
||||
|
||||
// private
|
||||
doSelectPage: function(page) {
|
||||
if (this.pages[page].index < 0) {
|
||||
if (this.pages[page].index < 0) {
|
||||
this.pages[page].index = this.configPanel.items.indexOf(this.pages[page]);
|
||||
}
|
||||
this.configPanel.getLayout().setActiveItem(this.pages[page].index);
|
||||
this.currentPage = page;
|
||||
},
|
||||
|
||||
|
||||
// private
|
||||
onGotConfig: function(config) {
|
||||
this.getOptionsManager().set(config);
|
||||
},
|
||||
|
||||
|
||||
// private
|
||||
onPageSelect: function(list, selections) {
|
||||
var r = list.getRecord(selections[0]);
|
||||
this.doSelectPage(r.get('name'));
|
||||
},
|
||||
|
||||
|
||||
// private
|
||||
onSetConfig: function() {
|
||||
this.getOptionsManager().commit();
|
||||
@ -4176,7 +4196,7 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, {
|
||||
}
|
||||
this.configPanel.getLayout().setActiveItem(0);
|
||||
},
|
||||
|
||||
|
||||
// private
|
||||
onShow: function() {
|
||||
if (!deluge.client.core) return;
|
||||
@ -4193,7 +4213,18 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, {
|
||||
|
||||
// private
|
||||
onOk: function() {
|
||||
deluge.client.core.set_config(this.optionsManager.getDirty());
|
||||
var changed = this.optionsManager.getDirty();
|
||||
if (!Ext.isObjectEmpty(changed)) {
|
||||
deluge.client.core.set_config(changed, {
|
||||
success: this.onSetConfig,
|
||||
scope: this
|
||||
});
|
||||
}
|
||||
|
||||
for (var page in this.pages) {
|
||||
if (this.pages[page].onOk) this.pages[page].onOk();
|
||||
}
|
||||
|
||||
this.hide();
|
||||
}
|
||||
});
|
||||
@ -6927,13 +6958,17 @@ Deluge.Keys = {
|
||||
* <pre>['queue', 'name', 'total_size', 'state', 'progress', 'num_seeds',
|
||||
* 'total_seeds', 'num_peers', 'total_peers', 'download_payload_rate',
|
||||
* 'upload_payload_rate', 'eta', 'ratio', 'distributed_copies',
|
||||
* 'is_auto_managed', 'time_added', 'tracker_host']</pre>
|
||||
* 'is_auto_managed', 'time_added', 'tracker_host', 'save_path',
|
||||
* 'total_done', 'total_uploaded', 'max_download_speed', 'max_upload_speed',
|
||||
* 'seeds_peers_ratio']</pre>
|
||||
*/
|
||||
Grid: [
|
||||
'queue', 'name', 'total_size', 'state', 'progress', 'num_seeds',
|
||||
'total_seeds', 'num_peers', 'total_peers', 'download_payload_rate',
|
||||
'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',
|
||||
'total_done', 'total_uploaded', 'max_download_speed', 'max_upload_speed',
|
||||
'seeds_peers_ratio'
|
||||
],
|
||||
|
||||
/**
|
||||
@ -8736,8 +8771,6 @@ Deluge.Toolbar = Ext.extend(Ext.Toolbar, {
|
||||
deluge.add.show();
|
||||
}
|
||||
});
|
||||
|
||||
deluge.toolbar = new Deluge.Toolbar();
|
||||
/*!
|
||||
* Deluge.TorrentGrid.js
|
||||
*
|
||||
@ -8783,11 +8816,15 @@ deluge.toolbar = new Deluge.Toolbar();
|
||||
if (!value) return;
|
||||
return fspeed(value);
|
||||
}
|
||||
function torrentLimitRenderer(value) {
|
||||
if (value == -1) return '';
|
||||
return fspeed(value * 1024.0);
|
||||
}
|
||||
function torrentProgressRenderer(value, p, r) {
|
||||
value = new Number(value);
|
||||
var progress = value;
|
||||
var text = r.data['state'] + ' ' + value.toFixed(2) + '%';
|
||||
var width = new Number(p.style.match(/\w+:\s*(\d+)\w+/)[1]);
|
||||
var width = new Number(this.style.match(/\w+:\s*(\d+)\w+/)[1]);
|
||||
return Deluge.progressBar(value, width - 8, text);
|
||||
}
|
||||
function seedsRenderer(value, p, r) {
|
||||
@ -8805,7 +8842,7 @@ deluge.toolbar = new Deluge.Toolbar();
|
||||
}
|
||||
}
|
||||
function availRenderer(value, p, r) {
|
||||
return (value < 0) ? '∞' : new Number(value).toFixed(3);
|
||||
return (value < 0) ? '∞' : parseFloat(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);
|
||||
@ -8857,18 +8894,6 @@ deluge.toolbar = new Deluge.Toolbar();
|
||||
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,
|
||||
@ -8887,36 +8912,90 @@ deluge.toolbar = new Deluge.Toolbar();
|
||||
sortable: true,
|
||||
renderer: ftime,
|
||||
dataIndex: 'eta'
|
||||
}, {
|
||||
header: _('Seeders'),
|
||||
hidden: true,
|
||||
width: 60,
|
||||
sortable: true,
|
||||
renderer: seedsRenderer,
|
||||
dataIndex: 'num_seeds'
|
||||
}, {
|
||||
header: _('Peers'),
|
||||
hidden: true,
|
||||
width: 60,
|
||||
sortable: true,
|
||||
renderer: peersRenderer,
|
||||
dataIndex: 'num_peers'
|
||||
}, {
|
||||
header: _('Ratio'),
|
||||
hidden: true,
|
||||
width: 60,
|
||||
sortable: true,
|
||||
renderer: availRenderer,
|
||||
dataIndex: 'ratio'
|
||||
}, {
|
||||
header: _('Avail'),
|
||||
hidden: true,
|
||||
width: 60,
|
||||
sortable: true,
|
||||
renderer: availRenderer,
|
||||
dataIndex: 'distributed_copies'
|
||||
}, {
|
||||
header: _('Added'),
|
||||
hidden: true,
|
||||
width: 80,
|
||||
sortable: true,
|
||||
renderer: fdate,
|
||||
dataIndex: 'time_added'
|
||||
}, {
|
||||
header: _('Tracker'),
|
||||
hidden: true,
|
||||
width: 120,
|
||||
sortable: true,
|
||||
renderer: trackerRenderer,
|
||||
dataIndex: 'tracker_host'
|
||||
}, {
|
||||
header: _('Save Path'),
|
||||
hidden: true,
|
||||
width: 120,
|
||||
sortable: true,
|
||||
renderer: fplain,
|
||||
dataIndex: 'save_path'
|
||||
}, {
|
||||
header: _('Downloaded'),
|
||||
hidden: true,
|
||||
width: 75,
|
||||
sortable: true,
|
||||
renderer: fsize,
|
||||
dataIndex: 'total_done'
|
||||
}, {
|
||||
header: _('Uploaded'),
|
||||
hidden: true,
|
||||
width: 75,
|
||||
sortable: true,
|
||||
renderer: fsize,
|
||||
dataIndex: 'total_uploaded'
|
||||
}, {
|
||||
header: _('Down Limit'),
|
||||
hidden: true,
|
||||
width: 75,
|
||||
sortable: true,
|
||||
renderer: torrentLimitRenderer,
|
||||
dataIndex: 'max_download_speed'
|
||||
}, {
|
||||
header: _('Up Limit'),
|
||||
hidden: true,
|
||||
width: 75,
|
||||
sortable: true,
|
||||
renderer: torrentLimitRenderer,
|
||||
dataIndex: 'max_upload_speed'
|
||||
}, {
|
||||
header: _('Seeders') + '/' + _('Peers'),
|
||||
hidden: true,
|
||||
width: 75,
|
||||
sortable: true,
|
||||
renderer: availRenderer,
|
||||
dataIndex: 'seeds_peers_ratio'
|
||||
}],
|
||||
|
||||
meta: {
|
||||
@ -8939,19 +9018,42 @@ deluge.toolbar = new Deluge.Toolbar();
|
||||
{name: 'distributed_copies', type: 'float'},
|
||||
{name: 'time_added', type: 'int'},
|
||||
{name: 'tracker_host'},
|
||||
{name: 'save_path'}
|
||||
{name: 'save_path'},
|
||||
{name: 'total_done', type: 'int'},
|
||||
{name: 'total_uploaded', type: 'int'},
|
||||
{name: 'max_download_speed', type: 'int'},
|
||||
{name: 'max_upload_speed', type: 'int'},
|
||||
{name: 'seeds_peers_ratio', type: 'float'}
|
||||
]
|
||||
},
|
||||
|
||||
keys: [{
|
||||
key: 'a',
|
||||
ctrl: true,
|
||||
stopEvent: true,
|
||||
handler: function() {
|
||||
deluge.torrents.getSelectionModel().selectAll();
|
||||
}
|
||||
}, {
|
||||
key: [46],
|
||||
stopEvent: true,
|
||||
handler: function() {
|
||||
ids = deluge.torrents.getSelectedIds();
|
||||
deluge.removeWindow.show(ids);
|
||||
}
|
||||
}],
|
||||
|
||||
constructor: function(config) {
|
||||
config = Ext.apply({
|
||||
id: 'torrentGrid',
|
||||
store: new Ext.data.JsonStore(this.meta),
|
||||
columns: this.columns,
|
||||
keys: this.keys,
|
||||
region: 'center',
|
||||
cls: 'deluge-torrents',
|
||||
stripeRows: true,
|
||||
autoExpandColumn: 'name',
|
||||
autoExpandMin: 150,
|
||||
deferredRender:false,
|
||||
autoScroll:true,
|
||||
margins: '5 5 0 0',
|
||||
@ -9149,6 +9251,7 @@ deluge.ui = {
|
||||
deluge.preferences = new Deluge.preferences.PreferencesWindow();
|
||||
deluge.sidebar = new Deluge.Sidebar();
|
||||
deluge.statusbar = new Deluge.Statusbar();
|
||||
deluge.toolbar = new Deluge.Toolbar();
|
||||
|
||||
this.detailsPanel = new Ext.Panel({
|
||||
id: 'detailsPanel',
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user