no ticket. minor changes. Comments cleaning up. The logic was NOT changed.

--HG--
branch : product-engine
meow-7.2.2
Denis Serdjuk 2010-02-19 18:47:21 +02:00
parent fa72384d33
commit 6a3ea6fa61
3 changed files with 19 additions and 11 deletions

View File

@ -41,11 +41,13 @@
#include <boost/function.hpp>
class LLSD;
/**
* This enum is responsible for identifying of history item.
*/
enum ELocationType {
TYPED_REGION_SURL//region name or surl
,LANDMARK // name of landmark
,TELEPORT_HISTORY
TYPED_REGION_SLURL//item added after the user had typed a region name or slurl
,LANDMARK // item has been loaded from landmark folder
,TELEPORT_HISTORY // item from session teleport history
};
class LLLocationHistoryItem {

View File

@ -664,7 +664,7 @@ void LLLocationInputCtrl::onLocationPrearrange(const LLSD& data)
value["item_type"] = TELEPORT_HISTORY;
value["global_pos"] = result->mGlobalPos.getValue();
std::string region_name = result->mTitle.substr(0, result->mTitle.find(','));
//TODO*: add Surl to teleportitem or parse region name from title
//TODO*: add slurl to teleportitem or parse region name from title
value["tooltip"] = LLSLURL::buildSLURLfromPosGlobal(region_name,
result->mGlobalPos, false);
add(result->getTitle(), value);
@ -914,7 +914,7 @@ void LLLocationInputCtrl::rebuildLocationHistory(std::string filter)
LLSD value;
value["tooltip"] = it->getToolTip();
//location history can contain only typed locations
value["item_type"] = TYPED_REGION_SURL;
value["item_type"] = TYPED_REGION_SLURL;
value["global_pos"] = it->mGlobalPos.getValue();
add(it->getLocation(), value);
}

View File

@ -449,8 +449,14 @@ void LLNavigationBar::onLocationSelection()
// Will not teleport to empty location.
if (typed_location.empty())
return;
//get selected item from combobox item
LLSD value = mCmbLocation->getSelectedValue();
/* since navbar list support autocompletion it contains several types of item: landmark, teleport hystory item,
* typed by user slurl or region name. Let's find out which type of item the user has selected
* to make decision about adding this location into typed history. see mSaveToLocationHistory
* Note:
* Only TYPED_REGION_SLURL item will be added into LLLocationHistory
*/
if(value.has("item_type"))
{
@ -480,7 +486,7 @@ void LLNavigationBar::onLocationSelection()
case TELEPORT_HISTORY:
//in case of teleport item was selected, teleport by position too.
case TYPED_REGION_SURL:
case TYPED_REGION_SLURL:
if(value.has("global_pos"))
{
gAgent.teleportViaLocation(LLVector3d(value["global_pos"]));
@ -492,7 +498,7 @@ void LLNavigationBar::onLocationSelection()
break;
}
}
//Let's parse surl or region name
//Let's parse slurl or region name
std::string region_name;
LLVector3 local_coords(128, 128, 0);
@ -541,7 +547,7 @@ void LLNavigationBar::onTeleportFinished(const LLVector3d& global_agent_pos)
return;
LLLocationHistory* lh = LLLocationHistory::getInstance();
//TODO*: do we need convert surl into readable format?
//TODO*: do we need convert slurl into readable format?
std::string location;
/*NOTE:
* We can't use gAgent.getPositionAgent() in case of local teleport to build location.
@ -553,7 +559,7 @@ void LLNavigationBar::onTeleportFinished(const LLVector3d& global_agent_pos)
std::string tooltip (LLSLURL::buildSLURLfromPosGlobal(gAgent.getRegion()->getName(), global_agent_pos, false));
LLLocationHistoryItem item (location,
global_agent_pos, tooltip,TYPED_REGION_SURL);// we can add into history only TYPED location
global_agent_pos, tooltip,TYPED_REGION_SLURL);// we can add into history only TYPED location
//Touch it, if it is at list already, add new location otherwise
if ( !lh->touchItem(item) ) {
lh->addItem(item);