FIRE-13818: Add landmark selection and teleport button to region restart floater; by Kitty Barnett (Catznip viewer)

Ansariel 2014-08-08 13:37:46 +02:00
parent 74b6689960
commit e76e0a783a
8 changed files with 167 additions and 4 deletions

View File

@ -35,6 +35,15 @@
#include "llviewercontrol.h" // <FS:PP> 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<LLComboBox>("landmark combo")->setPrearrangeCallback(boost::bind(&LLFloaterRegionRestarting::refreshLandmarkList, this));
getChild<LLUICtrl>("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<LLComboBox>("landmark combo");
if (pCombo)
{
const LLUUID idAsset = pCombo->getSelectedValue().asUUID();
if (idAsset.notNull())
gAgent.teleportViaLandmark(idAsset);
}
}
void LLFloaterRegionRestarting::refreshLandmarkList()
{
LLComboBox* pCombo = findChild<LLComboBox>("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();

View File

@ -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;

View File

@ -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
///----------------------------------------------------------------------------

View File

@ -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<LLUUID> m_AssetIds;
bool m_fFilterSelf;
};
// [/SL:KB]
/** Inventory Collector Functions
** **
*******************************************************************************/

View File

@ -19,5 +19,9 @@ Falls Sie in dieser Region bleiben, werden Sie ausgeloggt.
Sekunden bis Neustart
32767
</text>
<combo_box label="Meine Landmarken" name="landmark combo">
<combo_box.item label="Meine Landmarken" name="item1"/>
</combo_box>
<button tool_tip="Zur Landmarke teleportieren" name="teleport_btn"/>
</panel>
</floater>

View File

@ -491,6 +491,7 @@
</menu>
<menu label="UI" name="UI">
<menu_item_call label="Test Medienbrowser" name="Web Browser Test"/>
<menu_item_call label="Test Regionsneustart" name="Region Restart Test"/>
<menu_item_call label="Webinhaltsbrowser" name="Web Content Browser"/>
<menu_item_call label="Facebook Connection-Test" name="FB Connect Test"/>
<menu_item_call label="SelectMgr ausgeben" name="Dump SelectMgr"/>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater
height="150"
height="200"
width="290"
layout="topleft"
name="region_restarting"
@ -19,9 +19,9 @@ If you stay in this region you will be logged out.
</string>
<panel
name="layout_panel_1"
height="150"
width="290"
follows="right|top"
right="-1"
bottom="-1"
follows="all"
top="0"
left="0"
background_visible="true"
@ -71,5 +71,33 @@ If you stay in this region you will be logged out.
Seconds until restart
32767
</text>
<combo_box
allow_text_entry="true"
follows="top|right"
height="23"
label="My Landmarks"
layout="topleft"
top_pad="10"
left="30"
max_chars="64"
name="landmark combo"
right="-50"
width="182">
<combo_box.item
label="My Landmarks"
name="item1"
value="None" />
</combo_box>
<button
follows="top|left"
height="23"
image_overlay="Arrow_Right"
image_overlay_alignment="center"
tool_tip="Teleport to Landmark"
layout="topleft"
left_pad="1"
name="teleport_btn"
top_delta="0"
width="28" />
</panel>
</floater>

View File

@ -4165,6 +4165,16 @@
function="Advanced.WebBrowserTest"
parameter="http://secondlife.com/app/search/slurls.html"/>
</menu_item_call>
<menu_item_check
label="Region Restart Test..."
name="Region Restart Test">
<menu_item_check.on_check
function="Floater.Visible"
parameter="region_restarting" />
<menu_item_check.on_click
function="Floater.Toggle"
parameter="region_restarting" />
</menu_item_check>
<menu_item_call
label="Web Content Browser"
name="Web Content Browser"