merge changes for storm-826

meow-7.2.2
Oz Linden 2011-01-07 16:44:38 -05:00
commit 8a939212f4
15 changed files with 309 additions and 26 deletions

View File

@ -42,3 +42,4 @@ dc6483491b4af559060bccaef8e9045a303212dd 2.4.0-beta1
3bc1f50a72e117f4d4ad8d555f0c785ea8cc201e 2.4.0-beta1
25bd6007e3d2fc15db9326ed4b18a24a5969a46a 2.4.0-beta2
1ed382c6a08ba3850b6ce9061bc551ddece0ea07 2.4.0-release
a82e5b1e22c7f90e3c7977d146b80588f004ed0d 2.5.0-start

View File

@ -28,7 +28,7 @@
#define LL_LLVERSIONVIEWER_H
const S32 LL_VERSION_MAJOR = 2;
const S32 LL_VERSION_MINOR = 5;
const S32 LL_VERSION_MINOR = 6;
const S32 LL_VERSION_PATCH = 0;
const S32 LL_VERSION_BUILD = 0;

View File

@ -94,6 +94,7 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p)
mMaxChars(p.max_chars),
mPrearrangeCallback(p.prearrange_callback()),
mTextEntryCallback(p.text_entry_callback()),
mTextChangedCallback(p.text_changed_callback()),
mListPosition(p.list_position),
mLastSelectedIndex(-1),
mLabel(p.label)
@ -834,6 +835,10 @@ void LLComboBox::onTextEntry(LLLineEditor* line_editor)
mList->deselectAllItems();
mLastSelectedIndex = -1;
}
if (mTextChangedCallback != NULL)
{
(mTextChangedCallback)(line_editor, LLSD());
}
return;
}
@ -878,6 +883,10 @@ void LLComboBox::onTextEntry(LLLineEditor* line_editor)
// RN: presumably text entry
updateSelection();
}
if (mTextChangedCallback != NULL)
{
(mTextChangedCallback)(line_editor, LLSD());
}
}
void LLComboBox::updateSelection()

View File

@ -73,7 +73,8 @@ public:
allow_new_values;
Optional<S32> max_chars;
Optional<commit_callback_t> prearrange_callback,
text_entry_callback;
text_entry_callback,
text_changed_callback;
Optional<EPreferredPosition, PreferredPositionValues> list_position;
@ -190,6 +191,7 @@ public:
void setPrearrangeCallback( commit_callback_t cb ) { mPrearrangeCallback = cb; }
void setTextEntryCallback( commit_callback_t cb ) { mTextEntryCallback = cb; }
void setTextChangedCallback( commit_callback_t cb ) { mTextChangedCallback = cb; }
void setButtonVisible(BOOL visible);
@ -220,6 +222,7 @@ private:
BOOL mTextEntryTentative;
commit_callback_t mPrearrangeCallback;
commit_callback_t mTextEntryCallback;
commit_callback_t mTextChangedCallback;
commit_callback_t mSelectionCallback;
boost::signals2::connection mTopLostSignalConnection;
S32 mLastSelectedIndex;

View File

@ -160,6 +160,17 @@
<key>Value</key>
<integer>0</integer>
</map>
<key>ShowFavoritesOnLogin</key>
<map>
<key>Comment</key>
<string>Determines whether favorites of last logged in user will be saved on exit from viewer and shown on login screen</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<!-- End of back compatibility settings -->
</map>
</llsd>

View File

@ -607,6 +607,15 @@ void LLFavoritesBarCtrl::changed(U32 mask)
}
else
{
LLInventoryModel::item_array_t items;
LLInventoryModel::cat_array_t cats;
LLIsType is_type(LLAssetType::AT_LANDMARK);
gInventory.collectDescendentsIf(mFavoriteFolderId, cats, items, LLInventoryModel::EXCLUDE_TRASH, is_type);
for (LLInventoryModel::item_array_t::iterator i = items.begin(); i != items.end(); ++i)
{
(*i)->getSLURL();
}
updateButtons();
}
}

View File

