Fix the new window inventory folder floater, and opt it to squeak!

This commit is contained in:
Liru Færs
2020-02-25 12:52:41 -05:00
parent 841a55c266
commit 16b8980d28
2 changed files with 16 additions and 26 deletions

View File

@@ -32,10 +32,10 @@ LFFloaterInvPanel::LFFloaterInvPanel(const LLSD& cat, const std::string& name, L
: LLInstanceTracker<LFFloaterInvPanel, LLSD>(cat)
{
// Setup the floater first
mPanel = new LLInventoryPanel("inv_panel", LLInventoryPanel::DEFAULT_SORT_ORDER, cat, LLRect(), model ? model : &gInventory, true);
auto mPanel = new LLInventoryPanel("inv_panel", LLInventoryPanel::DEFAULT_SORT_ORDER, cat, LLRect(), model ? model : &gInventory, true);
// Load from XUI
mCommitCallbackRegistrar.add("InvPanel.Search", boost::bind(&LLInventoryPanel::setFilterSubString, boost::ref(mPanel), _2));
mCommitCallbackRegistrar.add("InvPanel.Search", boost::bind(&LLInventoryPanel::setFilterSubString, mPanel, _2));
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_inv_panel.xml");
// Now set the title
@@ -58,18 +58,12 @@ LFFloaterInvPanel::LFFloaterInvPanel(const LLSD& cat, const std::string& name, L
// Now take care of the children
LLPanel* panel = getChild<LLPanel>("placeholder_panel");
mPanel->setRect(panel->getRect());
mPanel->setOrigin(0, 0);
mPanel->postBuild();
mPanel->setFollows(FOLLOWS_ALL);
mPanel->setEnabled(true);
mPanel->removeBorder();
addChild(mPanel);
sendChildToBack(mPanel);
removeChild(panel);
}
LFFloaterInvPanel::~LFFloaterInvPanel()
{
delete mPanel;
panel->addChild(mPanel);
}
// static
@@ -96,15 +90,18 @@ void LFFloaterInvPanel::closeAll()
}
}
// virtual
BOOL LFFloaterInvPanel::handleKeyHere(KEY key, MASK mask)
{
if (!mPanel->hasFocus() && mask == MASK_NONE && (key == KEY_RETURN || key == KEY_DOWN))
if (mask == MASK_NONE && (key == KEY_RETURN || key == KEY_DOWN))
{
mPanel->setFocus(true);
if (LLFolderView* root = mPanel->getRootFolder())
root->scrollToShowSelection();
return true;
auto& mPanel = *getChild<LLInventoryPanel>("inv_panel");
if (!mPanel.hasFocus())
{
mPanel.setFocus(true);
if (LLFolderView* root = mPanel.getRootFolder())
root->scrollToShowSelection();
return true;
}
}
return LLFloater::handleKeyHere(key, mask);

View File

@@ -18,18 +18,16 @@
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA */
#ifndef LFFLOATERINVPANEL_H
#define LFFLOATERINVPANEL_H
#pragma once
#include "llfloater.h"
#include "llinstancetracker.h"
#include "llsdutil.h"
class LFFloaterInvPanel : public LLFloater, public LLInstanceTracker<LFFloaterInvPanel, LLSD>
class LFFloaterInvPanel final : public LLFloater, public LLInstanceTracker<LFFloaterInvPanel, LLSD>
{
LFFloaterInvPanel(const LLSD& cat, const std::string& name = LLStringUtil::null, class LLInventoryModel* model = nullptr);
~LFFloaterInvPanel();
public:
static void show(const LLSD& cat, const std::string& name = LLStringUtil::null, LLInventoryModel* model = nullptr); // Show the floater for cat (create with other params if necessary)
@@ -42,10 +40,5 @@ public:
}
static void closeAll(); // Called when not allowed to have inventory open
/*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);
private:
class LLInventoryPanel* mPanel;
BOOL handleKeyHere(KEY key, MASK mask) override;
};
#endif //LFFLOATERINVPANEL_H