Merge branch 'hotfix/profiles' into main
This commit is contained in:
commit
03d127fd39
@ -22,7 +22,7 @@ local MAJOR, MINOR = "Gladdy", 4
|
||||
local Gladdy = LibStub:NewLibrary(MAJOR, MINOR)
|
||||
local L
|
||||
Gladdy.version_major = "TBC-Classic_v1"
|
||||
Gladdy.version_minor = "0.3-Beta"
|
||||
Gladdy.version_minor = "0.4-Beta"
|
||||
Gladdy.version = Gladdy.version_major .. "." .. Gladdy.version_minor
|
||||
|
||||
LibStub("AceTimer-3.0"):Embed(Gladdy)
|
||||
|
@ -1,6 +1,6 @@
|
||||
## Interface: 20501
|
||||
## Title: Gladdy - TBC
|
||||
## Version: 1.0.3-Beta
|
||||
## Version: 1.0.4-Beta
|
||||
## Notes: The most powerful arena AddOn for WoW 2.5.1
|
||||
## Author: XiconQoo, DnB_Junkee, Knall
|
||||
## X-Email: contact me on discord Knall#1751
|
||||
|
@ -18,19 +18,11 @@ local function table_copy(t)
|
||||
return t2;
|
||||
end
|
||||
|
||||
local function applyImport(t)
|
||||
for k,v in pairs(t) do
|
||||
if type(v) == "table" then
|
||||
applyImport(v, Gladdy.dbi.profile[k]);
|
||||
else
|
||||
Gladdy.dbi.profile[k] = v;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local ExportImport = Gladdy:NewModule("ExportImport", nil, {
|
||||
})
|
||||
|
||||
|
||||
|
||||
local export = AceGUI:Create("Frame")
|
||||
export:SetWidth(550)
|
||||
export.sizer_se:Hide()
|
||||
@ -72,7 +64,7 @@ importButton:SetText("Import\n(this will overwrite your current profile!)")
|
||||
importButton:SetWidth(200)
|
||||
importButton:SetHeight(50)
|
||||
importButton:SetCallback("OnClick", function(widget)
|
||||
applyImport(import.deserializedTable)
|
||||
ExportImport:ApplyImport(import.deserializedTable)
|
||||
Gladdy:UpdateFrame()
|
||||
import:Hide()
|
||||
end)
|
||||
@ -154,35 +146,10 @@ function ExportImport:GetOptions()
|
||||
import.statustext:SetTextColor(1,0,0)
|
||||
import.eb:SetFocus()
|
||||
import.eb:SetCallback("OnTextChanged", function(widget)
|
||||
local decoded_string = LibDeflate:DecodeForPrint(widget:GetText())
|
||||
if not decoded_string then
|
||||
import.statustext:SetTextColor(1,0,0)
|
||||
import:SetStatusText("Invalid Import String FAILED LibDeflate:DecodeForPrint")
|
||||
import.button.frame:Disable()
|
||||
local deserialized = ExportImport:Decode(widget:GetText(), true)
|
||||
if not deserialized then
|
||||
return
|
||||
end
|
||||
local decompress_deflate = LibDeflate:DecompressZlib(decoded_string)
|
||||
if not decompress_deflate then
|
||||
import.statustext:SetTextColor(1,0,0)
|
||||
import:SetStatusText("Invalid Import String FAILED LibDeflate:DecompressZlib")
|
||||
import.button.frame:Disable()
|
||||
return
|
||||
end
|
||||
local success, deserialized = AceSerializer:Deserialize(decompress_deflate)
|
||||
if not success then
|
||||
import.statustext:SetTextColor(1,0,0)
|
||||
import:SetStatusText("Invalid Import String FAILED AceSerializer:Deserialize")
|
||||
import.button.frame:Disable()
|
||||
return
|
||||
end
|
||||
local statusOption, error = ExportImport:CheckDeserializedOptions(deserialized, Gladdy.db)
|
||||
if not statusOption then
|
||||
import.statustext:SetTextColor(1,0,0)
|
||||
import:SetStatusText(error)
|
||||
import.button.frame:Disable()
|
||||
return
|
||||
end
|
||||
|
||||
import.statustext:SetTextColor(0,1,0)
|
||||
import:SetStatusText("SUCCESS")
|
||||
import.button.frame:Enable()
|
||||
@ -195,3 +162,56 @@ function ExportImport:GetOptions()
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
function ExportImport:ApplyImport(t, table)
|
||||
if table == nil then
|
||||
table = Gladdy.dbi.profile
|
||||
end
|
||||
for k,v in pairs(t) do
|
||||
if type(v) == "table" then
|
||||
ExportImport:ApplyImport(v, table[k])
|
||||
else
|
||||
table[k] = v;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ExportImport:Decode(str, showError)
|
||||
local decoded_string = LibDeflate:DecodeForPrint(str)
|
||||
if not decoded_string then
|
||||
if showError then
|
||||
import.statustext:SetTextColor(1,0,0)
|
||||
import:SetStatusText("Invalid Import String FAILED LibDeflate:DecodeForPrint")
|
||||
import.button.frame:Disable()
|
||||
end
|
||||
return nil
|
||||
end
|
||||
local decompress_deflate = LibDeflate:DecompressZlib(decoded_string)
|
||||
if not decompress_deflate then
|
||||
if showError then
|
||||
import.statustext:SetTextColor(1,0,0)
|
||||
import:SetStatusText("Invalid Import String FAILED LibDeflate:DecompressZlib")
|
||||
import.button.frame:Disable()
|
||||
end
|
||||
return nil
|
||||
end
|
||||
local success, deserialized = AceSerializer:Deserialize(decompress_deflate)
|
||||
if not success then
|
||||
if showError then
|
||||
import.statustext:SetTextColor(1,0,0)
|
||||
import:SetStatusText("Invalid Import String FAILED AceSerializer:Deserialize")
|
||||
import.button.frame:Disable()
|
||||
end
|
||||
return nil
|
||||
end
|
||||
local statusOption, error = ExportImport:CheckDeserializedOptions(deserialized, Gladdy.db)
|
||||
if not statusOption then
|
||||
if showError then
|
||||
import.statustext:SetTextColor(1,0,0)
|
||||
import:SetStatusText(error)
|
||||
import.button.frame:Disable()
|
||||
end
|
||||
return nil
|
||||
end
|
||||
return deserialized
|
||||
end
|
File diff suppressed because one or more lines are too long
@ -1,7 +1,7 @@
|
||||
# Gladdy - TBC
|
||||
|
||||
### The most powerful arena addon for WoW TBC 2.5.1
|
||||
## [v1.0.3-Beta Download Here](https://github.com/XiconQoo/Gladdy-TBC/releases/download/v1.0.3-Beta/Gladdy_TBC-Classic_v1.0.3-Beta.zip)
|
||||
## [v1.0.4-Beta Download Here](https://github.com/XiconQoo/Gladdy-TBC/releases/download/v1.0.4-Beta/Gladdy_TBC-Classic_v1.0.4-Beta.zip)
|
||||
|
||||
###### <a target="_blank" rel="noopener noreferrer" href="https://www.paypal.me/xiconqoo/10"><img src="https://raw.githubusercontent.com/XiconQoo/Gladdy/readme-media/Paypal-Donate.png" height="30" style="margin-top:-30px;position:relative;top:20px;"></a> Please consider donating if you like my work
|
||||
|
||||
@ -35,5 +35,8 @@ The goal is to make Gladdy highly configurable in it's appearance. Everything ca
|
||||
|
||||
### Changes
|
||||
|
||||
#### v1.0.4-Beta
|
||||
- XiconProfiles fixed
|
||||
|
||||
#### v1.0.0-Beta
|
||||
- port form 2.4.3
|
Loading…
Reference in New Issue
Block a user