fix setting bandwidth limits via the statusbar

This commit is contained in:
Damien Churchill 2009-10-20 22:33:18 +00:00
parent da2a7ef138
commit 21701cb096
2 changed files with 19 additions and 16 deletions

View File

@ -243,7 +243,18 @@ Deluge.Menus.Torrent = new Ext.menu.Menu({
}]
});
Deluge.Menus.Connections = new Ext.menu.Menu({
Ext.deluge.StatusbarMenu = Ext.extend(Ext.menu.Menu, {
setValue: function(value) {
var item = this.items.get(value);
if (!item) item = this.items.get('other')
item.suspendEvents();
item.setChecked(true);
item.resumeEvents();
}
});
Deluge.Menus.Connections = new Ext.deluge.StatusbarMenu({
id: 'connectionsMenu',
items: [{
id: '50',
@ -290,7 +301,7 @@ Deluge.Menus.Connections = new Ext.menu.Menu({
}]
});
Deluge.Menus.Download = new Ext.menu.Menu({
Deluge.Menus.Download = new Ext.deluge.StatusbarMenu({
id: 'downspeedMenu',
items: [{
id: '5',
@ -337,7 +348,7 @@ Deluge.Menus.Download = new Ext.menu.Menu({
}]
});
Deluge.Menus.Upload = new Ext.menu.Menu({
Deluge.Menus.Upload = new Ext.deluge.StatusbarMenu({
id: 'upspeedMenu',
items: [{
id: '5',
@ -414,7 +425,7 @@ Deluge.Menus.FilePriorities = new Ext.menu.Menu({
});
function onLimitChanged(item, checked) {
/*if (item.id == "other") {
if (item.id == "other") {
} else {
config = {}
config[item.group] = item.id
@ -423,5 +434,5 @@ function onLimitChanged(item, checked) {
Deluge.UI.update();
}
});
}*/
}
}

View File

@ -131,18 +131,10 @@
});
this.items.get('statusbar-dht').setText(stats.dht_nodes);
function updateMenu(menu, stat) {
var item = menu.items.get(stat)
if (!item) {
item = menu.items.get('other')
}
item.setChecked(true);
}
updateMenu(Deluge.Menus.Connections, stats.max_num_connections);
updateMenu(Deluge.Menus.Download, stats.max_download);
updateMenu(Deluge.Menus.Upload, stats.max_upload);
Deluge.Menus.Connections.setValue(stats.max_num_connections);
Deluge.Menus.Download.setValue(stats.max_download);
Deluge.Menus.Upload.setValue(stats.max_upload);
}
});
Deluge.Statusbar = new Ext.deluge.Statusbar();