Transplant alternate chat tab flash color for mentions

master
Ansariel 2025-05-08 15:13:26 +02:00
parent 9df4d7ba96
commit f3a2a42a9a
16 changed files with 99 additions and 29 deletions

View File

@ -97,6 +97,7 @@ LLButton::Params::Params()
image_overlay_disabled_color("image_overlay_disabled_color", LLColor4::white % 0.3f), image_overlay_disabled_color("image_overlay_disabled_color", LLColor4::white % 0.3f),
image_overlay_selected_color("image_overlay_selected_color", LLColor4::white), image_overlay_selected_color("image_overlay_selected_color", LLColor4::white),
flash_color("flash_color"), flash_color("flash_color"),
flash_alt_color("flash_alt_color"), // <FS:Ansariel> [FS communication UI]
pad_right("pad_right", LLBUTTON_H_PAD), pad_right("pad_right", LLBUTTON_H_PAD),
pad_left("pad_left", LLBUTTON_H_PAD), pad_left("pad_left", LLBUTTON_H_PAD),
pad_bottom("pad_bottom"), pad_bottom("pad_bottom"),
@ -134,6 +135,7 @@ LLButton::LLButton(const LLButton::Params& p)
mMouseDownFrame(0), mMouseDownFrame(0),
mMouseHeldDownCount(0), mMouseHeldDownCount(0),
mFlashing( false ), mFlashing( false ),
mIsAltFlashColor(false), // <FS:Ansariel> [FS communication UI]
mCurGlowStrength(0.f), mCurGlowStrength(0.f),
mNeedsHighlight(false), mNeedsHighlight(false),
mUnselectedLabel(p.label()), mUnselectedLabel(p.label()),
@ -156,6 +158,7 @@ LLButton::LLButton(const LLButton::Params& p)
mDisabledSelectedLabelColor(p.label_color_disabled_selected()), mDisabledSelectedLabelColor(p.label_color_disabled_selected()),
mImageColor(p.image_color()), mImageColor(p.image_color()),
mFlashBgColor(p.flash_color()), mFlashBgColor(p.flash_color()),
mFlashAltBgColor(p.flash_alt_color()), // <FS:Ansariel> [FS communication UI]
mDisabledImageColor(p.image_color_disabled()), mDisabledImageColor(p.image_color_disabled()),
mImageOverlay(p.image_overlay()), mImageOverlay(p.image_overlay()),
mImageOverlayColor(p.image_overlay_color()), mImageOverlayColor(p.image_overlay_color()),
@ -840,7 +843,10 @@ void LLButton::draw()
// provide fade-in and fade-out via flash_color // provide fade-in and fade-out via flash_color
if (mFlashingTimer) if (mFlashingTimer)
{ {
LLColor4 flash_color = mFlashBgColor.get(); // <FS:Ansariel> [FS communication UI]
//LLColor4 flash_color = mFlashBgColor.get();
LLColor4 flash_color = mIsAltFlashColor ? mFlashAltBgColor.get() : mFlashBgColor.get();
// </FS:Ansariel> [FS communication UI]
use_glow_effect = true; use_glow_effect = true;
glow_type = LLRender::BT_ALPHA; // blend the glow glow_type = LLRender::BT_ALPHA; // blend the glow
@ -1118,7 +1124,10 @@ void LLButton::setToggleState(bool b)
} }
} }
void LLButton::setFlashing(bool b, bool force_flashing/* = false */) // <FS:Ansariel> [FS communication UI]
//void LLButton::setFlashing(bool b, bool force_flashing/* = false */)
void LLButton::setFlashing(bool b, bool force_flashing/* = false */, bool alternate_color/*= false */)
// </FS:Ansariel> [FS communication UI]
{ {
mForceFlashing = force_flashing; mForceFlashing = force_flashing;
if (mFlashingTimer) if (mFlashingTimer)
@ -1131,6 +1140,9 @@ void LLButton::setFlashing(bool b, bool force_flashing/* = false */)
mFlashing = b; mFlashing = b;
mFrameTimer.reset(); mFrameTimer.reset();
} }
// <FS:Ansariel> [FS communication UI]
mIsAltFlashColor = alternate_color;
} }
bool LLButton::toggleState() bool LLButton::toggleState()

View File

