master
James Cook 2009-11-12 08:53:20 -08:00
commit 7a45dec2d5
7 changed files with 60 additions and 44 deletions

View File

@ -40,6 +40,7 @@
#include "llimfloater.h" // for LLIMFloater
#include "lllayoutstack.h"
#include "llnearbychatbar.h"
#include "llspeakbutton.h"
#include "llsplitbutton.h"
#include "llsyswellwindow.h"
#include "llfloatercamera.h"
@ -185,6 +186,28 @@ void LLBottomTray::sessionIDUpdated(const LLUUID& old_session_id, const LLUUID&
}
}
// virtual
void LLBottomTray::onChange(EStatusType status, const std::string &channelURI, bool proximal)
{
// Time it takes to connect to voice channel might be pretty long,
// so don't expect user login or STATUS_VOICE_ENABLED to be followed by STATUS_JOINED.
BOOL enable = FALSE;
switch (status)
{
// Do not add STATUS_VOICE_ENABLED because voice chat is
// inactive until STATUS_JOINED
case STATUS_JOINED:
enable = TRUE;
break;
default:
enable = FALSE;
break;
}
mSpeakBtn->setEnabled(enable);
}
//virtual
void LLBottomTray::onFocusLost()
{
@ -280,6 +303,19 @@ BOOL LLBottomTray::postBuild()
mSnapshotPanel = getChild<LLPanel>("snapshot_panel");
setRightMouseDownCallback(boost::bind(&LLBottomTray::showBottomTrayContextMenu,this, _2, _3,_4));
mSpeakBtn = getChild<LLSpeakButton>("talk");
// Speak button should be initially disabled because
// it takes some time between logging in to world and connecting to voice channel.
mSpeakBtn->setEnabled(FALSE);
// Localization tool doesn't understand custom buttons like <talk_button>
mSpeakBtn->setSpeakToolTip( getString("SpeakBtnToolTip") );
mSpeakBtn->setShowToolTip( getString("VoiceControlBtnToolTip") );
// Registering Chat Bar to receive Voice client status change notifications.
gVoiceClient->addObserver(this);
if (mChicletPanel && mToolbarStack && mNearbyChatBar)
{
verifyChildControlsSizes();

View File

@ -33,7 +33,7 @@
#ifndef LL_LLBOTTOMPANEL_H
#define LL_LLBOTTOMPANEL_H
#include <llmenugl.h>
#include "llmenugl.h"
#include "llpanel.h"
#include "llimview.h"
@ -51,6 +51,7 @@ class LLBottomTray
: public LLSingleton<LLBottomTray>
, public LLPanel
, public LLIMSessionObserver
, public LLVoiceClientStatusObserver
{
LOG_CLASS(LLBottomTray);
friend class LLSingleton<LLBottomTray>;
@ -75,6 +76,10 @@ public:
virtual void onFocusLost();
virtual void setVisible(BOOL visible);
// Implements LLVoiceClientStatusObserver::onChange() to enable the speak
// button when voice is available
/*virtual*/ void onChange(EStatusType status, const std::string &channelURI, bool proximal);
void showBottomTrayContextMenu(S32 x, S32 y, MASK mask);
void showGestureButton(BOOL visible);

View File

@ -36,7 +36,6 @@
#include "lltrans.h"
#include "llnearbychatbar.h"
#include "llspeakbutton.h"
#include "llbottomtray.h"
#include "llagent.h"
#include "llgesturemgr.h"
@ -234,14 +233,6 @@ BOOL LLNearbyChatBar::postBuild()
mOutputMonitor = getChild<LLOutputMonitorCtrl>("chat_zone_indicator");
mOutputMonitor->setVisible(FALSE);
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.
mSpeakBtn->setEnabled(FALSE);
// Registering Chat Bar to receive Voice client status change notifications.
gVoiceClient->addObserver(this);
return TRUE;
}
@ -733,27 +724,6 @@ public:
}
};
void LLNearbyChatBar::onChange(EStatusType status, const std::string &channelURI, bool proximal)
{
// Time it takes to connect to voice channel might be pretty long,
// so don't expect user login or STATUS_VOICE_ENABLED to be followed by STATUS_JOINED.
BOOL enable = FALSE;
switch (status)
{
// Do not add STATUS_VOICE_ENABLED because voice chat is
// inactive until STATUS_JOINED
case STATUS_JOINED:
enable = TRUE;
break;
default:
enable = FALSE;
break;
}
mSpeakBtn->setEnabled(enable);
}
// Creating the object registers with the dispatcher.
LLChatHandler gChatHandler;

View File

@ -42,9 +42,6 @@
#include "llspeakers.h"
class LLSpeakButton;
class LLGestureComboBox
: public LLComboBox
, public LLGestureManagerObserver
@ -76,7 +73,6 @@ protected:
class LLNearbyChatBar
: public LLPanel
, public LLVoiceClientStatusObserver
{
public:
// constructor for inline chat-bars (e.g. hosted in chat history window)
@ -105,11 +101,6 @@ public:
S32 getMinWidth() const;
S32 getMaxWidth() const;
/**
* Implements LLVoiceClientStatusObserver::onChange()
*/
/*virtual*/ void onChange(EStatusType status, const std::string &channelURI, bool proximal);
protected:
static BOOL matchChatTypeTrigger(const std::string& in_str, std::string* out_str);
static void onChatBoxKeystroke(LLLineEditor* caller, void* userdata);
@ -127,7 +118,6 @@ protected:
static S32 sLastSpecialChatChannel;
LLLineEditor* mChatBox;
LLSpeakButton* mSpeakBtn;
LLOutputMonitorCtrl* mOutputMonitor;
LLLocalSpeakerMgr* mSpeakerMgr;
};

View File

@ -133,6 +133,16 @@ LLSpeakButton::~LLSpeakButton()
LLTransientFloaterMgr::getInstance()->removeControlView(mShowBtn);
}
void LLSpeakButton::setSpeakToolTip(const std::string& msg)
{
mSpeakBtn->setToolTip(msg);
}
void LLSpeakButton::setShowToolTip(const std::string& msg)
{
mShowBtn->setToolTip(msg);
}
void LLSpeakButton::onMouseDown_SpeakBtn()
{
bool down = true;

View File

@ -62,6 +62,11 @@ public:
/*virtual*/ ~LLSpeakButton();
/*virtual*/ void draw();
// *HACK: Need to put tooltips in a translatable location,
// the panel that contains this button.
void setSpeakToolTip(const std::string& msg);
void setShowToolTip(const std::string& msg);
protected:
friend class LLUICtrlFactory;
LLSpeakButton(const Params& p);

View File

@ -13,6 +13,8 @@
chrome="true"
border_visible="false"
width="1000">
<string name="SpeakBtnToolTip">Turns microphone on/off</string>
<string name="VoiceControlBtnToolTip">Shows/hides voice control panel</string>
<layout_stack
mouse_opaque="false"
border_size="0"
@ -70,9 +72,7 @@
left="0"
name="talk"
top="3"
width="100"
speak_button.tool_tip="Turns microphone on/off"
show_button.tool_tip="Shows/hides voice control panel" />
width="100" />
</layout_panel>
<icon
auto_resize="false"