fix setting bandwidth limits via the statusbar
This commit is contained in:
parent
da2a7ef138
commit
21701cb096
|
@ -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',
|
id: 'connectionsMenu',
|
||||||
items: [{
|
items: [{
|
||||||
id: '50',
|
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',
|
id: 'downspeedMenu',
|
||||||
items: [{
|
items: [{
|
||||||
id: '5',
|
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',
|
id: 'upspeedMenu',
|
||||||
items: [{
|
items: [{
|
||||||
id: '5',
|
id: '5',
|
||||||
|
@ -414,7 +425,7 @@ Deluge.Menus.FilePriorities = new Ext.menu.Menu({
|
||||||
});
|
});
|
||||||
|
|
||||||
function onLimitChanged(item, checked) {
|
function onLimitChanged(item, checked) {
|
||||||
/*if (item.id == "other") {
|
if (item.id == "other") {
|
||||||
} else {
|
} else {
|
||||||
config = {}
|
config = {}
|
||||||
config[item.group] = item.id
|
config[item.group] = item.id
|
||||||
|
@ -423,5 +434,5 @@ function onLimitChanged(item, checked) {
|
||||||
Deluge.UI.update();
|
Deluge.UI.update();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}*/
|
}
|
||||||
}
|
}
|
|
@ -132,17 +132,9 @@
|
||||||
|
|
||||||
this.items.get('statusbar-dht').setText(stats.dht_nodes);
|
this.items.get('statusbar-dht').setText(stats.dht_nodes);
|
||||||
|
|
||||||
function updateMenu(menu, stat) {
|
Deluge.Menus.Connections.setValue(stats.max_num_connections);
|
||||||
var item = menu.items.get(stat)
|
Deluge.Menus.Download.setValue(stats.max_download);
|
||||||
if (!item) {
|
Deluge.Menus.Upload.setValue(stats.max_upload);
|
||||||
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.Statusbar = new Ext.deluge.Statusbar();
|
Deluge.Statusbar = new Ext.deluge.Statusbar();
|
||||||
|
|
Loading…
Reference in New Issue