remaining hints defined

master
Richard Linden 2010-08-12 12:20:38 -07:00
parent 41fe9750c8
commit bd897431e1
11 changed files with 193 additions and 64 deletions

View File

@ -4,7 +4,7 @@
<key>FirstInventoryOffer</key>
<map>
<key>Comment</key>
<string>Shows hint when a person or object offers you an inventory item</string>
<string>Shows hint when a person or object offers resident an inventory item</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
@ -12,7 +12,51 @@
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstOtherChatBeforeUser</key>
<key>FirstNotUseDestinationGuide</key>
<map>
<key>Comment</key>
<string>Shows hint when resident doesn't activate destination guide</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstNotUseSidePanel</key>
<map>
<key>Comment</key>
<string>Shows hint when resident doesn't activate side panel</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstNotMoving</key>
<map>
<key>Comment</key>
<string>Shows hint when resident doesn't move</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstReceiveLindens</key>
<map>
<key>Comment</key>
<string>Shows hint when resident receives linden dollars</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FirstOtherChatBeforeUser</key>
<map>
<key>Comment</key>
<string>Shows hint when someone else chats first</string>

View File

@ -69,10 +69,6 @@ template class LLBottomTray* LLSingleton<class LLBottomTray>::getInstance();
namespace
{
const std::string& PANEL_CHICLET_NAME = "chiclet_list_panel";
const std::string& PANEL_CHATBAR_NAME = "chat_bar";
const std::string& PANEL_MOVEMENT_NAME = "movement_panel";
const std::string& PANEL_CAMERA_NAME = "cam_panel";
const std::string& PANEL_GESTURE_NAME = "gesture_panel";
S32 get_panel_min_width(LLLayoutStack* stack, LLView* panel)
{
@ -480,6 +476,7 @@ BOOL LLBottomTray::postBuild()
mToolbarStack = getChild<LLLayoutStack>("toolbar_stack");
mMovementButton = getChild<LLButton>("movement_btn");
LLHints::registerHintTarget("move_btn", mMovementButton->getHandle());
mCamButton = getChild<LLButton>("camera_btn");
setRightMouseDownCallback(boost::bind(&LLBottomTray::showBottomTrayContextMenu,this, _2, _3,_4));

View File

@ -36,7 +36,7 @@
// library includes
#include "indra_constants.h"
#include "llnotificationsutil.h"
#include "llnotifications.h"
// viewer includes
#include "llagent.h" // for gAgent.inPrelude()
@ -48,6 +48,7 @@
// static
std::set<std::string> LLFirstUse::sConfigVariables;
std::map<std::string, LLNotificationPtr> LLFirstUse::sNotifications;
// static
void LLFirstUse::addConfigVariable(const std::string& var)
@ -84,58 +85,79 @@ void LLFirstUse::useOverrideKeys()
// so don't show this message until you get off OI. JC
if (!gAgent.inPrelude())
{
if (gWarningSettings.getBOOL("FirstOverrideKeys"))
{
gWarningSettings.setBOOL("FirstOverrideKeys", FALSE);
LLNotificationsUtil::add("FirstOverrideKeys");
}
firstUseNotification("FirstOverrideKeys", true, "FirstOverrideKeys");
}
}
// static
void LLFirstUse::otherAvatarChat()
void LLFirstUse::otherAvatarChat(bool enable)
{
if (gWarningSettings.getBOOL("FirstOtherChatBeforeUser"))
{
gWarningSettings.setBOOL("FirstOtherChatBeforeUser", FALSE);
LLNotificationsUtil::add("HintChat", LLSD(), LLSD().with("target", "nearby_chat_bar").with("direction", "top"));
}
firstUseNotification("FirstOtherChatBeforeUser", enable, "HintChat", LLSD(), LLSD().with("target", "nearby_chat_bar").with("direction", "top"));
}
// static
void LLFirstUse::sit()
void LLFirstUse::sit(bool enable)
{
if (gWarningSettings.getBOOL("FirstSit"))
{
gWarningSettings.setBOOL("FirstSit", FALSE);
LLNotificationsUtil::add("HintSit", LLSD(), LLSD().with("target", "stand_btn").with("direction", "top"));
}
firstUseNotification("FirstSit", enable, "HintSit", LLSD(), LLSD().with("target", "stand_btn").with("direction", "top"));
}
// static
void LLFirstUse::inventoryOffer()
void LLFirstUse::inventoryOffer(bool enable)
{
if (gWarningSettings.getBOOL("FirstInventoryOffer"))
{
gWarningSettings.setBOOL("FirstInventoryOffer", FALSE);
LLNotificationsUtil::add("HintInventory", LLSD(), LLSD().with("target", "inventory_btn").with("direction", "left"));
}
firstUseNotification("FirstInventoryOffer", enable, "HintInventory", LLSD(), LLSD().with("target", "inventory_btn").with("direction", "left"));
}
// static
void LLFirstUse::useSandbox()
{
if (gWarningSettings.getBOOL("FirstSandbox"))
{
gWarningSettings.setBOOL("FirstSandbox", FALSE);
LLSD args;
args["HOURS"] = llformat("%d",SANDBOX_CLEAN_FREQ);
args["TIME"] = llformat("%d",SANDBOX_FIRST_CLEAN_HOUR);
LLNotificationsUtil::add("FirstSandbox", args);
}
firstUseNotification("FirstSandbox", true, "FirstSandbox", LLSD().with("HOURS", SANDBOX_CLEAN_FREQ).with("TIME", SANDBOX_FIRST_CLEAN_HOUR));
}
// static
void LLFirstUse::notUsingDestinationGuide(bool enable)
{
firstUseNotification("FirstNotUseDestinationGuide", enable, "HintDestinationGuide", LLSD(), LLSD().with("target", "dest_guide_btn").with("direction", "left"));
}
// static
void LLFirstUse::notUsingSidePanel(bool enable)
{
firstUseNotification("FirstNotUseSidePanel", enable, "HintSidePanel", LLSD(), LLSD().with("target", "side_panel_btn").with("direction", "left"));
}
// static
void LLFirstUse::notMoving(bool enable)
{
firstUseNotification("FirstNotMoving", enable, "HintMove", LLSD(), LLSD().with("target", "move_btn").with("direction", "top"));
}
// static
void LLFirstUse::receiveLindens(bool enable)
{
firstUseNotification("FirstReceiveLindens", enable, "HintLindenDollar", LLSD(), LLSD().with("target", "linden_balance").with("direction", "bottom"));
}
//static
void LLFirstUse::firstUseNotification(const std::string& control_var, bool enable, const std::string& notification_name, LLSD args, LLSD payload)
{
LLNotificationPtr notif = sNotifications[notification_name];
if (enable)
{
if (!notif && gWarningSettings.getBOOL(control_var))
{ // create new notification
sNotifications[notification_name] = LLNotifications::instance().add(LLNotification::Params().name(notification_name).substitutions(args).payload(payload));
gWarningSettings.setBOOL(control_var, FALSE);
}
}
else
{ // want to hide notification
if (notif)
{ // cancel existing notification
LLNotifications::instance().cancel(notif);
sNotifications.erase(notification_name);
}
}
}

View File

@ -76,6 +76,9 @@ object or from inventory.
14. First time you create/edit a sculpted prim.
*/
class LLNotification;
class LLFirstUse
{
public:
@ -88,14 +91,19 @@ public:
static void resetFirstUse();
static void useOverrideKeys();
static void otherAvatarChat();
static void sit();
static void inventoryOffer();
static void otherAvatarChat(bool enable = true);
static void sit(bool enable = true);
static void notUsingDestinationGuide(bool enable = true);
static void notUsingSidePanel(bool enable = true);
static void notMoving(bool enable = true);
static void inventoryOffer(bool enable = true);
static void receiveLindens(bool enable = true);
static void useSandbox();
protected:
static void firstUseNotification(const std::string& control_var, bool enable, const std::string& notification_name, LLSD args = LLSD(), LLSD payload = LLSD());
static std::set<std::string> sConfigVariables;
static std::map<std::string, boost::shared_ptr<LLNotification> > sNotifications;
};
#endif

View File

@ -149,7 +149,7 @@ void LLHintPopup::draw()
targetp->localRectToOtherView(targetp->getLocalRect(), &target_rect, getParent());
LLRect my_local_rect = getLocalRect();
LLRect my_rect = getRect();
LLRect my_rect;
LLRect arrow_rect;
LLUIImagePtr arrow_imagep;
@ -158,10 +158,10 @@ void LLHintPopup::draw()
switch(mDirection)
{
case LEFT:
my_rect.setCenterAndSize( target_rect.mLeft - (my_rect.getWidth() / 2 + mDistance),
my_rect.setCenterAndSize( target_rect.mLeft - (my_local_rect.getWidth() / 2 + mDistance),
target_rect.getCenterY(),
my_rect.getWidth(),
my_rect.getHeight());
my_local_rect.getWidth(),
my_local_rect.getHeight());
arrow_rect.setCenterAndSize(my_local_rect.mRight + mArrowRight->getWidth() / 2 - OVERLAP,
my_local_rect.getCenterY(),
mArrowRight->getWidth(),
@ -170,9 +170,9 @@ void LLHintPopup::draw()
break;
case TOP:
my_rect.setCenterAndSize( target_rect.getCenterX(),
target_rect.mTop + (my_rect.getHeight() / 2 + mDistance),
my_rect.getWidth(),
my_rect.getHeight());
target_rect.mTop + (my_local_rect.getHeight() / 2 + mDistance),
my_local_rect.getWidth(),
my_local_rect.getHeight());
arrow_rect.setCenterAndSize(my_local_rect.getCenterX(),
my_local_rect.mBottom - mArrowDown->getHeight() / 2 + OVERLAP,
mArrowDown->getWidth(),
@ -181,9 +181,9 @@ void LLHintPopup::draw()
break;
case RIGHT:
my_rect.setCenterAndSize( target_rect.getCenterX(),
target_rect.mTop - (my_rect.getHeight() / 2 + mDistance),
my_rect.getWidth(),
my_rect.getHeight());
target_rect.mTop - (my_local_rect.getHeight() / 2 + mDistance),
my_local_rect.getWidth(),
my_local_rect.getHeight());
arrow_rect.setCenterAndSize(my_local_rect.mLeft - mArrowLeft->getWidth() / 2 + OVERLAP,
my_local_rect.getCenterY(),
mArrowLeft->getWidth(),
@ -191,10 +191,10 @@ void LLHintPopup::draw()
arrow_imagep = mArrowLeft;
break;
case BOTTOM:
my_rect.setCenterAndSize( target_rect.mLeft + (my_rect.getWidth() / 2 + mDistance),
my_rect.setCenterAndSize( target_rect.mLeft + (my_local_rect.getWidth() / 2 + mDistance),
target_rect.getCenterY(),
my_rect.getWidth(),
my_rect.getHeight());
my_local_rect.getWidth(),
my_local_rect.getHeight());
arrow_rect.setCenterAndSize(my_local_rect.getCenterX(),
my_local_rect.mTop + mArrowUp->getHeight() / 2 - OVERLAP,
mArrowUp->getWidth(),
@ -211,6 +211,7 @@ void LLHintPopup::draw()
LLRegistry<std::string, LLHandle<LLView> > LLHints::sTargetRegistry;
std::map<LLNotificationPtr, class LLHintPopup*> LLHints::sHints;
//static
void LLHints::show(LLNotificationPtr hint)
@ -221,6 +222,9 @@ void LLHints::show(LLNotificationPtr hint)
p.notification = hint;
LLHintPopup* popup = new LLHintPopup(p);
sHints[hint] = popup;
LLView* hint_holder = gViewerWindow->getHintHolder();
if (hint_holder)
{
@ -229,6 +233,16 @@ void LLHints::show(LLNotificationPtr hint)
}
}
void LLHints::hide(LLNotificationPtr hint)
{
hint_map_t::iterator found_it = sHints.find(hint);
if (found_it != sHints.end())
{
found_it->second->hide();
sHints.erase(found_it);
}
}
//static
void LLHints::registerHintTarget(const std::string& name, LLHandle<LLView> target)
{

View File

@ -41,10 +41,13 @@ class LLHints
{
public:
static void show(LLNotificationPtr hint);
static void hide(LLNotificationPtr hint);
static void registerHintTarget(const std::string& name, LLHandle<LLView> target);
static LLHandle<LLView> getHintTarget(const std::string& name);
private:
static LLRegistry<std::string, LLHandle<LLView> > sTargetRegistry;
typedef std::map<LLNotificationPtr, class LLHintPopup*> hint_map_t;
static hint_map_t sHints;
};

View File

@ -49,10 +49,16 @@ LLHintHandler::~LLHintHandler()
bool LLHintHandler::processNotification(const LLSD& notify)
{
if (notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "load")
LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());
std::string sigtype = notify["sigtype"].asString();
if (sigtype == "add" || sigtype == "load")
{
LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());
LLHints::show(notification);
}
else if (sigtype == "delete")
{
LLHints::hide(notification);
}
return false;
}

View File

@ -36,6 +36,7 @@
#include "llappearancemgr.h"
#include "llavataractions.h"
#include "llbutton.h"
#include "llfirstuse.h"
#include "llinventorybridge.h"
#include "llinventoryfunctions.h"
#include "llinventorypanel.h"
@ -148,6 +149,8 @@ void LLSidepanelInventory::onOpen(const LLSD& key)
mTaskPanel->setObjectSelection(LLSelectMgr::getInstance()->getSelection());
showTaskInfoPanel();
}
LLFirstUse::inventoryOffer(false);
}
void LLSidepanelInventory::onInfoButtonClicked()

