summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorVadim Savchuk <vsavchuk@productengine.com>2009-11-06 21:04:04 +0200
committerVadim Savchuk <vsavchuk@productengine.com>2009-11-06 21:04:04 +0200
commitf716bb1e3afd4c950c379dfa702246979de467e6 (patch)
tree48bbde155d34027fae238a5a17691901c9ad3ad7 /indra
parentdae2e04f1930404296f39a39ec91c8cdb95eb733 (diff)
Backed out changeset c3b8509f465a (EXT-989) as causing numerous conflicts.
Will reapply the changes later. --HG-- branch : product-engine
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llchiclet.cpp194
-rw-r--r--indra/newview/llchiclet.h76
-rw-r--r--indra/newview/llvoicechannel.cpp3
-rw-r--r--indra/newview/llvoicechannel.h7
4 files changed, 112 insertions, 168 deletions
diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp
index 041baf06e7..6fd7e6b07d 100644
--- a/indra/newview/llchiclet.cpp
+++ b/indra/newview/llchiclet.cpp
@@ -200,9 +200,7 @@ void LLChiclet::setValue(const LLSD& value)
LLIMChiclet::LLIMChiclet(const LLIMChiclet::Params& p)
: LLChiclet(p)
-, mShowSpeaker(false)
, mNewMessagesIcon(NULL)
-, mSpeakerCtrl(NULL)
, mCounterCtrl(NULL)
{
// initialize an overlay icon for new messages
@@ -221,40 +219,6 @@ LLIMChiclet::LLIMChiclet(const LLIMChiclet::Params& p)
setShowCounter(false);
}
-void LLIMChiclet::setShowSpeaker(bool show)
-{
- bool needs_resize = getShowSpeaker() != show;
- if(needs_resize)
- {
- mShowSpeaker = show;
- toggleSpeakerControl();
- onChicletSizeChanged();
- }
-}
-void LLIMChiclet::initSpeakerControl()
-{
- mSpeakerCtrl->setSpeakerId(getOtherParticipantId());
-}
-
-void LLIMChiclet::toggleSpeakerControl()
-{
- LLRect speaker_rect = mSpeakerCtrl->getRect();
- S32 required_width = getRect().getWidth();
-
- if(getShowSpeaker())
- {
- required_width = required_width + speaker_rect.getWidth();
- initSpeakerControl();
- }
- else
- {
- required_width = required_width - speaker_rect.getWidth();
- }
-
- reshape(required_width, getRect().getHeight());
- mSpeakerCtrl->setVisible(getShowSpeaker());
-}
-
void LLIMChiclet::setShowNewMessagesIcon(bool show)
{
if(mNewMessagesIcon)
@@ -346,7 +310,7 @@ LLIMP2PChiclet::Params::Params()
// Changed icon height from 25 to 24 to fix ticket EXT-794.
// In some cases(after changing UI scale) 25 pixel height icon was
// drawn incorrectly, i'm not sure why.
- avatar_icon.rect(LLRect(0, 24, 24, 0));
+ avatar_icon.rect(LLRect(0, 24, 25, 0));
avatar_icon.mouse_opaque(false);
unread_notifications.name("unread");
@@ -359,9 +323,7 @@ LLIMP2PChiclet::Params::Params()
unread_notifications.visible(false);
speaker.name("speaker");
- speaker.rect(LLRect(25, 25, 45, 0));
- speaker.auto_update(true);
- speaker.draw_border(false);
+ speaker.rect(LLRect(45, 25, 65, 0));
show_speaker = false;
}
@@ -369,6 +331,7 @@ LLIMP2PChiclet::Params::Params()
LLIMP2PChiclet::LLIMP2PChiclet(const Params& p)
: LLIMChiclet(p)
, mChicletIconCtrl(NULL)
+, mSpeakerCtrl(NULL)
, mPopupMenu(NULL)
{
LLChicletAvatarIconCtrl::Params avatar_params = p.avatar_icon;
@@ -396,9 +359,18 @@ void LLIMP2PChiclet::setCounter(S32 counter)
setShowNewMessagesIcon(counter);
}
-void LLIMP2PChiclet::initSpeakerControl()
+LLRect LLIMP2PChiclet::getRequiredRect()
{
- mSpeakerCtrl->setSpeakerId(getOtherParticipantId());
+ LLRect rect(0, 0, mChicletIconCtrl->getRect().getWidth(), 0);
+ if(getShowCounter())
+ {
+ rect.mRight += mCounterCtrl->getRequiredRect().getWidth();
+ }
+ if(getShowSpeaker())
+ {
+ rect.mRight += mSpeakerCtrl->getRect().getWidth();
+ }
+ return rect;
}
void LLIMP2PChiclet::setOtherParticipantId(const LLUUID& other_participant_id)
@@ -475,6 +447,18 @@ void LLIMP2PChiclet::onMenuItemClicked(const LLSD& user_data)
}
}
+void LLIMP2PChiclet::setShowSpeaker(bool show)
+{
+ LLIMChiclet::setShowSpeaker(show);
+
+ bool needs_resize = getShowSpeaker() != show;
+ mSpeakerCtrl->setVisible(getShowSpeaker());
+ if(needs_resize)
+ {
+ onChicletSizeChanged();
+ }
+}
+
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
@@ -510,9 +494,7 @@ LLAdHocChiclet::Params::Params()
speaker.name("speaker");
- speaker.rect(LLRect(25, 25, 45, 0));
- speaker.auto_update(true);
- speaker.draw_border(false);
+ speaker.rect(LLRect(45, 25, 65, 0));
show_speaker = false;
}
@@ -520,6 +502,7 @@ LLAdHocChiclet::Params::Params()
LLAdHocChiclet::LLAdHocChiclet(const Params& p)
: LLIMChiclet(p)
, mChicletIconCtrl(NULL)
+, mSpeakerCtrl(NULL)
, mPopupMenu(NULL)
{
LLChicletAvatarIconCtrl::Params avatar_params = p.avatar_icon;
@@ -550,35 +533,24 @@ void LLAdHocChiclet::setSessionId(const LLUUID& session_id)
mChicletIconCtrl->setValue(im_session->mOtherParticipantID);
}
-void LLAdHocChiclet::draw()
+void LLAdHocChiclet::setCounter(S32 counter)
{
- initSpeakerControl();
- LLIMChiclet::draw();
+ mCounterCtrl->setCounter(counter);
+ setShowNewMessagesIcon(counter);
}
-void LLAdHocChiclet::initSpeakerControl()
+LLRect LLAdHocChiclet::getRequiredRect()
{
- LLUUID speaker_id;
- LLSpeakerMgr::speaker_list_t speaker_list;
-
- LLIMModel::getInstance()->findIMSession(getSessionId())->mSpeakers->getSpeakerList(&speaker_list, FALSE);
- for (LLSpeakerMgr::speaker_list_t::iterator i = speaker_list.begin(); i != speaker_list.end(); ++i)
+ LLRect rect(0, 0, mChicletIconCtrl->getRect().getWidth(), 0);
+ if(getShowCounter())
{
- LLPointer<LLSpeaker> s = *i;
- if (s->mSpeechVolume > 0 || s->mStatus == LLSpeaker::STATUS_SPEAKING)
- {
- speaker_id = s->mID;
- break;
- }
+ rect.mRight += mCounterCtrl->getRequiredRect().getWidth();
}
-
- mSpeakerCtrl->setSpeakerId(speaker_id);
-}
-
-void LLAdHocChiclet::setCounter(S32 counter)
-{
- mCounterCtrl->setCounter(counter);
- setShowNewMessagesIcon(counter);
+ if(getShowSpeaker())
+ {
+ rect.mRight += mSpeakerCtrl->getRect().getWidth();
+ }
+ return rect;
}
BOOL LLAdHocChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask)
@@ -612,9 +584,7 @@ LLIMGroupChiclet::Params::Params()
unread_notifications.visible(false);
speaker.name("speaker");
- speaker.rect(LLRect(25, 25, 45, 0));
- speaker.auto_update(true);
- speaker.draw_border(false);
+ speaker.rect(LLRect(45, 25, 65, 0));
show_speaker = false;
}
@@ -623,6 +593,7 @@ LLIMGroupChiclet::LLIMGroupChiclet(const Params& p)
: LLIMChiclet(p)
, LLGroupMgrObserver(LLUUID::null)
, mChicletIconCtrl(NULL)
+, mSpeakerCtrl(NULL)
, mPopupMenu(NULL)
{
LLChicletGroupIconCtrl::Params avatar_params = p.group_icon;
@@ -655,32 +626,18 @@ void LLIMGroupChiclet::setCounter(S32 counter)
setShowNewMessagesIcon(counter);
}
-void LLIMGroupChiclet::draw()
+LLRect LLIMGroupChiclet::getRequiredRect()
{
- initSpeakerControl();
- LLIMChiclet::draw();
-}
-
-void LLIMGroupChiclet::initSpeakerControl()
-{
- LLUUID speaker_id;
- LLSpeakerMgr* speaker_mgr = NULL;
- LLSpeakerMgr::speaker_list_t speaker_list;
-
- speaker_mgr = LLIMModel::getInstance()->findIMSession(getSessionId())->mSpeakers;
- speaker_mgr->update(TRUE);
- speaker_mgr->getSpeakerList(&speaker_list, FALSE);
- for (LLSpeakerMgr::speaker_list_t::iterator i = speaker_list.begin(); i != speaker_list.end(); ++i)
+ LLRect rect(0, 0, mChicletIconCtrl->getRect().getWidth(), 0);
+ if(getShowCounter())
{
- LLPointer<LLSpeaker> s = *i;
- if (s->mSpeechVolume > 0 || s->mStatus == LLSpeaker::STATUS_SPEAKING)
- {
- speaker_id = s->mID;
- break;
- }
+ rect.mRight += mCounterCtrl->getRequiredRect().getWidth();
}
-
- mSpeakerCtrl->setSpeakerId(speaker_id);
+ if(getShowSpeaker())
+ {
+ rect.mRight += mSpeakerCtrl->getRect().getWidth();
+ }
+ return rect;
}
void LLIMGroupChiclet::setSessionId(const LLUUID& session_id)
@@ -767,6 +724,17 @@ void LLIMGroupChiclet::onMenuItemClicked(const LLSD& user_data)
}
}
+void LLIMGroupChiclet::setShowSpeaker(bool show)
+{
+ LLIMChiclet::setShowSpeaker(show);
+
+ bool needs_resize = getShowSpeaker() != show;
+ mSpeakerCtrl->setVisible(getShowSpeaker());
+ if(needs_resize)
+ {
+ onChicletSizeChanged();
+ }
+}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
@@ -882,28 +850,10 @@ BOOL LLChicletPanel::postBuild()
LLIMModel::instance().addNewMsgCallback(boost::bind(im_chiclet_callback, this, _1));
LLIMModel::instance().addNoUnreadMsgsCallback(boost::bind(im_chiclet_callback, this, _1));
LLIMChiclet::sFindChicletsSignal.connect(boost::bind(&LLChicletPanel::findChiclet<LLChiclet>, this, _1));
- LLVoiceChannel::setOnCurrentVoiceChannelChanged(boost::bind(&LLChicletPanel::onCurrentVoiceChannelChanged, this, _1));
return TRUE;
}
-void LLChicletPanel::onCurrentVoiceChannelChanged(const LLUUID& session_id)
-{
- for(chiclet_list_t::iterator it = mChicletList.begin(); it != mChicletList.end(); ++it)
- {
- LLIMChiclet* chiclet = dynamic_cast<LLIMChiclet*>(*it);
- if(chiclet)
- {
- if(chiclet->getSessionId() == session_id)
- {
- chiclet->setShowSpeaker(true);
- continue;
- }
- chiclet->setShowSpeaker(false);
- }
- }
-}
-
S32 LLChicletPanel::calcChickletPanleWidth()
{
S32 res = 0;
@@ -947,7 +897,23 @@ bool LLChicletPanel::addChiclet(LLChiclet* chiclet, S32 index)
void LLChicletPanel::onChicletSizeChanged(LLChiclet* ctrl, const LLSD& param)
{
- arrange();
+ S32 chiclet_width = ctrl->getRect().getWidth();
+ S32 chiclet_new_width = ctrl->getRequiredRect().getWidth();
+
+ if(chiclet_new_width == chiclet_width)
+ {
+ return;
+ }
+
+ LLRect chiclet_rect = ctrl->getRect();
+ chiclet_rect.mRight = chiclet_rect.mLeft + chiclet_new_width;
+
+ ctrl->setRect(chiclet_rect);
+
+ S32 offset = chiclet_new_width - chiclet_width;
+ S32 index = getChicletIndex(ctrl);
+
+ shiftChiclets(offset, index + 1);
trimChiclets();
showScrollButtonsIfNeeded();
}
@@ -1486,6 +1452,6 @@ void LLChicletGroupIconCtrl::setValue(const LLSD& value )
//////////////////////////////////////////////////////////////////////////
LLChicletSpeakerCtrl::LLChicletSpeakerCtrl(const Params&p)
- : LLOutputMonitorCtrl(p)
+ : LLIconCtrl(p)
{
}
diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h
index 21909d2577..a830240b7d 100644
--- a/indra/newview/llchiclet.h
+++ b/indra/newview/llchiclet.h
@@ -149,11 +149,11 @@ protected:
/*
* Class for displaying status of Voice Chat
*/
-class LLChicletSpeakerCtrl : public LLOutputMonitorCtrl
+class LLChicletSpeakerCtrl : public LLIconCtrl
{
public:
- struct Params : public LLInitParam::Block<Params, LLOutputMonitorCtrl::Params>
+ struct Params : public LLInitParam::Block<Params, LLIconCtrl::Params>
{
Params(){};
};
@@ -266,6 +266,8 @@ private:
* Base class for Instant Message chiclets.
* IMChiclet displays icon, number of unread messages(optional)
* and voice chat status(optional).
+* Every chiclet should override LLUICtrl::getRequiredRect and return
+* desired width.
*/
class LLIMChiclet : public LLChiclet
{
@@ -304,14 +306,9 @@ public:
virtual LLUUID getOtherParticipantId() { return mOtherParticipantId; }
/*
- * Init Speaker Control with speaker's ID
+ * Shows/hides voice chat status control.
*/
- virtual void initSpeakerControl();
-
- /*
- * set status (Shows/Hide) for voice control.
- */
- virtual void setShowSpeaker(bool show);
+ virtual void setShowSpeaker(bool show) { mShowSpeaker = show; }
/*
* Returns voice chat status control visibility.
@@ -319,11 +316,6 @@ public:
virtual bool getShowSpeaker() {return mShowSpeaker;};
/*
- * Shows/Hides for voice control for a chiclet.
- */
- virtual void toggleSpeakerControl();
-
- /*
* Shows/hides overlay icon concerning new unread messages.
*/
virtual void setShowNewMessagesIcon(bool show);
@@ -333,7 +325,10 @@ public:
*/
virtual bool getShowNewMessagesIcon();
- virtual void draw();
+ /*
+ * Draws border around chiclet.
+ */
+ /*virtual*/ void draw();
/**
* Determine whether given ID refers to a group or an IM chat session.
@@ -368,8 +363,6 @@ protected:
LLIconCtrl* mNewMessagesIcon;
LLChicletNotificationCounterCtrl* mCounterCtrl;
- LLChicletSpeakerCtrl* mSpeakerCtrl;
-
/** the id of another participant, either an avatar id or a group id*/
LLUUID mOtherParticipantId;
@@ -417,6 +410,8 @@ public:
/* virtual */ void setOtherParticipantId(const LLUUID& other_participant_id);
+ /*virtual*/ void setShowSpeaker(bool show);
+
/*
* Sets number of unread messages. Will update chiclet's width if number text
* exceeds size of counter and notify it's parent about size change.
@@ -424,14 +419,15 @@ public:
/*virtual*/ void setCounter(S32);
/*
- * Init Speaker Control with speaker's ID
+ * Returns number of unread messages.
*/
- /*virtual*/ void initSpeakerControl();
+ /*virtual*/ S32 getCounter() { return mCounterCtrl->getCounter(); }
/*
- * Returns number of unread messages.
+ * Returns rect, required to display chiclet.
+ * Width is the only valid value.
*/
- /*virtual*/ S32 getCounter() { return mCounterCtrl->getCounter(); }
+ /*virtual*/ LLRect getRequiredRect();
protected:
LLIMP2PChiclet(const Params& p);
@@ -461,6 +457,7 @@ protected:
private:
LLChicletAvatarIconCtrl* mChicletIconCtrl;
+ LLChicletSpeakerCtrl* mSpeakerCtrl;
LLMenuGL* mPopupMenu;
};
@@ -498,19 +495,15 @@ public:
/*virtual*/ void setCounter(S32);
/*
- * Keep Speaker Control with actual speaker's ID
- */
- /*virtual*/ void draw();
-
- /*
- * Init Speaker Control with speaker's ID
+ * Returns number of unread messages.
*/
- /*virtual*/ void initSpeakerControl();
+ /*virtual*/ S32 getCounter() { return mCounterCtrl->getCounter(); }
/*
- * Returns number of unread messages.
+ * Returns rect, required to display chiclet.
+ * Width is the only valid value.
*/
- /*virtual*/ S32 getCounter() { return mCounterCtrl->getCounter(); }
+ /*virtual*/ LLRect getRequiredRect();
protected:
LLAdHocChiclet(const Params& p);
@@ -524,6 +517,7 @@ protected:
private:
LLChicletAvatarIconCtrl* mChicletIconCtrl;
+ LLChicletSpeakerCtrl* mSpeakerCtrl;
LLMenuGL* mPopupMenu;
};
@@ -553,17 +547,14 @@ public:
*/
/*virtual*/ void setSessionId(const LLUUID& session_id);
- /*
- * Keep Speaker Control with actual speaker's ID
- */
- /*virtual*/ void draw();
-
/**
* Callback for LLGroupMgrObserver, we get this when group data is available or changed.
* Sets group icon.
*/
/*virtual*/ void changed(LLGroupChange gc);
+ /*virtual*/ void setShowSpeaker(bool show);
+
/*
* Sets number of unread messages. Will update chiclet's width if number text
* exceeds size of counter and notify it's parent about size change.
@@ -571,14 +562,15 @@ public:
/*virtual*/ void setCounter(S32);
/*
- * Init Speaker Control with speaker's ID
+ * Returns number of unread messages.
*/
- /*virtual*/ void initSpeakerControl();
+ /*virtual*/ S32 getCounter() { return mCounterCtrl->getCounter(); }
/*
- * Returns number of unread messages.
+ * Returns rect, required to display chiclet.
+ * Width is the only valid value.
*/
- /*virtual*/ S32 getCounter() { return mCounterCtrl->getCounter(); }
+ /*virtual*/ LLRect getRequiredRect();
~LLIMGroupChiclet();
@@ -605,6 +597,7 @@ protected:
private:
LLChicletGroupIconCtrl* mChicletIconCtrl;
+ LLChicletSpeakerCtrl* mSpeakerCtrl;
LLMenuGL* mPopupMenu;
};
@@ -743,11 +736,6 @@ public:
/*virtual*/ BOOL postBuild();
/*
- * Handler for the Voice Client's signal. Finds a corresponding chiclet and toggles its SpeakerControl
- */
- void onCurrentVoiceChannelChanged(const LLUUID& session_id);
-
- /*
* Reshapes controls and rearranges chiclets if needed.
*/
/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE );
diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp
index 5ab3a2aaf3..cefc88ebee 100644
--- a/indra/newview/llvoicechannel.cpp
+++ b/indra/newview/llvoicechannel.cpp
@@ -46,7 +46,6 @@ LLVoiceChannel::voice_channel_map_t LLVoiceChannel::sVoiceChannelMap;
LLVoiceChannel::voice_channel_map_uri_t LLVoiceChannel::sVoiceChannelURIMap;
LLVoiceChannel* LLVoiceChannel::sCurrentVoiceChannel = NULL;
LLVoiceChannel* LLVoiceChannel::sSuspendedVoiceChannel = NULL;
-LLVoiceChannel::channel_changed_signal_t LLVoiceChannel::sCurrentVoiceChannelChanged;
BOOL LLVoiceChannel::sSuspended = FALSE;
@@ -321,8 +320,6 @@ void LLVoiceChannel::activate()
{
setState(STATE_CALL_STARTED);
}
-
- sCurrentVoiceChannelChanged(this->mSessionID);
}
void LLVoiceChannel::getChannelInfo()
diff --git a/indra/newview/llvoicechannel.h b/indra/newview/llvoicechannel.h
index dfa886c99c..8f1e9ff02d 100644
--- a/indra/newview/llvoicechannel.h
+++ b/indra/newview/llvoicechannel.h
@@ -54,13 +54,6 @@ public:
typedef boost::function<void(const EState& old_state, const EState& new_state)> state_changed_callback_t;
- // on current channel changed signal
- typedef boost::function<void(const LLUUID& session_id)> channel_changed_callback_t;
- typedef boost::signals2::signal<void(const LLUUID& session_id)> channel_changed_signal_t;
- static channel_changed_signal_t sCurrentVoiceChannelChanged;
- static boost::signals2::connection setOnCurrentVoiceChannelChanged(channel_changed_callback_t cb) { return sCurrentVoiceChannelChanged.connect(cb); }
-
-
LLVoiceChannel(const LLUUID& session_id, const std::string& session_name);
virtual ~LLVoiceChannel();