@ -100,7 +100,9 @@ public:
image_overlay_color, image_overlay_color,
image_overlay_selected_color, image_overlay_selected_color,
image_overlay_disabled_color, image_overlay_disabled_color,
flash_color; flash_color,
flash_alt_color; // <FS:Ansariel> [FS communication UI]
// layout // layout
Optional<S32> pad_right; Optional<S32> pad_right;
@ -217,7 +219,10 @@ public:
void setToggleState(bool b); void setToggleState(bool b);
void setHighlight(bool b); void setHighlight(bool b);
void setFlashing( bool b, bool force_flashing = false ); // <FS:Ansariel> [FS communication UI]
//void setFlashing( bool b, bool force_flashing = false );
void setFlashing(bool b, bool force_flashing = false, bool alternate_color = false);
// </FS:Ansariel> [FS communication UI]
bool getFlashing() const { return mFlashing; } bool getFlashing() const { return mFlashing; }
LLFlashTimer* getFlashTimer() {return mFlashingTimer;} LLFlashTimer* getFlashTimer() {return mFlashingTimer;}
void setFlashColor(const LLUIColor &color) { mFlashBgColor = color; }; void setFlashColor(const LLUIColor &color) { mFlashBgColor = color; };
@ -361,6 +366,8 @@ protected:
LLPointer<LLUIImage> mImageFlash; LLPointer<LLUIImage> mImageFlash;
LLUIColor mFlashBgColor; LLUIColor mFlashBgColor;
// <FS:Ansariel> [FS communication UI]
LLUIColor mFlashAltBgColor;
LLUIColor mImageColor; LLUIColor mImageColor;
LLUIColor mDisabledImageColor; LLUIColor mDisabledImageColor;
@ -373,6 +380,8 @@ protected:
bool mUseEllipses; bool mUseEllipses;
bool mUseFontColor; bool mUseFontColor;
bool mFlashing; bool mFlashing;
// <FS:Ansariel> [FS communication UI]
bool mIsAltFlashColor;
LLFontGL::HAlign mHAlign; LLFontGL::HAlign mHAlign;
S32 mLeftHPad; S32 mLeftHPad;

View File

@ -461,10 +461,16 @@ bool LLMultiFloater::isFloaterFlashing(LLFloater* floaterp)
Requires: floaterp != NULL Requires: floaterp != NULL
**/ **/
void LLMultiFloater::setFloaterFlashing(LLFloater* floaterp, bool flashing) // <FS:Ansariel> [FS communication UI]
//void LLMultiFloater::setFloaterFlashing(LLFloater* floaterp, bool flashing)
void LLMultiFloater::setFloaterFlashing(LLFloater* floaterp, bool flashing, bool alternate_color)
// </FS:Ansariel> [FS communication UI]
{ {
if ( floaterp && floaterp->getHost() == this ) if ( floaterp && floaterp->getHost() == this )
mTabContainer->setTabPanelFlashing(floaterp, flashing); // <FS:Ansariel> [FS communication UI]
//mTabContainer->setTabPanelFlashing(floaterp, flashing);
mTabContainer->setTabPanelFlashing(floaterp, flashing, alternate_color);
// </FS:Ansariel> [FS communication UI]
} }
void LLMultiFloater::onTabSelected() void LLMultiFloater::onTabSelected()

View File

@ -68,7 +68,10 @@ public:
virtual bool isFloaterFlashing(LLFloater* floaterp); virtual bool isFloaterFlashing(LLFloater* floaterp);
virtual S32 getFloaterCount() const; virtual S32 getFloaterCount() const;
virtual void setFloaterFlashing(LLFloater* floaterp, bool flashing); // <FS:Ansariel> [FS communication UI]
//virtual void setFloaterFlashing(LLFloater* floaterp, bool flashing);
virtual void setFloaterFlashing(LLFloater* floaterp, bool flashing, bool alternate_color = false);
// </FS:Ansariel> [FS communication UI]
virtual bool closeAllFloaters(); //Returns false if the floater could not be closed due to pending confirmation dialogs virtual bool closeAllFloaters(); //Returns false if the floater could not be closed due to pending confirmation dialogs
// <FS> Update torn off status and add title bar // <FS> Update torn off status and add title bar
//void setTabContainer(LLTabContainer* tab_container) { if (!mTabContainer) mTabContainer = tab_container; } // LL Code //void setTabContainer(LLTabContainer* tab_container) { if (!mTabContainer) mTabContainer = tab_container; } // LL Code

