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.cpp119
1 files changed, 100 insertions, 19 deletions
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 26c6db9652..65003d9b5c 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,6 +103,22 @@ public:
virtual void changed() { LLFloaterLand::refreshAll(); }
};
+// 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
+// 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
//---------------------------------------------------------------------------
@@ -554,7 +571,7 @@ void LLPanelLandGeneral::refresh()
if (regionp)
{
- mContentRating->setText(regionp->getSimAccessString());
+ insert_maturity_into_textbox(mContentRating, gFloaterView->getParentFloater(this), MATURITY);
mLandType->setText(regionp->getSimProductName());
}
@@ -803,16 +820,19 @@ void LLPanelLandGeneral::refreshNames()
}
mTextGroup->setText(group);
- const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID();
- if(auth_buyer_id.notNull())
- {
- std::string name;
- name = LLSLURL::buildCommand("agent", auth_buyer_id, "inspect");
- mSaleInfoForSale2->setTextArg("[BUYER]", name);
- }
- else
+ if (parcel->getForSale())
{
- mSaleInfoForSale2->setTextArg("[BUYER]", getString("anyone"));
+ const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID();
+ if(auth_buyer_id.notNull())
+ {
+ std::string name;
+ name = LLSLURL::buildCommand("agent", auth_buyer_id, "inspect");
+ mSaleInfoForSale2->setTextArg("[BUYER]", name);
+ }
+ else
+ {
+ mSaleInfoForSale2->setTextArg("[BUYER]", getString("anyone"));
+ }
}
}
@@ -2058,8 +2078,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();
@@ -2460,19 +2486,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())
{
@@ -2858,7 +2891,7 @@ void LLPanelLandCovenant::refresh()
LLTextBox* region_maturity = getChild<LLTextBox>("region_maturity_text");
if (region_maturity)
{
- region_maturity->setText(region->getSimAccessString());
+ insert_maturity_into_textbox(region_maturity, gFloaterView->getParentFloater(this), MATURITY);
}
LLTextBox* resellable_clause = getChild<LLTextBox>("resellable_clause");
@@ -2939,3 +2972,51 @@ void LLPanelLandCovenant::updateEstateOwnerName(const std::string& name)
if (editor) editor->setText(name);
}
}
+
+// inserts maturity info(icon and text) into target textbox
+// names_floater - pointer to floater which contains strings with maturity icons filenames
+// 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)
+ return;
+
+ LLStyle::Params style;
+
+ U8 sim_access = region->getSimAccess();
+
+ switch(sim_access)
+ {
+ case SIM_ACCESS_PG:
+ style.image(LLUI::getUIImage(names_floater->getString("maturity_icon_general")));
+ break;
+
+ case SIM_ACCESS_ADULT:
+ style.image(LLUI::getUIImage(names_floater->getString("maturity_icon_adult")));
+ break;
+
+ case SIM_ACCESS_MATURE:
+ style.image(LLUI::getUIImage(names_floater->getString("maturity_icon_moderate")));
+ break;
+
+ default:
+ 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->appendText(std::string("icon"), false, style);
+ target_textbox->appendText(LLViewerParcelMgr::getInstance()->getSelectionRegion()->getSimAccessString(), false);
+ target_textbox->appendText(text_after_rating, false);
+}