From 8ae52e2b90e9767787c14f0ac8a0bc6cc5f1df73 Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Sat, 6 Mar 2010 00:17:16 +0200 Subject: Partially implemented nice-to have sub-task EXT-4706 (Add maturity icons to About Land). - Added maturity icons to General and Covenant tabs. --HG-- branch : product-engine --- indra/newview/llfloaterland.cpp | 43 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloaterland.cpp') diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 26c6db9652..fa7d7e3a38 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -102,6 +102,10 @@ public: virtual void changed() { LLFloaterLand::refreshAll(); } }; +// fills target textbox with maturity info(icon and text) +// names_floater - pointer to floater which contains strings with maturity icons filenames +void FillMaturityTextBox(LLTextBox* target_textbox, LLFloater* names_floater); + //--------------------------------------------------------------------------- // LLFloaterLand //--------------------------------------------------------------------------- @@ -554,7 +558,7 @@ void LLPanelLandGeneral::refresh() if (regionp) { - mContentRating->setText(regionp->getSimAccessString()); + FillMaturityTextBox(mContentRating, gFloaterView->getParentFloater(this)); mLandType->setText(regionp->getSimProductName()); } @@ -2858,7 +2862,7 @@ void LLPanelLandCovenant::refresh() LLTextBox* region_maturity = getChild("region_maturity_text"); if (region_maturity) { - region_maturity->setText(region->getSimAccessString()); + FillMaturityTextBox(region_maturity, gFloaterView->getParentFloater(this)); } LLTextBox* resellable_clause = getChild("resellable_clause"); @@ -2939,3 +2943,38 @@ void LLPanelLandCovenant::updateEstateOwnerName(const std::string& name) if (editor) editor->setText(name); } } + +// fills target textbox with maturity info(icon and text) +// names_floater - pointer to floater which contains strings with maturity icons filenames +void FillMaturityTextBox(LLTextBox* target_textbox, LLFloater* names_floater) +{ + 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; + } + + // any text may be here instead of "icon" except "" + target_textbox->setText(std::string("icon"),style); + target_textbox->appendText(LLViewerParcelMgr::getInstance()->getSelectionRegion()->getSimAccessString(), false); +} \ No newline at end of file -- cgit v1.2.3 From 24810564a3332c63edbed0f447e1244e33a45e17 Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Sat, 6 Mar 2010 00:22:46 +0200 Subject: Fixed linux build --HG-- branch : product-engine --- indra/newview/llfloaterland.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloaterland.cpp') diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index fa7d7e3a38..7051447409 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -2977,4 +2977,4 @@ void FillMaturityTextBox(LLTextBox* target_textbox, LLFloater* names_floater) // any text may be here instead of "icon" except "" target_textbox->setText(std::string("icon"),style); target_textbox->appendText(LLViewerParcelMgr::getInstance()->getSelectionRegion()->getSimAccessString(), false); -} \ No newline at end of file +} -- cgit v1.2.3 From a45544f9a0adca7bd765929ffe321756ffb09609 Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Tue, 9 Mar 2010 22:54:45 +0200 Subject: Implemented nice-to have sub-task EXT-4706 (Add maturity icons to About Land). - Added maturity icons to Options and Access tabs. - Created auxiliary local class to get full access to checkboxes' textboxes. --HG-- branch : product-engine --- indra/newview/llfloaterland.cpp | 69 ++++++++++++++++++++++++++++++++--------- 1 file changed, 54 insertions(+), 15 deletions(-) (limited to 'indra/newview/llfloaterland.cpp') 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( "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("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("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); } -- cgit v1.2.3 From 61e6c888f04bdcf2e9c0b4cb9754c7827f831e35 Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Fri, 12 Mar 2010 12:09:22 +0200 Subject: fixed EXT-3607 (Cancelling a Land Sale to Specific Person Allows Land to be Set For Sale to Anyone Briefly) added additional check so that "for sale to anyone" text is shown only when a parcel is on sale reviewed by Richard at https://codereview.productengine.com/secondlife/r/4/ --HG-- branch : product-engine --- indra/newview/llfloaterland.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'indra/newview/llfloaterland.cpp') diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 26a179074d..65003d9b5c 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -820,16 +820,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::buildCommand("agent", auth_buyer_id, "inspect"); - 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::buildCommand("agent", auth_buyer_id, "inspect"); + mSaleInfoForSale2->setTextArg("[BUYER]", name); + } + else + { + mSaleInfoForSale2->setTextArg("[BUYER]", getString("anyone")); + } } } -- cgit v1.2.3