Quantcast

Fix ticket 264 - update throttling functionality

Johnny C. Lam [07-19-13 - 05:33]
Fix ticket 264 - update throttling functionality

Missed changes in r758 that broke the existing throttling code. This makes
the "update interval" option work again, defaulting to 0.1s == 100ms.

Expose option to set the update interval to throttle the refresh rate.

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@975 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
OvaleFrame.lua
OvaleOptions.lua
diff --git a/OvaleFrame.lua b/OvaleFrame.lua
index 7b2c9be..287beb3 100644
--- a/OvaleFrame.lua
+++ b/OvaleFrame.lua
@@ -157,6 +157,7 @@ do
 	local function OnUpdate(self)
 		-- Update current time.
 		Ovale.now = API_GetTime()
+		local now = Ovale.now

 		local profile = OvaleOptions:GetProfile()
 		local forceRefresh = not self.lastUpdate or (now > self.lastUpdate + profile.apparence.updateInterval)
diff --git a/OvaleOptions.lua b/OvaleOptions.lua
index 9df1d0f..502264d 100644
--- a/OvaleOptions.lua
+++ b/OvaleOptions.lua
@@ -202,7 +202,17 @@ local self_options =
 							desc = L["Ce caractère est affiché dans un coin de l'icône pour indiquer si la cible est à portée"],
 							get = function(info) return OvaleOptions.db.profile.apparence.targetText end,
 							set = function(info, value) OvaleOptions.db.profile.apparence.targetText = value; Ovale:UpdateFrame() end
-						}
+						},
+						updateInterval =
+						{
+							order = 100,
+							type = "range",
+							name = "Update interval",
+							desc = "Maximum time to wait (in milliseconds) before refreshing icons.",
+							min = 0, max = 500, step = 10,
+							get = function(info) return OvaleOptions.db.profile.apparence.updateInterval * 1000 end,
+							set = function(info, value) OvaleOptions.db.profile.apparence.updateInterval = value / 1000; Ovale:UpdateFrame() end
+						},
 					},
 				},
 				iconGroupAppearance =