Add Delete Profile button with confirmation, hide CoAMultiCastActionBarFrame
- Add CoAMultiCastActionBarFrame to HideCoA.FRAMES so it gets a checkbox in both the Classes and Character Override tabs automatically. - Add a Delete Profile button next to the override profile dropdown, disabled for the currently logged character's own profile (with an explanatory text shown below the row in that case). - Confirm deletion via a StaticPopupDialog before removing a profile. - Revert the Classes tab box backdrop under ElvUI back to the original borderless style; keep the new bordered style for the non-ElvUI case.
This commit is contained in:
@@ -30,6 +30,7 @@ HideCoA.FRAMES = {
|
||||
"CoAResourceSegmentBar",
|
||||
"CoAResourceOrb",
|
||||
"CoAResourceBar",
|
||||
"CoAMultiCastActionBarFrame",
|
||||
}
|
||||
|
||||
local function CreateDefaultClassSettings()
|
||||
|
||||
+71
-10
@@ -41,8 +41,6 @@ local title = panel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
||||
title:SetPoint("TOPLEFT", 16, -16)
|
||||
title:SetText("HideCoAUI")
|
||||
|
||||
local titleFont, titleSize = title:GetFont()
|
||||
|
||||
InterfaceOptions_AddCategory(panel)
|
||||
|
||||
-- CLASSES SUBCATEGORY --
|
||||
@@ -53,7 +51,6 @@ classesPanel.parent = panel.name
|
||||
|
||||
local classesTitle = classesPanel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
||||
classesTitle:SetPoint("TOPLEFT", 16, -16)
|
||||
classesTitle:SetFont(titleFont, titleSize + 4, "OUTLINE")
|
||||
classesTitle:SetText("Classes")
|
||||
|
||||
local hideAllButton = CreateFrame("Button", "HideCoAHideAllButton", classesPanel, "UIPanelButtonTemplate")
|
||||
@@ -72,26 +69,44 @@ if ElvSkins then
|
||||
end
|
||||
|
||||
local BOX_BACKDROP = {
|
||||
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
|
||||
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
|
||||
tile = true,
|
||||
tileSize = 16,
|
||||
edgeSize = 16,
|
||||
insets = { left = 5, right = 5, top = 5, bottom = 5 },
|
||||
}
|
||||
|
||||
local BOX_BACKDROP_ELVUI = {
|
||||
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
|
||||
tile = true,
|
||||
tileSize = 16,
|
||||
insets = { left = 0, right = 0, top = 0, bottom = 0 },
|
||||
}
|
||||
|
||||
local function SkinBox(box)
|
||||
if ElvUI then
|
||||
box:SetBackdrop(BOX_BACKDROP_ELVUI)
|
||||
box:SetBackdropColor(0.08, 0.10, 0.14, 0.5)
|
||||
else
|
||||
box:SetBackdrop(BOX_BACKDROP)
|
||||
box:SetBackdropColor(0.08, 0.10, 0.14, 0.5)
|
||||
box:SetBackdropBorderColor(0.6, 0.6, 0.6, 1)
|
||||
end
|
||||
end
|
||||
|
||||
local sidebarBox = CreateFrame("Frame", nil, classesPanel)
|
||||
sidebarBox:SetPoint("TOPLEFT", hideAllButton, "BOTTOMLEFT", 0, -12)
|
||||
sidebarBox:SetPoint("BOTTOMLEFT", classesPanel, "BOTTOMLEFT", 0, 8)
|
||||
sidebarBox:SetWidth(158)
|
||||
|
||||
sidebarBox:SetBackdrop(BOX_BACKDROP)
|
||||
sidebarBox:SetBackdropColor(0.08, 0.10, 0.14, 0.5)
|
||||
SkinBox(sidebarBox)
|
||||
|
||||
local contentBox = CreateFrame("Frame", nil, classesPanel)
|
||||
contentBox:SetPoint("TOPLEFT", sidebarBox, "TOPRIGHT", 3, 0)
|
||||
contentBox:SetPoint("BOTTOMRIGHT", classesPanel, "BOTTOMRIGHT", -8, 8)
|
||||
|
||||
contentBox:SetBackdrop(BOX_BACKDROP)
|
||||
contentBox:SetBackdropColor(0.08, 0.10, 0.14, 0.5)
|
||||
SkinBox(contentBox)
|
||||
|
||||
local classSidebar = CreateFrame("Frame", nil, sidebarBox)
|
||||
classSidebar:SetPoint("TOPLEFT", sidebarBox, "TOPLEFT", 4, -4)
|
||||
@@ -357,7 +372,6 @@ characterOverridePanel.parent = panel.name
|
||||
|
||||
local characterOverrideTitle = characterOverridePanel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
||||
characterOverrideTitle:SetPoint("TOPLEFT", 16, -16)
|
||||
characterOverrideTitle:SetFont(titleFont, titleSize + 4, "OUTLINE")
|
||||
characterOverrideTitle:SetText("Character Override")
|
||||
|
||||
local overrideProfileDropdown = CreateFrame("Frame", "HideCoAOverrideProfileDropDown", characterOverridePanel, "UIDropDownMenuTemplate")
|
||||
@@ -369,8 +383,23 @@ end
|
||||
|
||||
UIDropDownMenu_SetWidth(overrideProfileDropdown, 180)
|
||||
|
||||
local deleteProfileButton = CreateFrame("Button", "HideCoADeleteProfileButton", characterOverridePanel, "UIPanelButtonTemplate")
|
||||
local overrideProfileDropdownArrow = _G[overrideProfileDropdown:GetName() .. "Button"]
|
||||
deleteProfileButton:SetPoint("LEFT", overrideProfileDropdownArrow or overrideProfileDropdown, "RIGHT", 8, 2)
|
||||
deleteProfileButton:SetSize(110, 22)
|
||||
deleteProfileButton:SetText("Delete Profile")
|
||||
|
||||
if ElvSkins then
|
||||
ElvSkins:HandleButton(deleteProfileButton)
|
||||
end
|
||||
|
||||
local deleteProfileBlockedText = characterOverridePanel:CreateFontString(nil, "ARTWORK", "GameFontDisableSmall")
|
||||
deleteProfileBlockedText:SetPoint("TOPLEFT", overrideProfileDropdown, "BOTTOMLEFT", 16, -6)
|
||||
deleteProfileBlockedText:SetText("Can't delete currently logged character profile")
|
||||
deleteProfileBlockedText:Hide()
|
||||
|
||||
local overrideEnabledCheck = CreateFrame("CheckButton", "HideCoAOverrideEnabledCheck", characterOverridePanel, "InterfaceOptionsCheckButtonTemplate")
|
||||
overrideEnabledCheck:SetPoint("TOPLEFT", overrideProfileDropdown, "BOTTOMLEFT", 16, -8)
|
||||
overrideEnabledCheck:SetPoint("TOPLEFT", deleteProfileBlockedText, "BOTTOMLEFT", 0, -28)
|
||||
_G[overrideEnabledCheck:GetName() .. "Text"]:SetText("Override class options for this character")
|
||||
|
||||
if ElvSkins then
|
||||
@@ -442,6 +471,14 @@ local function SelectOverrideProfile(name)
|
||||
selectedOverrideProfile = name
|
||||
UIDropDownMenu_SetText(overrideProfileDropdown, name)
|
||||
RefreshCharacterOverrideTab()
|
||||
|
||||
if name == HideCoA.GetActiveProfileName() then
|
||||
deleteProfileButton:Disable()
|
||||
deleteProfileBlockedText:Show()
|
||||
else
|
||||
deleteProfileButton:Enable()
|
||||
deleteProfileBlockedText:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
local function OverrideProfileDropDown_OnClick(self)
|
||||
@@ -477,6 +514,31 @@ end)
|
||||
|
||||
AddCheckboxFeedback(overrideEnabledCheck)
|
||||
|
||||
StaticPopupDialogs["HIDECOA_DELETE_PROFILE"] = {
|
||||
text = "Delete profile '%s'?\n\nThis cannot be undone.",
|
||||
button1 = "Delete",
|
||||
button2 = "Cancel",
|
||||
OnAccept = function(self, profileName)
|
||||
HideCoA.DeleteProfile(profileName)
|
||||
SelectOverrideProfile(HideCoA.GetActiveProfileName())
|
||||
end,
|
||||
timeout = 0,
|
||||
whileDead = 1,
|
||||
hideOnEscape = 1,
|
||||
}
|
||||
|
||||
deleteProfileButton:SetScript("OnClick", function()
|
||||
|
||||
if not selectedOverrideProfile or selectedOverrideProfile == HideCoA.GetActiveProfileName() then
|
||||
return
|
||||
end
|
||||
|
||||
StaticPopup_Show("HIDECOA_DELETE_PROFILE", selectedOverrideProfile, nil, selectedOverrideProfile)
|
||||
|
||||
end)
|
||||
|
||||
AddClickSound(deleteProfileButton)
|
||||
|
||||
characterOverridePanel:SetScript("OnShow", function()
|
||||
SelectOverrideProfile(selectedOverrideProfile or HideCoA.GetActiveProfileName())
|
||||
end)
|
||||
@@ -491,7 +553,6 @@ aboutPanel.parent = panel.name
|
||||
|
||||
local aboutTitle = aboutPanel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
||||
aboutTitle:SetPoint("TOPLEFT", 16, -16)
|
||||
aboutTitle:SetFont(titleFont, titleSize + 4, "OUTLINE")
|
||||
aboutTitle:SetText("About")
|
||||
|
||||
InterfaceOptions_AddCategory(aboutPanel)
|
||||
|
||||
Reference in New Issue
Block a user