big update

This commit is contained in:
Crum
2019-01-12 12:09:06 -06:00
parent eebdf23364
commit aaf50317e5
45 changed files with 500 additions and 480 deletions
+5 -5
View File
@@ -32,7 +32,7 @@ function CP:CreateModuleConfigGroup(Name, section, pluginSection)
general = {
order = 1,
type = "toggle",
name = GENERAL
name = L["General"]
},
PreButtonSpacer = {
order = 200,
@@ -140,7 +140,7 @@ end
function CP:CopyTable(CopyFrom, CopyTo, CopyDefault, module)
for key, value in pairs(CopyTo) do
if type(value) ~= "table" then
if module == true or (type(module) == "table" and module.general == nil or (not CopyTo.general and module.general)) then --Some dark magic of a logic to figure out stuff
if module == true or (type(module) == "table" and (module.general == nil or (not CopyTo.general and module.general))) then --Some dark magic of a logic to figure out stuff
--This check is to see if the profile we are copying from has keys absent from defaults.
--If key exists, then copy. If not, then clear obsolite key from the profile.
if CopyDefault[key] ~= nil then
@@ -153,7 +153,7 @@ function CP:CopyTable(CopyFrom, CopyTo, CopyDefault, module)
if module == true then --Copy over entire section of profile subgroup
E:CopyTable(CopyTo, CopyDefault)
E:CopyTable(CopyTo, CopyFrom)
elseif module[key] ~= nil then
elseif type(module) == "table" and module[key] ~= nil then
--Making sure tables actually exist in profiles (e.g absent values in ElvDB.profiles are for default values)
CopyFrom[key], CopyTo[key] = CP:TablesExist(CopyFrom[key], CopyTo[key], CopyDefault[key])
--If key exists, then copy. If not, then clear obsolite key from the profile.
@@ -200,12 +200,12 @@ function CP:ImportFromProfile(section, pluginSection)
--Some checks for the occasion someone passes wrong stuff
if not section then error("No profile section provided. Usage CP:ImportFromProfile(\"section\")") end
if not pluginSection and CP.InternalOptions[section] then error(format("Section name could not be \"%s\". This name is reserved for internal setting"), section) end
if pluginSection and CP.InternalOptions[pluginSection][section] then error(format("Section name for plugin group \"%s\" could not be \"%s\". This name is reserved for internal setting"), pluginSection, section) end
if pluginSection and (CP.InternalOptions[pluginSection] and CP.InternalOptions[pluginSection][section]) then error(format("Section name for plugin group \"%s\" could not be \"%s\". This name is reserved for internal setting"), pluginSection, section) end
local module = pluginSection and E.global.profileCopy[pluginSection][section] or E.global.profileCopy[section]
if not module then error(format("Provided section name \"%s\" does not have a template for profile copy.", section)) end
--Starting digging through the settings
local CopyFrom = pluginSection and ElvDB.profiles[E.global.profileCopy.selected][pluginSection][section] or ElvDB.profiles[E.global.profileCopy.selected][section]
local CopyFrom = pluginSection and (ElvDB.profiles[E.global.profileCopy.selected][pluginSection] and ElvDB.profiles[E.global.profileCopy.selected][pluginSection][section] or P[pluginSection][section]) or ElvDB.profiles[E.global.profileCopy.selected][section]
local CopyTo = pluginSection and E.db[pluginSection][section] or E.db[section]
local CopyDefault = pluginSection and P[pluginSection][section] or P[section]
--Making sure tables actually exist in profiles (e.g absent values in ElvDB.profiles are for default values)