CHUI-295: Problem: The places panel implemention was incomplete and trying to make use of a class that was not fully implemented (placesfolderview). Resoltuion: Upon creation of the places panel, placesfolderview is created which contains the proper overloaded functions to show the correct menu when right clicking.
parent
41cba389f8
commit
bec60ef80e
|
|
@ -445,6 +445,7 @@ set(viewer_SOURCE_FILES
|
|||
llphysicsshapebuilderutil.cpp
|
||||
llplacesinventorybridge.cpp
|
||||
llplacesinventorypanel.cpp
|
||||
llplacesfolderview.cpp
|
||||
llpopupview.cpp
|
||||
llpolymesh.cpp
|
||||
llpolymorph.cpp
|
||||
|
|
@ -1015,6 +1016,7 @@ set(viewer_HEADER_FILES
|
|||
llphysicsshapebuilderutil.h
|
||||
llplacesinventorybridge.h
|
||||
llplacesinventorypanel.h
|
||||
llplacesfolderview.h
|
||||
llpolymesh.h
|
||||
llpolymorph.h
|
||||
llpopupview.h
|
||||
|
|
|
|||
|
|
@ -151,6 +151,30 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) :
|
|||
|
||||
}
|
||||
|
||||
LLFolderView * LLInventoryPanel::createFolderRoot(LLUUID root_id )
|
||||
{
|
||||
LLFolderView::Params p(mParams.folder_view);
|
||||
p.name = getName();
|
||||
p.title = getLabel();
|
||||
p.rect = LLRect(0, 0, getRect().getWidth(), 0);
|
||||
p.parent_panel = this;
|
||||
p.tool_tip = p.name;
|
||||
p.listener = mInvFVBridgeBuilder->createBridge( LLAssetType::AT_CATEGORY,
|
||||
LLAssetType::AT_CATEGORY,
|
||||
LLInventoryType::IT_CATEGORY,
|
||||
this,
|
||||
&mInventoryViewModel,
|
||||
NULL,
|
||||
root_id);
|
||||
p.view_model = &mInventoryViewModel;
|
||||
p.use_label_suffix = mParams.use_label_suffix;
|
||||
p.allow_multiselect = mAllowMultiSelect;
|
||||
p.show_empty_message = mShowEmptyMessage;
|
||||
p.show_item_link_overlays = mShowItemLinkOverlays;
|
||||
p.root = NULL;
|
||||
|
||||
return LLUICtrlFactory::create<LLFolderView>(p);
|
||||
}
|
||||
|
||||
void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params)
|
||||
{
|
||||
|
|
@ -172,29 +196,7 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params)
|
|||
{
|
||||
// Determine the root folder in case specified, and
|
||||
// build the views starting with that folder.
|
||||
|
||||
|
||||
LLFolderView::Params p(mParams.folder_view);
|
||||
p.name = getName();
|
||||
p.title = getLabel();
|
||||
p.rect = LLRect(0, 0, getRect().getWidth(), 0);
|
||||
p.parent_panel = this;
|
||||
p.tool_tip = p.name;
|
||||
p.listener = mInvFVBridgeBuilder->createBridge( LLAssetType::AT_CATEGORY,
|
||||
LLAssetType::AT_CATEGORY,
|
||||
LLInventoryType::IT_CATEGORY,
|
||||
this,
|
||||
&mInventoryViewModel,
|
||||
NULL,
|
||||
root_id);
|
||||
p.view_model = &mInventoryViewModel;
|
||||
p.use_label_suffix = mParams.use_label_suffix;
|
||||
p.allow_multiselect = mAllowMultiSelect;
|
||||
p.show_empty_message = mShowEmptyMessage;
|
||||
p.show_item_link_overlays = mShowItemLinkOverlays;
|
||||
p.root = NULL;
|
||||
|
||||
mFolderRoot = LLUICtrlFactory::create<LLFolderView>(p);
|
||||
mFolderRoot = createFolderRoot(root_id);
|
||||
|
||||
addItemID(root_id, mFolderRoot);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -278,6 +278,7 @@ protected:
|
|||
LLFolderViewItem* buildNewViews(const LLUUID& id);
|
||||
BOOL getIsHiddenFolderType(LLFolderType::EType folder_type) const;
|
||||
|
||||
virtual LLFolderView * createFolderRoot(LLUUID root_id );
|
||||
virtual LLFolderViewFolder* createFolderViewFolder(LLInvFVBridge * bridge);
|
||||
virtual LLFolderViewItem* createFolderViewItem(LLInvFVBridge * bridge);
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@
|
|||
#include "llmenubutton.h"
|
||||
#include "llplacesinventorybridge.h"
|
||||
#include "llplacesinventorypanel.h"
|
||||
#include "llplacesfolderview.h"
|
||||
#include "lltoggleablemenu.h"
|
||||
#include "llviewermenu.h"
|
||||
#include "llviewerregion.h"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,74 @@
|
|||
/**
|
||||
* @file llplacesfolderview.cpp
|
||||
* @brief llplacesfolderview used within llplacesinventorypanel
|
||||
* @author Gilbert@lindenlab.com
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2012, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "llplacesfolderview.h"
|
||||
|
||||
#include "llplacesinventorypanel.h"
|
||||
#include "llpanellandmarks.h"
|
||||
|
||||
LLPlacesFolderView::LLPlacesFolderView(const LLFolderView::Params& p)
|
||||
: LLFolderView(p)
|
||||
{
|
||||
// we do not need auto select functionality in places landmarks, so override default behavior.
|
||||
// this disables applying of the LLSelectFirstFilteredItem in LLFolderView::doIdle.
|
||||
// Fixed issues: EXT-1631, EXT-4994.
|
||||
mAutoSelectOverride = TRUE;
|
||||
}
|
||||
|
||||
BOOL LLPlacesFolderView::handleRightMouseDown(S32 x, S32 y, MASK mask)
|
||||
{
|
||||
// let children to change selection first
|
||||
childrenHandleRightMouseDown(x, y, mask);
|
||||
mParentLandmarksPanel->setCurrentSelectedList((LLPlacesInventoryPanel*)getParentPanel());
|
||||
|
||||
// then determine its type and set necessary menu handle
|
||||
if (getCurSelectedItem())
|
||||
{
|
||||
LLInventoryType::EType inventory_type = static_cast<LLFolderViewModelItemInventory*>(getCurSelectedItem()->getViewModelItem())->getInventoryType();
|
||||
inventory_type_menu_handle_t::iterator it_handle = mMenuHandlesByInventoryType.find(inventory_type);
|
||||
|
||||
if (it_handle != mMenuHandlesByInventoryType.end())
|
||||
{
|
||||
mPopupMenuHandle = (*it_handle).second;
|
||||
}
|
||||
else
|
||||
{
|
||||
llwarns << "Requested menu handle for non-setup inventory type: " << inventory_type << llendl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return LLFolderView::handleRightMouseDown(x, y, mask);
|
||||
}
|
||||
|
||||
void LLPlacesFolderView::setupMenuHandle(LLInventoryType::EType asset_type, LLHandle<LLView> menu_handle)
|
||||
{
|
||||
mMenuHandlesByInventoryType[asset_type] = menu_handle;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
/**
|
||||
* @file llplacesfolderview.h
|
||||
* @brief llplacesfolderview used within llplacesinventorypanel
|
||||
* @author Gilbert@lindenlab.com
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2012, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
#ifndef LL_LLPLACESFOLDERVIEW_H
|
||||
#define LL_LLPLACESFOLDERVIEW_H
|
||||
|
||||
#include "llfolderview.h"
|
||||
#include "llinventorypanel.h"
|
||||
|
||||
class LLLandmarksPanel;
|
||||
|
||||
class LLPlacesFolderView : public LLFolderView
|
||||
{
|
||||
public:
|
||||
|
||||
struct Params : public LLInitParam::Block<Params, LLFolderView::Params>
|
||||
{
|
||||
Params()
|
||||
{}
|
||||
};
|
||||
|
||||
LLPlacesFolderView(const LLFolderView::Params& p);
|
||||
/**
|
||||
* Handles right mouse down
|
||||
*
|
||||
* Contains workaround for EXT-2786: sets current selected list for landmark
|
||||
* panel using @c mParentLandmarksPanel which is set in @c LLLandmarksPanel::initLandmarksPanel
|
||||
*/
|
||||
/*virtual*/ BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
|
||||
|
||||
void setupMenuHandle(LLInventoryType::EType asset_type, LLHandle<LLView> menu_handle);
|
||||
|
||||
void setParentLandmarksPanel(LLLandmarksPanel* panel)
|
||||
{
|
||||
mParentLandmarksPanel = panel;
|
||||
}
|
||||
|
||||
private:
|
||||
/**
|
||||
* holds pointer to landmark panel. This pointer is used in @c LLPlacesFolderView::handleRightMouseDown
|
||||
*/
|
||||
LLLandmarksPanel* mParentLandmarksPanel;
|
||||
typedef std::map<LLInventoryType::EType, LLHandle<LLView> > inventory_type_menu_handle_t;
|
||||
inventory_type_menu_handle_t mMenuHandlesByInventoryType;
|
||||
|
||||
};
|
||||
|
||||
#endif // LL_LLPLACESFOLDERVIEW_H
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
#include "llplacesinventorypanel.h"
|
||||
|
||||
#include "llfolderviewmodel.h"
|
||||
#include "llfolderview.h"
|
||||
#include "llplacesfolderview.h"
|
||||
#include "llinventorybridge.h"
|
||||
#include "llinventoryfunctions.h"
|
||||
#include "llpanellandmarks.h"
|
||||
|
|
@ -58,6 +58,34 @@ LLPlacesInventoryPanel::~LLPlacesInventoryPanel()
|
|||
delete mSavedFolderState;
|
||||
}
|
||||
|
||||
|
||||
LLFolderView * LLPlacesInventoryPanel::createFolderRoot(LLUUID root_id )
|
||||
{
|
||||
LLPlacesFolderView::Params p;
|
||||
|
||||
p.name = getName();
|
||||
p.title = getLabel();
|
||||
p.rect = LLRect(0, 0, getRect().getWidth(), 0);
|
||||
p.parent_panel = this;
|
||||
p.tool_tip = p.name;
|
||||
p.listener = mInvFVBridgeBuilder->createBridge( LLAssetType::AT_CATEGORY,
|
||||
LLAssetType::AT_CATEGORY,
|
||||
LLInventoryType::IT_CATEGORY,
|
||||
this,
|
||||
&mInventoryViewModel,
|
||||
NULL,
|
||||
root_id);
|
||||
p.view_model = &mInventoryViewModel;
|
||||
p.use_label_suffix = mParams.use_label_suffix;
|
||||
p.allow_multiselect = mAllowMultiSelect;
|
||||
p.show_empty_message = mShowEmptyMessage;
|
||||
p.show_item_link_overlays = mShowItemLinkOverlays;
|
||||
p.root = NULL;
|
||||
p.use_ellipses = mParams.folder_view.use_ellipses;
|
||||
|
||||
return LLUICtrlFactory::create<LLPlacesFolderView>(p);
|
||||
}
|
||||
|
||||
// save current folder open state
|
||||
void LLPlacesInventoryPanel::saveFolderState()
|
||||
{
|
||||
|
|
@ -91,59 +119,3 @@ S32 LLPlacesInventoryPanel::notify(const LLSD& info)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* PROTECTED METHODS */
|
||||
/************************************************************************/
|
||||
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* LLPlacesFolderView implementation */
|
||||
/************************************************************************/
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC METHODS
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
LLPlacesFolderView::LLPlacesFolderView(const LLFolderView::Params& p)
|
||||
: LLFolderView(p)
|
||||
{
|
||||
// we do not need auto select functionality in places landmarks, so override default behavior.
|
||||
// this disables applying of the LLSelectFirstFilteredItem in LLFolderView::doIdle.
|
||||
// Fixed issues: EXT-1631, EXT-4994.
|
||||
mAutoSelectOverride = TRUE;
|
||||
}
|
||||
|
||||
BOOL LLPlacesFolderView::handleRightMouseDown(S32 x, S32 y, MASK mask)
|
||||
{
|
||||
// let children to change selection first
|
||||
childrenHandleRightMouseDown(x, y, mask);
|
||||
mParentLandmarksPanel->setCurrentSelectedList((LLPlacesInventoryPanel*)getParentPanel());
|
||||
|
||||
// then determine its type and set necessary menu handle
|
||||
if (getCurSelectedItem())
|
||||
{
|
||||
LLInventoryType::EType inventory_type = static_cast<LLFolderViewModelItemInventory*>(getCurSelectedItem()->getViewModelItem())->getInventoryType();
|
||||
inventory_type_menu_handle_t::iterator it_handle = mMenuHandlesByInventoryType.find(inventory_type);
|
||||
|
||||
if (it_handle != mMenuHandlesByInventoryType.end())
|
||||
{
|
||||
mPopupMenuHandle = (*it_handle).second;
|
||||
}
|
||||
else
|
||||
{
|
||||
llwarns << "Requested menu handle for non-setup inventory type: " << inventory_type << llendl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return LLFolderView::handleRightMouseDown(x, y, mask);
|
||||
}
|
||||
|
||||
void LLPlacesFolderView::setupMenuHandle(LLInventoryType::EType asset_type, LLHandle<LLView> menu_handle)
|
||||
{
|
||||
mMenuHandlesByInventoryType[asset_type] = menu_handle;
|
||||
}
|
||||
|
||||
// EOF
|
||||
|
|
|
|||
|
|
@ -29,9 +29,9 @@
|
|||
|
||||
#include "llfloaterinventory.h"
|
||||
#include "llinventorypanel.h"
|
||||
#include "llfolderview.h"
|
||||
|
||||
class LLLandmarksPanel;
|
||||
class LLFolderView;
|
||||
|
||||
class LLPlacesInventoryPanel : public LLInventoryPanel
|
||||
{
|
||||
|
|
@ -46,6 +46,7 @@ public:
|
|||
LLPlacesInventoryPanel(const Params& p);
|
||||
~LLPlacesInventoryPanel();
|
||||
|
||||
LLFolderView * createFolderRoot(LLUUID root_id );
|
||||
void saveFolderState();
|
||||
void restoreFolderState();
|
||||
|
||||
|
|
@ -55,34 +56,4 @@ private:
|
|||
LLSaveFolderState* mSavedFolderState;
|
||||
};
|
||||
|
||||
//TODO RN: this class is currently unused, make sure that behavior remains
|
||||
class LLPlacesFolderView : public LLFolderView
|
||||
{
|
||||
public:
|
||||
LLPlacesFolderView(const LLFolderView::Params& p);
|
||||
/**
|
||||
* Handles right mouse down
|
||||
*
|
||||
* Contains workaround for EXT-2786: sets current selected list for landmark
|
||||
* panel using @c mParentLandmarksPanel which is set in @c LLLandmarksPanel::initLandmarksPanel
|
||||
*/
|
||||
/*virtual*/ BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
|
||||
|
||||
void setupMenuHandle(LLInventoryType::EType asset_type, LLHandle<LLView> menu_handle);
|
||||
|
||||
void setParentLandmarksPanel(LLLandmarksPanel* panel)
|
||||
{
|
||||
mParentLandmarksPanel = panel;
|
||||
}
|
||||
|
||||
private:
|
||||
/**
|
||||
* holds pointer to landmark panel. This pointer is used in @c LLPlacesFolderView::handleRightMouseDown
|
||||
*/
|
||||
LLLandmarksPanel* mParentLandmarksPanel;
|
||||
typedef std::map<LLInventoryType::EType, LLHandle<LLView> > inventory_type_menu_handle_t;
|
||||
inventory_type_menu_handle_t mMenuHandlesByInventoryType;
|
||||
|
||||
};
|
||||
|
||||
#endif //LL_LLINVENTORYSUBTREEPANEL_H
|
||||
|
|
|
|||
Loading…
Reference in New Issue