meow-7.2.2
MaximB ProductEngine 2012-11-20 06:27:30 +02:00
commit 09570f1e38
16 changed files with 238 additions and 106 deletions

View File

@ -47,6 +47,7 @@ set(llui_SOURCE_FILES
lleditmenuhandler.cpp
llf32uictrl.cpp
llfiltereditor.cpp
llflashtimer.cpp
llflatlistview.cpp
llfloater.cpp
llfloaterreg.cpp
@ -153,6 +154,7 @@ set(llui_HEADER_FILES
lleditmenuhandler.h
llf32uictrl.h
llfiltereditor.h
llflashtimer.h
llflatlistview.h
llfloater.h
llfloaterreg.h

View File

@ -170,10 +170,16 @@ LLButton::LLButton(const LLButton::Params& p)
mMouseUpSignal(NULL),
mHeldDownSignal(NULL),
mUseDrawContextAlpha(p.use_draw_context_alpha),
mHandleRightMouse(p.handle_right_mouse),
mButtonFlashCount(p.button_flash_count),
mButtonFlashRate(p.button_flash_rate)
mHandleRightMouse(p.handle_right_mouse)
{
// If optional parameter "p.button_flash_count" is not provided, LLFlashTimer will be
// used instead it a "default" value from gSavedSettings.getS32("FlashCount")).
// Likewise, missing "p.button_flash_rate" is replaced by gSavedSettings.getF32("FlashPeriod").
// Note: flashing should be allowed in settings.xml (boolean key "EnableButtonFlashing").
S32 flash_count = p.button_flash_count.isProvided()? p.button_flash_count : 0;
F32 flash_rate = p.button_flash_rate.isProvided()? p.button_flash_rate : 0.0;
mFlashingTimer = new LLFlashTimer ((LLFlashTimer::callback_t)NULL, flash_count, flash_rate);
static LLUICachedControl<S32> llbutton_orig_h_pad ("UIButtonOrigHPad", 0);
static Params default_params(LLUICtrlFactory::getDefaultParams<LLButton>());
@ -267,6 +273,7 @@ LLButton::~LLButton()
delete mMouseDownSignal;
delete mMouseUpSignal;
delete mHeldDownSignal;
delete mFlashingTimer;
}
// HACK: Committing a button is the same as instantly clicking it.
@ -591,22 +598,11 @@ void LLButton::draw()
{
static LLCachedControl<bool> sEnableButtonFlashing(*LLUI::sSettingGroups["config"], "EnableButtonFlashing", true);
F32 alpha = mUseDrawContextAlpha ? getDrawContext().mAlpha : getCurrentTransparency();
bool flash = FALSE;
if( mFlashing)
{
if ( sEnableButtonFlashing)
{
F32 elapsed = mFlashingTimer.getElapsedTimeF32();
S32 flash_count = S32(elapsed * mButtonFlashRate * 2.f);
// flash on or off?
flash = (flash_count % 2 == 0) || flash_count > S32((F32)mButtonFlashCount * 2.f);
}
else
{ // otherwise just highlight button in flash color
flash = true;
}
}
mFlashing = mFlashingTimer->isFlashing();
bool flash = mFlashing &&
(!sEnableButtonFlashing || mFlashingTimer->isHighlight());
bool pressed_by_keyboard = FALSE;
if (hasFocus())
@ -951,10 +947,13 @@ void LLButton::setToggleState(BOOL b)
void LLButton::setFlashing( BOOL b )
{
if ((bool)b != mFlashing)
if (b)
{
mFlashing = b;
mFlashingTimer.reset();
mFlashingTimer->startFlashing();
}
else
{
mFlashingTimer->stopFlashing();
}
}

View File

@ -30,6 +30,7 @@
#include "lluuid.h"
#include "llbadgeowner.h"
#include "llcontrol.h"
#include "llflashtimer.h"
#include "lluictrl.h"
#include "v4color.h"
#include "llframetimer.h"
@ -201,6 +202,7 @@ public:
void setHighlight(bool b);
void setFlashing( BOOL b );
BOOL getFlashing() const { return mFlashing; }
LLFlashTimer* getFlashTimer() {return mFlashingTimer;}
void setHAlign( LLFontGL::HAlign align ) { mHAlign = align; }
LLFontGL::HAlign getHAlign() const { return mHAlign; }
@ -285,8 +287,6 @@ protected:
LLFrameTimer mMouseDownTimer;
bool mNeedsHighlight;
S32 mButtonFlashCount;
F32 mButtonFlashRate;
void drawBorder(LLUIImage* imagep, const LLColor4& color, S32 size);
void resetMouseDownTimer();
@ -373,7 +373,7 @@ protected:
bool mForcePressedState;
bool mDisplayPressedState;
LLFrameTimer mFlashingTimer;
LLFlashTimer* mFlashingTimer;
bool mHandleRightMouse;
};

View File

@ -0,0 +1,80 @@
/**
* @file llflashtimer.cpp
* @brief LLFlashTimer class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2012, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "../newview/llviewerprecompiledheaders.h"
#include "llflashtimer.h"
#include "../newview/llviewercontrol.h"
#include "lleventtimer.h"
LLFlashTimer::LLFlashTimer(callback_t cb, S32 count, F32 period)
: LLEventTimer(period)
, mCallback(cb)
, mCurrentTickCount(0)
, mIsFlashing(false)
{
mEventTimer.stop();
// By default use settings from settings.xml to be able change them via Debug settings. See EXT-5973.
// Due to Timer is implemented as derived class from EventTimer it is impossible to change period
// in runtime. So, both settings are made as required restart.
mFlashCount = 2 * ((count>0)? count : gSavedSettings.getS32("FlashCount"));
if (mPeriod<=0)
{
mPeriod = gSavedSettings.getF32("FlashPeriod");
}
}
BOOL LLFlashTimer::tick()
{
mIsHighlight = !(mCurrentTickCount % 2);
if (mCallback)
{
mCallback(mIsHighlight);
}
if (++mCurrentTickCount >= mFlashCount)
{
mEventTimer.stop();
}
return FALSE;
}
void LLFlashTimer::startFlashing()
{
mCurrentTickCount = 0;
mIsFlashing = true;
mEventTimer.start();
}
void LLFlashTimer::stopFlashing()
{
mIsFlashing = false;
mIsHighlight = false;
mEventTimer.stop();
}

67
indra/llui/llflashtimer.h Normal file
View File

@ -0,0 +1,67 @@
/**
* @file llflashtimer.h
* @brief LLFlashTimer class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2012, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_FLASHTIMER_H
#define LL_FLASHTIMER_H
#include "lleventtimer.h"
class LLFlashTimer : public LLEventTimer
{
public:
typedef boost::function<void (bool)> callback_t;
/**
* Constructor.
*
* @param count - how many times callback should be called (twice to not change original state)
* @param period - how frequently callback should be called
* @param cb - callback to be called each tick
*/
LLFlashTimer(callback_t cb = NULL, S32 count = 0, F32 period = 0.0);
~LLFlashTimer() {};
/*virtual*/ BOOL tick();
void startFlashing();
void stopFlashing();
bool isFlashing() {return mIsFlashing;}
bool isHighlight() {return mIsHighlight;}
private:
callback_t mCallback;
/**
* How many times parent will blink.
*/
S32 mFlashCount;
S32 mCurrentTickCount;
bool mIsHighlight;
bool mIsFlashing;
};
#endif /* LL_FLASHTIMER_H */

View File

@ -23,9 +23,12 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "../newview/llviewerprecompiledheaders.h"
#include "llflashtimer.h"
#include "linden_common.h"
#include "llfolderviewitem.h"
#include "llfolderview.h"
#include "llfolderviewmodel.h"
#include "llpanel.h"
@ -142,6 +145,8 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p)
mArrowSize(p.arrow_size),
mMaxFolderItemOverlap(p.max_folder_item_overlap)
{
mFlashTimer = new LLFlashTimer();
sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
sHighlightBgColor = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", DEFAULT_WHITE);
sHighlightFgColor = LLUIColorTable::instance().getColor("MenuItemHighlightFgColor", DEFAULT_WHITE);
@ -160,17 +165,19 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p)
}
}
// Destroys the object
LLFolderViewItem::~LLFolderViewItem()
{
delete mFlashTimer;
mViewModelItem = NULL;
}
BOOL LLFolderViewItem::postBuild()
{
refresh();
return TRUE;
}
// Destroys the object
LLFolderViewItem::~LLFolderViewItem( void )
{
mViewModelItem = NULL;
}
LLFolderView* LLFolderViewItem::getRoot()
{
@ -676,12 +683,16 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo
const S32 focus_bottom = getRect().getHeight() - mItemHeight;
const bool folder_open = (getRect().getHeight() > mItemHeight + 4);
const S32 FOCUS_LEFT = 1;
bool flashing = mFlashTimer->isFlashing();
if (flashing? mFlashTimer->isHighlight() : mIsSelected) // always render "current" item (only render other selected items if
// mShowSingleSelection is FALSE) or flashing item
if (mIsSelected) // always render "current" item. Only render other selected items if mShowSingleSelection is FALSE
{
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
LLColor4 bg_color = bgColor;
if (!mIsCurSelection)
bool selection = flashing? mFlashTimer->isHighlight() : mIsCurSelection;
if (!selection)
{
// do time-based fade of extra objects
F32 fade_time = (getRoot() ? getRoot()->getSelectionFadeElapsedTime() : 0.0f);
@ -701,7 +712,7 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo
getRect().getWidth() - 2,
focus_bottom,
bg_color, hasKeyboardFocus);
if (mIsCurSelection)
if (selection)
{
gl_rect_2d(FOCUS_LEFT,
focus_top,

View File

@ -26,6 +26,7 @@
#ifndef LLFOLDERVIEWITEM_H
#define LLFOLDERVIEWITEM_H
#include "llflashtimer.h"
#include "llview.h"
#include "lluiimage.h"
@ -162,6 +163,7 @@ public:
S32 getIconPad();
S32 getTextPad();
LLFlashTimer* getFlashTimer() {return mFlashTimer;}
// If 'selection' is 'this' then note that otherwise ignore.
// Returns TRUE if this item ends up being selected.
virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus);
@ -272,6 +274,7 @@ public:
private:
static std::map<U8, LLFontGL*> sFonts; // map of styles to fonts
LLFlashTimer* mFlashTimer;
};

View File

@ -506,8 +506,8 @@ void LLTabContainer::draw()
}
}
mPrevArrowBtn->setFlashing(FALSE);
mNextArrowBtn->setFlashing(FALSE);
mPrevArrowBtn->getFlashTimer()->stopFlashing();
mNextArrowBtn->getFlashTimer()->stopFlashing();
}

