Skip to content
Snippets Groups Projects
Commit f24f72d2 authored by Andrey Kleshchev's avatar Andrey Kleshchev Committed by akleshchev
Browse files

SL-19826 Gallery multiselect support Part#3

wip
parent 992d4ec3
No related branches found
No related tags found
2 merge requests!3Update to main branch,!2Rebase onto current main branch
......@@ -454,7 +454,10 @@ void copy_inventory_category(LLInventoryModel* model,
inventory_func_type func = [model, cat, root_copy_id, move_no_copy_items, callback](const LLUUID &new_id)
{
copy_inventory_category_content(new_id, model, cat, root_copy_id, move_no_copy_items);
if (callback)
{
callback(new_id);
}
};
gInventory.createNewCategory(parent_id, LLFolderType::FT_NONE, cat->getName(), func, cat->getThumbnailUUID());
}
......
This diff is collapsed.
......@@ -82,10 +82,12 @@ class LLInventoryGallery : public LLPanel, public LLEditMenuHandler
void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) override;
BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override;
BOOL handleKeyHere(KEY key, MASK mask) override;
void moveUp();
void moveDown();
void moveLeft();
void moveRight();
void moveUp(MASK mask);
void moveDown(MASK mask);
void moveLeft(MASK mask);
void moveRight(MASK mask);
void toggleSelectionRange(S32 start_idx, S32 end_idx);
void toggleSelectionRangeFromLast(const LLUUID target);
void onFocusLost() override;
void onFocusReceived() override;
......@@ -130,6 +132,8 @@ class LLInventoryGallery : public LLPanel, public LLEditMenuHandler
void deselectItem(const LLUUID& category_id);
void clearSelection();
void changeItemSelection(const LLUUID& item_id, bool scroll_to_selection = false);
void addItemSelection(const LLUUID& item_id, bool scroll_to_selection = false);
bool toggleItemSelection(const LLUUID& item_id, bool scroll_to_selection = false);
void scrollToShowItem(const LLUUID& item_id);
void signalSelectionItemID(const LLUUID& category_id);
boost::signals2::connection setSelectionChangeCallback(selection_change_callback_t cb);
......@@ -174,6 +178,15 @@ class LLInventoryGallery : public LLPanel, public LLEditMenuHandler
void showContextMenu(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& item_id);
protected:
void paste(const LLUUID& dest,
std::vector<LLUUID>& objects,
bool is_cut_mode,
const LLUUID& marketplacelistings_id);
void pasteAsLink(const LLUUID& dest,
std::vector<LLUUID>& objects,
const LLUUID& current_outfit_id,
const LLUUID& marketplacelistings_id,
const LLUUID& my_outifts_id);
bool applyFilter(LLInventoryGalleryItem* item, const std::string& filter_substring);
bool checkAgainstFilters(LLInventoryGalleryItem* item, const std::string& filter_substring);
......@@ -185,8 +198,8 @@ class LLInventoryGallery : public LLPanel, public LLEditMenuHandler
LLGalleryGestureObserver* mGestureObserver;
LLInventoryObserver* mInventoryObserver;
selection_deque mSelectedItemIDs;
LLUUID mItemToSelect;
bool mNeedsSelection;
selection_deque mItemsToSelect;
LLUUID mLastSelectedUUID;
bool mIsInitialized;
bool mRootDirty;
......
......@@ -51,17 +51,18 @@
LLContextMenu* LLInventoryGalleryContextMenu::createMenu()
{
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
//LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
LLUUID selected_id = mUUIDs.front();
LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
registrar.add("Inventory.DoToSelected", boost::bind(&LLInventoryGalleryContextMenu::doToSelected, this, _2, selected_id));
registrar.add("Inventory.FileUploadLocation", boost::bind(&LLInventoryGalleryContextMenu::fileUploadLocation, this, _2, selected_id));
registrar.add("Inventory.DoToSelected", boost::bind(&LLInventoryGalleryContextMenu::doToSelected, this, _2));
registrar.add("Inventory.FileUploadLocation", boost::bind(&LLInventoryGalleryContextMenu::fileUploadLocation, this, _2));
registrar.add("Inventory.EmptyTrash", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyTrash", LLFolderType::FT_TRASH));
registrar.add("Inventory.EmptyLostAndFound", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyLostAndFound", LLFolderType::FT_LOST_AND_FOUND));
std::set<LLUUID> uuids{selected_id};
std::set<LLUUID> uuids(mUUIDs.begin(), mUUIDs.end());
registrar.add("Inventory.Share", boost::bind(&LLAvatarActions::shareWithAvatars, uuids, gFloaterView->getParentFloater(mGallery)));
enable_registrar.add("Inventory.CanSetUploadLocation", boost::bind(&LLInventoryGalleryContextMenu::canSetUploadLocation, this, _2));
LLContextMenu* menu = createFromFile("menu_gallery_inventory.xml");
updateMenuItemsVisibility(menu);
......@@ -69,25 +70,27 @@ LLContextMenu* LLInventoryGalleryContextMenu::createMenu()
return menu;
}
void LLInventoryGalleryContextMenu::doToSelected(const LLSD& userdata, const LLUUID& selected_id)
void LLInventoryGalleryContextMenu::doToSelected(const LLSD& userdata)
{
std::string action = userdata.asString();
LLInventoryObject* obj = gInventory.getObject(selected_id);
LLInventoryObject* obj = gInventory.getObject(mUUIDs.front());
if(!obj) return;
if ("open_selected_folder" == action)
{
mGallery->setRootFolder(selected_id);
mGallery->setRootFolder(mUUIDs.front());
}
else if ("open_in_new_window" == action)
{
new_folder_window(selected_id);
new_folder_window(mUUIDs.front());
}
else if ("properties" == action)
{
show_item_profile(selected_id);
show_item_profile(mUUIDs.front());
}
else if ("restore" == action)
{
for (LLUUID& selected_id : mUUIDs)
{
LLViewerInventoryCategory* cat = gInventory.getCategory(selected_id);
if (cat)
......@@ -109,9 +112,10 @@ void LLInventoryGalleryContextMenu::doToSelected(const LLSD& userdata, const LLU
}
}
}
}
else if ("copy_uuid" == action)
{
LLViewerInventoryItem* item = gInventory.getItem(selected_id);
LLViewerInventoryItem* item = gInventory.getItem(mUUIDs.front());
if(item)
{
LLUUID asset_id = item->getProtectedAssetUUID();
......@@ -122,16 +126,19 @@ void LLInventoryGalleryContextMenu::doToSelected(const LLSD& userdata, const LLU
}
}
else if ("purge" == action)
{
for (LLUUID& selected_id : mUUIDs)
{
remove_inventory_object(selected_id, NULL);
}
}
else if ("goto" == action)
{
show_item_original(selected_id);
show_item_original(mUUIDs.front());
}
else if ("thumbnail" == action)
{
LLSD data(selected_id);
LLSD data(mUUIDs.front());
LLFloaterReg::showInstance("change_item_thumbnail", data);
}
else if ("cut" == action)
......@@ -165,39 +172,44 @@ void LLInventoryGalleryContextMenu::doToSelected(const LLSD& userdata, const LLU
}
else if ("rename" == action)
{
LLSD args;
args["NAME"] = obj->getName();
LLSD payload;
payload["id"] = selected_id;
LLNotificationsUtil::add("RenameItem", args, payload, boost::bind(onRename, _1, _2));
rename(mUUIDs.front());
}
else if ("open" == action || "open_original" == action)
{
LLViewerInventoryItem* item = gInventory.getItem(selected_id);
LLViewerInventoryItem* item = gInventory.getItem(mUUIDs.front());
if (item)
{
LLInvFVBridgeAction::doAction(item->getType(), selected_id , &gInventory);
LLInvFVBridgeAction::doAction(item->getType(), mUUIDs.front(), &gInventory);
}
}
else if ("ungroup_folder_items" == action)
{
ungroup_folder_items(selected_id);
ungroup_folder_items(mUUIDs.front());
}
else if ("take_off" == action || "detach" == action)
{
for (LLUUID& selected_id : mUUIDs)
{
LLAppearanceMgr::instance().removeItemFromAvatar(selected_id);
}
}
else if ("wear_add" == action)
{
for (LLUUID& selected_id : mUUIDs)
{
LLAppearanceMgr::instance().wearItemOnAvatar(selected_id, true, false); // Don't replace if adding.
}
}
else if ("wear" == action)
{
for (LLUUID& selected_id : mUUIDs)
{
LLAppearanceMgr::instance().wearItemOnAvatar(selected_id, true, true);
}
}
else if ("activate" == action)
{
for (LLUUID& selected_id : mUUIDs)
{
LLGestureMgr::instance().activateGesture(selected_id);
......@@ -205,9 +217,12 @@ void LLInventoryGalleryContextMenu::doToSelected(const LLSD& userdata, const LLU
if (!item) return;
gInventory.updateItem(item);
}
gInventory.notifyObservers();
}
else if ("deactivate" == action)
{
for (LLUUID& selected_id : mUUIDs)
{
LLGestureMgr::instance().deactivateGesture(selected_id);
......@@ -215,11 +230,12 @@ void LLInventoryGalleryContextMenu::doToSelected(const LLSD& userdata, const LLU
if (!item) return;
gInventory.updateItem(item);
}
gInventory.notifyObservers();
}
else if ("replace_links" == action)
{
LLFloaterReg::showInstance("linkreplace", LLSD(selected_id));
LLFloaterReg::showInstance("linkreplace", LLSD(mUUIDs.front()));
}
else if ("copy_slurl" == action)
{
......@@ -236,7 +252,7 @@ void LLInventoryGalleryContextMenu::doToSelected(const LLSD& userdata, const LLU
};
LLLandmarkActions::getSLURLfromPosGlobal(global_pos, copy_slurl_to_clipboard_cb, true);
};
LLLandmark* landmark = LLLandmarkActions::getLandmark(selected_id, copy_slurl_cb);
LLLandmark* landmark = LLLandmarkActions::getLandmark(mUUIDs.front(), copy_slurl_cb);
if (landmark)
{
copy_slurl_cb(landmark);
......@@ -246,7 +262,7 @@ void LLInventoryGalleryContextMenu::doToSelected(const LLSD& userdata, const LLU
{
LLSD key;
key["type"] = "landmark";
key["id"] = selected_id;
key["id"] = mUUIDs.front();
LLFloaterSidePanelContainer::showPanel("places", key);
}
else if ("show_on_map" == action)
......@@ -264,7 +280,7 @@ void LLInventoryGalleryContextMenu::doToSelected(const LLSD& userdata, const LLU
}
}
};
LLLandmark* landmark = LLLandmarkActions::getLandmark(selected_id, show_on_map_cb);
LLLandmark* landmark = LLLandmarkActions::getLandmark(mUUIDs.front(), show_on_map_cb);
if(landmark)
{
show_on_map_cb(landmark);
......@@ -272,7 +288,7 @@ void LLInventoryGalleryContextMenu::doToSelected(const LLSD& userdata, const LLU
}
else if ("save_as" == action)
{
LLPreviewTexture* preview_texture = LLFloaterReg::getTypedInstance<LLPreviewTexture>("preview_texture", selected_id);
LLPreviewTexture* preview_texture = LLFloaterReg::getTypedInstance<LLPreviewTexture>("preview_texture", mUUIDs.front());
if (preview_texture)
{
preview_texture->openToSave();
......@@ -281,6 +297,20 @@ void LLInventoryGalleryContextMenu::doToSelected(const LLSD& userdata, const LLU
}
}
void LLInventoryGalleryContextMenu::rename(const LLUUID& item_id)
{
LLInventoryObject* obj = gInventory.getObject(item_id);
if (!obj) return;
LLSD args;
args["NAME"] = obj->getName();
LLSD payload;
payload["id"] = mUUIDs.front();
LLNotificationsUtil::add("RenameItem", args, payload, boost::bind(onRename, _1, _2));
}
void LLInventoryGalleryContextMenu::onRename(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
......@@ -311,25 +341,39 @@ void LLInventoryGalleryContextMenu::onRename(const LLSD& notification, const LLS
}
}
void LLInventoryGalleryContextMenu::fileUploadLocation(const LLSD& userdata, const LLUUID& selected_id)
void LLInventoryGalleryContextMenu::fileUploadLocation(const LLSD& userdata)
{
const std::string param = userdata.asString();
if (param == "model")
{
gSavedPerAccountSettings.setString("ModelUploadFolder", selected_id.asString());
gSavedPerAccountSettings.setString("ModelUploadFolder", mUUIDs.front().asString());
}
else if (param == "texture")
{
gSavedPerAccountSettings.setString("TextureUploadFolder", selected_id.asString());
gSavedPerAccountSettings.setString("TextureUploadFolder", mUUIDs.front().asString());
}
else if (param == "sound")
{
gSavedPerAccountSettings.setString("SoundUploadFolder", selected_id.asString());
gSavedPerAccountSettings.setString("SoundUploadFolder", mUUIDs.front().asString());
}
else if (param == "animation")
{
gSavedPerAccountSettings.setString("AnimationUploadFolder", selected_id.asString());
gSavedPerAccountSettings.setString("AnimationUploadFolder", mUUIDs.front().asString());
}
}
bool LLInventoryGalleryContextMenu::canSetUploadLocation(const LLSD& userdata)
{
if (mUUIDs.size() != 1)
{
return false;
}
LLInventoryCategory* cat = gInventory.getCategory(mUUIDs.front());
if (!cat)
{
return false;
}
return true;
}
bool is_inbox_folder(LLUUID item_id)
......
......@@ -39,13 +39,15 @@ class LLInventoryGalleryContextMenu : public LLListContextMenu
bool isRootFolder() { return mRootFolder; }
void setRootFolder(bool is_root) { mRootFolder = is_root; }
void doToSelected(const LLSD& userdata, const LLUUID& selected_id);
void doToSelected(const LLSD& userdata);
void rename(const LLUUID& item_id);
protected:
//virtual void buildContextMenu(class LLMenuGL& menu, U32 flags);
void updateMenuItemsVisibility(LLContextMenu* menu);
void fileUploadLocation(const LLSD& userdata, const LLUUID& selected_id);
void fileUploadLocation(const LLSD& userdata);
bool canSetUploadLocation(const LLSD& userdata);
static void onRename(const LLSD& notification, const LLSD& response);
......
......@@ -453,6 +453,8 @@
<menu_item_call.on_click
function="Inventory.FileUploadLocation"
parameter="texture" />
<menu_item_call.on_visible
function="Inventory.CanSetUploadLocation" />
</menu_item_call>
<menu_item_call
label="Sound uploads"
......@@ -461,6 +463,8 @@
<menu_item_call.on_click
function="Inventory.FileUploadLocation"
parameter="sound" />
<menu_item_call.on_visible
function="Inventory.CanSetUploadLocation" />
</menu_item_call>
<menu_item_call
label="Animation uploads"
......@@ -469,6 +473,8 @@
<menu_item_call.on_click
function="Inventory.FileUploadLocation"
parameter="animation" />
<menu_item_call.on_visible
function="Inventory.CanSetUploadLocation" />
</menu_item_call>
<menu_item_call
label="Model uploads"
......@@ -477,6 +483,8 @@
<menu_item_call.on_click
function="Inventory.FileUploadLocation"
parameter="model" />
<menu_item_call.on_visible
function="Inventory.CanSetUploadLocation" />
</menu_item_call>
</menu>
<menu_item_separator
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment