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.
*
* $LicenseInfo:firstyear=2007&license=viewergpl$
*
* Second Life Viewer Source Code
* 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
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
@@ -53,7 +52,6 @@
#include "llviewerobject.h"
#include "llviewercontrol.h"
#include "llviewerobjectlist.h"
#include "llviewermenufile.h"
#include "llviewertexlayer.h"
#include "llviewerwindow.h"
#include "lltrans.h"
@@ -255,6 +253,7 @@ void LLAssetUploadResponder::result(const LLSD& content)
lldebugs << "LLAssetUploadResponder::result from capabilities" << llendl;
std::string state = content["state"];
if (state == "upload")
{
uploadUpload(content);
@@ -343,6 +342,7 @@ void LLNewAgentInventoryResponder::error(U32 statusNum, const std::string& reaso
//LLImportColladaAssetCache::getInstance()->assetUploaded(mVFileID, LLUUID(), FALSE);
}
//virtual
void LLNewAgentInventoryResponder::uploadFailure(const LLSD& content)
{
@@ -351,6 +351,7 @@ void LLNewAgentInventoryResponder::uploadFailure(const LLSD& content)
(*mCallBack)(false, mUserData);
}
LLAssetUploadResponder::uploadFailure(content);
//LLImportColladaAssetCache::getInstance()->assetUploaded(mVFileID, content["new_asset"], FALSE);
}
@@ -397,10 +398,14 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content)
// 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();
gUploadQueue.pop_front();
std::string next_file = sUploadQueue.front();
sUploadQueue.pop_front();
if (next_file.empty()) return;
std::string name = gDirUtilp->getBaseFileName(next_file, true);
@@ -448,6 +453,7 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content)
expected_upload_cost,
userdata);
}
*/
}
LLSendTexLayerResponder::LLSendTexLayerResponder(const LLSD& post_data,
@@ -698,6 +704,7 @@ void LLUpdateTaskInventoryResponder::uploadComplete(const LLSD& content)
}
}
/////////////////////////////////////////////////////
// LLNewAgentInventoryVariablePriceResponder::Impl //
/////////////////////////////////////////////////////
@@ -1165,3 +1172,4 @@ void LLNewAgentInventoryVariablePriceResponder::showConfirmationDialog(
boost::intrusive_ptr<LLNewAgentInventoryVariablePriceResponder>(this)));
}
}

View File