View File

@ -1806,12 +1806,18 @@ bool LLTabContainer::getTabPanelFlashing(LLPanel *child)
return false; return false;
} }
void LLTabContainer::setTabPanelFlashing(LLPanel* child, bool state ) // <FS:Ansariel> [FS communication UI]
//void LLTabContainer::setTabPanelFlashing(LLPanel* child, bool state )
void LLTabContainer::setTabPanelFlashing(LLPanel* child, bool state, bool alternate_color)
// </FS:Ansariel> [FS communication UI]
{ {
LLTabTuple* tuple = getTabByPanel(child); LLTabTuple* tuple = getTabByPanel(child);
if( tuple ) if( tuple )
{ {
tuple->mButton->setFlashing( state ); // <FS:Ansariel> [FS communication UI]
//tuple->mButton->setFlashing( state );
tuple->mButton->setFlashing(state, false, alternate_color);
// </FS:Ansariel> [FS communication UI]
} }
} }

View File

@ -222,7 +222,10 @@ public:
void setCurrentPanelIndex(S32 index) { mCurrentTabIdx = index; } void setCurrentPanelIndex(S32 index) { mCurrentTabIdx = index; }
bool getTabPanelFlashing(LLPanel* child); bool getTabPanelFlashing(LLPanel* child);
void setTabPanelFlashing(LLPanel* child, bool state); // <FS:Ansariel> [FS communication UI]
//void setTabPanelFlashing(LLPanel* child, bool state);
void setTabPanelFlashing(LLPanel* child, bool state, bool alternate_color = false);
// </FS:Ansariel> [FS communication UI]
void setTabImage(LLPanel* child, std::string img_name, const LLColor4& color = LLColor4::white); void setTabImage(LLPanel* child, std::string img_name, const LLColor4& color = LLColor4::white);
void setTabImage(LLPanel* child, const LLUUID& img_id, const LLColor4& color = LLColor4::white); void setTabImage(LLPanel* child, const LLUUID& img_id, const LLColor4& color = LLColor4::white);
void setTabImage(LLPanel* child, LLIconCtrl* icon); void setTabImage(LLPanel* child, LLIconCtrl* icon);

View File

