Quantcast

Save debug flags in the profile to persist them across sessions.

Johnny C. Lam [02-09-13 - 07:02]
Save debug flags in the profile to persist them across sessions.

Remove "debugflags" and "toggledebug" command actions since the flags are
toggled and saved from the main Ovale options panel.

Rename "debug" command action to "power".

Use "debug" commnd action to open the Ovale debug options panel.

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@682 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
Ovale.lua
OvaleOptions.lua
diff --git a/Ovale.lua b/Ovale.lua
index cf2cf21..bedb986 100644
--- a/Ovale.lua
+++ b/Ovale.lua
@@ -51,8 +51,6 @@ Ovale.compileOnStances = false
 Ovale.combatStartTime = nil
 Ovale.needCompile = false
 Ovale.listes = {}
---debug flags
-Ovale.debugFlags = {}
 --</public-static-properties>

 --Key bindings
@@ -65,7 +63,8 @@ BINDING_NAME_OVALE_CHECKBOX4 = L["Inverser la boîte à cocher "].."(5)"

 --<public-static-methods>
 function Ovale:debugPrint(flag, ...)
-	if self.debugFlags[flag] then
+	local profile = OvaleOptions:GetProfile()
+	if profile and profile.debug and profile.debug[flag] then
 		self:Print("[" .. flag .. "]", ...)
 	end
 end
diff --git a/OvaleOptions.lua b/OvaleOptions.lua
index a1cc6c1..74a267d 100644
--- a/OvaleOptions.lua
+++ b/OvaleOptions.lua
@@ -1,6 +1,6 @@
 --[[--------------------------------------------------------------------
     Ovale Spell Priority
-    Copyright (C) 2012 Sidoine
+    Copyright (C) 2012, 2013 Sidoine, Johnny C. Lam

     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License in the LICENSE
@@ -307,6 +307,30 @@ local options =
 				}
 			}
 		},
+		debug =
+		{
+			name = "Debug",
+			type = "group",
+			args =
+			{
+				debug =
+				{
+					type = "multiselect",
+					name = "Debug",
+					values =
+					{
+						["aura"] = L["Debug aura"],
+						["compile"] = L["Debug compile"],
+						["enemy"] = L["Debug enemies"],
+						["guid"] = L["Debug GUID"],
+						["missing_spells"] = L["Debug missing spells"],
+						["unknown_spells"] = L["Debug unknown spells"],
+					},
+					get = function(info, key) return OvaleOptions.db.profile.debug[key] end,
+					set = function(info, key, state) OvaleOptions.db.profile.debug[key] = state end,
+				}
+			},
+		},
 		actions =
 		{
 			name = "Actions",
@@ -349,47 +373,20 @@ local options =
 				},
 				debug =
 				{
-					order = -3,
 					name = "Debug",
 					type = "execute",
-					func = function()
-						for i=1,10 do Ovale:Print(i.."="..UnitPower("player", i)) end
-						Ovale:Print(OvaleState.state.eclipse)
-					end
+					func = function() AceConfigDialog:SetDefaultSize("Ovale", 500, 550); AceConfigDialog:Open("Ovale Debug") end
 				},
-				debugflags =
+				power =
 				{
-					name = "List debug flags",
+					order = -3,
+					name = "Power",
 					type = "execute",
-					func = function()
-						local flags
-						for flag in pairs(Ovale.debugFlags) do
-							if flags then
-								flags = flags .. ", " .. flag
-							else
-								flags = flag
-							end
-						end
-						if flags then
-							Ovale:Print(flags)
-						end
+					func = function()
+						for i=1,10 do Ovale:Print(i.."="..UnitPower("player", i)) end
+						Ovale:Print(OvaleState.state.eclipse)
 					end
 				},
-				toggledebug =
-				{
-					name = "Toggle debug flag",
-					type = "input",
-					set = function(info, value)
-						for flag in strgmatch(value, "[%w_]+") do
-							if Ovale.debugFlags[flag] then
-								Ovale.debugFlags[flag] = nil
-							else
-								Ovale.debugFlags[flag] = true
-							end
-						end
-					end,
-					get = nil,
-				},
 				talent =
 				{
 					order = -4,
@@ -471,6 +468,7 @@ function OvaleOptions:FirstInit()
 			top = 500,
 			check = {},
 			list = {},
+			debug = {},
 			apparence = {enCombat=false, iconScale = 2, secondIconScale = 1, margin = 4, fontScale = 0.5, iconShiftX = 0, iconShiftY = 0,
 				smallIconScale=1, raccourcis=true, numeric=false, avecCible = false,
 				verrouille = false, vertical = false, predictif=false, highlightIcon = true, clickThru = false,
@@ -484,10 +482,12 @@ function OvaleOptions:FirstInit()
 	AceConfig:RegisterOptionsTable("Ovale Actions", options.args.actions, "Ovale")
 	AceConfig:RegisterOptionsTable("Ovale Profile", options.args.profile)
 	AceConfig:RegisterOptionsTable("Ovale Apparence", options.args.apparence)
+	AceConfig:RegisterOptionsTable("Ovale Debug", options.args.debug)

 	AceConfigDialog:AddToBlizOptions("Ovale", "Ovale")
 	AceConfigDialog:AddToBlizOptions("Ovale Profile", "Profile", "Ovale")
 	AceConfigDialog:AddToBlizOptions("Ovale Apparence", "Apparence", "Ovale")
+	AceConfigDialog:AddToBlizOptions("Ovale Debug", "Debug", "Ovale")

 	self.db.RegisterCallback( self, "OnNewProfile", "HandleProfileChanges" )
 	self.db.RegisterCallback( self, "OnProfileReset", "HandleProfileChanges" )