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",
|
"CoAResourceSegmentBar",
|
||||||
"CoAResourceOrb",
|
"CoAResourceOrb",
|
||||||
"CoAResourceBar",
|
"CoAResourceBar",
|
||||||
|
"CoAMultiCastActionBarFrame",
|
||||||
}
|
}
|
||||||
|
|
||||||
local function CreateDefaultClassSettings()
|
local function CreateDefaultClassSettings()
|
||||||
|
|||||||
+71
-10
@@ -41,8 +41,6 @@ local title = panel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
|||||||
title:SetPoint("TOPLEFT", 16, -16)
|
title:SetPoint("TOPLEFT", 16, -16)
|
||||||
title:SetText("HideCoAUI")
|
title:SetText("HideCoAUI")
|
||||||
|
|
||||||
local titleFont, titleSize = title:GetFont()
|
|
||||||
|
|
||||||
InterfaceOptions_AddCategory(panel)
|
InterfaceOptions_AddCategory(panel)
|
||||||
|
|
||||||
-- CLASSES SUBCATEGORY --
|
-- CLASSES SUBCATEGORY --
|
||||||
@@ -53,7 +51,6 @@ classesPanel.parent = panel.name
|
|||||||
|
|
||||||
local classesTitle = classesPanel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
local classesTitle = classesPanel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
||||||
classesTitle:SetPoint("TOPLEFT", 16, -16)
|
classesTitle:SetPoint("TOPLEFT", 16, -16)
|
||||||
classesTitle:SetFont(titleFont, titleSize + 4, "OUTLINE")
|
|
||||||
classesTitle:SetText("Classes")
|
classesTitle:SetText("Classes")
|
||||||
|
|
||||||
local hideAllButton = CreateFrame("Button", "HideCoAHideAllButton", classesPanel, "UIPanelButtonTemplate")
|
local hideAllButton = CreateFrame("Button", "HideCoAHideAllButton", classesPanel, "UIPanelButtonTemplate")
|
||||||
@@ -72,26 +69,44 @@ if ElvSkins then
|
|||||||
end
|
end
|
||||||
|
|
||||||
local BOX_BACKDROP = {
|
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",
|
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
|
||||||
tile = true,
|
tile = true,
|
||||||
tileSize = 16,
|
tileSize = 16,
|
||||||
insets = { left = 0, right = 0, top = 0, bottom = 0 },
|
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)
|
local sidebarBox = CreateFrame("Frame", nil, classesPanel)
|
||||||
sidebarBox:SetPoint("TOPLEFT", hideAllButton, "BOTTOMLEFT", 0, -12)
|
sidebarBox:SetPoint("TOPLEFT", hideAllButton, "BOTTOMLEFT", 0, -12)
|
||||||
sidebarBox:SetPoint("BOTTOMLEFT", classesPanel, "BOTTOMLEFT", 0, 8)
|
sidebarBox:SetPoint("BOTTOMLEFT", classesPanel, "BOTTOMLEFT", 0, 8)
|
||||||
sidebarBox:SetWidth(158)
|
sidebarBox:SetWidth(158)
|
||||||
|
|
||||||
sidebarBox:SetBackdrop(BOX_BACKDROP)
|
SkinBox(sidebarBox)
|
||||||
sidebarBox:SetBackdropColor(0.08, 0.10, 0.14, 0.5)
|
|
||||||
|
|
||||||
local contentBox = CreateFrame("Frame", nil, classesPanel)
|
local contentBox = CreateFrame("Frame", nil, classesPanel)
|
||||||
contentBox:SetPoint("TOPLEFT", sidebarBox, "TOPRIGHT", 3, 0)
|
contentBox:SetPoint("TOPLEFT", sidebarBox, "TOPRIGHT", 3, 0)
|
||||||
contentBox:SetPoint("BOTTOMRIGHT", classesPanel, "BOTTOMRIGHT", -8, 8)
|
contentBox:SetPoint("BOTTOMRIGHT", classesPanel, "BOTTOMRIGHT", -8, 8)
|
||||||
|
|
||||||
contentBox:SetBackdrop(BOX_BACKDROP)
|
SkinBox(contentBox)
|
||||||
contentBox:SetBackdropColor(0.08, 0.10, 0.14, 0.5)
|
|
||||||
|
|
||||||
local classSidebar = CreateFrame("Frame", nil, sidebarBox)
|
local classSidebar = CreateFrame("Frame", nil, sidebarBox)
|
||||||
classSidebar:SetPoint("TOPLEFT", sidebarBox, "TOPLEFT", 4, -4)
|
classSidebar:SetPoint("TOPLEFT", sidebarBox, "TOPLEFT", 4, -4)
|
||||||
@@ -357,7 +372,6 @@ characterOverridePanel.parent = panel.name
|
|||||||
|
|
||||||
local characterOverrideTitle = characterOverridePanel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
local characterOverrideTitle = characterOverridePanel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
||||||
characterOverrideTitle:SetPoint("TOPLEFT", 16, -16)
|
characterOverrideTitle:SetPoint("TOPLEFT", 16, -16)
|
||||||
characterOverrideTitle:SetFont(titleFont, titleSize + 4, "OUTLINE")
|
|
||||||
characterOverrideTitle:SetText("Character Override")
|
characterOverrideTitle:SetText("Character Override")
|
||||||
|
|
||||||
local overrideProfileDropdown = CreateFrame("Frame", "HideCoAOverrideProfileDropDown", characterOverridePanel, "UIDropDownMenuTemplate")
|
local overrideProfileDropdown = CreateFrame("Frame", "HideCoAOverrideProfileDropDown", characterOverridePanel, "UIDropDownMenuTemplate")
|
||||||
@@ -369,8 +383,23 @@ end
|
|||||||
|
|
||||||
UIDropDownMenu_SetWidth(overrideProfileDropdown, 180)
|
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")
|
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")
|
_G[overrideEnabledCheck:GetName() .. "Text"]:SetText("Override class options for this character")
|
||||||
|
|
||||||
if ElvSkins then
|
if ElvSkins then
|
||||||
@@ -442,6 +471,14 @@ local function SelectOverrideProfile(name)
|
|||||||
selectedOverrideProfile = name
|
selectedOverrideProfile = name
|
||||||
UIDropDownMenu_SetText(overrideProfileDropdown, name)
|
UIDropDownMenu_SetText(overrideProfileDropdown, name)
|
||||||
RefreshCharacterOverrideTab()
|
RefreshCharacterOverrideTab()
|
||||||
|
|
||||||
|
if name == HideCoA.GetActiveProfileName() then
|
||||||
|
deleteProfileButton:Disable()
|
||||||
|
deleteProfileBlockedText:Show()
|
||||||
|
else
|
||||||
|
deleteProfileButton:Enable()
|
||||||
|
deleteProfileBlockedText:Hide()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function OverrideProfileDropDown_OnClick(self)
|
local function OverrideProfileDropDown_OnClick(self)
|
||||||
@@ -477,6 +514,31 @@ end)
|
|||||||
|
|
||||||
AddCheckboxFeedback(overrideEnabledCheck)
|
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()
|
characterOverridePanel:SetScript("OnShow", function()
|
||||||
SelectOverrideProfile(selectedOverrideProfile or HideCoA.GetActiveProfileName())
|
SelectOverrideProfile(selectedOverrideProfile or HideCoA.GetActiveProfileName())
|
||||||
end)
|
end)
|
||||||
@@ -491,7 +553,6 @@ aboutPanel.parent = panel.name
|
|||||||
|
|
||||||
local aboutTitle = aboutPanel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
local aboutTitle = aboutPanel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
||||||
aboutTitle:SetPoint("TOPLEFT", 16, -16)
|
aboutTitle:SetPoint("TOPLEFT", 16, -16)
|
||||||
aboutTitle:SetFont(titleFont, titleSize + 4, "OUTLINE")
|
|
||||||
aboutTitle:SetText("About")
|
aboutTitle:SetText("About")
|
||||||
|
|
||||||
InterfaceOptions_AddCategory(aboutPanel)
|
InterfaceOptions_AddCategory(aboutPanel)
|
||||||
|
|||||||
Reference in New Issue
Block a user