Quantcast
local addonName, addon = ...
local options = addon:NewModule("Options")
local L = LibStub("AceLocale-3.0"):GetLocale(addonName)

LibStub("Libra"):EmbedWidgets(options)

function options:OnInitialize()
	local options = self:CreateOptionsFrame(addon.name)
	options:SetDescription(GetAddOnMetadata(addonName, "Notes"))

	options:CreateOptions({
		{
			type = "Dropdown",
			text = L["Use Class Colors"],
			get = function()
				return addon.db.profile.useClassColors
			end,
			set = function(_, value)
				addon.db.profile.useClassColors = value
			end,
			menuList = {
				"None",
				"Target",
				"Player",
				"Target or Player"
			}
		},
		{
			type = "Dropdown",
			text = L["Icon Position"],
			get = function()
				return addon.db.profile.iconPosition
			end,
			set = function(_, value)
				addon.db.profile.iconPosition = value
			end,
			menuList = {
				"Left",
				"Right"
			}
		},
		{
			type = "CheckButton",
			text = L["Hide Icon"],
			get = function()
				return addon.db.profile.hideIcon
			end,
			set = function()
				addon.db.profile.hideIcon = not addon.db.profile.hideIcon
			end
		},
		{
			type = "Dropdown",
			text = L["Time Position"],
			get = function()
				return addon.db.profile.timePosition
			end,
			set = function(_, value)
				addon.db.profile.timePosition = value
			end,
			menuList = {
				"Outer Left",
				"Outer Right",
				"Inner Left",
				"Inner Right",
				"Top Left",
				"Top Right",
				"Bottom Left",
				"Bottom Right"
			}
		},
		{
			type = "CheckButton",
			text = L["Hide Total Time"],
			get = function()
				return addon.db.profile.hideTotalTime
			end,
			set = function()
				addon.db.profile.hideTotalTime = not addon.db.profile.hideTotalTime
			end
		},
		{
			type = "CheckButton",
			text = L["Hide Time"],
			get = function()
				return addon.db.profile.hideTime
			end,
			set = function()
				addon.db.profile.hideTime = not addon.db.profile.hideTime
			end
		}
	})

	local profiles = options:AddSubCategory(L["Profiles"])
    profiles:SetDescription(L["You can change the active database profile, so you can have different settings for every character."])

    local frame = LibStub("Libra"):CreateAceDBControls(addon.db, profiles)

    frame:SetPoint("TOP", -100, -100);

	options:SetupControls()
end