forked from funkydude/BugSack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.lua
122 lines (109 loc) · 3.79 KB
/
config.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
local addonName, addon = ...
if not addon.healthCheck then return end
local L = addon.L
local frame = addon.frame
frame.name = addonName
frame:Hide()
frame:SetScript("OnShow", function(frame)
local function newCheckbox(label, description, onClick)
local check = CreateFrame("CheckButton", "BugSackCheck" .. label, frame, "InterfaceOptionsCheckButtonTemplate")
check:SetScript("OnClick", function(self)
local tick = self:GetChecked()
onClick(self, tick and true or false)
if tick then
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
else
PlaySound(857) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_OFF
end
end)
check.label = _G[check:GetName() .. "Text"]
check.label:SetText(label)
check.tooltipText = label
check.tooltipRequirement = description
return check
end
local title = frame:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
title:SetPoint("TOPLEFT", 16, -16)
title:SetText(addonName)
local autoPopup = newCheckbox(
L["Auto popup"],
L.autoDesc,
function(self, value) addon.db.auto = value end)
autoPopup:SetChecked(addon.db.auto)
autoPopup:SetPoint("TOPLEFT", title, "BOTTOMLEFT", -2, -16)
local chatFrame = newCheckbox(
L["Chatframe output"],
L.chatFrameDesc,
function(self, value) addon.db.chatframe = value end)
chatFrame:SetChecked(addon.db.chatframe)
chatFrame:SetPoint("TOPLEFT", autoPopup, "BOTTOMLEFT", 0, -8)
local minimap = newCheckbox(
L["Minimap icon"],
L.minimapDesc,
function(self, value)
BugSackLDBIconDB.hide = not value
if BugSackLDBIconDB.hide then
LibStub("LibDBIcon-1.0"):Hide(addonName)
else
LibStub("LibDBIcon-1.0"):Show(addonName)
end
end)
minimap:SetPoint("TOPLEFT", chatFrame, "BOTTOMLEFT", 0, -8)
minimap:SetChecked(not BugSackLDBIconDB.hide)
local mute = newCheckbox(
L["Mute"],
L.muteDesc,
function(self, value) addon.db.mute = value end)
mute:SetChecked(addon.db.mute)
mute:SetPoint("TOPLEFT", minimap, "BOTTOMLEFT", 0, -8)
local info = {}
local fontSizeDropdown = CreateFrame("Frame", "BugSackFontSize", frame, "UIDropDownMenuTemplate")
fontSizeDropdown:SetPoint("TOPLEFT", mute, "BOTTOMLEFT", -15, -10)
fontSizeDropdown.initialize = function()
wipe(info)
local fonts = {"GameFontHighlightSmall", "GameFontHighlight", "GameFontHighlightMedium", "GameFontHighlightLarge"}
local names = {L["Small"], L["Medium"], L["Large"], L["X-Large"]}
for i, font in next, fonts do
info.text = names[i]
info.value = font
info.func = function(self)
addon.db.fontSize = self.value
if _G.BugSackFrameScrollText then
_G.BugSackFrameScrollText:SetFontObject(_G[self.value])
end
BugSackFontSizeText:SetText(self:GetText())
end
info.checked = font == addon.db.fontSize
UIDropDownMenu_AddButton(info)
end
end
BugSackFontSizeText:SetText(L["Font size"])
local dropdown = CreateFrame("Frame", "BugSackSoundDropdown", frame, "UIDropDownMenuTemplate")
dropdown:SetPoint("LEFT", fontSizeDropdown, "RIGHT", 150, 0)
dropdown.initialize = function()
wipe(info)
for _, sound in next, LibStub("LibSharedMedia-3.0"):List("sound") do
info.text = sound
info.value = sound
info.func = function(self)
addon.db.soundMedia = self.value
BugSackSoundDropdownText:SetText(self:GetText())
end
info.checked = sound == addon.db.soundMedia
UIDropDownMenu_AddButton(info)
end
end
BugSackSoundDropdownText:SetText(L["Sound"])
local clear = CreateFrame("Button", "BugSackSaveButton", frame, "UIPanelButtonTemplate")
clear:SetText(L["Wipe saved bugs"])
clear:SetWidth(177)
clear:SetHeight(24)
clear:SetPoint("TOPLEFT", fontSizeDropdown, "BOTTOMLEFT", 17, -25)
clear:SetScript("OnClick", function()
addon:Reset()
end)
clear.tooltipText = L["Wipe saved bugs"]
clear.newbieText = L.wipeDesc
frame:SetScript("OnShow", nil)
end)
InterfaceOptions_AddCategory(frame)