diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index 30e2d3b44..07e6eb5b6 100644 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp @@ -478,7 +478,7 @@ BOOL LLImageJ2C::validate(U8 *data, U32 file_size) if ( res ) { // Check to make sure that this instance has been initialized with data - if (!getData() || (0 == getDataSize())) + if (!getData() || (getDataSize() < 16)) { setLastError("LLImageJ2C uninitialized"); res = FALSE; diff --git a/indra/llimage/llimagemetadatareader.cpp b/indra/llimage/llimagemetadatareader.cpp index ed6261926..bf2c64c90 100644 --- a/indra/llimage/llimagemetadatareader.cpp +++ b/indra/llimage/llimagemetadatareader.cpp @@ -7,8 +7,8 @@ LLJ2cParser::LLJ2cParser(U8* data,int data_size) if(data && data_size) { mData.resize(data_size); - memcpy(&(mData[0]), data, data_size); - //std::copy(data,data+data_size,mData.begin()); + //memcpy(&(mData[0]), data, data_size); + std::copy(data,data+data_size,mData.begin()); } mIter = mData.begin(); } @@ -83,7 +83,8 @@ std::string LLImageMetaDataReader::ExtractEncodedComment(U8* data,int data_size) //llinfos << "FOUND PAYLOAD" << llendl; std::vector payload(128); S32 i; - memcpy(&(payload[0]), &(comment[2]), 128); + //memcpy(&(payload[0]), &(comment[2]), 128); + std::copy(comment.begin()+2,comment.end(),payload.begin()); if (payload[2] == payload[127]) { // emkdu.dll @@ -114,6 +115,7 @@ std::string LLImageMetaDataReader::ExtractEncodedComment(U8* data,int data_size) { if (payload[i] == 0) break; } + if(i < 4) break; std::string result(payload.begin()+4,payload.begin()+i); //llinfos << "FOUND COMMENT: " << result << llendl; delete parser; diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 4fd77692c..f214a56a6 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10331,6 +10331,17 @@ Value 0 + TemporaryUpload + + Comment + Whether or not a upload is temporary + Persist + 0 + Type + Boolean + Value + 0 + TerrainColorHeightRange Comment diff --git a/indra/newview/llfloateractivespeakers.cpp b/indra/newview/llfloateractivespeakers.cpp index 6ee923ab2..89b3af621 100644 --- a/indra/newview/llfloateractivespeakers.cpp +++ b/indra/newview/llfloateractivespeakers.cpp @@ -505,8 +505,12 @@ void LLPanelActiveSpeakers::refreshSpeakers() // draw inactive speakers in gray name_cell->setColor(LLColor4::grey4); } + else + { + name_cell->setColor(LLColor4::black); + } // - else if(speakerp->mType == LLSpeaker::SPEAKER_AGENT && speakerp->mID != gAgent.getID()) + if(!mShowTextChatters && !(speakerp->mStatus == LLSpeaker::STATUS_NOT_IN_CHANNEL) && speakerp->mID != gAgent.getID()) { // let us check to see if they are actually in the sim LLViewerRegion* regionp = gAgent.getRegion(); @@ -519,10 +523,6 @@ void LLPanelActiveSpeakers::refreshSpeakers() } } // - else - { - name_cell->setColor(LLColor4::black); - } std::string speaker_name; if (speakerp->mDisplayName.empty()) diff --git a/indra/newview/llfloateravatarlist.cpp b/indra/newview/llfloateravatarlist.cpp index 32396ec9f..6ddd6c12f 100644 --- a/indra/newview/llfloateravatarlist.cpp +++ b/indra/newview/llfloateravatarlist.cpp @@ -1203,13 +1203,15 @@ void LLFloaterAvatarList::sound_trigger_hook(LLMessageSystem* msg,void **) } } // static -void LLFloaterAvatarList::onConfirmRadarChatKeys(S32 option, LLSD payload) +bool LLFloaterAvatarList::onConfirmRadarChatKeys(const LLSD& notification, const LLSD& response ) { + S32 option = LLNotification::getSelectedOption(notification, response); if(option == 0) // yes { gSavedSettings.setBOOL("RadarChatKeys",TRUE); LLFloaterAvatarList::getInstance()->sendKeys(); } + return false; } //static void LLFloaterAvatarList::onClickSendKeys(void *userdata) diff --git a/indra/newview/llfloateravatarlist.h b/indra/newview/llfloateravatarlist.h index 474fdcd00..0c533f60b 100644 --- a/indra/newview/llfloateravatarlist.h +++ b/indra/newview/llfloateravatarlist.h @@ -265,7 +265,7 @@ private: static void onCommitUpdateRate(LLUICtrl*, void *userdata); static void onClickSendKeys(void *userdata); - static void onConfirmRadarChatKeys(S32 option, LLSD payload); + static bool onConfirmRadarChatKeys(const LLSD& notification, const LLSD& response ); static void callbackIdle(void *userdata); diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index 9225afb0d..ec8405978 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -58,6 +58,9 @@ #include "lluictrlfactory.h" #include "llviewerimagelist.h" #include "llstring.h" +// +#include "llviewercontrol.h" +// //static S32 LLFloaterImagePreview::sUploadAmount = 10; @@ -131,6 +134,11 @@ BOOL LLFloaterImagePreview::postBuild() if (mRawImagep->getWidth() * mRawImagep->getHeight () <= LL_IMAGE_REZ_LOSSLESS_CUTOFF * LL_IMAGE_REZ_LOSSLESS_CUTOFF) childEnable("lossless_check"); + + // + gSavedSettings.setBOOL("TemporaryUpload",FALSE); + childSetValue("temp_check",FALSE); + // } else { diff --git a/indra/newview/llfloatermessagelog.cpp b/indra/newview/llfloatermessagelog.cpp index 3a626018b..161779b35 100644 --- a/indra/newview/llfloatermessagelog.cpp +++ b/indra/newview/llfloatermessagelog.cpp @@ -810,10 +810,11 @@ BOOL LLFloaterMessageLog::onClickCloseCircuit(void* user_data) return TRUE; } // static -void LLFloaterMessageLog::onConfirmCloseCircuit(S32 option, LLSD payload) +bool LLFloaterMessageLog::onConfirmCloseCircuit(const LLSD& notification, const LLSD& response ) { - LLCircuitData* cdp = gMessageSystem->mCircuitInfo.findCircuit(LLHost(payload["circuittoclose"].asString())); - if(!cdp) return; + S32 option = LLNotification::getSelectedOption(notification, response); + LLCircuitData* cdp = gMessageSystem->mCircuitInfo.findCircuit(LLHost(notification["payload"]["circuittoclose"].asString())); + if(!cdp) return false; LLViewerRegion* regionp = LLWorld::getInstance()->getRegion(cdp->getHost()); switch(option) { @@ -822,7 +823,7 @@ void LLFloaterMessageLog::onConfirmCloseCircuit(S32 option, LLSD payload) gMessageSystem->sendReliable(cdp->getHost()); break; case 2: // cancel - return; + return false; break; case 1: // no default: @@ -841,12 +842,15 @@ void LLFloaterMessageLog::onConfirmCloseCircuit(S32 option, LLSD payload) payload["regionhost"] = myhost.getString(); LLNotifications::instance().add("GenericAlertYesCancel", args, payload, onConfirmRemoveRegion); } + return false; } // static -void LLFloaterMessageLog::onConfirmRemoveRegion(S32 option, LLSD payload) +bool LLFloaterMessageLog::onConfirmRemoveRegion(const LLSD& notification, const LLSD& response ) { + S32 option = LLNotification::getSelectedOption(notification, response); if(option == 0) // yes - LLWorld::getInstance()->removeRegion(LLHost(payload["regionhost"].asString())); + LLWorld::getInstance()->removeRegion(LLHost(notification["payload"]["regionhost"].asString())); + return false; } // static void LLFloaterMessageLog::onClickFilterApply(void* user_data) diff --git a/indra/newview/llfloatermessagelog.h b/indra/newview/llfloatermessagelog.h index 82d82f772..ebc4f2aa6 100644 --- a/indra/newview/llfloatermessagelog.h +++ b/indra/newview/llfloatermessagelog.h @@ -61,8 +61,8 @@ public: static void onCommitMessageLog(LLUICtrl* ctrl, void* user_data); static void onCommitFilter(LLUICtrl* ctrl, void* user_data); static BOOL onClickCloseCircuit(void* user_data); - static void onConfirmCloseCircuit(S32 option, LLSD payload); - static void onConfirmRemoveRegion(S32 option, LLSD payload); + static bool onConfirmCloseCircuit(const LLSD& notification, const LLSD& response ); + static bool onConfirmRemoveRegion(const LLSD& notification, const LLSD& response ); static void onClickFilterApply(void* user_data); void startApplyingFilter(std::string filter, BOOL force); void stopApplyingFilter(); diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index a74ef1803..89a0de22c 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -2039,6 +2039,11 @@ BOOL LLFloaterSnapshot::postBuild() sInstance->getRootView()->addChild(previewp); sInstance->getRootView()->addChild(gSnapshotFloaterView); + // + gSavedSettings.setBOOL("TemporaryUpload",FALSE); + childSetValue("temp_check",FALSE); + // + Impl::sPreviewHandle = previewp->getHandle(); impl.updateControls(this); diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index fc28effbc..d6f6bd231 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -62,6 +62,7 @@ #include "llassettype.h" #include "llinventorytype.h" #include "llbvhloader.h" +#include "lllocalinventory.h" // @@ -310,6 +311,51 @@ class LLFileUploadAnim : public view_listener_t class LLFileUploadBulk : public view_listener_t { + static bool onConfirmBulkUploadTemp(const LLSD& notification, const LLSD& response ) + { + S32 option = LLNotification::getSelectedOption(notification, response); + BOOL enabled; + if(option == 0) // yes + enabled = TRUE; + else if(option == 1) //no + enabled = FALSE; + else //cancel + return false; + + LLFilePicker& picker = LLFilePicker::instance(); + if (picker.getMultipleOpenFiles()) + { + //const std::string& filename = picker.getFirstFile(); + std::string filename; + while(!(filename = picker.getNextFile()).empty()) + { + std::string name = gDirUtilp->getBaseFileName(filename, true); + + std::string asset_name = name; + LLStringUtil::replaceNonstandardASCII( asset_name, '?' ); + LLStringUtil::replaceChar(asset_name, '|', '?'); + LLStringUtil::stripNonprintable(asset_name); + LLStringUtil::trim(asset_name); + + std::string display_name = LLStringUtil::null; + LLAssetStorage::LLStoreAssetCallback callback = NULL; + S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); + void *userdata = NULL; + gSavedSettings.setBOOL("TemporaryUpload",enabled); + upload_new_resource(filename, asset_name, asset_name, 0, LLAssetType::AT_NONE, LLInventoryType::IT_NONE, + LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(), + display_name, + callback, expected_upload_cost, userdata); + + } + } + else + { + llinfos << "Couldn't import objects from file" << llendl; + gSavedSettings.setBOOL("TemporaryUpload",FALSE); + } + return false; + } bool handleEvent(LLPointer event, const LLSD& userdata) { if( gAgent.cameraMouselook() ) @@ -326,11 +372,20 @@ class LLFileUploadBulk : public view_listener_t // If an upload fails, refund the user for that one // // Also fix single upload to charge first, then refund - + // + S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); + LLSD args; + std::string msg = "Would you like to bulk upload the files as temporary files?\nOnly textures will upload as temporary on Agni and Aditi."; + if(expected_upload_cost) + msg.append(llformat("\nWARNING: Each upload costs L$%d if it's not temporary.",expected_upload_cost)); + args["MESSAGE"] = msg; + LLNotifications::instance().add("GenericAlertYesNoCancel", args, LLSD(), onConfirmBulkUploadTemp); + /* moved to the callback for the above LLFilePicker& picker = LLFilePicker::instance(); if (picker.getMultipleOpenFiles()) { // + //const std::string& filename = picker.getFirstFile(); std::string filename; while(!(filename = picker.getNextFile()).empty()) @@ -362,6 +417,7 @@ class LLFileUploadBulk : public view_listener_t { llinfos << "Couldn't import objects from file" << llendl; } + */ return true; } }; @@ -1008,7 +1064,49 @@ void upload_new_resource(const std::string& src_filename, std::string name, LLFilePicker::instance().reset(); } } +// +void temp_upload_callback(const LLUUID& uuid, void* user_data, S32 result, LLExtStat ext_status) // StoreAssetData callback (fixed) +{ + LLResourceData* data = (LLResourceData*)user_data; + + if(result >= 0) + { + LLUUID item_id; + item_id.generate(); + LLPermissions* perms = new LLPermissions(); + perms->set(LLPermissions::DEFAULT); + perms->setOwnerAndGroup(LLUUID::null, LLUUID::null, LLUUID::null, false); + perms->setMaskBase(0); + perms->setMaskEveryone(0); + perms->setMaskGroup(0); + perms->setMaskNext(0); + perms->setMaskOwner(0); + LLViewerInventoryItem* item = new LLViewerInventoryItem( + item_id, + gLocalInventoryRoot, + *perms, + uuid, + (LLAssetType::EType)data->mAssetInfo.mType, + (LLInventoryType::EType)data->mInventoryType, + data->mAssetInfo.getName(), + data->mAssetInfo.getDescription(), + LLSaleInfo::DEFAULT, + 0, + 0); + LLLocalInventory::addItem(item); + } + else + { + LLSD args; + args["FILE"] = LLInventoryType::lookupHumanReadable(data->mInventoryType); + args["REASON"] = std::string(LLAssetStorage::getErrorString(result)); + LLNotifications::instance().add("CannotUploadReason", args); + } + LLUploadDialog::modalUploadFinished(); + delete data; +} +// void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExtStat ext_status) // StoreAssetData callback (fixed) { LLResourceData* data = (LLResourceData*)user_data; @@ -1190,7 +1288,11 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty lldebugs << "Folder: " << gInventory.findCategoryUUIDForType((destination_folder_type == LLAssetType::AT_NONE) ? asset_type : destination_folder_type) << llendl; lldebugs << "Asset Type: " << LLAssetType::lookup(asset_type) << llendl; std::string url = gAgent.getRegion()->getCapability("NewFileAgentInventory"); - if (!url.empty()) + // + BOOL temporary = gSavedSettings.getBOOL("TemporaryUpload"); + gSavedSettings.setBOOL("TemporaryUpload",FALSE); + if (!url.empty() && !temporary) + // { llinfos << "New Agent Inventory via capability" << llendl; LLSD body; @@ -1212,19 +1314,23 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty } else { - llinfos << "NewAgentInventory capability not found, new agent inventory via asset system." << llendl; - // check for adequate funds - // TODO: do this check on the sim - if (LLAssetType::AT_SOUND == asset_type || - LLAssetType::AT_TEXTURE == asset_type || - LLAssetType::AT_ANIMATION == asset_type) + // + if(!temporary) { - S32 balance = gStatusBar->getBalance(); - if (balance < expected_upload_cost) + llinfos << "NewAgentInventory capability not found, new agent inventory via asset system." << llendl; + // check for adequate funds + // TODO: do this check on the sim + if (LLAssetType::AT_SOUND == asset_type || + LLAssetType::AT_TEXTURE == asset_type || + LLAssetType::AT_ANIMATION == asset_type) { - // insufficient funds, bail on this upload - LLFloaterBuyCurrency::buyCurrency("Uploading costs", expected_upload_cost); - return; + S32 balance = gStatusBar->getBalance(); + if (balance < expected_upload_cost) + { + // insufficient funds, bail on this upload + LLFloaterBuyCurrency::buyCurrency("Uploading costs", expected_upload_cost); + return; + } } } @@ -1240,16 +1346,21 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty data->mAssetInfo.setName(name); data->mAssetInfo.setDescription(desc); data->mPreferredLocation = destination_folder_type; - - LLAssetStorage::LLStoreAssetCallback asset_callback = &upload_done_callback; + // + LLAssetStorage::LLStoreAssetCallback asset_callback = temporary ? &temp_upload_callback : &upload_done_callback; + // if (callback) { asset_callback = callback; } + // gAssetStorage->storeAssetData(data->mAssetInfo.mTransactionID, data->mAssetInfo.mType, asset_callback, (void*)data, - FALSE); + temporary, + TRUE, + temporary); + // } } diff --git a/indra/newview/skins/default/xui/en-us/floater_image_preview.xml b/indra/newview/skins/default/xui/en-us/floater_image_preview.xml index 926e71596..717e5479d 100644 --- a/indra/newview/skins/default/xui/en-us/floater_image_preview.xml +++ b/indra/newview/skins/default/xui/en-us/floater_image_preview.xml @@ -57,6 +57,10 @@ Try saving image as 24 bit Targa (.tga). follows="bottom|left" font="SansSerifSmall" height="16" initial_value="false" label="Use lossless compression" left="10" left_delta="2" name="lossless_check" width="280" /> +