@ -105,6 +105,7 @@
#include "llteleporthistorystorage.h"
#include "lllogininstance.h" // to check if logged in yet
#include "llsdserialize.h"
const F32 MAX_USER_FAR_CLIP = 512.f;
const F32 MIN_USER_FAR_CLIP = 64.f;
@ -284,7 +285,8 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
mGotPersonalInfo(false),
mOriginalIMViaEmail(false),
mLanguageChanged(false),
mDoubleClickActionDirty(false)
mDoubleClickActionDirty(false),
mFavoritesRecordMayExist(false)
{
//Build Floater is now Called from LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreference>);
@ -541,6 +543,34 @@ void LLFloaterPreference::apply()
updateDoubleClickSettings();
mDoubleClickActionDirty = false;
}
if (mFavoritesRecordMayExist && !gSavedPerAccountSettings.getBOOL("ShowFavoritesOnLogin"))
{
removeFavoritesRecordOfUser();
}
}
void LLFloaterPreference::removeFavoritesRecordOfUser()
{
mFavoritesRecordMayExist = false;
std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml");
LLSD fav_llsd;
llifstream file;
file.open(filename);
if (!file.is_open()) return;
LLSDSerialize::fromXML(fav_llsd, file);
LLAvatarName av_name;
LLAvatarNameCache::get( gAgentID, &av_name );
if (fav_llsd.has(av_name.getLegacyName()))
{
fav_llsd.erase(av_name.getLegacyName());
}
llofstream out_file;
out_file.open(filename);
LLSDSerialize::toPrettyXML(fav_llsd, out_file);
}
void LLFloaterPreference::cancel()
@ -626,6 +656,11 @@ void LLFloaterPreference::onOpen(const LLSD& key)
getChildView("maturity_desired_combobox")->setVisible( false);
}
if (LLStartUp::getStartupState() == STATE_STARTED)
{
mFavoritesRecordMayExist = gSavedPerAccountSettings.getBOOL("ShowFavoritesOnLogin");
}
// Forget previous language changes.
mLanguageChanged = false;
@ -1339,6 +1374,7 @@ void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im
// getChild<LLUICtrl>("busy_response")->setValue(gSavedSettings.getString("BusyModeResponse2"));
getChildView("favorites_on_login_check")->setEnabled(TRUE);
getChildView("log_nearby_chat")->setEnabled(TRUE);
getChildView("log_instant_messages")->setEnabled(TRUE);
getChildView("show_timestamps_check_im")->setEnabled(TRUE);
@ -1554,6 +1590,10 @@ BOOL LLPanelPreference::postBuild()
{
getChild<LLCheckBoxCtrl>("voice_call_friends_only_check")->setCommitCallback(boost::bind(&showFriendsOnlyWarning, _1, _2));
}
if (hasChild("favorites_on_login_check"))
{
getChild<LLCheckBoxCtrl>("favorites_on_login_check")->setCommitCallback(boost::bind(&showFavoritesOnLoginWarning, _1, _2));
}
// Panel Advanced
if (hasChild("modifier_combo"))
@ -1621,6 +1661,14 @@ void LLPanelPreference::showFriendsOnlyWarning(LLUICtrl* checkbox, const LLSD& v
}
}
void LLPanelPreference::showFavoritesOnLoginWarning(LLUICtrl* checkbox, const LLSD& value)
{
if (checkbox && checkbox->getValue())
{
LLNotificationsUtil::add("FavoritesOnLogin");
}
}
void LLPanelPreference::cancel()
{
for (control_values_map_t::iterator iter = mSavedValues.begin();

View File

@ -159,6 +159,8 @@ public:
void buildPopupLists();
static void refreshSkin(void* data);
// Remove record of current user's favorites from file on disk.
void removeFavoritesRecordOfUser();
private:
static std::string sSkin;
// set true if state of double-click action checkbox or radio-group was changed by user
@ -169,6 +171,8 @@ private:
bool mLanguageChanged;
bool mOriginalHideOnlineStatus;
// Record of current user's favorites may be stored in file on disk.
bool mFavoritesRecordMayExist;
std::string mDirectoryVisibility;
LLAvatarData mAvatarProperties;
@ -192,6 +196,8 @@ public:
private:
//for "Only friends and groups can call or IM me"
static void showFriendsOnlyWarning(LLUICtrl*, const LLSD&);
//for "Show my Favorite Landmarks at Login"
static void showFavoritesOnLoginWarning(LLUICtrl* checkbox, const LLSD& value);
typedef std::map<LLControlVariable*, LLSD> control_values_map_t;
control_values_map_t mSavedValues;

View File

@ -253,11 +253,67 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
gResponsePtr = LLIamHereLogin::build( this );
LLHTTPClient::head( LLGridManager::getInstance()->getLoginPage(), gResponsePtr );
// Show last logged in user favorites in "Start at" combo.
addUsersWithFavoritesToUsername();
getChild<LLComboBox>("username_combo")->setTextChangedCallback(boost::bind(&LLPanelLogin::addFavoritesToStartLocation, this));
updateLocationCombo(false);
}
void LLPanelLogin::addUsersWithFavoritesToUsername()
{
LLComboBox* combo = getChild<LLComboBox>("username_combo");
if (!combo) return;
std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml");
LLSD fav_llsd;
llifstream file;
file.open(filename);
if (!file.is_open()) return;
LLSDSerialize::fromXML(fav_llsd, file);
for (LLSD::map_const_iterator iter = fav_llsd.beginMap();
iter != fav_llsd.endMap(); ++iter)
{
combo->add(iter->first);
}
}
void LLPanelLogin::addFavoritesToStartLocation()
{
LLComboBox* combo = getChild<LLComboBox>("start_location_combo");
if (!combo) return;
int num_items = combo->getItemCount();
for (int i = num_items - 1; i > 2; i--)
{
combo->remove(i);
}
std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml");
LLSD fav_llsd;
llifstream file;
file.open(filename);
if (!file.is_open()) return;
LLSDSerialize::fromXML(fav_llsd, file);
for (LLSD::map_const_iterator iter = fav_llsd.beginMap();
iter != fav_llsd.endMap(); ++iter)
{
if(iter->first != getChild<LLComboBox>("username_combo")->getSimple()) continue;
combo->addSeparator();
LLSD user_llsd = iter->second;
for (LLSD::array_const_iterator iter1 = user_llsd.beginArray();
iter1 != user_llsd.endArray(); ++iter1)
{
std::string label = (*iter1)["name"].asString();
std::string value = (*iter1)["slurl"].asString();
if(label != "" && value != "")
{
combo->add(label, value);
}
}
break;
}
}
// force the size to be correct (XML doesn't seem to be sufficient to do this)
// (with some padding so the other login screen doesn't show through)
void LLPanelLogin::reshapeBrowser()
@ -393,13 +449,14 @@ void LLPanelLogin::giveFocus()
if( sInstance )
{
// Grab focus and move cursor to first blank input field
std::string username = sInstance->getChild<LLUICtrl>("username_edit")->getValue().asString();
std::string username = sInstance->getChild<LLUICtrl>("username_combo")->getValue().asString();
std::string pass = sInstance->getChild<LLUICtrl>("password_edit")->getValue().asString();
BOOL have_username = !username.empty();
BOOL have_pass = !pass.empty();
LLLineEditor* edit = NULL;
LLComboBox* combo = NULL;
if (have_username && !have_pass)
{
// User saved his name but not his password. Move
@ -409,7 +466,7 @@ void LLPanelLogin::giveFocus()
else
{
// User doesn't have a name, so start there.
edit = sInstance->getChild<LLLineEditor>("username_edit");
combo = sInstance->getChild<LLComboBox>("username_combo");
}
if (edit)
@ -417,6 +474,10 @@ void LLPanelLogin::giveFocus()
edit->setFocus(TRUE);
edit->selectAll();
}
else if (combo)
{
combo->setFocus(TRUE);
}
}
}
@ -431,8 +492,8 @@ void LLPanelLogin::showLoginWidgets()
// *TODO: Append all the usual login parameters, like first_login=Y etc.
std::string splash_screen_url = LLGridManager::getInstance()->getLoginPage();
web_browser->navigateTo( splash_screen_url, "text/html" );
LLUICtrl* username_edit = sInstance->getChild<LLUICtrl>("username_edit");
username_edit->setFocus(TRUE);
LLUICtrl* username_combo = sInstance->getChild<LLUICtrl>("username_combo");
username_combo->setFocus(TRUE);
}
// static
@ -476,16 +537,17 @@ void LLPanelLogin::setFields(LLPointer<LLCredential> credential,
login_id += " ";
login_id += lastname;
}
sInstance->getChild<LLUICtrl>("username_edit")->setValue(login_id);
sInstance->getChild<LLComboBox>("username_combo")->setLabel(login_id);
}
else if((std::string)identifier["type"] == "account")
{
sInstance->getChild<LLUICtrl>("username_edit")->setValue((std::string)identifier["account_name"]);
sInstance->getChild<LLComboBox>("username_combo")->setLabel((std::string)identifier["account_name"]);
}
else
{
sInstance->getChild<LLUICtrl>("username_edit")->setValue(std::string());
sInstance->getChild<LLComboBox>("username_combo")->setLabel(std::string());
}
sInstance->addFavoritesToStartLocation();
// if the password exists in the credential, set the password field with
// a filler to get some stars
LLSD authenticator = credential->getAuthenticator();
@ -533,7 +595,7 @@ void LLPanelLogin::getFields(LLPointer<LLCredential>& credential,
authenticator = credential->getAuthenticator();
}
std::string username = sInstance->getChild<LLUICtrl>("username_edit")->getValue().asString();
std::string username = sInstance->getChild<LLUICtrl>("username_combo")->getValue().asString();
LLStringUtil::trim(username);
std::string password = sInstance->getChild<LLUICtrl>("password_edit")->getValue().asString();
@ -625,15 +687,15 @@ BOOL LLPanelLogin::areCredentialFieldsDirty()
}
else
{
std::string username = sInstance->getChild<LLUICtrl>("username_edit")->getValue().asString();
std::string username = sInstance->getChild<LLUICtrl>("username_combo")->getValue().asString();
LLStringUtil::trim(username);
std::string password = sInstance->getChild<LLUICtrl>("password_edit")->getValue().asString();
LLLineEditor* ctrl = sInstance->getChild<LLLineEditor>("username_edit");
if(ctrl && ctrl->isDirty())
LLComboBox* combo = sInstance->getChild<LLComboBox>("username_combo");
if(combo && combo->isDirty())
{
return true;
}
ctrl = sInstance->getChild<LLLineEditor>("password_edit");
LLLineEditor* ctrl = sInstance->getChild<LLLineEditor>("password_edit");
if(ctrl && ctrl->isDirty())
{
return true;
@ -873,7 +935,7 @@ void LLPanelLogin::onClickConnect(void *)
return;
}
updateStartSLURL();
std::string username = sInstance->getChild<LLUICtrl>("username_edit")->getValue().asString();
std::string username = sInstance->getChild<LLUICtrl>("username_combo")->getValue().asString();
if(username.empty())

View File

@ -85,6 +85,8 @@ public:
private:
friend class LLPanelLoginListener;
void reshapeBrowser();
void addFavoritesToStartLocation();
void addUsersWithFavoritesToUsername();
static void onClickConnect(void*);
static void onClickNewAccount(void*);
// static bool newAccountAlertCallback(const LLSD& notification, const LLSD& response);

View File

@ -48,6 +48,7 @@
#include "llinventorybridge.h"
#include "llinventorypanel.h"
#include "llfloaterinventory.h"
#include "lllandmarkactions.h"
#include "llviewerassettype.h"
#include "llviewerregion.h"
@ -59,7 +60,9 @@
#include "llcommandhandler.h"
#include "llviewermessage.h"
#include "llsidepanelappearance.h"
#include "llavatarnamecache.h"
#include "llavataractions.h"
#include "lllogininstance.h"
///----------------------------------------------------------------------------
/// Helper class to store special inventory item names and their localized values.
@ -1416,6 +1419,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.
*
@ -1442,9 +1447,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<LLUUID, S32> sort_index_map_t;
sort_index_map_t mSortIndexes;
typedef std::map<LLUUID, std::string> slurls_map_t;
slurls_map_t mSLURLs;
bool mIsDirty;
struct IsNotInFavorites
@ -1499,10 +1512,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 (gSavedPerAccountSettings.getBOOL("ShowFavoritesOnLogin"))
{
LLFavoritesOrderStorage::instance().saveFavoritesSLURLs();
}
}
void LLFavoritesOrderStorage::load()
@ -1525,6 +1555,76 @@ 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");
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;
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;
user_llsd[(*it)->getSortField()] = value;
}
}
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
@ -1581,6 +1681,12 @@ S32 LLViewerInventoryItem::getSortField() const
void LLViewerInventoryItem::setSortField(S32 sortField)
{
LLFavoritesOrderStorage::instance().setSortIndex(mUUID, sortField);
getSLURL();
}
void LLViewerInventoryItem::getSLURL()
{
LLFavoritesOrderStorage::instance().getSLURL(mAssetUUID);
}
const LLPermissions& LLViewerInventoryItem::getPermissions() const

