From b94aa751c93b2c9bf9a9567946fe388a7c475d77 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 17 Jan 2017 20:11:00 +0200 Subject: MAINT-6959 Ability to set custom folders for uploading items --- .../newview/app_settings/settings_per_account.xml | 44 +++++++ indra/newview/llfloaterpreference.cpp | 64 +++++++++- indra/newview/llfloaterpreference.h | 4 + indra/newview/llinventorybridge.cpp | 3 + indra/newview/llinventorymodel.cpp | 36 ++++++ indra/newview/llinventorymodel.h | 3 + indra/newview/llinventorypanel.cpp | 23 +++- indra/newview/llinventorypanel.h | 1 + indra/newview/llmeshrepository.cpp | 12 +- indra/newview/llviewerassetupload.cpp | 3 +- .../skins/default/xui/en/floater_preferences.xml | 7 + .../skins/default/xui/en/menu_inventory.xml | 37 ++++++ .../default/xui/en/panel_preferences_uploads.xml | 142 +++++++++++++++++++++ 13 files changed, 369 insertions(+), 10 deletions(-) create mode 100644 indra/newview/skins/default/xui/en/panel_preferences_uploads.xml diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml index eee13fb28e..92e61d2e86 100644 --- a/indra/newview/app_settings/settings_per_account.xml +++ b/indra/newview/app_settings/settings_per_account.xml @@ -348,5 +348,49 @@ Value 1 + ModelUploadFolder + + Comment + All model uploads will be stored in this directory (UUID) + Persist + 1 + Type + String + Value + + + TextureUploadFolder + + Comment + All image(texture) uploads will be stored in this directory (UUID) + Persist + 1 + Type + String + Value + + + SoundUploadFolder + + Comment + All sound uploads will be stored in this directory (UUID) + Persist + 1 + Type + String + Value + + + AnimationUploadFolder + + Comment + All animation uploads will be stored in this directory (UUID) + Persist + 1 + Type + String + Value + + diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 100ee5ab72..02dffa7f08 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -467,6 +467,11 @@ BOOL LLFloaterPreference::postBuild() gSavedSettings.getControl("PreferredMaturity")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeMaturity, this)); + gSavedPerAccountSettings.getControl("ModelUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeModelFolder, this)); + gSavedPerAccountSettings.getControl("TextureUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeTextureFolder, this)); + gSavedPerAccountSettings.getControl("SoundUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeSoundFolder, this)); + gSavedPerAccountSettings.getControl("AnimationUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeAnimationFolder, this)); + LLTabContainer* tabcontainer = getChild("pref core"); if (!tabcontainer->selectTab(gSavedSettings.getS32("LastPrefTab"))) tabcontainer->selectFirstTab(); @@ -501,6 +506,7 @@ BOOL LLFloaterPreference::postBuild() fov_slider->setMinValue(LLViewerCamera::getInstance()->getMinView()); fov_slider->setMaxValue(LLViewerCamera::getInstance()->getMaxView()); + return TRUE; } @@ -742,7 +748,12 @@ void LLFloaterPreference::onOpen(const LLSD& key) // Display selected maturity icons. onChangeMaturity(); - + + onChangeModelFolder(); + onChangeTextureFolder(); + onChangeSoundFolder(); + onChangeAnimationFolder(); + // Load (double-)click to walk/teleport settings. updateClickActionControls(); @@ -1979,6 +1990,57 @@ void LLFloaterPreference::onChangeMaturity() getChild("rating_icon_adult")->setVisible(sim_access == SIM_ACCESS_ADULT); } +std::string get_category_path(LLUUID cat_id) +{ + LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); + if (cat->getParentUUID().notNull()) + { + return get_category_path(cat->getParentUUID()) + " > " + cat->getName(); + } + else + { + return cat->getName(); + } +} + +std::string get_category_path(LLFolderType::EType cat_type) +{ + LLUUID cat_id = gInventory.findUserDefinedCategoryUUIDForType(cat_type); + return get_category_path(cat_id); +} + +void LLFloaterPreference::onChangeModelFolder() +{ + if (gInventory.isInventoryUsable()) + { + getChild("upload_models")->setText(get_category_path(LLFolderType::FT_OBJECT)); + } +} + +void LLFloaterPreference::onChangeTextureFolder() +{ + if (gInventory.isInventoryUsable()) + { + getChild("upload_textures")->setText(get_category_path(LLFolderType::FT_TEXTURE)); + } +} + +void LLFloaterPreference::onChangeSoundFolder() +{ + if (gInventory.isInventoryUsable()) + { + getChild("upload_sounds")->setText(get_category_path(LLFolderType::FT_SOUND)); + } +} + +void LLFloaterPreference::onChangeAnimationFolder() +{ + if (gInventory.isInventoryUsable()) + { + getChild("upload_animation")->setText(get_category_path(LLFolderType::FT_ANIMATION)); + } +} + // FIXME: this will stop you from spawning the sidetray from preferences dialog on login screen // but the UI for this will still be enabled void LLFloaterPreference::onClickBlockList() diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index fa0c09e97a..ea199cf034 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -161,6 +161,10 @@ public: void onCommitMusicEnabled(); void applyResolution(); void onChangeMaturity(); + void onChangeModelFolder(); + void onChangeTextureFolder(); + void onChangeSoundFolder(); + void onChangeAnimationFolder(); void onClickBlockList(); void onClickProxySettings(); void onClickTranslationSettings(); diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 1de579d4c3..b7f5424f25 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -3789,6 +3789,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items disabled_items.push_back(std::string("New Gesture")); disabled_items.push_back(std::string("New Clothes")); disabled_items.push_back(std::string("New Body Parts")); + disabled_items.push_back(std::string("upload_def")); } if (favorites == mUUID) { @@ -3815,6 +3816,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items disabled_items.push_back(std::string("New Gesture")); disabled_items.push_back(std::string("New Clothes")); disabled_items.push_back(std::string("New Body Parts")); + disabled_items.push_back(std::string("upload_def")); } if (marketplace_listings_id == mUUID) { @@ -3864,6 +3866,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items items.push_back(std::string("New Gesture")); items.push_back(std::string("New Clothes")); items.push_back(std::string("New Body Parts")); + items.push_back(std::string("upload_def")); } } getClipboardEntries(false, items, disabled_items, flags); diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 503fa28a33..287fa4c45b 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -515,6 +515,42 @@ const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType prefe return findCategoryUUIDForTypeInRoot(preferred_type, create_folder, gInventory.getRootFolderID()); } +const LLUUID LLInventoryModel::findUserDefinedCategoryUUIDForType(LLFolderType::EType preferred_type) +{ + LLUUID cat_id; + switch (preferred_type) + { + case LLFolderType::FT_OBJECT: + { + cat_id = LLUUID(gSavedPerAccountSettings.getString("ModelUploadFolder")); + break; + } + case LLFolderType::FT_TEXTURE: + { + cat_id = LLUUID(gSavedPerAccountSettings.getString("TextureUploadFolder")); + break; + } + case LLFolderType::FT_SOUND: + { + cat_id = LLUUID(gSavedPerAccountSettings.getString("SoundUploadFolder")); + break; + } + case LLFolderType::FT_ANIMATION: + { + cat_id = LLUUID(gSavedPerAccountSettings.getString("AnimationUploadFolder")); + break; + } + default: + break; + } + + if (cat_id.isNull() || !getCategory(cat_id)) + { + cat_id = findCategoryUUIDForTypeInRoot(preferred_type, true, getRootFolderID()); + } + return cat_id; +} + const LLUUID LLInventoryModel::findLibraryCategoryUUIDForType(LLFolderType::EType preferred_type, bool create_folder) { return findCategoryUUIDForTypeInRoot(preferred_type, create_folder, gInventory.getLibraryRootFolderID()); diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index 826d1f880d..dee1769172 100644 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -287,6 +287,9 @@ public: // will search in the user's library folder instead of "My Inventory" const LLUUID findLibraryCategoryUUIDForType(LLFolderType::EType preferred_type, bool create_folder = true); + // Returns user specified category for uploads, returns default id if there are no + // user specified one or it does not exist, creates default category if it is missing. + const LLUUID findUserDefinedCategoryUUIDForType(LLFolderType::EType preferred_type); // Get whatever special folder this object is a child of, if any. const LLViewerInventoryCategory *getFirstNondefaultParent(const LLUUID& obj_id) const; diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 6a27c0fe21..bd15ba4975 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -167,7 +167,7 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) : mCommitCallbackRegistrar.add("Inventory.AttachObject", boost::bind(&LLInventoryPanel::attachObject, this, _2)); mCommitCallbackRegistrar.add("Inventory.BeginIMSession", boost::bind(&LLInventoryPanel::beginIMSession, this)); mCommitCallbackRegistrar.add("Inventory.Share", boost::bind(&LLAvatarActions::shareWithAvatars, this)); - + mCommitCallbackRegistrar.add("Inventory.FileUploadLocation", boost::bind(&LLInventoryPanel::fileUploadLocation, this, _2)); } LLFolderView * LLInventoryPanel::createFolderRoot(LLUUID root_id ) @@ -1190,6 +1190,27 @@ bool LLInventoryPanel::beginIMSession() return true; } +void LLInventoryPanel::fileUploadLocation(const LLSD& userdata) +{ + const std::string param = userdata.asString(); + if (param == "model") + { + gSavedPerAccountSettings.setString("ModelUploadFolder", LLFolderBridge::sSelf.get()->getUUID().asString()); + } + else if (param == "texture") + { + gSavedPerAccountSettings.setString("TextureUploadFolder", LLFolderBridge::sSelf.get()->getUUID().asString()); + } + else if (param == "sound") + { + gSavedPerAccountSettings.setString("SoundUploadFolder", LLFolderBridge::sSelf.get()->getUUID().asString()); + } + else if (param == "animation") + { + gSavedPerAccountSettings.setString("AnimationUploadFolder", LLFolderBridge::sSelf.get()->getUUID().asString()); + } +} + bool LLInventoryPanel::attachObject(const LLSD& userdata) { // Copy selected item UUIDs to a vector. diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index b69edd8b93..5cb9dde47a 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -201,6 +201,7 @@ public: void doToSelected(const LLSD& userdata); void doCreate(const LLSD& userdata); bool beginIMSession(); + void fileUploadLocation(const LLSD& userdata); bool attachObject(const LLSD& userdata); static void idle(void* user_data); diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 9dacae2c4e..1a533dace7 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -2030,8 +2030,8 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) LLSD result; LLSD res; - result["folder_id"] = gInventory.findCategoryUUIDForType(LLFolderType::FT_OBJECT); - result["texture_folder_id"] = gInventory.findCategoryUUIDForType(LLFolderType::FT_TEXTURE); + result["folder_id"] = gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_OBJECT); + result["texture_folder_id"] = gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_TEXTURE); result["asset_type"] = "mesh"; result["inventory_type"] = "object"; result["description"] = "(No Description)"; @@ -3536,11 +3536,11 @@ void LLMeshRepository::notifyLoadedMeshes() // Handle addition of texture, if any. if ( data.mResponse.has("new_texture_folder_id") ) { - const LLUUID& folder_id = data.mResponse["new_texture_folder_id"].asUUID(); + const LLUUID& new_folder_id = data.mResponse["new_texture_folder_id"].asUUID(); - if ( folder_id.notNull() ) + if ( new_folder_id.notNull() ) { - LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TEXTURE); + LLUUID parent_id = gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_TEXTURE); std::string name; // Check if the server built a different name for the texture folder @@ -3555,7 +3555,7 @@ void LLMeshRepository::notifyLoadedMeshes() // Add the category to the internal representation LLPointer cat = - new LLViewerInventoryCategory(folder_id, parent_id, + new LLViewerInventoryCategory(new_folder_id, parent_id, LLFolderType::FT_NONE, name, gAgent.getID()); cat->setVersion(LLViewerInventoryCategory::VERSION_UNKNOWN); diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp index cafaf8645a..49d29c0e4e 100644 --- a/indra/newview/llviewerassetupload.cpp +++ b/indra/newview/llviewerassetupload.cpp @@ -307,10 +307,9 @@ void LLResourceUploadInfo::assignDefaults() mDescription = "(No Description)"; } - mFolderId = gInventory.findCategoryUUIDForType( + mFolderId = gInventory.findUserDefinedCategoryUUIDForType( (mDestinationFolderType == LLFolderType::FT_NONE) ? (LLFolderType::EType)mAssetType : mDestinationFolderType); - } std::string LLResourceUploadInfo::getDisplayName() const diff --git a/indra/newview/skins/default/xui/en/floater_preferences.xml b/indra/newview/skins/default/xui/en/floater_preferences.xml index 9a9101e0da..5ca527ad20 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences.xml @@ -120,6 +120,13 @@ layout="topleft" help_topic="preferences_advanced1_tab" name="advanced1" /> + diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml index 5b8a9413bf..e1f9269c70 100644 --- a/indra/newview/skins/default/xui/en/menu_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory.xml @@ -321,6 +321,43 @@ parameter="eyes" /> + + + + + + + + + + + + + + + + + Current destination folders for uploads + + + + Images + + + + + Sounds + + + + + Animations + + + + + Models + + + + + To change a destination folder, right click on it in inventory and choose + "Use as default for" + + -- cgit v1.2.3