Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -17,6 +17,9 @@ function HMGT_Config:RegisterOptionsProvider(id, provider)
|
||||
if type(id) ~= "string" or id == "" then return false end
|
||||
if type(provider) ~= "function" then return false end
|
||||
self._optionProviders[id] = provider
|
||||
if type(self.RebuildRootOptions) == "function" then
|
||||
self:RebuildRootOptions()
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -1933,6 +1936,7 @@ function HMGT_Config:Initialize()
|
||||
"|cffffd100/hmgt|r",
|
||||
"|cffffd100/hmgt debug|r",
|
||||
"|cffffd100/hmgt status|r",
|
||||
"|cffffd100/hmgt lura|r",
|
||||
"|cffffd100/hmgt version|r",
|
||||
}, "\n"),
|
||||
},
|
||||
@@ -2083,6 +2087,15 @@ function HMGT_Config:Initialize()
|
||||
modulesGroup.args.raidTimeline = raidTimelineGroup
|
||||
end
|
||||
|
||||
local encounterAlertsGroup = BuildNamedModuleGroup(
|
||||
"encounterAlerts",
|
||||
L["OPT_MODULE_ENCOUNTER_ALERTS"] or "Encounter Alerts",
|
||||
50
|
||||
)
|
||||
if encounterAlertsGroup then
|
||||
modulesGroup.args.encounterAlerts = encounterAlertsGroup
|
||||
end
|
||||
|
||||
if next(modulesGroup.args) == nil then
|
||||
return nil
|
||||
end
|
||||
@@ -2120,12 +2133,20 @@ function HMGT_Config:Initialize()
|
||||
},
|
||||
}
|
||||
|
||||
local modulesGroup = BuildModulesGroup()
|
||||
if modulesGroup then
|
||||
rootOptions.args.modules = modulesGroup
|
||||
function HMGT_Config:RebuildRootOptions()
|
||||
local modulesGroup = BuildModulesGroup()
|
||||
if modulesGroup then
|
||||
rootOptions.args.modules = modulesGroup
|
||||
else
|
||||
rootOptions.args.modules = nil
|
||||
end
|
||||
NormalizeExecuteButtonWidths(rootOptions)
|
||||
if AceConfigRegistry and type(AceConfigRegistry.NotifyChange) == "function" then
|
||||
AceConfigRegistry:NotifyChange(ADDON_NAME)
|
||||
end
|
||||
end
|
||||
|
||||
NormalizeExecuteButtonWidths(rootOptions)
|
||||
HMGT_Config:RebuildRootOptions()
|
||||
|
||||
local aceConfig = LibStub("AceConfig-3.0")
|
||||
local aceConfigDialog = LibStub("AceConfigDialog-3.0")
|
||||
|
||||
Reference in New Issue
Block a user