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/llfirstuse.cpp | 88 +++++++++++++++++++++++++++----------------- 1 file changed, 55 insertions(+), 33 deletions(-) (limited to 'indra/newview/llfirstuse.cpp') 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); + } } + } -- cgit v1.2.3