From 6cdf7547df4092ae1119314a7657fb6515da9793 Mon Sep 17 00:00:00 2001 From: James Whitehead II Date: Fri, 27 Mar 2009 12:10:08 +0000 Subject: [PATCH] * Fix profile switching system so it stores the options in 'char' rather than 'profile'.. duur --- Clique.lua | 24 +++++++++++++----------- CliqueOptions.lua | 28 ++++++++++++++-------------- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/Clique.lua b/Clique.lua index de91a4e..62d9128 100644 --- a/Clique.lua +++ b/Clique.lua @@ -30,8 +30,10 @@ function Clique:Enable() blacklist = { }, tooltips = false, + }, + char = { switchSpec = false, - } + }, } self.db = self:InitializeDB("CliqueDB", self.defaults) @@ -70,13 +72,13 @@ function Clique:Enable() self:RegisterEvent("PLAYER_TALENT_UPDATE") -- Change to correct profile based on talent spec - if self.db.profile.switchSpec then + if self.db.char.switchSpec then self.silentProfile = true self.talentGroup = GetActiveTalentGroup() - if self.talentGroup == 1 and self.db.profile.primaryProfile then - self.db:SetProfile(self.db.profile.primaryProfile) - elseif self.talentGroup == 2 and self.db.profile.secondaryProfile then - self.db:SetProfile(self.db.profile.secondaryProfile) + if self.talentGroup == 1 and self.db.char.primaryProfile then + self.db:SetProfile(self.db.char.primaryProfile) + elseif self.talentGroup == 2 and self.db.char.secondaryProfile then + self.db:SetProfile(self.db.char.secondaryProfile) end self.silentProfile = false end @@ -721,13 +723,13 @@ end function Clique:PLAYER_TALENT_UPDATE() local newGroup = GetActiveTalentGroup() - if self.db.profile.switchSpec and newGroup ~= self.talentGroup then + if self.db.char.switchSpec and newGroup ~= self.talentGroup then self.talentGroup = newGroup self:Print("Detected a talent spec change, changing profile") - if self.talentGroup == 1 and self.db.profile.primaryProfile then - self.db:SetProfile(self.db.profile.primaryProfile) - elseif self.talentGroup == 2 and self.db.profile.secondaryProfile then - self.db:SetProfile(self.db.profile.secondaryProfile) + if self.talentGroup == 1 and self.db.char.primaryProfile then + self.db:SetProfile(self.db.char.primaryProfile) + elseif self.talentGroup == 2 and self.db.char.secondaryProfile then + self.db:SetProfile(self.db.char.secondaryProfile) end if CliqueFrame then CliqueFrame.title:SetText("Clique v. " .. Clique.version .. " - " .. tostring(Clique.db.keys.profile)); diff --git a/CliqueOptions.lua b/CliqueOptions.lua index 2157f59..20d798e 100644 --- a/CliqueOptions.lua +++ b/CliqueOptions.lua @@ -1864,7 +1864,7 @@ function Clique:CreateOptionsWidgets(parent) local function initialize(self, level) local function OnClick(self) UIDropDownMenu_SetSelectedID(priDropdown, self:GetID()) - Clique.db.profile.primaryProfile = self.value + Clique.db.char.primaryProfile = self.value Clique:UpdateClicks() end @@ -1887,8 +1887,8 @@ function Clique:CreateOptionsWidgets(parent) UIDropDownMenu_SetWidth(priDropdown, 175); UIDropDownMenu_SetButtonWidth(priDropdown, 199) UIDropDownMenu_JustifyText(priDropdown, "LEFT") - if Clique.db.profile.primaryProfile then - UIDropDownMenu_SetSelectedValue(priDropdown, Clique.db.profile.primaryProfile) + if Clique.db.char.primaryProfile then + UIDropDownMenu_SetSelectedValue(priDropdown, Clique.db.char.primaryProfile) else UIDropDownMenu_SetSelectedValue(priDropdown, Clique.db.keys.profile) end @@ -1905,7 +1905,7 @@ function Clique:CreateOptionsWidgets(parent) local function initialize(self, level) local function OnClick(self) UIDropDownMenu_SetSelectedID(secDropdown, self:GetID()) - Clique.db.profile.secondaryProfile = self.value + Clique.db.char.secondaryProfile = self.value Clique:UpdateClicks() end @@ -1928,24 +1928,24 @@ function Clique:CreateOptionsWidgets(parent) UIDropDownMenu_SetWidth(secDropdown, 175); UIDropDownMenu_SetButtonWidth(secDropdown, 199) UIDropDownMenu_JustifyText(secDropdown, "LEFT") - if Clique.db.profile.secondaryProfile then - UIDropDownMenu_SetSelectedValue(secDropdown, Clique.db.profile.secondaryProfile) + if Clique.db.char.secondaryProfile then + UIDropDownMenu_SetSelectedValue(secDropdown, Clique.db.char.secondaryProfile) else UIDropDownMenu_SetSelectedValue(secDropdown, Clique.db.keys.profile) end local function refreshOptions(self) -- Hide the dropdowns if the spec switch option isn't selected - local switchSpec = Clique.db.profile.switchSpec + local switchSpec = Clique.db.char.switchSpec CliqueOptionsSpecSwitch:SetChecked(switchSpec) if switchSpec then CliquePriSpecDropDown:Show() CliqueSecSpecDropDown:Show() - if not Clique.db.profile.primaryProfile then - Clique.db.profile.primaryProfile = Clique.db.keys.profile + if not Clique.db.char.primaryProfile then + Clique.db.char.primaryProfile = Clique.db.keys.profile end - if not Clique.db.profile.secondaryProfile then - Clique.db.profile.secondaryProfile = Clique.db.keys.profile + if not Clique.db.char.secondaryProfile then + Clique.db.char.secondaryProfile = Clique.db.keys.profile end else CliquePriSpecDropDown:Hide() @@ -1954,10 +1954,10 @@ function Clique:CreateOptionsWidgets(parent) end parent:SetScript("OnShow", refreshOptions) switchSpec:SetScript("OnClick", function(self) - if Clique.db.profile.switchSpec then - Clique.db.profile.switchSpec = false + if Clique.db.char.switchSpec then + Clique.db.char.switchSpec = false else - Clique.db.profile.switchSpec = true + Clique.db.char.switchSpec = true end refreshOptions(parent) Clique:UpdateClicks() -- 1.7.9.5