diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2024-09-24 20:15:50 +0300 |
---|---|---|
committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2024-09-25 09:38:54 +0300 |
commit | cd8b0a4fc9062e2ea03c41c7c83dbbfde0755d8c (patch) | |
tree | 0f01f220e64d12cdcf76908a00dd0c21bc2d69c0 /indra/newview/llvoicevivox.cpp | |
parent | a2e9a0caf32003253766efe528329fdd11f28b0b (diff) |
Revert "viewer#2413 Remove obsolete alert about expiring voice morphs"
This reverts commit 5c16ae13758bdfe8fe1f13d5f67eabbb6eaa30a1.
Fix is correct, but should wait untill server sided fix gets deployed.
Diffstat (limited to 'indra/newview/llvoicevivox.cpp')
-rw-r--r-- | indra/newview/llvoicevivox.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 1e934ade59..e25f914c47 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -6458,6 +6458,7 @@ LLVivoxVoiceClient::voiceFontEntry::voiceFontEntry(LLUUID& id) : mIsNew(false) { mExpiryTimer.stop(); + mExpiryWarningTimer.stop(); } LLVivoxVoiceClient::voiceFontEntry::~voiceFontEntry() @@ -6568,6 +6569,20 @@ void LLVivoxVoiceClient::addVoiceFont(const S32 font_index, font->mExpiryTimer.start(); font->mExpiryTimer.setExpiryAt(expiration_date.secondsSinceEpoch() - VOICE_FONT_EXPIRY_INTERVAL); + // Set the warning timer to some interval before actual expiry. + S32 warning_time = gSavedSettings.getS32("VoiceEffectExpiryWarningTime"); + if (warning_time != 0) + { + font->mExpiryWarningTimer.start(); + F64 expiry_time = (expiration_date.secondsSinceEpoch() - (F64)warning_time); + font->mExpiryWarningTimer.setExpiryAt(expiry_time - VOICE_FONT_EXPIRY_INTERVAL); + } + else + { + // Disable the warning timer. + font->mExpiryWarningTimer.stop(); + } + // Only flag new session fonts after the first time we have fetched the list. if (mVoiceFontsReceived) { @@ -6609,6 +6624,7 @@ void LLVivoxVoiceClient::expireVoiceFonts() // than checking each font individually. bool have_expired = false; + bool will_expire = false; bool expired_in_use = false; LLUUID current_effect = LLVoiceClient::instance().getVoiceEffectDefault(); @@ -6618,6 +6634,7 @@ void LLVivoxVoiceClient::expireVoiceFonts() { voiceFontEntry* voice_font = iter->second; LLFrameTimer& expiry_timer = voice_font->mExpiryTimer; + LLFrameTimer& warning_timer = voice_font->mExpiryWarningTimer; // Check for expired voice fonts if (expiry_timer.getStarted() && expiry_timer.hasExpired()) @@ -6634,6 +6651,14 @@ void LLVivoxVoiceClient::expireVoiceFonts() deleteVoiceFont(voice_font->mID); have_expired = true; } + + // Check for voice fonts that will expire in less that the warning time + if (warning_timer.getStarted() && warning_timer.hasExpired()) + { + LL_DEBUGS("VoiceFont") << "Voice Font " << voice_font->mName << " will expire soon." << LL_ENDL; + will_expire = true; + warning_timer.stop(); + } } LLSD args; @@ -6655,6 +6680,15 @@ void LLVivoxVoiceClient::expireVoiceFonts() // Refresh voice font lists in the UI. notifyVoiceFontObservers(); } + + // Give a warning notification if any voice fonts are due to expire. + if (will_expire) + { + S32Seconds seconds(gSavedSettings.getS32("VoiceEffectExpiryWarningTime")); + args["INTERVAL"] = llformat("%d", LLUnit<S32, LLUnits::Days>(seconds).value()); + + LLNotificationsUtil::add("VoiceEffectsWillExpire", args); + } } void LLVivoxVoiceClient::deleteVoiceFont(const LLUUID& id) |