Skip to content

Commit

Permalink
Refactoring, Vol. 2.
Browse files Browse the repository at this point in the history
I'll leave /core and modules/unitframes out for now.
  • Loading branch information
ls- committed Aug 28, 2017
1 parent 5d0e6b7 commit 03a26c7
Show file tree
Hide file tree
Showing 11 changed files with 311 additions and 303 deletions.
2 changes: 2 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ std = {
"DEFAULT_CHAT_FRAME",
"LE_REALM_RELATION_VIRTUAL",
"LFG_ROLE_NUM_SHORTAGE_TYPES",
"LS_UI_CONFIG",
"MAX_PLAYER_LEVEL",
"MAX_REPUTATION_REACTION",
"MAX_TOTEMS",
Expand Down Expand Up @@ -46,6 +47,7 @@ std = {
"GetMinimapZoneText",
"GuildMicroButtonTabard",
"HonorWatchBar",
"InterfaceOptionsFramePanelContainer",
"LFDMicroButtonAlert",
"LSMultiBarBottomLeftBar",
"LSMultiBarBottomRightBar",
Expand Down
12 changes: 6 additions & 6 deletions config/auras.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local _, ns = ...
local E, C, M, L, P, D = ns.E, ns.C, ns.M, ns.L, ns.P, ns.D
local CFG = P:GetModule("Config")
local AURAS = P:GetModule("Auras")
local CONFIG = P:GetModule("Config")

-- Lua
local _G = getfenv(0)
Expand All @@ -19,7 +19,7 @@ local function GetOptionsTable_Aura(filter, order, name)
order = 1,
name = L["RESTORE_DEFAULTS"],
func = function()
CFG:CopySettings(D.profile.auras[E.UI_LAYOUT][filter], C.db.profile.auras[E.UI_LAYOUT][filter], {point = true})
CONFIG:CopySettings(D.profile.auras[E.UI_LAYOUT][filter], C.db.profile.auras[E.UI_LAYOUT][filter], {point = true})
AURAS:UpdateHeader(filter)
end,
},
Expand Down Expand Up @@ -162,7 +162,7 @@ local function GetOptionsTable_Aura(filter, order, name)
return temp
end

function CFG:CreateAurasPanel(order)
function CONFIG.CreateAurasPanel(_, order)
C.options.args.auras = {
order = order,
type = "group",
Expand All @@ -181,7 +181,7 @@ function CFG:CreateAurasPanel(order)

if AURAS:IsInit() then
if not value then
CFG:ShowStaticPopup("RELOAD_UI")
CONFIG:ShowStaticPopup("RELOAD_UI")
end
else
if value then
Expand All @@ -195,7 +195,7 @@ function CFG:CreateAurasPanel(order)
order = 2,
name = L["RESTORE_DEFAULTS"],
func = function()
CFG:CopySettings(D.profile.auras[E.UI_LAYOUT], C.db.profile.auras[E.UI_LAYOUT], {point = true})
CONFIG:CopySettings(D.profile.auras[E.UI_LAYOUT], C.db.profile.auras[E.UI_LAYOUT], {point = true})
AURAS:Update()
end,
},
Expand All @@ -211,7 +211,7 @@ function CFG:CreateAurasPanel(order)
order = 1,
name = L["RESTORE_DEFAULTS"],
func = function()
CFG:CopySettings(D.profile.auras[E.UI_LAYOUT].TOTEM, C.db.profile.auras[E.UI_LAYOUT].TOTEM, {point = true})
CONFIG:CopySettings(D.profile.auras[E.UI_LAYOUT].TOTEM, C.db.profile.auras[E.UI_LAYOUT].TOTEM, {point = true})
AURAS:UpdateHeader("TOTEM")
end,
},
Expand Down
18 changes: 9 additions & 9 deletions config/auratracker.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local _, ns = ...
local E, C, M, L, P, D = ns.E, ns.C, ns.M, ns.L, ns.P, ns.D
local CFG = P:GetModule("Config")
local AURATRACKER = P:GetModule("AuraTracker")
local CONFIG = P:GetModule("Config")

-- Lua
local _G = getfenv(0)
Expand All @@ -16,10 +16,10 @@ local GROWTH_DIRS = {
}

local DRAG_KEYS = {
[1] = ALT_KEY,
[2] = CTRL_KEY,
[3] = SHIFT_KEY,
[4] = NONE_KEY,
[1] = _G.ALT_KEY,
[2] = _G.CTRL_KEY,
[3] = _G.SHIFT_KEY,
[4] = _G.NONE_KEY,
}

