diff options
author | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-06-26 17:55:31 -0700 |
---|---|---|
committer | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-06-26 17:55:31 -0700 |
commit | 173b4ec4561793ca5913c7ec89bc8b83a71b2702 (patch) | |
tree | 0c1ecc1ca7cec546f00daa25199ea548d4bf4d3d /indra/newview | |
parent | bb59fff5a0e60b16e0726fb2da6cc6ee9cc3569c (diff) | |
parent | de89e384544176f2e10225481ca2b0e7901167fb (diff) |
merge
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llfloatersocial.cpp | 81 | ||||
-rw-r--r-- | indra/newview/llfloatersocial.h | 14 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_social.xml | 27 |
3 files changed, 80 insertions, 42 deletions
diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index f16c5601c8..80cdd3a0cb 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -35,8 +35,7 @@ #include "llfacebookconnect.h" #include "llfloaterreg.h" #include "lliconctrl.h" -#include "llresmgr.h" // LLLocale -#include "llsdserialize.h" +#include "llloadingindicator.h" #include "llslurl.h" #include "llviewerregion.h" #include "llviewercontrol.h" @@ -396,11 +395,61 @@ void LLSocialPhotoPanel::onSend() } -LLSocialCheckinPanel::LLSocialCheckinPanel() +LLSocialCheckinPanel::LLSocialCheckinPanel() : + mMapUrl(""), + mReloadingMapTexture(false) { mCommitCallbackRegistrar.add("SocialSharing.SendCheckin", boost::bind(&LLSocialCheckinPanel::onSend, this)); } +BOOL LLSocialCheckinPanel::postBuild() +{ + // Keep pointers to widgets so we don't traverse the UI hierarchy too often + mMapLoadingIndicator = getChild<LLUICtrl>("map_loading_indicator"); + mMapPlaceholder = getChild<LLIconCtrl>("map_placeholder"); + mMapCheckBox = getChild<LLCheckBoxCtrl>("add_place_view_cb"); + mMapCheckBoxValue = mMapCheckBox->get(); + + return LLPanel::postBuild(); +} + +void LLSocialCheckinPanel::draw() +{ + std::string map_url = get_map_url(); + // Did we change location? + if (map_url != mMapUrl) + { + mMapUrl = map_url; + // Load the map tile + mMapTexture = LLViewerTextureManager::getFetchedTextureFromUrl(mMapUrl, FTT_MAP_TILE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + mMapTexture->setBoostLevel(LLGLTexture::BOOST_MAP); + mReloadingMapTexture = true; + // In the meantime, put the "loading" indicator on, hide the tile map and disable the checkbox + mMapLoadingIndicator->setVisible(true); + mMapPlaceholder->setVisible(false); + mMapCheckBoxValue = mMapCheckBox->get(); + mMapCheckBox->set(false); + mMapCheckBox->setEnabled(false); + } + // Are we done loading the map tile? + if (mReloadingMapTexture && mMapTexture->isFullyLoaded()) + { + // Don't do it again next time around + mReloadingMapTexture = false; + // Convert the map texture to the appropriate image object + LLPointer<LLUIImage> ui_image = new LLUIImage(mMapUrl, mMapTexture); + // Load the map widget with the correct map tile image + mMapPlaceholder->setImage(ui_image); + // Now hide the loading indicator, bring the tile in view and reenable the checkbox with its previous value + mMapLoadingIndicator->setVisible(false); + mMapPlaceholder->setVisible(true); + mMapCheckBox->setEnabled(true); + mMapCheckBox->set(mMapCheckBoxValue); + } + + LLPanel::draw(); +} + void LLSocialCheckinPanel::onSend() { // Get the location SLURL @@ -435,8 +484,6 @@ void LLSocialCheckinPanel::onSend() LLFloaterSocial::LLFloaterSocial(const LLSD& key) : LLFloater(key), - mMapUrl(""), - mReloadingMapTexture(false), mSocialPhotoPanel(NULL) { mCommitCallbackRegistrar.add("SocialSharing.Cancel", boost::bind(&LLFloaterSocial::onCancel, this)); @@ -450,36 +497,12 @@ void LLFloaterSocial::onCancel() BOOL LLFloaterSocial::postBuild() { mSocialPhotoPanel = static_cast<LLSocialPhotoPanel*>(getChild<LLUICtrl>("social_photo_tab")); - // Keep a pointer to the map tile placeholder texture - mMapPlaceholder = getChild<LLIconCtrl>("map_placeholder")->getImage(); return LLFloater::postBuild(); } /*virtual*/ void LLFloaterSocial::draw() { - std::string map_url = get_map_url(); - // Did we change location? - if (map_url != mMapUrl) - { - mMapUrl = map_url; - // Load the map tile - mMapTexture = LLViewerTextureManager::getFetchedTextureFromUrl(mMapUrl, FTT_MAP_TILE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); - mMapTexture->setBoostLevel(LLGLTexture::BOOST_MAP); - mReloadingMapTexture = true; - // In the meantime, put back the "loading" placeholder in the map widget - getChild<LLIconCtrl>("map_placeholder")->setImage(mMapPlaceholder); - } - // Are we done loading the map tile? - if (mReloadingMapTexture && mMapTexture->isFullyLoaded()) - { - // Don't do it again next time around - mReloadingMapTexture = false; - // Convert the map texture to the appropriate image object - LLPointer<LLUIImage> ui_image = new LLUIImage(mMapUrl, mMapTexture); - // Point map widget to correct map tile - getChild<LLIconCtrl>("map_placeholder")->setImage(ui_image); - } LLFloater::draw(); } diff --git a/indra/newview/llfloatersocial.h b/indra/newview/llfloatersocial.h index 1e28e3cb7e..b7792e10c1 100644 --- a/indra/newview/llfloatersocial.h +++ b/indra/newview/llfloatersocial.h @@ -81,7 +81,17 @@ class LLSocialCheckinPanel : public LLPanel { public: LLSocialCheckinPanel(); + BOOL postBuild(); + void draw(); void onSend(); +private: + std::string mMapUrl; + LLPointer<LLViewerFetchedTexture> mMapTexture; + LLUICtrl* mMapLoadingIndicator; + LLIconCtrl* mMapPlaceholder; + LLCheckBoxCtrl* mMapCheckBox; + bool mReloadingMapTexture; + bool mMapCheckBoxValue; }; class LLFloaterSocial : public LLFloater @@ -99,10 +109,6 @@ public: private: LLSocialPhotoPanel * mSocialPhotoPanel; - std::string mMapUrl; - LLPointer<LLViewerFetchedTexture> mMapTexture; - LLPointer<LLUIImage> mMapPlaceholder; - bool mReloadingMapTexture; }; #endif // LL_LLFLOATERSOCIAL_H diff --git a/indra/newview/skins/default/xui/en/floater_social.xml b/indra/newview/skins/default/xui/en/floater_social.xml index 76c15b9624..960f883595 100644 --- a/indra/newview/skins/default/xui/en/floater_social.xml +++ b/indra/newview/skins/default/xui/en/floater_social.xml @@ -379,16 +379,25 @@ <layout_panel name="place_map_panel" height="133"> - <icon + <loading_indicator follows="left|top" - height="128" - width="128" - image_name="Map_Placeholder_Icon" - layout="topleft" - top="5" - left="9" - name="map_placeholder"> - </icon> + height="24" + width="24" + name="map_loading_indicator" + top="57" + left="61" + visible="true"/> + <icon + follows="left|top" + height="128" + width="128" + image_name="Map_Placeholder_Icon" + layout="topleft" + top="5" + left="9" + visible="false" + name="map_placeholder"> + </icon> <check_box follows="left|top" initial_value="true" |