summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterimsessiontab.cpp
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2024-09-28 18:01:02 +0800
committerErik Kundiman <erik@megapahit.org>2024-10-18 18:38:25 +0800
commitad3cbb9f75c4ea7f0473225afc034c403b54fc82 (patch)
tree4e4239e97a405d2820e26a4f2215ad8ccb88af7e /indra/newview/llfloaterimsessiontab.cpp
parent7fdb350e487acc35b26de6e243ff27f94185d3a5 (diff)
parent64c055f9be03861661f8c211ae36ba0db489b12d (diff)
Merge remote-tracking branch 'secondlife/release/2024.09-ExtraFPS' into 2024.09-ExtraFPS
Diffstat (limited to 'indra/newview/llfloaterimsessiontab.cpp')
-rw-r--r--indra/newview/llfloaterimsessiontab.cpp53
1 files changed, 45 insertions, 8 deletions
diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp
index 2621ce576c..fe0916bf15 100644
--- a/indra/newview/llfloaterimsessiontab.cpp
+++ b/indra/newview/llfloaterimsessiontab.cpp
@@ -302,6 +302,7 @@ bool LLFloaterIMSessionTab::postBuild()
mGearBtn = getChild<LLButton>("gear_btn");
mAddBtn = getChild<LLButton>("add_btn");
mVoiceButton = getChild<LLButton>("voice_call_btn");
+ mVoiceButton->setClickedCallback([this](LLUICtrl*, const LLSD&) { onCallButtonClicked(); });
mParticipantListPanel = getChild<LLLayoutPanel>("speakers_list_panel");
mRightPartPanel = getChild<LLLayoutPanel>("right_part_holder");
@@ -434,16 +435,35 @@ void LLFloaterIMSessionTab::draw()
void LLFloaterIMSessionTab::enableDisableCallBtn()
{
- if (LLVoiceClient::instanceExists() && mVoiceButton)
+ if (!mVoiceButton)
+ return;
+
+ bool enable = false;
+
+ if (mSessionID.notNull() && mSession && mSession->mSessionInitialized && mSession->mCallBackEnabled)
{
- mVoiceButton->setEnabled(
- mSessionID.notNull()
- && mSession
- && mSession->mSessionInitialized
- && LLVoiceClient::getInstance()->voiceEnabled()
- && LLVoiceClient::getInstance()->isVoiceWorking()
- && mSession->mCallBackEnabled);
+ if (mVoiceButtonHangUpMode)
+ {
+ // We allow to hang up from any state
+ enable = true;
+ }
+ else
+ {
+ // We allow to start call from this state only
+ if (mSession->mVoiceChannel &&
+ !mSession->mVoiceChannel->callStarted() &&
+ LLVoiceClient::instanceExists())
+ {
+ LLVoiceClient* client = LLVoiceClient::getInstance();
+ if (client->voiceEnabled() && client->isVoiceWorking())
+ {
+ enable = true;
+ }
+ }
+ }
}
+
+ mVoiceButton->setEnabled(enable);
}
// virtual
@@ -466,6 +486,22 @@ void LLFloaterIMSessionTab::onFocusLost()
super::onFocusLost();
}
+void LLFloaterIMSessionTab::onCallButtonClicked()
+{
+ if (mVoiceButtonHangUpMode)
+ {
+ // We allow to hang up from any state
+ gIMMgr->endCall(mSessionID);
+ }
+ else
+ {
+ if (mSession->mVoiceChannel && !mSession->mVoiceChannel->callStarted())
+ {
+ gIMMgr->startCall(mSessionID);
+ }
+ }
+}
+
void LLFloaterIMSessionTab::onInputEditorClicked()
{
LLFloaterIMContainer* im_box = LLFloaterIMContainer::findInstance();
@@ -1040,6 +1076,7 @@ void LLFloaterIMSessionTab::updateCallBtnState(bool callIsActive)
{
mVoiceButton->setImageOverlay(callIsActive? getString("call_btn_stop") : getString("call_btn_start"));
mVoiceButton->setToolTip(callIsActive? getString("end_call_button_tooltip") : getString("start_call_button_tooltip"));
+ mVoiceButtonHangUpMode = callIsActive;
enableDisableCallBtn();
}