from retail
This commit is contained in:
@@ -991,7 +991,17 @@ local function SetCategories(globalCategories, categories)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function OnlyMetaDataCategory(categories)
|
||||
local metaData = false
|
||||
for category in pairs(categories) do
|
||||
if category == "metadata" then
|
||||
metaData = true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
return metaData
|
||||
end
|
||||
|
||||
local function GetCategories(diff, isRoot)
|
||||
local categories = {}
|
||||
@@ -1001,6 +1011,7 @@ local function GetCategories(diff, isRoot)
|
||||
categories[category] = true
|
||||
end
|
||||
end
|
||||
|
||||
return categories
|
||||
end
|
||||
|
||||
@@ -1042,11 +1053,22 @@ local function BuildDiffsHelper(uid, newUidMap, oldUidMap, matchInfo)
|
||||
oldUidMap:SetDiff(matchedUid, diff, categories)
|
||||
SetCategories(matchInfo.activeCategories, categories)
|
||||
|
||||
matchInfo.diffs[uid] = true
|
||||
if isGroup then
|
||||
matchInfo.modifiedGroupCount = matchInfo.modifiedGroupCount + 1
|
||||
matchInfo.categories[uid] = categories
|
||||
|
||||
if OnlyMetaDataCategory(categories) then
|
||||
matchInfo.onlyMetaDataModified[uid] = true
|
||||
if isGroup then
|
||||
matchInfo.modifiedMetaDataGroupCount = matchInfo.modifiedMetaDataGroupCount + 1
|
||||
else
|
||||
matchInfo.modifiedMetaDataCount = matchInfo.modifiedMetaDataCount + 1
|
||||
end
|
||||
else
|
||||
matchInfo.modifiedCount = matchInfo.modifiedCount + 1
|
||||
matchInfo.modified[uid] = true
|
||||
if isGroup then
|
||||
matchInfo.modifiedGroupCount = matchInfo.modifiedGroupCount + 1
|
||||
else
|
||||
matchInfo.modifiedCount = matchInfo.modifiedCount + 1
|
||||
end
|
||||
end
|
||||
else
|
||||
matchInfo.unmodified[uid] = true
|
||||
@@ -1140,6 +1162,8 @@ end
|
||||
local function hasChanges(matchInfo)
|
||||
return matchInfo.modifiedCount > 0
|
||||
or matchInfo.modifiedGroupCount > 0
|
||||
or matchInfo.modifiedMetaDataCount > 0
|
||||
or matchInfo.modifiedMetaDataGroupCount > 0
|
||||
or matchInfo.addedCount > 0
|
||||
or matchInfo.addedGroupCount > 0
|
||||
or matchInfo.deletedCount > 0
|
||||
@@ -1151,13 +1175,17 @@ local function BuildDiffs(newUidMap, oldUidMap)
|
||||
local matchInfo = {
|
||||
modifiedCount = 0,
|
||||
modifiedGroupCount = 0,
|
||||
modifiedMetaDataCount = 0,
|
||||
modifiedMetaDataGroupCount = 0,
|
||||
unmodifiedCount = 0,
|
||||
unmodifiedGroupCount = 0,
|
||||
addedCount = 0,
|
||||
addedGroupCount = 0,
|
||||
deletedCount = 0,
|
||||
deletedGroupCount = 0,
|
||||
diffs = {}, -- Contains diffs for new uids
|
||||
modified = {}, -- Contains uids that were modified
|
||||
onlyMetaDataModified = {}, -- Contains uids that are only metadata modified
|
||||
categories = {}, -- Contains categories for uids
|
||||
unmodified = {}, -- Contains new uids that had a empty diff
|
||||
added = {}, -- Contains new uids that were added
|
||||
deleted = {}, -- Contains old uids that were removed
|
||||
@@ -1228,7 +1256,21 @@ local function MatchInfo(data, children, target)
|
||||
return matchInfo
|
||||
end
|
||||
|
||||
local function AddAuraList(container, uidMap, list, expandText)
|
||||
local function CategoriesToDisplayText(categories)
|
||||
local categoriesDisplayTexts = {}
|
||||
for _, category in ipairs(OptionsPrivate.Private.update_categories) do
|
||||
if categories[category.name] then
|
||||
tinsert(categoriesDisplayTexts, category.label)
|
||||
end
|
||||
end
|
||||
if #categoriesDisplayTexts > 0 then
|
||||
return table.concat(categoriesDisplayTexts, ", ")
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
local function AddAuraList(container, uidMap, list, categories, expandText)
|
||||
local expand = AceGUI:Create("WeakAurasExpand")
|
||||
local collapsed = true
|
||||
local image = collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\expand"
|
||||
@@ -1247,7 +1289,16 @@ local function AddAuraList(container, uidMap, list, expandText)
|
||||
|
||||
local sortedNames = {}
|
||||
for uid in pairs(list) do
|
||||
tinsert(sortedNames, uidMap:GetIdFor(uid))
|
||||
if categories[uid] then
|
||||
local categoriesText = CategoriesToDisplayText(categories[uid])
|
||||
if categoriesText then
|
||||
tinsert(sortedNames, L["%s (%s)"]:format(uidMap:GetIdFor(uid), categoriesText))
|
||||
else
|
||||
tinsert(sortedNames, uidMap:GetIdFor(uid))
|
||||
end
|
||||
else
|
||||
tinsert(sortedNames, uidMap:GetIdFor(uid))
|
||||
end
|
||||
end
|
||||
table.sort(sortedNames)
|
||||
|
||||
@@ -1277,7 +1328,7 @@ local function AddAuraList(container, uidMap, list, expandText)
|
||||
end
|
||||
|
||||
local methods = {
|
||||
Open = function(self, data, children, target, sender, callbackFunc)
|
||||
Open = function(self, data, children, target, linkedAuras, sender, callbackFunc)
|
||||
if(self.optionsWindow.window == "importexport") then
|
||||
self.optionsWindow.importexport:Close();
|
||||
elseif(self.optionsWindow.window == "texture") then
|
||||
@@ -1294,6 +1345,7 @@ local methods = {
|
||||
data = data,
|
||||
children = children or {},
|
||||
target = target,
|
||||
linkedAuras = linkedAuras,
|
||||
sender = sender
|
||||
}
|
||||
self.userChoices = {
|
||||
@@ -1355,13 +1407,22 @@ local methods = {
|
||||
local matchInfoText = L["This is a modified version of your group: |cff9900FF%s|r"]:format(oldRootId)
|
||||
matchInfoResult:SetText(matchInfoText)
|
||||
if matchInfo.addedCount ~= 0 then
|
||||
AddAuraList(self, matchInfo.newUidMap, matchInfo.added, L["%d |4aura:auras; added"]:format(matchInfo.addedCount))
|
||||
AddAuraList(self, matchInfo.newUidMap, matchInfo.added, {},
|
||||
L["%d |4aura:auras; added"]:format(matchInfo.addedCount))
|
||||
end
|
||||
if matchInfo.modifiedCount ~= 0 then
|
||||
AddAuraList(self, matchInfo.oldUidMap, matchInfo.diffs, L["%d |4aura:auras; modified"]:format(matchInfo.modifiedCount))
|
||||
local modifiedCount = matchInfo.modifiedCount + matchInfo.modifiedGroupCount
|
||||
if modifiedCount ~= 0 then
|
||||
AddAuraList(self, matchInfo.oldUidMap, matchInfo.modified, matchInfo.categories,
|
||||
L["%d |4aura:auras; modified"]:format(modifiedCount))
|
||||
end
|
||||
local onlyMetaDataModifiedCount = matchInfo.modifiedMetaDataCount + matchInfo.modifiedMetaDataGroupCount
|
||||
if onlyMetaDataModifiedCount ~= 0 then
|
||||
AddAuraList(self, matchInfo.oldUidMap, matchInfo.onlyMetaDataModified, {},
|
||||
L["%d |4aura:auras; with meta data modified"]:format(onlyMetaDataModifiedCount))
|
||||
end
|
||||
if matchInfo.deletedCount ~= 0 then
|
||||
AddAuraList(self, matchInfo.oldUidMap, matchInfo.deleted, L["%d |4aura:auras; deleted"]:format(matchInfo.deletedCount))
|
||||
AddAuraList(self, matchInfo.oldUidMap, matchInfo.deleted, {},
|
||||
L["%d |4aura:auras; deleted"]:format(matchInfo.deletedCount))
|
||||
end
|
||||
else
|
||||
matchInfoResult:SetText(L["This is a modified version of your aura, |cff9900FF%s.|r"]:format(oldRootId))
|
||||
@@ -1444,6 +1505,23 @@ local methods = {
|
||||
self:AddChild(scamCheckText)
|
||||
end
|
||||
|
||||
if linkedAuras and next(linkedAuras) then
|
||||
self:AddChild(AceGUI:Create("WeakAurasSpacer"))
|
||||
|
||||
local linkedAurasText = AceGUI:Create("Label")
|
||||
linkedAurasText:SetFontObject(GameFontHighlight)
|
||||
linkedAurasText:SetFullWidth(true)
|
||||
|
||||
local auraIdText = table.concat(self.pendingData.linkedAuras, ", ")
|
||||
if #self.pendingData.linkedAuras == 1 then
|
||||
linkedAurasText:SetText(L["This aura is marked as an update to an aura '%s', but cannot be used to update that aura. This usually happens if an aura is moved out of a group."]:format(auraIdText))
|
||||
else
|
||||
linkedAurasText:SetText(L["This aura is marked as an update to auras '%s', but cannot be used to update them. This usually happens if an aura is moved out of a group."]:format(auraIdText))
|
||||
end
|
||||
linkedAurasText:SetColor(1, 0, 0)
|
||||
self:AddChild(linkedAurasText)
|
||||
end
|
||||
|
||||
-- Let people install auras that are newer than their version of WeakAuras
|
||||
local highestVersion = data.internalVersion or 0
|
||||
if children then
|
||||
|
||||
Reference in New Issue
Block a user