diff options
Diffstat (limited to 'linden/indra/newview/llpanelavatar.cpp')
-rw-r--r-- | linden/indra/newview/llpanelavatar.cpp | 352 |
1 files changed, 193 insertions, 159 deletions
diff --git a/linden/indra/newview/llpanelavatar.cpp b/linden/indra/newview/llpanelavatar.cpp index c7019e0..70b18be 100644 --- a/linden/indra/newview/llpanelavatar.cpp +++ b/linden/indra/newview/llpanelavatar.cpp | |||
@@ -64,6 +64,7 @@ | |||
64 | #include "lluiconstants.h" | 64 | #include "lluiconstants.h" |
65 | #include "llvoavatar.h" | 65 | #include "llvoavatar.h" |
66 | #include "llviewermenu.h" // *FIX: for is_agent_friend() | 66 | #include "llviewermenu.h" // *FIX: for is_agent_friend() |
67 | #include "llviewermessage.h" // send_generic_message | ||
67 | #include "llviewerobjectlist.h" | 68 | #include "llviewerobjectlist.h" |
68 | #include "llviewerregion.h" | 69 | #include "llviewerregion.h" |
69 | #include "llviewborder.h" | 70 | #include "llviewborder.h" |
@@ -253,35 +254,60 @@ BOOL LLDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, | |||
253 | 254 | ||
254 | 255 | ||
255 | //----------------------------------------------------------------------------- | 256 | //----------------------------------------------------------------------------- |
256 | // LLPanelAvatarSecondLife() | 257 | // LLPanelAvatarTab() |
257 | //----------------------------------------------------------------------------- | 258 | //----------------------------------------------------------------------------- |
258 | LLPanelAvatarSecondLife::LLPanelAvatarSecondLife(const std::string& name, const LLRect &rect, LLPanelAvatar* panel_avatar ) | 259 | LLPanelAvatarTab::LLPanelAvatarTab(const std::string& name, const LLRect &rect, |
260 | LLPanelAvatar* panel_avatar) | ||
259 | : LLPanel(name, rect), | 261 | : LLPanel(name, rect), |
260 | mPanelAvatar(panel_avatar), | 262 | mPanelAvatar(panel_avatar), |
261 | mPartnerID() | 263 | mDataRequested(false) |
262 | { | 264 | { } |
263 | } | ||
264 | 265 | ||
265 | LLPanelAvatarSecondLife::~LLPanelAvatarSecondLife() | 266 | // virtual |
267 | void LLPanelAvatarTab::draw() | ||
266 | { | 268 | { |
269 | if (getVisible()) | ||
270 | { | ||
271 | refresh(); | ||
272 | |||
273 | LLPanel::draw(); | ||
274 | } | ||
267 | } | 275 | } |
268 | 276 | ||
269 | void LLPanelAvatarSecondLife::draw() | 277 | void LLPanelAvatarTab::sendAvatarProfileRequestIfNeeded(const char* type) |
270 | { | 278 | { |
271 | if (getVisible()) | 279 | if (!mDataRequested) |
272 | { | 280 | { |
273 | updatePartnerName(); | 281 | std::vector<std::string> strings; |
282 | strings.push_back( mPanelAvatar->getAvatarID().asString() ); | ||
283 | strings.push_back( type ); | ||
284 | send_generic_message("avatarprofilerequest", strings); | ||
285 | mDataRequested = true; | ||
274 | } | 286 | } |
287 | } | ||
288 | |||
289 | //----------------------------------------------------------------------------- | ||
290 | // LLPanelAvatarSecondLife() | ||
291 | //----------------------------------------------------------------------------- | ||
292 | LLPanelAvatarSecondLife::LLPanelAvatarSecondLife(const std::string& name, | ||
293 | const LLRect &rect, | ||
294 | LLPanelAvatar* panel_avatar ) | ||
295 | : LLPanelAvatarTab(name, rect, panel_avatar), | ||
296 | mPartnerID() | ||
297 | { | ||
298 | } | ||
275 | 299 | ||
276 | LLPanel::draw(); | 300 | void LLPanelAvatarSecondLife::refresh() |
301 | { | ||
302 | updatePartnerName(); | ||
277 | } | 303 | } |
278 | 304 | ||
279 | void LLPanelAvatarSecondLife::updatePartnerName() | 305 | void LLPanelAvatarSecondLife::updatePartnerName() |
280 | { | 306 | { |
281 | if (mPartnerID.notNull()) | 307 | if (mPartnerID.notNull()) |
282 | { | 308 | { |
283 | char first[128]; | 309 | char first[128]; /*Flawfinder: ignore*/ |
284 | char last[128]; | 310 | char last[128]; /*Flawfinder: ignore*/ |
285 | BOOL found = gCacheName->getName(mPartnerID, first, last); | 311 | BOOL found = gCacheName->getName(mPartnerID, first, last); |
286 | if (found) | 312 | if (found) |
287 | { | 313 | { |
@@ -378,17 +404,27 @@ void LLPanelAvatarSecondLife::onClickPublishHelp(void *) | |||
378 | gViewerWindow->alertXml("ClickPublishHelpAvatar"); | 404 | gViewerWindow->alertXml("ClickPublishHelpAvatar"); |
379 | } | 405 | } |
380 | 406 | ||
381 | //----------------------------------------------------------------------------- | 407 | // static |
382 | // LLPanelAvatarFirstLife() | 408 | void LLPanelAvatarSecondLife::onClickPartnerHelp(void *) |
383 | //----------------------------------------------------------------------------- | 409 | { |
384 | LLPanelAvatarFirstLife::LLPanelAvatarFirstLife(const std::string& name, const LLRect &rect, LLPanelAvatar* panel_avatar ) | 410 | gViewerWindow->alertXml("ClickPartnerHelpAvatar", onClickPartnerHelpLoadURL, (void*) NULL); |
385 | : LLPanel(name, rect), | 411 | } |
386 | mPanelAvatar(panel_avatar) | 412 | |
413 | // static | ||
414 | void LLPanelAvatarSecondLife::onClickPartnerHelpLoadURL(S32 option, void* userdata) | ||
387 | { | 415 | { |
416 | if (option == 0) | ||
417 | LLWeb::loadURL("http://secondlife.com/partner"); | ||
388 | } | 418 | } |
389 | 419 | ||
390 | 420 | ||
391 | LLPanelAvatarFirstLife::~LLPanelAvatarFirstLife() | 421 | //----------------------------------------------------------------------------- |
422 | // LLPanelAvatarFirstLife() | ||
423 | //----------------------------------------------------------------------------- | ||
424 | LLPanelAvatarFirstLife::LLPanelAvatarFirstLife(const std::string& name, | ||
425 | const LLRect &rect, | ||
426 | LLPanelAvatar* panel_avatar ) | ||
427 | : LLPanelAvatarTab(name, rect, panel_avatar) | ||
392 | { | 428 | { |
393 | } | 429 | } |
394 | 430 | ||
@@ -407,9 +443,10 @@ BOOL LLPanelAvatarSecondLife::postBuild(void) | |||
407 | { | 443 | { |
408 | childSetEnabled("born", FALSE); | 444 | childSetEnabled("born", FALSE); |
409 | childSetEnabled("partner_edit", FALSE); | 445 | childSetEnabled("partner_edit", FALSE); |
446 | childSetAction("partner_help",onClickPartnerHelp,this); | ||
410 | 447 | ||
411 | childSetAction("?",onClickPublishHelp,this); | 448 | childSetAction("?",onClickPublishHelp,this); |
412 | BOOL own_avatar = (mPanelAvatar->getAvatarID() == gAgent.getID() ); | 449 | BOOL own_avatar = (getPanelAvatar()->getAvatarID() == gAgent.getID() ); |
413 | enableControls(own_avatar); | 450 | enableControls(own_avatar); |
414 | 451 | ||
415 | childSetVisible("About:",LLPanelAvatar::sAllowFirstLife); | 452 | childSetVisible("About:",LLPanelAvatar::sAllowFirstLife); |
@@ -426,26 +463,30 @@ BOOL LLPanelAvatarSecondLife::postBuild(void) | |||
426 | childSetVisible("online_unknown",FALSE); | 463 | childSetVisible("online_unknown",FALSE); |
427 | childSetVisible("online_no",FALSE); | 464 | childSetVisible("online_no",FALSE); |
428 | 465 | ||
429 | childSetAction("Show on Map", LLPanelAvatar::onClickTrack, mPanelAvatar); | 466 | childSetAction("Show on Map", LLPanelAvatar::onClickTrack, getPanelAvatar()); |
430 | childSetAction("Instant Message...", LLPanelAvatar::onClickIM, mPanelAvatar); | 467 | childSetAction("Instant Message...", LLPanelAvatar::onClickIM, getPanelAvatar()); |
431 | childSetAction("Rate...", LLPanelAvatar::onClickRate, mPanelAvatar); | 468 | childSetAction("Rate...", LLPanelAvatar::onClickRate, getPanelAvatar()); |
432 | childSetAction("Pay...", LLPanelAvatar::onClickPay, mPanelAvatar); | 469 | childSetAction("Pay...", LLPanelAvatar::onClickPay, getPanelAvatar()); |
433 | childSetAction("Mute", LLPanelAvatar::onClickMute, mPanelAvatar ); | 470 | childSetAction("Mute", LLPanelAvatar::onClickMute, getPanelAvatar() ); |
434 | 471 | ||
435 | childSetAction("Offer Teleport...", LLPanelAvatar::onClickOfferTeleport, mPanelAvatar); | 472 | childSetAction("Offer Teleport...", LLPanelAvatar::onClickOfferTeleport, |
473 | getPanelAvatar() ); | ||
436 | 474 | ||
437 | childSetDoubleClickCallback("groups", onDoubleClickGroup, this ); | 475 | childSetDoubleClickCallback("groups", onDoubleClickGroup, this ); |
438 | 476 | ||
439 | return TRUE; | 477 | return TRUE; |
440 | } | 478 | } |
479 | |||
441 | BOOL LLPanelAvatarFirstLife::postBuild(void) | 480 | BOOL LLPanelAvatarFirstLife::postBuild(void) |
442 | { | 481 | { |
443 | BOOL own_avatar = (mPanelAvatar->getAvatarID() == gAgent.getID() ); | 482 | BOOL own_avatar = (getPanelAvatar()->getAvatarID() == gAgent.getID() ); |
444 | enableControls(own_avatar); | 483 | enableControls(own_avatar); |
445 | return TRUE; | 484 | return TRUE; |
446 | } | 485 | } |
486 | |||
447 | BOOL LLPanelAvatarNotes::postBuild(void) | 487 | BOOL LLPanelAvatarNotes::postBuild(void) |
448 | { childSetCommitCallback("notes edit",onCommitNotes,this); | 488 | { |
489 | childSetCommitCallback("notes edit",onCommitNotes,this); | ||
449 | 490 | ||
450 | LLTextEditor* te = LLUICtrlFactory::getTextEditorByName(this,"notes edit"); | 491 | LLTextEditor* te = LLUICtrlFactory::getTextEditorByName(this,"notes edit"); |
451 | if(te) te->setCommitOnFocusLost(TRUE); | 492 | if(te) te->setCommitOnFocusLost(TRUE); |
@@ -482,6 +523,7 @@ BOOL LLPanelAvatarClassified::postBuild(void) | |||
482 | childSetAction("Delete...",onClickDelete,NULL); | 523 | childSetAction("Delete...",onClickDelete,NULL); |
483 | return TRUE; | 524 | return TRUE; |
484 | } | 525 | } |
526 | |||
485 | BOOL LLPanelAvatarPicks::postBuild(void) | 527 | BOOL LLPanelAvatarPicks::postBuild(void) |
486 | { | 528 | { |
487 | childSetAction("New...",onClickNew,NULL); | 529 | childSetAction("New...",onClickNew,NULL); |
@@ -489,25 +531,25 @@ BOOL LLPanelAvatarPicks::postBuild(void) | |||
489 | return TRUE; | 531 | return TRUE; |
490 | } | 532 | } |
491 | 533 | ||
492 | BOOL LLPanelAvatarAdvanced::postBuild() | 534 | BOOL LLPanelAvatarAdvanced::postBuild() |
493 | { | 535 | { |
494 | for( S32 i = 0; i < kArraySize(mWantToCheck); i++ ) | 536 | for(size_t ii = 0; ii < kArraySize(mWantToCheck); ++ii) |
495 | mWantToCheck[i] = NULL; | 537 | mWantToCheck[ii] = NULL; |
496 | for( S32 i = 0; i < kArraySize(mSkillsCheck); i++ ) | 538 | for(size_t ii = 0; ii < kArraySize(mSkillsCheck); ++ii) |
497 | mSkillsCheck[i] = NULL; | 539 | mSkillsCheck[ii] = NULL; |
498 | mWantToCount = (8>kArraySize(mWantToCheck))?kArraySize(mWantToCheck):8; | 540 | mWantToCount = (8>kArraySize(mWantToCheck))?kArraySize(mWantToCheck):8; |
499 | for(int t=0;t < mWantToCount ;t++) | 541 | for(S32 tt=0; tt < mWantToCount; ++tt) |
500 | { | 542 | { |
501 | LLString ctlname = llformat("chk%d",t); | 543 | LLString ctlname = llformat("chk%d", tt); |
502 | mWantToCheck[t] = LLUICtrlFactory::getCheckBoxByName(this,ctlname); | 544 | mWantToCheck[tt] = LLUICtrlFactory::getCheckBoxByName(this,ctlname); |
503 | } | 545 | } |
504 | mSkillsCount = (6>kArraySize(mSkillsCheck))?kArraySize(mSkillsCheck):6; | 546 | mSkillsCount = (6>kArraySize(mSkillsCheck))?kArraySize(mSkillsCheck):6; |
505 | 547 | ||
506 | for(int t=0;t<mSkillsCount;t++) | 548 | for(S32 tt=0; tt < mSkillsCount; ++tt) |
507 | { | 549 | { |
508 | //Find the Skills checkboxes and save off thier controls | 550 | //Find the Skills checkboxes and save off thier controls |
509 | LLString ctlname = llformat("schk%d",t); | 551 | LLString ctlname = llformat("schk%d",tt); |
510 | mSkillsCheck[t] = LLUICtrlFactory::getCheckBoxByName(this,ctlname); | 552 | mSkillsCheck[tt] = LLUICtrlFactory::getCheckBoxByName(this,ctlname); |
511 | } | 553 | } |
512 | 554 | ||
513 | mWantToEdit = LLUICtrlFactory::getLineEditorByName(this,"want_to_edit"); | 555 | mWantToEdit = LLUICtrlFactory::getLineEditorByName(this,"want_to_edit"); |
@@ -518,9 +560,12 @@ BOOL LLPanelAvatarAdvanced::postBuild() | |||
518 | return TRUE; | 560 | return TRUE; |
519 | } | 561 | } |
520 | 562 | ||
521 | LLPanelAvatarWeb::LLPanelAvatarWeb(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar) | 563 | //----------------------------------------------------------------------------- |
522 | : LLPanel(name, rect), | 564 | // LLPanelAvatarWeb |
523 | mPanelAvatar(panel_avatar), | 565 | //----------------------------------------------------------------------------- |
566 | LLPanelAvatarWeb::LLPanelAvatarWeb(const std::string& name, const LLRect& rect, | ||
567 | LLPanelAvatar* panel_avatar) | ||
568 | : LLPanelAvatarTab(name, rect, panel_avatar), | ||
524 | mWebBrowser(NULL) | 569 | mWebBrowser(NULL) |
525 | { | 570 | { |
526 | } | 571 | } |
@@ -668,13 +713,14 @@ void LLPanelAvatarWeb::onLocationChange( const EventType& eventIn ) | |||
668 | } | 713 | } |
669 | #endif | 714 | #endif |
670 | 715 | ||
671 | LLPanelAvatarAdvanced::LLPanelAvatarAdvanced( | 716 | |
672 | const std::string& name, | 717 | //----------------------------------------------------------------------------- |
673 | const LLRect& rect, | 718 | // LLPanelAvatarAdvanced |
674 | LLPanelAvatar* panel_avatar) | 719 | //----------------------------------------------------------------------------- |
675 | : | 720 | LLPanelAvatarAdvanced::LLPanelAvatarAdvanced(const std::string& name, |
676 | LLPanel(name, rect), | 721 | const LLRect& rect, |
677 | mPanelAvatar(panel_avatar), | 722 | LLPanelAvatar* panel_avatar) |
723 | : LLPanelAvatarTab(name, rect, panel_avatar), | ||
678 | mWantToCount(0), | 724 | mWantToCount(0), |
679 | mSkillsCount(0), | 725 | mSkillsCount(0), |
680 | mWantToEdit( NULL ), | 726 | mWantToEdit( NULL ), |
@@ -682,13 +728,9 @@ LLPanelAvatarAdvanced::LLPanelAvatarAdvanced( | |||
682 | { | 728 | { |
683 | } | 729 | } |
684 | 730 | ||
685 | LLPanelAvatarAdvanced::~LLPanelAvatarAdvanced() | ||
686 | { | ||
687 | } | ||
688 | |||
689 | |||
690 | void LLPanelAvatarAdvanced::enableControls(BOOL self) | 731 | void LLPanelAvatarAdvanced::enableControls(BOOL self) |
691 | { int t; | 732 | { |
733 | S32 t; | ||
692 | for(t=0;t<mWantToCount;t++) | 734 | for(t=0;t<mWantToCount;t++) |
693 | { | 735 | { |
694 | if(mWantToCheck[t])mWantToCheck[t]->setEnabled(self); | 736 | if(mWantToCheck[t])mWantToCheck[t]->setEnabled(self); |
@@ -774,25 +816,27 @@ void LLPanelAvatarAdvanced::getWantSkills(U32* want_to_mask, std::string& want_t | |||
774 | // LLPanelAvatarNotes() | 816 | // LLPanelAvatarNotes() |
775 | //----------------------------------------------------------------------------- | 817 | //----------------------------------------------------------------------------- |
776 | LLPanelAvatarNotes::LLPanelAvatarNotes(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar) | 818 | LLPanelAvatarNotes::LLPanelAvatarNotes(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar) |
777 | : LLPanel(name, rect), | 819 | : LLPanelAvatarTab(name, rect, panel_avatar) |
778 | mPanelAvatar(panel_avatar) | ||
779 | { | 820 | { |
780 | } | 821 | } |
781 | 822 | ||
782 | LLPanelAvatarNotes::~LLPanelAvatarNotes() | 823 | void LLPanelAvatarNotes::refresh() |
783 | { | 824 | { |
825 | sendAvatarProfileRequestIfNeeded("notes"); | ||
784 | } | 826 | } |
785 | 827 | ||
786 | 828 | void LLPanelAvatarNotes::clearControls() | |
787 | void LLPanelAvatarNotes::enableControls(BOOL self) | 829 | { |
788 | { } | 830 | childSetText("notes edit", "Loading..."); |
831 | childSetEnabled("notes edit", false); | ||
832 | } | ||
789 | 833 | ||
790 | // static | 834 | // static |
791 | void LLPanelAvatarNotes::onCommitNotes(LLUICtrl*, void* userdata) | 835 | void LLPanelAvatarNotes::onCommitNotes(LLUICtrl*, void* userdata) |
792 | { | 836 | { |
793 | LLPanelAvatarNotes* self = (LLPanelAvatarNotes*)userdata; | 837 | LLPanelAvatarNotes* self = (LLPanelAvatarNotes*)userdata; |
794 | 838 | ||
795 | self->mPanelAvatar->sendAvatarNotesUpdate(); | 839 | self->getPanelAvatar()->sendAvatarNotesUpdate(); |
796 | } | 840 | } |
797 | 841 | ||
798 | 842 | ||
@@ -801,33 +845,14 @@ void LLPanelAvatarNotes::onCommitNotes(LLUICtrl*, void* userdata) | |||
801 | //----------------------------------------------------------------------------- | 845 | //----------------------------------------------------------------------------- |
802 | LLPanelAvatarClassified::LLPanelAvatarClassified(const LLString& name, const LLRect& rect, | 846 | LLPanelAvatarClassified::LLPanelAvatarClassified(const LLString& name, const LLRect& rect, |
803 | LLPanelAvatar* panel_avatar) | 847 | LLPanelAvatar* panel_avatar) |
804 | : LLPanel(name, rect), | 848 | : LLPanelAvatarTab(name, rect, panel_avatar) |
805 | mPanelAvatar(panel_avatar) | ||
806 | { | 849 | { |
807 | } | 850 | } |
808 | 851 | ||
809 | 852 | ||
810 | LLPanelAvatarClassified::~LLPanelAvatarClassified() | ||
811 | { | ||
812 | // children deleted by view destructor | ||
813 | } | ||
814 | |||
815 | |||
816 | void LLPanelAvatarClassified::draw() | ||
817 | { | ||
818 | if (getVisible()) | ||
819 | { | ||
820 | refresh(); | ||
821 | |||
822 | LLPanel::draw(); | ||
823 | } | ||
824 | } | ||
825 | |||
826 | |||
827 | void LLPanelAvatarClassified::refresh() | 853 | void LLPanelAvatarClassified::refresh() |
828 | { | 854 | { |
829 | BOOL self = (gAgent.getID() == mPanelAvatar->getAvatarID()); | 855 | BOOL self = (gAgent.getID() == getPanelAvatar()->getAvatarID()); |
830 | |||
831 | 856 | ||
832 | LLTabContainerCommon* tabs = LLUICtrlFactory::getTabContainerByName(this,"classified tab"); | 857 | LLTabContainerCommon* tabs = LLUICtrlFactory::getTabContainerByName(this,"classified tab"); |
833 | 858 | ||
@@ -839,15 +864,12 @@ void LLPanelAvatarClassified::refresh() | |||
839 | 864 | ||
840 | childSetEnabled("New...",self && allow_new); | 865 | childSetEnabled("New...",self && allow_new); |
841 | childSetEnabled("Delete...",self && allow_delete); | 866 | childSetEnabled("Delete...",self && allow_delete); |
842 | childSetVisible("help_text",self && show_help); | ||
843 | childSetVisible("classified tab",!show_help); | 867 | childSetVisible("classified tab",!show_help); |
844 | } | ||
845 | 868 | ||
846 | 869 | sendAvatarProfileRequestIfNeeded("classifieds"); | |
847 | void LLPanelAvatarClassified::enableControls(BOOL self) | ||
848 | { | ||
849 | } | 870 | } |
850 | 871 | ||
872 | |||
851 | BOOL LLPanelAvatarClassified::titleIsValid() | 873 | BOOL LLPanelAvatarClassified::titleIsValid() |
852 | { | 874 | { |
853 | LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(this, "classified tab"); | 875 | LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(this, "classified tab"); |
@@ -884,6 +906,10 @@ void LLPanelAvatarClassified::deleteClassifiedPanels() | |||
884 | { | 906 | { |
885 | tabs->deleteAllTabs(); | 907 | tabs->deleteAllTabs(); |
886 | } | 908 | } |
909 | |||
910 | childSetVisible("New...", false); | ||
911 | childSetVisible("Delete...", false); | ||
912 | childSetVisible("loading_text", true); | ||
887 | } | 913 | } |
888 | 914 | ||
889 | 915 | ||
@@ -892,7 +918,7 @@ void LLPanelAvatarClassified::processAvatarClassifiedReply(LLMessageSystem* msg, | |||
892 | S32 block = 0; | 918 | S32 block = 0; |
893 | S32 block_count = 0; | 919 | S32 block_count = 0; |
894 | LLUUID classified_id; | 920 | LLUUID classified_id; |
895 | char classified_name[DB_PICK_NAME_SIZE]; | 921 | char classified_name[DB_PICK_NAME_SIZE]; /*Flawfinder: ignore*/ |
896 | LLPanelClassified* panel_classified = NULL; | 922 | LLPanelClassified* panel_classified = NULL; |
897 | 923 | ||
898 | LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(this,"classified tab"); | 924 | LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(this,"classified tab"); |
@@ -927,6 +953,10 @@ void LLPanelAvatarClassified::processAvatarClassifiedReply(LLMessageSystem* msg, | |||
927 | { | 953 | { |
928 | tabs->selectFirstTab(); | 954 | tabs->selectFirstTab(); |
929 | } | 955 | } |
956 | |||
957 | childSetVisible("New...", true); | ||
958 | childSetVisible("Delete...", true); | ||
959 | childSetVisible("loading_text", false); | ||
930 | } | 960 | } |
931 | 961 | ||
932 | 962 | ||
@@ -1018,34 +1048,17 @@ void LLPanelAvatarClassified::callbackDelete(S32 option, void* data) | |||
1018 | //----------------------------------------------------------------------------- | 1048 | //----------------------------------------------------------------------------- |
1019 | // LLPanelAvatarPicks() | 1049 | // LLPanelAvatarPicks() |
1020 | //----------------------------------------------------------------------------- | 1050 | //----------------------------------------------------------------------------- |
1021 | LLPanelAvatarPicks::LLPanelAvatarPicks(const std::string& name, const LLRect& rect, | 1051 | LLPanelAvatarPicks::LLPanelAvatarPicks(const std::string& name, |
1052 | const LLRect& rect, | ||
1022 | LLPanelAvatar* panel_avatar) | 1053 | LLPanelAvatar* panel_avatar) |
1023 | : LLPanel(name, rect), | 1054 | : LLPanelAvatarTab(name, rect, panel_avatar) |
1024 | mPanelAvatar(panel_avatar) | ||
1025 | { | 1055 | { |
1026 | } | 1056 | } |
1027 | 1057 | ||
1028 | 1058 | ||
1029 | LLPanelAvatarPicks::~LLPanelAvatarPicks() | ||
1030 | { | ||
1031 | // children deleted by view destructor | ||
1032 | } | ||
1033 | |||
1034 | |||
1035 | void LLPanelAvatarPicks::draw() | ||
1036 | { | ||
1037 | if (getVisible()) | ||
1038 | { | ||
1039 | refresh(); | ||
1040 | |||
1041 | LLPanel::draw(); | ||
1042 | } | ||
1043 | } | ||
1044 | |||
1045 | |||
1046 | void LLPanelAvatarPicks::refresh() | 1059 | void LLPanelAvatarPicks::refresh() |
1047 | { | 1060 | { |
1048 | BOOL self = (gAgent.getID() == mPanelAvatar->getAvatarID()); | 1061 | BOOL self = (gAgent.getID() == getPanelAvatar()->getAvatarID()); |
1049 | 1062 | ||
1050 | LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(this,"picks tab"); | 1063 | LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(this,"picks tab"); |
1051 | S32 tab_count = tabs ? tabs->getTabCount() : 0; | 1064 | S32 tab_count = tabs ? tabs->getTabCount() : 0; |
@@ -1054,12 +1067,8 @@ void LLPanelAvatarPicks::refresh() | |||
1054 | 1067 | ||
1055 | childSetEnabled("New...",self && allow_new); | 1068 | childSetEnabled("New...",self && allow_new); |
1056 | childSetEnabled("Delete...",self && allow_delete); | 1069 | childSetEnabled("Delete...",self && allow_delete); |
1057 | } | ||
1058 | 1070 | ||
1059 | 1071 | sendAvatarProfileRequestIfNeeded("picks"); | |
1060 | // You are only allowed 10 picks. | ||
1061 | void LLPanelAvatarPicks::enableControls(BOOL self) | ||
1062 | { | ||
1063 | } | 1072 | } |
1064 | 1073 | ||
1065 | 1074 | ||
@@ -1070,15 +1079,18 @@ void LLPanelAvatarPicks::deletePickPanels() | |||
1070 | { | 1079 | { |
1071 | tabs->deleteAllTabs(); | 1080 | tabs->deleteAllTabs(); |
1072 | } | 1081 | } |
1073 | } | ||
1074 | 1082 | ||
1083 | childSetVisible("New...", false); | ||
1084 | childSetVisible("Delete...", false); | ||
1085 | childSetVisible("loading_text", true); | ||
1086 | } | ||
1075 | 1087 | ||
1076 | void LLPanelAvatarPicks::processAvatarPicksReply(LLMessageSystem* msg, void**) | 1088 | void LLPanelAvatarPicks::processAvatarPicksReply(LLMessageSystem* msg, void**) |
1077 | { | 1089 | { |
1078 | S32 block = 0; | 1090 | S32 block = 0; |
1079 | S32 block_count = 0; | 1091 | S32 block_count = 0; |
1080 | LLUUID pick_id; | 1092 | LLUUID pick_id; |
1081 | char pick_name[DB_PICK_NAME_SIZE]; | 1093 | char pick_name[DB_PICK_NAME_SIZE]; /*Flawfinder: ignore*/ |
1082 | LLPanelPick* panel_pick = NULL; | 1094 | LLPanelPick* panel_pick = NULL; |
1083 | 1095 | ||
1084 | LLTabContainerCommon* tabs = LLUICtrlFactory::getTabContainerByName(this,"picks tab"); | 1096 | LLTabContainerCommon* tabs = LLUICtrlFactory::getTabContainerByName(this,"picks tab"); |
@@ -1114,6 +1126,10 @@ void LLPanelAvatarPicks::processAvatarPicksReply(LLMessageSystem* msg, void**) | |||
1114 | { | 1126 | { |
1115 | tabs->selectFirstTab(); | 1127 | tabs->selectFirstTab(); |
1116 | } | 1128 | } |
1129 | |||
1130 | childSetVisible("New...", true); | ||
1131 | childSetVisible("Delete...", true); | ||
1132 | childSetVisible("loading_text", false); | ||
1117 | } | 1133 | } |
1118 | 1134 | ||
1119 | 1135 | ||
@@ -1313,6 +1329,31 @@ void LLPanelAvatar::setOnlineStatus(EOnlineStatus online_status) | |||
1313 | } | 1329 | } |
1314 | 1330 | ||
1315 | mPanelSecondLife->childSetVisible("online_yes", (online_status == ONLINE_STATUS_YES)); | 1331 | mPanelSecondLife->childSetVisible("online_yes", (online_status == ONLINE_STATUS_YES)); |
1332 | |||
1333 | // Since setOnlineStatus gets called after setAvatarID | ||
1334 | // need to make sure that "Offer Teleport" doesn't get set | ||
1335 | // to TRUE again for yourself | ||
1336 | if (mAvatarID != gAgent.getID()) | ||
1337 | { | ||
1338 | childSetVisible("Offer Teleport...",TRUE); | ||
1339 | } | ||
1340 | |||
1341 | BOOL in_prelude = gAgent.inPrelude(); | ||
1342 | if(gAgent.isGodlike()) | ||
1343 | { | ||
1344 | childSetEnabled("Offer Teleport...", TRUE); | ||
1345 | childSetToolTip("Offer Teleport...", childGetValue("TeleportGod").asString()); | ||
1346 | } | ||
1347 | else if (in_prelude) | ||
1348 | { | ||
1349 | childSetEnabled("Offer Teleport...",FALSE); | ||
1350 | childSetToolTip("Offer Teleport...",childGetValue("TeleportPrelude").asString()); | ||
1351 | } | ||
1352 | else | ||
1353 | { | ||
1354 | childSetEnabled("Offer Teleport...", (online_status == ONLINE_STATUS_YES)); | ||
1355 | childSetToolTip("Offer Teleport...", childGetValue("TeleportNormal").asString()); | ||
1356 | } | ||
1316 | } | 1357 | } |
1317 | 1358 | ||
1318 | void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const LLString &name, | 1359 | void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const LLString &name, |
@@ -1338,12 +1379,8 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const LLString &name, | |||
1338 | mPanelSecondLife->enableControls(own_avatar && mAllowEdit); | 1379 | mPanelSecondLife->enableControls(own_avatar && mAllowEdit); |
1339 | mPanelWeb->enableControls(own_avatar && mAllowEdit); | 1380 | mPanelWeb->enableControls(own_avatar && mAllowEdit); |
1340 | mPanelAdvanced->enableControls(own_avatar && mAllowEdit); | 1381 | mPanelAdvanced->enableControls(own_avatar && mAllowEdit); |
1341 | mPanelPicks->enableControls(own_avatar && mAllowEdit); | ||
1342 | mPanelClassified->enableControls(own_avatar && mAllowEdit); | ||
1343 | // Teens don't have this. | 1382 | // Teens don't have this. |
1344 | if (mPanelFirstLife) mPanelFirstLife->enableControls(own_avatar && mAllowEdit); | 1383 | if (mPanelFirstLife) mPanelFirstLife->enableControls(own_avatar && mAllowEdit); |
1345 | mPanelNotes->enableControls(own_avatar && mAllowEdit); | ||
1346 | |||
1347 | 1384 | ||
1348 | LLView *target_view = getChildByName("drop_target_rect", TRUE); | 1385 | LLView *target_view = getChildByName("drop_target_rect", TRUE); |
1349 | if(target_view) | 1386 | if(target_view) |
@@ -1357,16 +1394,16 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const LLString &name, | |||
1357 | mDropTarget->setAgentID(mAvatarID); | 1394 | mDropTarget->setAgentID(mAvatarID); |
1358 | } | 1395 | } |
1359 | 1396 | ||
1360 | LLNameEditor* NameEdit = LLViewerUICtrlFactory::getNameEditorByName(this, "name"); | 1397 | LLNameEditor* name_edit = LLViewerUICtrlFactory::getNameEditorByName(this, "name"); |
1361 | if(NameEdit) | 1398 | if(name_edit) |
1362 | { | 1399 | { |
1363 | if (name.empty()) | 1400 | if (name.empty()) |
1364 | { | 1401 | { |
1365 | NameEdit->setNameID(avatar_id, FALSE); | 1402 | name_edit->setNameID(avatar_id, FALSE); |
1366 | } | 1403 | } |
1367 | else | 1404 | else |
1368 | { | 1405 | { |
1369 | NameEdit->setText(name); | 1406 | name_edit->setText(name); |
1370 | } | 1407 | } |
1371 | } | 1408 | } |
1372 | // if (avatar_changed) | 1409 | // if (avatar_changed) |
@@ -1374,9 +1411,19 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const LLString &name, | |||
1374 | // While we're waiting for data off the network, clear out the | 1411 | // While we're waiting for data off the network, clear out the |
1375 | // old data. | 1412 | // old data. |
1376 | mPanelSecondLife->clearControls(); | 1413 | mPanelSecondLife->clearControls(); |
1414 | |||
1377 | mPanelPicks->deletePickPanels(); | 1415 | mPanelPicks->deletePickPanels(); |
1416 | mPanelPicks->setDataRequested(false); | ||
1417 | |||
1378 | mPanelClassified->deleteClassifiedPanels(); | 1418 | mPanelClassified->deleteClassifiedPanels(); |
1419 | mPanelClassified->setDataRequested(false); | ||
1379 | 1420 | ||
1421 | mPanelNotes->clearControls(); | ||
1422 | mPanelNotes->setDataRequested(false); | ||
1423 | |||
1424 | // Request just the first two pages of data. The picks, | ||
1425 | // classifieds, and notes will be requested when that panel | ||
1426 | // is made visible. JC | ||
1380 | sendAvatarPropertiesRequest(); | 1427 | sendAvatarPropertiesRequest(); |
1381 | 1428 | ||
1382 | if (own_avatar) | 1429 | if (own_avatar) |
@@ -1423,25 +1470,6 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const LLString &name, | |||
1423 | childSetVisible("Mute",TRUE); | 1470 | childSetVisible("Mute",TRUE); |
1424 | childSetEnabled("Mute",FALSE); | 1471 | childSetEnabled("Mute",FALSE); |
1425 | 1472 | ||
1426 | childSetVisible("Offer Teleport...",TRUE); | ||
1427 | BOOL in_prelude = gAgent.inPrelude(); | ||
1428 | if(gAgent.isGodlike()) | ||
1429 | { | ||
1430 | childSetEnabled("Offer Teleport...", TRUE); | ||
1431 | childSetToolTip("Offer Teleport...", childGetValue("TeleportGod").asString()); | ||
1432 | } | ||
1433 | else if (in_prelude) | ||
1434 | { | ||
1435 | childSetEnabled("Offer Teleport...",FALSE); | ||
1436 | childSetToolTip("Offer Teleport...",childGetValue("TeleportPrelude").asString()); | ||
1437 | } | ||
1438 | else | ||
1439 | { | ||
1440 | // Even if user might be offline, allow a teleport offer. | ||
1441 | BOOL maybe_online = (online_status != ONLINE_STATUS_NO); | ||
1442 | childSetEnabled("Offer Teleport...", maybe_online); | ||
1443 | childSetToolTip("Offer Teleport...", childGetValue("TeleportNormal").asString()); | ||
1444 | } | ||
1445 | childSetVisible("drop target",TRUE); | 1473 | childSetVisible("drop target",TRUE); |
1446 | childSetEnabled("drop target",FALSE); | 1474 | childSetEnabled("drop target",FALSE); |
1447 | 1475 | ||
@@ -1670,12 +1698,17 @@ void LLPanelAvatar::onClickCancel(void *userdata) | |||
1670 | 1698 | ||
1671 | if (self) | 1699 | if (self) |
1672 | { | 1700 | { |
1673 | self->sendAvatarPropertiesRequest(); | ||
1674 | LLFloaterAvatarInfo *infop; | 1701 | LLFloaterAvatarInfo *infop; |
1675 | if ((infop = LLFloaterAvatarInfo::getInstance(self->mAvatarID))) | 1702 | if ((infop = LLFloaterAvatarInfo::getInstance(self->mAvatarID))) |
1676 | { | 1703 | { |
1677 | infop->close(); | 1704 | infop->close(); |
1678 | } | 1705 | } |
1706 | else | ||
1707 | { | ||
1708 | // We're in the Search directory and are cancelling an edit | ||
1709 | // to our own profile, so reset. | ||
1710 | self->sendAvatarPropertiesRequest(); | ||
1711 | } | ||
1679 | } | 1712 | } |
1680 | } | 1713 | } |
1681 | 1714 | ||
@@ -1721,16 +1754,16 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**) | |||
1721 | LLUUID image_id; | 1754 | LLUUID image_id; |
1722 | LLUUID fl_image_id; | 1755 | LLUUID fl_image_id; |
1723 | LLUUID partner_id; | 1756 | LLUUID partner_id; |
1724 | char about_text[DB_USER_ABOUT_BUF_SIZE]; | 1757 | char about_text[DB_USER_ABOUT_BUF_SIZE]; /*Flawfinder: ignore*/ |
1725 | char fl_about_text[DB_USER_FL_ABOUT_BUF_SIZE]; | 1758 | char fl_about_text[DB_USER_FL_ABOUT_BUF_SIZE]; /*Flawfinder: ignore*/ |
1726 | char born_on[DB_BORN_BUF_SIZE]; | 1759 | char born_on[DB_BORN_BUF_SIZE]; /*Flawfinder: ignore*/ |
1727 | S32 charter_member_size = 0; | 1760 | S32 charter_member_size = 0; |
1728 | BOOL allow_publish = FALSE; | 1761 | BOOL allow_publish = FALSE; |
1729 | //BOOL mature = FALSE; | 1762 | //BOOL mature = FALSE; |
1730 | BOOL identified = FALSE; | 1763 | BOOL identified = FALSE; |
1731 | BOOL transacted = FALSE; | 1764 | BOOL transacted = FALSE; |
1732 | BOOL online = FALSE; | 1765 | BOOL online = FALSE; |
1733 | char profile_url[DB_USER_PROFILE_URL_BUF_SIZE]; | 1766 | char profile_url[DB_USER_PROFILE_URL_BUF_SIZE]; /*Flawfinder: ignore*/ |
1734 | 1767 | ||
1735 | U32 flags = 0x0; | 1768 | U32 flags = 0x0; |
1736 | 1769 | ||
@@ -1786,7 +1819,7 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**) | |||
1786 | } | 1819 | } |
1787 | else if(1 < charter_member_size) | 1820 | else if(1 < charter_member_size) |
1788 | { | 1821 | { |
1789 | char caption[MAX_STRING]; | 1822 | char caption[MAX_STRING]; /*Flawfinder: ignore*/ |
1790 | msg->getString("PropertiesData", "CharterMember", MAX_STRING, caption); | 1823 | msg->getString("PropertiesData", "CharterMember", MAX_STRING, caption); |
1791 | caption_text = caption; | 1824 | caption_text = caption; |
1792 | } | 1825 | } |
@@ -1868,10 +1901,10 @@ void LLPanelAvatar::processAvatarInterestsReply(LLMessageSystem *msg, void**) | |||
1868 | LLUUID avatar_id; // target of this panel | 1901 | LLUUID avatar_id; // target of this panel |
1869 | 1902 | ||
1870 | U32 want_to_mask; | 1903 | U32 want_to_mask; |
1871 | char want_to_text[DB_USER_WANT_TO_BUF_SIZE]; | 1904 | char want_to_text[DB_USER_WANT_TO_BUF_SIZE]; /*Flawfinder: ignore*/ |
1872 | U32 skills_mask; | 1905 | U32 skills_mask; |
1873 | char skills_text[DB_USER_SKILLS_BUF_SIZE]; | 1906 | char skills_text[DB_USER_SKILLS_BUF_SIZE]; /*Flawfinder: ignore*/ |
1874 | char languages_text[DB_USER_SKILLS_BUF_SIZE]; | 1907 | char languages_text[DB_USER_SKILLS_BUF_SIZE]; /*Flawfinder: ignore*/ |
1875 | 1908 | ||
1876 | //llinfos << "properties packet size " << msg->getReceiveSize() << llendl; | 1909 | //llinfos << "properties packet size " << msg->getReceiveSize() << llendl; |
1877 | 1910 | ||
@@ -1903,9 +1936,9 @@ void LLPanelAvatar::processAvatarGroupsReply(LLMessageSystem *msg, void**) | |||
1903 | LLUUID agent_id; // your id | 1936 | LLUUID agent_id; // your id |
1904 | LLUUID avatar_id; // target of this panel | 1937 | LLUUID avatar_id; // target of this panel |
1905 | U64 group_powers; | 1938 | U64 group_powers; |
1906 | char group_title[DB_GROUP_TITLE_BUF_SIZE]; | 1939 | char group_title[DB_GROUP_TITLE_BUF_SIZE]; /*Flawfinder: ignore*/ |
1907 | LLUUID group_id; | 1940 | LLUUID group_id; |
1908 | char group_name[DB_GROUP_NAME_BUF_SIZE]; | 1941 | char group_name[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ |
1909 | LLUUID group_insignia_id; | 1942 | LLUUID group_insignia_id; |
1910 | const LLFontGL* FONT = LLFontGL::sSansSerifSmall; | 1943 | const LLFontGL* FONT = LLFontGL::sSansSerifSmall; |
1911 | 1944 | ||
@@ -2117,10 +2150,10 @@ void LLPanelAvatar::processAvatarStatisticsReply(LLMessageSystem *msg, void**) | |||
2117 | S32 items = msg->getNumberOfBlocksFast(_PREHASH_StatisticsData); | 2150 | S32 items = msg->getNumberOfBlocksFast(_PREHASH_StatisticsData); |
2118 | for (S32 i = 0; i < items; i++) | 2151 | for (S32 i = 0; i < items; i++) |
2119 | { | 2152 | { |
2120 | char name[MAX_STRING]; | 2153 | char name[MAX_STRING]; /*Flawfinder: ignore*/ |
2121 | S32 positive; | 2154 | S32 positive; |
2122 | S32 negative; | 2155 | S32 negative; |
2123 | char value_string[MAX_STRING]; | 2156 | char value_string[MAX_STRING]; /*Flawfinder: ignore*/ |
2124 | 2157 | ||
2125 | msg->getStringFast( _PREHASH_StatisticsData, | 2158 | msg->getStringFast( _PREHASH_StatisticsData, |
2126 | _PREHASH_Name, MAX_STRING, name, i); | 2159 | _PREHASH_Name, MAX_STRING, name, i); |
@@ -2134,7 +2167,7 @@ void LLPanelAvatar::processAvatarStatisticsReply(LLMessageSystem *msg, void**) | |||
2134 | item = new LLScrollListItem(); | 2167 | item = new LLScrollListItem(); |
2135 | item->addColumn( name, font, TEXT_WIDTH ); | 2168 | item->addColumn( name, font, TEXT_WIDTH ); |
2136 | 2169 | ||
2137 | sprintf( value_string, "+%d", positive); | 2170 | snprintf( value_string, sizeof(value_string), "+%d", positive); /*Flawfinder: ignore*/ |
2138 | item->addColumn( value_string, font, 50 ); | 2171 | item->addColumn( value_string, font, 50 ); |
2139 | 2172 | ||
2140 | item->addColumn("", font); // extra column to force striped appearance | 2173 | item->addColumn("", font); // extra column to force striped appearance |
@@ -2163,9 +2196,10 @@ void LLPanelAvatar::processAvatarNotesReply(LLMessageSystem *msg, void**) | |||
2163 | continue; | 2196 | continue; |
2164 | } | 2197 | } |
2165 | 2198 | ||
2166 | char text[DB_USER_NOTE_SIZE]; | 2199 | char text[DB_USER_NOTE_SIZE]; /*Flawfinder: ignore*/ |
2167 | msg->getString("Data", "Notes", DB_USER_NOTE_SIZE, text); | 2200 | msg->getString("Data", "Notes", DB_USER_NOTE_SIZE, text); |
2168 | self->childSetValue("notes edit", text); | 2201 | self->childSetValue("notes edit", text); |
2202 | self->childSetEnabled("notes edit", true); | ||
2169 | } | 2203 | } |
2170 | } | 2204 | } |
2171 | 2205 | ||