Skip to content

Commit

Permalink
Addon compartment support
Browse files Browse the repository at this point in the history
  • Loading branch information
solocommand committed Jul 26, 2024
1 parent 6d7de05 commit d405a17
Show file tree
Hide file tree
Showing 7 changed files with 283 additions and 149 deletions.
26 changes: 12 additions & 14 deletions Socialite.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,16 @@ do
if loadedAddon ~= addonName then return end
self:UnregisterEvent("ADDON_LOADED")

if type(SocialiteSettings) ~= "table" then SocialiteSettings = {minimap={hide=false}} end
if type(SocialiteSettings) ~= "table" then SocialiteSettings = {
minimap={hide=true},
showInAddonCompartment=true,
DisableUsageText=false,
} end
local sv = SocialiteSettings
if type(sv.minimap) ~= "table" then sv.minimap = {hide=false} end
if type(sv.minimap) ~= "table" then sv.minimap = {hide=true} end
if type(sv.showInAddonCompartment) ~= "boolean" then sv.showInAddonCompartment = true end
if type(sv.DisableUsageText) ~= "boolean" then sv.DisableUsageText = false end

if type(sv.ShowLabel) ~= "boolean" then sv.ShowLabel = true end
if type(sv.ShowRealID) ~= "boolean" then sv.ShowRealID = true end
if type(sv.ShowRealIDApp) ~= "boolean" then sv.ShowRealIDApp = false end
Expand All @@ -55,12 +62,12 @@ do
if type(sv.ShowGroupMembers) ~= "boolean" then sv.ShowGroupMembers = true end
if type(sv.ShowStatus) ~= "string" then sv.ShowStatus = "icon" end
if type(sv.TooltipInteraction) ~= "string" then sv.TooltipInteraction = "always" end
if type(sv.DisableUsageText) ~= "boolean" then sv.DisableUsageText = false end

addon.db = sv


ldbi:Register(addonName, addon.dataobj, addon.db.minimap)
if sv.showInAddonCompartment then ldbi:AddButtonToCompartment(addonName) end

self:SetScript("OnEvent", nil)
end)
Expand Down Expand Up @@ -91,19 +98,10 @@ do
end
end,
OnClick = function(self, button)
if button == "RightButton" then
if button == "RightButton" or self == nil then
showConfig()
else
if addon.db.ShowFriends or addon.db.ShowRealID then
-- ToggleFriendsFrame(1); -- friends tab
-- We want to show the friends tab, but there's a taint issue :/
if FriendsFrame:IsShown() then
HideUIPanel(FriendsFrame)
else
ShowUIPanel(FriendsFrame)
end
end

if addon.db.ShowFriends or addon.db.ShowRealID then ToggleFriendsFrame(1) end
if addon.db.ShowGuild then ToggleGuildFrame(1) end
end
end
Expand Down
1 change: 1 addition & 0 deletions Socialite.toc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
## X-Curse-Project-ID: 26811
## X-Wago-ID: rkGr7xNy
## OptionalDeps: Ace3, LibDataBroker-1.1, LibDBIcon-1.0
## IconTexture: Interface\AddOns\Socialite\Socialite

embeds.xml

Expand Down
49 changes: 35 additions & 14 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ end
local function build()
local t = {
name = "Socialite",
handler = Socialite,
type = 'group',
args = {
showMinimapIcon = {
Expand All @@ -45,30 +44,51 @@ local function build()
ldbi:Refresh(addonName)
end,
},
DisableUsageText = buildCheckbox("DisableUsageText", 1),
ShowLabel = buildCheckbox("ShowLabel", 2),
ShowGroupMembers = buildCheckbox("ShowGroupMembers", 3),
showInAddonCompartment = {
type = 'toggle',
name = L.showInAddonCompartment,
desc = L.showInAddonCompartmentDescription,
order = 1,
get = function(info) return addon.db[info[#info]] end,
set = function(info, value)
addon:setDB(info[#info], value)
if value then
ldbi:AddButtonToCompartment(addonName)
else
ldbi:RemoveButtonFromCompartment(addonName)
end
end
},
DisableUsageText = buildCheckbox("DisableUsageText", 2),
battleNetFriends = {
type = "group",
name = L["Battle.net Friends"],
order = 10,
args = {
ShowRealID = buildCheckbox("ShowRealID"),
ShowRealIDBroadcasts = buildCheckbox("ShowRealIDBroadcasts"),
ShowRealIDFactions = buildCheckbox("ShowRealIDFactions"),
ShowRealIDNotes = buildCheckbox("ShowRealIDNotes"),
ShowRealIDApp = buildCheckbox("ShowRealIDApp"),
ShowRealID = buildCheckbox("ShowRealID", 11),
ShowRealIDBroadcasts = buildCheckbox("ShowRealIDBroadcasts", 12),
ShowRealIDFactions = buildCheckbox("ShowRealIDFactions", 13),
ShowRealIDNotes = buildCheckbox("ShowRealIDNotes", 14),
ShowRealIDApp = buildCheckbox("ShowRealIDApp", 15),
}
},
characterFriends = {
type = "group",
name = L["Character Friends"],
order = 20,
args = {
ShowFriends = buildCheckbox("ShowFriends"),
ShowFriendsNote = buildCheckbox("ShowFriendsNote"),
ShowFriends = buildCheckbox("ShowFriends", 21),
ShowFriendsNote = buildCheckbox("ShowFriendsNote", 22),
}
},
dataText = {
type = "group",
name = L["Data text"],
order = 25,
args = {
ShowLabel = buildCheckbox("ShowLabel", 3),
},
},
tooltip = {
type = "group",
name = L["Tooltip Settings"],
Expand All @@ -85,7 +105,8 @@ local function build()
outofcombat = L.MENU_INTERACTION_OOC,
never = L.MENU_INTERACTION_NEVER,
}, 32),
}
ShowGroupMembers = buildCheckbox("ShowGroupMembers", 33),
},
},
guild = {
type = 'group',
Expand Down Expand Up @@ -121,6 +142,6 @@ local function build()
return t
end

LibStub("AceConfig-3.0"):RegisterOptionsTable("Socialite", build, nil)
LibStub("AceConfig-3.0"):RegisterOptionsTable("Socialite", build, "/socialite")
addon.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions(addonName, "Socialite")
LibStub("AceConsole-3.0"):RegisterChatCommand("socialite", function() Settings.OpenToCategory(addonName) end)
-- LibStub("AceConsole-3.0"):RegisterChatCommand("socialite", function() Settings.OpenToCategory(addonName) end)
3 changes: 3 additions & 0 deletions i18n/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ L["ShowRealIDFactions"] = "Show friends faction"
L["ShowRealIDFactionsDescription"] = "Show the faction of your Battle.net friends"
L["ShowRealIDNotes"] = "Show friend note"
L["ShowRealIDNotesDescription"] = "Show your friends' note"
L["showInAddonCompartment"] = "Show in compartment"
L["showInAddonCompartmentDescription"] = "Toggles the display of Scoreboard within the addon compartment."
L["Data text"] = "Data text"

L["Character Friends"] = "Character Friends"
L["ShowFriends"] = "Show friends"
Expand Down
3 changes: 3 additions & 0 deletions stylua.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
indent_type = "Spaces"
indent_width = 2
column_width = 180
Loading

0 comments on commit d405a17

Please sign in to comment.