view AfterOptions.lua @ 13:3a5816741bcb tip

Added tag v1.0Release for changeset 2761550de087
author wobin
date Sun, 20 Dec 2009 22:29:05 +1100
parents f601b8507480
children
line wrap: on
line source
local AddonName, AfterDark = ...
local AceDialog 
local L = AfterDark.L

local function loadToasterOptions()
	options.args.general = {
		order = 1,
		type = "group",
		name = L["General"],
		set = function(info, value) AfterDark.db.profile[info[#info]] = value end,
		get = function(info) return AfterDark.db.profile[info[#info]] end,
		args = {
					Darkness = {
						order = 1,
						type = "range",
						name = L["Darkness"],
						desc = L["How well done you want your toast"],
						min = 0, max = 1,
					},
					Music = {
						order = 2,
						type = "select",
						name = L["Music"],
						values = { ["Anthem"] = L["Anthem of the Flying Toasters"], ["Ride"]  = L["Ride of the Valkyries"], ["zRandom"] = L["Both"] },
						style = "dropdown",
						width = "double"
					},
					Busy = {
						order = 3,
						type = "range",
						name = L["Busy"],
						desc = L["How busy do you want it?"],
						min = 10, max = 120, step = 1,
						width = "full"
					},
					Speed = {
						order = 4,
						type = "range",
						name = L["Speed"],
						desc = L["Do you feel... the Need for Speed?"],
						min = 1, max = 30, step = 1,
						width = "full"
					}
				}
			}
end

local function loadOptions()
	options = {
		type = "group",
		name = "After Dark",
		childGroups = "tab",
		args = {}
	}
	loadToasterOptions()
end


SLASH_AFTERDARK1 = "/afterdark"
SLASH_AFTERDARK2 = "/ad"

SlashCmdList["AFTERDARK"] = function(msg)
	InterfaceOptionsFrame_OpenToCategory(AfterDark.Config)
end

function AfterDark:SetupOptions()
	if not AceDialog then
		loadOptions()

		AceDialog = LibStub("AceConfigDialog-3.0")
		LibStub("AceConfig-3.0"):RegisterOptionsTable("AfterDark", options)
		AfterDark.Config = AceDialog:AddToBlizOptions("AfterDark", "After Dark", nil, 'general') 
	end
end