From a89ee82a370f06917505072847d917f5fc16bc9d Mon Sep 17 00:00:00 2001 From: Vati Date: Sat, 28 Feb 2026 04:26:36 +0400 Subject: [PATCH] optional from layout show category count --- Core/Database.lua | 3 +++ UI/BagFrame.lua | 6 ++++-- UI/BankFrame.lua | 23 ++++++++++++++++---- UI/SettingsPopup.lua | 50 ++++++++++++++++++++++++++++++++++++++++++++ UI/SettingsPopup.xml | 13 ++++++++++++ 5 files changed, 89 insertions(+), 6 deletions(-) diff --git a/Core/Database.lua b/Core/Database.lua index d7ca182..d14253b 100644 --- a/Core/Database.lua +++ b/Core/Database.lua @@ -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 diff --git a/UI/BagFrame.lua b/UI/BagFrame.lua index 0c715b9..d7552e8 100644 --- a/UI/BagFrame.lua +++ b/UI/BagFrame.lua @@ -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 diff --git a/UI/BankFrame.lua b/UI/BankFrame.lua index 213cda5..5fd8e34 100644 --- a/UI/BankFrame.lua +++ b/UI/BankFrame.lua @@ -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 diff --git a/UI/SettingsPopup.lua b/UI/SettingsPopup.lua index d14b196..f90e82e 100644 --- a/UI/SettingsPopup.lua +++ b/UI/SettingsPopup.lua @@ -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") diff --git a/UI/SettingsPopup.xml b/UI/SettingsPopup.xml index bed4f0e..025c846 100644 --- a/UI/SettingsPopup.xml +++ b/UI/SettingsPopup.xml @@ -456,6 +456,19 @@ Guda_SettingsPopup_ShowEquipSetCategoriesCheckbox_OnClick(this) + + + + + + + + + + Guda_SettingsPopup_ShowCategoryCountCheckbox_OnLoad(this) + Guda_SettingsPopup_ShowCategoryCountCheckbox_OnClick(this) + +