File Menu Frosting~

Adds Minimize All, and Change Local Textures options
People keep adding how to do Local Textures, here's an easy way right where it'd be expected!
This commit is contained in:
Lirusaito
2013-04-24 14:09:04 -04:00
parent 464b1890f5
commit 3a4714edb1
4 changed files with 109 additions and 96 deletions

View File

@@ -3,10 +3,9 @@
* @brief Processes responses received for asset upload requests. * @brief Processes responses received for asset upload requests.
* *
* $LicenseInfo:firstyear=2007&license=viewergpl$ * $LicenseInfo:firstyear=2007&license=viewergpl$
* * Second Life Viewer Source Code
* Copyright (c) 2007-2009, Linden Research, Inc. * Copyright (c) 2007-2009, Linden Research, Inc.
* *
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0 * to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement * ("GPL"), unless you have obtained a separate licensing agreement
@@ -53,7 +52,6 @@
#include "llviewerobject.h" #include "llviewerobject.h"
#include "llviewercontrol.h" #include "llviewercontrol.h"
#include "llviewerobjectlist.h" #include "llviewerobjectlist.h"
#include "llviewermenufile.h"
#include "llviewertexlayer.h" #include "llviewertexlayer.h"
#include "llviewerwindow.h" #include "llviewerwindow.h"
#include "lltrans.h" #include "lltrans.h"
@@ -255,6 +253,7 @@ void LLAssetUploadResponder::result(const LLSD& content)
lldebugs << "LLAssetUploadResponder::result from capabilities" << llendl; lldebugs << "LLAssetUploadResponder::result from capabilities" << llendl;
std::string state = content["state"]; std::string state = content["state"];
if (state == "upload") if (state == "upload")
{ {
uploadUpload(content); uploadUpload(content);
@@ -343,6 +342,7 @@ void LLNewAgentInventoryResponder::error(U32 statusNum, const std::string& reaso
//LLImportColladaAssetCache::getInstance()->assetUploaded(mVFileID, LLUUID(), FALSE); //LLImportColladaAssetCache::getInstance()->assetUploaded(mVFileID, LLUUID(), FALSE);
} }
//virtual //virtual
void LLNewAgentInventoryResponder::uploadFailure(const LLSD& content) void LLNewAgentInventoryResponder::uploadFailure(const LLSD& content)
{ {
@@ -351,6 +351,7 @@ void LLNewAgentInventoryResponder::uploadFailure(const LLSD& content)
(*mCallBack)(false, mUserData); (*mCallBack)(false, mUserData);
} }
LLAssetUploadResponder::uploadFailure(content); LLAssetUploadResponder::uploadFailure(content);
//LLImportColladaAssetCache::getInstance()->assetUploaded(mVFileID, content["new_asset"], FALSE); //LLImportColladaAssetCache::getInstance()->assetUploaded(mVFileID, content["new_asset"], FALSE);
} }
@@ -397,10 +398,14 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content)
// continue uploading for bulk uploads // continue uploading for bulk uploads
if (!gUploadQueue.empty()) /* Singu Note: sUploadQueue was never getting populated, anywhere! Therefore, this entire block never was reached.
** I have condensed it to here in the hopes it may one day see use. Apparently, it came in with Siana's prep work
** for mesh upload (697dd7e9298282590f8cf858a58335f70302532b), but we never needed it.
static std::deque<std::string> sUploadQueue;
if (!sUploadQueue.empty())
{ {
std::string next_file = gUploadQueue.front(); std::string next_file = sUploadQueue.front();
gUploadQueue.pop_front(); sUploadQueue.pop_front();
if (next_file.empty()) return; if (next_file.empty()) return;
std::string name = gDirUtilp->getBaseFileName(next_file, true); std::string name = gDirUtilp->getBaseFileName(next_file, true);
@@ -448,6 +453,7 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content)
expected_upload_cost, expected_upload_cost,
userdata); userdata);
} }
*/
} }
LLSendTexLayerResponder::LLSendTexLayerResponder(const LLSD& post_data, LLSendTexLayerResponder::LLSendTexLayerResponder(const LLSD& post_data,
@@ -698,6 +704,7 @@ void LLUpdateTaskInventoryResponder::uploadComplete(const LLSD& content)
} }
} }
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
// LLNewAgentInventoryVariablePriceResponder::Impl // // LLNewAgentInventoryVariablePriceResponder::Impl //
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
@@ -1165,3 +1172,4 @@ void LLNewAgentInventoryVariablePriceResponder::showConfirmationDialog(
boost::intrusive_ptr<LLNewAgentInventoryVariablePriceResponder>(this))); boost::intrusive_ptr<LLNewAgentInventoryVariablePriceResponder>(this)));
} }
} }

