add popup menus, need some changes in mooui so they display correctly

This commit is contained in:
Damien Churchill 2008-10-08 02:24:59 +00:00
parent 2574e05ad4
commit 641c27a90a
2 changed files with 155 additions and 1 deletions

View File

@ -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) {
}
});

View File

@ -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')
}
]
}
};