diff --git a/deluge/ui/webui/templates/ajax/static/js/deluge-bars.js b/deluge/ui/webui/templates/ajax/static/js/deluge-bars.js index 77ec8dded..1cbda0f8c 100644 --- a/deluge/ui/webui/templates/ajax/static/js/deluge-bars.js +++ b/deluge/ui/webui/templates/ajax/static/js/deluge-bars.js @@ -28,10 +28,28 @@ Deluge.Widgets.StatusBar = new Class({ initialize: function() { this.parent($('status')); + this.bound = { + onConnectionsClick: this.onConnectionsClick.bindWithEvent(this), + onUploadClick: this.onUploadClick.bindWithEvent(this), + onDownloadClick: this.onDownloadClick.bindWithEvent(this) + }; + this.element.getElements('li').each(function(el) { this[el.id] = el; }, this); this.incoming_connections.setStyle('display', 'none'); + + this.connections.addEvent('contextmenu', this.bound.onConnectionsClick); + this.connectionsMenu = new Widgets.PopupMenu(); + this.connectionsMenu.add(Deluge.Menus.Connections); + + this.downspeed.addEvent('contextmenu', this.bound.onDownloadClick); + this.downloadMenu = new Widgets.PopupMenu(); + this.downloadMenu.add(Deluge.Menus.Download); + + this.upspeed.addEvent('contextmenu', this.bound.onUploadClick); + this.uploadMenu = new Widgets.PopupMenu(); + this.uploadMenu.add(Deluge.Menus.Upload); }, update: function(stats) { @@ -45,6 +63,25 @@ Deluge.Widgets.StatusBar = new Class({ } else { this.incoming_connections.setStyle('display', 'inline'); } + }, + + onConnectionsClick: function(e) { + e.stop(); + this.connectionsMenu.show(e); + }, + + onDownloadClick: function(e) { + e.stop(); + this.downloadMenu.show(e); + }, + + onUploadClick: function(e) { + e.stop(); + this.uploadMenu.show(e); + }, + + onMenuClick: function(e) { + } }); diff --git a/deluge/ui/webui/templates/ajax/static/js/deluge-menus.js b/deluge/ui/webui/templates/ajax/static/js/deluge-menus.js index 606b0f209..f51d4e52c 100644 --- a/deluge/ui/webui/templates/ajax/static/js/deluge-menus.js +++ b/deluge/ui/webui/templates/ajax/static/js/deluge-menus.js @@ -297,5 +297,122 @@ Deluge.Menus = { text: Deluge.Strings.get('Move Storage'), icon: '/static/images/tango/move.png' } + ], + + Connections: [ + { + type: 'text', + action: 'max_connections', + value: 50, + text: '50' + }, + { + type: 'text', + action: 'max_connections', + value: 100, + text: '100' + }, + { + type: 'text', + action: 'max_connections', + value: 200, + text: '200' + }, + { + type: 'text', + action: 'max_connections', + value: 300, + text: '300' + }, + { + type: 'text', + action: 'max_connections', + value: 500, + text: '500' + }, + { + type: 'text', + action: 'max_connections', + value: -1, + text: Deluge.Strings.get('Unlimited') + } + ], + + Download: [ + { + type: 'text', + action: 'max_download_speed', + value: 5, + text: '5 KiB/s' + }, + { + type: 'text', + action: 'max_download_speed', + value: 10, + text: '10 KiB/s' + }, + { + type: 'text', + action: 'max_download_speed', + value: 30, + text: '30 KiB/s' + }, + { + type: 'text', + action: 'max_download_speed', + value: 80, + text: '80 KiB/s' + }, + { + type: 'text', + action: 'max_download_speed', + value: 300, + text: '300 KiB/s' + }, + { + type: 'text', + action: 'max_download_speed', + value: -1, + text: Deluge.Strings.get('Unlimited') + } + ], + + Upload: [ + { + type: 'text', + action: 'max_upload_speed', + value: 5, + text:'5 KiB/s' + }, + { + type: 'text', + action: 'max_upload_speed', + value: 10, + text: '10 KiB/s' + }, + { + type: 'text', + action: 'max_upload_speed', + value: 30, + text: '30 KiB/s' + }, + { + type: 'text', + action: 'max_upload_speed', + value: 80, + text: '80 KiB/s' + }, + { + type: 'text', + action: 'max_upload_speed', + value: 300, + text: '300 KiB/s' + }, + { + type: 'text', + action: 'max_upload_speed', + value: -1, + text: Deluge.Strings.get('Unlimited') + } ] -} +};