Module: deluge
Branch: master
Commit: 38802245b61b41e4b313dad60c8aa45230ce8666

Author: Damien Churchill <[email protected]>
Date:   Tue Mar  9 22:48:33 2010 +0000

display the speed in the title bar

---

 deluge/ui/web/js/deluge-all/Deluge.Formatters.js |   10 ++++++----
 deluge/ui/web/js/deluge-all/Deluge.UI.js         |    8 ++++++++
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/deluge/ui/web/js/deluge-all/Deluge.Formatters.js 
b/deluge/ui/web/js/deluge-all/Deluge.Formatters.js
index 141cadc..2053b8c 100644
--- a/deluge/ui/web/js/deluge-all/Deluge.Formatters.js
+++ b/deluge/ui/web/js/deluge-all/Deluge.Formatters.js
@@ -64,10 +64,11 @@ Deluge.Formatters = {
         * Formats the bytes value into a string with KiB, MiB or GiB units.
         *
         * @param {Number} bytes the filesize in bytes
+        * @param {Boolean} showZero pass in true to displays 0 values
         * @return {String} formatted string with KiB, MiB or GiB units.
         */
-       size: function(bytes) {
-               if (!bytes) return '';
+       size: function(bytes, showZero) {
+               if (!bytes && !showZero) return '';
                bytes = bytes / 1024.0;
        
                if (bytes < 1024) { return bytes.toFixed(1)  + ' KiB'; }
@@ -83,10 +84,11 @@ Deluge.Formatters = {
         * Formats a string to display a transfer speed utilizing {...@link 
#size}
         *
         * @param {Number} bits the number of bits per second
+        * @param {Boolean} showZero pass in true to displays 0 values
         * @return {String} formatted string with KiB, MiB or GiB units.
         */
-       speed: function(bits) {
-               return (!bits) ? '' : fsize(bits) + '/s';
+       speed: function(bits, showZero) {
+               return (!bits && !showZero) ? '' : fsize(bits, showZero) + '/s';
        },
        
        /**
diff --git a/deluge/ui/web/js/deluge-all/Deluge.UI.js 
b/deluge/ui/web/js/deluge-all/Deluge.UI.js
index c2634fa..2c42e06 100644
--- a/deluge/ui/web/js/deluge-all/Deluge.UI.js
+++ b/deluge/ui/web/js/deluge-all/Deluge.UI.js
@@ -87,6 +87,8 @@ Deluge.UI = {
                }, this, {single: true});
        
                this.update = this.update.createDelegate(this);
+
+               this.originalTitle = document.title;
        },
 
        update: function() {
@@ -118,6 +120,12 @@ Deluge.UI = {
         */
        onUpdate: function(data) {
                if (!data['connected']) Deluge.Events.fire('disconnect');
+
+               if (Deluge.config.show_session_speed) {
+                       document.title = this.originalTitle + 
+                               ' (Down: ' + 
fspeed(data['stats'].download_rate, true) + 
+                               ' Up: ' + fspeed(data['stats'].upload_rate, 
true) + ')';
+               }
                Deluge.Torrents.update(data['torrents']);
                Deluge.Statusbar.update(data['stats']);
                Deluge.Sidebar.update(data['filters']);

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to