optional from layout show category count

This commit is contained in:
Vati
2026-02-28 04:26:36 +04:00
parent 3d22490e15
commit a89ee82a37
5 changed files with 89 additions and 6 deletions
+3
View File
@@ -130,6 +130,9 @@ function DB:Initialize()
if Guda_CharDB.settings.markEquipmentSets == nil then
Guda_CharDB.settings.markEquipmentSets = true
end
if Guda_CharDB.settings.showCategoryCount == nil then
Guda_CharDB.settings.showCategoryCount = true
end
if Guda_CharDB.settings.autoVendorJunk == nil then
Guda_CharDB.settings.autoVendorJunk = true
end
+4 -2
View File
@@ -1075,9 +1075,11 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName)
displayName = catDef.name
end
-- Set item count
-- Set item count (gated by showCategoryCount setting)
if header.countText then
if numItems > 0 then
local showCount = addon.Modules.DB:GetSetting("showCategoryCount")
if showCount == nil then showCount = true end
if showCount and numItems > 0 then
header.countText:SetText("(" .. numItems .. ")")
header.countText:Show()
else
+19 -4
View File
@@ -880,10 +880,16 @@ function BankFrame:DisplayItemsByCategory(bankData, isOtherChar, charName)
displayName = catDef.name
end
-- Set item count
-- Set item count (gated by showCategoryCount setting)
if header.countText then
header.countText:SetText("(" .. numItems .. ")")
header.countText:Show()
local showCount = addon.Modules.DB:GetSetting("showCategoryCount")
if showCount == nil then showCount = true end
if showCount and numItems > 0 then
header.countText:SetText("(" .. numItems .. ")")
header.countText:Show()
else
header.countText:Hide()
end
end
header.fullName = displayName
@@ -994,7 +1000,16 @@ function BankFrame:DisplayItemsByCategory(bankData, isOtherChar, charName)
header:SetPoint("TOPLEFT", itemContainer, "TOPLEFT", x + currentBottomX, y)
header:SetWidth(blockWidth)
header.text:SetText(sec.name)
if header.countText then header.countText:SetText("(" .. numItems .. ")"); header.countText:Show() end
if header.countText then
local showCount = addon.Modules.DB:GetSetting("showCategoryCount")
if showCount == nil then showCount = true end
if showCount and numItems > 0 then
header.countText:SetText("(" .. numItems .. ")")
header.countText:Show()
else
header.countText:Hide()
end
end
header:Show()
local itemY = y - 20
+50
View File
@@ -283,6 +283,14 @@ function Guda_SettingsPopup_OnShow(self)
markEquipmentSetsCheckbox:SetChecked(markEquipmentSets and 1 or 0)
end
-- Show Category Count checkbox
local showCategoryCountCheckbox = getglobal("Guda_SettingsPopup_ShowCategoryCountCheckbox")
local showCategoryCount = Guda.Modules.DB:GetSetting("showCategoryCount")
if showCategoryCount == nil then showCategoryCount = true end
if showCategoryCountCheckbox then
showCategoryCountCheckbox:SetChecked(showCategoryCount and 1 or 0)
end
-- Automation checkboxes
local autoVendorJunkCheckbox = getglobal("Guda_SettingsPopup_AutoVendorJunkCheckbox")
local autoVendorJunk = Guda.Modules.DB:GetSetting("autoVendorJunk")
@@ -1310,6 +1318,48 @@ function Guda_SettingsPopup_MarkEquipmentSetsCheckbox_OnClick(self)
end
end
-- Show Category Count Checkbox OnLoad
function Guda_SettingsPopup_ShowCategoryCountCheckbox_OnLoad(self)
local text = getglobal(self:GetName().."Text")
if text then
text:SetText("Show Category Count")
local font, _, flags = text:GetFont()
if font then
text:SetFont(font, 13, flags)
end
end
self.tooltipText = "Show the item count next to each category header in category view."
local enabled = true
if Guda and Guda.Modules and Guda.Modules.DB then
enabled = Guda.Modules.DB:GetSetting("showCategoryCount")
if enabled == nil then enabled = true end
end
self:SetChecked(enabled and 1 or 0)
end
-- Show Category Count Checkbox OnClick
function Guda_SettingsPopup_ShowCategoryCountCheckbox_OnClick(self)
local isChecked = self:GetChecked() == 1
if Guda and Guda.Modules and Guda.Modules.DB then
Guda.Modules.DB:SetSetting("showCategoryCount", isChecked)
end
local bagFrame = getglobal("Guda_BagFrame")
if bagFrame and bagFrame:IsShown() then
Guda.Modules.BagFrame:Update()
end
local bankFrame = getglobal("Guda_BankFrame")
if bankFrame and bankFrame:IsShown() then
Guda.Modules.BankFrame:Update()
end
end
-- Auto Vendor Junk Checkbox OnLoad
function Guda_SettingsPopup_AutoVendorJunkCheckbox_OnLoad(self)
local text = getglobal(self:GetName().."Text")
+13
View File
@@ -456,6 +456,19 @@
<OnClick>Guda_SettingsPopup_ShowEquipSetCategoriesCheckbox_OnClick(this)</OnClick>
</Scripts>
</CheckButton>
<!-- Show Category Count Checkbox -->
<CheckButton name="Guda_SettingsPopup_ShowCategoryCountCheckbox" inherits="OptionsCheckButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="Guda_SettingsPopup_HoverBaglineCheckbox">
<Offset><AbsDimension x="0" y="-8"/></Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>Guda_SettingsPopup_ShowCategoryCountCheckbox_OnLoad(this)</OnLoad>
<OnClick>Guda_SettingsPopup_ShowCategoryCountCheckbox_OnClick(this)</OnClick>
</Scripts>
</CheckButton>
</Frames>
</Frame>