diff options
Diffstat (limited to 'indra/newview/llfirstuse.cpp')
-rwxr-xr-x[-rw-r--r--] | indra/newview/llfirstuse.cpp | 250 |
1 files changed, 90 insertions, 160 deletions
diff --git a/indra/newview/llfirstuse.cpp b/indra/newview/llfirstuse.cpp index de079b7123..2e1afc68b4 100644..100755 --- a/indra/newview/llfirstuse.cpp +++ b/indra/newview/llfirstuse.cpp @@ -2,31 +2,25 @@ * @file llfirstuse.cpp * @brief Methods that spawn "first-use" dialogs * - * $LicenseInfo:firstyear=2003&license=viewergpl$ - * - * Copyright (c) 2003-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2003&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -36,15 +30,16 @@ // library includes #include "indra_constants.h" +#include "llnotifications.h" // viewer includes #include "llagent.h" // for gAgent.inPrelude() -#include "llnotify.h" #include "llviewercontrol.h" #include "llui.h" #include "llappviewer.h" #include "lltracker.h" + // static std::set<std::string> LLFirstUse::sConfigVariables; @@ -76,202 +71,137 @@ void LLFirstUse::resetFirstUse() } } - -// Called whenever the viewer detects that your balance went up -void LLFirstUse::useBalanceIncrease(S32 delta) +// static +void LLFirstUse::otherAvatarChatFirst(bool enable) { - if (gWarningSettings.getBOOL("FirstBalanceIncrease")) - { - gWarningSettings.setBOOL("FirstBalanceIncrease", FALSE); - - LLSD args; - args["AMOUNT"] = llformat("%d",delta); - LLNotifications::instance().add("FirstBalanceIncrease", args); - } + firstUseNotification("FirstOtherChatBeforeUser", enable, "HintChat", LLSD(), LLSD().with("target", "nearby_chat").with("direction", "top_right").with("distance", 24)); } - -// Called whenever the viewer detects your balance went down -void LLFirstUse::useBalanceDecrease(S32 delta) +// static +void LLFirstUse::speak(bool enable) { - if (gWarningSettings.getBOOL("FirstBalanceDecrease")) - { - gWarningSettings.setBOOL("FirstBalanceDecrease", FALSE); - - LLSD args; - args["AMOUNT"] = llformat("%d",-delta); - LLNotifications::instance().add("FirstBalanceDecrease", args); - } + firstUseNotification("FirstSpeak", enable, "HintSpeak", LLSD(), LLSD().with("target", "speak_btn").with("direction", "top")); } - // static -void LLFirstUse::useSit() +void LLFirstUse::sit(bool enable) { - // Our orientation island uses sitting to teach vehicle driving - // so just never show this message. JC - //if (gWarningSettings.getBOOL("FirstSit")) - //{ - // gWarningSettings.setBOOL("FirstSit", FALSE); - // - // LLNotifications::instance().add("FirstSit"); - //} + firstUseNotification("FirstSit", enable, "HintSit", LLSD(), LLSD().with("target", "stand_btn").with("direction", "top")); } // static -void LLFirstUse::useMap() +void LLFirstUse::newInventory(bool enable) { - if (gWarningSettings.getBOOL("FirstMap")) - { - gWarningSettings.setBOOL("FirstMap", FALSE); - - LLNotifications::instance().add("FirstMap"); - } + // turning this off until bug EXP-62 can be fixed (inventory hint appears for new users when their initial inventory is acquired) + // firstUseNotification("FirstInventoryOffer", enable, "HintInventory", LLSD(), LLSD().with("target", "inventory_btn").with("direction", "left")); } +// first clean starts at 3 AM +const S32 SANDBOX_FIRST_CLEAN_HOUR = 3; +// clean every <n> hours +const S32 SANDBOX_CLEAN_FREQ = 12; + // static -void LLFirstUse::useGoTo() +void LLFirstUse::useSandbox() { - // nothing for now JC + firstUseNotification("FirstSandbox", true, "FirstSandbox", LLSD().with("HOURS", SANDBOX_CLEAN_FREQ).with("TIME", SANDBOX_FIRST_CLEAN_HOUR)); } // static -void LLFirstUse::useBuild() +void LLFirstUse::notUsingDestinationGuide(bool enable) { - if (gWarningSettings.getBOOL("FirstBuild")) - { - gWarningSettings.setBOOL("FirstBuild", FALSE); - - LLNotifications::instance().add("FirstBuild"); - } + // not doing this yet + firstUseNotification("FirstNotUseDestinationGuide", enable, "HintDestinationGuide", LLSD(), LLSD().with("target", "dest_guide_btn").with("direction", "top")); } -/* -// static -void LLFirstUse::useLeftClickNoHit() -{ - if (gWarningSettings.getBOOL("FirstLeftClickNoHit")) - { - gWarningSettings.setBOOL("FirstLeftClickNoHit", FALSE); - LLNotifications::instance().add("FirstLeftClickNoHit"); - } -} -*/ // static -void LLFirstUse::useTeleport() +void LLFirstUse::notUsingSidePanel(bool enable) { - if (gWarningSettings.getBOOL("FirstTeleport")) - { - LLVector3d teleportDestination = LLTracker::getTrackedPositionGlobal(); - if(teleportDestination != LLVector3d::zero) - { - gWarningSettings.setBOOL("FirstTeleport", FALSE); - - LLNotifications::instance().add("FirstTeleport"); - } - } + // not doing this yet + //firstUseNotification("FirstNotUseSidePanel", enable, "HintSidePanel", LLSD(), LLSD().with("target", "side_panel_btn").with("direction", "left")); } // static -void LLFirstUse::useOverrideKeys() +void LLFirstUse::notMoving(bool enable) { - // Our orientation island uses key overrides to teach vehicle driving - // so don't show this message until you get off OI. JC - if (!gAgent.inPrelude()) - { - if (gWarningSettings.getBOOL("FirstOverrideKeys")) - { - gWarningSettings.setBOOL("FirstOverrideKeys", FALSE); - - LLNotifications::instance().add("FirstOverrideKeys"); - } - } + // fire off 2 notifications and rely on filtering to select the relevant one + firstUseNotification("FirstNotMoving", enable, "HintMove", LLSD(), LLSD().with("target", "move_btn").with("direction", "top")); + firstUseNotification("FirstNotMoving", enable, "HintMoveClick", LLSD(), LLSD() + .with("target", "nav_bar") + .with("direction", "bottom") + .with("hint_image", "click_to_move.png") + .with("up_arrow", "")); } // static -void LLFirstUse::useAttach() +void LLFirstUse::viewPopup(bool enable) { - // nothing for now +// firstUseNotification("FirstViewPopup", enable, "HintView", LLSD(), LLSD().with("target", "view_popup").with("direction", "right")); } // static -void LLFirstUse::useAppearance() +void LLFirstUse::setDisplayName(bool enable) { - if (gWarningSettings.getBOOL("FirstAppearance")) - { - gWarningSettings.setBOOL("FirstAppearance", FALSE); - - LLNotifications::instance().add("FirstAppearance"); - } + firstUseNotification("FirstDisplayName", enable, "HintDisplayName", LLSD(), LLSD().with("target", "set_display_name").with("direction", "left")); } // static -void LLFirstUse::useInventory() +void LLFirstUse::receiveLindens(bool enable) { - if (gWarningSettings.getBOOL("FirstInventory")) - { - gWarningSettings.setBOOL("FirstInventory", FALSE); - - LLNotifications::instance().add("FirstInventory"); - } + firstUseNotification("FirstReceiveLindens", enable, "HintLindenDollar", LLSD(), LLSD().with("target", "linden_balance").with("direction", "bottom")); } -// static -void LLFirstUse::useSandbox() +//static +void LLFirstUse::firstUseNotification(const std::string& control_var, bool enable, const std::string& notification_name, LLSD args, LLSD payload) { - 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); - LLNotifications::instance().add("FirstSandbox", args); - } -} + init(); -// static -void LLFirstUse::useFlexible() -{ - if (gWarningSettings.getBOOL("FirstFlexible")) + if (enable) { - gWarningSettings.setBOOL("FirstFlexible", FALSE); - - LLNotifications::instance().add("FirstFlexible"); - } -} + if (gSavedSettings.getBOOL("EnableUIHints")) + { + LL_DEBUGS("LLFirstUse") << "Trigger first use notification " << notification_name << LL_ENDL; -// static -void LLFirstUse::useDebugMenus() -{ - if (gWarningSettings.getBOOL("FirstDebugMenus")) + // if notification doesn't already exist and this notification hasn't been disabled... + if (gWarningSettings.getBOOL(control_var)) + { // create new notification + LLNotifications::instance().add(LLNotification::Params().name(notification_name).substitutions(args).payload(payload.with("control_var", control_var))); + } + } + } + else { - gWarningSettings.setBOOL("FirstDebugMenus", FALSE); - - LLNotifications::instance().add("FirstDebugMenus"); + LL_DEBUGS("LLFirstUse") << "Disabling first use notification " << notification_name << LL_ENDL; + LLNotifications::instance().cancelByName(notification_name); + // redundantly clear settings var here, in case there are no notifications to cancel + gWarningSettings.setBOOL(control_var, FALSE); } + } // static -void LLFirstUse::useSculptedPrim() +void LLFirstUse::init() { - if (gWarningSettings.getBOOL("FirstSculptedPrim")) + static bool initialized = false; + if (!initialized) { - gWarningSettings.setBOOL("FirstSculptedPrim", FALSE); - - LLNotifications::instance().add("FirstSculptedPrim"); - + LLNotifications::instance().getChannel("Hints")->connectChanged(&processNotification); } + initialized = true; } -// static -void LLFirstUse::useMedia() +//static +bool LLFirstUse::processNotification(const LLSD& notify) { - if (gWarningSettings.getBOOL("FirstMedia")) + if (notify["sigtype"].asString() == "delete") { - gWarningSettings.setBOOL("FirstMedia", FALSE); - - LLNotifications::instance().add("FirstMedia"); + LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID()); + if (notification) + { + // disable any future notifications + gWarningSettings.setBOOL(notification->getPayload()["control_var"], FALSE); + } } + return false; } |