Skip to content

Commit 561db04

Browse files
author
Maelareth
committed
feat(nicknames): finalise NSRT precedence popup
- Localise all popup strings (L[...] + enUS registration); addon names are passed as format args so translators never touch them - Add a Name precedence dropdown to the Nicknames options page (only shown when NSRT is installed), making good on the popup's 'change it later' promise - Only prompt when the user actually has DF nicknames to show (entries, received, or a broadcast nick) - without this every NSRT user would get the popup with nothing to choose between - CHANGELOG entry
1 parent 2c7233b commit 561db04

4 files changed

Lines changed: 54 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
* Moved **Pixel-Perfect Scaling** to **General → Settings**, since it applies globally to both party and raid. (by Krathe)
4141
* (Aura Designer) New icon and square indicators now default their **border inset to 0**, flush with the icon edge, matching the other indicator types. (by Krathe)
4242
* (Auto Layouts) Saved layouts are tidied of leftover built-in text overrides after the Text Designer migration, so the override list no longer lists dead entries. (by Krathe)
43+
* (Nicknames) **Northern Sky Raid Tools compatibility** — when NSRT is also set to put nicknames on DandersFrames frames, a one-time prompt lets you choose which addon decides the names shown on your frames (changeable later under **General → Nicknames → Name precedence**), so the two no longer silently fight. (by Maelareth)
4344

4445
### Bug Fixes
4546

Features/Nicknames.lua

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,8 +1042,7 @@ end
10421042
-- so the two would fight. We detect that, prompt the user once which should
10431043
-- win, and store the choice (framePrecedence) which DF:GetFrameName honours.
10441044
-- Entirely DF-side: we never modify NSRT, only READ its toggle.
1045-
-- NOTE: strings here are hard-coded for the prototype — localise (L[...] +
1046-
-- enUS) before merge.
1045+
-- The same choice can be changed later in the Nicknames options page.
10471046
-- ============================================================
10481047

10491048
-- True if NSRT is loaded AND configured to manage names on DandersFrames frames.
@@ -1086,6 +1085,7 @@ end
10861085
function NK:ShowConflictPopup()
10871086
if NK._conflictPopup then NK._conflictPopup:Show(); return end
10881087

1088+
local L = DF.L
10891089
local theme = (DF.GUI and DF.GUI.GetThemeColor and DF.GUI.GetThemeColor())
10901090
or { r = 0.9, g = 0.55, b = 0.15 }
10911091

@@ -1106,7 +1106,7 @@ function NK:ShowConflictPopup()
11061106

11071107
local title = popup:CreateFontString(nil, "OVERLAY", "DFFontNormalLarge")
11081108
title:SetPoint("TOP", 0, -16)
1109-
title:SetText("Addon nicknames conflict")
1109+
title:SetText(L["Addon nicknames conflict"])
11101110
title:SetTextColor(1, 0.3, 0.3)
11111111

11121112
local warnTex = "Interface\\AddOns\\DandersFrames\\Media\\Icons\\warning"
@@ -1118,12 +1118,13 @@ function NK:ShowConflictPopup()
11181118
local msg = popup:CreateFontString(nil, "OVERLAY", "DFFontHighlight")
11191119
msg:SetPoint("TOP", title, "BOTTOM", 0, -16)
11201120
msg:SetPoint("LEFT", 28, 0); msg:SetPoint("RIGHT", -28, 0); msg:SetJustifyH("CENTER")
1121-
msg:SetText("Both |cffe68c26DandersFrames|r and |cff6fb1e0Northern Sky Raid Tools|r are set to show nicknames on your frames.\n\nWhich one should decide the names shown here?")
1121+
msg:SetText(L["Both %s and %s are set to show nicknames on your frames.\n\nWhich one should decide the names shown here?"]
1122+
:format("|cffe68c26DandersFrames|r", "|cff6fb1e0Northern Sky Raid Tools|r"))
11221123

11231124
local sub = popup:CreateFontString(nil, "OVERLAY", "DFFontHighlightSmall")
11241125
sub:SetPoint("TOP", msg, "BOTTOM", 0, -12)
11251126
sub:SetPoint("LEFT", 28, 0); sub:SetPoint("RIGHT", -28, 0); sub:SetJustifyH("CENTER")
1126-
sub:SetText("This only changes who controls names on DandersFrames frames - you can change it later in Nicknames settings.")
1127+
sub:SetText(L["This only changes who controls names on DandersFrames frames - you can change it later in Nicknames settings."])
11271128
sub:SetTextColor(0.7, 0.7, 0.7)
11281129

11291130
local function choose(pref)
@@ -1155,9 +1156,9 @@ function NK:ShowConflictPopup()
11551156
return b
11561157
end
11571158

1158-
local dfBtn = makeButton("Use DandersFrames nicknames", true, function() choose("self") end)
1159+
local dfBtn = makeButton(L["Use %s nicknames"]:format("DandersFrames"), true, function() choose("self") end)
11591160
dfBtn:SetPoint("BOTTOM", -118, 16)
1160-
local nsBtn = makeButton("Use Northern Sky Raid Tools nicknames", false, function() choose("nsrt") end)
1161+
local nsBtn = makeButton(L["Use %s nicknames"]:format("Northern Sky Raid Tools"), false, function() choose("nsrt") end)
11611162
nsBtn:SetPoint("BOTTOM", 118, 16)
11621163

