From e2deaf5a14a01020afe4240f33e438a0676ba0ec Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 11 May 2010 17:26:55 -0700 Subject: Clean up merge about name cache callback prototype --- indra/llui/llnotifications.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'indra/llui/llnotifications.h') diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index c942a32512..f818b386b5 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -1005,12 +1005,11 @@ public: gCacheName->get(id, is_group, boost::bind( &LLPostponedNotification::onCachedNameReceived, thiz, _1, _2, - _3, _4)); + _3)); } private: - void onCachedNameReceived(const LLUUID& id, const std::string& first, - const std::string& last, bool is_group); + void onCachedNameReceived(const LLUUID& id, const std::string& full_name, bool is_group); void cleanup() { -- cgit v1.2.3 From 934dc6e2d0fabb935c75bb611ceb543426e485eb Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 24 May 2010 16:59:05 -0700 Subject: DEV-50013 Inventory offer notifications use new name system Reviewed with Richard --- indra/llui/llnotifications.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'indra/llui/llnotifications.h') diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index f818b386b5..73357daaef 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -104,8 +104,8 @@ #include "llinitparam.h" #include "llnotificationslistener.h" #include "llnotificationptr.h" -#include "llcachename.h" +class LLAvatarName; typedef enum e_notification_priority { @@ -1000,16 +1000,20 @@ public: { // upcast T to the base type to restrict T derivation from LLPostponedNotification LLPostponedNotification* thiz = new T(); - thiz->mParams = params; - gCacheName->get(id, is_group, boost::bind( - &LLPostponedNotification::onCachedNameReceived, thiz, _1, _2, - _3)); + // Avoid header file dependency on llcachename.h + lookupName(thiz, id, is_group); } private: - void onCachedNameReceived(const LLUUID& id, const std::string& full_name, bool is_group); + static void lookupName(LLPostponedNotification* thiz, const LLUUID& id, bool is_group); + // only used for groups + void onGroupNameCache(const LLUUID& id, const std::string& full_name, bool is_group); + // only used for avatars + void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name); + // used for both group and avatar names + void finalizeName(const std::string& name); void cleanup() { -- cgit v1.2.3 From 94e406157d0b133d51b5dbb95aab296b46eae10e Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 16 Aug 2010 14:59:29 -0700 Subject: added ability to cancel all notifications with a given name --- indra/llui/llnotifications.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llui/llnotifications.h') diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 1cdd744a68..fcf988222d 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -900,6 +900,7 @@ public: void add(const LLNotificationPtr pNotif); void cancel(LLNotificationPtr pNotif); + void cancelByName(const std::string& name); void update(const LLNotificationPtr pNotif); LLNotificationPtr find(LLUUID uuid); -- cgit v1.2.3 From 1ad5663463721c4bca6ca8e91b9894226e999cca Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Tue, 14 Sep 2010 10:53:05 -0700 Subject: converted notifications.xml to paramblock parsing for easier reuse and extension --- indra/llui/llnotifications.h | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'indra/llui/llnotifications.h') diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 11adad8194..d20b65ee1b 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -110,6 +110,18 @@ typedef enum e_notification_priority NOTIFICATION_PRIORITY_CRITICAL } ENotificationPriority; +struct NotificationPriorityValues : public LLInitParam::TypeValuesHelper +{ + static void declareValues(); +}; + +namespace LLNotificationTemplateParams +{ + struct Notification; + struct Form; + struct Template; +}; + class LLNotificationResponderInterface { public: @@ -167,8 +179,7 @@ public: LLNotificationForm(); LLNotificationForm(const LLSD& sd); - LLNotificationForm(const std::string& name, - const LLPointer xml_node); + LLNotificationForm(const std::string& name, const LLNotificationTemplateParams::Form& p); LLSD asLLSD() const; @@ -193,11 +204,12 @@ private: typedef boost::shared_ptr LLNotificationFormPtr; + // This is the class of object read from the XML file (notifications.xml, // from the appropriate local language directory). struct LLNotificationTemplate { - LLNotificationTemplate(); + LLNotificationTemplate(const LLNotificationTemplateParams::Notification& p); // the name of the notification -- the key used to identify it // Ideally, the key should follow variable naming rules // (no spaces or punctuation). @@ -247,7 +259,7 @@ struct LLNotificationTemplate // messages when we allow clickable URLs in the UI U32 mURLOption; - U32 mURLOpenExternally; + std::string mURLTarget; //This is a flag that tells if the url needs to open externally dispite //what the user setting is. @@ -302,7 +314,7 @@ public: // optional Optional substitutions; Optional payload; - Optional priority; + Optional priority; Optional form_elements; Optional time_stamp; Optional context; @@ -519,7 +531,7 @@ public: S32 getURLOpenExternally() const { - return(mTemplatep? mTemplatep->mURLOpenExternally : -1); + return(mTemplatep? mTemplatep->mURLTarget == "_external": -1); } const LLNotificationFormPtr getForm(); @@ -872,7 +884,6 @@ public: // load notification descriptions from file; // OK to call more than once because it will reload bool loadTemplates(); - LLPointer checkForXMLTemplate(LLPointer item); // Add a simple notification (from XUI) void addFromCallback(const LLSD& name); @@ -918,8 +929,6 @@ public: // test for existence bool templateExists(const std::string& name); - // useful if you're reloading the file - void clearTemplates(); // erase all templates void forceResponse(const LLNotification::Params& params, S32 option); @@ -957,9 +966,6 @@ private: std::string mFileName; - typedef std::map > XMLTemplateMap; - XMLTemplateMap mXmlTemplates; - LLNotificationMap mUniqueNotifications; typedef std::map GlobalStringMap; -- cgit v1.2.3 From f87a49991a0a96c8cf11cbc9461711794aae3a72 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 16 Sep 2010 00:39:21 -0700 Subject: refactored notification template into own header file --- indra/llui/llnotifications.h | 205 ++++++++++++++++++++----------------------- 1 file changed, 94 insertions(+), 111 deletions(-) (limited to 'indra/llui/llnotifications.h') diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index d20b65ee1b..a58e7afe23 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -100,7 +100,6 @@ #include "llnotificationptr.h" #include "llcachename.h" - typedef enum e_notification_priority { NOTIFICATION_PRIORITY_UNSPECIFIED, @@ -115,13 +114,6 @@ struct NotificationPriorityValues : public LLInitParam::TypeValuesHelper + { + Mandatory name; + + FormElementBase() + : name("name") + {} + }; + + struct FormIgnore : public LLInitParam::Block + { + Optional text; + Optional save_option; + + FormIgnore() + : text("text"), + save_option("save_option", false) + {} + }; + + struct FormButton : public LLInitParam::Block + { + Mandatory index; + Mandatory text; + Optional ignore; + Optional is_default; + + Mandatory type; + + FormButton() + : index("index"), + text("text"), + ignore("ignore"), + is_default("default"), + type("type") + { + // set type here so it gets serialized + type = "button"; + } + }; + + struct FormInput : public LLInitParam::Block + { + Mandatory type; + Optional width; + + FormInput() + : type("type"), + width("width", 0) + {} + }; + + struct FormElement : public LLInitParam::Choice + { + Alternative button; + Alternative input; + + FormElement() + : button("button"), + input("input") + {} + }; + + struct FormElements : public LLInitParam::Block + { + Multiple elements; + FormElements() + : elements("") + {} + }; + + struct Params : public LLInitParam::Block + { + Optional name; + Optional ignore; + Optional form_elements; + + Params() + : name("name"), + ignore("ignore"), + form_elements("") + {} + }; + typedef enum e_ignore_type { IGNORE_NO, @@ -179,7 +255,7 @@ public: LLNotificationForm(); LLNotificationForm(const LLSD& sd); - LLNotificationForm(const std::string& name, const LLNotificationTemplateParams::Form& p); + LLNotificationForm(const std::string& name, const Params& p); LLSD asLLSD() const; @@ -205,80 +281,7 @@ private: typedef boost::shared_ptr LLNotificationFormPtr; -// This is the class of object read from the XML file (notifications.xml, -// from the appropriate local language directory). -struct LLNotificationTemplate -{ - LLNotificationTemplate(const LLNotificationTemplateParams::Notification& p); - // the name of the notification -- the key used to identify it - // Ideally, the key should follow variable naming rules - // (no spaces or punctuation). - std::string mName; - // The type of the notification - // used to control which queue it's stored in - std::string mType; - // The text used to display the notification. Replaceable parameters - // are enclosed in square brackets like this []. - std::string mMessage; - // The label for the notification; used for - // certain classes of notification (those with a window and a window title). - // Also used when a notification pops up underneath the current one. - // Replaceable parameters can be used in the label. - std::string mLabel; - // The name of the icon image. This should include an extension. - std::string mIcon; - // This is the Highlander bit -- "There Can Be Only One" - // An outstanding notification with this bit set - // is updated by an incoming notification with the same name, - // rather than creating a new entry in the queue. - // (used for things like progress indications, or repeating warnings - // like "the grid is going down in N minutes") - bool mUnique; - // if we want to be unique only if a certain part of the payload is constant - // specify the field names for the payload. The notification will only be - // combined if all of the fields named in the context are identical in the - // new and the old notification; otherwise, the notification will be - // duplicated. This is to support suppressing duplicate offers from the same - // sender but still differentiating different offers. Example: Invitation to - // conference chat. - std::vector mUniqueContext; - // If this notification expires automatically, this value will be - // nonzero, and indicates the number of seconds for which the notification - // will be valid (a teleport offer, for example, might be valid for - // 300 seconds). - U32 mExpireSeconds; - // if the offer expires, one of the options is chosen automatically - // based on its "value" parameter. This controls which one. - // If expireSeconds is specified, expireOption should also be specified. - U32 mExpireOption; - // if the notification contains a url, it's stored here (and replaced - // into the message where [_URL] is found) - std::string mURL; - // if there's a URL in the message, this controls which option visits - // that URL. Obsolete this and eliminate the buttons for affected - // messages when we allow clickable URLs in the UI - U32 mURLOption; - - std::string mURLTarget; - //This is a flag that tells if the url needs to open externally dispite - //what the user setting is. - - // does this notification persist across sessions? if so, it will be - // serialized to disk on first receipt and read on startup - bool mPersist; - // This is the name of the default functor, if present, to be - // used for the notification's callback. It is optional, and used only if - // the notification is constructed without an identified functor. - std::string mDefaultFunctor; - // The form data associated with a given notification (buttons, text boxes, etc) - LLNotificationFormPtr mForm; - // default priority for notifications of this type - ENotificationPriority mPriority; - // UUID of the audio file to be played when this notification arrives - // this is loaded as a name, but looked up to get the UUID upon template load. - // If null, it wasn't specified. - LLUUID mSoundEffect; -}; +struct LLNotificationTemplate; // we want to keep a map of these by name, and it's best to manage them // with smart pointers @@ -481,15 +484,11 @@ public: return mIgnored; } - const std::string& getName() const - { - return mTemplatep->mName; - } + const std::string& getName() const; - bool isPersistent() const - { - return mTemplatep->mPersist; - } + const std::string& getIcon() const; + + bool isPersistent() const; const LLUUID& id() const { @@ -511,28 +510,12 @@ public: return mTimestamp; } - std::string getType() const - { - return (mTemplatep ? mTemplatep->mType : ""); - } - + std::string getType() const; std::string getMessage() const; std::string getLabel() const; - std::string getURL() const; -// { -// return (mTemplatep ? mTemplatep->mURL : ""); -// } - - S32 getURLOption() const - { - return (mTemplatep ? mTemplatep->mURLOption : -1); - } - - S32 getURLOpenExternally() const - { - return(mTemplatep? mTemplatep->mURLTarget == "_external": -1); - } + S32 getURLOption() const; + S32 getURLOpenExternally() const; const LLNotificationFormPtr getForm(); @@ -602,7 +585,7 @@ public: std::string summarize() const; - bool hasUniquenessConstraints() const { return (mTemplatep ? mTemplatep->mUnique : false);} + bool hasUniquenessConstraints() const; virtual ~LLNotification() {} }; -- cgit v1.2.3 From b24071ca8936035ff42cb361e42cac63593f695e Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 16 Sep 2010 16:28:57 -0700 Subject: added ability to have notification ignore variable point to settings.xml variables --- indra/llui/llnotifications.h | 55 +++++++++++++++----------------------------- 1 file changed, 18 insertions(+), 37 deletions(-) (limited to 'indra/llui/llnotifications.h') diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index a58e7afe23..ed29e0d83e 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -163,22 +163,19 @@ class LLNotificationForm public: struct FormElementBase : public LLInitParam::Block { - Mandatory name; + Optional name; - FormElementBase() - : name("name") - {} + FormElementBase(); }; struct FormIgnore : public LLInitParam::Block { Optional text; Optional save_option; + Optional control; + Optional invert_control; - FormIgnore() - : text("text"), - save_option("save_option", false) - {} + FormIgnore(); }; struct FormButton : public LLInitParam::Block @@ -190,16 +187,7 @@ public: Mandatory type; - FormButton() - : index("index"), - text("text"), - ignore("ignore"), - is_default("default"), - type("type") - { - // set type here so it gets serialized - type = "button"; - } + FormButton(); }; struct FormInput : public LLInitParam::Block @@ -207,10 +195,7 @@ public: Mandatory type; Optional width; - FormInput() - : type("type"), - width("width", 0) - {} + FormInput(); }; struct FormElement : public LLInitParam::Choice @@ -218,18 +203,13 @@ public: Alternative button; Alternative input; - FormElement() - : button("button"), - input("input") - {} + FormElement(); }; struct FormElements : public LLInitParam::Block { Multiple elements; - FormElements() - : elements("") - {} + FormElements(); }; struct Params : public LLInitParam::Block @@ -238,11 +218,7 @@ public: Optional ignore; Optional form_elements; - Params() - : name("name"), - ignore("ignore"), - form_elements("") - {} + Params(); }; typedef enum e_ignore_type @@ -268,14 +244,19 @@ public: // appends form elements from another form serialized as LLSD void append(const LLSD& sub_form); std::string getDefaultOption(); + LLPointer getIgnoreSetting(); + bool getIgnored(); + void setIgnored(bool ignored); EIgnoreType getIgnoreType() { return mIgnore; } std::string getIgnoreMessage() { return mIgnoreMsg; } private: - LLSD mFormData; - EIgnoreType mIgnore; - std::string mIgnoreMsg; + LLSD mFormData; + EIgnoreType mIgnore; + std::string mIgnoreMsg; + LLPointer mIgnoreSetting; + bool mInvertSetting; }; typedef boost::shared_ptr LLNotificationFormPtr; -- cgit v1.2.3 From 159fd0316adccbf51faa2f6293952d615b3f2a14 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 17 Sep 2010 14:56:03 -0700 Subject: fix for enable all popups not working also popup notification is no longer a singleton --- indra/llui/llnotifications.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/llui/llnotifications.h') diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index ed29e0d83e..dcb7b48f92 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -458,6 +458,13 @@ public: return mRespondedTo; } + bool isActive() const + { + return !isRespondedTo() + && !isCancelled() + && !isExpired(); + } + const LLSD& getResponse() { return mResponse; } bool isIgnored() const -- cgit v1.2.3 From a748466377982f376d4901e3450e6b927cf96a4d Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 20 Sep 2010 19:16:17 -0700 Subject: EXP-82 FIX MOTD open in external browser notification not given until fully logged in reviewed by Monroe --- indra/llui/llnotifications.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llui/llnotifications.h') diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index dcb7b48f92..4fe1687f0e 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -441,6 +441,7 @@ public: LLSD asLLSD(); void respond(const LLSD& sd); + void respondWithDefault(); void* getResponder() { return mResponderObj; } -- cgit v1.2.3 From d3a9d6a6cef6630995c652b4cc04c8807dbe6d4e Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Fri, 24 Sep 2010 15:44:26 +0100 Subject: trivial indentation changes while I'm poking around here. (transplanted from 01d8534678f5613c924a036128addf6b7447c92a) --- indra/llui/llnotifications.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui/llnotifications.h') diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 4fe1687f0e..f075c44520 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -504,7 +504,7 @@ public: std::string getLabel() const; std::string getURL() const; S32 getURLOption() const; - S32 getURLOpenExternally() const; + S32 getURLOpenExternally() const; const LLNotificationFormPtr getForm(); -- cgit v1.2.3 From 97f11e0e39a10156597c0f82c8a1bead17621b4c Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Wed, 29 Sep 2010 10:56:47 -0700 Subject: added max_length_chars to notification params --- indra/llui/llnotifications.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llui/llnotifications.h') diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index f84d9e3921..e52875665e 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -194,6 +194,7 @@ public: { Mandatory type; Optional width; + Optional max_length_chars; FormInput(); }; -- cgit v1.2.3 From 7ffc9b06c820d70724af2aef361ff9964e584e73 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Fri, 8 Oct 2010 16:56:02 -0700 Subject: Created a floater for setting display name --- indra/llui/llnotifications.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llui/llnotifications.h') diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index e52875665e..3ae3f158e4 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -196,6 +196,7 @@ public: Optional width; Optional max_length_chars; + Optional value; FormInput(); }; -- cgit v1.2.3