aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpanelgroupgeneral.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:50 -0500
committerJacek Antonelli2008-08-15 23:45:50 -0500
commit2a4dea528f670b9bb1f77ef27a8a1dd16603d114 (patch)
tree95c68e362703c9099d571ecbdc6142b1cda1e005 /linden/indra/newview/llpanelgroupgeneral.cpp
parentSecond Life viewer sources 1.20.6 (diff)
downloadmeta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.zip
meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.gz
meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.bz2
meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.xz
Second Life viewer sources 1.20.7
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llpanelgroupgeneral.cpp99
1 files changed, 81 insertions, 18 deletions
diff --git a/linden/indra/newview/llpanelgroupgeneral.cpp b/linden/indra/newview/llpanelgroupgeneral.cpp
index 1709ad2..a7eac37 100644
--- a/linden/indra/newview/llpanelgroupgeneral.cpp
+++ b/linden/indra/newview/llpanelgroupgeneral.cpp
@@ -54,6 +54,11 @@
54#include "lltexturectrl.h" 54#include "lltexturectrl.h"
55#include "llviewerwindow.h" 55#include "llviewerwindow.h"
56 56
57// consts
58const S32 MATURE_CONTENT = 1;
59const S32 NON_MATURE_CONTENT = 2;
60const S32 DECLINE_TO_STATE = 0;
61
57// static 62// static
58void* LLPanelGroupGeneral::createTab(void* data) 63void* LLPanelGroupGeneral::createTab(void* data)
59{ 64{
@@ -76,7 +81,7 @@ LLPanelGroupGeneral::LLPanelGroupGeneral(const std::string& name,
76 mBtnJoinGroup(NULL), 81 mBtnJoinGroup(NULL),
77 mListVisibleMembers(NULL), 82 mListVisibleMembers(NULL),
78 mCtrlShowInGroupList(NULL), 83 mCtrlShowInGroupList(NULL),
79 mCtrlMature(NULL), 84 mComboMature(NULL),
80 mCtrlOpenEnrollment(NULL), 85 mCtrlOpenEnrollment(NULL),
81 mCtrlEnrollmentFee(NULL), 86 mCtrlEnrollmentFee(NULL),
82 mSpinEnrollmentFee(NULL), 87 mSpinEnrollmentFee(NULL),
@@ -156,14 +161,19 @@ BOOL LLPanelGroupGeneral::postBuild()
156 mCtrlShowInGroupList->setCallbackUserData(this); 161 mCtrlShowInGroupList->setCallbackUserData(this);
157 } 162 }
158 163
159 mCtrlMature = getChild<LLCheckBoxCtrl>("mature", recurse); 164 mComboMature = getChild<LLComboBox>("group_mature_check", recurse);
160 if (mCtrlMature) 165 if(mComboMature)
161 { 166 {
162 mCtrlMature->setCommitCallback(onCommitAny); 167 mComboMature->setCurrentByIndex(0);
163 mCtrlMature->setCallbackUserData(this); 168 mComboMature->setCommitCallback(onCommitAny);
164 mCtrlMature->setVisible( !gAgent.isTeen() ); 169 mComboMature->setCallbackUserData(this);
170 if (gAgent.isTeen())
171 {
172 // Teens don't get to set mature flag. JC
173 mComboMature->setVisible(FALSE);
174 mComboMature->setCurrentByIndex(NON_MATURE_CONTENT);
175 }
165 } 176 }
166
167 mCtrlOpenEnrollment = getChild<LLCheckBoxCtrl>("open_enrollement", recurse); 177 mCtrlOpenEnrollment = getChild<LLCheckBoxCtrl>("open_enrollement", recurse);
168 if (mCtrlOpenEnrollment) 178 if (mCtrlOpenEnrollment)
169 { 179 {
@@ -231,7 +241,7 @@ BOOL LLPanelGroupGeneral::postBuild()
231 mEditCharter->setEnabled(TRUE); 241 mEditCharter->setEnabled(TRUE);
232 242
233 mCtrlShowInGroupList->setEnabled(TRUE); 243 mCtrlShowInGroupList->setEnabled(TRUE);
234 mCtrlMature->setEnabled(TRUE); 244 mComboMature->setEnabled(TRUE);
235 mCtrlOpenEnrollment->setEnabled(TRUE); 245 mCtrlOpenEnrollment->setEnabled(TRUE);
236 mCtrlEnrollmentFee->setEnabled(TRUE); 246 mCtrlEnrollmentFee->setEnabled(TRUE);
237 mSpinEnrollmentFee->setEnabled(TRUE); 247 mSpinEnrollmentFee->setEnabled(TRUE);
@@ -429,6 +439,16 @@ bool LLPanelGroupGeneral::apply(LLString& mesg)
429 if (has_power_in_group || mGroupID.isNull()) 439 if (has_power_in_group || mGroupID.isNull())
430 { 440 {
431 llinfos << "LLPanelGroupGeneral::apply" << llendl; 441 llinfos << "LLPanelGroupGeneral::apply" << llendl;
442
443 // Check to make sure mature has been set
444 if(mComboMature->getCurrentIndex() == DECLINE_TO_STATE)
445 {
446 LLString::format_map_t args;
447 gViewerWindow->alertXml("SetGroupMature", &callbackConfirmMatureApply,
448 new LLHandle<LLPanel>(getHandle()));
449 return false;
450 }
451
432 if (mGroupID.isNull()) 452 if (mGroupID.isNull())
433 { 453 {
434 // Validate the group name length. 454 // Validate the group name length.
@@ -446,13 +466,12 @@ bool LLPanelGroupGeneral::apply(LLString& mesg)
446 LLString::format_map_t args; 466 LLString::format_map_t args;
447 args["[MESSAGE]"] = mConfirmGroupCreateStr; 467 args["[MESSAGE]"] = mConfirmGroupCreateStr;
448 gViewerWindow->alertXml("GenericAlertYesCancel", args, 468 gViewerWindow->alertXml("GenericAlertYesCancel", args,
449 createGroupCallback,new LLHandle<LLPanel>(getHandle())); 469 createGroupCallback, new LLHandle<LLPanel>(getHandle()) );
450 470
451 return false; 471 return false;
452 } 472 }
453 473
454 LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); 474 LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
455
456 if (!gdatap) 475 if (!gdatap)
457 { 476 {
458 mesg = "No group data found for group "; 477 mesg = "No group data found for group ";
@@ -468,11 +487,12 @@ bool LLPanelGroupGeneral::apply(LLString& mesg)
468 { 487 {
469 if (mEditCharter) gdatap->mCharter = mEditCharter->getText(); 488 if (mEditCharter) gdatap->mCharter = mEditCharter->getText();
470 if (mInsignia) gdatap->mInsigniaID = mInsignia->getImageAssetID(); 489 if (mInsignia) gdatap->mInsigniaID = mInsignia->getImageAssetID();
471 if (mCtrlMature) 490 if (mComboMature)
472 { 491 {
473 if (!gAgent.isTeen()) 492 if (!gAgent.isTeen())
474 { 493 {
475 gdatap->mMaturePublish = mCtrlMature->get(); 494 gdatap->mMaturePublish =
495 mComboMature->getCurrentIndex() == MATURE_CONTENT;
476 } 496 }
477 else 497 else
478 { 498 {
@@ -523,6 +543,42 @@ void LLPanelGroupGeneral::cancel()
523 notifyObservers(); 543 notifyObservers();
524} 544}
525 545
546
547// static
548void LLPanelGroupGeneral::callbackConfirmMatureApply(S32 option, void* data)
549{
550 LLHandle<LLPanel>* handlep = (LLHandle<LLPanel>*)data;
551 LLPanelGroupGeneral* self = dynamic_cast<LLPanelGroupGeneral*>(handlep->get());
552 delete handlep;
553 if (self)
554 {
555 self->confirmMatureApply(option);
556 }
557}
558
559// invoked from callbackConfirmMature
560void LLPanelGroupGeneral::confirmMatureApply(S32 option)
561{
562 // 0 == Yes
563 // 1 == No
564 // 2 == Cancel
565 switch(option)
566 {
567 case 0:
568 mComboMature->setCurrentByIndex(MATURE_CONTENT);
569 break;
570 case 1:
571 mComboMature->setCurrentByIndex(NON_MATURE_CONTENT);
572 break;
573 default:
574 return;
575 }
576
577 // If we got here it means they set a valid value
578 LLString mesg = "";
579 apply(mesg);
580}
581
526// static 582// static
527void LLPanelGroupGeneral::createGroupCallback(S32 option, void* userdata) 583void LLPanelGroupGeneral::createGroupCallback(S32 option, void* userdata)
528{ 584{
@@ -547,7 +603,7 @@ void LLPanelGroupGeneral::createGroupCallback(S32 option, void* userdata)
547 enrollment_fee, 603 enrollment_fee,
548 self->mCtrlOpenEnrollment->get(), 604 self->mCtrlOpenEnrollment->get(),
549 false, 605 false,
550 self->mCtrlMature->get()); 606 self->mComboMature->getCurrentIndex() == MATURE_CONTENT);
551 607
552 } 608 }
553 break; 609 break;
@@ -632,11 +688,18 @@ void LLPanelGroupGeneral::update(LLGroupChange gc)
632 mCtrlShowInGroupList->set(gdatap->mShowInList); 688 mCtrlShowInGroupList->set(gdatap->mShowInList);
633 mCtrlShowInGroupList->setEnabled(mAllowEdit && can_change_ident); 689 mCtrlShowInGroupList->setEnabled(mAllowEdit && can_change_ident);
634 } 690 }
635 if (mCtrlMature) 691 if (mComboMature)
636 { 692 {
637 mCtrlMature->set(gdatap->mMaturePublish); 693 if(gdatap->mMaturePublish)
638 mCtrlMature->setEnabled(mAllowEdit && can_change_ident); 694 {
639 mCtrlMature->setVisible( !gAgent.isTeen() ); 695 mComboMature->setCurrentByIndex(MATURE_CONTENT);
696 }
697 else
698 {
699 mComboMature->setCurrentByIndex(NON_MATURE_CONTENT);
700 }
701 mComboMature->setEnabled(mAllowEdit && can_change_ident);
702 mComboMature->setVisible( !gAgent.isTeen() );
640 } 703 }
641 if (mCtrlOpenEnrollment) 704 if (mCtrlOpenEnrollment)
642 { 705 {
@@ -820,7 +883,7 @@ void LLPanelGroupGeneral::updateChanged()
820 mInsignia, 883 mInsignia,
821 mEditCharter, 884 mEditCharter,
822 mCtrlShowInGroupList, 885 mCtrlShowInGroupList,
823 mCtrlMature, 886 mComboMature,
824 mCtrlOpenEnrollment, 887 mCtrlOpenEnrollment,
825 mCtrlEnrollmentFee, 888 mCtrlEnrollmentFee,
826 mSpinEnrollmentFee, 889 mSpinEnrollmentFee,