/indra/newview/llpanelplacestab.cpp

https://bitbucket.org/lindenlab/viewer-beta/ · C++ · 82 lines · 44 code · 13 blank · 25 comment · 3 complexity · 17648b85df03e2a2e9ccd6bf6b183015 MD5 · raw file

  1. /**
  2. * @file llpanelplacestab.cpp
  3. * @brief Tabs interface for Side Bar "Places" panel
  4. *
  5. * $LicenseInfo:firstyear=2009&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #include "llviewerprecompiledheaders.h"
  27. #include "llpanelplacestab.h"
  28. #include "llbutton.h"
  29. #include "llnotificationsutil.h"
  30. #include "llwindow.h"
  31. #include "llpanelplaces.h"
  32. #include "llslurl.h"
  33. #include "llworldmap.h"
  34. std::string LLPanelPlacesTab::sFilterSubString = LLStringUtil::null;
  35. bool LLPanelPlacesTab::isTabVisible()
  36. {
  37. LLUICtrl* parent = getParentUICtrl();
  38. if (!parent) return false;
  39. if (!parent->getVisible()) return false;
  40. return true;
  41. }
  42. void LLPanelPlacesTab::setPanelPlacesButtons(LLPanelPlaces* panel)
  43. {
  44. mTeleportBtn = panel->getChild<LLButton>("teleport_btn");
  45. mShowOnMapBtn = panel->getChild<LLButton>("map_btn");
  46. mShowProfile = panel->getChild<LLButton>("profile_btn");
  47. }
  48. void LLPanelPlacesTab::onRegionResponse(const LLVector3d& landmark_global_pos,
  49. U64 region_handle,
  50. const std::string& url,
  51. const LLUUID& snapshot_id,
  52. bool teleport)
  53. {
  54. std::string sim_name;
  55. bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal( landmark_global_pos, sim_name );
  56. std::string sl_url;
  57. if ( gotSimName )
  58. {
  59. sl_url = LLSLURL(sim_name, landmark_global_pos).getSLURLString();
  60. }
  61. else
  62. {
  63. sl_url = "";
  64. }
  65. LLView::getWindow()->copyTextToClipboard(utf8str_to_wstring(sl_url));
  66. LLSD args;
  67. args["SLURL"] = sl_url;
  68. LLNotificationsUtil::add("CopySLURL", args);
  69. }