Skip to content

Commit

Permalink
Updating import/exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
funkjedi committed Dec 3, 2022
1 parent f017aa3 commit 7df29a7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Libs/Libs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Include file="AceConsole-3.0\AceConsole-3.0.xml"/>
<Include file="AceDB-3.0\AceDB-3.0.xml"/>
<Include file="AceEvent-3.0\AceEvent-3.0.xml"/>
<!-- <Include file="AceGUI-3.0\AceGUI-3.0.xml"/> -->
<Include file="AceGUI-3.0\AceGUI-3.0.xml"/>
<Include file="AceSerializer-3.0\AceSerializer-3.0.xml"/>
<Include file="AceTimer-3.0\AceTimer-3.0.xml"/>
<Include file="LibDeflate\lib.xml"/>
Expand Down
27 changes: 23 additions & 4 deletions Wago.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local addonName, ATOM = ...
local Module = ATOM:NewModule('Wago')

local CopyIntoTable, CompressData, DecompressData, GetField
local SelectAddon, SelectAddonProfile, SelectImportBtn, SelectExportBtn, UpdateDisabledStates
local GetAddon, SelectAddon, SelectAddonProfile, SelectImportBtn, SelectExportBtn, UpdateDisabledStates

function Module:ShowWindow()
Module.minwidth = 720
Expand Down Expand Up @@ -41,11 +41,17 @@ function Module:ShowWindow()
group2:SetFullWidth(true)
group1:AddChild(group2)

local supportedAddons = {}

if GetAddon('Dominos') then
supportedAddons['Dominos.db'] = 'Dominos'
end

local addonDropdown = AceGUI:Create('Dropdown')
addonDropdown:SetMultiselect(false)
addonDropdown:SetLabel('Select addon:')
addonDropdown:SetWidth(200)
addonDropdown:SetList({ ['Dominos.db'] = 'Dominos', ['MasqueDB'] = 'Masque' })
addonDropdown:SetList(supportedAddons)
addonDropdown:SetCallback('OnValueChanged', SelectAddon)
window.addonDropdown = addonDropdown
group2:AddChild(addonDropdown)
Expand Down Expand Up @@ -112,21 +118,34 @@ function Module:ShowWindow()
SelectAddon(addonDropdown, 'OnValueChanged', 'Dominos.db')
end

function GetAddon(addon)
if _G[addon] then
return _G[addon]
end

return LibStub('AceAddon-3.0'):GetAddon(addon, true)
end

function GetField(field)
local var = _G

for name in string.gmatch(field, '[%w_]+') do
if type(var) == 'table' then
if var == _G then
var = GetAddon(name)
elseif type(var) == 'table' then
var = var[name]
else
var = nil
end
end

return var
end

function SelectAddon(widget, event, key)
local database = GetField(key)
local profiles = {}, currentProfile
local profiles = {}
local currentProfile

if database then
currentProfile = database:GetCurrentProfile()
Expand Down

0 comments on commit 7df29a7

Please sign in to comment.