diff --git a/indra/newview/llfloaterregionrestarting.cpp b/indra/newview/llfloaterregionrestarting.cpp index 9c6d07efbb..3997de705c 100644 --- a/indra/newview/llfloaterregionrestarting.cpp +++ b/indra/newview/llfloaterregionrestarting.cpp @@ -35,6 +35,15 @@ #include "llviewercontrol.h" // FIRE-12900, FIRE-12901: gSavedSettings, make screen shaking optional #include "llviewerwindow.h" +// [SL:KB] - Patch: UI-RegionRestart | Checked: 2014-03-15 (Catznip-3.6) +#include "llcombobox.h" +#include "llinventoryfunctions.h" +#include "llinventorymodel.h" +#include "llinventorymodelbackgroundfetch.h" +#include "llviewercontrol.h" +#include "llviewerinventory.h" +// [/SL:KB] + static S32 sSeconds; static U32 sShakeState; @@ -55,6 +64,14 @@ BOOL LLFloaterRegionRestarting::postBuild() { mRegionChangedConnection = gAgent.addRegionChangedCallback(boost::bind(&LLFloaterRegionRestarting::regionChange, this)); +// [SL:KB] - Patch: UI-RegionRestart | Checked: 2014-03-15 (Catznip-3.6) + const LLUUID idLandmarks = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK); + LLInventoryModelBackgroundFetch::instance().start(idLandmarks); + + getChild("landmark combo")->setPrearrangeCallback(boost::bind(&LLFloaterRegionRestarting::refreshLandmarkList, this)); + getChild("teleport_btn")->setCommitCallback(boost::bind(&LLFloaterRegionRestarting::onTeleportClicked, this)); +// [/SL:KB] + LLStringUtil::format_map_t args; std::string text; @@ -97,6 +114,57 @@ void LLFloaterRegionRestarting::refresh() } } +// [SL:KB] - Patch: UI-RegionRestart | Checked: 2014-03-15 (Catznip-3.6) +void LLFloaterRegionRestarting::onOpen(const LLSD& key) +{ + LLFloater::onOpen(key); + + refreshLandmarkList(); +} + +void LLFloaterRegionRestarting::onTeleportClicked() +{ + LLComboBox* pCombo = findChild("landmark combo"); + if (pCombo) + { + const LLUUID idAsset = pCombo->getSelectedValue().asUUID(); + if (idAsset.notNull()) + gAgent.teleportViaLandmark(idAsset); + } +} + +void LLFloaterRegionRestarting::refreshLandmarkList() +{ + LLComboBox* pCombo = findChild("landmark combo"); + if (!pCombo) + return; + + // Delete all but the placehold entry + S32 cntItem = pCombo->getItemCount(); + if (cntItem > 1) + { + pCombo->selectItemRange(1, -1); + pCombo->operateOnSelection(LLCtrlListInterface::OP_DELETE); + } + + // Add landmarks from inventory (match the logic from the world map floater) + LLInventoryModel::cat_array_t cats; + LLInventoryModel::item_array_t items; + LLFindLandmarks is_landmark(true, false /*gSavedSettings.getBOOL("WorldMapFilterSelfLandmarks")*/); + gInventory.collectDescendentsIf(gInventory.getRootFolderID(), cats, items, LLInventoryModel::EXCLUDE_TRASH, is_landmark); + + std::sort(items.begin(), items.end(), LLViewerInventoryItem::comparePointers()); + + for (LLInventoryModel::item_array_t::const_iterator itItem = items.begin(); itItem != items.end(); ++itItem) + { + const LLViewerInventoryItem* pItem = *itItem; + pCombo->addSimpleElement(pItem->getName(), ADD_BOTTOM, pItem->getAssetUUID()); + } + + pCombo->selectFirstItem(); +} +// [/SL:KB] + void LLFloaterRegionRestarting::draw() { LLFloater::draw(); diff --git a/indra/newview/llfloaterregionrestarting.h b/indra/newview/llfloaterregionrestarting.h index 46416db2c8..4f05744a66 100644 --- a/indra/newview/llfloaterregionrestarting.h +++ b/indra/newview/llfloaterregionrestarting.h @@ -48,6 +48,13 @@ private: virtual void draw(); virtual void regionChange(); +// [SL:KB] - Patch: UI-RegionRestart | Checked: 2014-03-15 (Catznip-3.6) + /*virtual*/ void onOpen(const LLSD& key); + + void onTeleportClicked(); + void refreshLandmarkList(); +// [/SL:KB] + std::string mName; U32 mShakeIterations; F32 mShakeMagnitude; diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index fd15c5dbb9..afc2c8187d 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -1013,6 +1013,35 @@ bool LLFindNonRemovableObjects::operator()(LLInventoryCategory* cat, LLInventory return false; } +// [SL:KB] - Patch: UI-Misc | Checked: 2014-03-02 (Catznip-3.6) +LLFindLandmarks::LLFindLandmarks(bool fFilterDuplicates, bool fFilterSelf) + : m_fFilterDuplicates(fFilterDuplicates) + , m_fFilterSelf(fFilterSelf) +{ +} + +bool LLFindLandmarks::operator()(LLInventoryCategory* cat, LLInventoryItem* item) +{ + if ( (item) && (LLAssetType::AT_LANDMARK == item->getType()) ) + { + if ( (m_fFilterSelf) && (gAgentID != item->getCreatorUUID()) ) + { + return false; + } + + if (m_fFilterDuplicates) + { + if (m_AssetIds.end() != std::find(m_AssetIds.begin(), m_AssetIds.end(), item->getAssetUUID())) + return false; + m_AssetIds.push_back(item->getAssetUUID()); + } + + return true; + } + return false; +} +// [/SL:KB] + ///---------------------------------------------------------------------------- /// LLAssetIDMatches ///---------------------------------------------------------------------------- diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index 69bb97cc81..ef8c53352c 100755 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -417,6 +417,22 @@ public: virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item); }; +// [SL:KB] - Patch: UI-Misc | Checked: 2014-03-02 (Catznip-3.6) +class LLFindLandmarks : public LLInventoryCollectFunctor +{ +public: + LLFindLandmarks(bool fFilterDuplicates, bool fFilterSelf); + virtual ~LLFindLandmarks() { } + + /*virtual*/ bool operator()(LLInventoryCategory* cat, LLInventoryItem* item); + +protected: + bool m_fFilterDuplicates; + std::list m_AssetIds; + bool m_fFilterSelf; +}; +// [/SL:KB] + /** Inventory Collector Functions ** ** *******************************************************************************/ diff --git a/indra/newview/skins/default/xui/de/floater_region_restarting.xml b/indra/newview/skins/default/xui/de/floater_region_restarting.xml index 704c148780..a8312bac7f 100644 --- a/indra/newview/skins/default/xui/de/floater_region_restarting.xml +++ b/indra/newview/skins/default/xui/de/floater_region_restarting.xml @@ -19,5 +19,9 @@ Falls Sie in dieser Region bleiben, werden Sie ausgeloggt. Sekunden bis Neustart 32767 + + + +