From f149b87fcc152a7e6232d1a2eb81bb2ac72697da Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 29 Jun 2023 23:53:22 +0300 Subject: SL-19929 New inventory feature notification --- indra/newview/llagent.cpp | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'indra/newview/llagent.cpp') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 8cc9be7244..2430ca5f83 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -120,6 +120,8 @@ const F64 CHAT_AGE_FAST_RATE = 3.0; const F32 MIN_FIDGET_TIME = 8.f; // seconds const F32 MAX_FIDGET_TIME = 20.f; // seconds +const S32 UI_FEATURE_VERSION = 1; + // The agent instance. LLAgent gAgent; @@ -372,7 +374,7 @@ LLAgent::LLAgent() : mHideGroupTitle(FALSE), mGroupID(), - mInitialized(FALSE), + mInitialized(false), mListener(), mDoubleTapRunTimer(), @@ -447,7 +449,7 @@ LLAgent::LLAgent() : mNextFidgetTime(0.f), mCurrentFidget(0), - mFirstLogin(FALSE), + mFirstLogin(false), mOutfitChosen(FALSE), mVoiceConnected(false), @@ -504,7 +506,7 @@ void LLAgent::init() mHttpPolicy = app_core_http.getPolicy(LLAppCoreHttp::AP_AGENT); - mInitialized = TRUE; + mInitialized = true; } //----------------------------------------------------------------------------- @@ -559,6 +561,31 @@ void LLAgent::onAppFocusGained() } } +void LLAgent::setFirstLogin(bool b) +{ + mFirstLogin = b; + + if (mFirstLogin) + { + // Don't notify new users about new features + S32 feature_version = gSavedSettings.getS32("LastUIFeatureVersion"); + if (feature_version < UI_FEATURE_VERSION) + { + gSavedSettings.setS32("LastUIFeatureVersion", UI_FEATURE_VERSION); + } + } +} + +void LLAgent::showLatestFeatureNotification() +{ + // Notify user about new thumbnail support + S32 feature_version = gSavedSettings.getS32("LastUIFeatureVersion"); + if (feature_version < UI_FEATURE_VERSION) + { + LLFloaterReg::showInstance("new_feature_notification"); + gSavedSettings.setS32("LastUIFeatureVersion", UI_FEATURE_VERSION); + } +} void LLAgent::ageChat() { -- cgit v1.3 From d3233e787aaf1ba0558a714d5216ea70c7249c36 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 3 Jul 2023 23:29:01 +0300 Subject: SL-19929 New inventory feature notification should appear on top --- indra/newview/llagent.cpp | 7 ++++++- indra/newview/llfloaternewfeaturenotification.cpp | 21 +++++++++++++-------- indra/newview/llfloaternewfeaturenotification.h | 12 ++++++------ 3 files changed, 25 insertions(+), 15 deletions(-) (limited to 'indra/newview/llagent.cpp') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 2430ca5f83..8574134032 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -582,7 +582,12 @@ void LLAgent::showLatestFeatureNotification() S32 feature_version = gSavedSettings.getS32("LastUIFeatureVersion"); if (feature_version < UI_FEATURE_VERSION) { - LLFloaterReg::showInstance("new_feature_notification"); + // Need to open on top even if called from onOpen, + // do on idle to make sure it's on top + doOnIdleOneTime([]() + { + LLFloaterReg::showInstance("new_feature_notification"); + }); gSavedSettings.setS32("LastUIFeatureVersion", UI_FEATURE_VERSION); } } diff --git a/indra/newview/llfloaternewfeaturenotification.cpp b/indra/newview/llfloaternewfeaturenotification.cpp index e04b1a5da5..7c3fe8cdc8 100644 --- a/indra/newview/llfloaternewfeaturenotification.cpp +++ b/indra/newview/llfloaternewfeaturenotification.cpp @@ -30,7 +30,7 @@ LLFloaterNewFeatureNotification::LLFloaterNewFeatureNotification(const LLSD& key) - : LLFloater(key) + : LLFloater(key) { } @@ -40,24 +40,29 @@ LLFloaterNewFeatureNotification::~LLFloaterNewFeatureNotification() BOOL LLFloaterNewFeatureNotification::postBuild() { - setCanDrag(FALSE); - getChild("close_btn")->setCommitCallback(boost::bind(&LLFloaterNewFeatureNotification::onCloseBtn, this)); - return TRUE; + setCanDrag(FALSE); + getChild("close_btn")->setCommitCallback(boost::bind(&LLFloaterNewFeatureNotification::onCloseBtn, this)); + return TRUE; } void LLFloaterNewFeatureNotification::onOpen(const LLSD& key) { - centerOnScreen(); + centerOnScreen(); } void LLFloaterNewFeatureNotification::onCloseBtn() { - closeFloater(); + closeFloater(); } void LLFloaterNewFeatureNotification::centerOnScreen() { - LLVector2 window_size = LLUI::getInstance()->getWindowSize(); - centerWithin(LLRect(0, 0, ll_round(window_size.mV[VX]), ll_round(window_size.mV[VY]))); + LLVector2 window_size = LLUI::getInstance()->getWindowSize(); + centerWithin(LLRect(0, 0, ll_round(window_size.mV[VX]), ll_round(window_size.mV[VY]))); + LLFloaterView* parent = dynamic_cast(getParent()); + if (parent) + { + parent->bringToFront(this); + } } diff --git a/indra/newview/llfloaternewfeaturenotification.h b/indra/newview/llfloaternewfeaturenotification.h index 86e9683def..95501451dc 100644 --- a/indra/newview/llfloaternewfeaturenotification.h +++ b/indra/newview/llfloaternewfeaturenotification.h @@ -30,20 +30,20 @@ #include "llfloater.h" class LLFloaterNewFeatureNotification: - public LLFloater + public LLFloater { - friend class LLFloaterReg; + friend class LLFloaterReg; public: - BOOL postBuild() override; - void onOpen(const LLSD& key) override; + BOOL postBuild() override; + void onOpen(const LLSD& key) override; private: LLFloaterNewFeatureNotification(const LLSD& key); /*virtual*/ ~LLFloaterNewFeatureNotification(); - void centerOnScreen(); + void centerOnScreen(); - void onCloseBtn(); + void onCloseBtn(); }; #endif -- cgit v1.3 From d32e685d96e19be3711e09ab626203d248d3594b Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 18 Aug 2023 18:51:42 +0300 Subject: SL-19929 Small rework of a 'feature' notification To make multiple parallel features possible --- indra/newview/app_settings/settings.xml | 4 +- indra/newview/llagent.cpp | 80 ++++++++++++++++++---- indra/newview/llagent.h | 5 +- indra/newview/llfloaternewfeaturenotification.cpp | 8 +++ indra/newview/llsidepanelinventory.cpp | 2 +- .../xui/en/floater_new_feature_notification.xml | 12 +++- 6 files changed, 90 insertions(+), 21 deletions(-) (limited to 'indra/newview/llagent.cpp') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index b812219685..edb0c6b4d1 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -5504,9 +5504,9 @@ Persist 1 Type - S32 + LLSD Value - 0 + LastFindPanel diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 8574134032..8cda46d390 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -121,6 +121,8 @@ const F32 MIN_FIDGET_TIME = 8.f; // seconds const F32 MAX_FIDGET_TIME = 20.f; // seconds const S32 UI_FEATURE_VERSION = 1; +// for version 1: 1 - inventory, 2 - gltf +const S32 UI_FEATURE_FLAGS = 1; // The agent instance. LLAgent gAgent; @@ -568,27 +570,77 @@ void LLAgent::setFirstLogin(bool b) if (mFirstLogin) { // Don't notify new users about new features - S32 feature_version = gSavedSettings.getS32("LastUIFeatureVersion"); - if (feature_version < UI_FEATURE_VERSION) + if (getFeatureVersion() <= UI_FEATURE_VERSION) { - gSavedSettings.setS32("LastUIFeatureVersion", UI_FEATURE_VERSION); + setFeatureVersion(UI_FEATURE_VERSION, UI_FEATURE_FLAGS); } } } -void LLAgent::showLatestFeatureNotification() +void LLAgent::setFeatureVersion(S32 version, S32 flags) { - // Notify user about new thumbnail support - S32 feature_version = gSavedSettings.getS32("LastUIFeatureVersion"); - if (feature_version < UI_FEATURE_VERSION) + LLSD updated_version; + updated_version["version"] = version; + updated_version["flags"] = flags; + gSavedSettings.setLLSD("LastUIFeatureVersion", updated_version); +} + +S32 LLAgent::getFeatureVersion() +{ + S32 version; + S32 flags; + getFeatureVersionAndFlags(version, flags); + return version; +} + +void LLAgent::getFeatureVersionAndFlags(S32& version, S32& flags) +{ + version = 0; + flags = 0; + LLSD feature_version = gSavedSettings.getLLSD("LastUIFeatureVersion"); + if (feature_version.isInteger()) + { + version = feature_version.asInteger(); + flags = UI_FEATURE_FLAGS; + } + else if (feature_version.isMap()) + { + version = feature_version["version"]; + flags = feature_version["flags"]; + } + else if (!feature_version.isString() && !feature_version.isUndefined()) { - // Need to open on top even if called from onOpen, - // do on idle to make sure it's on top - doOnIdleOneTime([]() - { - LLFloaterReg::showInstance("new_feature_notification"); - }); - gSavedSettings.setS32("LastUIFeatureVersion", UI_FEATURE_VERSION); + // is something newer inside? + version = UI_FEATURE_VERSION; + flags = UI_FEATURE_FLAGS; + } +} + +void LLAgent::showLatestFeatureNotification(const std::string key) +{ + S32 version; + S32 flags; // a single release can have multiple new features + getFeatureVersionAndFlags(version, flags); + if (version <= UI_FEATURE_VERSION && (flags & UI_FEATURE_FLAGS) != UI_FEATURE_FLAGS) + { + if (key == "inventory") + { + S32 flag = 1; + + // Notify user about new thumbnail support + if ((flags & flag) == 0) + { + // Need to open on top even if called from onOpen, + // do on idle to make sure it's on top + LLSD floater_key(key); + doOnIdleOneTime([floater_key]() + { + LLFloaterReg::showInstance("new_feature_notification", floater_key); + }); + + setFeatureVersion(UI_FEATURE_VERSION, flags | flag); + } + } } } diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index fb9ac402e1..0ce6fda131 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -122,7 +122,10 @@ public: bool isFirstLogin() const { return mFirstLogin; } bool isInitialized() const { return mInitialized; } - void showLatestFeatureNotification(); + void setFeatureVersion(S32 version, S32 flags); + S32 getFeatureVersion(); + void getFeatureVersionAndFlags(S32 &version, S32 &flags); + void showLatestFeatureNotification(const std::string key); public: std::string mMOTD; // Message of the day private: diff --git a/indra/newview/llfloaternewfeaturenotification.cpp b/indra/newview/llfloaternewfeaturenotification.cpp index 7c3fe8cdc8..3a2035b9b9 100644 --- a/indra/newview/llfloaternewfeaturenotification.cpp +++ b/indra/newview/llfloaternewfeaturenotification.cpp @@ -42,6 +42,14 @@ BOOL LLFloaterNewFeatureNotification::postBuild() { setCanDrag(FALSE); getChild("close_btn")->setCommitCallback(boost::bind(&LLFloaterNewFeatureNotification::onCloseBtn, this)); + + const std::string title_txt = "title_txt"; + const std::string dsc_txt = "description_txt"; + std::string feature = "_" + getKey().asString(); + + getChild(title_txt)->setValue(getString(title_txt + feature)); + getChild(dsc_txt)->setValue(getString(dsc_txt + feature)); + return TRUE; } diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index dde260eb7f..e970f70e92 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -401,7 +401,7 @@ void LLSidepanelInventory::onOpen(const LLSD& key) } #endif - gAgent.showLatestFeatureNotification(); + gAgent.showLatestFeatureNotification("inventory"); } void LLSidepanelInventory::performActionOnSelection(const std::string &action) diff --git a/indra/newview/skins/default/xui/en/floater_new_feature_notification.xml b/indra/newview/skins/default/xui/en/floater_new_feature_notification.xml index 370a08f16a..5f0eeab71c 100644 --- a/indra/newview/skins/default/xui/en/floater_new_feature_notification.xml +++ b/indra/newview/skins/default/xui/en/floater_new_feature_notification.xml @@ -13,6 +13,13 @@ can_drag_on_left="false" can_minimize="false" can_close="false"> + +New inventory features + + +You can now add preview images to inventory items and view a folder in its own window. +Learn more in this [https://community.secondlife.com/blogs/entry/13637-new-features-inventory-item-preview-and-single-folder-view/ blogpost] + -New inventory features +New feature -You can now add preview images to inventory items and view a folder in its own window. -Learn more in this [https://community.secondlife.com/blogs/entry/13637-new-features-inventory-item-preview-and-single-folder-view/ blogpost] +Feature description