View File

@ -13142,10 +13142,10 @@
<key>Value</key>
<real>50.0</real>
</map>
<key>WellIconFlashCount</key>
<key>FlashCount</key>
<map>
<key>Comment</key>
<string>Number of flashes of IM Well and Notification Well icons after which flashing buttons stay lit up. Requires restart.</string>
<string>Number of flashes of item. Requires restart.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
@ -13153,10 +13153,10 @@
<key>Value</key>
<integer>3</integer>
</map>
<key>WellIconFlashPeriod</key>
<key>FlashPeriod</key>
<map>
<key>Comment</key>
<string>Period at which IM Well and Notification Well icons flash (seconds). Requires restart.</string>
<string>Period at which item flash (seconds). Requires restart.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>

View File

@ -67,60 +67,6 @@ boost::signals2::signal<LLChiclet* (const LLUUID&),
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
/**
* Updates the Well's 'Lit' state to flash it when "new messages" are come.
*
* It gets callback which will be called 2*N times with passed period. See EXT-3147
*/
class LLSysWellChiclet::FlashToLitTimer : public LLEventTimer
{
public:
typedef boost::function<void()> callback_t;
/**
* Constructor.
*
* @param count - how many times callback should be called (twice to not change original state)
* @param period - how frequently callback should be called
* @param cb - callback to be called each tick
*/
FlashToLitTimer(S32 count, F32 period, callback_t cb)
: LLEventTimer(period)
, mCallback(cb)
, mFlashCount(2 * count)
, mCurrentFlashCount(0)
{
mEventTimer.stop();
}
BOOL tick()
{
mCallback();
if (++mCurrentFlashCount == mFlashCount) mEventTimer.stop();
return FALSE;
}
void flash()
{
mCurrentFlashCount = 0;
mEventTimer.start();
}
void stopFlashing()
{
mEventTimer.stop();
}
private:
callback_t mCallback;
/**
* How many times Well will blink.
*/
S32 mFlashCount;
S32 mCurrentFlashCount;
};
LLSysWellChiclet::Params::Params()
: button("button")
@ -145,13 +91,8 @@ LLSysWellChiclet::LLSysWellChiclet(const Params& p)
mButton = LLUICtrlFactory::create<LLButton>(button_params);
addChild(mButton);
// use settings from settings.xml to be able change them via Debug settings. See EXT-5973.
// Due to Timer is implemented as derived class from EventTimer it is impossible to change period
// in runtime. So, both settings are made as required restart.
static S32 flash_to_lit_count = gSavedSettings.getS32("WellIconFlashCount");
static F32 flash_period = gSavedSettings.getF32("WellIconFlashPeriod");
mFlashToLitTimer = new FlashToLitTimer(flash_to_lit_count, flash_period, boost::bind(&LLSysWellChiclet::changeLitState, this));
mFlashToLitTimer = new LLFlashTimer(boost::bind(&LLSysWellChiclet::changeLitState, this, _1));
}
LLSysWellChiclet::~LLSysWellChiclet()
@ -191,7 +132,7 @@ void LLSysWellChiclet::setToggleState(BOOL toggled) {
mButton->setToggleState(toggled);
}
void LLSysWellChiclet::changeLitState()
void LLSysWellChiclet::changeLitState(bool blink)
{
setNewMessagesState(!mIsNewMessagesState);
}
@ -320,7 +261,7 @@ void LLIMWellChiclet::messageCountChanged(const LLSD& session_data)
// we have to flash to 'Lit' state each time new unread message is coming.
if (counter > mCounter && im_not_visible)
{
mFlashToLitTimer->flash();
mFlashToLitTimer->startFlashing();
}
else if (counter == 0)
{

View File

@ -29,6 +29,7 @@
#include "llavatariconctrl.h"
#include "llbutton.h"
#include "llflashtimer.h"
#include "llpanel.h"
#include "lltextbox.h"
#include "lloutputmonitorctrl.h"
@ -844,7 +845,7 @@ protected:
* There is an assumption that it will be called 2*N times to do not change its start state.
* @see FlashToLitTimer
*/
void changeLitState();
void changeLitState(bool blink);
/**
* Displays menu.
@ -860,7 +861,7 @@ protected:
S32 mMaxDisplayedCount;
bool mIsNewMessagesState;
FlashToLitTimer* mFlashToLitTimer;
LLFlashTimer* mFlashToLitTimer;
LLContextMenu* mContextMenu;
};

View File

@ -41,6 +41,7 @@
#include "llcallbacklist.h"
#include "llgroupactions.h"
#include "llgroupiconctrl.h"
#include "llflashtimer.h"
#include "llfloateravatarpicker.h"
#include "llfloaterpreference.h"
#include "llimview.h"
@ -1154,6 +1155,7 @@ void LLFloaterIMContainer::selectConversation(const LLUUID& session_id)
}
}
// Synchronous select the conversation item and the conversation floater
BOOL LLFloaterIMContainer::selectConversationPair(const LLUUID& session_id, bool select_widget)
{
@ -1593,7 +1595,22 @@ void LLFloaterIMContainer::reSelectConversation()
{
selectFloater(session_floater);
}
}
void LLFloaterIMContainer::flashConversationItemWidget(const LLUUID& session_id, bool is_flashes)
{
LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,session_id);
if (widget)
{
if (is_flashes)
{
widget->getFlashTimer()->startFlashing();
}
else
{
widget->getFlashTimer()->stopFlashing();
}
}
}
// EOF

View File

@ -164,6 +164,7 @@ public:
void setTimeNow(const LLUUID& session_id, const LLUUID& participant_id);
void setNearbyDistances();
void reSelectConversation();
void flashConversationItemWidget(const LLUUID& session_id, bool is_flashes);
private:
LLConversationViewSession* createConversationItemWidget(LLConversationItem* item);

View File

@ -40,6 +40,7 @@
#include "llfloaterimsession.h"
#include "llfloaterimcontainer.h" // to replace separate IM Floaters with multifloater container
#include "lllayoutstack.h"
#include "lltoolbarview.h"
#include "llfloaterimnearbychat.h"
const F32 REFRESH_INTERVAL = 0.2f;
@ -328,11 +329,20 @@ std::string LLFloaterIMSessionTab::appendTime()
void LLFloaterIMSessionTab::appendMessage(const LLChat& chat, const LLSD &args)
{
// Update the participant activity time
LLFloaterIMContainer* im_box = LLFloaterIMContainer::findInstance();
if (im_box)
{
im_box->setTimeNow(mSessionID,chat.mFromID);
// TODO: Warning! The next two lines of code are included below only temporarily
// to demonstrate the correct format call the appropriate functions.
// They should be moved to the right places when working on CHUI-486. ~Alex ProductEngine.
// ---- start demo ----
im_box->flashConversationItemWidget(mSessionID, true); // flashing of the conversation's item
gToolBarView->flashCommand(LLCommandId("chat"), true); // flashing of the FUI button "Chat"
// ---- end demo -----
}

View File

@ -2808,7 +2808,7 @@ void LLIMMgr::inviteToSession(
{
bool isRejectGroupCall = (gSavedSettings.getBOOL("VoiceCallsRejectGroup") && (notify_box_type == "VoiceInviteGroup"));
bool isRejectNonFriendCall = (gSavedSettings.getBOOL("VoiceCallsFriendsOnly") && (LLAvatarTracker::instance().getBuddyInfo(caller_id) == NULL));
bool isRejectDoNotDisturb = gAgent.isDoNotDisturb();
bool isRejectDoNotDisturb = (gAgent.isDoNotDisturb() && !hasSession(session_id));
if (isRejectGroupCall || isRejectNonFriendCall || isRejectDoNotDisturb)
{
if (isRejectDoNotDisturb && !isRejectGroupCall && !isRejectNonFriendCall)

View File

@ -30,8 +30,8 @@
image_overlay_alignment="left"
use_ellipses="true"
auto_resize="true"
button_flash_count="99999"
button_flash_rate="1.0"
button_flash_count="3"
button_flash_rate="0.25"
flash_color="EmphasisColor"/>
<button_icon pad_left="10"
pad_right="10"