View File

@ -423,6 +423,7 @@ void LLSideTray::createButtons ()
{
mCollapseButton = createButton("",sidebar_tab->mImage,sidebar_tab->getTabTitle(),
boost::bind(&LLSideTray::onToggleCollapse, this));
LLHints::registerHintTarget("side_panel_btn", mCollapseButton->getHandle());
}
else
{
@ -432,6 +433,7 @@ void LLSideTray::createButtons ()
}
}
LLHints::registerHintTarget("inventory_btn", mTabButtons["sidebar_inventory"]->getHandle());
LLHints::registerHintTarget("dest_guide_btn", mTabButtons["sidebar_places"]->getHandle());
}
void LLSideTray::processTriState ()

View File

@ -47,6 +47,7 @@
#include "llpanelvolumepulldown.h"
#include "llfloaterregioninfo.h"
#include "llfloaterscriptdebug.h"
#include "llhints.h"
#include "llhudicon.h"
#include "llnavigationbar.h"
#include "llkeyboard.h"
@ -191,6 +192,8 @@ BOOL LLStatusBar::postBuild()
mMediaToggle->setClickedCallback( &LLStatusBar::onClickMediaToggle, this );
mMediaToggle->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterNearbyMedia, this));
LLHints::registerHintTarget("linden_balance", getChild<LLView>("balance_bg")->getHandle());
gSavedSettings.getControl("MuteAudio")->getSignal()->connect(boost::bind(&LLStatusBar::onVolumeChanged, this, _2));
// Adding Net Stat Graph

View File

@ -6389,12 +6389,33 @@ Mute everyone?
label="Hint for Chatting"
type="hint">
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
<!--<unique/>-->
</notification>
<notification
name="HintSit"
label="Hint for Sitting"
type="hint">
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
</notification>
<notification
name="HintDestinationGuide"
label="Hint for Destination Guide"
type="hint">
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
</notification>
<notification
name="HintSidePanel"
label="Hint for Side Panel"
type="hint">
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
<!--<unique/>-->
</notification>
<notification
name="HintMove"
label="Hint for Movement"
type="hint">
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
<!--<unique/>-->
@ -6405,7 +6426,13 @@ Mute everyone?
label="Hint for Inventory"
type="hint">
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
<!--<unique/>-->
</notification>
<notification
name="HintLindenDollar"
label="Hint for L$"
type="hint">
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
</notification>
<global name="UnsupportedCPU">