addon/Addon/Frames/Settings/OptionsSpeechFrame.lua

102 lines
4.7 KiB
Lua
Raw Normal View History

function CzechQuestsAddon:AddSpeechOptions(category, layout)
-- Enable translations
local enableCheckbox = Settings.RegisterAddOnSetting(
category,
"CzechQuestsAddon__TRANSLATION_SPEECH_FRAME_ENABLED",
"TRANSLATION_SPEECH_FRAME_ENABLED",
CzechQuestsAddon_Store.config,
type(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_ENABLED),
"Zapnout *",
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_ENABLED
)
Settings.CreateCheckbox(category, enableCheckbox)
-- Add text font dropdown menu
local textFontFamilyDropdown = Settings.RegisterProxySetting(
category,
"CzechQuestsAddon__TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY",
type(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY),
"Písmo textu *",
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY,
function()
return CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY
end,
function(value)
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY = value
end
)
Settings.CreateDropdown(category, textFontFamilyDropdown, GetFontOptions)
-- Add slider for change secondary header font size
local textFontSizeSlider = Settings.RegisterProxySetting(
category,
"CzechQuestsAddon__TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE",
type(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE),
"Velikost textu *",
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE,
function()
return CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE
end,
function(value)
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE = value
end
)
local textFontSizeSliderOptions = Settings.CreateSliderOptions(8, 30, 1)
textFontSizeSliderOptions:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right);
Settings.CreateSlider(category, textFontSizeSlider, textFontSizeSliderOptions)
-- Add slider for change frame width
local windowWidthSizeSlider = Settings.RegisterProxySetting(
category,
"CzechQuestsAddon__TRANSLATION_SPEECH_FRAME_WIDTH",
type(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH),
"Šírka okna",
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH,
function()
return CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH
end,
function(value)
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH = value
CzechQuestsAddon.translationSpeechFrame:SetWidth(
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH
)
CzechQuestsAddon.translationSpeechFrame.content:SetWidth(
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH
)
end
)
local windowWidthSizeSliderOption = Settings.CreateSliderOptions(200, 1000, 10)
windowWidthSizeSliderOption:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right);
Settings.CreateSlider(category, windowWidthSizeSlider, windowWidthSizeSliderOption)
-- Show original
local originalWhenMissingCheckbox = Settings.RegisterAddOnSetting(
category,
"CzechQuestsAddon__TRANSLATION_SPEECH_FRAME_ORIGINAL_WHEN_MISSING",
"TRANSLATION_SPEECH_FRAME_ORIGINAL_WHEN_MISSING",
CzechQuestsAddon_Store.config,
type(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_ORIGINAL_WHEN_MISSING),
"Original pokud není preklad",
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_ORIGINAL_WHEN_MISSING
)
Settings.CreateCheckbox(category, originalWhenMissingCheckbox)
local initializer= CreateSettingsButtonInitializer(
'Resetovat pozici okna',
'RESET',
function()
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_POSITION = { x = 0, y = 0}
CzechQuestsAddon.translationSpeechFrame:SetPoint(
"TOPLEFT", UIParent, "TOPLEFT",
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_POSITION.x,
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_POSITION.y
)
end,
nil,
"Resetovat pozici okna"
)
layout:AddInitializer(initializer)
end