Quantcast
--[[
	Copyright (c) 2014 Eyal Shilony <Lynxium>

	Permission is hereby granted, free of charge, to any person obtaining
	a copy of this software and associated documentation files (the
	"Software"), to deal in the Software without restriction, including
	without limitation the rights to use, copy, modify, merge, publish,
	distribute, sublicense, and/or sell copies of the Software, and to
	permit persons to whom the Software is furnished to do so, subject to
	the following conditions:

	The above copyright notice and this permission notice shall be
	included in all copies or substantial portions of the Software.

	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
	EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
	MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
	NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
	LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
	OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
	WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
]]

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["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 = {
				"Outside Left",
				"Outside Right",
				"Inside Left",
				"Inside Right"
			}
		},
		{
			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
		}
	})

	options:SetupControls()
end