From 0d091cdaccd03b3bb08db2e421e3481630056fd8 Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Thu, 1 Apr 2010 09:52:54 +0100 Subject: [PATCH] =?UTF-8?q?replace=20=E2=88=9E=20with=20its=20html=20code?= =?UTF-8?q?=20∞?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deluge/ui/web/js/deluge-all/Formatters.js | 2 +- deluge/ui/web/js/deluge-all/Torrents.js | 2 +- deluge/ui/web/js/deluge-all/add/AddWindow.js | 62 +++++++++---------- .../ui/web/js/deluge-all/details/StatusTab.js | 2 +- 4 files changed, 31 insertions(+), 37 deletions(-) diff --git a/deluge/ui/web/js/deluge-all/Formatters.js b/deluge/ui/web/js/deluge-all/Formatters.js index 1dbec58c1..04a67a40c 100644 --- a/deluge/ui/web/js/deluge-all/Formatters.js +++ b/deluge/ui/web/js/deluge-all/Formatters.js @@ -97,7 +97,7 @@ Deluge.Formatters = { * @return {String} a formatted time string. will return '' if seconds == 0 */ timeRemaining: function(time) { - if (time == 0) { return '∞' } + if (time == 0) { return '∞' } time = time.toFixed(0); if (time < 60) { return time + 's'; } else { time = time / 60; } diff --git a/deluge/ui/web/js/deluge-all/Torrents.js b/deluge/ui/web/js/deluge-all/Torrents.js index af4a64d02..70e57d66a 100644 --- a/deluge/ui/web/js/deluge-all/Torrents.js +++ b/deluge/ui/web/js/deluge-all/Torrents.js @@ -65,7 +65,7 @@ } } function availRenderer(value, p, r) { - return (value < 0) ? '∞' : new Number(value).toFixed(3); + return (value < 0) ? '∞' : new Number(value).toFixed(3); } function trackerRenderer(value, p, r) { return String.format('
{0}
', value); diff --git a/deluge/ui/web/js/deluge-all/add/AddWindow.js b/deluge/ui/web/js/deluge-all/add/AddWindow.js index 334953f6e..36940d88f 100644 --- a/deluge/ui/web/js/deluge-all/add/AddWindow.js +++ b/deluge/ui/web/js/deluge-all/add/AddWindow.js @@ -34,21 +34,16 @@ Ext.namespace('Deluge.add'); Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { - constructor: function(config) { - config = Ext.apply({ - title: _('Add Torrents'), - layout: 'border', - width: 470, - height: 450, - bodyStyle: 'padding: 10px 5px;', - buttonAlign: 'right', - closeAction: 'hide', - closable: true, - plain: true, - iconCls: 'x-deluge-add-window-icon' - }, config); - Deluge.add.AddWindow.superclass.constructor.call(this, config); - }, + title: _('Add Torrents'), + layout: 'border', + width: 470, + height: 450, + bodyStyle: 'padding: 10px 5px;', + buttonAlign: 'right', + closeAction: 'hide', + closable: true, + plain: true, + iconCls: 'x-deluge-add-window-icon', initComponent: function() { Deluge.add.AddWindow.superclass.initComponent.call(this); @@ -63,9 +58,9 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { return String.format('
{0}
', value); } } - - this.grid = this.add({ - xtype: 'grid', + + this.list = this.add({ + xtype: 'listview', region: 'center', store: new Ext.data.SimpleStore({ fields: [ @@ -82,15 +77,13 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { dataIndex: 'text' }], stripeRows: true, - selModel: new Ext.grid.RowSelectionModel({ - singleSelect: true, - listeners: { - 'rowselect': { - fn: this.onSelect, - scope: this - } + singleSelect: true, + listeners: { + 'selectionchanged': { + fn: this.onSelect, + scope: this } - }), + }, hideHeaders: true, autoExpandColumn: 'torrent', deferredRender: false, @@ -126,14 +119,14 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { }, clear: function() { - this.grid.getStore().removeAll(); + this.list.getStore().removeAll(); this.optionsPanel.clear(); }, onAddClick: function() { var torrents = []; if (!this.grid) return; - this.grid.getStore().each(function(r) { + this.list.getStore().each(function(r) { var id = r.get('info_hash'); torrents.push({ path: this.optionsPanel.getFilename(id), @@ -169,13 +162,14 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { var selection = this.grid.getSelectionModel(); if (!selection.hasSelection()) return; var torrent = selection.getSelected(); - this.grid.getStore().remove(torrent); + this.list.getStore().remove(torrent); this.optionsPanel.clear(); 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.files.setDisabled(false); this.optionsPanel.form.setDisabled(false); @@ -198,12 +192,12 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { }, onTorrentBeforeAdd: function(torrentId, text) { - var store = this.grid.getStore(); + var store = this.list.getStore(); store.loadData([[torrentId, null, text]], true); }, onTorrentAdd: function(torrentId, info) { - var r = this.grid.getStore().getById(torrentId); + var r = this.list.getStore().getById(torrentId); if (!info) { Ext.MessageBox.show({ title: _('Error'), @@ -213,11 +207,11 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { icon: Ext.MessageBox.ERROR, iconCls: 'x-deluge-icon-error' }); - this.grid.getStore().remove(r); + this.list.getStore().remove(r); } else { r.set('info_hash', info['info_hash']); r.set('text', info['name']); - this.grid.getStore().commitChanges(); + this.list.getStore().commitChanges(); this.optionsPanel.addTorrent(info); } }, diff --git a/deluge/ui/web/js/deluge-all/details/StatusTab.js b/deluge/ui/web/js/deluge-all/details/StatusTab.js index 03f2091d9..ba99a2a5d 100644 --- a/deluge/ui/web/js/deluge-all/details/StatusTab.js +++ b/deluge/ui/web/js/deluge-all/details/StatusTab.js @@ -96,7 +96,7 @@ Deluge.details.StatusTab = Ext.extend(Ext.Panel, { var data = { downloaded: fsize(status.total_done, true), uploaded: fsize(status.total_uploaded, true), - share: (status.ratio == -1) ? '∞' : status.ratio.toFixed(3), + share: (status.ratio == -1) ? '∞' : status.ratio.toFixed(3), announce: ftime(status.next_announce), tracker_status: status.tracker_status, downspeed: (status.download_payload_rate) ? fspeed(status.download_payload_rate) : '0.0 KiB/s',