meow-7.2.2
maxim@mnikolenko 2013-01-03 13:38:42 +02:00
commit df3f00443f
16 changed files with 210 additions and 123 deletions

View File

@ -311,7 +311,7 @@ void LLButton::onCommit()
{
make_ui_sound("UISndClickRelease");
}
if (mIsToggle)
{
toggleState();
@ -613,8 +613,6 @@ void LLButton::draw()
static LLCachedControl<bool> sEnableButtonFlashing(*LLUI::sSettingGroups["config"], "EnableButtonFlashing", true);
F32 alpha = mUseDrawContextAlpha ? getDrawContext().mAlpha : getCurrentTransparency();
bool flash = mFlashing && sEnableButtonFlashing;
bool pressed_by_keyboard = FALSE;
if (hasFocus())
{
@ -642,6 +640,17 @@ void LLButton::draw()
LLColor4 glow_color;
LLRender::eBlendType glow_type = LLRender::BT_ADD_WITH_ALPHA;
LLUIImage* imagep = NULL;
// Cancel sticking of color, if the button is pressed,
// or when a flashing of the previously selected button is ended
if (mFlashingTimer
&& ((selected && !mFlashingTimer->isFlashingInProgress()) || pressed))
{
mFlashing = false;
}
bool flash = mFlashing && sEnableButtonFlashing;
if (pressed && mDisplayPressedState)
{
imagep = selected ? mImagePressedSelected : mImagePressed;
@ -697,8 +706,7 @@ void LLButton::draw()
imagep = mImageDisabled;
}
// Selected has a higher priority than flashing. If both are set, flashing is ignored.
if (mFlashing && !selected)
if (mFlashing)
{
// if button should flash and we have icon for flashing, use it as image for button
if(flash && mImageFlash)

View File

@ -41,6 +41,7 @@
#include "llchannelmanager.h"
#include "llchicletbar.h"
#include "llconsole.h"
#include "lldonotdisturbnotificationstorage.h"
#include "llenvmanager.h"
#include "llfirstuse.h"
#include "llfloatercamera.h"
@ -1389,11 +1390,16 @@ BOOL LLAgent::getAFK() const
//-----------------------------------------------------------------------------
// setDoNotDisturb()
//-----------------------------------------------------------------------------
void LLAgent::setDoNotDisturb(bool pIsDotNotDisturb)
void LLAgent::setDoNotDisturb(bool pIsDoNotDisturb)
{
mIsDoNotDisturb = pIsDotNotDisturb;
sendAnimationRequest(ANIM_AGENT_DO_NOT_DISTURB, (pIsDotNotDisturb ? ANIM_REQUEST_START : ANIM_REQUEST_STOP));
LLNotificationsUI::LLChannelManager::getInstance()->muteAllChannels(pIsDotNotDisturb);
bool isDoNotDisturbSwitchedOff = (mIsDoNotDisturb && !pIsDoNotDisturb);
mIsDoNotDisturb = pIsDoNotDisturb;
sendAnimationRequest(ANIM_AGENT_DO_NOT_DISTURB, (pIsDoNotDisturb ? ANIM_REQUEST_START : ANIM_REQUEST_STOP));
LLNotificationsUI::LLChannelManager::getInstance()->muteAllChannels(pIsDoNotDisturb);
if (isDoNotDisturbSwitchedOff)
{
LLDoNotDisturbNotificationStorage::getInstance()->loadNotifications();
}
}
//-----------------------------------------------------------------------------

View File

@ -139,7 +139,9 @@ void LLChannelManager::onLoginCompleted()
}
LLPersistentNotificationStorage::getInstance()->loadNotifications();
LLDoNotDisturbNotificationStorage::getInstance()->initialize();
LLDoNotDisturbNotificationStorage::getInstance()->loadNotifications();
}
//--------------------------------------------------------------------------

View File

@ -39,6 +39,7 @@
LLCommunicationChannel::LLCommunicationChannel(const std::string& pName, const std::string& pParentName)
: LLNotificationChannel(pName, pParentName, filterByDoNotDisturbStatus)
, mHistory()
{
}
@ -61,6 +62,11 @@ LLCommunicationChannel::history_list_t::const_iterator LLCommunicationChannel::e
return mHistory.end();
}
void LLCommunicationChannel::clearHistory()
{
mHistory.clear();
}
void LLCommunicationChannel::onFilterFail(LLNotificationPtr pNotificationPtr)
{
std::string notificationType = pNotificationPtr->getType();

View File

@ -46,6 +46,8 @@ public:
typedef std::multimap<LLDate, LLNotificationPtr> history_list_t;
history_list_t::const_iterator beginHistory() const;
history_list_t::const_iterator endHistory() const;
void clearHistory();
protected:
virtual void onFilterFail(LLNotificationPtr pNotificationPtr);

View File

@ -547,27 +547,6 @@ void LLConversationViewParticipant::onMouseLeave(S32 x, S32 y, MASK mask)
LLFolderViewItem::onMouseLeave(x, y, mask);
}
BOOL LLConversationViewParticipant::handleMouseDown( S32 x, S32 y, MASK mask )
{
LLConversationItem* item = NULL;
LLConversationViewSession* session_widget =
dynamic_cast<LLConversationViewSession *>(this->getParentFolder());
if (session_widget)
{
item = dynamic_cast<LLConversationItem*>(session_widget->getViewModelItem());
}
LLUUID session_id = item? item->getUUID() : LLUUID();
BOOL result = LLFolderViewItem::handleMouseDown(x, y, mask);
if(result)
{
(LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container"))->
selectConversationPair(session_id, false);
}
return result;
}
S32 LLConversationViewParticipant::getLabelXPos()
{
return getIndentation() + mAvatarIcon->getRect().getWidth() + mIconPad;

View File

@ -132,8 +132,6 @@ public:
void addToFolder(LLFolderViewFolder* folder);
void addToSession(const LLUUID& session_id);
/*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask );
void onMouseEnter(S32 x, S32 y, MASK mask);
void onMouseLeave(S32 x, S32 y, MASK mask);

View File

@ -34,9 +34,12 @@
#include "llerror.h"
#include "llfasttimer_class.h"
#include "llnotifications.h"
#include "llnotificationhandler.h"
#include "llnotificationstorage.h"
#include "llscriptfloater.h"
#include "llsd.h"
#include "llsingleton.h"
#include "lluuid.h"
LLDoNotDisturbNotificationStorage::LLDoNotDisturbNotificationStorage()
: LLSingleton<LLDoNotDisturbNotificationStorage>()
@ -85,6 +88,59 @@ static LLFastTimer::DeclareTimer FTM_LOAD_DND_NOTIFICATIONS("Load DND Notificati
void LLDoNotDisturbNotificationStorage::loadNotifications()
{
LLFastTimer _(FTM_LOAD_DND_NOTIFICATIONS);
LLSD input;
if (!readNotifications(input) ||input.isUndefined())
{
return;
}
LLSD& data = input["data"];
if (data.isUndefined())
{
return;
}
LLNotifications& instance = LLNotifications::instance();
for (LLSD::array_const_iterator notification_it = data.beginArray();
notification_it != data.endArray();
++notification_it)
{
LLSD notification_params = *notification_it;
LLNotificationPtr notification(new LLNotification(notification_params));
const LLUUID& notificationID = notification->id();
if (instance.find(notificationID))
{
instance.update(notification);
}
else
{
LLNotificationResponderInterface* responder = createResponder(notification_params["name"], notification_params["responder"]);
if (responder == NULL)
{
LL_WARNS("LLDoNotDisturbNotificationStorage") << "cannot create responder for notification of type '"
<< notification->getType() << "'" << LL_ENDL;
}
else
{
LLNotificationResponderPtr responderPtr(responder);
notification->setResponseFunctor(responderPtr);
}
instance.add(notification);
}
}
// Clear the communication channel history and rewrite the save file to empty it as well
LLNotificationChannelPtr channelPtr = getCommunicationChannel();
LLCommunicationChannel *commChannel = dynamic_cast<LLCommunicationChannel*>(channelPtr.get());
llassert(commChannel != NULL);
commChannel->clearHistory();
saveNotifications();
}
LLNotificationChannelPtr LLDoNotDisturbNotificationStorage::getCommunicationChannel() const

View File

@ -106,6 +106,8 @@ public:
bool enableContextMenuItem(const std::string& item, uuid_vec_t& selectedIDS);
void doToParticipants(const std::string& item, uuid_vec_t& selectedIDS);
void assignResizeLimits();
private:
typedef std::map<LLUUID,LLFloater*> avatarID_panel_map_t;
avatarID_panel_map_t mSessions;
@ -154,7 +156,6 @@ private:
void toggleAllowTextChat(const LLUUID& participant_uuid);
void toggleMute(const LLUUID& participant_id, U32 flags);
void openNearbyChat();
void assignResizeLimits();
LLButton* mExpandCollapseBtn;
LLButton* mStubCollapseBtn;

View File

@ -606,8 +606,8 @@ void LLFloaterIMSessionTab::updateHeaderAndToolbar()
// prevent start conversation before its container
LLFloaterIMContainer::getInstance();
bool is_torn_off = checkIfTornOff();
if (!is_torn_off)
bool is_not_torn_off = !checkIfTornOff();
if (is_not_torn_off)
{
hideAllStandardButtons();
}
@ -616,7 +616,7 @@ void LLFloaterIMSessionTab::updateHeaderAndToolbar()
// Participant list should be visible only in torn off floaters.
bool is_participant_list_visible =
is_torn_off
!is_not_torn_off
&& gSavedSettings.getBOOL("IMShowControlPanel")
&& !mIsP2PChat;
@ -624,22 +624,28 @@ void LLFloaterIMSessionTab::updateHeaderAndToolbar()
// Display collapse image (<<) if the floater is hosted
// or if it is torn off but has an open control panel.
bool is_expanded = !is_torn_off || is_participant_list_visible;
bool is_expanded = is_not_torn_off || is_participant_list_visible;
mExpandCollapseBtn->setImageOverlay(getString(is_expanded ? "collapse_icon" : "expand_icon"));
mExpandCollapseBtn->setToolTip(
is_not_torn_off?
getString("expcol_button_not_tearoff_tooltip") :
(is_expanded?
getString("expcol_button_tearoff_and_expanded_tooltip") :
getString("expcol_button_tearoff_and_collapsed_tooltip")));
// toggle floater's drag handle and title visibility
if (mDragHandle)
{
mDragHandle->setTitleVisible(is_torn_off);
mDragHandle->setTitleVisible(!is_not_torn_off);
}
// The button (>>) should be disabled for torn off P2P conversations.
mExpandCollapseBtn->setEnabled(!is_torn_off || !mIsP2PChat);
mExpandCollapseBtn->setEnabled(is_not_torn_off || !mIsP2PChat);
mTearOffBtn->setImageOverlay(getString(is_torn_off? "return_icon" : "tear_off_icon"));
mTearOffBtn->setToolTip(getString(!is_torn_off? "tooltip_to_separate_window" : "tooltip_to_main_window"));
mTearOffBtn->setImageOverlay(getString(is_not_torn_off? "tear_off_icon" : "return_icon"));
mTearOffBtn->setToolTip(getString(is_not_torn_off? "tooltip_to_separate_window" : "tooltip_to_main_window"));
mCloseBtn->setVisible(!is_torn_off && !mIsNearbyChat);
mCloseBtn->setVisible(is_not_torn_off && !mIsNearbyChat);
enableDisableCallBtn();
@ -751,6 +757,11 @@ void LLFloaterIMSessionTab::onTearOffClicked()
{
forceReshape();
}
LLFloaterIMContainer* container = LLFloaterIMContainer::getInstance();
if (container)
{
container->assignResizeLimits();
}
refreshConversation();
updateGearBtn();
}

View File

@ -122,7 +122,7 @@ void on_new_message(const LLSD& msg)
LLUUID session_id = msg["session_id"].asUUID();
LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(session_id);
// determine action for this session
// determine action for this session
if (session_id.isNull())
{
@ -148,13 +148,14 @@ void on_new_message(const LLSD& msg)
action = gSavedSettings.getString("NotificationGroupChatOptions");
}
// do not show notification in "do not disturb" mode or it goes from agent
// do not show notification which goes from agent
if (gAgent.getID() == participant_id)
{
return;
}
// execution of the action
LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(session_id);
@ -173,7 +174,7 @@ void on_new_message(const LLSD& msg)
if ("toast" == action)
{
// Skip toasting if we have open window of IM with this session id
// Skip toasting and flashing if we have open window of IM with this session id
if (session_floater
&& session_floater->isInVisibleChain()
&& session_floater->hasFocus()
@ -184,12 +185,6 @@ void on_new_message(const LLSD& msg)
return;
}
// Skip toasting for system messages and for nearby chat
if (participant_id.isNull())
{
return;
}
//User is not focused on conversation containing the message
if(session_floater_not_focused)
{
@ -201,7 +196,8 @@ void on_new_message(const LLSD& msg)
gToolBarView->flashCommand(LLCommandId("chat"), true);
//Show IM toasts (upper right toasts)
if(session_id.notNull())
// Skip toasting for system messages and for nearby chat
if(session_id.notNull() && participant_id.notNull())
{
LLAvatarNameCache::get(participant_id, boost::bind(&on_avatar_name_cache_toast, _1, _2, msg));
}

View File

@ -29,14 +29,39 @@
#include "llnotificationstorage.h"
#include <string>
#include <map>
#include "llerror.h"
#include "llfile.h"
#include "llnotifications.h"
#include "llpointer.h"
#include "llsd.h"
#include "llsdserialize.h"
#include "llsingleton.h"
#include "llviewermessage.h"
class LLResponderRegistry : public LLSingleton<LLResponderRegistry>
{
public:
LLResponderRegistry();
~LLResponderRegistry();
LLNotificationResponderInterface* createResponder(const std::string& pNotificationName, const LLSD& pParams);
protected:
private:
template<typename RESPONDER_TYPE> static LLNotificationResponderInterface* create(const LLSD& pParams);
typedef boost::function<LLNotificationResponderInterface* (const LLSD& params)> responder_constructor_t;
void add(const std::string& pNotificationName, const responder_constructor_t& pConstructor);
typedef std::map<std::string, responder_constructor_t> build_map_t;
build_map_t mBuildMap;
};
LLNotificationStorage::LLNotificationStorage(std::string pFileName)
: mFileName(pFileName)
{
@ -90,3 +115,53 @@ bool LLNotificationStorage::readNotifications(LLSD& pNotificationData) const
return didFileRead;
}
LLNotificationResponderInterface* LLNotificationStorage::createResponder(const std::string& pNotificationName, const LLSD& pParams) const
{
return LLResponderRegistry::getInstance()->createResponder(pNotificationName, pParams);
}
LLResponderRegistry::LLResponderRegistry()
: LLSingleton<LLResponderRegistry>()
, mBuildMap()
{
add("ObjectGiveItem", &create<LLOfferInfo>);
add("OwnObjectGiveItem", &create<LLOfferInfo>);
add("UserGiveItem", &create<LLOfferInfo>);
add("TeleportOffered", &create<LLOfferInfo>);
add("TeleportOffered_MaturityExceeded", &create<LLOfferInfo>);
add("OfferFriendship", &create<LLOfferInfo>);
}
LLResponderRegistry::~LLResponderRegistry()
{
}
LLNotificationResponderInterface* LLResponderRegistry::createResponder(const std::string& pNotificationName, const LLSD& pParams)
{
build_map_t::const_iterator it = mBuildMap.find(pNotificationName);
if(mBuildMap.end() == it)
{
return NULL;
}
responder_constructor_t ctr = it->second;
return ctr(pParams);
}
template<typename RESPONDER_TYPE> LLNotificationResponderInterface* LLResponderRegistry::create(const LLSD& pParams)
{
RESPONDER_TYPE* responder = new RESPONDER_TYPE();
responder->fromLLSD(pParams);
return responder;
}
void LLResponderRegistry::add(const std::string& pNotificationName, const responder_constructor_t& pConstructor)
{
if (mBuildMap.find(pNotificationName) != mBuildMap.end())
{
LL_ERRS("LLResponderRegistry") << "Responder is already registered : " << pNotificationName << LL_ENDL;
}
mBuildMap.insert(std::make_pair<std::string, responder_constructor_t>(pNotificationName, pConstructor));
}

View File

@ -31,6 +31,7 @@
#include "llerror.h"
class LLNotificationResponderInterface;
class LLSD;
class LLNotificationStorage
@ -44,6 +45,8 @@ protected:
bool writeNotifications(const LLSD& pNotificationData) const;
bool readNotifications(LLSD& pNotificationData) const;
LLNotificationResponderInterface* createResponder(const std::string& pNotificationName, const LLSD& pParams) const;
private:
std::string mFileName;
};

View File

@ -36,34 +36,6 @@
#include "llscriptfloater.h"
#include "llviewermessage.h"
class LLResponderRegistry
{
public:
static void registerResponders();
static LLNotificationResponderInterface* createResponder(const std::string& notification_name, const LLSD& params);
protected:
private:
template<typename RESPONDER_TYPE>
static LLNotificationResponderInterface* create(const LLSD& params)
{
RESPONDER_TYPE* responder = new RESPONDER_TYPE();
responder->fromLLSD(params);
return responder;
}
typedef boost::function<LLNotificationResponderInterface* (const LLSD& params)> responder_constructor_t;
static void add(const std::string& notification_name, const responder_constructor_t& ctr);
typedef std::map<std::string, responder_constructor_t> build_map_t;
static build_map_t sBuildMap;
};
LLPersistentNotificationStorage::LLPersistentNotificationStorage()
: LLSingleton<LLPersistentNotificationStorage>()
, LLNotificationStorage(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "open_notifications.xml"))
@ -114,7 +86,6 @@ static LLFastTimer::DeclareTimer FTM_LOAD_NOTIFICATIONS("Load Notifications");
void LLPersistentNotificationStorage::loadNotifications()
{
LLFastTimer _(FTM_LOAD_NOTIFICATIONS);
LLResponderRegistry::registerResponders();
LLNotifications::instance().getChannel("Persistent")->
connectChanged(boost::bind(&LLPersistentNotificationStorage::onPersistentChannelChanged, this, _1));
@ -144,8 +115,7 @@ void LLPersistentNotificationStorage::loadNotifications()
LLSD notification_params = *notification_it;
LLNotificationPtr notification(new LLNotification(notification_params));
LLNotificationResponderPtr responder(LLResponderRegistry::
createResponder(notification_params["name"], notification_params["responder"]));
LLNotificationResponderPtr responder(createResponder(notification_params["name"], notification_params["responder"]));
notification->setResponseFunctor(responder);
instance.add(notification);
@ -172,39 +142,4 @@ bool LLPersistentNotificationStorage::onPersistentChannelChanged(const LLSD& pay
return false;
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
LLResponderRegistry::build_map_t LLResponderRegistry::sBuildMap;
void LLResponderRegistry::registerResponders()
{
sBuildMap.clear();
add("ObjectGiveItem", &create<LLOfferInfo>);
add("UserGiveItem", &create<LLOfferInfo>);
}
LLNotificationResponderInterface* LLResponderRegistry::createResponder(const std::string& notification_name, const LLSD& params)
{
build_map_t::const_iterator it = sBuildMap.find(notification_name);
if(sBuildMap.end() == it)
{
return NULL;
}
responder_constructor_t ctr = it->second;
return ctr(params);
}
void LLResponderRegistry::add(const std::string& notification_name, const responder_constructor_t& ctr)
{
if(sBuildMap.find(notification_name) != sBuildMap.end())
{
llwarns << "Responder is already registered : " << notification_name << llendl;
llassert(!"Responder already registered");
}
sBuildMap[notification_name] = ctr;
}
// EOF

View File

@ -49,6 +49,15 @@
<floater.string
name="end_call_button_tooltip"
value="Close voice connection"/>
<floater.string
name="expcol_button_not_tearoff_tooltip"
value="Collapse this pane"/>
<floater.string
name="expcol_button_tearoff_and_expanded_tooltip"
value="Collapse participant list"/>
<floater.string
name="expcol_button_tearoff_and_collapsed_tooltip"
value="Expand participant list"/>
<view
follows="all"
layout="topleft"

View File

@ -6583,7 +6583,7 @@ However, this region contains content accessible to adults only.
log_to_im="true"
log_to_chat="false"
show_toast="false"
type="offer">
type="notify">
Teleport offer sent to [TO_NAME]
</notification>
@ -6636,7 +6636,7 @@ However, this region contains content accessible to adults only.
name="FriendshipOffered"
log_to_im="true"
show_toast="false"
type="offer">
type="notify">
<tag>friendship</tag>
You have offered friendship to [TO_NAME]
</notification>
@ -6666,7 +6666,7 @@ However, this region contains content accessible to adults only.
icon="notify.tga"
name="FriendshipAccepted"
log_to_im="true"
type="offer">
type="notify">
<tag>friendship</tag>
&lt;nolink&gt;[NAME]&lt;/nolink&gt; accepted your friendship offer.
</notification>
@ -6686,7 +6686,7 @@ However, this region contains content accessible to adults only.
name="FriendshipAcceptedByMe"
log_to_im="true"
show_toast="false"
type="offer">
type="notify">
<tag>friendship</tag>
Friendship offer accepted.
</notification>
@ -6696,7 +6696,7 @@ Friendship offer accepted.
name="FriendshipDeclinedByMe"
log_to_im="true"
show_toast="false"
type="offer">
type="notify">
<tag>friendship</tag>
Friendship offer declined.
</notification>