local DRAG_KEY_VALUES = {
Expand All @@ -40,7 +40,7 @@ local function Update()
AURATRACKER:Update()
end

function CFG:CreateAuraTrackerPanel(order)
function CONFIG.CreateAuraTrackerPanel(_, order)
C.options.args.auratracker = {
order = order,
type = "group",
Expand All @@ -58,7 +58,7 @@ function CFG:CreateAuraTrackerPanel(order)

if AURATRACKER:IsInit() then
if not value then
CFG:ShowStaticPopup("RELOAD_UI")
CONFIG:ShowStaticPopup("RELOAD_UI")
end
else
if value then
Expand Down Expand Up @@ -86,7 +86,7 @@ function CFG:CreateAuraTrackerPanel(order)
name = L["RESTORE_DEFAULTS"],
disabled = function() return not AURATRACKER:IsInit() end,
func = function()
CFG:CopySettings(D.char.auratracker, C.db.char.auratracker, {enabled = true, filter = true})
CONFIG:CopySettings(D.char.auratracker, C.db.char.auratracker, {enabled = true, filter = true})
AURATRACKER:Update()
end,
},
Expand Down Expand Up @@ -189,7 +189,7 @@ function CFG:CreateAuraTrackerPanel(order)
name = L["FILTER_SETTINGS"],
disabled = function() return not AURATRACKER:IsInit() end,
func = function()
CFG:OpenAuraConfig(L["AURA_TRACKER"], C.db.char.auratracker.filter, {1, 2}, {3}, Update)
CONFIG:OpenAuraConfig(L["AURA_TRACKER"], C.db.char.auratracker.filter, {1, 2}, {3}, Update)
end,
},
},
Expand Down
26 changes: 13 additions & 13 deletions config/bars.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local _, ns = ...
local E, C, M, L, P, D = ns.E, ns.C, ns.M, ns.L, ns.P, ns.D
local CFG = P:GetModule("Config")
local CONFIG = P:GetModule("Config")
local BARS = P:GetModule("Bars")

-- Lua
Expand Down Expand Up @@ -40,7 +40,7 @@ local function GetOptionsTable_Bar(barID, order, name)
order = 2,
name = L["RESTORE_DEFAULTS"],
func = function()
CFG:CopySettings(D.profile.bars[barID], C.db.profile.bars[barID], {visible = true, point = true})
CONFIG:CopySettings(D.profile.bars[barID], C.db.profile.bars[barID], {visible = true, point = true})
BARS:UpdateBar(barID)
end,
},
Expand Down Expand Up @@ -149,11 +149,11 @@ local function GetOptionsTable_Bar(barID, order, name)
if BARS:IsInit() then
if BARS:HasBags() then
if not value then
CFG:ShowStaticPopup("RELOAD_UI")
CONFIG:ShowStaticPopup("RELOAD_UI")
end
else
if BARS:IsRestricted() then
CFG:ShowStaticPopup("RELOAD_UI")
CONFIG:ShowStaticPopup("RELOAD_UI")
else
if value then
BARS:CreateBags()
Expand Down Expand Up @@ -186,7 +186,7 @@ local function GetOptionsTable_Bar(barID, order, name)
return temp
end

function CFG:CreateActionBarsPanel(order)
function CONFIG.CreateActionBarsPanel(_, order)
C.options.args.bars = {
order = order,
type = "group",
Expand All @@ -205,7 +205,7 @@ function CFG:CreateActionBarsPanel(order)

if BARS:IsInit() then
if not value then
CFG:ShowStaticPopup("RELOAD_UI")
CONFIG:ShowStaticPopup("RELOAD_UI")
end
else
if value then
Expand All @@ -226,7 +226,7 @@ function CFG:CreateActionBarsPanel(order)
C.db.char.bars.restricted = value

if BARS:IsInit() then
CFG:ShowStaticPopup("RELOAD_UI")
CONFIG:ShowStaticPopup("RELOAD_UI")
end
end
},
Expand Down Expand Up @@ -299,7 +299,7 @@ function CFG:CreateActionBarsPanel(order)
order = 1,
name = L["RESTORE_DEFAULTS"],
func = function()
CFG:CopySettings(D.profile.bars.extra, C.db.profile.bars.extra, {point = true})
CONFIG:CopySettings(D.profile.bars.extra, C.db.profile.bars.extra, {point = true})
BARS:UpdateExtraButton()
end,
},
Expand Down Expand Up @@ -336,7 +336,7 @@ function CFG:CreateActionBarsPanel(order)
order = 1,
name = L["RESTORE_DEFAULTS"],
func = function()
CFG:CopySettings(D.profile.bars.zone, C.db.profile.bars.zone, {point = true})
CONFIG:CopySettings(D.profile.bars.zone, C.db.profile.bars.zone, {point = true})
BARS:UpdateZoneButton()
end,
},
Expand Down Expand Up @@ -373,7 +373,7 @@ function CFG:CreateActionBarsPanel(order)
order = 1,
name = L["RESTORE_DEFAULTS"],
func = function()
CFG:CopySettings(D.profile.bars.vehicle, C.db.profile.bars.vehicle, {point = true})
CONFIG:CopySettings(D.profile.bars.vehicle, C.db.profile.bars.vehicle, {point = true})
BARS:UpdateVehicleExitButton()
end,
},
Expand Down Expand Up @@ -410,7 +410,7 @@ function CFG:CreateActionBarsPanel(order)
order = 1,
name = L["RESTORE_DEFAULTS"],
func = function()
CFG:CopySettings(D.profile.bars.micromenu.tooltip, C.db.profile.bars.micromenu.tooltip)
CONFIG:CopySettings(D.profile.bars.micromenu.tooltip, C.db.profile.bars.micromenu.tooltip)
BARS:UpdateMicroButtons()
end,
},
Expand Down Expand Up @@ -520,7 +520,7 @@ function CFG:CreateActionBarsPanel(order)
if BARS:IsInit() then
if BARS:HasXPBar() then
if not value then
CFG:ShowStaticPopup("RELOAD_UI")
CONFIG:ShowStaticPopup("RELOAD_UI")
end
else
if value then
Expand All @@ -535,7 +535,7 @@ function CFG:CreateActionBarsPanel(order)
order = 2,
name = L["RESTORE_DEFAULTS"],
func = function()
CFG:CopySettings(D.profile.bars.xpbar, C.db.profile.bars.xpbar, {point = true})
CONFIG:CopySettings(D.profile.bars.xpbar, C.db.profile.bars.xpbar, {point = true})
BARS:UpdateXPBar()
end,
disabled = function() return not BARS:HasXPBar() end,
Expand Down
34 changes: 17 additions & 17 deletions config/blizzard.lua
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
local _, ns = ...
local E, C, M, L, P, D = ns.E, ns.C, ns.M, ns.L, ns.P, ns.D
local CFG = P:GetModule("Config")
local BLIZZARD = P:GetModule("Blizzard")
local CONFIG = P:GetModule("Config")

