@@ -135,13 +135,12 @@ function Config:Init()
135135 Settings .VarType .String
136136 );
137137 do
138- local expandInitializer , isExpanded = self :MakeExpandableSection (" Displayed Classes" )
138+ local expandInitializer , isExpanded = self :MakeExpandableSection (layout , " Displayed Classes" )
139139
140140 local function isVisible ()
141141 return self .db .showWarbandCatalystInfoModifierKey ~= self .modifierKeyOptions .never ;
142142 end
143143 expandInitializer :AddShownPredicate (isVisible );
144- layout :AddInitializer (expandInitializer );
145144
146145 local tooltip = " If checked, the tooltip will show the Catalyst information for %s for warbound or BoE items."
147146 for classID = 1 , GetNumClasses () do
@@ -171,9 +170,9 @@ function Config:Init()
171170 defaults .autoConfirmCatalyst ,
172171 " Automatically confirm the popup window when you try to Catalyse an item." ,
173172 {
174- { text = " Never" , label = " Never " , tooltip = " Never auto-confirm." , value = self .autoConfirmCatalystOptions .never , },
175- { text = " Previous Season" , label = " Previous Season " , tooltip = " Auto-confirm for items from previous seasons that are free." , value = self .autoConfirmCatalystOptions .previousSeason , },
176- { text = " Always" , label = " Always " , tooltip = " Always auto-confirm, even if there are limited charges." , value = self .autoConfirmCatalystOptions .always , },
173+ { text = " Never" , tooltip = " Never auto-confirm." , value = self .autoConfirmCatalystOptions .never , },
174+ { text = " Previous Season" , tooltip = " Auto-confirm for items from previous seasons that are free." , value = self .autoConfirmCatalystOptions .previousSeason , },
175+ { text = " Always" , tooltip = " Always auto-confirm, even if there are limited charges." , value = self .autoConfirmCatalystOptions .always , },
177176 },
178177 Settings .VarType .String
179178 )
@@ -238,7 +237,7 @@ function Config:MakeCheckbox(category, label, settingKey, defaultValue, tooltip,
238237 return Settings .CreateCheckbox (category , setting , tooltip );
239238end
240239
241- --- @alias TUMDropDownOptions { text : string , label : string , tooltip : string , value : any } []
240+ --- @alias TUMDropDownOptions { text : string , label : string ? , tooltip : string ? , value : any } []
242241
243242--- @param options TUMDropDownOptions | fun (): TUMDropDownOptions
244243--- @param varType " string" | " number" | " boolean" # one of Settings.VarType
@@ -250,11 +249,19 @@ function Config:MakeDropdown(category, label, settingKey, defaultValue, tooltip,
250249 if type (options ) == " table" then
251250 GetOptions = function () return options ; end
252251 end
252+ local function wrapper ()
253+ local opts = GetOptions ();
254+ for _ , option in pairs (opts ) do
255+ option .label = option .label or option .text ;
256+ end
257+
258+ return opts ;
259+ end
253260
254261 local setting = Settings .RegisterAddOnSetting (category , variable , settingKey , self .db , varType , label , defaultValue );
255262 setting :SetValueChangedCallback (function (setting , value ) self :OnSettingChange (setting :GetVariable (), value ) end );
256263
257- return Settings .CreateDropdown (category , setting , GetOptions , tooltip );
264+ return Settings .CreateDropdown (category , setting , wrapper , tooltip );
258265end
259266
260267--- @return SettingsListElementInitializer
@@ -271,10 +278,11 @@ function Config:MakeButton(category, layout, label, onClick, tooltip)
271278 return initializer ;
272279end
273280
281+ --- @param layout SettingsVerticalLayoutMixin
274282--- @param sectionName string
275283--- @return SettingsExpandableSectionInitializer initializer
276284--- @return fun (): boolean isExpanded
277- function Config :MakeExpandableSection (sectionName )
285+ function Config :MakeExpandableSection (layout , sectionName )
278286 local expandInitializer = CreateSettingsExpandableSectionInitializer (sectionName );
279287 function expandInitializer :GetExtent ()
280288 return 25 ;
@@ -298,6 +306,7 @@ function Config:MakeExpandableSection(sectionName)
298306 return initializer :GetExtent ();
299307 end
300308 end );
309+ layout :AddInitializer (expandInitializer );
301310
302311 return expandInitializer , function () return expandInitializer .data .expanded ; end ;
303312end
@@ -307,16 +316,10 @@ function Config:OnSettingChange(setting, value)
307316end
308317
309318---- ---------------
310- --- @class TransmogUpgradeMaster_SettingsButtonControlMixin : SettingsControlMixin
319+ --- @class TransmogUpgradeMaster_SettingsButtonControlMixin : SettingsListElementTemplate , SettingsControlMixin
311320TransmogUpgradeMaster_SettingsButtonControlMixin = CreateFromMixins (SettingsControlMixin );
312321do
313322 local mixin = TransmogUpgradeMaster_SettingsButtonControlMixin ;
314- function mixin :OnLoad ()
315- SettingsControlMixin .OnLoad (self );
316- self .Button = CreateFrame (" Button" , nil , self , " UIPanelButtonTemplate" );
317- self .Button :SetSize (200 , 26 );
318- self .Button :SetPoint (" LEFT" , self , " CENTER" , - 80 , 0 );
319- end
320323
321324 function mixin :Init (initializer )
322325 SettingsControlMixin .Init (self , initializer );
0 commit comments