Update Floater Inv Panel to be more modern
This commit is contained in:
@@ -26,19 +26,19 @@
|
||||
#include "lluictrlfactory.h"
|
||||
|
||||
|
||||
LFFloaterInvPanel::LFFloaterInvPanel(const LLUUID& cat_id, LLInventoryModel* model, const std::string& name)
|
||||
: LLInstanceTracker<LFFloaterInvPanel, LLUUID>(cat_id)
|
||||
LFFloaterInvPanel::LFFloaterInvPanel(const LLSD& cat, const std::string& name, LLInventoryModel* model)
|
||||
: LLInstanceTracker<LFFloaterInvPanel, LLSD>(cat)
|
||||
{
|
||||
mCommitCallbackRegistrar.add("InvPanel.Search", boost::bind(&LLInventoryPanel::setFilterSubString, boost::ref(mPanel), _2));
|
||||
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_inv_panel.xml");
|
||||
LLPanel* panel = getChild<LLPanel>("placeholder_panel");
|
||||
mPanel = new LLInventoryPanel("inv_panel", LLInventoryPanel::DEFAULT_SORT_ORDER, LLSD().with("id", cat_id), panel->getRect(), model, true);
|
||||
mPanel = new LLInventoryPanel("inv_panel", LLInventoryPanel::DEFAULT_SORT_ORDER, cat, panel->getRect(), model ? model : &gInventory, true);
|
||||
mPanel->postBuild();
|
||||
mPanel->setFollows(FOLLOWS_ALL);
|
||||
mPanel->setEnabled(true);
|
||||
addChild(mPanel);
|
||||
removeChild(panel);
|
||||
setTitle(name);
|
||||
setTitle(name.empty() ? mPanel->getRootFolder()->getLabel() : name);
|
||||
}
|
||||
|
||||
LFFloaterInvPanel::~LFFloaterInvPanel()
|
||||
@@ -47,10 +47,10 @@ LFFloaterInvPanel::~LFFloaterInvPanel()
|
||||
}
|
||||
|
||||
// static
|
||||
void LFFloaterInvPanel::show(const LLUUID& cat_id, LLInventoryModel* model, const std::string& name)
|
||||
void LFFloaterInvPanel::show(const LLSD& cat, const std::string& name, LLInventoryModel* model)
|
||||
{
|
||||
LFFloaterInvPanel* floater = LFFloaterInvPanel::getInstance(cat_id);
|
||||
if (!floater) floater = new LFFloaterInvPanel(cat_id, model, name);
|
||||
LFFloaterInvPanel* floater = LFFloaterInvPanel::getInstance(cat);
|
||||
if (!floater) floater = new LFFloaterInvPanel(cat, name, model);
|
||||
floater->open();
|
||||
}
|
||||
|
||||
@@ -63,10 +63,10 @@ void LFFloaterInvPanel::closeAll()
|
||||
{
|
||||
cache.push_back(&*i);
|
||||
}
|
||||
// Now close all panels, without using instance_iter iterators.
|
||||
for (std::vector<LFFloaterInvPanel*>::iterator i = cache.begin(); i != cache.end(); ++i)
|
||||
// Now close all, without using instance_iter iterators.
|
||||
for (auto& floater : cache)
|
||||
{
|
||||
(*i)->close();
|
||||
floater->close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,15 +23,16 @@
|
||||
|
||||
#include "llfloater.h"
|
||||
#include "llinstancetracker.h"
|
||||
#include "llsdutil.h"
|
||||
|
||||
|
||||
class LFFloaterInvPanel : public LLFloater, public LLInstanceTracker<LFFloaterInvPanel, LLUUID>
|
||||
class LFFloaterInvPanel : public LLFloater, public LLInstanceTracker<LFFloaterInvPanel, LLSD>
|
||||
{
|
||||
LFFloaterInvPanel(const LLUUID& cat_id, class LLInventoryModel* model, const std::string& name);
|
||||
LFFloaterInvPanel(const LLSD& cat, const std::string& name = LLStringUtil::null, class LLInventoryModel* model = nullptr);
|
||||
~LFFloaterInvPanel();
|
||||
|
||||
public:
|
||||
static void show(const LLUUID& cat_id, LLInventoryModel* model, const std::string& name); // Show the floater for cat_id (create with other params if necessary)
|
||||
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)
|
||||
static void closeAll(); // Called when not allowed to have inventory open
|
||||
|
||||
/*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);
|
||||
|
||||
@@ -2961,7 +2961,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action)
|
||||
LLInventoryModel* model = getInventoryModel();
|
||||
LLViewerInventoryCategory* cat = getCategory();
|
||||
if (!model || !cat) return;
|
||||
LFFloaterInvPanel::show(mUUID, model, cat->getName());
|
||||
LFFloaterInvPanel::show(LLSD().with("id", mUUID), cat->getName(), model);
|
||||
return;
|
||||
}
|
||||
else if ("paste" == action)
|
||||
|
||||
Reference in New Issue
Block a user