diff --git a/src/webui/btjson.cpp b/src/webui/btjson.cpp index 7d4acc167..d5deb38cf 100644 --- a/src/webui/btjson.cpp +++ b/src/webui/btjson.cpp @@ -146,6 +146,7 @@ static const char KEY_TRANSFER_CONNECTION_STATUS[] = "connection_status"; // Sync main data keys static const char KEY_SYNC_MAINDATA_QUEUEING[] = "queueing"; +static const char KEY_SYNC_MAINDATA_USE_ALT_SPEED_LIMITS[] = "use_alt_speed_limits"; static const char KEY_FULL_UPDATE[] = "full_update"; static const char KEY_RESPONSE_ID[] = "rid"; @@ -333,6 +334,7 @@ QByteArray btjson::getSyncMainData(int acceptedResponseId, QVariantMap &lastData QVariantMap serverState = getTranserInfoMap(); serverState[KEY_SYNC_MAINDATA_QUEUEING] = QBtSession::instance()->isQueueingEnabled(); + serverState[KEY_SYNC_MAINDATA_USE_ALT_SPEED_LIMITS] = Preferences::instance()->isAltBandwidthEnabled(); data["server_state"] = serverState; return json::toJson(generateSyncData(acceptedResponseId, data, lastAcceptedData, lastData)); diff --git a/src/webui/www/public/scripts/client.js b/src/webui/www/public/scripts/client.js index 8f34665a3..4f84ea7ed 100644 --- a/src/webui/www/public/scripts/client.js +++ b/src/webui/www/public/scripts/client.js @@ -222,6 +222,11 @@ window.addEvent('load', function () { $('queueingMenuItems').addClass('invisible'); } } + + if (alternativeSpeedLimits != serverState.use_alt_speed_limits) { + alternativeSpeedLimits = serverState.use_alt_speed_limits; + updateAltSpeedIcon(alternativeSpeedLimits); + } }; var updateAltSpeedIcon = function(enabled) { @@ -231,16 +236,6 @@ window.addEvent('load', function () { $('alternativeSpeedLimits').src = "images/slow_off.png" } - // Determine whether the alternative speed limits are enabled or not - new Request({url: 'command/alternativeSpeedLimitsEnabled', - method: 'get', - onSuccess : function (isEnabled) { - alternativeSpeedLimits = !!parseInt(isEnabled); - if (alternativeSpeedLimits) - $('alternativeSpeedLimits').src = "images/slow.png" - } - }).send(); - $('alternativeSpeedLimits').addEvent('click', function() { // Change icon immediately to give some feedback updateAltSpeedIcon(!alternativeSpeedLimits);