11631164
NK._conflictPopup = popup
@@ -1169,6 +1170,14 @@ function NK:CheckConflictPrompt()
11691170
local data = NK:GetDB()
11701171
if not data or not data.enabled then return end
11711172
if data.framePrecedence ~= nil then return end -- already decided
1173+
-- Only prompt users who actually USE DF nicknames (enabled defaults true,
1174+
-- so without this every NSRT user would get the popup with nothing to
1175+
-- choose between). Once they add a first nickname, the conflict is real
1176+
-- and the popup appears at next login (framePrecedence is still nil).
1177+
local hasAny = (data.entries and #data.entries > 0)
1178+
or (NK.received and next(NK.received) ~= nil)
1179+
or (data.selfNick and data.selfNick ~= "")
1180+
if not hasAny then return end
11721181
if not NK:NSRTManagingNames() then return end -- no conflict
11731182
if InCombatLockdown and InCombatLockdown() then
11741183
if not NK._conflictCombatWatch then

Locales/enUS.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1883,6 +1883,7 @@ L["Add a nickname"] = true
18831883
L["Add from"] = true
18841884
L["Add from:"] = true
18851885
L["Added"] = true
1886+
L["Addon nicknames conflict"] = true
18861887
L["All nicknames"] = true
18871888
L["Angle <name>"] = true
18881889
L["Apply to"] = true
@@ -1895,6 +1896,7 @@ L["Blocked: contained formatting codes"] = true
18951896
L["Blocked: contains a filtered word"] = true
18961897
L["Blocked: empty"] = true
18971898
L["Blocked: too long"] = true
1899+
L["Both %s and %s are set to show nicknames on your frames.\n\nWhich one should decide the names shown here?"] = true
18981900
L["Brackets [name]"] = true
18991901
L["Character / text"] = true
19001902
L["Contains"] = true
@@ -1911,6 +1913,8 @@ L["Mark nicknames"] = true
19111913
L["Marker style"] = true
19121914
L["Match"] = true
19131915
L["My added"] = true
1916+
L["Name precedence"] = true
1917+
L["Names on frames decided by"] = true
19141918
L["Needs re-link"] = true
19151919
L["Nickname"] = true
19161920
L["Nicknames"] = true
@@ -1919,6 +1923,7 @@ L["No characters found."] = true
19191923
L["No group members found."] = true
19201924
L["No nickname rules yet. Add one above."] = true
19211925
L["No nicknames received yet."] = true
1926+
L["Northern Sky Raid Tools can also show nicknames on DandersFrames frames. Choose which one decides the names shown here."] = true
19221927
L["Overlapping rule"] = true
19231928
L["Overlaps with rule(s) %s. For names they share, the rule higher in the list wins."] = true
19241929
L["Overridden"] = true
@@ -1937,6 +1942,8 @@ L["Source"] = true
19371942
L["Starts with"] = true
19381943
L["Starts with: matches any character whose name begins with this text."] = true
19391944
L["This Battle.net friend could not be matched after an update. Remove this rule and add them again."] = true
1945+
L["This only changes who controls names on DandersFrames frames - you can change it later in Nicknames settings."] = true
1946+
L["Use %s nicknames"] = true
19401947
L["You are not in a guild."] = true
19411948
L["Your nickname (broadcast)"] = true
19421949

Options/NicknamesPage.lua

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,36 @@ function DF.BuildNicknamesPage(guiRef, pageRef, dbRef)
777777
recvContent:SetHeight(mmax(1, n * ROW_HEIGHT))
778778
end
779779

780+
-- ===== Name precedence (only shown when NSRT can also manage our names) =====
781+
-- Northern Sky Raid Tools can also be set to put nicknames on DandersFrames
782+
-- frames; when both are active they fight. This mirrors the one-time conflict
783+
-- popup (Features/Nicknames.lua) so the choice can be changed here later.
784+
if C_AddOns and C_AddOns.IsAddOnLoaded and C_AddOns.IsAddOnLoaded("NorthernSkyRaidTools") then
785+
local precHeader = parent:CreateFontString(nil, "OVERLAY", "DFFontNormal")
786+
precHeader:SetPoint("TOPLEFT", recvBg, "BOTTOMLEFT", 0, -18)
787+
precHeader:SetText(L["Name precedence"])
788+
do local pc = themeColor(); precHeader:SetTextColor(pc.r, pc.g, pc.b) end
789+
790+
local precDesc = parent:CreateFontString(nil, "OVERLAY", "DFFontDisableSmall")
791+
precDesc:SetPoint("TOPLEFT", precHeader, "BOTTOMLEFT", 0, -6)
792+
precDesc:SetWidth(LIST_WIDTH)
793+
precDesc:SetJustifyH("LEFT")
794+
precDesc:SetText(L["Northern Sky Raid Tools can also show nicknames on DandersFrames frames. Choose which one decides the names shown here."])
795+
796+
local precOpts = {
797+
self = "DandersFrames", nsrt = "Northern Sky Raid Tools",
798+
_order = { "self", "nsrt" },
799+
}
800+
local precDD = GUI:CreateDropdown(parent, L["Names on frames decided by"], precOpts, nil, nil, nil,
801+
function() local d = NK:GetDB(); return (d and d.framePrecedence == "nsrt") and "nsrt" or "self" end,
802+
function(v)
803+
local d = NK:GetDB(); if d then d.framePrecedence = v end
804+
NK:RefreshAllFrames()
805+
end)
806+
precDD:SetSize(220, 50)
807+
precDD:SetPoint("TOPLEFT", precDesc, "BOTTOMLEFT", -4, -8)
808+
end
809+
780810
-- Keep this panel in sync with changes made anywhere (e.g. incoming shares).
781811
NK.onChange = Refresh
782812
Refresh()

0 commit comments

Comments
 (0)