summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterland.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloaterland.cpp')
-rw-r--r--indra/newview/llfloaterland.cpp69
1 files changed, 54 insertions, 15 deletions
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 7051447409..26a179074d 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -86,6 +86,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;
@@ -102,9 +103,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
@@ -558,7 +571,7 @@ void LLPanelLandGeneral::refresh()
if (regionp)
{
- FillMaturityTextBox(mContentRating, gFloaterView->getParentFloater(this));
+ insert_maturity_into_textbox(mContentRating, gFloaterView->getParentFloater(this), MATURITY);
mLandType->setText(regionp->getSimProductName());
}
@@ -2062,8 +2075,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();
@@ -2464,19 +2483,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())
{
@@ -2862,7 +2888,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");
@@ -2944,9 +2970,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)
@@ -2974,7 +3001,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);
}