Move the Voice Font control from LLCallFloater to its own panel so that it can be reused.

meow-7.2.2
Aimee Linden 2010-04-30 19:38:52 +01:00
parent 5a9d0803be
commit 7a6474129c
5 changed files with 37 additions and 109 deletions

View File

@ -350,6 +350,7 @@ set(viewer_SOURCE_FILES
llpanelprofileview.cpp
llpanelteleporthistory.cpp
llpaneltiptoast.cpp
llpanelvoicefont.cpp
llpanelvolume.cpp
llpanelvolumepulldown.cpp
llparcelselection.cpp
@ -857,6 +858,7 @@ set(viewer_HEADER_FILES
llpanelprofileview.h
llpanelteleporthistory.h
llpaneltiptoast.h
llpanelvoicefont.h
llpanelvolume.h
llpanelvolumepulldown.h
llparcelselection.h

View File

@ -52,7 +52,7 @@
#include "lltransientfloatermgr.h"
#include "llviewerwindow.h"
#include "llvoicechannel.h"
#include "llvoiceclient.h" // for Voice font list types
#include "llviewercontrol.h"
#include "llviewerparcelmgr.h"
static void get_voice_participants_uuids(uuid_vec_t& speakers_uuids);
@ -106,7 +106,6 @@ LLCallFloater::LLCallFloater(const LLSD& key)
, mNonAvatarCaller(NULL)
, mVoiceType(VC_LOCAL_CHAT)
, mAgentPanel(NULL)
, mVoiceFont(NULL)
, mSpeakingIndicator(NULL)
, mIsModeratorMutedVoice(false)
, mInitParticipantsVoiceState(false)
@ -115,10 +114,7 @@ LLCallFloater::LLCallFloater(const LLSD& key)
mSpeakerDelayRemover = new LLSpeakersDelayActionsStorage(boost::bind(&LLCallFloater::removeVoiceLeftParticipant, this, _1), voice_left_remove_delay);
mFactoryMap["non_avatar_caller"] = LLCallbackMap(create_non_avatar_caller, NULL);
LLVoiceClient::instance().addObserver(dynamic_cast<LLVoiceClientParticipantObserver*>(this));
LLVoiceClient::instance().addObserver(dynamic_cast<LLVoiceClientFontsObserver*>(this));
mCommitCallbackRegistrar.add("Voice.CommitVoiceFont", boost::bind(&LLCallFloater::onCommitVoiceFont, this));
LLVoiceClient::instance().addObserver(this);
LLTransientFloaterMgr::getInstance()->addControlView(this);
// force docked state since this floater doesn't save it between recreations
@ -138,8 +134,7 @@ LLCallFloater::~LLCallFloater()
if(LLVoiceClient::instanceExists())
{
LLVoiceClient::instance().removeObserver(dynamic_cast<LLVoiceClientParticipantObserver*>(this));
LLVoiceClient::instance().removeObserver(dynamic_cast<LLVoiceClientFontsObserver*>(this));
LLVoiceClient::instance().removeObserver(this);
}
LLTransientFloaterMgr::getInstance()->removeControlView(this);
}
@ -153,7 +148,6 @@ BOOL LLCallFloater::postBuild()
childSetAction("leave_call_btn", boost::bind(&LLCallFloater::leaveCall, this));
mVoiceFont = getChild<LLComboBox>("voice_font");
mNonAvatarCaller = getChild<LLNonAvatarCaller>("non_avatar_caller");
mNonAvatarCaller->setVisible(FALSE);
@ -225,12 +219,6 @@ void LLCallFloater::onParticipantsChanged()
}
}
// virtual
void LLCallFloater::onVoiceFontsChanged()
{
updateVoiceFont();
}
//////////////////////////////////////////////////////////////////////////
/// PRIVATE SECTION
//////////////////////////////////////////////////////////////////////////
@ -244,38 +232,6 @@ void LLCallFloater::leaveCall()
}
}
void LLCallFloater::onCommitVoiceFont()
{
if (LLVoiceClient::instance().hasVoiceFonts())
{
LLVoiceClient::getInstance()->setVoiceFont(mVoiceFont->getValue());
}
}
void LLCallFloater::updateVoiceFont()
{
if (mVoiceFont)
{
mVoiceFont->removeall();
mVoiceFont->add(getString("no_voice_font"), LLUUID::null);
if (LLVoiceClient::instance().hasVoiceFonts())
{
const LLVoiceClient::voice_font_list_t font_list = LLVoiceClient::instance().getVoiceFontList();
for (LLVoiceClient::voice_font_list_t::const_iterator it = font_list.begin(); it != font_list.end(); ++it)
{
mVoiceFont->add(*(it->first), *(it->second), ADD_BOTTOM);
}
mVoiceFont->setEnabled(true);
mVoiceFont->setValue(LLVoiceClient::instance().getVoiceFont());
}
else
{
mVoiceFont->setEnabled(false);
}
}
}
void LLCallFloater::updateSession()
{
LLVoiceChannel* voice_channel = LLVoiceChannel::getCurrentVoiceChannel();
@ -333,23 +289,22 @@ void LLCallFloater::updateSession()
if (NULL == mSpeakerManager)
{
// by default let show nearby chat participants
// By default show nearby chat participants
mSpeakerManager = LLLocalSpeakerMgr::getInstance();
lldebugs << "Set DEFAULT speaker manager" << llendl;
mVoiceType = VC_LOCAL_CHAT;
}
updateTitle();
updateVoiceFont();
//hide "Leave Call" button for nearby chat
// Hide "Leave Call" button for nearby chat
bool is_local_chat = mVoiceType == VC_LOCAL_CHAT;
childSetVisible("leave_call_btn_panel", !is_local_chat);
refreshParticipantList();
updateAgentModeratorState();
//show floater for voice calls & only in CONNECTED to voice channel state
// Show floater for voice calls & only in CONNECTED to voice channel state
if (!is_local_chat &&
voice_channel &&
LLVoiceChannel::STATE_CONNECTED == voice_channel->getState())

View File

@ -40,7 +40,6 @@
class LLAvatarList;
class LLAvatarListItem;
class LLComboBox;
class LLNonAvatarCaller;
class LLOutputMonitorCtrl;
class LLParticipantList;
@ -58,9 +57,7 @@ class LLSpeakersDelayActionsStorage;
* When the Resident is engaged in any chat except Nearby Chat, the Voice Control Panel
* also provides a 'Leave Call' button to allow the Resident to leave that voice channel.
*/
class LLCallFloater : public LLTransientDockableFloater,
LLVoiceClientParticipantObserver,
LLVoiceClientFontsObserver
class LLCallFloater : public LLTransientDockableFloater, LLVoiceClientParticipantObserver
{
public:
@ -80,9 +77,6 @@ public:
*/
/*virtual*/ void onParticipantsChanged();
/// Called by LLVoiceClient::notifyVoiceFontObservers when voice font list is changed.
/*virtual*/ void onVoiceFontsChanged();
static void sOnCurrentChannelChanged(const LLUUID& session_id);
private:
@ -107,9 +101,6 @@ private:
void leaveCall();
void onCommitVoiceFont();
void updateVoiceFont();
/**
* Updates mSpeakerManager and list according to current Voice Channel
*
@ -239,7 +230,6 @@ private:
LLNonAvatarCaller* mNonAvatarCaller;
EVoiceControls mVoiceType;
LLPanel* mAgentPanel;
LLComboBox* mVoiceFont;
LLOutputMonitorCtrl* mSpeakingIndicator;
bool mIsModeratorMutedVoice;

View File

@ -7262,8 +7262,13 @@ bool LLVoiceClient::setVoiceFont(const LLUUID& id)
bool LLVoiceClient::setVoiceFont(const std::string &session_handle, const LLUUID& id)
{
sessionState *session = findSession(session_handle);
if (!session)
{
LL_DEBUGS("Voice") << "Invalid Session." << LL_ENDL;
return false;
}
if (!session || !session->mVoiceEnabled || !hasVoiceFonts())
if (!hasVoiceFonts())
{
LL_DEBUGS("Voice") << "Voice fonts not available." << LL_ENDL;
return false;

View File

@ -3,7 +3,7 @@
can_resize="true"
can_minimize="true"
can_close="false"
height="202"
height="205"
layout="topleft"
min_height="124"
min_width="190"
@ -35,9 +35,6 @@
name="no_one_near">
No one near has voice enabled
</string>
<floater.string name="no_voice_font">
No Voice Effect
</floater.string>
<layout_stack
clip="false"
follows="all"
@ -53,7 +50,7 @@
user_resize="false"
auto_resize="false"
layout="topleft"
height="26"
height="20"
name="my_panel">
<avatar_icon
enabled="false"
@ -93,55 +90,34 @@
clip="true"
auto_resize="false"
follows="left|top|right"
height="23"
height="26"
layout="topleft"
left="10"
mouse_opaque="false"
name="voice_font_and_leave_call_stack"
orientation="horizontal"
width="263">
<layout_panel
auto_resize="true"
user_resize="false"
follows="top|left"
height="26"
width="262">
<panel
class="panel_voice_font"
name="panel_voice_font"
visiblity_control="VoiceFontUI"
filename="panel_voice_font.xml" />
<layout_panel
auto_resize="false"
user_resize="false"
follows="top|right"
height="23"
visible="true"
layout="topleft"
name="voice_font_panel"
width="150">
<combo_box
enabled="false"
follows="left|top|right"
name="leave_call_btn_panel"
width="100">
<button
follows="right|top"
height="23"
name="voice_font"
top_pad="0"
width="150">
<combo_box.item
label="No Voice Effect"
name="no_voice_font"
value="0" />
<combo_box.commit_callback
function="Voice.CommitVoiceFont" />
</combo_box>
label="Leave Call"
name="leave_call_btn"
width="100" />
</layout_panel>
<layout_panel
auto_resize="false"
user_resize="false"
follows="top|right"
height="26"
visible="true"
layout="topleft"
name="leave_call_btn_panel"
width="100">
<button
follows="right|top"
height="23"
top_pad="0"
label="Leave Call"
name="leave_call_btn"
width="100" />
</layout_panel>
</layout_stack>
</layout_stack>
<layout_panel
follows="all"
layout="topleft"