remove pointless privatising

This commit is contained in:
Damien Churchill 2009-04-21 21:46:20 +00:00
parent ee5cfc8cff
commit 9df1ec2193
2 changed files with 133 additions and 137 deletions

View File

@ -21,59 +21,57 @@ Copyright:
Boston, MA 02110-1301, USA. Boston, MA 02110-1301, USA.
*/ */
(function() { Ext.deluge.details.DetailsTab = Ext.extend(Ext.Panel, {
Ext.deluge.details.DetailsTab = Ext.extend(Ext.Panel, { title: _('Details'),
title: _('Details'), cls: 'x-deluge-status',
cls: 'x-deluge-status',
onRender: function(ct, position) {
onRender: function(ct, position) { Ext.deluge.details.DetailsTab.superclass.onRender.call(this, ct, position);
Ext.deluge.details.DetailsTab.superclass.onRender.call(this, ct, position); this.load({
this.load({ url: '/render/tab_details.html',
url: '/render/tab_details.html', text: _('Loading') + '...'
text: _('Loading') + '...' });
}); this.getUpdater().on('update', this.onPanelUpdate, this);
this.getUpdater().on('update', this.onPanelUpdate, this); },
},
clear: function() {
clear: function() { if (!this.fields) return;
if (!this.fields) return; for (var k in this.fields) {
for (var k in this.fields) { this.fields[k].innerHTML = '';
this.fields[k].innerHTML = '';
}
},
update: function(torrentId) {
if (!this.fields) this.getFields();
Deluge.Client.core.get_torrent_status(torrentId, Deluge.Keys.Details, {
success: this.onRequestComplete,
scope: this,
torrentId: torrentId
});
},
onPanelUpdate: function(el, response) {
this.fields = {};
Ext.each(Ext.query('dd', this.body.dom), function(field) {
this.fields[field.className] = field;
}, this);
},
onRequestComplete: function(torrent, options) {
var data = {
torrent_name: torrent.name,
hash: options.torrentId,
path: torrent.save_path,
size: fsize(torrent.total_size),
files: torrent.num_files,
status: torrent.tracker_status,
tracker: torrent.tracker,
comment: torrent.comment
};
for (var field in this.fields) {
this.fields[field].innerHTML = data[field];
}
} }
}); },
Deluge.Details.add(new Ext.deluge.details.DetailsTab());
})(); update: function(torrentId) {
if (!this.fields) this.getFields();
Deluge.Client.core.get_torrent_status(torrentId, Deluge.Keys.Details, {
success: this.onRequestComplete,
scope: this,
torrentId: torrentId
});
},
onPanelUpdate: function(el, response) {
this.fields = {};
Ext.each(Ext.query('dd', this.body.dom), function(field) {
this.fields[field.className] = field;
}, this);
},
onRequestComplete: function(torrent, options) {
var data = {
torrent_name: torrent.name,
hash: options.torrentId,
path: torrent.save_path,
size: fsize(torrent.total_size),
files: torrent.num_files,
status: torrent.tracker_status,
tracker: torrent.tracker,
comment: torrent.comment
};
for (var field in this.fields) {
this.fields[field].innerHTML = data[field];
}
}
});
Deluge.Details.add(new Ext.deluge.details.DetailsTab());

View File