@@ -3,10 +3,9 @@
* @brief "File" menu in the main menu bar.
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
*
* Second Life Viewer Source Code
* 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
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
@@ -63,11 +62,9 @@
#include "lltrans.h"
#include "llfloaterbuycurrency.h"
// <edit>
#include "llselectmgr.h"
#include "floaterlocalassetbrowse.h"
#include "llassettype.h"
#include "llinventorytype.h"
#include "llbvhloader.h"
#include "lllocalinventory.h"
// </edit>
// linden libraries
@@ -89,12 +86,9 @@
#include <boost/tokenizer.hpp>
#include "hippogridmanager.h"
#include "importtracker.h"
using namespace LLOldEvents;
std::deque<std::string> gUploadQueue;
typedef LLMemberListener<LLView> view_listener_t;
@@ -502,6 +496,15 @@ class LLFileMinimizeAllWindows : public view_listener_t
return true;
}
};
class LLFileLocalAssetBrowser : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent>, const LLSD&)
{
FloaterLocalAssetBrowser::show(0);
return true;
}
};
// </edit>
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
{
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",
short_name.c_str());
args["FILE"] = short_name;
upload_error(error_message, "NofileExtension", filename, args);
upload_error(error_message, "NoFileExtension", filename, args);
return;
}
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->setMaskGroup(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(
item_id,
destination,
gInventory.findCategoryUUIDForType(LLFolderType::FT_TEXTURE),
*perms,
uuid,
(LLAssetType::EType)data->mAssetInfo.mType,
@@ -1011,16 +994,10 @@ void temp_upload_callback(const LLUUID& uuid, void* user_data, S32 result, LLExt
LLSaleInfo::DEFAULT,
0,
time_corrected());
if (bUseSystemInventory)
{
LLLocalInventory::addItem(item);
}
else
{
item->updateServer(TRUE);
gInventory.updateItem(item);
gInventory.notifyObservers();
}
item->updateServer(TRUE);
gInventory.updateItem(item);
gInventory.notifyObservers();
}
else
{
@@ -1129,40 +1106,44 @@ void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExt
data = NULL;
}
static LLAssetID upload_new_resource_prep(const LLTransactionID& tid,
LLAssetType::EType asset_type,
LLInventoryType::EType& inventory_type,
std::string& name,
const std::string& display_name,
std::string& description)
static LLAssetID upload_new_resource_prep(
const LLTransactionID& tid,
LLAssetType::EType asset_type,
LLInventoryType::EType& inventory_type,
std::string& name,
const std::string& display_name,
std::string& description)
{
LLAssetID uuid = generate_asset_id_for_new_upload(tid);
increase_new_upload_stats(asset_type);
assign_defaults_and_show_upload_message(asset_type,
inventory_type,
name,
display_name,
description);
assign_defaults_and_show_upload_message(
asset_type,
inventory_type,
name,
display_name,
description);
return uuid;
}
LLSD generate_new_resource_upload_capability_body(LLAssetType::EType asset_type,
const std::string& name,
const std::string& desc,
LLFolderType::EType destination_folder_type,
LLInventoryType::EType inv_type,
U32 next_owner_perms,
U32 group_perms,
U32 everyone_perms)
LLSD generate_new_resource_upload_capability_body(
LLAssetType::EType asset_type,
const std::string& name,
const std::string& desc,
LLFolderType::EType destination_folder_type,
LLInventoryType::EType inv_type,
U32 next_owner_perms,
U32 group_perms,
U32 everyone_perms)
{
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["inventory_type"] = LLInventoryType::lookup(inv_type);
@@ -1175,28 +1156,36 @@ LLSD generate_new_resource_upload_capability_body(LLAssetType::EType asset_type,
return body;
}
bool upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_type,
std::string name,
std::string desc, S32 compression_info,
LLFolderType::EType destination_folder_type,
LLInventoryType::EType inv_type,
U32 next_owner_perms,
U32 group_perms,
U32 everyone_perms,
const std::string& display_name,
LLAssetStorage::LLStoreAssetCallback callback,
S32 expected_upload_cost,
void *userdata,
void (*callback2)(bool, void*))
bool upload_new_resource(
const LLTransactionID &tid,
LLAssetType::EType asset_type,
std::string name,
std::string desc,
S32 compression_info,
LLFolderType::EType destination_folder_type,
LLInventoryType::EType inv_type,
U32 next_owner_perms,
U32 group_perms,
U32 everyone_perms,
const std::string& display_name,
LLAssetStorage::LLStoreAssetCallback callback,
S32 expected_upload_cost,
void *userdata,
void (*callback2)(bool, void*))
{
if(gDisconnected)
{
return false;
}
LLAssetID uuid = upload_new_resource_prep(tid, asset_type, inv_type,
name, display_name, desc);
LLAssetID uuid =
upload_new_resource_prep(
tid,
asset_type,
inv_type,
name,
display_name,
desc);
llinfos << "*** Uploading: "
<< "\nType: " << LLAssetType::lookup(asset_type)
<< "\nUUID: " << uuid
@@ -1216,6 +1205,7 @@ bool upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty
// </edit>
{
llinfos << "New Agent Inventory via capability" << llendl;
LLSD body;
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);
@@ -1227,8 +1217,15 @@ bool upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty
body["everyone_mask"] = LLSD::Integer(everyone_perms);
body["expected_upload_cost"] = LLSD::Integer(expected_upload_cost);
LLHTTPClient::post(url, body,
new LLNewAgentInventoryResponder(body, uuid, asset_type, callback2, userdata));
LLHTTPClient::post(
url,
body,
new LLNewAgentInventoryResponder(
body,
uuid,
asset_type,
callback2,
userdata));
}
else
{
@@ -1274,12 +1271,14 @@ bool upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty
{
asset_callback = callback;
}
gAssetStorage->storeAssetData(data->mAssetInfo.mTransactionID, data->mAssetInfo.mType,
asset_callback,
(void*)data,
temporary,
TRUE,
temporary);
gAssetStorage->storeAssetData(
data->mAssetInfo.mTransactionID,
data->mAssetInfo.mType,
asset_callback,
(void*)data,
temporary,
TRUE,
temporary);
}
// 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(description);
if (name.empty())
{
name = "(No Name)";
@@ -1345,6 +1345,7 @@ void assign_defaults_and_show_upload_message(LLAssetType::EType asset_type,
LLUploadDialog::modalUploadDialog(upload_message);
}
void init_menu_file()
{
(new LLFileUploadImage())->registerListener(gMenuHolder, "File.UploadImage");
@@ -1358,13 +1359,13 @@ void init_menu_file()
(new LLFileEnableCloseAllWindows())->registerListener(gMenuHolder, "File.EnableCloseAllWindows");
// <edit>
(new LLFileMinimizeAllWindows())->registerListener(gMenuHolder, "File.MinimizeAllWindows");
(new LLFileLocalAssetBrowser())->registerListener(gMenuHolder, "File.LocalAssetBrowser");
// </edit>
(new LLFileSavePreview())->registerListener(gMenuHolder, "File.SavePreview");
(new LLFileSavePreviewPNG())->registerListener(gMenuHolder, "File.SavePreviewPNG");
(new LLFileTakeSnapshot())->registerListener(gMenuHolder, "File.TakeSnapshot");
(new LLFileTakeSnapshotToDisk())->registerListener(gMenuHolder, "File.TakeSnapshotToDisk");
(new LLFileQuit())->registerListener(gMenuHolder, "File.Quit");
(new LLFileLogOut())->registerListener(gMenuHolder, "File.LogOut");
(new LLFileEnableUpload())->registerListener(gMenuHolder, "File.EnableUpload");
(new LLFileEnableUploadModel())->registerListener(gMenuHolder, "File.EnableUploadModel");

View File

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

View File

@@ -37,6 +37,9 @@
<on_click function="Object.ImportUpload" />
<on_enable function="Object.EnableImport" />
</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_call enabled="true" label="Set Default Permissions..."
mouse_opaque="true" name="perm prefs" >
@@ -44,6 +47,9 @@
</menu_item_call>
<menu_item_separator bottom="-94" enabled="true" height="8" label="-----------" left="0"
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"
mouse_opaque="true" name="Close Window" shortcut="control|W" width="243">
<on_click function="File.CloseWindow" userdata="" />