diff options
Diffstat (limited to 'indra/newview/llpanelavatar.h')
-rw-r--r-- | indra/newview/llpanelavatar.h | 341 |
1 files changed, 78 insertions, 263 deletions
diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h index 12e1b99360..f72eb1990d 100644 --- a/indra/newview/llpanelavatar.h +++ b/indra/newview/llpanelavatar.h @@ -38,8 +38,11 @@ #include "lluuid.h" #include "llwebbrowserctrl.h" +#include "llavatarpropertiesprocessor.h" + class LLButton; class LLCheckBoxCtrl; +class LLComboBox; class LLDropTarget; class LLInventoryItem; class LLLineEditor; @@ -56,6 +59,12 @@ class LLViewerObject; class LLMessageSystem; class LLIconCtrl; class LLWebBrowserCtrl; +class LLVector3d; +class LLFloaterReg; + +class LLPanelMeProfile; +class LLPanelPick; +class LLAgent; enum EOnlineStatus { @@ -63,321 +72,127 @@ enum EOnlineStatus ONLINE_STATUS_YES = 1 }; -// Base class for all sub-tabs inside the avatar profile. Many of these -// panels need to keep track of the parent panel (to get the avatar id) -// and only request data from the database when they are first drawn. JC -class LLPanelAvatarTab : public LLPanel -{ -public: - LLPanelAvatarTab(const std::string& name, const LLRect &rect, - LLPanelAvatar* panel_avatar); - - // Calls refresh() once per frame when panel is visible - /*virtual*/ void draw(); - - LLPanelAvatar* getPanelAvatar() const { return mPanelAvatar; } - - void setDataRequested(bool requested) { mDataRequested = requested; } - bool isDataRequested() const { return mDataRequested; } - - // If the data for this tab has not yet been requested, - // send the request. Used by tabs that are filled in only - // when they are first displayed. - // type is one of "avatarnotesrequest", "avatarpicksrequest", - // or "avatarclassifiedsrequest" - void sendAvatarProfileRequestIfNeeded(const std::string& method); - -private: - LLPanelAvatar* mPanelAvatar; - bool mDataRequested; -}; - -class LLPanelAvatarFirstLife : public LLPanelAvatarTab +class LLPanelProfileTab + : public LLPanel + , public LLAvatarPropertiesObserver { public: - LLPanelAvatarFirstLife(const std::string& name, const LLRect &rect, LLPanelAvatar* panel_avatar); - - /*virtual*/ BOOL postBuild(void); + + LLPanelProfileTab(const LLUUID& avatar_id); + LLPanelProfileTab(const Params& params ); - void enableControls(BOOL own_avatar); -}; + void setAvatarId(const LLUUID& avatar_id); + const LLUUID& getAvatarId(){return mAvatarId;} -class LLPanelAvatarSecondLife -: public LLPanelAvatarTab -{ -public: - LLPanelAvatarSecondLife(const std::string& name, const LLRect &rect, LLPanelAvatar* panel_avatar ); - - /*virtual*/ BOOL postBuild(void); - /*virtual*/ void refresh(); - - static void onClickImage( void *userdata); - static void onClickFriends( void *userdata); - static void onDoubleClickGroup(void* userdata); - static void onClickPublishHelp(void *userdata); - static void onClickPartnerHelp(void *userdata); - static bool onClickPartnerHelpLoadURL(const LLSD& notification, const LLSD& response); - static void onClickPartnerInfo(void *userdata); - - // Clear out the controls anticipating new network data. - void clearControls(); - void enableControls(BOOL own_avatar); - void updateOnlineText(BOOL online, BOOL have_calling_card); - void updatePartnerName(); - - void setPartnerID(LLUUID id) { mPartnerID = id; } + virtual void updateData() = 0; -private: - LLUUID mPartnerID; -}; + virtual void onActivate(const LLUUID& id); + typedef enum e_profile_type + { + PT_UNKNOWN, + PT_OWN, + PT_OTHER + } EProfileType; -// WARNING! The order of the inheritance here matters!! Do not change. - KLW -class LLPanelAvatarWeb : - public LLPanelAvatarTab - , public LLWebBrowserCtrlObserver -{ -public: - LLPanelAvatarWeb(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar); - /*virtual*/ ~LLPanelAvatarWeb(); - /*virtual*/ BOOL postBuild(void); - - /*virtual*/ void refresh(); + virtual void onAddFriend(); - void enableControls(BOOL own_avatar); + virtual void onIM(); - void setWebURL(std::string url); + virtual void onTeleport(); - void load(std::string url); - static void onURLKeystroke(LLLineEditor* editor, void* data); - static void onCommitLoad(LLUICtrl* ctrl, void* data); - static void onCommitURL(LLUICtrl* ctrl, void* data); - static void onClickWebProfileHelp(void *); + virtual void clear(){}; - // browser observer impls - virtual void onStatusTextChange( const EventType& eventIn ); - virtual void onLocationChange( const EventType& eventIn ); +protected: + virtual ~LLPanelProfileTab(); + void setProfileType(); -private: - std::string mHome; - std::string mNavigateTo; - LLWebBrowserCtrl* mWebBrowser; +protected: + e_profile_type mProfileType; + LLUUID mAvatarId; }; - -class LLPanelAvatarAdvanced : public LLPanelAvatarTab +class LLPanelAvatarProfile + : public LLPanelProfileTab { public: - LLPanelAvatarAdvanced(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar); - - /*virtual*/ BOOL postBuild(void); - - void enableControls(BOOL own_avatar); - void setWantSkills(U32 want_to_mask, const std::string& want_to_text, - U32 skills_mask, const std::string& skills_text, - const std::string& languages_text); - void getWantSkills(U32* want_to_mask, std::string& want_to_text, - U32* skills_mask, std::string& skills_text, - std::string& languages_text); - -private: - S32 mWantToCount; - S32 mSkillsCount; - LLCheckBoxCtrl *mWantToCheck[8]; - LLLineEditor *mWantToEdit; - LLCheckBoxCtrl *mSkillsCheck[8]; - LLLineEditor *mSkillsEdit; -}; - - -class LLPanelAvatarNotes : public LLPanelAvatarTab -{ -public: - LLPanelAvatarNotes(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar); + LLPanelAvatarProfile(const LLUUID& avatar_id = LLUUID::null); + LLPanelAvatarProfile(const Params& params ); + ~LLPanelAvatarProfile(); + + static void* create(void* data); - /*virtual*/ BOOL postBuild(void); + /*virtual*/ void processProperties(void* data, EAvatarProcessorType type); - /*virtual*/ void refresh(); + void updateData(); - void clearControls(); + void clear(); - static void onCommitNotes(LLUICtrl* field, void* userdata); -}; - - -class LLPanelAvatarClassified : public LLPanelAvatarTab -{ -public: - LLPanelAvatarClassified(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar); + virtual void clearControls(); /*virtual*/ BOOL postBuild(void); + void onOpen(const LLSD& key); - /*virtual*/ void refresh(); + void onAddFriendButtonClick(); - // If can close, return TRUE. If cannot close, pop save/discard dialog - // and return FALSE. - BOOL canClose(); + void onIMButtonClick(); - void apply(); + void onCallButtonClick(); - BOOL titleIsValid(); + void onTeleportButtonClick(); - // Delete all the classified sub-panels from the tab container - void deleteClassifiedPanels(); - - // Unpack the outline of classified for this avatar (count, names, but not - // actual data). - void processAvatarClassifiedReply(LLMessageSystem* msg, void**); + void onShareButtonClick(); private: - static void onClickNew(void* data); - static void onClickDelete(void* data); + bool isOwnProfile(){return PT_OWN == mProfileType;} + bool isEditMode(){return mEditMode;} + void updateChildrenList(); + void onStatusChanged(); + void onStatusMessageChanged(); + void setCaptionText(const LLAvatarData* avatar_data); + void scrollToTop(); - bool callbackDelete(const LLSD& notification, const LLSD& response); - bool callbackNew(const LLSD& notification, const LLSD& response); -}; - -class LLPanelAvatarPicks : public LLPanelAvatarTab -{ -public: - LLPanelAvatarPicks(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar); - - /*virtual*/ BOOL postBuild(void); - - /*virtual*/ void refresh(); - - // Delete all the pick sub-panels from the tab container - void deletePickPanels(); - - // Unpack the outline of picks for this avatar (count, names, but not - // actual data). - void processAvatarPicksReply(LLMessageSystem* msg, void**); - void processAvatarClassifiedReply(LLMessageSystem* msg, void**); +protected: + bool mEditMode; private: - static void onClickNew(void* data); - static void onClickDelete(void* data); - - bool callbackDelete(const LLSD& notification, const LLSD& response); + bool mUpdated; + LLComboBox * mStatusCombobox; + LLLineEditor * mStatusMessage; }; -class LLPanelAvatar : public LLPanel +class LLPanelAvatarNotes + : public LLPanelProfileTab { public: - LLPanelAvatar(const std::string& name, const LLRect &rect, BOOL allow_edit); - /*virtual*/ ~LLPanelAvatar(); + LLPanelAvatarNotes(const LLUUID& id = LLUUID::null); + LLPanelAvatarNotes(const Params& params ); + ~LLPanelAvatarNotes(); - /*virtual*/ BOOL postBuild(void); + static void* create(void* data); - // If can close, return TRUE. If cannot close, pop save/discard dialog - // and return FALSE. - BOOL canClose(); + BOOL postBuild(void); - void setAvatar(LLViewerObject *avatarp); + void onCommitRights(); - // Fill in the avatar ID and handle some field fill-in, as well as - // button enablement. - // Pass one of the ONLINE_STATUS_foo constants above. - void setAvatarID(const LLUUID &avatar_id, const std::string &name, EOnlineStatus online_status); + void onCommitNotes(); - void setOnlineStatus(EOnlineStatus online_status); + void clear(); - const LLUUID& getAvatarID() const { return mAvatarID; } - - void resetGroupList(); - - void sendAvatarStatisticsRequest(); - - void sendAvatarPropertiesRequest(); - void sendAvatarPropertiesUpdate(); - - void sendAvatarNotesRequest(); - void sendAvatarNotesUpdate(); - - void sendAvatarPicksRequest(); + void processProperties(void* data, EAvatarProcessorType type); - void selectTab(S32 tabnum); - void selectTabByName(std::string tab_name); + void updateData(); - BOOL haveData() { return mHaveProperties && mHaveStatistics; } - BOOL isEditable() const { return mAllowEdit; } - - static void processAvatarPropertiesReply(LLMessageSystem *msg, void **); - static void processAvatarInterestsReply(LLMessageSystem *msg, void **); - static void processAvatarGroupsReply(LLMessageSystem* msg, void**); - static void processAvatarNotesReply(LLMessageSystem *msg, void **); - static void processAvatarPicksReply(LLMessageSystem *msg, void **); - static void processAvatarClassifiedReply(LLMessageSystem *msg, void **); - - static void onClickTrack( void *userdata); - static void onClickIM( void *userdata); - static void onClickOfferTeleport( void *userdata); - static void onClickPay( void *userdata); - static void onClickAddFriend(void* userdata); - static void onClickOK( void *userdata); - static void onClickCancel( void *userdata); - static void onClickKick( void *userdata); - static void onClickFreeze( void *userdata); - static void onClickUnfreeze(void *userdata); - static void onClickCSR( void *userdata); - static void onClickMute( void *userdata); - -private: - void enableOKIfReady(); - - static bool finishKick(const LLSD& notification, const LLSD& response); - static bool finishFreeze(const LLSD& notification, const LLSD& response); - static bool finishUnfreeze(const LLSD& notification, const LLSD& response); - - static void showProfileCallback(S32 option, void *userdata); +protected: +}; - static void* createPanelAvatar(void* data); - static void* createFloaterAvatarInfo(void* data); - static void* createPanelAvatarSecondLife(void* data); - static void* createPanelAvatarWeb(void* data); - static void* createPanelAvatarInterests(void* data); - static void* createPanelAvatarPicks(void* data); - static void* createPanelAvatarClassified(void* data); - static void* createPanelAvatarFirstLife(void* data); - static void* createPanelAvatarNotes(void* data); -public: - LLPanelAvatarSecondLife* mPanelSecondLife; - LLPanelAvatarAdvanced* mPanelAdvanced; - LLPanelAvatarClassified* mPanelClassified; - LLPanelAvatarPicks* mPanelPicks; - LLPanelAvatarNotes* mPanelNotes; - LLPanelAvatarFirstLife* mPanelFirstLife; - LLPanelAvatarWeb* mPanelWeb; - - LLDropTarget* mDropTarget; - - // Teen users are not allowed to see or enter data into the first life page, - // or their own about/interests text entry fields. - static BOOL sAllowFirstLife; - -private: - LLUUID mAvatarID; // for which avatar is this window? - BOOL mIsFriend; // Are we friends? - BOOL mHaveProperties; - BOOL mHaveStatistics; - // only update note if data received from database and - // note is changed from database version - bool mHaveNotes; - std::string mLastNotes; - LLTabContainer* mTab; - BOOL mAllowEdit; - - typedef std::list<LLPanelAvatar*> panel_list_t; - static panel_list_t sAllPanels; -}; // helper funcs void add_left_label(LLPanel *panel, const std::string& name, S32 y); - #endif // LL_LLPANELAVATAR_H |