@ -21,89 +21,87 @@ Copyright:
Boston, MA 02110-1301, USA. Boston, MA 02110-1301, USA.
*/ */
(function() { Ext.deluge.details.StatusTab = Ext.extend(Ext.Panel, {
Ext.deluge.details.StatusTab = Ext.extend(Ext.Panel, { title: _('Status'),
title: _('Status'),
onRender: function(ct, position) {
Ext.deluge.details.StatusTab.superclass.onRender.call(this, ct, position);
onRender: function(ct, position) { this.progressBar = this.add({
Ext.deluge.details.StatusTab.superclass.onRender.call(this, ct, position); xtype: 'fullprogressbar',
cls: 'x-deluge-status-progressbar'
this.progressBar = this.add({ });
xtype: 'fullprogressbar',
cls: 'x-deluge-status-progressbar' this.status = this.add({
}); cls: 'x-deluge-status',
border: false,
this.status = this.add({ listeners: {
cls: 'x-deluge-status', 'render': {
border: false, fn: function(panel) {
listeners: { panel.load({
'render': { url: '/render/tab_status.html',
fn: function(panel) { text: _('Loading') + '...'
panel.load({ });
url: '/render/tab_status.html', panel.getUpdater().on('update', this.onPanelUpdate, this);
text: _('Loading') + '...' },
}); scope: this
panel.getUpdater().on('update', this.onPanelUpdate, this);
},
scope: this
}
} }
});
},
clear: function() {
if (!this.fields) return;
this.progressBar.updateProgress(0, ' ');
for (var k in this.fields) {
this.fields[k].innerHTML = '';
} }
}, });
},
update: function(torrentId) {
if (!this.fields) this.getFields(); clear: function() {
Deluge.Client.core.get_torrent_status(torrentId, Deluge.Keys.Status, { if (!this.fields) return;
success: this.onRequestComplete, this.progressBar.updateProgress(0, ' ');
scope: this for (var k in this.fields) {
}); this.fields[k].innerHTML = '';
},
onPanelUpdate: function(el, response) {
this.fields = {};
Ext.each(Ext.query('dd', this.status.body.dom), function(field) {
this.fields[field.className] = field;
}, this);
},
onRequestComplete: function(status) {
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
var data = {
downloaded: fsize(status.total_done) + ' (' + fsize(status.total_payload_download) + ')',
uploaded: fsize(status.total_uploaded) + ' (' + fsize(status.total_payload_upload) + ')',
share: status.ratio.toFixed(3),
announce: ftime(status.next_announce),
tracker_status: status.tracker_status,
downspeed: fspeed(status.download_payload_rate),
upspeed: fspeed(status.upload_payload_rate),
eta: ftime(status.eta),
pieces: status.num_pieces + ' (' + fsize(status.piece_length) + ')',
seeders: seeders,
peers: peers,
avail: status.distributed_copies.toFixed(3),
active_time: ftime(status.active_time),
seeding_time: ftime(status.seeding_time),
seed_rank: status.seed_rank,
auto_managed: 'False',
time_added: fdate(status.time_added)
}
if (status.is_auto_managed) {data.auto_managed = 'True'}
for (var field in this.fields) {
this.fields[field].innerHTML = data[field];
}
var text = status.state + ' ' + status.progress.toFixed(2) + '%';
this.progressBar.updateProgress(status.progress, text);
} }
}); },
Deluge.Details.add(new Ext.deluge.details.StatusTab());
})(); update: function(torrentId) {
if (!this.fields) this.getFields();
Deluge.Client.core.get_torrent_status(torrentId, Deluge.Keys.Status, {
success: this.onRequestComplete,
scope: this
});
},
onPanelUpdate: function(el, response) {
this.fields = {};
Ext.each(Ext.query('dd', this.status.body.dom), function(field) {
this.fields[field.className] = field;
}, this);
},
onRequestComplete: function(status) {
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
var data = {
downloaded: fsize(status.total_done) + ' (' + fsize(status.total_payload_download) + ')',
uploaded: fsize(status.total_uploaded) + ' (' + fsize(status.total_payload_upload) + ')',
share: status.ratio.toFixed(3),
announce: ftime(status.next_announce),
tracker_status: status.tracker_status,
downspeed: fspeed(status.download_payload_rate),
upspeed: fspeed(status.upload_payload_rate),
eta: ftime(status.eta),
pieces: status.num_pieces + ' (' + fsize(status.piece_length) + ')',
seeders: seeders,
peers: peers,
avail: status.distributed_copies.toFixed(3),
active_time: ftime(status.active_time),
seeding_time: ftime(status.seeding_time),
seed_rank: status.seed_rank,
auto_managed: 'False',
time_added: fdate(status.time_added)
}
if (status.is_auto_managed) {data.auto_managed = 'True'}
for (var field in this.fields) {
this.fields[field].innerHTML = data[field];
}
var text = status.state + ' ' + status.progress.toFixed(2) + '%';
this.progressBar.updateProgress(status.progress, text);
}
});
Deluge.Details.add(new Ext.deluge.details.StatusTab());