ACME-582 : Checkin feature: Implement the loading and displaying of map tiles in the LLIconCtrl
parent
37fcb81c4a
commit
e2a7280918
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#define LL_LLFLOATERSOCIAL_H
|
||||
|
||||
#include "llfloater.h"
|
||||
#include "llviewertexture.h"
|
||||
|
||||
class LLSocialPhotoPanel : public LLPanel
|
||||
{
|
||||
|
|
@ -41,9 +42,6 @@ class LLSocialCheckinPanel : public LLPanel
|
|||
public:
|
||||
LLSocialCheckinPanel();
|
||||
void onSend();
|
||||
/*virtual*/ void setVisible(BOOL visible);
|
||||
private:
|
||||
std::string mMapUrl;
|
||||
};
|
||||
|
||||
class LLFloaterSocial : public LLFloater
|
||||
|
|
@ -52,6 +50,12 @@ public:
|
|||
LLFloaterSocial(const LLSD& key);
|
||||
BOOL postBuild();
|
||||
void onCancel();
|
||||
/*virtual*/ void draw();
|
||||
private:
|
||||
std::string mMapUrl;
|
||||
LLPointer<LLViewerFetchedTexture> mMapTexture;
|
||||
LLPointer<LLUIImage> mMapPlaceholder;
|
||||
bool mReloadingMapTexture;
|
||||
};
|
||||
|
||||
#endif // LL_LLFLOATERSOCIAL_H
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 25 KiB |
Loading…
Reference in New Issue