Skip to content

Commit 50f9831

Browse files
committed
Add SilentMode setting
1 parent 07bd90a commit 50f9831

3 files changed

Lines changed: 21 additions & 1 deletion

File tree

MemoryGarbageCollector/MemoryGarbageCollector.lua

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ local DEFAULT_SAVED_VARS = {
3737
overflowRelative = 10, -- percent
3838
overflowAbsolute = 50, -- MB
3939
showDebugMessages = false,
40+
silentMode = false,
4041
}
4142

4243
local SF = string.format
@@ -172,7 +173,7 @@ function MGC.InitMenu()
172173
},
173174
{
174175
type = "checkbox",
175-
name = GetString(SI_SETTINGSYSTEMPANEL6),
176+
name = "Debug",
176177
tooltip = GetString(SI_MGC_SHOW_DEBUG_MESSAGES),
177178
disabled = function()
178179
return not config.autoClear
@@ -186,6 +187,18 @@ function MGC.InitMenu()
186187
end,
187188
default = DEFAULT_SAVED_VARS.showDebugMessages,
188189
},
190+
{
191+
type = "checkbox",
192+
name = "SilentMode",
193+
tooltip = GetString(SI_MGC_SILENT_MODE),
194+
getFunc = function()
195+
return config.silentMode
196+
end,
197+
setFunc = function(v)
198+
config.silentMode = v
199+
end,
200+
default = DEFAULT_SAVED_VARS.silentMode,
201+
},
189202
}
190203

191204
LAM:RegisterAddonPanel(panelName, panelData)
@@ -262,6 +275,11 @@ end
262275

263276
-- Send message to game chat
264277
function MGC.chatMessage(message)
278+
-- Do not send anything when silentMode on.
279+
if MGC.config.silentMode then
280+
return
281+
end
282+
265283
if LibChatMessage then
266284
if not MGC.chat then
267285
MGC.chat = LibChatMessage(MGC.shortName, MGC.shortName)

MemoryGarbageCollector/lang/en.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ local strings = {
1111
SI_MGC_OVERFLOW_ABSOLUTE = "Absolute (MB)",
1212
SI_MGC_OVERFLOW_ABSOLUTE_TOOLTIP = "The value of memory exceeded at which it is necessary to cause a cleanup",
1313
SI_MGC_SHOW_DEBUG_MESSAGES = "Show debug messages",
14+
SI_MGC_SILENT_MODE = "Silent Mode (Disable ALL chat messages)",
1415
SI_MGC_MEMORY_INIT_MAX = "|ceeeeeeMemory limit set: |cAFD3FF%d MB.",
1516
SI_MGC_MEMORY_OVERFLOW_DEBUG = "|ceeeeeeNow: |c77ff7a%d MB; |ceeeeeeLimit: |cAFD3FF%d MB.",
1617
SI_MGC_MEMORY_OVERFLOW_REACHED = "|ceeeeeeBefore: |cff7d77%d MB; |ceeeeeeAfter: |c77ff7a%d MB; |ceeeeeeCleared: |cAFD3FF%d MB.",

MemoryGarbageCollector/lang/ru.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ local strings = {
1111
SI_MGC_OVERFLOW_ABSOLUTE = "Абсолютное значение (Мб)",
1212
SI_MGC_OVERFLOW_ABSOLUTE_TOOLTIP = "При превышении потребления памяти на N Мб, относительно стартового значения, будет произведена очистка.",
1313
SI_MGC_SHOW_DEBUG_MESSAGES = "Показывать отладочные сообщения",
14+
SI_MGC_SILENT_MODE = "Тихий режим (отключить ВСЕ сообщения чата)",
1415
SI_MGC_MEMORY_INIT_MAX = "|ceeeeeeУстановлен лимит потребления памяти: |cAFD3FF%d Мб.",
1516
SI_MGC_MEMORY_OVERFLOW_DEBUG = "|ceeeeeeСейчас: |c77ff7a%d Мб; |ceeeeeeЛимит: |cAFD3FF%d Мб.",
1617
SI_MGC_MEMORY_OVERFLOW_REACHED = "|ceeeeeeДо: |cff7d77%d Мб; |ceeeeeeПосле: |c77ff7a%d Мб; |ceeeeeeОсвобождено: |cAFD3FF%d Мб.",

0 commit comments

Comments
 (0)