@ -39,6 +39,7 @@
#include "llchicletbar.h" #include "llchicletbar.h"
#include "llemojihelper.h" #include "llemojihelper.h"
#include "lltoolbarview.h" #include "lltoolbarview.h"
#include "llurlregistry.h"
#include "llvoiceclient.h" #include "llvoiceclient.h"
constexpr F32 VOICE_STATUS_UPDATE_INTERVAL = 1.0f; constexpr F32 VOICE_STATUS_UPDATE_INTERVAL = 1.0f;
@ -316,6 +317,9 @@ void FSFloaterIMContainer::removeFloater(LLFloater* floaterp)
gSavedSettings.setBOOL(setting_name, true); gSavedSettings.setBOOL(setting_name, true);
floaterp->setCanClose(true); floaterp->setCanClose(true);
} }
mFlashingTabStates.erase(floaterp);
LLMultiFloater::removeFloater(floaterp); LLMultiFloater::removeFloater(floaterp);
} }
// [/SL:KB] // [/SL:KB]
@ -345,21 +349,17 @@ void FSFloaterIMContainer::onCloseFloater(LLUUID& id)
} }
} }
void FSFloaterIMContainer::onNewMessageReceived(const LLSD& data) void FSFloaterIMContainer::onNewMessageReceived(const LLSD& msg)
{ {
LLUUID session_id = data["session_id"].asUUID(); LLUUID session_id = msg["session_id"].asUUID();
LLFloater* floaterp = get_ptr_in_map(mSessions, session_id); LLFloater* floaterp = get_ptr_in_map(mSessions, session_id);
LLFloater* current_floater = LLMultiFloater::getActiveFloater(); LLFloater* current_floater = LLMultiFloater::getActiveFloater();
// KC: Don't flash tab on friend status changes per setting // KC: Don't flash tab on friend status changes per setting
if (floaterp && current_floater && floaterp != current_floater if (floaterp && current_floater && floaterp != current_floater
&& (gSavedSettings.getBOOL("FSIMChatFlashOnFriendStatusChange") || !data.has("from_id") || data["from_id"].asUUID().notNull())) && (gSavedSettings.getBOOL("FSIMChatFlashOnFriendStatusChange") || !msg.has("from_id") || msg["from_id"].asUUID().notNull()))
{ {
if (LLMultiFloater::isFloaterFlashing(floaterp)) startFlashingTab(floaterp, msg["message"].asString());
{
LLMultiFloater::setFloaterFlashing(floaterp, false);
}
LLMultiFloater::setFloaterFlashing(floaterp, true);
} }
} }
@ -559,16 +559,15 @@ void FSFloaterIMContainer::addFlashingSession(const LLUUID& session_id)
uuid_vec_t::iterator found = std::find(mFlashingSessions.begin(), mFlashingSessions.end(), session_id); uuid_vec_t::iterator found = std::find(mFlashingSessions.begin(), mFlashingSessions.end(), session_id);
if (found == mFlashingSessions.end()) if (found == mFlashingSessions.end())
{ {
mFlashingSessions.push_back(session_id); mFlashingSessions.emplace_back(session_id);
} }
checkFlashing();
} }
void FSFloaterIMContainer::checkFlashing() void FSFloaterIMContainer::checkFlashing()
{ {
if (mFlashingSessions.empty()) gToolBarView->flashCommand(LLCommandId("chat"), !mFlashingSessions.empty(), isMinimized());
{
gToolBarView->flashCommand(LLCommandId("chat"), false);
}
} }
void FSFloaterIMContainer::sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) void FSFloaterIMContainer::sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id)
@ -584,5 +583,21 @@ void FSFloaterIMContainer::sessionIDUpdated(const LLUUID& old_session_id, const
void FSFloaterIMContainer::tabOpen(LLFloater* opened_floater, bool from_click) void FSFloaterIMContainer::tabOpen(LLFloater* opened_floater, bool from_click)
{ {
LLEmojiHelper::instance().hideHelper(nullptr, true); LLEmojiHelper::instance().hideHelper(nullptr, true);
mFlashingTabStates.erase(opened_floater);
}
void FSFloaterIMContainer::startFlashingTab(LLFloater* floater, const std::string& message)
{
const bool contains_mention = LLUrlRegistry::getInstance()->containsAgentMention(message);
auto& [session_floater, is_alt_flashing] = *(mFlashingTabStates.try_emplace(floater, false).first);
is_alt_flashing = is_alt_flashing || contains_mention;
if (LLMultiFloater::isFloaterFlashing(floater))
{
LLMultiFloater::setFloaterFlashing(floater, false);
}
LLMultiFloater::setFloaterFlashing(floater, true, is_alt_flashing);
} }
// EOF // EOF

View File

@ -63,7 +63,7 @@ public:
virtual void setVisible(bool b); virtual void setVisible(bool b);
/*virtual*/ void setMinimized(bool b); /*virtual*/ void setMinimized(bool b);
void onNewMessageReceived(const LLSD& data); // public so nearbychat can call it directly. TODO: handle via callback. -AO void onNewMessageReceived(const LLSD& msg); // public so nearbychat can call it directly. TODO: handle via callback. -AO
virtual void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, bool has_offline_msg); virtual void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, bool has_offline_msg);
virtual void sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) {}; virtual void sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) {};
@ -78,6 +78,8 @@ public:
void tabOpen(LLFloater* opened_floater, bool from_click); void tabOpen(LLFloater* opened_floater, bool from_click);
void startFlashingTab(LLFloater* floater, const std::string& message);
private: private:
enum eVoiceState enum eVoiceState
{ {
@ -105,6 +107,8 @@ private:
bool mIsAddingNewSession; bool mIsAddingNewSession;
std::map<LLFloater*, bool> mFlashingTabStates;
// [SL:KB] - Patch: UI-TabRearrange | Checked: 2012-05-05 (Catznip-3.3.0) // [SL:KB] - Patch: UI-TabRearrange | Checked: 2012-05-05 (Catznip-3.3.0)
protected: protected:
void onIMTabRearrange(S32 tab_index, LLPanel* tab_panel); void onIMTabRearrange(S32 tab_index, LLPanel* tab_panel);

View File

@ -276,11 +276,11 @@ void FSFloaterNearbyChat::addMessage(const LLChat& chat,bool archive,const LLSD
// AO: IF tab mode active, flash our tab // AO: IF tab mode active, flash our tab
if (isChatMultiTab()) if (isChatMultiTab())
{ {
LLMultiFloater* hostp = getHost();
// KC: Don't flash tab on system messages // KC: Don't flash tab on system messages
if (!isInVisibleChain() && hostp && (chat.mSourceType == CHAT_SOURCE_AGENT || chat.mSourceType == CHAT_SOURCE_OBJECT)) if (FSFloaterIMContainer* container = dynamic_cast<FSFloaterIMContainer*>(getHost());
!isInVisibleChain() && container && (chat.mSourceType == CHAT_SOURCE_AGENT || chat.mSourceType == CHAT_SOURCE_OBJECT))
{ {
hostp->setFloaterFlashing(this, true); container->startFlashingTab(this, chat.mText);
} }
} }

View File

@ -468,7 +468,6 @@ void notify_of_message(const LLSD& msg, bool is_dnd_msg)
&& gSavedSettings.getBOOL("FSNotifyNearbyChatFlash")) && gSavedSettings.getBOOL("FSNotifyNearbyChatFlash"))
{ {
im_container->addFlashingSession(session_id); im_container->addFlashingSession(session_id);
gToolBarView->flashCommand(LLCommandId("chat"), true, im_container->isMinimized());
} }
return; return;
} }
@ -492,7 +491,6 @@ void notify_of_message(const LLSD& msg, bool is_dnd_msg)
&& gSavedSettings.getBOOL("FSNotifyIMFlash")) && gSavedSettings.getBOOL("FSNotifyIMFlash"))
{ {
im_container->addFlashingSession(session_id); im_container->addFlashingSession(session_id);
gToolBarView->flashCommand(LLCommandId("chat"), true, im_container->isMinimized());
} }
// <FS:Ansariel> (Group-)IMs in chat console // <FS:Ansariel> (Group-)IMs in chat console

