replace ∞ with its html code ∞

This commit is contained in:
Damien Churchill 2010-04-01 09:52:54 +01:00
parent ac7a1f0065
commit 0d091cdacc
4 changed files with 31 additions and 37 deletions

View File

@ -97,7 +97,7 @@ Deluge.Formatters = {
* @return {String} a formatted time string. will return '' if seconds == 0 * @return {String} a formatted time string. will return '' if seconds == 0
*/ */
timeRemaining: function(time) { timeRemaining: function(time) {
if (time == 0) { return '' } if (time == 0) { return '∞' }
time = time.toFixed(0); time = time.toFixed(0);
if (time < 60) { return time + 's'; } if (time < 60) { return time + 's'; }
else { time = time / 60; } else { time = time / 60; }

View File

@ -65,7 +65,7 @@
} }
} }
function availRenderer(value, p, r) { function availRenderer(value, p, r) {
return (value < 0) ? '' : new Number(value).toFixed(3); return (value < 0) ? '&infin;' : new Number(value).toFixed(3);
} }
function trackerRenderer(value, p, r) { 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); return String.format('<div style="background: url(' + deluge.config.base + 'tracker/{0}) no-repeat; padding-left: 20px;">{0}</div>', value);

View File

@ -34,21 +34,16 @@ Ext.namespace('Deluge.add');
Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
constructor: function(config) { title: _('Add Torrents'),
config = Ext.apply({ layout: 'border',
title: _('Add Torrents'), width: 470,
layout: 'border', height: 450,
width: 470, bodyStyle: 'padding: 10px 5px;',
height: 450, buttonAlign: 'right',
bodyStyle: 'padding: 10px 5px;', closeAction: 'hide',
buttonAlign: 'right', closable: true,
closeAction: 'hide', plain: true,
closable: true, iconCls: 'x-deluge-add-window-icon',
plain: true,
iconCls: 'x-deluge-add-window-icon'
}, config);
Deluge.add.AddWindow.superclass.constructor.call(this, config);
},
initComponent: function() { initComponent: function() {
Deluge.add.AddWindow.superclass.initComponent.call(this); Deluge.add.AddWindow.superclass.initComponent.call(this);
@ -64,8 +59,8 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
} }
} }
this.grid = this.add({ this.list = this.add({
xtype: 'grid', xtype: 'listview',
region: 'center', region: 'center',
store: new Ext.data.SimpleStore({ store: new Ext.data.SimpleStore({
fields: [ fields: [
@ -82,15 +77,13 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
dataIndex: 'text' dataIndex: 'text'
}], }],
stripeRows: true, stripeRows: true,
selModel: new Ext.grid.RowSelectionModel({ singleSelect: true,
singleSelect: true, listeners: {
listeners: { 'selectionchanged': {
'rowselect': { fn: this.onSelect,
fn: this.onSelect, scope: this
scope: this
}
} }
}), },
hideHeaders: true, hideHeaders: true,
autoExpandColumn: 'torrent', autoExpandColumn: 'torrent',
deferredRender: false, deferredRender: false,
@ -126,14 +119,14 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
}, },
clear: function() { clear: function() {
this.grid.getStore().removeAll(); this.list.getStore().removeAll();
this.optionsPanel.clear(); this.optionsPanel.clear();
}, },
onAddClick: function() { onAddClick: function() {
var torrents = []; var torrents = [];
if (!this.grid) return; if (!this.grid) return;
this.grid.getStore().each(function(r) { this.list.getStore().each(function(r) {
var id = r.get('info_hash'); var id = r.get('info_hash');
torrents.push({ torrents.push({
path: this.optionsPanel.getFilename(id), path: this.optionsPanel.getFilename(id),
@ -169,13 +162,14 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
var selection = this.grid.getSelectionModel(); var selection = this.grid.getSelectionModel();
if (!selection.hasSelection()) return; if (!selection.hasSelection()) return;
var torrent = selection.getSelected(); var torrent = selection.getSelected();
this.grid.getStore().remove(torrent); this.list.getStore().remove(torrent);
this.optionsPanel.clear(); this.optionsPanel.clear();
if (this.torrents && this.torrents[torrent.id]) delete this.torrents[torrent.id]; if (this.torrents && this.torrents[torrent.id]) delete this.torrents[torrent.id];
}, },
onSelect: function(selModel, rowIndex, record) { onSelect: function(list, selections) {
this.optionsPanel.setTorrent(record.get('info_hash')); this.optionsPanel.setTorrent(record.get('info_hash'));
this.optionsPanel.files.setDisabled(false); this.optionsPanel.files.setDisabled(false);
this.optionsPanel.form.setDisabled(false); this.optionsPanel.form.setDisabled(false);
@ -198,12 +192,12 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
}, },
onTorrentBeforeAdd: function(torrentId, text) { onTorrentBeforeAdd: function(torrentId, text) {
var store = this.grid.getStore(); var store = this.list.getStore();
store.loadData([[torrentId, null, text]], true); store.loadData([[torrentId, null, text]], true);
}, },
onTorrentAdd: function(torrentId, info) { onTorrentAdd: function(torrentId, info) {
var r = this.grid.getStore().getById(torrentId); var r = this.list.getStore().getById(torrentId);
if (!info) { if (!info) {
Ext.MessageBox.show({ Ext.MessageBox.show({
title: _('Error'), title: _('Error'),
@ -213,11 +207,11 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
icon: Ext.MessageBox.ERROR, icon: Ext.MessageBox.ERROR,
iconCls: 'x-deluge-icon-error' iconCls: 'x-deluge-icon-error'
}); });
this.grid.getStore().remove(r); this.list.getStore().remove(r);
} else { } else {
r.set('info_hash', info['info_hash']); r.set('info_hash', info['info_hash']);
r.set('text', info['name']); r.set('text', info['name']);
this.grid.getStore().commitChanges(); this.list.getStore().commitChanges();
this.optionsPanel.addTorrent(info); this.optionsPanel.addTorrent(info);
} }
}, },

View File

@ -96,7 +96,7 @@ Deluge.details.StatusTab = Ext.extend(Ext.Panel, {
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),
share: (status.ratio == -1) ? '' : status.ratio.toFixed(3), share: (status.ratio == -1) ? '&infin;' : status.ratio.toFixed(3),
announce: ftime(status.next_announce), announce: ftime(status.next_announce),
tracker_status: status.tracker_status, tracker_status: status.tracker_status,
downspeed: (status.download_payload_rate) ? fspeed(status.download_payload_rate) : '0.0 KiB/s', downspeed: (status.download_payload_rate) ? fspeed(status.download_payload_rate) : '0.0 KiB/s',