View File

@@ -3,10 +3,9 @@
* @brief "File" menu in the main menu bar. * @brief "File" menu in the main menu bar.
* *
* $LicenseInfo:firstyear=2002&license=viewergpl$ * $LicenseInfo:firstyear=2002&license=viewergpl$
* * Second Life Viewer Source Code
* Copyright (c) 2002-2009, Linden Research, Inc. * Copyright (c) 2002-2009, Linden Research, Inc.
* *
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0 * to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement * ("GPL"), unless you have obtained a separate licensing agreement
@@ -63,11 +62,9 @@
#include "lltrans.h" #include "lltrans.h"
#include "llfloaterbuycurrency.h" #include "llfloaterbuycurrency.h"
// <edit> // <edit>
#include "llselectmgr.h" #include "floaterlocalassetbrowse.h"
#include "llassettype.h" #include "llassettype.h"
#include "llinventorytype.h" #include "llinventorytype.h"
#include "llbvhloader.h"
#include "lllocalinventory.h"
// </edit> // </edit>
// linden libraries // linden libraries
@@ -89,12 +86,9 @@
#include <boost/tokenizer.hpp> #include <boost/tokenizer.hpp>
#include "hippogridmanager.h" #include "hippogridmanager.h"
#include "importtracker.h"
using namespace LLOldEvents; using namespace LLOldEvents;
std::deque<std::string> gUploadQueue;
typedef LLMemberListener<LLView> view_listener_t; typedef LLMemberListener<LLView> view_listener_t;
@@ -502,6 +496,15 @@ class LLFileMinimizeAllWindows : public view_listener_t
return true; return true;
} }
}; };
class LLFileLocalAssetBrowser : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent>, const LLSD&)
{
FloaterLocalAssetBrowser::show(0);
return true;
}
};
// </edit> // </edit>
class LLFileSavePreview : public view_listener_t class LLFileSavePreview : public view_listener_t
@@ -600,20 +603,6 @@ class LLFileTakeSnapshotToDisk : public view_listener_t
} }
}; };
class LLFileLogOut : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
std::string command(gDirUtilp->getExecutableDir() + gDirUtilp->getDirDelimiter() + gDirUtilp->getExecutableFilename());
gSavedSettings.setBOOL("ShowConsoleWindow", FALSE);
gViewerWindow->getWindow()->ShellEx(command);
gSavedSettings.setBOOL("ShowConsoleWindow", FALSE);
LLAppViewer::instance()->userQuit();
gSavedSettings.setBOOL("ShowConsoleWindow", FALSE);
return true;
}
};
class LLFileQuit : public view_listener_t class LLFileQuit : public view_listener_t
{ {
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
@@ -696,7 +685,7 @@ void upload_new_resource(const std::string& src_filename, std::string name,
"No file extension for the file: '%s'\nPlease make sure the file has a correct file extension", "No file extension for the file: '%s'\nPlease make sure the file has a correct file extension",
short_name.c_str()); short_name.c_str());
args["FILE"] = short_name; args["FILE"] = short_name;
upload_error(error_message, "NofileExtension", filename, args); upload_error(error_message, "NoFileExtension", filename, args);
return; return;
} }
else if (codec == IMG_CODEC_J2C) else if (codec == IMG_CODEC_J2C)
@@ -992,16 +981,10 @@ void temp_upload_callback(const LLUUID& uuid, void* user_data, S32 result, LLExt
perms->setMaskEveryone(PERM_ALL); perms->setMaskEveryone(PERM_ALL);
perms->setMaskGroup(PERM_ALL); perms->setMaskGroup(PERM_ALL);
perms->setMaskNext(PERM_ALL); perms->setMaskNext(PERM_ALL);
LLUUID destination = gInventory.findCategoryUUIDForType(LLFolderType::FT_TEXTURE);
BOOL bUseSystemInventory = (gSavedSettings.getBOOL("AscentUseSystemFolder") && gSavedSettings.getBOOL("AscentSystemTemporary"));
if (bUseSystemInventory)
{
destination = gSystemFolderAssets;
}
LLViewerInventoryItem* item = new LLViewerInventoryItem( LLViewerInventoryItem* item = new LLViewerInventoryItem(
item_id, item_id,
destination, gInventory.findCategoryUUIDForType(LLFolderType::FT_TEXTURE),
*perms, *perms,
uuid, uuid,
(LLAssetType::EType)data->mAssetInfo.mType, (LLAssetType::EType)data->mAssetInfo.mType,
@@ -1011,16 +994,10 @@ void temp_upload_callback(const LLUUID& uuid, void* user_data, S32 result, LLExt
LLSaleInfo::DEFAULT, LLSaleInfo::DEFAULT,
0, 0,
time_corrected()); time_corrected());
if (bUseSystemInventory)
{ item->updateServer(TRUE);
LLLocalInventory::addItem(item); gInventory.updateItem(item);
} gInventory.notifyObservers();
else
{
item->updateServer(TRUE);
gInventory.updateItem(item);
gInventory.notifyObservers();
}
} }
else else
{ {
@@ -1129,40 +1106,44 @@ void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExt
data = NULL; data = NULL;
} }
static LLAssetID upload_new_resource_prep(const LLTransactionID& tid, static LLAssetID upload_new_resource_prep(
LLAssetType::EType asset_type, const LLTransactionID& tid,
LLInventoryType::EType& inventory_type, LLAssetType::EType asset_type,
std::string& name, LLInventoryType::EType& inventory_type,
const std::string& display_name, std::string& name,
std::string& description) const std::string& display_name,
std::string& description)
{ {
LLAssetID uuid = generate_asset_id_for_new_upload(tid); LLAssetID uuid = generate_asset_id_for_new_upload(tid);
increase_new_upload_stats(asset_type); increase_new_upload_stats(asset_type);
assign_defaults_and_show_upload_message(asset_type, assign_defaults_and_show_upload_message(
inventory_type, asset_type,
name, inventory_type,
display_name, name,
description); display_name,
description);
return uuid; return uuid;
} }
LLSD generate_new_resource_upload_capability_body(LLAssetType::EType asset_type, LLSD generate_new_resource_upload_capability_body(
const std::string& name, LLAssetType::EType asset_type,
const std::string& desc, const std::string& name,
LLFolderType::EType destination_folder_type, const std::string& desc,
LLInventoryType::EType inv_type, LLFolderType::EType destination_folder_type,
U32 next_owner_perms, LLInventoryType::EType inv_type,
U32 group_perms, U32 next_owner_perms,
U32 everyone_perms) U32 group_perms,
U32 everyone_perms)
{ {
LLSD body; LLSD body;
body["folder_id"] = gInventory.findCategoryUUIDForType(destination_folder_type == LLFolderType::FT_NONE ? body["folder_id"] = gInventory.findCategoryUUIDForType(
LLFolderType::assetTypeToFolderType(asset_type) : destination_folder_type == LLFolderType::FT_NONE ?
destination_folder_type); LLFolderType::assetTypeToFolderType(asset_type) :
destination_folder_type);
body["asset_type"] = LLAssetType::lookup(asset_type); body["asset_type"] = LLAssetType::lookup(asset_type);
body["inventory_type"] = LLInventoryType::lookup(inv_type); body["inventory_type"] = LLInventoryType::lookup(inv_type);
@@ -1175,28 +1156,36 @@ LLSD generate_new_resource_upload_capability_body(LLAssetType::EType asset_type,
return body; return body;
} }
bool upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_type, bool upload_new_resource(
std::string name, const LLTransactionID &tid,
std::string desc, S32 compression_info, LLAssetType::EType asset_type,
LLFolderType::EType destination_folder_type, std::string name,
LLInventoryType::EType inv_type, std::string desc,
U32 next_owner_perms, S32 compression_info,
U32 group_perms, LLFolderType::EType destination_folder_type,
U32 everyone_perms, LLInventoryType::EType inv_type,
const std::string& display_name, U32 next_owner_perms,
LLAssetStorage::LLStoreAssetCallback callback, U32 group_perms,
S32 expected_upload_cost, U32 everyone_perms,
void *userdata, const std::string& display_name,
void (*callback2)(bool, void*)) LLAssetStorage::LLStoreAssetCallback callback,
S32 expected_upload_cost,
void *userdata,
void (*callback2)(bool, void*))
{ {
if(gDisconnected) if(gDisconnected)
{ {
return false; return false;
} }
LLAssetID uuid =
LLAssetID uuid = upload_new_resource_prep(tid, asset_type, inv_type, upload_new_resource_prep(
name, display_name, desc); tid,
asset_type,
inv_type,
name,
display_name,
desc);
llinfos << "*** Uploading: " llinfos << "*** Uploading: "
<< "\nType: " << LLAssetType::lookup(asset_type) << "\nType: " << LLAssetType::lookup(asset_type)
<< "\nUUID: " << uuid << "\nUUID: " << uuid
@@ -1216,6 +1205,7 @@ bool upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty
// </edit> // </edit>
{ {
llinfos << "New Agent Inventory via capability" << llendl; llinfos << "New Agent Inventory via capability" << llendl;
LLSD body; LLSD body;
body["folder_id"] = gInventory.findCategoryUUIDForType((destination_folder_type == LLFolderType::FT_NONE) ? LLFolderType::assetTypeToFolderType(asset_type) : destination_folder_type); body["folder_id"] = gInventory.findCategoryUUIDForType((destination_folder_type == LLFolderType::FT_NONE) ? LLFolderType::assetTypeToFolderType(asset_type) : destination_folder_type);
body["asset_type"] = LLAssetType::lookup(asset_type); body["asset_type"] = LLAssetType::lookup(asset_type);
@@ -1227,8 +1217,15 @@ bool upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty
body["everyone_mask"] = LLSD::Integer(everyone_perms); body["everyone_mask"] = LLSD::Integer(everyone_perms);
body["expected_upload_cost"] = LLSD::Integer(expected_upload_cost); body["expected_upload_cost"] = LLSD::Integer(expected_upload_cost);
LLHTTPClient::post(url, body, LLHTTPClient::post(
new LLNewAgentInventoryResponder(body, uuid, asset_type, callback2, userdata)); url,
body,
new LLNewAgentInventoryResponder(
body,
uuid,
asset_type,
callback2,
userdata));
} }
else else
{ {
@@ -1274,12 +1271,14 @@ bool upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty
{ {
asset_callback = callback; asset_callback = callback;
} }
gAssetStorage->storeAssetData(data->mAssetInfo.mTransactionID, data->mAssetInfo.mType, gAssetStorage->storeAssetData(
asset_callback, data->mAssetInfo.mTransactionID,
(void*)data, data->mAssetInfo.mType,
temporary, asset_callback,
TRUE, (void*)data,
temporary); temporary,
TRUE,
temporary);
} }
// Return true when a call to a callback function will follow. // Return true when a call to a callback function will follow.
@@ -1330,6 +1329,7 @@ void assign_defaults_and_show_upload_message(LLAssetType::EType asset_type,
} }
LLStringUtil::stripNonprintable(name); LLStringUtil::stripNonprintable(name);
LLStringUtil::stripNonprintable(description); LLStringUtil::stripNonprintable(description);
if (name.empty()) if (name.empty())
{ {
name = "(No Name)"; name = "(No Name)";
@@ -1345,6 +1345,7 @@ void assign_defaults_and_show_upload_message(LLAssetType::EType asset_type,
LLUploadDialog::modalUploadDialog(upload_message); LLUploadDialog::modalUploadDialog(upload_message);
} }
void init_menu_file() void init_menu_file()
{ {
(new LLFileUploadImage())->registerListener(gMenuHolder, "File.UploadImage"); (new LLFileUploadImage())->registerListener(gMenuHolder, "File.UploadImage");
@@ -1358,13 +1359,13 @@ void init_menu_file()
(new LLFileEnableCloseAllWindows())->registerListener(gMenuHolder, "File.EnableCloseAllWindows"); (new LLFileEnableCloseAllWindows())->registerListener(gMenuHolder, "File.EnableCloseAllWindows");
// <edit> // <edit>
(new LLFileMinimizeAllWindows())->registerListener(gMenuHolder, "File.MinimizeAllWindows"); (new LLFileMinimizeAllWindows())->registerListener(gMenuHolder, "File.MinimizeAllWindows");
(new LLFileLocalAssetBrowser())->registerListener(gMenuHolder, "File.LocalAssetBrowser");
// </edit> // </edit>
(new LLFileSavePreview())->registerListener(gMenuHolder, "File.SavePreview"); (new LLFileSavePreview())->registerListener(gMenuHolder, "File.SavePreview");
(new LLFileSavePreviewPNG())->registerListener(gMenuHolder, "File.SavePreviewPNG"); (new LLFileSavePreviewPNG())->registerListener(gMenuHolder, "File.SavePreviewPNG");
(new LLFileTakeSnapshot())->registerListener(gMenuHolder, "File.TakeSnapshot"); (new LLFileTakeSnapshot())->registerListener(gMenuHolder, "File.TakeSnapshot");
(new LLFileTakeSnapshotToDisk())->registerListener(gMenuHolder, "File.TakeSnapshotToDisk"); (new LLFileTakeSnapshotToDisk())->registerListener(gMenuHolder, "File.TakeSnapshotToDisk");
(new LLFileQuit())->registerListener(gMenuHolder, "File.Quit"); (new LLFileQuit())->registerListener(gMenuHolder, "File.Quit");
(new LLFileLogOut())->registerListener(gMenuHolder, "File.LogOut");
(new LLFileEnableUpload())->registerListener(gMenuHolder, "File.EnableUpload"); (new LLFileEnableUpload())->registerListener(gMenuHolder, "File.EnableUpload");
(new LLFileEnableUploadModel())->registerListener(gMenuHolder, "File.EnableUploadModel"); (new LLFileEnableUploadModel())->registerListener(gMenuHolder, "File.EnableUploadModel");

View File

@@ -48,8 +48,6 @@ class NewResourceItemCallback : public LLInventoryCallback
class LLTransactionID; class LLTransactionID;
extern std::deque<std::string> gUploadQueue;
void init_menu_file(); void init_menu_file();
void upload_new_resource(const std::string& src_filename, void upload_new_resource(const std::string& src_filename,

View File

@@ -37,6 +37,9 @@
<on_click function="Object.ImportUpload" /> <on_click function="Object.ImportUpload" />
<on_enable function="Object.EnableImport" /> <on_enable function="Object.EnableImport" />
</menu_item_call> </menu_item_call>
<menu_item_call label="Change Local Textures" mouse_opaque="true" name="Change Local Textures">
<on_click function="File.LocalAssetBrowser"/>
</menu_item_call>
<menu_item_separator enabled="true" label="-----------" mouse_opaque="true" name="separator" /> <menu_item_separator enabled="true" label="-----------" mouse_opaque="true" name="separator" />
<menu_item_call enabled="true" label="Set Default Permissions..." <menu_item_call enabled="true" label="Set Default Permissions..."
mouse_opaque="true" name="perm prefs" > mouse_opaque="true" name="perm prefs" >
@@ -44,6 +47,9 @@
</menu_item_call> </menu_item_call>
<menu_item_separator bottom="-94" enabled="true" height="8" label="-----------" left="0" <menu_item_separator bottom="-94" enabled="true" height="8" label="-----------" left="0"
mouse_opaque="true" name="separator" width="243" /> mouse_opaque="true" name="separator" width="243" />
<menu_item_call label="Minimize All Windows" mouse_opaque="true" name="Minimize All Windows">
<on_click function="File.MinimizeAllWindows"/>
</menu_item_call>
<menu_item_call bottom="-113" enabled="true" height="19" label="Close Window" left="0" <menu_item_call bottom="-113" enabled="true" height="19" label="Close Window" left="0"
mouse_opaque="true" name="Close Window" shortcut="control|W" width="243"> mouse_opaque="true" name="Close Window" shortcut="control|W" width="243">
<on_click function="File.CloseWindow" userdata="" /> <on_click function="File.CloseWindow" userdata="" />