add a progress bar to the statistics tab

This commit is contained in:
Damien Churchill 2008-10-12 19:06:17 +00:00
parent a34d74d790
commit 20a6a302e6
2 changed files with 31 additions and 5 deletions

View File

@ -77,7 +77,21 @@ Deluge.Widgets.StatisticsPage = new Class({
},
initialize: function() {
this.parent('Statistics')
this.parent('Statistics');
this.addEvent('loaded', this.onLoad.bindWithEvent(this));
},
onLoad: function(e) {
this.bar = new Widgets.ProgressBar();
this.bar.element.inject(this.element, 'top');
this.bar.set('width', this.getWidth() - 12);
this.bar.update('', 0);
this.addEvent('resize', this.onResize.bindWithEvent(this));
},
onResize: function(e) {
if (!$defined(this.bar)) return;
this.bar.set('width', this.getWidth() - 12);
},
update: function(torrent) {
@ -98,15 +112,17 @@ Deluge.Widgets.StatisticsPage = new Class({
seeding_time: torrent.seeding_time.toTime(),
seed_rank: torrent.seed_rank
}
var text = torrent.state + ' ' + torrent.progress.toFixed(2) + '%';
this.bar.update(text, torrent.progress);
if (torrent.is_auto_managed) {data.auto_managed = 'True'}
else {data.auto_managed = 'False'}
else {data.auto_managed = 'False'};
this.element.getElements('dd').each(function(item) {
item.set('text', data[item.getProperty('class')])
}, this)
item.set('text', data[item.getProperty('class')]);
}, this);
}
})
});
Deluge.Widgets.DetailsPage = new Class({
Extends: Widgets.TabPage,

View File

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