more semicolons and fixes

This commit is contained in:
Damien Churchill 2008-10-12 20:57:03 +00:00
parent 13a2927762
commit 5e29fabf1e
2 changed files with 47 additions and 43 deletions

View File

@ -82,6 +82,7 @@ Deluge.Widgets.StatisticsPage = new Class({
}, },
onLoad: function(e) { onLoad: function(e) {
this.element.id = 'statistics';
this.bar = new Widgets.ProgressBar(); this.bar = new Widgets.ProgressBar();
this.bar.element.inject(this.element, 'top'); this.bar.element.inject(this.element, 'top');
this.bar.set('width', this.getWidth() - 12); this.bar.set('width', this.getWidth() - 12);
@ -178,42 +179,45 @@ Deluge.Widgets.FilesGrid = new Class({
}, },
initialize: function(element, options) { initialize: function(element, options) {
this.parent(element, options) this.parent(element, options);
var menu = new Widgets.PopupMenu() var menu = new Widgets.PopupMenu();
$A([0,1,2,5]).each(function(index) { $A([0,1,2,5]).each(function(index) {
menu.add({ menu.add({
type:'text', type:'text',
action: index, action: index,
text: this.priority_texts[index], text: this.priority_texts[index],
icon: this.priority_icons[index] icon: this.priority_icons[index]
}) });
}, this) }, this);
menu.addEvent('action', function(e) { menu.addEvent('action', function(e) {
e = { e = {
action: e.action, action: e.action,
torrentId: menu.row.torrentId torrentId: menu.row.torrentId
} };
this.fireEvent('menuAction', e) this.fireEvent('menuAction', e);
}.bind(this)) }.bind(this));
this.addEvent('row_menu', function(e) { this.addEvent('rowMenu', function(e) {
e.stop() e.stop();
menu.row = e.row menu.row = e.row;
menu.show(e) menu.show(e);
}) })
}, },
clear: function() { clear: function() {
this.rows.empty() this.rows.empty();
this.body.empty() this.body.empty();
this.render() this.render();
}, },
updateFiles: function(torrent) { updateFiles: function(torrent) {
torrent.files.each(function(file) { torrent.files.each(function(file) {
var p = torrent.file_priorities[file.index] var p = torrent.file_priorities[file.index];
var priority = {text:this.priority_texts[p], icon:this.priority_icons[p]} var priority = {
text:this.priority_texts[p],
icon:this.priority_icons[p]
};
var percent = torrent.file_progress[file.index]*100.0; var percent = torrent.file_progress[file.index]*100.0;
row = { row = {
@ -227,14 +231,14 @@ Deluge.Widgets.FilesGrid = new Class({
fileIndex: file.index, fileIndex: file.index,
torrentId: torrent.id torrentId: torrent.id
} };
if (this.has(row.id)) { if (this.has(row.id)) {
this.updateRow(row, true) this.updateRow(row, true);
} else { } else {
this.addRow(row, true) this.addRow(row, true);
} };
}, this) }, this);
this.render() this.render();
} }
}); });
@ -246,48 +250,48 @@ Deluge.Widgets.FilesPage = new Class({
}, },
initialize: function(el) { initialize: function(el) {
this.parent('Files') this.parent('Files');
this.torrentId = -1 this.torrentId = -1;
this.addEvent('loaded', this.loaded.bindWithEvent(this)) this.addEvent('loaded', this.loaded.bindWithEvent(this));
this.addEvent('resize', this.resized.bindWithEvent(this)) this.addEvent('resize', this.resized.bindWithEvent(this));
}, },
loaded: function(event) { loaded: function(event) {
this.grid = new Deluge.Widgets.FilesGrid('files') this.grid = new Deluge.Widgets.FilesGrid('files');
this.grid.addEvent('menuAction', this.menuAction.bindWithEvent(this)) this.grid.addEvent('menuAction', this.menuAction.bindWithEvent(this));
if (this.beenResized) { if (this.beenResized) {
this.resized(this.beenResized) this.resized(this.beenResized);
delete this.beenResized delete this.beenResized;
} };
}, },
resized: function(e) { resized: function(e) {
if (!this.grid) { if (!this.grid) {
this.beenResized = e; this.beenResized = e;
return return;
} };
this.element.getPadding() this.element.getPadding();
this.grid.sets({ this.grid.sets({
width: e.width - this.element.padding.x, width: e.width - this.element.padding.x,
height: e.height - this.element.padding.y height: e.height - this.element.padding.y
}) });
}, },
menuAction: function(e) { menuAction: function(e) {
this.fireEvent('menuAction', e) this.fireEvent('menuAction', e);
}, },
update: function(torrent) { update: function(torrent) {
if (this.torrentId != torrent.id) { if (this.torrentId != torrent.id) {
this.torrentId = torrent.id this.torrentId = torrent.id;
this.grid.rows.empty() this.grid.rows.empty();
this.grid.body.empty() this.grid.body.empty();
} }
this.grid.updateFiles(torrent) this.grid.updateFiles(torrent);
} }
}) });
Deluge.Widgets.PeersPage = new Class({ Deluge.Widgets.PeersPage = new Class({
Extends: Widgets.TabPage, Extends: Widgets.TabPage,

View File

@ -359,14 +359,14 @@ label.fluid {
margin: 2px; margin: 2px;
} }
#details .moouiProgressBar { #statistics .moouiProgressBar {
margin-top: 10px; margin-top: 10px;
background: #1c2431; background: #1c2431;
-moz-border-radius:5px; /*ff only setting*/ -moz-border-radius:5px; /*ff only setting*/
-webkit-border-radius: 5px; -webkit-border-radius: 5px;
} }
#details .moouiProgressBar span { #statistics .moouiProgressBar span {
line-height: 20px; line-height: 20px;
} }