From 20a6a302e6a3d3126c6a39ed0f3dbcff39424421 Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Sun, 12 Oct 2008 19:06:17 +0000 Subject: [PATCH] add a progress bar to the statistics tab --- .../ajax/static/js/deluge-details.js | 26 +++++++++++++++---- .../ajax/static/themes/classic/style.css | 10 +++++++ 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/deluge/ui/webui/templates/ajax/static/js/deluge-details.js b/deluge/ui/webui/templates/ajax/static/js/deluge-details.js index 6d421ac30..b0cfd64f6 100644 --- a/deluge/ui/webui/templates/ajax/static/js/deluge-details.js +++ b/deluge/ui/webui/templates/ajax/static/js/deluge-details.js @@ -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, diff --git a/deluge/ui/webui/templates/ajax/static/themes/classic/style.css b/deluge/ui/webui/templates/ajax/static/themes/classic/style.css index a73d61ab0..1a4e1ccad 100644 --- a/deluge/ui/webui/templates/ajax/static/themes/classic/style.css +++ b/deluge/ui/webui/templates/ajax/static/themes/classic/style.css @@ -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;