View File

@ -62,6 +62,7 @@ public:
virtual const std::string& getName() const;
virtual S32 getSortField() const;
virtual void setSortField(S32 sortField);
virtual void getSLURL(); //Caches SLURL for landmark. //*TODO: Find a better way to do it and remove this method from here.
virtual const LLPermissions& getPermissions() const;
virtual const bool getIsFullPerm() const; // 'fullperm' in the popular sense: modify-ok & copy-ok & transfer-ok, no special god rules applied
virtual const LLUUID& getCreatorUUID() const;

View File

@ -251,6 +251,16 @@ Save all changes to clothing/body parts?
yestext="OK"/>
</notification>
<notification
icon="alertmodal.tga"
name="FavoritesOnLogin"
type="alertmodal">
Note: When you turn on this option, anyone who uses this computer can see your list of favorite locations.
<usetemplate
name="okbutton"
yestext="OK"/>
</notification>
<notification
icon="alertmodal.tga"
name="GrantModifyRights"

View File

@ -61,23 +61,28 @@ left="20"
width="150">
Username:
</text>
<line_editor
<combo_box
allow_text_entry="true"
follows="left|bottom"
height="22"
label="bobsmith12 or Steller Sunshine"
left_delta="0"
max_length_bytes="63"
name="username_edit"
prevalidate_callback="ascii"
max_chars="128"
prevalidate_callback="ascii"
select_on_focus="true"
tool_tip="The username you chose when you registered, like bobsmith12 or Steller Sunshine"
top_pad="0"
width="150" />
name="username_combo"
width="178">
<combo_box.combo_button
visible ="false"/>
<combo_box.drop_down_button
visible ="false"/>
</combo_box>
<text
follows="left|bottom"
font="SansSerifSmall"
height="15"
left_pad="8"
left_pad="-19"
name="password_text"
top="20"
width="150">

View File

@ -77,6 +77,16 @@
left="30"
name="auto_disengage_mic_check"
top_pad="10"
width="350" />
<check_box
control_name="ShowFavoritesOnLogin"
enabled="false"
height="16"
label="Show my Favorite Landmarks at Login (via &apos;Start At&apos; drop-down menu)"
layout="topleft"
left="30"
name="favorites_on_login_check"
top_pad="10"
width="350" />
<text
type="string"
@ -87,7 +97,7 @@
left="30"
mouse_opaque="false"
name="Logs:"
top_pad="30"
top_pad="20"
width="350">
Chat Logs:
</text>
@ -179,7 +189,7 @@
layout="topleft"
left="30"
name="block_list"
top_pad="35"
top_pad="28"
width="145">
<!--<button.commit_callback
function="SideTray.ShowPanel"-->