From e12ec78127ce3a52931d1b0fe62ff50cdf238960 Mon Sep 17 00:00:00 2001 From: prep linden Date: Thu, 21 Oct 2010 13:26:13 -0400 Subject: secondlife:///app/maptrackavatar/lluid secondlife:///app/sharewithavatar/lluid secondlife:///app/socialcallhandler/lluid <-work in progress --- indra/newview/llviewerinventory.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 75a5b14154..cf01792327 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -59,6 +59,7 @@ #include "llcommandhandler.h" #include "llviewermessage.h" #include "llsidepanelappearance.h" +#include "llavataractions.h" ///---------------------------------------------------------------------------- /// Helper class to store special inventory item names and their localized values. @@ -211,6 +212,37 @@ public: }; LLInventoryHandler gInventoryHandler; +//prep# share +class LLShareWithAvatarHandler : public LLCommandHandler +{ +public: + // requires trusted browser to trigger + LLShareWithAvatarHandler() : LLCommandHandler("sharewithavatar", UNTRUSTED_THROTTLE) + { + } + + bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) + { + //Make sure we have some parameters + if (params.size() == 0) + { + return false; + } + + //Get the ID + LLUUID id; + if (!id.set( params[0], FALSE )) + { + return false; + } + + //instigate share with this avatar + LLAvatarActions::share( id ); + return true; + } +}; +LLShareWithAvatarHandler gShareWithAvatar; + ///---------------------------------------------------------------------------- /// Class LLViewerInventoryItem ///---------------------------------------------------------------------------- -- cgit v1.2.3 From 03fd5c02f73467d50a10b62e982ce1dee961d315 Mon Sep 17 00:00:00 2001 From: prep linden Date: Thu, 21 Oct 2010 15:57:06 -0400 Subject: Added support for map tracking slapp, share slapp and a voice call slapp. slapp urls: secondlife:///app/maptrackavatar/lluid secondlife:///app/sharewithavatar/lluid secondlife:///app/voicecallavatar/lluid --- indra/newview/llviewerinventory.cpp | 30 ------------------------------ 1 file changed, 30 deletions(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index cf01792327..1907aaea4e 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -212,36 +212,6 @@ public: }; LLInventoryHandler gInventoryHandler; -//prep# share -class LLShareWithAvatarHandler : public LLCommandHandler -{ -public: - // requires trusted browser to trigger - LLShareWithAvatarHandler() : LLCommandHandler("sharewithavatar", UNTRUSTED_THROTTLE) - { - } - - bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) - { - //Make sure we have some parameters - if (params.size() == 0) - { - return false; - } - - //Get the ID - LLUUID id; - if (!id.set( params[0], FALSE )) - { - return false; - } - - //instigate share with this avatar - LLAvatarActions::share( id ); - return true; - } -}; -LLShareWithAvatarHandler gShareWithAvatar; ///---------------------------------------------------------------------------- /// Class LLViewerInventoryItem -- cgit v1.2.3 From d6f8efae246db921b8d52fc1f86bbf667931dd93 Mon Sep 17 00:00:00 2001 From: Andrew Productengine Date: Mon, 6 Dec 2010 18:05:44 +0200 Subject: STORM-34 FIXED Saving of user's favorites into file and showing them in "Start at" combobox on login screen was implemented. Implementation details: - File is saved on exit from viewer and not immediately on changes as was written in spec. It is done to make this file consistent with favorites order: order of favorites is saved on exit, so if favorites info is saved in other moment earlier, crashing viewer or other unexpected way of finishing its work (i.e. via Windows task bar) would cause inconsistence between favorites order saved per account and one from this new file. - File is saved in user_settings\stored_favorites.xml. - If you uncheck the option in Preferences and press OK, the file gets immediately deleted (according to spec). Issues that require further changes: - Currently only favorites of last logged in user are shown in login screen. Showing favorites of multiple users will be implemented later when design for it is approved by Esbee. - Preference is now global for all users, because design states it may be changed before login, and we don't have account info at the moment. But it doesn't seem to be a good idea, so changes in design are needed. - Currently the way of retrieving SLURLs needs optimization in a separate ticket. More detailed design approved by Esbee is needed to develop it further, perhaps in new tickets. --- indra/newview/llviewerinventory.cpp | 102 ++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 7dbaa4cf92..941e81d36f 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -48,6 +48,7 @@ #include "llinventorybridge.h" #include "llinventorypanel.h" #include "llfloaterinventory.h" +#include "lllandmarkactions.h" #include "llviewerassettype.h" #include "llviewerregion.h" @@ -59,6 +60,8 @@ #include "llcommandhandler.h" #include "llviewermessage.h" #include "llsidepanelappearance.h" +#include "llavatarnamecache.h" +#include "lllogininstance.h" ///---------------------------------------------------------------------------- /// Helper class to store special inventory item names and their localized values. @@ -1414,6 +1417,8 @@ public: S32 getSortIndex(const LLUUID& inv_item_id); void removeSortIndex(const LLUUID& inv_item_id); + void getSLURL(const LLUUID& asset_id); + /** * Implementation of LLDestroyClass. Calls cleanup() instance method. * @@ -1440,9 +1445,17 @@ private: void load(); void save(); + void saveFavoritesSLURLs(); + + void onLandmarkLoaded(const LLUUID& asset_id, LLLandmark* landmark); + void storeFavoriteSLURL(const LLUUID& asset_id, std::string& slurl); + typedef std::map sort_index_map_t; sort_index_map_t mSortIndexes; + typedef std::map slurls_map_t; + slurls_map_t mSLURLs; + bool mIsDirty; struct IsNotInFavorites @@ -1497,10 +1510,27 @@ void LLFavoritesOrderStorage::removeSortIndex(const LLUUID& inv_item_id) mIsDirty = true; } +void LLFavoritesOrderStorage::getSLURL(const LLUUID& asset_id) +{ + slurls_map_t::iterator slurl_iter = mSLURLs.find(asset_id); + if (slurl_iter != mSLURLs.end()) return; // SLURL for current landmark is already cached + + LLLandmark* lm = gLandmarkList.getAsset(asset_id, + boost::bind(&LLFavoritesOrderStorage::onLandmarkLoaded, this, asset_id, _1)); + if (lm) + { + onLandmarkLoaded(asset_id, lm); + } +} + // static void LLFavoritesOrderStorage::destroyClass() { LLFavoritesOrderStorage::instance().cleanup(); + if (gSavedSettings.getBOOL("ShowFavoritesOnLogin")) + { + LLFavoritesOrderStorage::instance().saveFavoritesSLURLs(); + } } void LLFavoritesOrderStorage::load() @@ -1523,6 +1553,77 @@ void LLFavoritesOrderStorage::load() } } +void LLFavoritesOrderStorage::saveFavoritesSLURLs() +{ + // Do not change the file if we are not logged in yet. + if (!LLLoginInstance::getInstance()->authSuccess()) return; + + std::string user_dir = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, ""); + if (user_dir.empty()) return; + + std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml"); + + const LLUUID fav_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE); + LLInventoryModel::cat_array_t cats; + LLInventoryModel::item_array_t items; + gInventory.collectDescendents(fav_id, cats, items, LLInventoryModel::EXCLUDE_TRASH); + + LLSD user_llsd; + for (LLInventoryModel::item_array_t::iterator it = items.begin(); it != items.end(); it++) + { + LLSD value; + value["name"] = (*it)->getName(); + value["asset_id"] = (*it)->getAssetUUID(); + + slurls_map_t::iterator slurl_iter = mSLURLs.find(value["asset_id"]); + if (slurl_iter != mSLURLs.end()) + { + value["slurl"] = slurl_iter->second; + } + else + { + llwarns << "Fetching SLURLs for \"Favorites\" is not complete!" << llendl; + return; + } + + user_llsd[(*it)->getSortField()] = value; + } + + LLSD fav_llsd; + // this level in LLSD is not needed now and is just a stub, but will be needed later when implementing save of multiple users favorites in one file. + LLAvatarName av_name; + LLAvatarNameCache::get( gAgentID, &av_name ); + fav_llsd[av_name.getLegacyName()] = user_llsd; + + llofstream file; + file.open(filename); + LLSDSerialize::toPrettyXML(fav_llsd, file); +} + +void LLFavoritesOrderStorage::onLandmarkLoaded(const LLUUID& asset_id, LLLandmark* landmark) +{ + if (!landmark) return; + + LLVector3d pos_global; + if (!landmark->getGlobalPos(pos_global)) + { + // If global position was unknown on first getGlobalPos() call + // it should be set for the subsequent calls. + landmark->getGlobalPos(pos_global); + } + + if (!pos_global.isExactlyZero()) + { + LLLandmarkActions::getSLURLfromPosGlobal(pos_global, + boost::bind(&LLFavoritesOrderStorage::storeFavoriteSLURL, this, asset_id, _1)); + } +} + +void LLFavoritesOrderStorage::storeFavoriteSLURL(const LLUUID& asset_id, std::string& slurl) +{ + mSLURLs[asset_id] = slurl; +} + void LLFavoritesOrderStorage::save() { // nothing to save if clean @@ -1579,6 +1680,7 @@ S32 LLViewerInventoryItem::getSortField() const void LLViewerInventoryItem::setSortField(S32 sortField) { LLFavoritesOrderStorage::instance().setSortIndex(mUUID, sortField); + LLFavoritesOrderStorage::instance().getSLURL(mAssetUUID); } const LLPermissions& LLViewerInventoryItem::getPermissions() const -- cgit v1.2.3 From 32750132db47eb335c56f6c880902cf7195e1825 Mon Sep 17 00:00:00 2001 From: Andrew Productengine Date: Thu, 9 Dec 2010 19:54:40 +0200 Subject: STORM-34 ADDITIONAL_FIX Implemented storing of multi-user favorites and showing them on login screen. - Changed the way SLURLs are cached a little, because previous one introduced problems with theit order. - Also allowed saving of favorites to disk even if not all of them received SLURL info - this is done to avoid favorites not saving when there is at least one "dead" landmark among them. - "Username" field on login screen is now not a lineeditor, but combobox (to enable autocompletion), but without button (Esbee asked for this in ticket for security reasons, and perhaps for visual consistency). - Elements of this combobox are names of users whose favorites we have saved in file. - Contents of "Start at:" combobox are changed depending on changes in "Username"- if username is present in favorites file, favorites for this user are added there. - New callback was added to LLCombobox and used in this fix, because present ones weren't enough to easily track changes in text entry. --- indra/newview/llviewerinventory.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 941e81d36f..4fa79b1855 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1562,6 +1562,13 @@ void LLFavoritesOrderStorage::saveFavoritesSLURLs() if (user_dir.empty()) return; std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml"); + llifstream in_file; + in_file.open(filename); + LLSD fav_llsd; + if (in_file.is_open()) + { + LLSDSerialize::fromXML(fav_llsd, in_file); + } const LLUUID fav_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE); LLInventoryModel::cat_array_t cats; @@ -1579,18 +1586,10 @@ void LLFavoritesOrderStorage::saveFavoritesSLURLs() if (slurl_iter != mSLURLs.end()) { value["slurl"] = slurl_iter->second; + user_llsd[(*it)->getSortField()] = value; } - else - { - llwarns << "Fetching SLURLs for \"Favorites\" is not complete!" << llendl; - return; - } - - user_llsd[(*it)->getSortField()] = value; } - LLSD fav_llsd; - // this level in LLSD is not needed now and is just a stub, but will be needed later when implementing save of multiple users favorites in one file. LLAvatarName av_name; LLAvatarNameCache::get( gAgentID, &av_name ); fav_llsd[av_name.getLegacyName()] = user_llsd; @@ -1680,6 +1679,11 @@ S32 LLViewerInventoryItem::getSortField() const void LLViewerInventoryItem::setSortField(S32 sortField) { LLFavoritesOrderStorage::instance().setSortIndex(mUUID, sortField); + getSLURL(); +} + +void LLViewerInventoryItem::getSLURL() +{ LLFavoritesOrderStorage::instance().getSLURL(mAssetUUID); } -- cgit v1.2.3 From c02d6a319f378d5dcc34c51b20f556f175d2a40a Mon Sep 17 00:00:00 2001 From: Andrew Productengine Date: Thu, 23 Dec 2010 18:15:54 +0200 Subject: STORM-34 ADDITIONAL_FIX Made saving favorites in file per-account preference instead of per-machine. - Made changes in code of floater preferences and panel login that were required because of turning the setting per-account. - Added new method to LLFloaterPreference that looks for current user's record in saved favorites file and removes it. --- indra/newview/llviewerinventory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 4fa79b1855..9c7ef7922b 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1527,7 +1527,7 @@ void LLFavoritesOrderStorage::getSLURL(const LLUUID& asset_id) void LLFavoritesOrderStorage::destroyClass() { LLFavoritesOrderStorage::instance().cleanup(); - if (gSavedSettings.getBOOL("ShowFavoritesOnLogin")) + if (gSavedPerAccountSettings.getBOOL("ShowFavoritesOnLogin")) { LLFavoritesOrderStorage::instance().saveFavoritesSLURLs(); } -- cgit v1.2.3