Skip to content

Commit e99b467

Browse files
committed
Add "Notifications" options tab, with single option for whisper sounds always
1 parent 748e7b4 commit e99b467

File tree

4 files changed

+49
-2
lines changed

4 files changed

+49
-2
lines changed

Core/Config.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ local settings = {
116116
SHOW_BUTTONS = {key = "show_buttons", default = "unset"},
117117
SHOW_TABS = {key = "show_tabs_1", default = "always", refresh = {addonTable.Constants.RefreshReason.Tabs}},
118118

119+
WHISPER_SOUNDS = {key = "whisper_sounds", default = "first"},
120+
119121
COPY_TIMESTAMPS = {key = "copy_timestamps", default = true},
120122
ENABLE_COMBAT_MESSAGES = {key = "enable_combat_messages", default = false},
121123
DEBUG = {key = "debug", default = false},

Core/Messages.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1433,7 +1433,7 @@ function addonTable.MessagesMonitorMixin:MessageEventHandler(event, ...)
14331433
(ChatEdit_SetLastTellTarget or ChatFrameUtil.SetLastTellTarget)(arg2, type);
14341434
end
14351435

1436-
if ( not self.tellTimer or (GetTime() > self.tellTimer) ) then
1436+
if not self.tellTimer or (GetTime() > self.tellTimer) or addonTable.Config.Get(addonTable.Config.Options.WHISPER_SOUNDS) == "all" then
14371437
PlaySound(SOUNDKIT.TELL_MESSAGE);
14381438
end
14391439
self.tellTimer = GetTime() + (CHAT_TELL_ALERT_TIME or ChatFrameConstants.WhisperSoundAlertCooldown);

CustomiseDialog/Main.lua

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,13 +718,53 @@ local function SetupChatColors(parent)
718718
return container
719719
end
720720

721+
local function SetupNotifications(parent)
722+
local container = CreateFrame("Frame", nil, parent)
723+
724+
local allFrames = {}
725+
726+
local whisperDropdown = addonTable.CustomiseDialog.Components.GetBasicDropdown(container, addonTable.Locales.WHISPER_SOUNDS, function(value)
727+
return addonTable.Config.Get(addonTable.Config.Options.WHISPER_SOUNDS) == value
728+
end, function(value)
729+
addonTable.Config.Set(addonTable.Config.Options.WHISPER_SOUNDS, value)
730+
end)
731+
whisperDropdown:SetPoint("TOP")
732+
do
733+
local entries = {
734+
addonTable.Locales.FIRST_MESSAGE,
735+
addonTable.Locales.ALL_MESSAGES,
736+
}
737+
local values = {
738+
"first",
739+
"all"
740+
}
741+
whisperDropdown:Init(entries, values)
742+
end
743+
table.insert(allFrames, whisperDropdown)
744+
745+
container:SetScript("OnShow", function()
746+
for _, f in ipairs(allFrames) do
747+
if f.SetValue then
748+
if f.option then
749+
f:SetValue(addonTable.Config.Get(f.option))
750+
else
751+
f:SetValue()
752+
end
753+
end
754+
end
755+
end)
756+
757+
return container
758+
end
759+
721760
local TabSetups = {
722761
{name = GENERAL, callback = SetupGeneral},
723762
{name = addonTable.Locales.THEME, callback = SetupThemes},
724763
{name = addonTable.Locales.LAYOUT, callback = SetupLayout},
725764
{name = addonTable.Locales.DISPLAY, callback = SetupDisplay},
726765
{name = addonTable.Locales.MESSAGE_COLORS, callback = SetupChatColors},
727766
{name = addonTable.Locales.FORMATTING, callback = SetupFormatting},
767+
{name = addonTable.Locales.NOTIFICATIONS, callback = SetupNotifications},
728768
}
729769

730770
function addonTable.CustomiseDialog.Toggle()
@@ -738,7 +778,7 @@ function addonTable.CustomiseDialog.Toggle()
738778
frame:SetToplevel(true)
739779
customisers[addonTable.Config.Get(addonTable.Config.Options.CURRENT_SKIN)] = frame
740780
table.insert(UISpecialFrames, frame:GetName())
741-
frame:SetSize(600, 700)
781+
frame:SetSize(700, 700)
742782
frame:SetPoint("CENTER")
743783
frame:Raise()
744784

Locales.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ L["LAYOUT"] = "Layout"
5151
L["DISPLAY"] = "Display"
5252
L["FORMATTING"] = "Formatting"
5353
L["MESSAGE_COLORS"] = "Message Colors"
54+
L["NOTIFICATIONS"] = "Notifications"
5455

5556
L["CUSTOMISE_CHATTYNATOR"] = "Customise Chattynator"
5657
L["CUSTOMISE_CHATTYNATOR_TAB"] = "Customise Chattynator Tab"
@@ -97,6 +98,10 @@ L["ALWAYS"] = "Always"
9798
L["MOUSEOVER"] = "Mouseover"
9899
L["NEVER"] = "Never"
99100

101+
L["WHISPER_SOUNDS"] = "Whispers sounds"
102+
L["FIRST_MESSAGE"] = "First message"
103+
L["ALL_MESSAGES"] = "All messages"
104+
100105
L["NONE"] = "None"
101106
L["SHORTEN_STYLE_1"] = "Style 1: [1] [|cff00ff00Character|r]:"
102107
L["SHORTEN_STYLE_2"] = "Style 2: W. |cff00ff00Character|r:"

0 commit comments

Comments
 (0)