feat: Remove unused options and clean up code in RaidTimeline and MapOverlay modules

This commit is contained in:
Torsten Brendgen
2026-04-16 11:11:12 +02:00
parent dca24c77c9
commit af16ab1c0c
4 changed files with 35 additions and 30 deletions

View File

@@ -8,6 +8,7 @@ if not HMGT_Config or not HMGT_Config.RegisterOptionsProvider then return end
local L = LibStub("AceLocale-3.0"):GetLocale(ADDON_NAME, true) or {}
local AceConfigRegistry = LibStub("AceConfigRegistry-3.0")
local AceConfigDialog = LibStub("AceConfigDialog-3.0", true)
local LSM = LibStub("LibSharedMedia-3.0", true)
local FONT_OUTLINE_VALUES = {
@@ -43,6 +44,15 @@ local function Notify(rebuild)
AceConfigRegistry:NotifyChange(ADDON_NAME)
end
local function SelectRaidTimelineGeneral()
if not AceConfigDialog or type(AceConfigDialog.SelectGroup) ~= "function" then
return
end
pcall(function()
AceConfigDialog:SelectGroup(ADDON_NAME, "modules", "raidTimeline", "general")
end)
end
local function GetDrafts()
HMGT._raidTimelineDraft = HMGT._raidTimelineDraft or {
addEncounterId = "",
@@ -523,13 +533,9 @@ local function BuildEncounterDetailGroup(encounterId)
diffOrder = diffOrder + 0.01
end
args.openTimelineEditor = {
type = "execute", order = 7, width = "full", name = L["OPT_RT_OPEN_EDITOR"] or "Open timeline",
func = function() if RT.OpenTimelineEditor then RT:OpenTimelineEditor(encounterId) end end,
}
args.runTest = {
type = "execute",
order = 7.5,
order = 7,
width = "full",
name = function()
if RT:IsTestRunning(encounterId) then
@@ -549,19 +555,19 @@ local function BuildEncounterDetailGroup(encounterId)
}
args.testHint = {
type = "description",
order = 7.6,
order = 7.1,
width = "full",
name = L["OPT_RT_TEST_HINT"] or "Runs the encounter timeline outside of combat so you can verify assignments, whispers and debug output.",
}
args.editorHint = {
type = "description", order = 8, width = "full",
name = L["OPT_RT_TIMELINE_HINT"] or "Click the bar to add a cooldown. Drag markers horizontally to change the time. Mousewheel scrolls, Ctrl+Mousewheel zooms.",
}
args.encounterDelete = {
type = "execute", order = 9, width = "full", name = DELETE or "Delete",
type = "execute", order = 8, width = "full", name = DELETE or "Delete",
disabled = function() return not RT:IsLocalEditor() end,
confirm = function() return string.format(L["OPT_RT_DELETE_ENCOUNTER_CONFIRM"] or "Delete raid timeline for encounter %d?", tonumber(encounterId) or 0) end,
func = function() RT:RemoveEncounter(encounterId); Notify(true) end,
func = function()
RT:RemoveEncounter(encounterId)
Notify(true)
SelectRaidTimelineGeneral()
end,
}
args.entryBreak = { type = "description", order = 10, width = "full", name = " " }
@@ -569,7 +575,14 @@ local function BuildEncounterDetailGroup(encounterId)
args[key] = value
end
return { type = "group", name = GetBossTreeLabel(encounterId), args = args }
return {
type = "group",
name = GetBossTreeLabel(encounterId),
hidden = function()
return RT:GetEncounter(encounterId) == nil
end,
args = args,
}
end
local function BuildRaidTreeArgs()
@@ -679,34 +692,33 @@ function RT:GetOptionsGroup()
set = function(_, val)
RT:GetSettings().unlocked = val and true or false
RT:ApplyAlertStyle()
if val then RT:ShowPreview() end
if val then
RT:ShowPreview()
else
RT:HideAlert()
end
end,
},
preview = {
type = "toggle", order = 5, width = "double", name = L["OPT_RT_PREVIEW"] or "Preview alert",
get = function() return RT.previewAlertActive == true end,
set = function(_, val) if val then RT:ShowPreview() else RT:HideAlert() end end,
},
alertFont = {
type = "select", order = 6, width = 1.4, name = L["OPT_FONT"] or "Typeface",
type = "select", order = 5, width = 1.4, name = L["OPT_FONT"] or "Typeface",
dialogControl = "LSM30_Font",
values = AceGUIWidgetLSMlists and AceGUIWidgetLSMlists.font or (LSM and LSM:HashTable("font")) or {},
get = function() return RT:GetSettings().alertFont or "Friz Quadrata TT" end,
set = function(_, val) RT:GetSettings().alertFont = val; RT:ApplyAlertStyle() end,
},
alertFontSize = {
type = "range", order = 7, min = 10, max = 72, step = 1, width = 1.0, name = L["OPT_FONT_SIZE"] or "Font size",
type = "range", order = 6, min = 10, max = 72, step = 1, width = 1.0, name = L["OPT_FONT_SIZE"] or "Font size",
get = function() return tonumber(RT:GetSettings().alertFontSize) or 30 end,
set = function(_, val) RT:GetSettings().alertFontSize = math.floor((tonumber(val) or 30) + 0.5); RT:ApplyAlertStyle() end,
},
alertFontOutline = {
type = "select", order = 8, width = 1.0, name = L["OPT_FONT_OUTLINE"] or "Font outline",
type = "select", order = 7, width = 1.0, name = L["OPT_FONT_OUTLINE"] or "Font outline",
values = FONT_OUTLINE_VALUES,
get = function() return RT:GetSettings().alertFontOutline or "OUTLINE" end,
set = function(_, val) RT:GetSettings().alertFontOutline = val; RT:ApplyAlertStyle() end,
},
alertColor = {
type = "color", order = 9, width = 0.8, name = L["OPT_RT_ALERT_COLOR"] or "Text colour", hasAlpha = true,
type = "color", order = 8, width = 0.8, name = L["OPT_RT_ALERT_COLOR"] or "Text colour", hasAlpha = true,
get = function()
local color = RT:GetSettings().alertColor or {}
return color.r or 1, color.g or 0.82, color.b or 0.15, color.a or 1