summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/CMakeLists.txt4
-rw-r--r--indra/newview/llbottomtray.cpp2
-rw-r--r--indra/newview/llbottomtray.h4
-rw-r--r--indra/newview/llchiclet.h36
-rw-r--r--indra/newview/llnearbychatbar.cpp10
-rw-r--r--indra/newview/llnearbychatbar.h4
-rw-r--r--indra/newview/llspeakbutton.cpp196
-rw-r--r--indra/newview/llspeakbutton.h81
8 files changed, 289 insertions, 48 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index b989f0c230..03bf41b118 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -376,6 +376,7 @@ set(viewer_SOURCE_FILES
llsky.cpp
llslurl.cpp
llspatialpartition.cpp
+ llspeakbutton.cpp
llspeakers.cpp
llsplitbutton.cpp
llsprite.cpp
@@ -386,7 +387,6 @@ set(viewer_SOURCE_FILES
llsurfacepatch.cpp
llsyswellitem.cpp
llsyswellwindow.cpp
- lltalkbutton.cpp
llteleporthistory.cpp
llteleporthistorystorage.cpp
lltexglobalcolor.cpp
@@ -862,6 +862,7 @@ set(viewer_HEADER_FILES
llsky.h
llslurl.h
llspatialpartition.h
+ llspeakbutton.h
llspeakers.h
llsplitbutton.h
llsprite.h
@@ -873,7 +874,6 @@ set(viewer_HEADER_FILES
llsyswellitem.h
llsyswellwindow.h
lltable.h
- lltalkbutton.h
llteleporthistory.h
llteleporthistorystorage.h
lltexglobalcolor.h
diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp
index ddcee5f453..a17ba79078 100644
--- a/indra/newview/llbottomtray.cpp
+++ b/indra/newview/llbottomtray.cpp
@@ -47,7 +47,7 @@
LLBottomTray::LLBottomTray(const LLSD&)
: mChicletPanel(NULL),
mSysWell(NULL),
- mTalkBtn(NULL),
+ mSpeakBtn(NULL),
mNearbyChatBar(NULL),
mToolbarStack(NULL)
diff --git a/indra/newview/llbottomtray.h b/indra/newview/llbottomtray.h
index a28f1e42ec..02588a1975 100644
--- a/indra/newview/llbottomtray.h
+++ b/indra/newview/llbottomtray.h
@@ -43,7 +43,7 @@ class LLChicletPanel;
class LLLineEditor;
class LLLayoutStack;
class LLNotificationChiclet;
-class LLTalkButton;
+class LLSpeakButton;
class LLNearbyChatBar;
class LLIMChiclet;
@@ -110,7 +110,7 @@ protected:
LLChicletPanel* mChicletPanel;
LLNotificationChiclet* mSysWell;
- LLTalkButton* mTalkBtn;
+ LLSpeakButton* mSpeakBtn;
LLNearbyChatBar* mNearbyChatBar;
LLLayoutStack* mToolbarStack;
LLMenuGL* mBottomTrayContextMenu;
diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h
index 6eefd9829f..e84111c53a 100644
--- a/indra/newview/llchiclet.h
+++ b/indra/newview/llchiclet.h
@@ -833,42 +833,6 @@ protected:
bool mShowControls;
};
-/*
- * Button displaying voice chat status. Displays voice chat options When clicked.
-*/
-class LLTalkButton : public LLUICtrl
-{
-public:
-
- struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
- {
- Optional<LLButton::Params> speak_button,
- show_button;
-
- Optional<LLOutputMonitorCtrl::Params> monitor;
-
- Params();
- };
-
- /*virtual*/ ~LLTalkButton();
-
- void setSpeakBtnToggleState(bool state);
-
-protected:
- friend class LLUICtrlFactory;
- LLTalkButton(const Params& p);
-
- void onClick_SpeakBtn();
-
- void onClick_ShowBtn();
-
-private:
- LLButton* mSpeakBtn;
- LLButton* mShowBtn;
- LLVoiceControlPanel* mPrivateCallPanel;
- LLOutputMonitorCtrl* mOutputMonitor;
-};
-
template<class T>
T* LLChicletPanel::createChiclet(const LLUUID& session_id, S32 index)
{
diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp
index 730939861b..7c26264c9d 100644
--- a/indra/newview/llnearbychatbar.cpp
+++ b/indra/newview/llnearbychatbar.cpp
@@ -36,7 +36,7 @@
#include "lltrans.h"
#include "llnearbychatbar.h"
-#include "lltalkbutton.h"
+#include "llspeakbutton.h"
#include "llbottomtray.h"
#include "llagent.h"
#include "llgesturemgr.h"
@@ -229,11 +229,11 @@ BOOL LLNearbyChatBar::postBuild()
mOutputMonitor = getChild<LLOutputMonitorCtrl>("chat_zone_indicator");
mOutputMonitor->setVisible(FALSE);
- mTalkBtn = getParent()->getChild<LLTalkButton>("talk");
+ mSpeakBtn = getParent()->getChild<LLSpeakButton>("talk");
// Speak button should be initially disabled because
// it takes some time between logging in to world and connecting to voice channel.
- mTalkBtn->setEnabled(FALSE);
+ mSpeakBtn->setEnabled(FALSE);
// Registering Chat Bar to receive Voice client status change notifications.
gVoiceClient->addObserver(this);
@@ -692,7 +692,7 @@ LLWString LLNearbyChatBar::stripChannelNumber(const LLWString &mesg, S32* channe
void LLNearbyChatBar::setPTTState(bool state)
{
- mTalkBtn->setSpeakBtnToggleState(state);
+ mSpeakBtn->setSpeakBtnToggleState(state);
}
void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel)
@@ -748,7 +748,7 @@ void LLNearbyChatBar::onChange(EStatusType status, const std::string &channelURI
break;
}
- mTalkBtn->setEnabled(enable);
+ mSpeakBtn->setEnabled(enable);
}
// Creating the object registers with the dispatcher.
diff --git a/indra/newview/llnearbychatbar.h b/indra/newview/llnearbychatbar.h
index 3fa1d3ea8a..9645c6b468 100644
--- a/indra/newview/llnearbychatbar.h
+++ b/indra/newview/llnearbychatbar.h
@@ -42,7 +42,7 @@
#include "llspeakers.h"
-class LLTalkButton;
+class LLSpeakButton;
class LLGestureComboBox
@@ -128,7 +128,7 @@ protected:
static S32 sLastSpecialChatChannel;
LLLineEditor* mChatBox;
- LLTalkButton* mTalkBtn;
+ LLSpeakButton* mSpeakBtn;
LLOutputMonitorCtrl* mOutputMonitor;
LLActiveSpeakerMgr mSpeakerMgr;
};
diff --git a/indra/newview/llspeakbutton.cpp b/indra/newview/llspeakbutton.cpp
new file mode 100644
index 0000000000..c03495ada7
--- /dev/null
+++ b/indra/newview/llspeakbutton.cpp
@@ -0,0 +1,196 @@
+/**
+* @file llspeakbutton.cpp
+* @brief LLSpeakButton class implementation
+*
+* $LicenseInfo:firstyear=2002&license=viewergpl$
+*
+* Copyright (c) 2002-2009, Linden Research, Inc.
+*
+* Second Life Viewer Source Code
+* The source code in this file ("Source Code") is provided by Linden Lab
+* to you under the terms of the GNU General Public License, version 2.0
+* ("GPL"), unless you have obtained a separate licensing agreement
+* ("Other License"), formally executed by you and Linden Lab. Terms of
+* the GPL can be found in doc/GPL-license.txt in this distribution, or
+* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+*
+* There are special exceptions to the terms and conditions of the GPL as
+* it is applied to this Source Code. View the full text of the exception
+* in the file doc/FLOSS-exception.txt in this software distribution, or
+* online at
+* http://secondlifegrid.net/programs/open_source/licensing/flossexception
+*
+* By copying, modifying or distributing this software, you acknowledge
+* that you have read and understood your obligations described above,
+* and agree to abide by those obligations.
+*
+* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+* COMPLETENESS OR PERFORMANCE.
+* $/LicenseInfo$
+*/
+
+#include "llviewerprecompiledheaders.h" // must be first include
+
+#include "llagent.h"
+#include "llbottomtray.h"
+#include "llfloaterreg.h"
+#include "llvoiceclient.h"
+#include "llvoicecontrolpanel.h"
+#include "lltransientfloatermgr.h"
+
+#include "llavatariconctrl.h"
+#include "llbutton.h"
+#include "llpanel.h"
+#include "lltextbox.h"
+#include "lloutputmonitorctrl.h"
+#include "llgroupmgr.h"
+
+#include "llspeakbutton.h"
+
+static LLDefaultChildRegistry::Register<LLSpeakButton> t1("chiclet_talk");
+
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+
+LLSpeakButton::Params::Params()
+ : speak_button("speak_button")
+ , show_button("show_button")
+ , monitor("monitor")
+{
+ // *TODO Vadim: move hardcoded labels (!) and other params to XUI.
+ speak_button.name("left");
+ speak_button.label("Speak");
+ speak_button.label_selected("Speak");
+ speak_button.font(LLFontGL::getFontSansSerifSmall());
+ speak_button.tab_stop(false);
+ speak_button.is_toggle(true);
+ speak_button.picture_style(true);
+ // Use default button art. JC
+ //speak_button.image_selected(LLUI::getUIImage("SegmentedBtn_Left_Selected"));
+ //speak_button.image_unselected(LLUI::getUIImage("SegmentedBtn_Left_Off"));
+
+ show_button.name("right");
+ show_button.label(LLStringUtil::null);
+ show_button.rect(LLRect(0, 0, 20, 0));
+ show_button.tab_stop(false);
+ show_button.is_toggle(true);
+ show_button.picture_style(true);
+ show_button.image_selected(LLUI::getUIImage("ComboButton_Selected"));
+ show_button.image_unselected(LLUI::getUIImage("ComboButton_Off"));
+
+ monitor.name("monitor");
+ // *TODO: Make this data driven.
+ monitor.rect(LLRect(0, 18, 18, 0));
+}
+
+LLSpeakButton::LLSpeakButton(const Params& p)
+: LLUICtrl(p)
+, mPrivateCallPanel(NULL)
+, mOutputMonitor(NULL)
+, mSpeakBtn(NULL)
+, mShowBtn(NULL)
+{
+ LLRect rect = p.rect();
+ LLRect speak_rect(0, rect.getHeight(), rect.getWidth(), 0);
+ LLRect show_rect = p.show_button.rect();
+ show_rect.set(0, rect.getHeight(), show_rect.getWidth(), 0);
+
+ speak_rect.mRight -= show_rect.getWidth();
+ show_rect.mLeft = speak_rect.getWidth();
+ show_rect.mRight = rect.getWidth();
+
+ LLButton::Params speak_params = p.speak_button;
+ speak_params.rect(speak_rect);
+ mSpeakBtn = LLUICtrlFactory::create<LLButton>(speak_params);
+ addChild(mSpeakBtn);
+ LLTransientFloaterMgr::getInstance()->addControlView(mSpeakBtn);
+
+ mSpeakBtn->setClickedCallback(boost::bind(&LLSpeakButton::onClick_SpeakBtn, this));
+ mSpeakBtn->setToggleState(FALSE);
+
+ LLButton::Params show_params = p.show_button;
+ show_params.rect(show_rect);
+ mShowBtn = LLUICtrlFactory::create<LLButton>(show_params);
+ addChild(mShowBtn);
+ LLTransientFloaterMgr::getInstance()->addControlView(mShowBtn);
+
+ mShowBtn->setClickedCallback(boost::bind(&LLSpeakButton::onClick_ShowBtn, this));
+ mShowBtn->setToggleState(FALSE);
+
+ static const S32 MONITOR_RIGHT_PAD = 2;
+
+ LLRect monitor_rect = p.monitor.rect();
+ S32 monitor_height = monitor_rect.getHeight();
+ monitor_rect.mLeft = speak_rect.getWidth() - monitor_rect.getWidth() - MONITOR_RIGHT_PAD;
+ monitor_rect.mRight = speak_rect.getWidth() - MONITOR_RIGHT_PAD;
+ monitor_rect.mBottom = (rect.getHeight() / 2) - (monitor_height / 2);
+ monitor_rect.mTop = monitor_rect.mBottom + monitor_height;
+
+ LLOutputMonitorCtrl::Params monitor_params = p.monitor;
+ monitor_params.draw_border(false);
+ monitor_params.rect(monitor_rect);
+ monitor_params.auto_update(true);
+ monitor_params.speaker_id(gAgentID);
+ mOutputMonitor = LLUICtrlFactory::create<LLOutputMonitorCtrl>(monitor_params);
+ mSpeakBtn->addChild(mOutputMonitor);
+
+ // never show "muted" because you can't mute yourself
+ mOutputMonitor->setIsMuted(false);
+}
+
+LLSpeakButton::~LLSpeakButton()
+{
+}
+
+void LLSpeakButton::setSpeakBtnToggleState(bool state)
+{
+ mSpeakBtn->setToggleState(state);
+}
+
+void LLSpeakButton::onClick_SpeakBtn()
+{
+ bool speaking = mSpeakBtn->getToggleState();
+ gVoiceClient->setUserPTTState(speaking);
+}
+
+void LLSpeakButton::onClick_ShowBtn()
+{
+ if(!mShowBtn->getToggleState())
+ {
+ mPrivateCallPanel->onClickClose(mPrivateCallPanel);
+ delete mPrivateCallPanel;
+ mPrivateCallPanel = NULL;
+ mShowBtn->setToggleState(FALSE);
+ return;
+ }
+
+ S32 x = mSpeakBtn->getRect().mLeft;
+ S32 y = 0;
+
+ localPointToScreen(x, y, &x, &y);
+
+ mPrivateCallPanel = new LLVoiceControlPanel;
+ getRootView()->addChild(mPrivateCallPanel);
+
+ y = LLBottomTray::getInstance()->getRect().getHeight() + mPrivateCallPanel->getRect().getHeight();
+
+ LLRect rect;
+ rect.setLeftTopAndSize(x, y, mPrivateCallPanel->getRect().getWidth(), mPrivateCallPanel->getRect().getHeight());
+ mPrivateCallPanel->setRect(rect);
+
+
+ LLAvatarListItem* item = new LLAvatarListItem();
+ item->showLastInteractionTime(false);
+ item->showInfoBtn(true);
+ item->showSpeakingIndicator(true);
+ item->reshape(mPrivateCallPanel->getRect().getWidth(), item->getRect().getHeight(), FALSE);
+
+ mPrivateCallPanel->addItem(item);
+ mPrivateCallPanel->setVisible(TRUE);
+ mPrivateCallPanel->setFrontmost(TRUE);
+
+ mShowBtn->setToggleState(TRUE);
+}
+
diff --git a/indra/newview/llspeakbutton.h b/indra/newview/llspeakbutton.h
new file mode 100644
index 0000000000..f1d15ebd70
--- /dev/null
+++ b/indra/newview/llspeakbutton.h
@@ -0,0 +1,81 @@
+/**
+* @file llspeakbutton.h
+* @brief LLSpeakButton class header file
+*
+* $LicenseInfo:firstyear=2002&license=viewergpl$
+*
+* Copyright (c) 2002-2009, Linden Research, Inc.
+*
+* Second Life Viewer Source Code
+* The source code in this file ("Source Code") is provided by Linden Lab
+* to you under the terms of the GNU General Public License, version 2.0
+* ("GPL"), unless you have obtained a separate licensing agreement
+* ("Other License"), formally executed by you and Linden Lab. Terms of
+* the GPL can be found in doc/GPL-license.txt in this distribution, or
+* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+*
+* There are special exceptions to the terms and conditions of the GPL as
+* it is applied to this Source Code. View the full text of the exception
+* in the file doc/FLOSS-exception.txt in this software distribution, or
+* online at
+* http://secondlifegrid.net/programs/open_source/licensing/flossexception
+*
+* By copying, modifying or distributing this software, you acknowledge
+* that you have read and understood your obligations described above,
+* and agree to abide by those obligations.
+*
+* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+* COMPLETENESS OR PERFORMANCE.
+* $/LicenseInfo$
+*/
+
+#ifndef LL_LLSPEAKBUTTON_H
+#define LL_LLSPEAKBUTTON_H
+
+#include "llinitparam.h"
+#include "lluictrl.h"
+
+class LLVoiceControlPanel;
+class LLButton;
+class LLOutputMonitorCtrl;
+
+/*
+ * Button displaying voice chat status. Displays voice chat options when
+ * clicked.
+*/
+class LLSpeakButton : public LLUICtrl
+{
+public:
+
+ struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
+ {
+ Optional<LLButton::Params>
+ speak_button,
+ show_button;
+
+ Optional<LLOutputMonitorCtrl::Params> monitor;
+
+ Params();
+ };
+
+ /*virtual*/ ~LLSpeakButton();
+
+ void setSpeakBtnToggleState(bool state);
+
+protected:
+ friend class LLUICtrlFactory;
+ LLSpeakButton(const Params& p);
+
+ void onClick_SpeakBtn();
+
+ void onClick_ShowBtn();
+
+private:
+ LLButton* mSpeakBtn;
+ LLButton* mShowBtn;
+ LLVoiceControlPanel* mPrivateCallPanel;
+ LLOutputMonitorCtrl* mOutputMonitor;
+};
+
+#endif // LL_LLSPEAKBUTTON_H