summaryrefslogtreecommitdiff
path: root/indra/newview/lllocationhistory.h
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2009-09-07 22:55:07 +0000
committerSteven Bennetts <steve@lindenlab.com>2009-09-07 22:55:07 +0000
commit79653dfed48105019b8ecca9cf4bfaa2a390e100 (patch)
tree455943795bf3371bbff0689604cf5eedd903fae4 /indra/newview/lllocationhistory.h
parenta9b2296b2b5664cfc8d86c7f99c00c10268e250a (diff)
merge https://svn.aws.productengine.com/secondlife/export-from-ll/viewer-2-0@1566 https://svn.aws.productengine.com/secondlife/pe/stable-2@1580 -> viewer-2.0.0-3
* Bugs: EXT-807 EXT-810 EXT-811 EXT-784 EXT-820 EXT-393 EXT-826 EXT-811 EXT-801 EXT-808 EXT-393 EXT-743 EXT-699 EXT-397 EXT-812 EXT-736 EXT-744 EXT-809 EXT-306 EXT-854 EXT-857 EXT-790 * New Dev: EXT-694 EXT-393 EXT-367 EXT-819 EXT-795 EXT-827 EXT-788 * EXT-272 - Draggable Landmarks * EXT-715 - Block List Panel * EXT-782 - Implement advanced place information accordions
Diffstat (limited to 'indra/newview/lllocationhistory.h')
-rw-r--r--indra/newview/lllocationhistory.h77
1 files changed, 69 insertions, 8 deletions
diff --git a/indra/newview/lllocationhistory.h b/indra/newview/lllocationhistory.h
index 060a6b2fe8..5f9976f87a 100644
--- a/indra/newview/lllocationhistory.h
+++ b/indra/newview/lllocationhistory.h
@@ -40,21 +40,84 @@
#include <map>
#include <boost/function.hpp>
+class LLSD;
+
+enum ELocationType {
+ TYPED_REGION_SURL//region name or surl
+ ,LANDMARK // name of landmark
+ ,TELEPORT_HISTORY
+ };
+class LLLocationHistoryItem {
+
+public:
+ LLLocationHistoryItem(){}
+ LLLocationHistoryItem(std::string typed_location,
+ LLVector3d global_position, std::string tooltip,ELocationType type ):
+ mLocation(typed_location),
+ mGlobalPos(global_position),
+ mToolTip(tooltip),
+ mType(type)
+ {}
+ LLLocationHistoryItem(const LLLocationHistoryItem& item):
+ mGlobalPos(item.mGlobalPos),
+ mToolTip(item.mToolTip),
+ mLocation(item.mLocation),
+ mType(item.mType)
+ {}
+ LLLocationHistoryItem(const LLSD& data):
+ mLocation(data["location"]),
+ mGlobalPos(data["global_pos"]),
+ mToolTip(data["tooltip"]),
+ mType(ELocationType(data["item_type"].asInteger()))
+ {}
+
+ bool operator==(const LLLocationHistoryItem& item)
+ {
+ // do not compare mGlobalPos,
+ // because of a rounding off , the history can contain duplicates
+ return mLocation == item.mLocation && (mType == item.mType);
+ }
+ bool operator!=(const LLLocationHistoryItem& item)
+ {
+ return ! (*this == item);
+ }
+ LLSD toLLSD() const
+ {
+ LLSD val;
+ val["location"]= mLocation;
+ val["global_pos"] = mGlobalPos.getValue();
+ val["tooltip"] = mToolTip;
+ val["item_type"] = mType;
+ return val;
+ }
+ const std::string& getLocation() const { return mLocation; };
+ const std::string& getToolTip() const { return mToolTip; };
+ //static bool equalByRegionParcel(const LLLocationHistoryItem& item1, const LLLocationHistoryItem& item2);
+ static bool equalByLocation(const LLLocationHistoryItem& item1, const std::string& item_location)
+ {
+ return item1.getLocation() == item_location;
+ }
+
+ LLVector3d mGlobalPos; // global position
+ std::string mToolTip;// SURL
+ std::string mLocation;// typed_location
+ ELocationType mType;
+};
+
class LLLocationHistory: public LLSingleton<LLLocationHistory>
{
LOG_CLASS(LLLocationHistory);
public:
- typedef std::vector<std::string> location_list_t;
+ typedef std::vector<LLLocationHistoryItem> location_list_t;
typedef boost::function<void()> loaded_callback_t;
typedef boost::signals2::signal<void()> loaded_signal_t;
LLLocationHistory();
- void addItem(const std::string & item, const std::string & tooltip);
- bool touchItem(const std::string & item);
+ void addItem(const LLLocationHistoryItem& item);
+ bool touchItem(const LLLocationHistoryItem& item);
void removeItems();
- std::string getToolTip(const std::string & item) const;
size_t getItemCount() const { return mItems.size(); }
const location_list_t& getItems() const { return mItems; }
bool getMatchingItems(std::string substring, location_list_t& result) const;
@@ -65,10 +128,8 @@ public:
void dump() const;
private:
- bool equalByRegionParcel(const std::string& item, const std::string& item_to_add);
- const static char delimiter;
- std::vector<std::string> mItems;
- std::map<std::string, std::string> mToolTips;
+
+ location_list_t mItems;
std::string mFilename; /// File to store the history to.
loaded_signal_t mLoadedSignal;
};