Skip to content
This repository has been archived by the owner on Oct 6, 2020. It is now read-only.

Database rework reminder! #3

Closed
ghost opened this issue Jun 13, 2017 · 3 comments
Closed

Database rework reminder! #3

ghost opened this issue Jun 13, 2017 · 3 comments
Assignees

Comments

@ghost
Copy link

ghost commented Jun 13, 2017

This is just a reminder for the Database rework.

https://www.wowinterface.com/downloads/info24061-Wasabi.html#comments
From the link above you can see my examples.

Hey, p3lim. Once again thank you for your work.

Currently, I noticed you have to use a Database for each module you make. The below example should explain more.

local General = LibStub("Wasabi"):New(K.Title, "GeneralDB", C.General)
General:AddSlash("/kkthnxui")
General:Initialize(function(self)
  local Title = self:CreateTitle()
    Title:SetPoint("TOPLEFT", 16, -16)
    Title:SetText("General Options")
 
    local AutoScale_OnEnter = function(self)
        GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT")
        GameTooltip:AddLine("Automatically scale the User Interface based on your screen resolution", 0, 1, 0)
        GameTooltip:Show()
    end
 
  local AutoScale = self:CreateCheckButton("AutoScale")
    AutoScale:SetPoint("TOPLEFT", Title, "BOTTOMLEFT", 0, -8)
    AutoScale:SetText("Auto Scale Resolution")
    AutoScale:SetScript("OnEnter", AutoScale_OnEnter)
    AutoScale:SetScript("OnLeave", GameTooltip_Hide)
 
    local FontSize_OnEnter = function(self)
        GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT")
        GameTooltip:AddLine("Set the font size for everything in UI. Note: This doesn't effect somethings that have their own seperate options (UnitFrame Font, Datatext Font, ect..)", 0, 1, 0)
        GameTooltip:Show()
    end
 
    local FontSize = self:CreateSlider("FontSize")
    FontSize:SetRange(10, 20)
    FontSize:SetStep(1)
    FontSize:SetPoint("TOPLEFT", AutoScale, "BOTTOMLEFT", 0, -8)
    FontSize:SetText("Set UI Font Size")
    FontSize:SetScript("OnEnter", FontSize_OnEnter)
    FontSize:SetScript("OnLeave", GameTooltip_Hide)
end)
 
local ActionBar = General:CreateChild("ActionBar", "ActionBarDB", C.ActionBar)
ActionBar:Initialize(function(self)
  local Title = self:CreateTitle()
    Title:SetPoint("TOPLEFT", 16, -16)
    Title:SetText("ActionBar Options")
 
end)

So, in theory, I am wondering something here. I am wanting to just use one SavedVariable for everything. I just want to use KkthnxUIDB instead of filling ActionBarDB, GeneralDB, NameplatesDB and so on. Now I could have overlooked this as I am still checking out your Lib.

To kinda show what I am wanting is more of a compact Database from your config. Would be a lot cleaner.

KkthnxUIData = {
    ["Stormreaver"] = {
        ["Gripsohard"] = {
            ["SplitBars"] = true,
            ["Movers"] = {
                ["Loot / Alert Frames"] = {
                    "CENTER", -- [1]
                    "UIParent", -- [2]
                    "CENTER", -- [3]
                    -334, -- [4]
                    60.9999656677246, -- [5]
                },
            },
            ["BottomBars"] = 2,
            ["RightBars"] = 1,
            ["InstallComplete"] = true,
            ["BarsLocked"] = true,
        },
        ["Pervie"] = {
            ["SplitBars"] = true,
            ["Movers"] = {
                ["Loot / Alert Frames"] = {
                    "CENTER", -- [1]
                    "UIParent", -- [2]
                    "CENTER", -- [3]
                    -334, -- [4]
                    60.9999656677246, -- [5]
                },
                ["KkthnxUIBuffHeader"] = {
                    "RIGHT", -- [1]
                    "UIParent", -- [2]
                    "RIGHT", -- [3]
                    -324.000183105469, -- [4]
                    119.999938964844, -- [5]
                },
            },
            ["BottomBars"] = 2,
            ["RightBars"] = 1,
            ["InstallComplete"] = true,
            ["BarsLocked"] = true,
        },
    },
}
@p3lim
Copy link
Member

p3lim commented Jun 13, 2017

I could add an option to specify a table key to use within an existing table. It wouldn't be completely merged like you wanted, but it would be in one parent table.
Something like this: Wasabi:New(name, 'KkthnxUIData', 'General', defaults)

KkthnxUIData = {
    ["General"] = {
        ["AutoScale"] = true,
        ["FontSize"] = 13,
    },
    ["ActionBars"] = {
        ["BarsLocked"] = true,
    },
}

Another alternative is simply allowing no savedvariable passed to sub-frames, let them leech off the main one. I'll see what I'll do.

Also, next version will have profile management, so yo won't need to implement that yourself.

@p3lim p3lim self-assigned this Jun 13, 2017
@ghost
Copy link
Author

ghost commented Jun 13, 2017

You simply rock! Looking forward to the profile management. Thank you for the info.

@p3lim
Copy link
Member

p3lim commented Jul 18, 2018

This one is sadly delayed as I can't really find a good way to implement this.
Profiles are still being considered though, but sub-tables sadly won't be.

Superseded by #1.

@p3lim p3lim closed this as completed Jul 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

1 participant