From bd897431e14aff091d5f45425816ddec4b2538c7 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 12 Aug 2010 12:20:38 -0700 Subject: remaining hints defined --- indra/newview/app_settings/ignorable_dialogs.xml | 48 +++++++++++- indra/newview/llbottomtray.cpp | 5 +- indra/newview/llfirstuse.cpp | 88 ++++++++++++++-------- indra/newview/llfirstuse.h | 16 +++- indra/newview/llhints.cpp | 40 ++++++---- indra/newview/llhints.h | 3 + indra/newview/llnotificationhinthandler.cpp | 10 ++- indra/newview/llsidepanelinventory.cpp | 3 + indra/newview/llsidetray.cpp | 2 + indra/newview/llstatusbar.cpp | 3 + .../newview/skins/default/xui/en/notifications.xml | 31 +++++++- 11 files changed, 189 insertions(+), 60 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/ignorable_dialogs.xml b/indra/newview/app_settings/ignorable_dialogs.xml index a0b9e33aa9..0720ccee49 100644 --- a/indra/newview/app_settings/ignorable_dialogs.xml +++ b/indra/newview/app_settings/ignorable_dialogs.xml @@ -4,7 +4,7 @@ FirstInventoryOffer Comment - Shows hint when a person or object offers you an inventory item + Shows hint when a person or object offers resident an inventory item Persist 1 Type @@ -12,7 +12,51 @@ Value 1 - FirstOtherChatBeforeUser + FirstNotUseDestinationGuide + + Comment + Shows hint when resident doesn't activate destination guide + Persist + 1 + Type + Boolean + Value + 1 + + FirstNotUseSidePanel + + Comment + Shows hint when resident doesn't activate side panel + Persist + 1 + Type + Boolean + Value + 1 + + FirstNotMoving + + Comment + Shows hint when resident doesn't move + Persist + 1 + Type + Boolean + Value + 1 + + FirstReceiveLindens + + Comment + Shows hint when resident receives linden dollars + Persist + 1 + Type + Boolean + Value + 1 + + FirstOtherChatBeforeUser Comment Shows hint when someone else chats first diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 7d4c0be3fa..e0b605a724 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -69,10 +69,6 @@ template class LLBottomTray* LLSingleton::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("toolbar_stack"); mMovementButton = getChild("movement_btn"); + LLHints::registerHintTarget("move_btn", mMovementButton->getHandle()); mCamButton = getChild("camera_btn"); setRightMouseDownCallback(boost::bind(&LLBottomTray::showBottomTrayContextMenu,this, _2, _3,_4)); diff --git a/indra/newview/llfirstuse.cpp b/indra/newview/llfirstuse.cpp index 8906525676..d2dff49904 100644 --- a/indra/newview/llfirstuse.cpp +++ b/indra/newview/llfirstuse.cpp @@ -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 LLFirstUse::sConfigVariables; +std::map 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); + firstUseNotification("FirstOtherChatBeforeUser", enable, "HintChat", LLSD(), LLSD().with("target", "nearby_chat_bar").with("direction", "top")); +} - LLNotificationsUtil::add("HintChat", LLSD(), LLSD().with("target", "nearby_chat_bar").with("direction", "top")); - } +// static +void LLFirstUse::sit(bool enable) +{ + firstUseNotification("FirstSit", enable, "HintSit", LLSD(), LLSD().with("target", "stand_btn").with("direction", "top")); } // static -void LLFirstUse::sit() +void LLFirstUse::inventoryOffer(bool enable) { - if (gWarningSettings.getBOOL("FirstSit")) - { - gWarningSettings.setBOOL("FirstSit", FALSE); + firstUseNotification("FirstInventoryOffer", enable, "HintInventory", LLSD(), LLSD().with("target", "inventory_btn").with("direction", "left")); +} - LLNotificationsUtil::add("HintSit", LLSD(), LLSD().with("target", "stand_btn").with("direction", "top")); - } +// static +void LLFirstUse::useSandbox() +{ + firstUseNotification("FirstSandbox", true, "FirstSandbox", LLSD().with("HOURS", SANDBOX_CLEAN_FREQ).with("TIME", SANDBOX_FIRST_CLEAN_HOUR)); } // static -void LLFirstUse::inventoryOffer() +void LLFirstUse::notUsingDestinationGuide(bool enable) { - if (gWarningSettings.getBOOL("FirstInventoryOffer")) - { - gWarningSettings.setBOOL("FirstInventoryOffer", FALSE); + firstUseNotification("FirstNotUseDestinationGuide", enable, "HintDestinationGuide", LLSD(), LLSD().with("target", "dest_guide_btn").with("direction", "left")); +} - LLNotificationsUtil::add("HintInventory", LLSD(), LLSD().with("target", "inventory_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::useSandbox() +void LLFirstUse::notMoving(bool enable) { - if (gWarningSettings.getBOOL("FirstSandbox")) - { - gWarningSettings.setBOOL("FirstSandbox", FALSE); + 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]; - LLSD args; - args["HOURS"] = llformat("%d",SANDBOX_CLEAN_FREQ); - args["TIME"] = llformat("%d",SANDBOX_FIRST_CLEAN_HOUR); - LLNotificationsUtil::add("FirstSandbox", args); + 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); + } } + } diff --git a/indra/newview/llfirstuse.h b/indra/newview/llfirstuse.h index ca7290fe17..abf7d9836e 100644 --- a/indra/newview/llfirstuse.h +++ b/indra/newview/llfirstuse.h @@ -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 sConfigVariables; + static std::map > sNotifications; }; #endif diff --git a/indra/newview/llhints.cpp b/indra/newview/llhints.cpp index a8c3183301..2f3504efed 100644 --- a/indra/newview/llhints.cpp +++ b/indra/newview/llhints.cpp @@ -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 > LLHints::sTargetRegistry; +std::map 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 target) { diff --git a/indra/newview/llhints.h b/indra/newview/llhints.h index b5255db95b..4ecdc9937c 100644 --- a/indra/newview/llhints.h +++ b/indra/newview/llhints.h @@ -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 target); static LLHandle getHintTarget(const std::string& name); private: static LLRegistry > sTargetRegistry; + typedef std::map hint_map_t; + static hint_map_t sHints; }; diff --git a/indra/newview/llnotificationhinthandler.cpp b/indra/newview/llnotificationhinthandler.cpp index f5c0330b2a..a9460821b0 100644 --- a/indra/newview/llnotificationhinthandler.cpp +++ b/indra/newview/llnotificationhinthandler.cpp @@ -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; } diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 0951586dd5..7eda4fad20 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -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() diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp index 066b694618..7e8dc2747b 100644 --- a/indra/newview/llsidetray.cpp +++ b/indra/newview/llsidetray.cpp @@ -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 () diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index a6bb4d4d5f..46d148c088 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -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("balance_bg")->getHandle()); + gSavedSettings.getControl("MuteAudio")->getSignal()->connect(boost::bind(&LLStatusBar::onVolumeChanged, this, _2)); // Adding Net Stat Graph diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index d7684e434e..8db89a7622 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -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 - + Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam + + + + Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam + + + + Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam + + + + Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam @@ -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 - + + + + Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam -- cgit v1.2.3