diff options
Diffstat (limited to 'indra/newview/llpanelavatar.h')
-rw-r--r-- | indra/newview/llpanelavatar.h | 440 |
1 files changed, 155 insertions, 285 deletions
diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h index 12e1b99360..51bd619901 100644 --- a/indra/newview/llpanelavatar.h +++ b/indra/newview/llpanelavatar.h @@ -34,28 +34,10 @@ #define LL_LLPANELAVATAR_H #include "llpanel.h" -#include "v3dmath.h" -#include "lluuid.h" -#include "llwebbrowserctrl.h" - -class LLButton; -class LLCheckBoxCtrl; -class LLDropTarget; -class LLInventoryItem; +#include "llavatarpropertiesprocessor.h" + +class LLComboBox; class LLLineEditor; -class LLNameEditor; -class LLPanelAvatar; -class LLScrollListCtrl; -class LLTabContainer; -class LLTextBox; -class LLTextEditor; -class LLTextureCtrl; -class LLUICtrl; -class LLViewerImage; -class LLViewerObject; -class LLMessageSystem; -class LLIconCtrl; -class LLWebBrowserCtrl; enum EOnlineStatus { @@ -63,321 +45,209 @@ 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 +/** +* Base class for any Profile View or Me Profile Panel. +*/ +class LLPanelProfileTab + : public LLPanel + , public LLAvatarPropertiesObserver { 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); + /** + * Sets avatar ID, sets panel as observer of avatar related info replies from server. + */ + virtual void setAvatarId(const LLUUID& id); + + /** + * Returns avatar ID. + */ + virtual const LLUUID& getAvatarId() { return mAvatarId; } + + /** + * Sends update data request to server. + */ + virtual void updateData() = 0; + + /** + * Clears panel data if viewing avatar info for first time and sends update data request. + */ + virtual void onOpen(const LLSD& key); + + /** + * Profile tabs should close any opened panels here. + * + * Called from LLPanelProfile::onOpen() before opening new profile. + * See LLPanelpicks::onClose for example. LLPanelPicks closes picture info panel + * before new profile is displayed, otherwise new profile will + * be hidden behind picture info panel. + */ + virtual void onClose() {} + + /** + * Resets controls visibility, state, etc. + */ + virtual void resetControls(){}; + + /** + * Clears all data received from server. + */ + virtual void resetData(){}; + + /*virtual*/ ~LLPanelProfileTab(); + +protected: + + LLPanelProfileTab(); + + /** + * Scrolls panel to top when viewing avatar info for first time. + */ + void scrollToTop(); private: - LLPanelAvatar* mPanelAvatar; - bool mDataRequested; -}; - - -class LLPanelAvatarFirstLife : public LLPanelAvatarTab -{ -public: - LLPanelAvatarFirstLife(const std::string& name, const LLRect &rect, LLPanelAvatar* panel_avatar); - - /*virtual*/ BOOL postBuild(void); - void enableControls(BOOL own_avatar); + LLUUID mAvatarId; }; - -class LLPanelAvatarSecondLife -: public LLPanelAvatarTab +/** +* Panel for displaying Avatar's first and second life related info. +*/ +class LLPanelAvatarProfile + : public LLPanelProfileTab { 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; } - -private: - LLUUID mPartnerID; -}; + LLPanelAvatarProfile(); + /*virtual*/ void onOpen(const LLSD& key); -// 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); + /** + * Processes data received from server. + */ + /*virtual*/ void processProperties(void* data, EAvatarProcessorType type); - /*virtual*/ void refresh(); + /*virtual*/ BOOL postBuild(); - void enableControls(BOOL own_avatar); + /*virtual*/ void updateData(); - void setWebURL(std::string url); + /*virtual*/ void resetControls(); - 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 resetData(); - // browser observer impls - virtual void onStatusTextChange( const EventType& eventIn ); - virtual void onLocationChange( const EventType& eventIn ); +protected: -private: - std::string mHome; - std::string mNavigateTo; - LLWebBrowserCtrl* mWebBrowser; -}; - - -class LLPanelAvatarAdvanced : public LLPanelAvatarTab -{ -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); + /** + * Process profile related data received from server. + */ + virtual void processProfileProperties(const LLAvatarData* avatar_data); - /*virtual*/ BOOL postBuild(void); + /** + * Processes group related data received from server. + */ + virtual void processGroupProperties(const LLAvatarGroups* avatar_groups); - /*virtual*/ void refresh(); + /** + * Fills common for Avatar profile and Me Profile fields. + */ + virtual void fillCommonData(const LLAvatarData* avatar_data); - void clearControls(); + /** + * Fills partner data. + */ + virtual void fillPartnerData(const LLAvatarData* avatar_data); - static void onCommitNotes(LLUICtrl* field, void* userdata); + /** + * Fills Avatar's online status. + */ + virtual void fillOnlineStatus(const LLAvatarData* avatar_data); + + /** + * Fills account status. + */ + virtual void fillAccountStatus(const LLAvatarData* avatar_data); + + void onUrlTextboxClicked(std::string url); + void onHomepageTextboxClicked(); + void onAddFriendButtonClick(); + void onIMButtonClick(); + void onCallButtonClick(); + void onTeleportButtonClick(); + void onShareButtonClick(); }; - -class LLPanelAvatarClassified : public LLPanelAvatarTab +/** + * Panel for displaying own first and second life related info. + */ +class LLPanelAvatarMeProfile + : public LLPanelAvatarProfile { public: - LLPanelAvatarClassified(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar); - - /*virtual*/ BOOL postBuild(void); - - /*virtual*/ void refresh(); - - // If can close, return TRUE. If cannot close, pop save/discard dialog - // and return FALSE. - BOOL canClose(); - - void apply(); - - BOOL titleIsValid(); + LLPanelAvatarMeProfile(); - // Delete all the classified sub-panels from the tab container - void deleteClassifiedPanels(); + /*virtual*/ BOOL postBuild(); - // Unpack the outline of classified for this avatar (count, names, but not - // actual data). - void processAvatarClassifiedReply(LLMessageSystem* msg, void**); - -private: - static void onClickNew(void* data); - static void onClickDelete(void* data); - - bool callbackDelete(const LLSD& notification, const LLSD& response); - bool callbackNew(const LLSD& notification, const LLSD& response); -}; +protected: + /*virtual*/ void onOpen(const LLSD& key); -class LLPanelAvatarPicks : public LLPanelAvatarTab -{ -public: - LLPanelAvatarPicks(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar); + /*virtual*/ void processProfileProperties(const LLAvatarData* avatar_data); - /*virtual*/ BOOL postBuild(void); + /** + * Fills Avatar status data. + */ + virtual void fillStatusData(const LLAvatarData* avatar_data); - /*virtual*/ void refresh(); + /*virtual*/ void resetControls(); - // Delete all the pick sub-panels from the tab container - void deletePickPanels(); +protected: - // Unpack the outline of picks for this avatar (count, names, but not - // actual data). - void processAvatarPicksReply(LLMessageSystem* msg, void**); - void processAvatarClassifiedReply(LLMessageSystem* msg, void**); + void onStatusChanged(); + void onStatusMessageChanged(); + void onUpdateAccountTextboxClicked(); + void onMyAccountTextboxClicked(); + void onPartnerEditTextboxClicked(); private: - static void onClickNew(void* data); - static void onClickDelete(void* data); - bool callbackDelete(const LLSD& notification, const LLSD& response); + LLComboBox* mStatusCombobox; }; - -class LLPanelAvatar : public LLPanel +/** +* Panel for displaying Avatar's notes and modifying friend's rights. +*/ +class LLPanelAvatarNotes + : public LLPanelProfileTab { public: - LLPanelAvatar(const std::string& name, const LLRect &rect, BOOL allow_edit); - /*virtual*/ ~LLPanelAvatar(); + LLPanelAvatarNotes(); - /*virtual*/ BOOL postBuild(void); + /*virtual*/ void onOpen(const LLSD& key); - // If can close, return TRUE. If cannot close, pop save/discard dialog - // and return FALSE. - BOOL canClose(); + /*virtual*/ BOOL postBuild(); - void setAvatar(LLViewerObject *avatarp); + /*virtual*/ void processProperties(void* data, EAvatarProcessorType type); - // 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); + /*virtual*/ void updateData(); - void setOnlineStatus(EOnlineStatus online_status); +protected: - const LLUUID& getAvatarID() const { return mAvatarID; } - - void resetGroupList(); + /*virtual*/ void resetControls(); - void sendAvatarStatisticsRequest(); + /*virtual*/ void resetData(); - void sendAvatarPropertiesRequest(); - void sendAvatarPropertiesUpdate(); + /** + * Fills rights data for friends. + */ + void fillRightsData(); - void sendAvatarNotesRequest(); - void sendAvatarNotesUpdate(); + void onCommitRights(); + void onCommitNotes(); - void sendAvatarPicksRequest(); - - void selectTab(S32 tabnum); - void selectTabByName(std::string tab_name); - - 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); - - 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; + void onAddFriendButtonClick(); + void onIMButtonClick(); + void onCallButtonClick(); + void onTeleportButtonClick(); + void onShareButtonClick(); }; -// helper funcs -void add_left_label(LLPanel *panel, const std::string& name, S32 y); - - #endif // LL_LLPANELAVATAR_H |