summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatersocial.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloatersocial.cpp')
-rw-r--r--indra/newview/llfloatersocial.cpp51
1 files changed, 37 insertions, 14 deletions
diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp
index 361d54f696..b14098eb77 100644
--- a/indra/newview/llfloatersocial.cpp
+++ b/indra/newview/llfloatersocial.cpp
@@ -33,6 +33,7 @@
#include "llagentui.h"
#include "llfacebookconnect.h"
#include "llfloaterreg.h"
+#include "lliconctrl.h"
#include "llslurl.h"
#include "llviewerregion.h"
#include "llviewercontrol.h"
@@ -78,22 +79,11 @@ void LLSocialPhotoPanel::onSend()
}
-LLSocialCheckinPanel::LLSocialCheckinPanel() :
- mMapUrl("")
+LLSocialCheckinPanel::LLSocialCheckinPanel()
{
mCommitCallbackRegistrar.add("SocialSharing.SendCheckin", boost::bind(&LLSocialCheckinPanel::onSend, this));
}
-/*virtual*/
-void LLSocialCheckinPanel::setVisible(BOOL visible)
-{
- if (visible)
- {
- mMapUrl = get_map_url();
- }
- LLPanel::setVisible(visible);
-}
-
void LLSocialCheckinPanel::onSend()
{
// Get the location SLURL
@@ -110,7 +100,7 @@ void LLSocialCheckinPanel::onSend()
// Optionally add the region map view
bool add_map_view = getChild<LLUICtrl>("add_place_view_cb")->getValue().asBoolean();
- std::string map_url = (add_map_view ? mMapUrl : "");
+ std::string map_url = (add_map_view ? get_map_url() : "");
// Get the caption
std::string caption = getChild<LLUICtrl>("place_caption")->getValue().asString();
@@ -127,7 +117,9 @@ void LLSocialCheckinPanel::onSend()
}
-LLFloaterSocial::LLFloaterSocial(const LLSD& key) : LLFloater(key)
+LLFloaterSocial::LLFloaterSocial(const LLSD& key) : LLFloater(key),
+ mMapUrl(""),
+ mReloadingMapTexture(false)
{
mCommitCallbackRegistrar.add("SocialSharing.Cancel", boost::bind(&LLFloaterSocial::onCancel, this));
}
@@ -139,5 +131,36 @@ void LLFloaterSocial::onCancel()
BOOL LLFloaterSocial::postBuild()
{
+ // 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();
+}
+