diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llfloatersocial.cpp | 79 | ||||
-rw-r--r-- | indra/newview/llfloatersocial.h | 20 | ||||
-rw-r--r-- | indra/newview/skins/default/textures/icons/map_placeholder.jpg | bin | 0 -> 25641 bytes | |||
-rwxr-xr-x | indra/newview/skins/default/textures/textures.xml | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_social.xml | 108 |
5 files changed, 125 insertions, 84 deletions
diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 9a63a7de78..fe5c324d0b 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -33,22 +33,45 @@ #include "llagentui.h" #include "llfacebookconnect.h" #include "llfloaterreg.h" +#include "lliconctrl.h" #include "llslurl.h" #include "llviewerregion.h" #include "llviewercontrol.h" +static LLRegisterPanelClassWrapper<LLSocialStatusPanel> t_panel_status("llsocialstatuspanel"); static LLRegisterPanelClassWrapper<LLSocialPhotoPanel> t_panel_photo("llsocialphotopanel"); static LLRegisterPanelClassWrapper<LLSocialCheckinPanel> t_panel_checkin("llsocialcheckinpanel"); std::string get_map_url() { - LLVector3d center_agent = gAgent.getRegion()->getCenterGlobal(); + LLVector3d center_agent; + if (gAgent.getRegion()) + { + center_agent = gAgent.getRegion()->getCenterGlobal(); + } int x_pos = center_agent[0] / 256.0; int y_pos = center_agent[1] / 256.0; std::string map_url = gSavedSettings.getString("CurrentMapServerURL") + llformat("map-1-%d-%d-objects.jpg", x_pos, y_pos); return map_url; } +LLSocialStatusPanel::LLSocialStatusPanel() +{ + mCommitCallbackRegistrar.add("SocialSharing.SendStatus", boost::bind(&LLSocialStatusPanel::onSend, this)); +} + +void LLSocialStatusPanel::onSend() +{ + std::string message = getChild<LLUICtrl>("message")->getValue().asString(); + LLFacebookConnect::instance().updateStatus(message); + + LLFloater* floater = getParentByType<LLFloater>(); + if (floater) + { + floater->closeFloater(); + } +} + LLSocialPhotoPanel::LLSocialPhotoPanel() : mRefreshBtn(NULL), mRefreshLabel(NULL), @@ -194,22 +217,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 @@ -224,10 +236,9 @@ void LLSocialCheckinPanel::onSend() std::string description; LLAgentUI::buildLocationString(description, LLAgentUI::LOCATION_FORMAT_NORMAL_COORDS, gAgent.getPositionAgent()); - // 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(); @@ -244,9 +255,10 @@ void LLSocialCheckinPanel::onSend() } -LLFloaterSocial::LLFloaterSocial(const LLSD& key) : -LLFloater(key), -mSocialPhotoPanel(NULL) +LLFloaterSocial::LLFloaterSocial(const LLSD& key) : LLFloater(key), + mMapUrl(""), + mReloadingMapTexture(false), + mSocialPhotoPanel(NULL) { mCommitCallbackRegistrar.add("SocialSharing.Cancel", boost::bind(&LLFloaterSocial::onCancel, this)); } @@ -259,10 +271,39 @@ 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(); +} + void LLFloaterSocial::onOpen(const LLSD& key) { LLSnapshotLivePreview* preview = static_cast<LLSnapshotLivePreview *>(mSocialPhotoPanel->mPreviewHandle.get()); diff --git a/indra/newview/llfloatersocial.h b/indra/newview/llfloatersocial.h index 118eaf17d7..a08bbb99ad 100644 --- a/indra/newview/llfloatersocial.h +++ b/indra/newview/llfloatersocial.h @@ -28,13 +28,21 @@ #define LL_LLFLOATERSOCIAL_H #include "llfloater.h" +#include "llviewertexture.h" #include "llsnapshotlivepreview.h" +class LLSocialStatusPanel : public LLPanel +{ +public: + LLSocialStatusPanel(); + void onSend(); +}; + class LLSocialPhotoPanel : public LLPanel { -public: + public: LLSocialPhotoPanel(); ~LLSocialPhotoPanel(); @@ -58,9 +66,6 @@ class LLSocialCheckinPanel : public LLPanel public: LLSocialCheckinPanel(); void onSend(); - /*virtual*/ void setVisible(BOOL visible); -private: - std::string mMapUrl; }; class LLFloaterSocial : public LLFloater @@ -70,10 +75,13 @@ public: BOOL postBuild(); void onCancel(); void onOpen(const LLSD& key); - + /*virtual*/ void draw(); 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/textures/icons/map_placeholder.jpg b/indra/newview/skins/default/textures/icons/map_placeholder.jpg Binary files differnew file mode 100644 index 0000000000..0cb86c58d3 --- /dev/null +++ b/indra/newview/skins/default/textures/icons/map_placeholder.jpg diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 64f7103ccc..731bbe8994 100755 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -325,6 +325,8 @@ with the same filename but different name <texture name="Locked_Icon" file_name="icons/Locked_Icon.png" preload="false" /> + <texture name="Map_Placeholder_Icon" file_name="icons/map_placeholder.jpg" preload="true" /> + <texture name="MarketplaceBtn_Off" file_name="widgets/MarketplaceBtn_Off.png" preload="true" scale.left="30" scale.top="19" scale.right="35" scale.bottom="4" /> <texture name="MarketplaceBtn_Selected" file_name="widgets/MarketplaceBtn_Selected.png" preload="true" scale.left="30" scale.top="19" scale.right="35" scale.bottom="4" /> diff --git a/indra/newview/skins/default/xui/en/floater_social.xml b/indra/newview/skins/default/xui/en/floater_social.xml index dc505fb200..5c910ad986 100644 --- a/indra/newview/skins/default/xui/en/floater_social.xml +++ b/indra/newview/skins/default/xui/en/floater_social.xml @@ -23,6 +23,7 @@ height="430" halign="center"> <panel + class="llsocialstatuspanel" background_opaque="true" background_visible="true" bg_alpha_color="DkGray" @@ -48,7 +49,7 @@ left="9" length="1" max_length="700" - name="caption" + name="message" type="string" word_wrap="true"> </text_editor> @@ -60,7 +61,7 @@ top_pad="18" width="100"> <button.commit_callback - function="PostToFacebook.Send" /> + function="SocialSharing.SendStatus" /> </button> <button follows="left|top" @@ -381,36 +382,25 @@ <layout_panel name="place_map_panel" height="133"> - <ui_ctrl - height="128" - width="128" - name="map_placeholder" - top_pad="5" - follows="left|top" - left="9"> - <panel - background_visible="true" - border_image="Badge_Border" - border_color="BadgeBorderColor" - bg_alpha_color="0.9 1 0.9 1" - follows="left|top" - halign="center" - height="128" - width="128" - left="0" - top="0" - name="map_panel" - visible="true"/> - </ui_ctrl> - <check_box - follows="left|top" - initial_value="true" - top_delta="8" - width="8" - label="" - name="add_place_view_cb" - left_pad="5"/> - <text + <icon + follows="left|top" + height="128" + width="128" + image_name="Map_Placeholder_Icon" + layout="topleft" + top="5" + left="9" + name="map_placeholder"> + </icon> + <check_box + follows="left|top" + initial_value="true" + top_delta="8" + width="8" + label="" + name="add_place_view_cb" + left_pad="5"/> + <text follows="left|top" font="SansSerif" height="32" @@ -420,35 +410,35 @@ top_delta="-8" type="string"> Include overhead view of location - </text> - </layout_panel> - <layout_panel - name="place_button_panel" - height="96"> - <button - follows="left|top" - top="5" - left="9" - height="23" - label="Post" - name="post_place_btn" - width="100"> - <button.commit_callback + </text> + </layout_panel> + <layout_panel + name="place_button_panel" + height="96"> + <button + follows="left|top" + top="5" + left="9" + height="23" + label="Post" + name="post_place_btn" + width="100"> + <button.commit_callback function="SocialSharing.SendCheckin" /> - </button> - <button - follows="left|top" - height="23" - label="Cancel" - name="cancel_btn" - left_pad="15" - top_delta="0" - width="100"> - <button.commit_callback + </button> + <button + follows="left|top" + height="23" + label="Cancel" + name="cancel_btn" + left_pad="15" + top_delta="0" + width="100"> + <button.commit_callback function="SocialSharing.Cancel" /> - </button> - </layout_panel> - </layout_stack> + </button> + </layout_panel> + </layout_stack> </panel> </tab_container> </floater> |