View File

@ -1437,4 +1437,7 @@
<color <color
name="ChatSelfMentionHighlight" name="ChatSelfMentionHighlight"
value="1 1 0.383 1" /> value="1 1 0.383 1" />
<color
name="MentionFlashBgColor"
reference="EmphasisColor" />
</colors> </colors>

View File

@ -1190,4 +1190,7 @@
<color <color
name="NotecardCursorColor" name="NotecardCursorColor"
reference="TextCursorColor" /> reference="TextCursorColor" />
<color
name="MentionFlashBgColor"
reference="EmphasisColor" />
</colors> </colors>

View File

@ -1430,4 +1430,7 @@
<color <color
name="ChatSelfMentionHighlight" name="ChatSelfMentionHighlight"
value="1 1 0.734 1" /> value="1 1 0.734 1" />
<color
name="MentionFlashBgColor"
reference="EmphasisColor" />
</colors> </colors>

View File

@ -1178,4 +1178,7 @@
<color <color
name="NotecardCursorColor" name="NotecardCursorColor"
reference="TextCursorColor" /> reference="TextCursorColor" />
<color
name="MentionFlashBgColor"
reference="EmphasisColor" />
</colors> </colors>

View File

@ -18,6 +18,7 @@
image_color="ButtonImageColor" image_color="ButtonImageColor"
image_color_disabled="ButtonImageColor" image_color_disabled="ButtonImageColor"
flash_color="ButtonFlashBgColor" flash_color="ButtonFlashBgColor"
flash_alt_color="MentionFlashBgColor"
font="SansSerifSmall" font="SansSerifSmall"
hover_glow_amount="0.25" hover_glow_amount="0.25"
halign="center" halign="center"

View File

@ -18,6 +18,7 @@
image_color="SL-CustomMain" image_color="SL-CustomMain"
image_color_disabled="ButtonImageColor" image_color_disabled="ButtonImageColor"
flash_color="SL-CustomMain" flash_color="SL-CustomMain"
flash_alt_color="MentionFlashBgColor"
font="SansSerifSmall" font="SansSerifSmall"
hover_glow_amount="0.25" hover_glow_amount="0.25"
halign="center" halign="center"