Implemented normal sub-task EXT-2478(Implement a chiclet for the llGiveInventory() processing)

--HG--
branch : product-engine
meow-7.2.2
Eugene Mutavchi 2009-12-01 22:30:04 +02:00
parent 07f284408b
commit 06d5706cdc
3 changed files with 160 additions and 1 deletions

View File

@ -1456,6 +1456,28 @@ void LLChicletGroupIconCtrl::setValue(const LLSD& value )
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
LLChicletInvOfferIconCtrl::LLChicletInvOfferIconCtrl(const Params& p)
: LLChicletAvatarIconCtrl(p)
, mDefaultIcon(p.default_icon)
{
}
void LLChicletInvOfferIconCtrl::setValue(const LLSD& value )
{
if(value.asUUID().isNull())
{
LLIconCtrl::setValue(mDefaultIcon);
}
else
{
LLChicletAvatarIconCtrl::setValue(value);
}
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
LLChicletSpeakerCtrl::LLChicletSpeakerCtrl(const Params&p)
: LLOutputMonitorCtrl(p)
{
@ -1507,4 +1529,60 @@ BOOL LLScriptChiclet::handleMouseDown(S32 x, S32 y, MASK mask)
return LLChiclet::handleMouseDown(x, y, mask);
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
static const std::string INVENTORY_USER_OFFER ("UserGiveItem");
LLInvOfferChiclet::Params::Params()
{
// *TODO Vadim: Get rid of hardcoded values.
rect(CHICLET_RECT);
icon.rect(CHICLET_ICON_RECT);
}
LLInvOfferChiclet::LLInvOfferChiclet(const Params&p)
: LLIMChiclet(p)
, mChicletIconCtrl(NULL)
{
LLChicletInvOfferIconCtrl::Params icon_params = p.icon;
mChicletIconCtrl = LLUICtrlFactory::create<LLChicletInvOfferIconCtrl>(icon_params);
// Let "new message" icon be on top, else it will be hidden behind chiclet icon.
addChildInBack(mChicletIconCtrl);
}
void LLInvOfferChiclet::setSessionId(const LLUUID& session_id)
{
setShowNewMessagesIcon( getSessionId() != session_id );
LLIMChiclet::setSessionId(session_id);
LLUUID notification_id = LLScriptFloaterManager::getInstance()->findNotificationId(session_id);
LLNotificationPtr notification = LLNotifications::getInstance()->find(notification_id);
if(notification)
{
setToolTip(notification->getSubstitutions()["TITLE"].asString());
}
if ( notification && notification->getName() == INVENTORY_USER_OFFER )
{
mChicletIconCtrl->setValue(notification->getPayload()["from_id"]);
}
else
{
mChicletIconCtrl->setValue(LLUUID::null);
}
}
void LLInvOfferChiclet::onMouseDown()
{
LLScriptFloaterManager::instance().toggleScriptFloater(getSessionId());
}
BOOL LLInvOfferChiclet::handleMouseDown(S32 x, S32 y, MASK mask)
{
onMouseDown();
return LLChiclet::handleMouseDown(x, y, mask);
}
// EOF

View File

@ -147,6 +147,39 @@ protected:
std::string mDefaultIcon;
};
/**
* Class for displaying icon in inventory offer chiclet.
*/
class LLChicletInvOfferIconCtrl : public LLChicletAvatarIconCtrl
{
public:
struct Params :
public LLInitParam::Block<Params, LLChicletAvatarIconCtrl::Params>
{
Optional<std::string> default_icon;
Params()
: default_icon("default_icon", "Generic_Object_Small")
{
avatar_id = LLUUID::null;
};
};
/**
* Sets icon, if value is LLUUID::null - default icon will be set.
*/
virtual void setValue(const LLSD& value );
protected:
LLChicletInvOfferIconCtrl(const Params& p);
friend class LLUICtrlFactory;
private:
std::string mDefaultIcon;
};
/**
* Class for displaying of speaker's voice indicator
*/
@ -584,6 +617,45 @@ private:
LLIconCtrl* mChicletIconCtrl;
};
/**
* Chiclet for inventory offer script floaters.
*/
class LLInvOfferChiclet: public LLIMChiclet
{
public:
struct Params : public LLInitParam::Block<Params, LLIMChiclet::Params>
{
Optional<LLChicletInvOfferIconCtrl::Params> icon;
Params();
};
/*virtual*/ void setSessionId(const LLUUID& session_id);
/*virtual*/ void setCounter(S32 counter){}
/*virtual*/ S32 getCounter() { return 0; }
/**
* Toggle script floater
*/
/*virtual*/ void onMouseDown();
/**
* Override default handler
*/
/*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
protected:
LLInvOfferChiclet(const Params&);
friend class LLUICtrlFactory;
private:
LLChicletInvOfferIconCtrl* mChicletIconCtrl;
};
/**
* Implements Group chat chiclet.
*/

View File

@ -212,7 +212,16 @@ void LLScriptFloaterManager::onAddNotification(const LLUUID& notification_id)
LLNotificationData nd = {notification_id};
mNotifications.insert(std::make_pair(object_id, nd));
LLBottomTray::getInstance()->getChicletPanel()->createChiclet<LLScriptChiclet>(object_id);
// Create inventory offer chiclet for offer type notifications
LLNotificationPtr notification = LLNotifications::getInstance()->find(notification_id);
if( notification && notification->getType() == "offer" )
{
LLBottomTray::instance().getChicletPanel()->createChiclet<LLInvOfferChiclet>(object_id);
}
else
{
LLBottomTray::getInstance()->getChicletPanel()->createChiclet<LLScriptChiclet>(object_id);
}
toggleScriptFloater(object_id);
}