-- Lua
local _G = getfenv(0)

-- Mine
local DRAG_KEYS = {
[1] = ALT_KEY,
[2] = CTRL_KEY,
[3] = SHIFT_KEY,
[4] = NONE_KEY,
[1] = _G.ALT_KEY,
[2] = _G.CTRL_KEY,
[3] = _G.SHIFT_KEY,
[4] = _G.NONE_KEY,
}

local DRAG_KEY_VALUES = {
Expand All @@ -28,7 +28,7 @@ local DRAG_KEY_INDICES = {
NONE = 4,
}

function CFG:CreateBlizzardPanel(order)
function CONFIG.CreateBlizzardPanel(_, order)
C.options.args.blizzard = {
order = order,
type = "group",
Expand All @@ -50,7 +50,7 @@ function CFG:CreateBlizzardPanel(order)
end
else
if not value then
CFG:ShowStaticPopup("RELOAD_UI")
CONFIG:ShowStaticPopup("RELOAD_UI")
end
end
end
Expand Down Expand Up @@ -78,7 +78,7 @@ function CFG:CreateBlizzardPanel(order)
end
else
if not value then
CFG:ShowStaticPopup("RELOAD_UI")
CONFIG:ShowStaticPopup("RELOAD_UI")
end
end
end
Expand All @@ -100,7 +100,7 @@ function CFG:CreateBlizzardPanel(order)
end
else
if not value then
CFG:ShowStaticPopup("RELOAD_UI")
CONFIG:ShowStaticPopup("RELOAD_UI")
end
end
end
Expand All @@ -122,7 +122,7 @@ function CFG:CreateBlizzardPanel(order)
end
else
if not value then
CFG:ShowStaticPopup("RELOAD_UI")
CONFIG:ShowStaticPopup("RELOAD_UI")
end
end
end
Expand All @@ -144,7 +144,7 @@ function CFG:CreateBlizzardPanel(order)
end
else
if not value then
CFG:ShowStaticPopup("RELOAD_UI")
CONFIG:ShowStaticPopup("RELOAD_UI")
end
end
end
Expand All @@ -166,7 +166,7 @@ function CFG:CreateBlizzardPanel(order)
end
else
if not value then
CFG:ShowStaticPopup("RELOAD_UI")
CONFIG:ShowStaticPopup("RELOAD_UI")
end
end
end
Expand All @@ -188,7 +188,7 @@ function CFG:CreateBlizzardPanel(order)
end
else
if not value then
CFG:ShowStaticPopup("RELOAD_UI")
CONFIG:ShowStaticPopup("RELOAD_UI")
end
end
end
Expand All @@ -210,7 +210,7 @@ function CFG:CreateBlizzardPanel(order)
end
else
if not value then
CFG:ShowStaticPopup("RELOAD_UI")
CONFIG:ShowStaticPopup("RELOAD_UI")
end
end
end
Expand All @@ -232,7 +232,7 @@ function CFG:CreateBlizzardPanel(order)
end
else
if not value then
CFG:ShowStaticPopup("RELOAD_UI")
CONFIG:ShowStaticPopup("RELOAD_UI")
end
end
end
Expand All @@ -254,7 +254,7 @@ function CFG:CreateBlizzardPanel(order)
end
else
if not value then
CFG:ShowStaticPopup("RELOAD_UI")
CONFIG:ShowStaticPopup("RELOAD_UI")
end
end
end
Expand All @@ -281,7 +281,7 @@ function CFG:CreateBlizzardPanel(order)
end
else
if not value then
CFG:ShowStaticPopup("RELOAD_UI")
CONFIG:ShowStaticPopup("RELOAD_UI")
end
end
end
Expand Down
Loading

0 comments on commit 03a26c7

Please sign in to comment.