diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/newview/llbottomtray.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llbottomtray.h | 4 | ||||
-rw-r--r-- | indra/newview/llchiclet.cpp | 131 | ||||
-rw-r--r-- | indra/newview/llchiclet.h | 36 | ||||
-rw-r--r-- | indra/newview/llnearbychatbar.cpp | 9 | ||||
-rw-r--r-- | indra/newview/llnearbychatbar.h | 7 | ||||
-rw-r--r-- | indra/newview/llspeakbutton.cpp | 174 | ||||
-rw-r--r-- | indra/newview/llspeakbutton.h | 82 |
9 files changed, 274 insertions, 173 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 075f8148e3..2978ef210f 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 @@ -863,6 +864,7 @@ set(viewer_HEADER_FILES llsky.h llslurl.h llspatialpartition.h + llspeakbutton.h llspeakers.h llsplitbutton.h llsprite.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.cpp b/indra/newview/llchiclet.cpp index 0a187ca422..0f259b885c 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -51,10 +51,9 @@ #include "lltransientfloatermgr.h" static LLDefaultChildRegistry::Register<LLChicletPanel> t1("chiclet_panel"); -static LLDefaultChildRegistry::Register<LLTalkButton> t2("talk_button"); -static LLDefaultChildRegistry::Register<LLNotificationChiclet> t3("chiclet_notification"); -static LLDefaultChildRegistry::Register<LLIMP2PChiclet> t4("chiclet_im_p2p"); -static LLDefaultChildRegistry::Register<LLIMGroupChiclet> t5("chiclet_im_group"); +static LLDefaultChildRegistry::Register<LLNotificationChiclet> t2("chiclet_notification"); +static LLDefaultChildRegistry::Register<LLIMP2PChiclet> t3("chiclet_im_p2p"); +static LLDefaultChildRegistry::Register<LLIMGroupChiclet> t4("chiclet_im_group"); S32 LLNotificationChiclet::mUreadSystemNotifications = 0; @@ -1249,130 +1248,6 @@ bool LLChicletPanel::isAnyIMFloaterDoked() ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// -// *TODO Vadim: Move this out of llchiclet.cpp. - -LLTalkButton::Params::Params() - : speak_button("speak_button") - , show_button("show_button") - , monitor("monitor") -{ - // See widgets/talk_button.xml -} - -LLTalkButton::LLTalkButton(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(&LLTalkButton::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(&LLTalkButton::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); - mOutputMonitor->setIsAgentControl(true); -} - -LLTalkButton::~LLTalkButton() -{ -} - -void LLTalkButton::setSpeakBtnToggleState(bool state) -{ - mSpeakBtn->setToggleState(state); -} - -void LLTalkButton::onClick_SpeakBtn() -{ - bool speaking = mSpeakBtn->getToggleState(); - gVoiceClient->setUserPTTState(speaking); -} - -void LLTalkButton::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); -} - -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// - LLChicletNotificationCounterCtrl::LLChicletNotificationCounterCtrl(const Params& p) : LLTextBox(p) , mCounter(0) diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h index a830240b7d..b50702205c 100644 --- a/indra/newview/llchiclet.h +++ b/indra/newview/llchiclet.h @@ -853,42 +853,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 d7a5ff289c..bcb4edd7c1 100644 --- a/indra/newview/llnearbychatbar.cpp +++ b/indra/newview/llnearbychatbar.cpp @@ -36,6 +36,7 @@ #include "lltrans.h" #include "llnearbychatbar.h" +#include "llspeakbutton.h" #include "llbottomtray.h" #include "llagent.h" #include "llgesturemgr.h" @@ -233,11 +234,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); @@ -696,7 +697,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) @@ -752,7 +753,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 0307eee7bf..aa25b6aa68 100644 --- a/indra/newview/llnearbychatbar.h +++ b/indra/newview/llnearbychatbar.h @@ -37,11 +37,14 @@ #include "llcombobox.h" #include "llgesturemgr.h" #include "llchat.h" -#include "llchiclet.h" #include "llvoiceclient.h" #include "lloutputmonitorctrl.h" #include "llspeakers.h" + +class LLSpeakButton; + + class LLGestureComboBox : public LLComboBox , public LLGestureManagerObserver @@ -125,7 +128,7 @@ protected: static S32 sLastSpecialChatChannel; LLLineEditor* mChatBox; - LLTalkButton* mTalkBtn; + LLSpeakButton* mSpeakBtn; LLOutputMonitorCtrl* mOutputMonitor; LLLocalSpeakerMgr* mSpeakerMgr; }; diff --git a/indra/newview/llspeakbutton.cpp b/indra/newview/llspeakbutton.cpp new file mode 100644 index 0000000000..cd765b0338 --- /dev/null +++ b/indra/newview/llspeakbutton.cpp @@ -0,0 +1,174 @@ +/** +* @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("talk_button"); + +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// + +LLSpeakButton::Params::Params() + : speak_button("speak_button") + , show_button("show_button") + , monitor("monitor") +{ + // See widgets/talk_button.xml +} + +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); + mOutputMonitor->setIsAgentControl(true); +} + +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..f59ded2133 --- /dev/null +++ b/indra/newview/llspeakbutton.h @@ -0,0 +1,82 @@ +/** +* @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 |