700445c248
Five Options files seeded their tab tables with { ... } instead of {}.
At chunk scope WoW passes ... = (addonName, addonTable), so each table
got two stray junk entries instead of being empty; { ... } is also a
strict Lua 5.0 parse error. Fixed QuestieOptions.tabs and the Arrow,
General, Keybinds, and Tracker tab tables. Cherry-picked from
phase2-lua50-sweep (the only version-independent fix in that branch).
186 lines
6.2 KiB
Lua
186 lines
6.2 KiB
Lua
---@class QuestieOptions
|
|
local QuestieOptions = QuestieLoader:CreateModule("QuestieOptions");
|
|
-------------------------
|
|
--Import modules.
|
|
-------------------------
|
|
---@type QuestieQuest
|
|
local QuestieQuest = QuestieLoader:ImportModule("QuestieQuest");
|
|
---@type QuestieJourney
|
|
local QuestieJourney = QuestieLoader:ImportModule("QuestieJourney");
|
|
---@type l10n
|
|
local l10n = QuestieLoader:ImportModule("l10n")
|
|
---@type QuestieCombatQueue
|
|
local QuestieCombatQueue = QuestieLoader:ImportModule("QuestieCombatQueue")
|
|
|
|
QuestieOptions.tabs = {}
|
|
QuestieConfigFrame = nil
|
|
|
|
local AceGUI = LibStub("AceGUI-3.0")
|
|
local AceConfigDialog = LibStub("AceConfigDialog-3.0")
|
|
|
|
-- Forward declaration
|
|
local _CreateOptionsTable
|
|
|
|
---Initializes the frames for the options menu
|
|
function QuestieOptions:Initialize()
|
|
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieOptions]: Initializing...")
|
|
|
|
local optionsTable = _CreateOptionsTable()
|
|
|
|
coroutine.yield()
|
|
|
|
LibStub("AceConfig-3.0"):RegisterOptionsTable("Questie", optionsTable)
|
|
AceConfigDialog:AddToBlizOptions("Questie", "Questie");
|
|
|
|
coroutine.yield()
|
|
|
|
---@type AceGUIFrame, AceGUIFrame
|
|
local configFrame = AceGUI:Create("Frame")
|
|
|
|
configFrame:Hide()
|
|
coroutine.yield()
|
|
|
|
AceConfigDialog:SetDefaultSize("Questie", Questie.db.profile.configWidth, Questie.db.profile.configHeight)
|
|
AceConfigDialog:Open("Questie", configFrame) -- load the options into configFrame
|
|
configFrame:SetLayout("Fill")
|
|
configFrame:EnableResize(true)
|
|
QuestieCompat.SetResizeBounds(configFrame.frame, 550, 400)
|
|
|
|
configFrame.frame:HookScript("OnSizeChanged", function(self, width, height)
|
|
Questie.db.profile.configWidth = width
|
|
Questie.db.profile.configHeight = height
|
|
end)
|
|
|
|
configFrame:Hide()
|
|
coroutine.yield()
|
|
|
|
local journeyButton = CreateFrame("Button", nil, configFrame.frame, "UIPanelButtonTemplate")
|
|
journeyButton:SetSize(140, 24)
|
|
journeyButton:SetPoint("TOPRIGHT", configFrame.frame, "TOPRIGHT", -50, -13)
|
|
journeyButton:SetText(l10n('My Journey'))
|
|
journeyButton:SetScript("OnClick", function()
|
|
QuestieCombatQueue:Queue(function()
|
|
QuestieJourney:ToggleJourneyWindow()
|
|
QuestieOptions:OpenConfigWindow()
|
|
end)
|
|
end)
|
|
|
|
configFrame:Hide()
|
|
coroutine.yield()
|
|
|
|
QuestieConfigFrame = configFrame
|
|
table.insert(UISpecialFrames, "QuestieConfigFrame")
|
|
|
|
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieOptions]: Initialization done")
|
|
end
|
|
|
|
-- Generic function to hide the config frame.
|
|
function QuestieOptions:HideFrame()
|
|
if QuestieConfigFrame and QuestieConfigFrame:IsShown() then
|
|
QuestieConfigFrame:Hide();
|
|
end
|
|
end
|
|
|
|
-- Open the configuration window
|
|
function QuestieOptions:OpenConfigWindow()
|
|
if not QuestieConfigFrame then
|
|
return
|
|
end
|
|
if not QuestieConfigFrame:IsShown() then
|
|
PlaySound(882)
|
|
-- AceConfigDialog:Open("Questie", QuestieConfigFrame)
|
|
QuestieConfigFrame:Show()
|
|
else
|
|
QuestieConfigFrame:Hide()
|
|
end
|
|
end
|
|
|
|
-- get option value
|
|
function QuestieOptions:GetProfileValue(info)
|
|
return Questie.db.profile[info[#info]]
|
|
end
|
|
|
|
-- set option value
|
|
function QuestieOptions:SetProfileValue(info, value)
|
|
local key = info[#info]
|
|
if debug and Questie.db.profile[key] ~= value then
|
|
Questie:Debug(Questie.DEBUG_SPAM, "DEBUG: global option", key, "changed from '" .. tostring(Questie.db.profile[key]) .. "' to '" .. tostring(value) .. "'")
|
|
end
|
|
Questie.db.profile[key] = value
|
|
|
|
if key == "minimapIconRangeCutoff" then
|
|
local QuestieMap = QuestieLoader:ImportModule("QuestieMap")
|
|
if QuestieMap and QuestieMap.RefreshMinimapIconVisibility then
|
|
QuestieMap:RefreshMinimapIconVisibility()
|
|
end
|
|
end
|
|
end
|
|
|
|
function QuestieOptions:ClusterRedraw()
|
|
Questie:Debug(Questie.DEBUG_INFO, "Clustering changed, redrawing!")
|
|
-- Cluster-only changes don't depend on quest log state — skip the
|
|
-- TestGameCache wait and draw-queue drain that SmoothReset does.
|
|
QuestieQuest:SmoothReset({ skipCacheTest = true })
|
|
end
|
|
|
|
---@return table
|
|
_CreateOptionsTable = function()
|
|
local general_tab = QuestieOptions.tabs.general:Initialize()
|
|
coroutine.yield()
|
|
--local social_tab = QuestieOptions.tabs.social:Initialize()
|
|
--coroutine.yield()
|
|
--local minimap_tab = QuestieOptions.tabs.minimap:Initialize()
|
|
--coroutine.yield()
|
|
--local map_tab = QuestieOptions.tabs.map:Initialize()
|
|
--coroutine.yield()
|
|
local icons_tab = QuestieOptions.tabs.icons:Initialize()
|
|
coroutine.yield()
|
|
local arrow_tab = QuestieOptions.tabs.arrow:Initialize()
|
|
coroutine.yield()
|
|
local tracker_tab = QuestieOptions.tabs.tracker:Initialize()
|
|
coroutine.yield()
|
|
local auto_tab = QuestieOptions.tabs.auto:Initialize()
|
|
coroutine.yield()
|
|
--local tooltip_tab = QuestieOptions.tabs.tooltip:Initialize()
|
|
--coroutine.yield()
|
|
--local sounds_tab = QuestieOptions.tabs.sounds:Initialize()
|
|
--coroutine.yield()
|
|
local nameplate_tab = QuestieOptions.tabs.nameplate:Initialize()
|
|
coroutine.yield()
|
|
local dbm_hud_tab = QuestieOptions.tabs.dbm:Initialize()
|
|
coroutine.yield()
|
|
local advanced_tab = QuestieOptions.tabs.advanced:Initialize()
|
|
coroutine.yield()
|
|
local database_tab = QuestieOptions.tabs.database:Initialize()
|
|
coroutine.yield()
|
|
local credits_tab = QuestieOptions.tabs.credits:Initialize()
|
|
coroutine.yield()
|
|
local keybinds_tab = QuestieOptions.tabs.keybinds:Initialize()
|
|
coroutine.yield()
|
|
return {
|
|
name = "Questie",
|
|
handler = Questie,
|
|
type = "group",
|
|
childGroups = "tab",
|
|
args = {
|
|
general_tab = general_tab,
|
|
--social_tab = social_tab,
|
|
--minimap_tab = minimap_tab,
|
|
--map_tab = map_tab,
|
|
icons_tab = icons_tab,
|
|
arrow_tab = arrow_tab,
|
|
tracker_tab = tracker_tab,
|
|
auto_tab = auto_tab,
|
|
--tooltip_tab = tooltip_tab,
|
|
--sounds_tab = sounds_tab,
|
|
nameplate_tab = nameplate_tab,
|
|
dbm_hud_tab = dbm_hud_tab,
|
|
advanced_tab = advanced_tab,
|
|
database_tab = database_tab,
|
|
credits_tab = credits_tab,
|
|
keybinds_tab = keybinds_tab,
|
|
profiles_tab = LibStub("AceDBOptions-3.0"):GetOptionsTable(Questie.db)
|
|
}
|
|
}
|
|
end
|