diff options
Diffstat (limited to 'indra/newview/llfloaterland.cpp')
-rw-r--r-- | indra/newview/llfloaterland.cpp | 90 |
1 files changed, 66 insertions, 24 deletions
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 62e539b9c9..282760f988 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -85,6 +85,7 @@ static std::string OWNER_ONLINE = "0"; static std::string OWNER_OFFLINE = "1"; static std::string OWNER_GROUP = "2"; +static std::string MATURITY = "[MATURITY]"; // constants used in callbacks below - syntactic sugar. static const BOOL BUY_GROUP_LAND = TRUE; @@ -101,9 +102,21 @@ public: virtual void changed() { LLFloaterLand::refreshAll(); } }; -// fills target textbox with maturity info(icon and text) +// class needed to get full access to textbox inside checkbox, because LLCheckBoxCtrl::setLabel() has string as its argument. +// It was introduced while implementing EXT-4706 +class LLCheckBoxWithTBAcess : public LLCheckBoxCtrl +{ +public: + LLTextBox* getTextBox() + { + return mLabel; + } +}; + +// inserts maturity info(icon and text) into target textbox // names_floater - pointer to floater which contains strings with maturity icons filenames -void FillMaturityTextBox(LLTextBox* target_textbox, LLFloater* names_floater); +// str_to_parse is string in format "txt1[MATURITY]txt2" where maturity icon and text will be inserted instead of [MATURITY] +void insert_maturity_into_textbox(LLTextBox* target_textbox, LLFloater* names_floater, std::string str_to_parse); //--------------------------------------------------------------------------- // LLFloaterLand @@ -557,7 +570,7 @@ void LLPanelLandGeneral::refresh() if (regionp) { - FillMaturityTextBox(mContentRating, gFloaterView->getParentFloater(this)); + insert_maturity_into_textbox(mContentRating, gFloaterView->getParentFloater(this), MATURITY); mLandType->setText(regionp->getSimProductName()); } @@ -806,16 +819,19 @@ void LLPanelLandGeneral::refreshNames() } mTextGroup->setText(group); - const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID(); - if(auth_buyer_id.notNull()) + if (parcel->getForSale()) { - std::string name; - name = LLSLURL("agent", auth_buyer_id, "inspect").getSLURLString(); - mSaleInfoForSale2->setTextArg("[BUYER]", name); - } - else - { - mSaleInfoForSale2->setTextArg("[BUYER]", getString("anyone")); + const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID(); + if(auth_buyer_id.notNull()) + { + std::string name; + name = LLSLURL("agent", auth_buyer_id, "inspect").getSLURLString(); + mSaleInfoForSale2->setTextArg("[BUYER]", name); + } + else + { + mSaleInfoForSale2->setTextArg("[BUYER]", getString("anyone")); + } } } @@ -2061,8 +2077,14 @@ void LLPanelLandOptions::refresh() { // not teen so fill in the data for the maturity control mMatureCtrl->setVisible(TRUE); - mMatureCtrl->setLabel(getString("mature_check_mature")); - mMatureCtrl->setToolTip(getString("mature_check_mature_tooltip")); + LLStyle::Params style; + style.image(LLUI::getUIImage(gFloaterView->getParentFloater(this)->getString("maturity_icon_moderate"))); + LLCheckBoxWithTBAcess* fullaccess_mature_ctrl = (LLCheckBoxWithTBAcess*)mMatureCtrl; + fullaccess_mature_ctrl->getTextBox()->setText(std::string("icon"),style); + fullaccess_mature_ctrl->getTextBox()->appendText(getString("mature_check_mature"), false); + fullaccess_mature_ctrl->setToolTip(getString("mature_check_mature_tooltip")); + fullaccess_mature_ctrl->reshape(fullaccess_mature_ctrl->getRect().getWidth(), fullaccess_mature_ctrl->getRect().getHeight(), FALSE); + // they can see the checkbox, but its disposition depends on the // state of the region LLViewerRegion* regionp = LLViewerParcelMgr::getInstance()->getSelectionRegion(); @@ -2463,19 +2485,26 @@ void LLPanelLandAccess::refresh() } } + LLCheckBoxWithTBAcess* maturity_checkbox = (LLCheckBoxWithTBAcess*) getChild<LLCheckBoxCtrl>( "public_access"); LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); if(region) { - std::string region_access = "("; - region_access += region->getSimAccessString(); - region_access += ")"; - childSetLabelArg( "public_access", "[MATURITY]", region_access ); + LLTextBox* maturity_textbox = maturity_checkbox->getTextBox(); + insert_maturity_into_textbox(maturity_textbox, gFloaterView->getParentFloater(this), getString("allow_public_access")); + maturity_checkbox->reshape(maturity_checkbox->getRect().getWidth(), maturity_checkbox->getRect().getHeight(), FALSE); } else { - childSetLabelArg( "public_access", "[MATURITY]", std::string() ); - } + std::string maturity_string = getString("allow_public_access"); + size_t maturity_pos = maturity_string.find(MATURITY); + if (maturity_pos != std::string::npos) + { + maturity_string.replace(maturity_pos, MATURITY.length(), std::string("")); + } + + maturity_checkbox->setLabel(maturity_string); + } if(parcel->getRegionDenyAnonymousOverride()) { @@ -2861,7 +2890,7 @@ void LLPanelLandCovenant::refresh() LLTextBox* region_maturity = getChild<LLTextBox>("region_maturity_text"); if (region_maturity) { - FillMaturityTextBox(region_maturity, gFloaterView->getParentFloater(this)); + insert_maturity_into_textbox(region_maturity, gFloaterView->getParentFloater(this), MATURITY); } LLTextBox* resellable_clause = getChild<LLTextBox>("resellable_clause"); @@ -2943,9 +2972,10 @@ void LLPanelLandCovenant::updateEstateOwnerName(const std::string& name) } } -// fills target textbox with maturity info(icon and text) +// inserts maturity info(icon and text) into target textbox // names_floater - pointer to floater which contains strings with maturity icons filenames -void FillMaturityTextBox(LLTextBox* target_textbox, LLFloater* names_floater) +// str_to_parse is string in format "txt1[MATURITY]txt2" where maturity icon and text will be inserted instead of [MATURITY] +void insert_maturity_into_textbox(LLTextBox* target_textbox, LLFloater* names_floater, std::string str_to_parse) { LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); if (!region) @@ -2973,7 +3003,19 @@ void FillMaturityTextBox(LLTextBox* target_textbox, LLFloater* names_floater) break; } + size_t maturity_pos = str_to_parse.find(MATURITY); + + if (maturity_pos == std::string::npos) + { + return; + } + + std::string text_before_rating = str_to_parse.substr(0, maturity_pos); + std::string text_after_rating = str_to_parse.substr(maturity_pos + MATURITY.length()); + + target_textbox->setText(text_before_rating); // any text may be here instead of "icon" except "" - target_textbox->setText(std::string("icon"),style); + target_textbox->appendText(std::string("icon"), false, style); target_textbox->appendText(LLViewerParcelMgr::getInstance()->getSelectionRegion()->getSimAccessString(), false); + target_textbox->appendText(text_after_rating, false); } |