From fbb4e5fb0f7bba935ec9d0d466be12a346a6b149 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Fri, 8 Jun 2012 13:49:02 -0400 Subject: STORM-68 As a Builder, I want that ability to set default permissions on creation of objects, clothing, scripts, notecards, etc. First pass at implementation, debuggins lines still need to be removed and there is one known bug to be resolved. --- indra/llinventory/llinventory.cpp | 5 + indra/newview/app_settings/settings.xml | 330 +++++++++++++ indra/newview/llagentwearables.cpp | 62 ++- indra/newview/llfloaterbvhpreview.cpp | 2 +- indra/newview/llfloatergesture.cpp | 25 +- indra/newview/llfloaternamedesc.cpp | 2 +- indra/newview/llfloaterperms.cpp | 153 ++++--- indra/newview/llfloaterperms.h | 49 +- indra/newview/llfloaterpreference.cpp | 8 +- indra/newview/llfloaterpreference.h | 1 + indra/newview/llfloatersnapshot.cpp | 4 +- indra/newview/llinventorymodel.cpp | 2 +- indra/newview/llmeshrepository.cpp | 6 +- indra/newview/llpanelcontents.cpp | 6 +- indra/newview/llviewerfloaterreg.cpp | 2 +- indra/newview/llviewerinventory.cpp | 98 +++- indra/newview/llviewerinventory.h | 12 + indra/newview/llviewermenufile.cpp | 12 +- indra/newview/llviewerobject.cpp | 12 +- indra/newview/llviewerobjectlist.cpp | 12 + .../skins/default/xui/en/floater_perms_default.xml | 508 +++++++++++++++++++++ indra/newview/skins/default/xui/en/menu_viewer.xml | 7 - .../default/xui/en/panel_preferences_advanced.xml | 11 + 23 files changed, 1213 insertions(+), 116 deletions(-) create mode 100644 indra/newview/skins/default/xui/en/floater_perms_default.xml (limited to 'indra') diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index fbf23bc3f0..4e5a328c54 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -303,6 +303,11 @@ LLInventoryItem::LLInventoryItem(const LLUUID& uuid, LLStringUtil::replaceNonstandardASCII(mDescription, ' '); LLStringUtil::replaceChar(mDescription, '|', ' '); mPermissions.initMasks(inv_type); +// if (LLInventoryType::IT_LSL == inv_type) +// { +// mPermissions.setMaskNext(permissions.getMaskNextOwner()); + mPermissions.setMaskNext(PERM_ALL); +// } } LLInventoryItem::LLInventoryItem() : diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 05c05b9393..b3ed917574 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -13516,5 +13516,335 @@ Value 0 + ObjectsNextOwnerCopy + + Comment + Newly created objects can be copied by next owner + Persist + 1 + Type + Boolean + Value + 0 + + ObjectsNextOwnerModify + + Comment + Newly created objects can be modified by next owner + Persist + 1 + Type + Boolean + Value + 0 + + ObjectsNextOwnerTransfer + + Comment + Newly created objects can be resold or given away by next owner + Persist + 1 + Type + Boolean + Value + 1 + + ObjectsEveryoneCopy + + Comment + Everyone can copy the newly created object + Persist + 1 + Type + Boolean + Value + 0 + + ObjectsShareWithGroup + + Comment + Newly created objects are shared with the currently active group + Persist + 1 + Type + Boolean + Value + 0 + + UploadsNextOwnerCopy + + Comment + Newly uploaded items can be copied by next owner + Persist + 1 + Type + Boolean + Value + 0 + + UploadsNextOwnerModify + + Comment + Newly uploaded items can be modified by next owner + Persist + 1 + Type + Boolean + Value + 0 + + UploadsNextOwnerTransfer + + Comment + Newly uploaded items can be resold or given away by next owner + Persist + 1 + Type + Boolean + Value + 1 + + UploadsEveryoneCopy + + Comment + Everyone can copy the newly uploaded item + Persist + 1 + Type + Boolean + Value + 0 + + UploadsShareWithGroup + + Comment + Newly uploaded items are shared with the currently active group + Persist + 1 + Type + Boolean + Value + 0 + + ScriptsNextOwnerCopy + + Comment + Newly created scripts can be copied by next owner + Persist + 1 + Type + Boolean + Value + 0 + + ScriptsNextOwnerModify + + Comment + Newly created scripts can be modified by next owner + Persist + 1 + Type + Boolean + Value + 0 + + ScriptsNextOwnerTransfer + + Comment + Newly created scripts can be resold or given away by next owner + Persist + 1 + Type + Boolean + Value + 1 + + ScriptsEveryoneCopy + + Comment + Everyone can copy the newly created script + Persist + 1 + Type + Boolean + Value + 0 + + ScriptsShareWithGroup + + Comment + Newly created scripts are shared with the currently active group + Persist + 1 + Type + Boolean + Value + 0 + + NotecardsNextOwnerCopy + + Comment + Newly created notecards can be copied by next owner + Persist + 1 + Type + Boolean + Value + 0 + + NotecardsNextOwnerModify + + Comment + Newly created notecards can be modified by next owner + Persist + 1 + Type + Boolean + Value + 0 + + NotecardsNextOwnerTransfer + + Comment + Newly created notecards can be resold or given away by next owner + Persist + 1 + Type + Boolean + Value + 1 + + NotecardsEveryoneCopy + + Comment + Everyone can copy the newly created notecard + Persist + 1 + Type + Boolean + Value + 0 + + NotecardsShareWithGroup + + Comment + Newly created notecards are shared with the currently active group + Persist + 1 + Type + Boolean + Value + 0 + + GesturesNextOwnerCopy + + Comment + Newly created gestures can be copied by next owner + Persist + 1 + Type + Boolean + Value + 0 + + GesturesNextOwnerModify + + Comment + Newly created gestures can be modified by next owner + Persist + 1 + Type + Boolean + Value + 0 + + GesturesNextOwnerTransfer + + Comment + Newly created gestures can be resold or given away by next owner + Persist + 1 + Type + Boolean + Value + 1 + + GesturesEveryoneCopy + + Comment + Everyone can copy the newly created gesture + Persist + 1 + Type + Boolean + Value + 0 + + GesturesShareWithGroup + + Comment + Newly created gestures are shared with the currently active group + Persist + 1 + Type + Boolean + Value + 0 + + WearablesNextOwnerCopy + + Comment + Newly created clothing or body part can be copied by next owner + Persist + 1 + Type + Boolean + Value + 0 + + WearablesNextOwnerModify + + Comment + Newly created clothing or body part can be modified by next owner + Persist + 1 + Type + Boolean + Value + 0 + + WearablesNextOwnerTransfer + + Comment + Newly created clothing or body part can be resold or given away by next owner + Persist + 1 + Type + Boolean + Value + 1 + + WearablesEveryoneCopy + + Comment + Everyone can copy the newly created clothing or body part + Persist + 1 + Type + Boolean + Value + 0 + + WearablesShareWithGroup + + Comment + Newly created clothing or body part is shared with the currently active group + Persist + 1 + Type + Boolean + Value + 0 + diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index dd02a74a38..7017357346 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -49,6 +49,7 @@ #include "llvoavatarself.h" #include "llwearable.h" #include "llwearablelist.h" +#include "llfloaterperms.h" #include @@ -65,8 +66,24 @@ class LLWearAndEditCallback : public LLInventoryCallback { void fire(const LLUUID& inv_item) { +llwarns << "DBG 1" << llendl; if (inv_item.isNull()) return; +llwarns << "DBG 2" << llendl; + LLViewerInventoryItem* item = gInventory.getItem(inv_item); + if (!item) return; + +llwarns << "DBG 3" << llendl; + LLPermissions perm = item->getPermissions(); + perm.setMaskNext(LLFloaterPerms::getNextOwnerPerms("Wearables")); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Wearables")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Wearables")); + item->setPermissions(perm); + +llwarns << "DBG 4" << llendl; + gInventory.updateItem(item); + gInventory.notifyObservers(); + // Request editing the item after it gets worn. gAgentWearables.requestEditingWearable(inv_item); @@ -75,6 +92,27 @@ class LLWearAndEditCallback : public LLInventoryCallback } }; +class LLCreateWearableCallback : public LLInventoryCallback +{ + void fire(const LLUUID& inv_item) + { + if (inv_item.isNull()) + return; + + LLViewerInventoryItem* item = gInventory.getItem(inv_item); + if (!item) return; + + LLPermissions perm = item->getPermissions(); + perm.setMaskNext(LLFloaterPerms::getNextOwnerPerms("Wearables")); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Wearables")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Wearables")); + item->setPermissions(perm); + + gInventory.updateItem(item); + gInventory.notifyObservers(); + } +}; + /////////////////////////////////////////////////////////////////////////////// // HACK: For EXT-3923: Pants item shows in inventory with skin icon and messes with "current look" @@ -1982,7 +2020,16 @@ void LLAgentWearables::createWearable(LLWearableType::EType type, bool wear, con LLWearable* wearable = LLWearableList::instance().createNewWearable(type); LLAssetType::EType asset_type = wearable->getAssetType(); LLInventoryType::EType inv_type = LLInventoryType::IT_WEARABLE; - LLPointer cb = wear ? new LLWearAndEditCallback : NULL; + LLPointer cb; + if (wear) + { + cb = new LLWearAndEditCallback; + } + else + { + cb = new LLCreateWearableCallback; + } + LLUUID folder_id; if (parent_id.notNull()) @@ -1995,10 +2042,15 @@ void LLAgentWearables::createWearable(LLWearableType::EType type, bool wear, con folder_id = gInventory.findCategoryUUIDForType(folder_type); } - create_inventory_item(gAgent.getID(), gAgent.getSessionID(), - folder_id, wearable->getTransactionID(), wearable->getName(), - wearable->getDescription(), asset_type, inv_type, wearable->getType(), - wearable->getPermissions().getMaskNextOwner(), + create_inventory_item(gAgent.getID(), + gAgent.getSessionID(), + folder_id, + wearable->getTransactionID(), + wearable->getName(), + wearable->getDescription(), + asset_type, inv_type, + wearable->getType(), + LLFloaterPerms::getNextOwnerPerms("Wearables"), cb); } diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp index b050a638dc..720c2cbeea 100644 --- a/indra/newview/llfloaterbvhpreview.cpp +++ b/indra/newview/llfloaterbvhpreview.cpp @@ -991,7 +991,7 @@ void LLFloaterBvhPreview::onBtnOK(void* userdata) 0, LLFolderType::FT_NONE, LLInventoryType::IT_ANIMATION, - LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(), + LLFloaterPerms::getNextOwnerPerms("Uploads"), LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"), name, callback, expected_upload_cost, userdata); diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp index 56051ff684..dcc245ee20 100644 --- a/indra/newview/llfloatergesture.cpp +++ b/indra/newview/llfloatergesture.cpp @@ -48,6 +48,7 @@ #include "llviewermenu.h" #include "llviewerinventory.h" #include "llviewercontrol.h" +#include "llfloaterperms.h" BOOL item_name_precedes( LLInventoryItem* a, LLInventoryItem* b ) { @@ -74,6 +75,16 @@ public: void fire(const LLUUID &inv_item) { LLPreviewGesture::show(inv_item, LLUUID::null); + + LLInventoryItem* item = gInventory.getItem(inv_item); + if (item) + { + LLPermissions perm = item->getPermissions(); + perm.setMaskNext(LLFloaterPerms::getNextOwnerPerms("Gestures")); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Gestures")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Gestures")); + item->setPermissions(perm); + } } }; @@ -449,9 +460,17 @@ void LLFloaterGesture::onClickPlay() void LLFloaterGesture::onClickNew() { LLPointer cb = new GestureShowCallback(); - create_inventory_item(gAgent.getID(), gAgent.getSessionID(), - LLUUID::null, LLTransactionID::tnull, "New Gesture", "", LLAssetType::AT_GESTURE, - LLInventoryType::IT_GESTURE, NOT_WEARABLE, PERM_MOVE | PERM_TRANSFER, cb); + create_inventory_item(gAgent.getID(), + gAgent.getSessionID(), + LLUUID::null, + LLTransactionID::tnull, + "New Gesture", + "", + LLAssetType::AT_GESTURE, + LLInventoryType::IT_GESTURE, + NOT_WEARABLE, + PERM_MOVE | LLFloaterPerms::getNextOwnerPerms("Gestures"), + cb); } void LLFloaterGesture::onActivateBtnClick() diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp index 27b1c3b9cd..eefc352287 100644 --- a/indra/newview/llfloaternamedesc.cpp +++ b/indra/newview/llfloaternamedesc.cpp @@ -171,7 +171,7 @@ void LLFloaterNameDesc::onBtnOK( ) getChild("name_form")->getValue().asString(), getChild("description_form")->getValue().asString(), 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, - LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(), + LLFloaterPerms::getNextOwnerPerms("Uploads"), LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"), display_name, callback, expected_upload_cost, nruserdata); closeFloater(false); } diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index 80b55c3cbb..3853dd0ef6 100644 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -37,96 +37,139 @@ LLFloaterPerms::LLFloaterPerms(const LLSD& seed) : LLFloater(seed) { - mCommitCallbackRegistrar.add("Perms.Copy", boost::bind(&LLFloaterPerms::onCommitCopy, this)); - mCommitCallbackRegistrar.add("Perms.OK", boost::bind(&LLFloaterPerms::onClickOK, this)); - mCommitCallbackRegistrar.add("Perms.Cancel", boost::bind(&LLFloaterPerms::onClickCancel, this)); - } BOOL LLFloaterPerms::postBuild() { - mCloseSignal.connect(boost::bind(&LLFloaterPerms::cancel, this)); - - refresh(); - - return TRUE; + return true; } -void LLFloaterPerms::onClickOK() -{ - ok(); - closeFloater(); +//static +U32 LLFloaterPerms::getGroupPerms(std::string prefix) +{ + return gSavedSettings.getBOOL(prefix+"ShareWithGroup") ? PERM_COPY : PERM_NONE; } -void LLFloaterPerms::onClickCancel() +//static +U32 LLFloaterPerms::getEveryonePerms(std::string prefix) { - cancel(); - closeFloater(); + return gSavedSettings.getBOOL(prefix+"EveryoneCopy") ? PERM_COPY : PERM_NONE; } -void LLFloaterPerms::onCommitCopy() +//static +U32 LLFloaterPerms::getNextOwnerPerms(std::string prefix) { - // Implements fair use - BOOL copyable = gSavedSettings.getBOOL("NextOwnerCopy"); - if(!copyable) + U32 flags = PERM_MOVE; + if ( gSavedSettings.getBOOL(prefix+"NextOwnerCopy") ) { - gSavedSettings.setBOOL("NextOwnerTransfer", TRUE); + flags |= PERM_COPY; } - LLCheckBoxCtrl* xfer = getChild("next_owner_transfer"); - xfer->setEnabled(copyable); + if ( gSavedSettings.getBOOL(prefix+"NextOwnerModify") ) + { + flags |= PERM_MODIFY; + } + if ( gSavedSettings.getBOOL(prefix+"NextOwnerTransfer") ) + { + flags |= PERM_TRANSFER; + } + return flags; } -void LLFloaterPerms::ok() +//static +U32 LLFloaterPerms::getNextOwnerPermsInverted(std::string prefix) { - refresh(); // Changes were already applied to saved settings. Refreshing internal values makes it official. + // Sets bits for permissions that are off + U32 flags = PERM_MOVE; + if ( !gSavedSettings.getBOOL(prefix+"NextOwnerCopy") ) + { + flags |= PERM_COPY; + } + if ( !gSavedSettings.getBOOL(prefix+"NextOwnerModify") ) + { + flags |= PERM_MODIFY; + } + if ( !gSavedSettings.getBOOL(prefix+"NextOwnerTransfer") ) + { + flags |= PERM_TRANSFER; + } + return flags; } -void LLFloaterPerms::cancel() +LLFloaterPermsDefault::LLFloaterPermsDefault(const LLSD& seed) +: LLFloater(seed) { - gSavedSettings.setBOOL("ShareWithGroup", mShareWithGroup); - gSavedSettings.setBOOL("EveryoneCopy", mEveryoneCopy); - gSavedSettings.setBOOL("NextOwnerCopy", mNextOwnerCopy); - gSavedSettings.setBOOL("NextOwnerModify", mNextOwnerModify); - gSavedSettings.setBOOL("NextOwnerTransfer", mNextOwnerTransfer); + mCommitCallbackRegistrar.add("PermsDefault.Copy", boost::bind(&LLFloaterPermsDefault::onCommitCopy, this, _2)); + mCommitCallbackRegistrar.add("PermsDefault.OK", boost::bind(&LLFloaterPermsDefault::onClickOK, this)); + mCommitCallbackRegistrar.add("PermsDefault.Cancel", boost::bind(&LLFloaterPermsDefault::onClickCancel, this)); } -void LLFloaterPerms::refresh() +BOOL LLFloaterPermsDefault::postBuild() { - mShareWithGroup = gSavedSettings.getBOOL("ShareWithGroup"); - mEveryoneCopy = gSavedSettings.getBOOL("EveryoneCopy"); - mNextOwnerCopy = gSavedSettings.getBOOL("NextOwnerCopy"); - mNextOwnerModify = gSavedSettings.getBOOL("NextOwnerModify"); - mNextOwnerTransfer = gSavedSettings.getBOOL("NextOwnerTransfer"); + mCloseSignal.connect(boost::bind(&LLFloaterPermsDefault::cancel, this)); + + category_names[CAT_OBJECTS] = "Objects"; + category_names[CAT_UPLOADS] = "Uploads"; + category_names[CAT_SCRIPTS] = "Scripts"; + category_names[CAT_NOTECARDS] = "Notecards"; + category_names[CAT_GESTURES] = "Gestures"; + category_names[CAT_WEARABLES] = "Wearables"; + + refresh(); + + return true; } -//static -U32 LLFloaterPerms::getGroupPerms(std::string prefix) -{ - return gSavedSettings.getBOOL(prefix+"ShareWithGroup") ? PERM_COPY : PERM_NONE; +void LLFloaterPermsDefault::onClickOK() +{ + ok(); + closeFloater(); } -//static -U32 LLFloaterPerms::getEveryonePerms(std::string prefix) +void LLFloaterPermsDefault::onClickCancel() { - return gSavedSettings.getBOOL(prefix+"EveryoneCopy") ? PERM_COPY : PERM_NONE; + cancel(); + closeFloater(); } -//static -U32 LLFloaterPerms::getNextOwnerPerms(std::string prefix) +void LLFloaterPermsDefault::onCommitCopy(const LLSD& user_data) { - U32 flags = PERM_MOVE; - if ( gSavedSettings.getBOOL(prefix+"NextOwnerCopy") ) + // Implements fair use + std::string prefix = user_data.asString(); + + BOOL copyable = gSavedSettings.getBOOL(prefix+"NextOwnerCopy"); + if(!copyable) { - flags |= PERM_COPY; + gSavedSettings.setBOOL(prefix+"NextOwnerTransfer", TRUE); } - if ( gSavedSettings.getBOOL(prefix+"NextOwnerModify") ) + LLCheckBoxCtrl* xfer = getChild(prefix+"_transfer"); + xfer->setEnabled(copyable); +} + +void LLFloaterPermsDefault::ok() +{ + refresh(); // Changes were already applied to saved settings. Refreshing internal values makes it official. +} + +void LLFloaterPermsDefault::cancel() +{ + for (U32 iter = CAT_OBJECTS; iter < CAT_LAST; iter++) { - flags |= PERM_MODIFY; + gSavedSettings.setBOOL(category_names[iter]+"NextOwnerCopy", mNextOwnerCopy[iter]); + gSavedSettings.setBOOL(category_names[iter]+"NextOwnerModify", mNextOwnerModify[iter]); + gSavedSettings.setBOOL(category_names[iter]+"NextOwnerTransfer", mNextOwnerTransfer[iter]); + gSavedSettings.setBOOL(category_names[iter]+"ShareWithGroup", mShareWithGroup[iter]); + gSavedSettings.setBOOL(category_names[iter]+"EveryoneCopy", mEveryoneCopy[iter]); } - if ( gSavedSettings.getBOOL(prefix+"NextOwnerTransfer") ) +} + +void LLFloaterPermsDefault::refresh() +{ + for (U32 iter = CAT_OBJECTS; iter < CAT_LAST; iter++) { - flags |= PERM_TRANSFER; + mShareWithGroup[iter] = gSavedSettings.getBOOL(category_names[iter]+"ShareWithGroup"); + mEveryoneCopy[iter] = gSavedSettings.getBOOL(category_names[iter]+"EveryoneCopy"); + mNextOwnerCopy[iter] = gSavedSettings.getBOOL(category_names[iter]+"NextOwnerCopy"); + mNextOwnerModify[iter] = gSavedSettings.getBOOL(category_names[iter]+"NextOwnerModify"); + mNextOwnerTransfer[iter] = gSavedSettings.getBOOL(category_names[iter]+"NextOwnerTransfer"); } - return flags; } - diff --git a/indra/newview/llfloaterperms.h b/indra/newview/llfloaterperms.h index 6b65f4b0cd..bb4a6f9702 100644 --- a/indra/newview/llfloaterperms.h +++ b/indra/newview/llfloaterperms.h @@ -36,26 +36,53 @@ class LLFloaterPerms : public LLFloater public: /*virtual*/ BOOL postBuild(); - void ok(); - void cancel(); - void onClickOK(); - void onClickCancel(); - void onCommitCopy(); + // Convenience methods to get current permission preference bitfields from saved settings: static U32 getEveryonePerms(std::string prefix=""); // prefix + "EveryoneCopy" static U32 getGroupPerms(std::string prefix=""); // prefix + "ShareWithGroup" static U32 getNextOwnerPerms(std::string prefix=""); // bitfield for prefix + "NextOwner" + "Copy", "Modify", and "Transfer" + static U32 getNextOwnerPermsInverted(std::string prefix=""); private: LLFloaterPerms(const LLSD& seed); + +}; + +class LLFloaterPermsDefault : public LLFloater +{ + friend class LLFloaterReg; + +public: + /*virtual*/ BOOL postBuild(); + void ok(); + void cancel(); + void onClickOK(); + void onClickCancel(); + void onCommitCopy(const LLSD& user_data); + +enum Categories +{ + CAT_OBJECTS, + CAT_UPLOADS, + CAT_SCRIPTS, + CAT_NOTECARDS, + CAT_GESTURES, + CAT_WEARABLES, + CAT_LAST +}; + +private: + LLFloaterPermsDefault(const LLSD& seed); void refresh(); - BOOL // cached values only for implementing cancel. - mShareWithGroup, - mEveryoneCopy, - mNextOwnerCopy, - mNextOwnerModify, - mNextOwnerTransfer; + std::string category_names[CAT_LAST]; + + // cached values only for implementing cancel. + bool mShareWithGroup[CAT_LAST]; + bool mEveryoneCopy[CAT_LAST]; + bool mNextOwnerCopy[CAT_LAST]; + bool mNextOwnerModify[CAT_LAST]; + bool mNextOwnerTransfer[CAT_LAST]; }; #endif diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 173b0e538c..596c73870d 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -346,7 +346,8 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.BlockList", boost::bind(&LLFloaterPreference::onClickBlockList, this)); mCommitCallbackRegistrar.add("Pref.Proxy", boost::bind(&LLFloaterPreference::onClickProxySettings, this)); mCommitCallbackRegistrar.add("Pref.TranslationSettings", boost::bind(&LLFloaterPreference::onClickTranslationSettings, this)); - + mCommitCallbackRegistrar.add("Pref.PermsDefault", boost::bind(&LLFloaterPreference::onClickPermsDefault, this)); + sSkin = gSavedSettings.getString("SkinCurrent"); mCommitCallbackRegistrar.add("Pref.ClickActionChange", boost::bind(&LLFloaterPreference::onClickActionChange, this)); @@ -1520,6 +1521,11 @@ void LLFloaterPreference::onClickActionChange() mClickActionDirty = true; } +void LLFloaterPreference::onClickPermsDefault() +{ + LLFloaterReg::showInstance("perms_default"); +} + void LLFloaterPreference::updateClickActionSettings() { const int single_clk_action = getChild("single_click_action_combo")->getValue().asInteger(); diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index ec5994e917..bc6e74b0c7 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -157,6 +157,7 @@ public: void onClickBlockList(); void onClickProxySettings(); void onClickTranslationSettings(); + void onClickPermsDefault(); void applyUIColor(LLUICtrl* ctrl, const LLSD& param); void getUIColor(LLUICtrl* ctrl, const LLSD& param); diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index d8d62e5bbb..1d429c5963 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -980,8 +980,8 @@ void LLSnapshotLivePreview::saveTexture() LLFolderType::FT_SNAPSHOT_CATEGORY, LLInventoryType::IT_SNAPSHOT, PERM_ALL, // Note: Snapshots to inventory is a special case of content upload - LLFloaterPerms::getGroupPerms(), // that is more permissive than other uploads - LLFloaterPerms::getEveryonePerms(), + LLFloaterPerms::getGroupPerms("Uploads"), // that is more permissive than other uploads + LLFloaterPerms::getEveryonePerms("Uploads"), "Snapshot : " + pos_string, callback, expected_upload_cost, userdata); gViewerWindow->playSnapshotAnimAndSound(); diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 85ecb133d0..bca2a28dfd 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -2778,7 +2778,7 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) { LLPointer titem = new LLViewerInventoryItem; titem->unpackMessage(msg, _PREHASH_ItemData, i); - llinfos << "unpaked item '" << titem->getName() << "' in " + llinfos << "unpacked item '" << titem->getName() << "' in " << titem->getParentUUID() << llendl; U32 callback_id; msg->getU32Fast(_PREHASH_ItemData, _PREHASH_CallbackID, callback_id); diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index f461c7e46f..03547f103a 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1369,9 +1369,9 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) result["asset_type"] = "mesh"; result["inventory_type"] = "object"; result["description"] = "(No Description)"; - result["next_owner_mask"] = LLSD::Integer(LLFloaterPerms::getNextOwnerPerms()); - result["group_mask"] = LLSD::Integer(LLFloaterPerms::getGroupPerms()); - result["everyone_mask"] = LLSD::Integer(LLFloaterPerms::getEveryonePerms()); + result["next_owner_mask"] = LLSD::Integer(LLFloaterPerms::getNextOwnerPerms("Uploads")); + result["group_mask"] = LLSD::Integer(LLFloaterPerms::getGroupPerms("Uploads")); + result["everyone_mask"] = LLSD::Integer(LLFloaterPerms::getEveryonePerms("Uploads")); res["mesh_list"] = LLSD::emptyArray(); res["texture_list"] = LLSD::emptyArray(); diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp index a64b4ec94d..f180afa037 100644 --- a/indra/newview/llpanelcontents.cpp +++ b/indra/newview/llpanelcontents.cpp @@ -59,6 +59,7 @@ #include "llviewerregion.h" #include "llviewerwindow.h" #include "llworld.h" +#include "llfloaterperms.h" // // Imported globals @@ -156,12 +157,15 @@ void LLPanelContents::onClickNewScript(void *userdata) { LLPermissions perm; perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, LLUUID::null); + + // Parameters are base, owner, everyone, group, next perm.initMasks( PERM_ALL, PERM_ALL, PERM_NONE, PERM_NONE, - PERM_MOVE | PERM_TRANSFER); + PERM_ALL); +// PERM_MOVE | LLFloaterPerms::getNextOwnerPerms("Scripts")); std::string desc; LLViewerAssetType::generateDescriptionFor(LLAssetType::AT_LSL_TEXT, desc); LLPointer new_item = diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 7fdaac68c8..356c79a036 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -244,12 +244,12 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterPayUtil::registerFloater(); LLFloaterReg::add("people", "floater_people.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("perms_default", "floater_perms_default.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("places", "floater_places.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("prefs_proxy", "floater_preferences_proxy.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("prefs_hardware_settings", "floater_hardware_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("prefs_translation", "floater_translation_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("perm_prefs", "floater_perm_prefs.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("picks", "floater_picks.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("pref_joystick", "floater_joystick.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("preview_anim", "floater_preview_animation.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 45ca23cdfe..0d56233db1 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -64,6 +64,7 @@ #include "llavatarnamecache.h" #include "llavataractions.h" #include "lllogininstance.h" +#include "llfloaterperms.h" ///---------------------------------------------------------------------------- /// Helper class to store special inventory item names and their localized values. @@ -1013,6 +1014,24 @@ void ActivateGestureCallback::fire(const LLUUID& inv_item) LLGestureMgr::instance().activateGesture(inv_item); } +void CreateScriptCallback::fire(const LLUUID& inv_item) +{ + if (inv_item.isNull()) + return; + + LLViewerInventoryItem* item = gInventory.getItem(inv_item); + if (!item) return; + + LLPermissions perm = item->getPermissions(); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Scripts")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Scripts")); + + item->setPermissions(perm); + + gInventory.updateItem(item); + gInventory.notifyObservers(); +} + void CreateGestureCallback::fire(const LLUUID& inv_item) { if (inv_item.isNull()) @@ -1022,6 +1041,12 @@ void CreateGestureCallback::fire(const LLUUID& inv_item) LLViewerInventoryItem* item = gInventory.getItem(inv_item); if (!item) return; + + LLPermissions perm = item->getPermissions(); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Gestures")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Gestures")); + item->setPermissions(perm); + gInventory.updateItem(item); gInventory.notifyObservers(); @@ -1030,6 +1055,23 @@ void CreateGestureCallback::fire(const LLUUID& inv_item) gFloaterView->adjustToFitScreen(preview, FALSE); } +void CreateNotecardCallback::fire(const LLUUID& inv_item) +{ + if (inv_item.isNull()) + return; + + LLViewerInventoryItem* item = gInventory.getItem(inv_item); + if (!item) return; + + LLPermissions perm = item->getPermissions(); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Notecards")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Notecards")); + item->setPermissions(perm); + + gInventory.updateItem(item); + gInventory.notifyObservers(); +} + void AddFavoriteLandmarkCallback::fire(const LLUUID& inv_item_id) { if (mTargetLandmarkId.isNull()) return; @@ -1285,22 +1327,44 @@ void create_new_item(const std::string& name, LLViewerAssetType::generateDescriptionFor(asset_type, desc); next_owner_perm = (next_owner_perm) ? next_owner_perm : PERM_MOVE | PERM_TRANSFER; - - if (inv_type == LLInventoryType::IT_GESTURE) - { - LLPointer cb = new CreateGestureCallback(); - create_inventory_item(gAgent.getID(), gAgent.getSessionID(), - parent_id, LLTransactionID::tnull, name, desc, asset_type, inv_type, - NOT_WEARABLE, next_owner_perm, cb); - } - else + LLPointer cb = NULL; + + switch (inv_type) { - LLPointer cb = NULL; - create_inventory_item(gAgent.getID(), gAgent.getSessionID(), - parent_id, LLTransactionID::tnull, name, desc, asset_type, inv_type, - NOT_WEARABLE, next_owner_perm, cb); - } + case LLInventoryType::IT_LSL: + { + cb = new CreateScriptCallback(); + next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Scripts"); + break; + } + + case LLInventoryType::IT_GESTURE: + { + cb = new CreateGestureCallback(); + next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Gestures"); + break; + } + + case LLInventoryType::IT_NOTECARD: + { + cb = new CreateNotecardCallback(); + next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Notecards"); + break; + } + } + + create_inventory_item(gAgent.getID(), + gAgent.getSessionID(), + parent_id, + LLTransactionID::tnull, + name, + desc, + asset_type, + inv_type, + NOT_WEARABLE, + next_owner_perm, + cb); } const std::string NEW_LSL_NAME = "New Script"; // *TODO:Translate? (probably not) @@ -1341,7 +1405,7 @@ void menu_create_inventory_item(LLFolderView* root, LLFolderBridge *bridge, cons parent_id, LLAssetType::AT_LSL_TEXT, LLInventoryType::IT_LSL, - PERM_MOVE | PERM_TRANSFER); + PERM_MOVE | PERM_TRANSFER); // overridden in create_new_item } else if ("notecard" == type_name) { @@ -1350,7 +1414,7 @@ void menu_create_inventory_item(LLFolderView* root, LLFolderBridge *bridge, cons parent_id, LLAssetType::AT_NOTECARD, LLInventoryType::IT_NOTECARD, - PERM_ALL); + PERM_ALL); // overridden in create_new_item } else if ("gesture" == type_name) { @@ -1359,7 +1423,7 @@ void menu_create_inventory_item(LLFolderView* root, LLFolderBridge *bridge, cons parent_id, LLAssetType::AT_GESTURE, LLInventoryType::IT_GESTURE, - PERM_ALL); + PERM_ALL); // overridden in create_new_item } else { diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index 7822ef4da6..a88a5d31be 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -279,12 +279,24 @@ public: void fire(const LLUUID& inv_item); }; +class CreateScriptCallback : public LLInventoryCallback +{ +public: + void fire(const LLUUID& inv_item); +}; + class CreateGestureCallback : public LLInventoryCallback { public: void fire(const LLUUID& inv_item); }; +class CreateNotecardCallback : public LLInventoryCallback +{ +public: + void fire(const LLUUID& inv_item); +}; + class AddFavoriteLandmarkCallback : public LLInventoryCallback { public: diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index dc2ea4bd1f..aa0c0008aa 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -441,9 +441,9 @@ class LLFileUploadBulk : public view_listener_t 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, - LLFloaterPerms::getNextOwnerPerms(), - LLFloaterPerms::getGroupPerms(), - LLFloaterPerms::getEveryonePerms(), + LLFloaterPerms::getNextOwnerPerms("Uploads"), + LLFloaterPerms::getGroupPerms("Uploads"), + LLFloaterPerms::getEveryonePerms("Uploads"), display_name, callback, expected_upload_cost, @@ -1004,9 +1004,9 @@ void upload_done_callback( 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, - PERM_NONE, - PERM_NONE, - PERM_NONE, + LLFloaterPerms::getNextOwnerPerms("Uploads"), + LLFloaterPerms::getGroupPerms("Uploads"), + LLFloaterPerms::getEveryonePerms("Uploads"), display_name, callback, expected_upload_cost, // assuming next in a group of uploads is of roughly the same type, i.e. same upload cost diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index cd300accb7..98856d125f 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -100,6 +100,7 @@ #include "lltrans.h" #include "llsdutil.h" #include "llmediaentry.h" +#include "llfloaterperms.h" //#define DEBUG_UPDATE_TYPE @@ -2571,8 +2572,15 @@ void LLViewerObject::saveScript( * interaction with doUpdateInventory() called below. */ lldebugs << "LLViewerObject::saveScript() " << item->getUUID() << " " << item->getAssetUUID() << llendl; + + LLPermissions perm = item->getPermissions(); + perm.setMaskNext(LLFloaterPerms::getNextOwnerPerms("Scripts")); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Scripts")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Scripts")); + perm.setMaskNext(PERM_ALL); + LLPointer task_item = - new LLViewerInventoryItem(item->getUUID(), mID, item->getPermissions(), + new LLViewerInventoryItem(item->getUUID(), mID, perm, item->getAssetUUID(), item->getType(), item->getInventoryType(), item->getName(), item->getDescription(), @@ -2594,6 +2602,8 @@ void LLViewerObject::saveScript( task_item->packMessage(msg); msg->sendReliable(mRegionp->getHost()); + task_item->setPermissions(perm); + // do the internal logic doUpdateInventory(task_item, TASK_INVENTORY_ITEM_KEY, is_new); } diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 6912faa9ec..09eec8e5ab 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -74,6 +74,7 @@ #include "object_flags.h" #include "llappviewer.h" +#include "llfloaterperms.h" extern F32 gMinObjectDistance; extern BOOL gAnimateTextures; @@ -266,6 +267,17 @@ void LLViewerObjectList::processUpdateCore(LLViewerObject* objectp, // llinfos << "DEBUG selecting " << objectp->mID << " " // << objectp->mLocalID << llendl; LLSelectMgr::getInstance()->selectObjectAndFamily(objectp); + + // This is a bit of a hack. Because the server ensures one of either COPY or TRANSFER is always be on + // to set the bits we want it is first necessary to set them all on and then clear the ones that + // are not needed. + LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_NEXT_OWNER, TRUE, PERM_COPY | PERM_MODIFY | PERM_TRANSFER); + LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_NEXT_OWNER, FALSE, LLFloaterPerms::getNextOwnerPermsInverted("Objects")); + + LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_EVERYONE, TRUE, LLFloaterPerms::getEveryonePerms("Objects")); + + LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_GROUP, TRUE, LLFloaterPerms::getGroupPerms("Objects")); + dialog_refresh_all(); } diff --git a/indra/newview/skins/default/xui/en/floater_perms_default.xml b/indra/newview/skins/default/xui/en/floater_perms_default.xml new file mode 100644 index 0000000000..ac19be8d15 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_perms_default.xml @@ -0,0 +1,508 @@ + + + + + + + Copy + + + + Modify + + + + Transfer + + + + Share with group + + + + Allow anyone to copy + + + + + Objects + + + + + + + + + + + + + Uploads + + + + + + + + + + + + + Scripts + + + + + + + + + + + + + Notecards + + + + + + + + + + + + + Gestures + + + + + + + + + + + + + + Wearables + + + + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 5ba566b175..c660ef13ae 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1131,13 +1131,6 @@ function="File.UploadBulk" parameter="" /> - - - + -- cgit v1.2.3 From dce0a9be48808d084f3c98615d5747544fe59ad5 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Fri, 8 Jun 2012 17:09:37 -0400 Subject: STORM-68 Add default: to switch statement to fix compiling issue on mac/linux --- indra/newview/llviewerinventory.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 0d56233db1..83a195738a 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1352,6 +1352,8 @@ void create_new_item(const std::string& name, next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Notecards"); break; } + default: + break; } create_inventory_item(gAgent.getID(), -- cgit v1.2.3 From d61a5f743c5d3bde0146b036508485bfdc9c3cb5 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Sat, 9 Jun 2012 10:05:54 -0400 Subject: STORM-68 Removed debugging PERM_ALL that was causing upload trouble and removed 3 obsolete debug settings --- indra/llinventory/llinventory.cpp | 5 ----- indra/newview/app_settings/settings.xml | 33 ------------------------------- indra/newview/llassetuploadresponders.cpp | 2 +- indra/newview/llfloaternamedesc.cpp | 8 +++++++- indra/newview/llfloaterperms.cpp | 2 ++ indra/newview/llviewerobject.cpp | 5 ++--- 6 files changed, 12 insertions(+), 43 deletions(-) (limited to 'indra') diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index 4e5a328c54..fbf23bc3f0 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -303,11 +303,6 @@ LLInventoryItem::LLInventoryItem(const LLUUID& uuid, LLStringUtil::replaceNonstandardASCII(mDescription, ' '); LLStringUtil::replaceChar(mDescription, '|', ' '); mPermissions.initMasks(inv_type); -// if (LLInventoryType::IT_LSL == inv_type) -// { -// mPermissions.setMaskNext(permissions.getMaskNextOwner()); - mPermissions.setMaskNext(PERM_ALL); -// } } LLInventoryItem::LLInventoryItem() : diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index b3ed917574..7a3c1df0bc 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6043,39 +6043,6 @@ Value 130 - NextOwnerCopy - - Comment - Newly created objects can be copied by next owner - Persist - 1 - Type - Boolean - Value - 0 - - NextOwnerModify - - Comment - Newly created objects can be modified by next owner - Persist - 1 - Type - Boolean - Value - 0 - - NextOwnerTransfer - - Comment - Newly created objects can be resold or given away by next owner - Persist - 1 - Type - Boolean - Value - 1 - NewCacheLocation Comment diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index 65bfc990d1..c4a2d8fca5 100644 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -151,7 +151,7 @@ void on_new_single_inventory_upload_complete( LLSaleInfo::DEFAULT, inventory_item_flags, creation_date_now); - +llwarns << "DBG -------------" << llendl; gInventory.updateItem(item); gInventory.notifyObservers(); success = true; diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp index eefc352287..97671a8614 100644 --- a/indra/newview/llfloaternamedesc.cpp +++ b/indra/newview/llfloaternamedesc.cpp @@ -45,6 +45,7 @@ #include "lluictrlfactory.h" #include "llstring.h" #include "lleconomy.h" +#include "llpermissions.h" // linden includes #include "llassetstorage.h" @@ -167,11 +168,16 @@ void LLFloaterNameDesc::onBtnOK( ) S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); // kinda hack - assumes that unsubclassed LLFloaterNameDesc is only used for uploading chargeable assets, which it is right now (it's only used unsubclassed for the sound upload dialog, and THAT should be a subclass). void *nruserdata = NULL; std::string display_name = LLStringUtil::null; + LLPermissions perm; + perm.setMaskNext(PERM_COPY); upload_new_resource(mFilenameAndPath, // file getChild("name_form")->getValue().asString(), getChild("description_form")->getValue().asString(), 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, - LLFloaterPerms::getNextOwnerPerms("Uploads"), LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"), +perm.getMaskNextOwner(), +// LLFloaterPerms::getNextOwnerPerms("Uploads"), + LLFloaterPerms::getGroupPerms("Uploads"), + LLFloaterPerms::getEveryonePerms("Uploads"), display_name, callback, expected_upload_cost, nruserdata); closeFloater(false); } diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index 3853dd0ef6..ede17d937e 100644 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -59,6 +59,8 @@ U32 LLFloaterPerms::getEveryonePerms(std::string prefix) //static U32 LLFloaterPerms::getNextOwnerPerms(std::string prefix) { +llwarns << "DBG prefix=" << prefix << llendl; + U32 flags = PERM_MOVE; if ( gSavedSettings.getBOOL(prefix+"NextOwnerCopy") ) { diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 98856d125f..a494e934b0 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -2577,7 +2577,6 @@ void LLViewerObject::saveScript( perm.setMaskNext(LLFloaterPerms::getNextOwnerPerms("Scripts")); perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Scripts")); perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Scripts")); - perm.setMaskNext(PERM_ALL); LLPointer task_item = new LLViewerInventoryItem(item->getUUID(), mID, perm, @@ -2602,10 +2601,10 @@ void LLViewerObject::saveScript( task_item->packMessage(msg); msg->sendReliable(mRegionp->getHost()); - task_item->setPermissions(perm); - // do the internal logic doUpdateInventory(task_item, TASK_INVENTORY_ITEM_KEY, is_new); +llwarns << "DBG is_new:" << is_new << llendl; + task_item->setPermissions(perm); } void LLViewerObject::moveInventory(const LLUUID& folder_id, -- cgit v1.2.3 From b6df9b6d56108bcf4b3e8dfd875ef76a9b6f448b Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Sat, 9 Jun 2012 11:43:39 -0400 Subject: STORM-68 Fiddling with debugging for New Script case --- indra/newview/llassetuploadresponders.cpp | 2 +- indra/newview/llfloaternamedesc.cpp | 6 ++---- indra/newview/llfloaterperms.cpp | 2 -- indra/newview/llpanelcontents.cpp | 4 ++-- indra/newview/llviewerobject.cpp | 20 ++++++++++++-------- 5 files changed, 17 insertions(+), 17 deletions(-) (limited to 'indra') diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index c4a2d8fca5..65bfc990d1 100644 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -151,7 +151,7 @@ void on_new_single_inventory_upload_complete( LLSaleInfo::DEFAULT, inventory_item_flags, creation_date_now); -llwarns << "DBG -------------" << llendl; + gInventory.updateItem(item); gInventory.notifyObservers(); success = true; diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp index 97671a8614..ee7f413a59 100644 --- a/indra/newview/llfloaternamedesc.cpp +++ b/indra/newview/llfloaternamedesc.cpp @@ -168,14 +168,12 @@ void LLFloaterNameDesc::onBtnOK( ) S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); // kinda hack - assumes that unsubclassed LLFloaterNameDesc is only used for uploading chargeable assets, which it is right now (it's only used unsubclassed for the sound upload dialog, and THAT should be a subclass). void *nruserdata = NULL; std::string display_name = LLStringUtil::null; - LLPermissions perm; - perm.setMaskNext(PERM_COPY); + upload_new_resource(mFilenameAndPath, // file getChild("name_form")->getValue().asString(), getChild("description_form")->getValue().asString(), 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, -perm.getMaskNextOwner(), -// LLFloaterPerms::getNextOwnerPerms("Uploads"), + LLFloaterPerms::getNextOwnerPerms("Uploads"), LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"), display_name, callback, expected_upload_cost, nruserdata); diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index ede17d937e..3853dd0ef6 100644 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -59,8 +59,6 @@ U32 LLFloaterPerms::getEveryonePerms(std::string prefix) //static U32 LLFloaterPerms::getNextOwnerPerms(std::string prefix) { -llwarns << "DBG prefix=" << prefix << llendl; - U32 flags = PERM_MOVE; if ( gSavedSettings.getBOOL(prefix+"NextOwnerCopy") ) { diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp index f180afa037..db4b679c50 100644 --- a/indra/newview/llpanelcontents.cpp +++ b/indra/newview/llpanelcontents.cpp @@ -164,8 +164,8 @@ void LLPanelContents::onClickNewScript(void *userdata) PERM_ALL, PERM_NONE, PERM_NONE, - PERM_ALL); -// PERM_MOVE | LLFloaterPerms::getNextOwnerPerms("Scripts")); + // this does not work + PERM_MOVE | LLFloaterPerms::getNextOwnerPerms("Scripts")); std::string desc; LLViewerAssetType::generateDescriptionFor(LLAssetType::AT_LSL_TEXT, desc); LLPointer new_item = diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index a494e934b0..57549e025c 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -2555,6 +2555,17 @@ void LLViewerObject::doUpdateInventory( doInventoryCallback(); ++mInventorySerialNum; } + + if(is_new && mInventory) + { + std::string name = item->getName(); +llwarns << "DBG " << name << llendl; + LLPermissions perm = item->getPermissions(); + perm.setMaskNext(LLFloaterPerms::getNextOwnerPerms("Scripts")); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Scripts")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Scripts")); + item->setPermissions(perm); + } } // save a script, which involves removing the old one, and rezzing @@ -2573,13 +2584,8 @@ void LLViewerObject::saveScript( */ lldebugs << "LLViewerObject::saveScript() " << item->getUUID() << " " << item->getAssetUUID() << llendl; - LLPermissions perm = item->getPermissions(); - perm.setMaskNext(LLFloaterPerms::getNextOwnerPerms("Scripts")); - perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Scripts")); - perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Scripts")); - LLPointer task_item = - new LLViewerInventoryItem(item->getUUID(), mID, perm, + new LLViewerInventoryItem(item->getUUID(), mID, item->getPermissions(), item->getAssetUUID(), item->getType(), item->getInventoryType(), item->getName(), item->getDescription(), @@ -2603,8 +2609,6 @@ void LLViewerObject::saveScript( // do the internal logic doUpdateInventory(task_item, TASK_INVENTORY_ITEM_KEY, is_new); -llwarns << "DBG is_new:" << is_new << llendl; - task_item->setPermissions(perm); } void LLViewerObject::moveInventory(const LLUUID& folder_id, -- cgit v1.2.3 From 052dc3982056d822a523394954c277d9eb7c7ab9 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 12 Jun 2012 14:26:53 -0400 Subject: STORM-68 Fix for group perms not being defined correctly and fix for group and everyone perms failing to copy and paste --- indra/newview/llagentwearables.cpp | 7 +- indra/newview/llfloatergesture.cpp | 1 + indra/newview/llfloaterperms.cpp | 2 +- indra/newview/llpanelcontents.cpp | 10 ++ indra/newview/llviewerinventory.cpp | 8 +- indra/newview/llviewerobject.cpp | 11 --- .../skins/default/xui/en/floater_perm_prefs.xml | 108 --------------------- .../skins/default/xui/en/floater_perms_default.xml | 23 ----- 8 files changed, 20 insertions(+), 150 deletions(-) delete mode 100644 indra/newview/skins/default/xui/en/floater_perm_prefs.xml (limited to 'indra') diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 7017357346..654a785a1a 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -66,21 +66,18 @@ class LLWearAndEditCallback : public LLInventoryCallback { void fire(const LLUUID& inv_item) { -llwarns << "DBG 1" << llendl; if (inv_item.isNull()) return; -llwarns << "DBG 2" << llendl; LLViewerInventoryItem* item = gInventory.getItem(inv_item); if (!item) return; -llwarns << "DBG 3" << llendl; LLPermissions perm = item->getPermissions(); perm.setMaskNext(LLFloaterPerms::getNextOwnerPerms("Wearables")); perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Wearables")); perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Wearables")); item->setPermissions(perm); -llwarns << "DBG 4" << llendl; + item->updateServer(FALSE); gInventory.updateItem(item); gInventory.notifyObservers(); @@ -108,6 +105,7 @@ class LLCreateWearableCallback : public LLInventoryCallback perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Wearables")); item->setPermissions(perm); + item->updateServer(FALSE); gInventory.updateItem(item); gInventory.notifyObservers(); } @@ -521,6 +519,7 @@ void LLAgentWearables::saveWearableAs(const LLWearableType::EType type, LLWearable* new_wearable = LLWearableList::instance().createCopy( old_wearable, trunc_name); + LLPointer cb = new addWearableToAgentInventoryCallback( LLPointer(NULL), diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp index dcc245ee20..59f5b2b346 100644 --- a/indra/newview/llfloatergesture.cpp +++ b/indra/newview/llfloatergesture.cpp @@ -84,6 +84,7 @@ public: perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Gestures")); perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Gestures")); item->setPermissions(perm); + item->updateServer(FALSE); } } }; diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index 3853dd0ef6..4e9acfc780 100644 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -47,7 +47,7 @@ BOOL LLFloaterPerms::postBuild() //static U32 LLFloaterPerms::getGroupPerms(std::string prefix) { - return gSavedSettings.getBOOL(prefix+"ShareWithGroup") ? PERM_COPY : PERM_NONE; + return gSavedSettings.getBOOL(prefix+"ShareWithGroup") ? PERM_COPY | PERM_MOVE | PERM_MODIFY : PERM_NONE; } //static diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp index db4b679c50..ac0cf460c0 100644 --- a/indra/newview/llpanelcontents.cpp +++ b/indra/newview/llpanelcontents.cpp @@ -183,6 +183,16 @@ void LLPanelContents::onClickNewScript(void *userdata) time_corrected()); object->saveScript(new_item, TRUE, true); + std::string name = new_item->getName(); +llwarns << "DBG " << new_item->getUUID() << llendl; + +// LLPermissions perm = new_item->getPermissions(); + perm.setMaskNext(LLFloaterPerms::getNextOwnerPerms("Scripts")); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Scripts")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Scripts")); + new_item->setPermissions(perm); + + // *NOTE: In order to resolve SL-22177, we needed to create // the script first, and then you have to click it in // inventory to edit it. diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 83a195738a..a7ba150294 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1025,9 +1025,9 @@ void CreateScriptCallback::fire(const LLUUID& inv_item) LLPermissions perm = item->getPermissions(); perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Scripts")); perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Scripts")); - item->setPermissions(perm); + item->updateServer(FALSE); gInventory.updateItem(item); gInventory.notifyObservers(); } @@ -1047,8 +1047,9 @@ void CreateGestureCallback::fire(const LLUUID& inv_item) perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Gestures")); item->setPermissions(perm); - gInventory.updateItem(item); - gInventory.notifyObservers(); + item->updateServer(FALSE); + gInventory.updateItem(item); + gInventory.notifyObservers(); LLPreviewGesture* preview = LLPreviewGesture::show(inv_item, LLUUID::null); // Force to be entirely onscreen. @@ -1068,6 +1069,7 @@ void CreateNotecardCallback::fire(const LLUUID& inv_item) perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Notecards")); item->setPermissions(perm); + item->updateServer(FALSE); gInventory.updateItem(item); gInventory.notifyObservers(); } diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 57549e025c..ff714f24b4 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -2555,17 +2555,6 @@ void LLViewerObject::doUpdateInventory( doInventoryCallback(); ++mInventorySerialNum; } - - if(is_new && mInventory) - { - std::string name = item->getName(); -llwarns << "DBG " << name << llendl; - LLPermissions perm = item->getPermissions(); - perm.setMaskNext(LLFloaterPerms::getNextOwnerPerms("Scripts")); - perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Scripts")); - perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Scripts")); - item->setPermissions(perm); - } } // save a script, which involves removing the old one, and rezzing diff --git a/indra/newview/skins/default/xui/en/floater_perm_prefs.xml b/indra/newview/skins/default/xui/en/floater_perm_prefs.xml deleted file mode 100644 index ff454e3ebf..0000000000 --- a/indra/newview/skins/default/xui/en/floater_perm_prefs.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - Next owner can: - - - - - - - - - - diff --git a/indra/newview/skins/default/xui/en/floater_perms_default.xml b/indra/newview/skins/default/xui/en/floater_perms_default.xml index ac19be8d15..15077330fd 100644 --- a/indra/newview/skins/default/xui/en/floater_perms_default.xml +++ b/indra/newview/skins/default/xui/en/floater_perms_default.xml @@ -8,7 +8,6 @@ save_rect="true" title="DEFAULT CREATION PERMISSIONS" width="700"> - - Copy - Modify - Transfer - Share with group - Allow anyone to copy - - - - - - - - - - - - - - - - - + + + + [http://community.secondlife.com/t5/English-Knowledge-Base/Second-Life-Share/ta-p/2149711 Learn about posting to Flickr] + + + diff --git a/indra/newview/skins/default/xui/en/panel_flickr_photo.xml b/indra/newview/skins/default/xui/en/panel_flickr_photo.xml new file mode 100644 index 0000000000..1fc4927ac2 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_flickr_photo.xml @@ -0,0 +1,152 @@ + + + + + + + + + + + [SIZE] KB + + + + + + Refreshing... + + + Comment (optional): + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index df04ddee86..ce09faeac0 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -148,13 +148,19 @@ Please try logging in again in a minute. You were sent to an invalid region. Testing viewer disconnect - - Connecting to Facebook... - Posting... - Disconnecting from Facebook... - Problem connecting to Facebook - Problem posting to Facebook - Problem disconnecting from Facebook + + Connecting to Facebook... + Posting... + Disconnecting from Facebook... + Problem connecting to Facebook + Problem posting to Facebook + Problem disconnecting from Facebook + Connecting to Flickr... + Posting... + Disconnecting from Flickr... + Problem connecting to Flickr + Problem posting to Flickr + Problem disconnecting from Flickr Person -- cgit v1.2.3 From 7c46eb17f24e30fe83469a297086aa93f100e5ed Mon Sep 17 00:00:00 2001 From: Cho Date: Mon, 4 Nov 2013 19:12:39 +0000 Subject: Changed SLShare menu text to match spec for ACME-1138 --- indra/newview/skins/default/xui/en/menu_viewer.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 19fe706885..bbd6e94579 100755 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -281,14 +281,14 @@ Date: Mon, 4 Nov 2013 23:42:21 +0000 Subject: added Twitter floater for ACME-1146, ACME-1147, ACME-1148, ACME-1149, and ACME-1150 --- indra/newview/CMakeLists.txt | 2 + indra/newview/llfloatersnapshot.cpp | 8 +- indra/newview/llfloatertwitter.cpp | 669 +++++++++++++++++++++ indra/newview/llfloatertwitter.h | 122 ++++ indra/newview/llsnapshotlivepreview.cpp | 3 + indra/newview/lltwitterconnect.cpp | 3 +- indra/newview/llviewerfloaterreg.cpp | 2 + .../skins/default/xui/en/floater_twitter.xml | 89 +++ indra/newview/skins/default/xui/en/menu_viewer.xml | 11 +- .../skins/default/xui/en/panel_twitter_account.xml | 75 +++ .../skins/default/xui/en/panel_twitter_photo.xml | 152 +++++ indra/newview/skins/default/xui/en/strings.xml | 8 +- 12 files changed, 1137 insertions(+), 7 deletions(-) create mode 100644 indra/newview/llfloatertwitter.cpp create mode 100644 indra/newview/llfloatertwitter.h create mode 100644 indra/newview/skins/default/xui/en/floater_twitter.xml create mode 100644 indra/newview/skins/default/xui/en/panel_twitter_account.xml create mode 100644 indra/newview/skins/default/xui/en/panel_twitter_photo.xml (limited to 'indra') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 226c739e48..746991a6f0 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -288,6 +288,7 @@ set(viewer_SOURCE_FILES llfloatertos.cpp llfloatertoybox.cpp llfloatertranslationsettings.cpp + llfloatertwitter.cpp llfloateruipreview.cpp llfloaterurlentry.cpp llfloatervoiceeffect.cpp @@ -879,6 +880,7 @@ set(viewer_HEADER_FILES llfloatertos.h llfloatertoybox.h llfloatertranslationsettings.h + llfloatertwitter.h llfloateruipreview.h llfloaterurlentry.h llfloatervoiceeffect.h diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index fa92ed094b..4701e128d3 100755 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -33,6 +33,7 @@ #include "llfloaterreg.h" #include "llfloatersocial.h" #include "llfloaterflickr.h" +#include "llfloatertwitter.h" #include "llcheckboxctrl.h" #include "llcombobox.h" #include "llpostcard.h" @@ -1265,10 +1266,11 @@ S32 LLFloaterSnapshot::notify(const LLSD& info) void LLFloaterSnapshot::update() { LLFloaterSnapshot* inst = LLFloaterReg::findTypedInstance("snapshot"); - LLFloaterSocial* floater_social = LLFloaterReg::findTypedInstance("social"); - LLFloaterFlickr* floater_flickr = LLFloaterReg::findTypedInstance("flickr"); + LLFloaterSocial* floater_social = LLFloaterReg::findTypedInstance("social"); + LLFloaterFlickr* floater_flickr = LLFloaterReg::findTypedInstance("flickr"); + LLFloaterTwitter* floater_twitter = LLFloaterReg::findTypedInstance("twitter"); - if (!inst && !floater_social && !floater_flickr) + if (!inst && !floater_social && !floater_flickr && !floater_twitter) return; BOOL changed = FALSE; diff --git a/indra/newview/llfloatertwitter.cpp b/indra/newview/llfloatertwitter.cpp new file mode 100644 index 0000000000..b45cf32945 --- /dev/null +++ b/indra/newview/llfloatertwitter.cpp @@ -0,0 +1,669 @@ +/** +* @file llfloatertwitter.cpp +* @brief Implementation of llfloatertwitter +* @author cho@lindenlab.com +* +* $LicenseInfo:firstyear=2013&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2013, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" + +#include "llfloatertwitter.h" + +#include "llagent.h" +#include "llagentui.h" +#include "llcheckboxctrl.h" +#include "llcombobox.h" +#include "lltwitterconnect.h" +#include "llfloaterreg.h" +#include "lliconctrl.h" +#include "llresmgr.h" // LLLocale +#include "llsdserialize.h" +#include "llloadingindicator.h" +#include "llplugincookiestore.h" +#include "llslurl.h" +#include "lltrans.h" +#include "llsnapshotlivepreview.h" +#include "llviewerregion.h" +#include "llviewercontrol.h" +#include "llviewermedia.h" + +static LLRegisterPanelClassWrapper t_panel_photo("lltwitterphotopanel"); +static LLRegisterPanelClassWrapper t_panel_account("lltwitteraccountpanel"); + +const S32 MAX_POSTCARD_DATASIZE = 1024 * 1024; // one megabyte +const std::string DEFAULT_PHOTO_QUERY_PARAMETERS = "?sourceid=slshare_photo&utm_source=twitter&utm_medium=photo&utm_campaign=slshare"; + +/////////////////////////// +//LLTwitterPhotoPanel/////// +/////////////////////////// + +LLTwitterPhotoPanel::LLTwitterPhotoPanel() : +mSnapshotPanel(NULL), +mResolutionComboBox(NULL), +mRefreshBtn(NULL), +mWorkingLabel(NULL), +mThumbnailPlaceholder(NULL), +mCaptionTextBox(NULL), +mLocationCheckbox(NULL), +mPostButton(NULL) +{ + mCommitCallbackRegistrar.add("SocialSharing.SendPhoto", boost::bind(&LLTwitterPhotoPanel::onSend, this)); + mCommitCallbackRegistrar.add("SocialSharing.RefreshPhoto", boost::bind(&LLTwitterPhotoPanel::onClickNewSnapshot, this)); +} + +LLTwitterPhotoPanel::~LLTwitterPhotoPanel() +{ + if(mPreviewHandle.get()) + { + mPreviewHandle.get()->die(); + } +} + +BOOL LLTwitterPhotoPanel::postBuild() +{ + setVisibleCallback(boost::bind(&LLTwitterPhotoPanel::onVisibilityChange, this, _2)); + + mSnapshotPanel = getChild("snapshot_panel"); + mResolutionComboBox = getChild("resolution_combobox"); + mResolutionComboBox->setCommitCallback(boost::bind(&LLTwitterPhotoPanel::updateResolution, this, TRUE)); + mRefreshBtn = getChild("new_snapshot_btn"); + mWorkingLabel = getChild("working_lbl"); + mThumbnailPlaceholder = getChild("thumbnail_placeholder"); + mCaptionTextBox = getChild("photo_caption"); + mLocationCheckbox = getChild("add_location_cb"); + mPostButton = getChild("post_photo_btn"); + mCancelButton = getChild("cancel_photo_btn"); + + return LLPanel::postBuild(); +} + +void LLTwitterPhotoPanel::draw() +{ + LLSnapshotLivePreview * previewp = static_cast(mPreviewHandle.get()); + + // Enable interaction only if no transaction with the service is on-going (prevent duplicated posts) + bool no_ongoing_connection = !(LLTwitterConnect::instance().isTransactionOngoing()); + mCancelButton->setEnabled(no_ongoing_connection); + mCaptionTextBox->setEnabled(no_ongoing_connection); + mResolutionComboBox->setEnabled(no_ongoing_connection); + mRefreshBtn->setEnabled(no_ongoing_connection); + mLocationCheckbox->setEnabled(no_ongoing_connection); + + // Display the preview if one is available + if (previewp && previewp->getThumbnailImage()) + { + const LLRect& thumbnail_rect = mThumbnailPlaceholder->getRect(); + const S32 thumbnail_w = previewp->getThumbnailWidth(); + const S32 thumbnail_h = previewp->getThumbnailHeight(); + + // calc preview offset within the preview rect + const S32 local_offset_x = (thumbnail_rect.getWidth() - thumbnail_w) / 2 ; + const S32 local_offset_y = (thumbnail_rect.getHeight() - thumbnail_h) / 2 ; + + // calc preview offset within the floater rect + // Hack : To get the full offset, we need to take into account each and every offset of each widgets up to the floater. + // This is almost as arbitrary as using a fixed offset so that's what we do here for the sake of simplicity. + // *TODO : Get the offset looking through the hierarchy of widgets, should be done in postBuild() so to avoid traversing the hierarchy each time. + S32 offset_x = thumbnail_rect.mLeft + local_offset_x - 1; + S32 offset_y = thumbnail_rect.mBottom + local_offset_y - 39; + + mSnapshotPanel->localPointToOtherView(offset_x, offset_y, &offset_x, &offset_y, getParentByType()); + + gGL.matrixMode(LLRender::MM_MODELVIEW); + // Apply floater transparency to the texture unless the floater is focused. + F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); + LLColor4 color = LLColor4::white; + gl_draw_scaled_image(offset_x, offset_y, + thumbnail_w, thumbnail_h, + previewp->getThumbnailImage(), color % alpha); + + previewp->drawPreviewRect(offset_x, offset_y) ; + } + + // Update the visibility of the working (computing preview) label + mWorkingLabel->setVisible(!(previewp && previewp->getSnapshotUpToDate())); + + // Enable Post if we have a preview to send and no on going connection being processed + mPostButton->setEnabled(no_ongoing_connection && (previewp && previewp->getSnapshotUpToDate())); + + // Draw the rest of the panel on top of it + LLPanel::draw(); +} + +LLSnapshotLivePreview* LLTwitterPhotoPanel::getPreviewView() +{ + LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)mPreviewHandle.get(); + return previewp; +} + +void LLTwitterPhotoPanel::onVisibilityChange(const LLSD& new_visibility) +{ + bool visible = new_visibility.asBoolean(); + if (visible) + { + if (mPreviewHandle.get()) + { + LLSnapshotLivePreview* preview = getPreviewView(); + if(preview) + { + lldebugs << "opened, updating snapshot" << llendl; + preview->updateSnapshot(TRUE); + } + } + else + { + LLRect full_screen_rect = getRootView()->getRect(); + LLSnapshotLivePreview::Params p; + p.rect(full_screen_rect); + LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p); + mPreviewHandle = previewp->getHandle(); + + previewp->setSnapshotType(previewp->SNAPSHOT_WEB); + previewp->setSnapshotFormat(LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG); + //previewp->setSnapshotQuality(98); + previewp->setThumbnailPlaceholderRect(mThumbnailPlaceholder->getRect()); + + updateControls(); + } + } +} + +void LLTwitterPhotoPanel::onClickNewSnapshot() +{ + LLSnapshotLivePreview* previewp = getPreviewView(); + if (previewp) + { + //setStatus(Impl::STATUS_READY); + lldebugs << "updating snapshot" << llendl; + previewp->updateSnapshot(TRUE); + } +} + +void LLTwitterPhotoPanel::onSend() +{ + LLEventPumps::instance().obtain("TwitterConnectState").stopListening("LLTwitterPhotoPanel"); // just in case it is already listening + LLEventPumps::instance().obtain("TwitterConnectState").listen("LLTwitterPhotoPanel", boost::bind(&LLTwitterPhotoPanel::onTwitterConnectStateChange, this, _1)); + + // Connect to Twitter if necessary and then post + if (LLTwitterConnect::instance().isConnected()) + { + sendPhoto(); + } + else + { + LLTwitterConnect::instance().checkConnectionToTwitter(true); + } +} + +bool LLTwitterPhotoPanel::onTwitterConnectStateChange(const LLSD& data) +{ + switch (data.get("enum").asInteger()) + { + case LLTwitterConnect::TWITTER_CONNECTED: + sendPhoto(); + break; + + case LLTwitterConnect::TWITTER_POSTED: + LLEventPumps::instance().obtain("TwitterConnectState").stopListening("LLTwitterPhotoPanel"); + clearAndClose(); + break; + } + + return false; +} + +void LLTwitterPhotoPanel::sendPhoto() +{ + // Get the caption + std::string caption = mCaptionTextBox->getValue().asString(); + + // Add the location if required + bool add_location = mLocationCheckbox->getValue().asBoolean(); + if (add_location) + { + // Get the SLURL for the location + LLSLURL slurl; + LLAgentUI::buildSLURL(slurl); + std::string slurl_string = slurl.getSLURLString(); + + // Add query parameters so Google Analytics can track incoming clicks! + slurl_string += DEFAULT_PHOTO_QUERY_PARAMETERS; + + // Add it to the caption (pretty crude, but we don't have a better option with photos) + if (caption.empty()) + caption = slurl_string; + else + caption = caption + " " + slurl_string; + } + + // Get the image + LLSnapshotLivePreview* previewp = getPreviewView(); + + // Post to Twitter + LLTwitterConnect::instance().uploadPhoto(previewp->getFormattedImage(), caption); + + updateControls(); +} + +void LLTwitterPhotoPanel::clearAndClose() +{ + mCaptionTextBox->setValue(""); + + LLFloater* floater = getParentByType(); + if (floater) + { + floater->closeFloater(); + } +} + +void LLTwitterPhotoPanel::updateControls() +{ + LLSnapshotLivePreview* previewp = getPreviewView(); + BOOL got_bytes = previewp && previewp->getDataSize() > 0; + BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); + LLSnapshotLivePreview::ESnapshotType shot_type = (previewp ? previewp->getSnapshotType() : LLSnapshotLivePreview::SNAPSHOT_POSTCARD); + + // *TODO: Separate maximum size for Web images from postcards + lldebugs << "Is snapshot up-to-date? " << got_snap << llendl; + + LLLocale locale(LLLocale::USER_LOCALE); + std::string bytes_string; + if (got_snap) + { + LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 ); + } + + //getChild("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : getString("unknown")); <---uses localized string + getChild("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : "unknown"); + getChild("file_size_label")->setColor( + shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD + && got_bytes + && previewp->getDataSize() > MAX_POSTCARD_DATASIZE ? LLUIColor(LLColor4::red) : LLUIColorTable::instance().getColor( "LabelTextColor" )); + + updateResolution(FALSE); +} + +void LLTwitterPhotoPanel::updateResolution(BOOL do_update) +{ + LLComboBox* combobox = static_cast(mResolutionComboBox); + + std::string sdstring = combobox->getSelectedValue(); + LLSD sdres; + std::stringstream sstream(sdstring); + LLSDSerialize::fromNotation(sdres, sstream, sdstring.size()); + + S32 width = sdres[0]; + S32 height = sdres[1]; + + LLSnapshotLivePreview * previewp = static_cast(mPreviewHandle.get()); + if (previewp && combobox->getCurrentIndex() >= 0) + { + S32 original_width = 0 , original_height = 0 ; + previewp->getSize(original_width, original_height) ; + + if (width == 0 || height == 0) + { + // take resolution from current window size + lldebugs << "Setting preview res from window: " << gViewerWindow->getWindowWidthRaw() << "x" << gViewerWindow->getWindowHeightRaw() << llendl; + previewp->setSize(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw()); + } + else + { + // use the resolution from the selected pre-canned drop-down choice + lldebugs << "Setting preview res selected from combo: " << width << "x" << height << llendl; + previewp->setSize(width, height); + } + + checkAspectRatio(width); + + previewp->getSize(width, height); + + if(original_width != width || original_height != height) + { + previewp->setSize(width, height); + + // hide old preview as the aspect ratio could be wrong + lldebugs << "updating thumbnail" << llendl; + + previewp->updateSnapshot(FALSE, TRUE); + if(do_update) + { + lldebugs << "Will update controls" << llendl; + updateControls(); + LLTwitterPhotoPanel::onClickNewSnapshot(); + } + } + + } +} + +void LLTwitterPhotoPanel::checkAspectRatio(S32 index) +{ + LLSnapshotLivePreview *previewp = getPreviewView() ; + + BOOL keep_aspect = FALSE; + + if (0 == index) // current window size + { + keep_aspect = TRUE; + } + else // predefined resolution + { + keep_aspect = FALSE; + } + + if (previewp) + { + previewp->mKeepAspectRatio = keep_aspect; + } +} + +LLUICtrl* LLTwitterPhotoPanel::getRefreshBtn() +{ + return mRefreshBtn; +} + +/////////////////////////// +//LLTwitterAccountPanel////// +/////////////////////////// + +LLTwitterAccountPanel::LLTwitterAccountPanel() : +mAccountCaptionLabel(NULL), +mAccountNameLabel(NULL), +mPanelButtons(NULL), +mConnectButton(NULL), +mDisconnectButton(NULL) +{ + mCommitCallbackRegistrar.add("SocialSharing.Connect", boost::bind(&LLTwitterAccountPanel::onConnect, this)); + mCommitCallbackRegistrar.add("SocialSharing.Disconnect", boost::bind(&LLTwitterAccountPanel::onDisconnect, this)); + + setVisibleCallback(boost::bind(&LLTwitterAccountPanel::onVisibilityChange, this, _2)); +} + +BOOL LLTwitterAccountPanel::postBuild() +{ + mAccountCaptionLabel = getChild("account_caption_label"); + mAccountNameLabel = getChild("account_name_label"); + mPanelButtons = getChild("panel_buttons"); + mConnectButton = getChild("connect_btn"); + mDisconnectButton = getChild("disconnect_btn"); + + return LLPanel::postBuild(); +} + +void LLTwitterAccountPanel::draw() +{ + LLTwitterConnect::EConnectionState connection_state = LLTwitterConnect::instance().getConnectionState(); + + //Disable the 'disconnect' button and the 'use another account' button when disconnecting in progress + bool disconnecting = connection_state == LLTwitterConnect::TWITTER_DISCONNECTING; + mDisconnectButton->setEnabled(!disconnecting); + + //Disable the 'connect' button when a connection is in progress + bool connecting = connection_state == LLTwitterConnect::TWITTER_CONNECTION_IN_PROGRESS; + mConnectButton->setEnabled(!connecting); + + LLPanel::draw(); +} + +void LLTwitterAccountPanel::onVisibilityChange(const LLSD& new_visibility) +{ + bool visible = new_visibility.asBoolean(); + + if(visible) + { + LLEventPumps::instance().obtain("TwitterConnectState").stopListening("LLTwitterAccountPanel"); + LLEventPumps::instance().obtain("TwitterConnectState").listen("LLTwitterAccountPanel", boost::bind(&LLTwitterAccountPanel::onTwitterConnectStateChange, this, _1)); + + LLEventPumps::instance().obtain("TwitterConnectInfo").stopListening("LLTwitterAccountPanel"); + LLEventPumps::instance().obtain("TwitterConnectInfo").listen("LLTwitterAccountPanel", boost::bind(&LLTwitterAccountPanel::onTwitterConnectInfoChange, this)); + + //Connected + if(LLTwitterConnect::instance().isConnected()) + { + showConnectedLayout(); + } + //Check if connected (show disconnected layout in meantime) + else + { + showDisconnectedLayout(); + } + if ((LLTwitterConnect::instance().getConnectionState() == LLTwitterConnect::TWITTER_NOT_CONNECTED) || + (LLTwitterConnect::instance().getConnectionState() == LLTwitterConnect::TWITTER_CONNECTION_FAILED)) + { + LLTwitterConnect::instance().checkConnectionToTwitter(); + } + } + else + { + LLEventPumps::instance().obtain("TwitterConnectState").stopListening("LLTwitterAccountPanel"); + LLEventPumps::instance().obtain("TwitterConnectInfo").stopListening("LLTwitterAccountPanel"); + } +} + +bool LLTwitterAccountPanel::onTwitterConnectStateChange(const LLSD& data) +{ + if(LLTwitterConnect::instance().isConnected()) + { + //In process of disconnecting so leave the layout as is + if(data.get("enum").asInteger() != LLTwitterConnect::TWITTER_DISCONNECTING) + { + showConnectedLayout(); + } + } + else + { + showDisconnectedLayout(); + } + + return false; +} + +bool LLTwitterAccountPanel::onTwitterConnectInfoChange() +{ + LLSD info = LLTwitterConnect::instance().getInfo(); + std::string clickable_name; + + //Strings of format [http://www.somewebsite.com Click Me] become clickable text + if(info.has("link") && info.has("name")) + { + clickable_name = "[" + info["link"].asString() + " " + info["name"].asString() + "]"; + } + + mAccountNameLabel->setText(clickable_name); + + return false; +} + +void LLTwitterAccountPanel::showConnectButton() +{ + if(!mConnectButton->getVisible()) + { + mConnectButton->setVisible(TRUE); + mDisconnectButton->setVisible(FALSE); + } +} + +void LLTwitterAccountPanel::hideConnectButton() +{ + if(mConnectButton->getVisible()) + { + mConnectButton->setVisible(FALSE); + mDisconnectButton->setVisible(TRUE); + } +} + +void LLTwitterAccountPanel::showDisconnectedLayout() +{ + mAccountCaptionLabel->setText(getString("twitter_disconnected")); + mAccountNameLabel->setText(std::string("")); + showConnectButton(); +} + +void LLTwitterAccountPanel::showConnectedLayout() +{ + LLTwitterConnect::instance().loadTwitterInfo(); + + mAccountCaptionLabel->setText(getString("twitter_connected")); + hideConnectButton(); +} + +void LLTwitterAccountPanel::onConnect() +{ + LLTwitterConnect::instance().checkConnectionToTwitter(true); + + //Clear only the twitter browser cookies so that the twitter login screen appears + LLViewerMedia::getCookieStore()->removeCookiesByDomain(".twitter.com"); +} + +void LLTwitterAccountPanel::onDisconnect() +{ + LLTwitterConnect::instance().disconnectFromTwitter(); + + LLViewerMedia::getCookieStore()->removeCookiesByDomain(".twitter.com"); +} + +//////////////////////// +//LLFloaterTwitter/////// +//////////////////////// + +LLFloaterTwitter::LLFloaterTwitter(const LLSD& key) : LLFloater(key), + mSocialPhotoPanel(NULL), + mStatusErrorText(NULL), + mStatusLoadingText(NULL), + mStatusLoadingIndicator(NULL) +{ + mCommitCallbackRegistrar.add("SocialSharing.Cancel", boost::bind(&LLFloaterTwitter::onCancel, this)); +} + +void LLFloaterTwitter::onCancel() +{ + closeFloater(); +} + +BOOL LLFloaterTwitter::postBuild() +{ + // Keep tab of the Photo Panel + mSocialPhotoPanel = static_cast(getChild("panel_twitter_photo")); + // Connection status widgets + mStatusErrorText = getChild("connection_error_text"); + mStatusLoadingText = getChild("connection_loading_text"); + mStatusLoadingIndicator = getChild("connection_loading_indicator"); + return LLFloater::postBuild(); +} + +// static +void LLFloaterTwitter::preUpdate() +{ + LLFloaterTwitter* instance = LLFloaterReg::findTypedInstance("twitter"); + if (instance) + { + //Will set file size text to 'unknown' + instance->mSocialPhotoPanel->updateControls(); + } +} + +// static +void LLFloaterTwitter::postUpdate() +{ + LLFloaterTwitter* instance = LLFloaterReg::findTypedInstance("twitter"); + if (instance) + { + //Will set the file size text + instance->mSocialPhotoPanel->updateControls(); + + // The refresh button is initially hidden. We show it after the first update, + // i.e. after snapshot is taken + LLUICtrl * refresh_button = instance->mSocialPhotoPanel->getRefreshBtn(); + + if (!refresh_button->getVisible()) + { + refresh_button->setVisible(true); + } + + } +} + +void LLFloaterTwitter::draw() +{ + if (mStatusErrorText && mStatusLoadingText && mStatusLoadingIndicator) + { + mStatusErrorText->setVisible(false); + mStatusLoadingText->setVisible(false); + mStatusLoadingIndicator->setVisible(false); + LLTwitterConnect::EConnectionState connection_state = LLTwitterConnect::instance().getConnectionState(); + std::string status_text; + + switch (connection_state) + { + case LLTwitterConnect::TWITTER_NOT_CONNECTED: + // No status displayed when first opening the panel and no connection done + case LLTwitterConnect::TWITTER_CONNECTED: + // When successfully connected, no message is displayed + case LLTwitterConnect::TWITTER_POSTED: + // No success message to show since we actually close the floater after successful posting completion + break; + case LLTwitterConnect::TWITTER_CONNECTION_IN_PROGRESS: + // Connection loading indicator + mStatusLoadingText->setVisible(true); + status_text = LLTrans::getString("SocialTwitterConnecting"); + mStatusLoadingText->setValue(status_text); + mStatusLoadingIndicator->setVisible(true); + break; + case LLTwitterConnect::TWITTER_POSTING: + // Posting indicator + mStatusLoadingText->setVisible(true); + status_text = LLTrans::getString("SocialTwitterPosting"); + mStatusLoadingText->setValue(status_text); + mStatusLoadingIndicator->setVisible(true); + break; + case LLTwitterConnect::TWITTER_CONNECTION_FAILED: + // Error connecting to the service + mStatusErrorText->setVisible(true); + status_text = LLTrans::getString("SocialTwitterErrorConnecting"); + mStatusErrorText->setValue(status_text); + break; + case LLTwitterConnect::TWITTER_POST_FAILED: + // Error posting to the service + mStatusErrorText->setVisible(true); + status_text = LLTrans::getString("SocialTwitterErrorPosting"); + mStatusErrorText->setValue(status_text); + break; + case LLTwitterConnect::TWITTER_DISCONNECTING: + // Disconnecting loading indicator + mStatusLoadingText->setVisible(true); + status_text = LLTrans::getString("SocialTwitterDisconnecting"); + mStatusLoadingText->setValue(status_text); + mStatusLoadingIndicator->setVisible(true); + break; + case LLTwitterConnect::TWITTER_DISCONNECT_FAILED: + // Error disconnecting from the service + mStatusErrorText->setVisible(true); + status_text = LLTrans::getString("SocialTwitterErrorDisconnecting"); + mStatusErrorText->setValue(status_text); + break; + } + } + LLFloater::draw(); +} + diff --git a/indra/newview/llfloatertwitter.h b/indra/newview/llfloatertwitter.h new file mode 100644 index 0000000000..d0c7b57eef --- /dev/null +++ b/indra/newview/llfloatertwitter.h @@ -0,0 +1,122 @@ +/** +* @file llfloatertwitter.h +* @brief Header file for llfloatertwitter +* @author cho@lindenlab.com +* +* $LicenseInfo:firstyear=2013&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2013, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ +#ifndef LL_LLFLOATERTWITTER_H +#define LL_LLFLOATERTWITTER_H + +#include "llfloater.h" +#include "lltextbox.h" +#include "llviewertexture.h" + +class LLIconCtrl; +class LLCheckBoxCtrl; +class LLSnapshotLivePreview; + +class LLTwitterPhotoPanel : public LLPanel +{ +public: + LLTwitterPhotoPanel(); + ~LLTwitterPhotoPanel(); + + BOOL postBuild(); + void draw(); + + LLSnapshotLivePreview* getPreviewView(); + void onVisibilityChange(const LLSD& new_visibility); + void onClickNewSnapshot(); + void onSend(); + bool onTwitterConnectStateChange(const LLSD& data); + + void sendPhoto(); + void clearAndClose(); + + void updateControls(); + void updateResolution(BOOL do_update); + void checkAspectRatio(S32 index); + LLUICtrl* getRefreshBtn(); + +private: + LLHandle mPreviewHandle; + + LLUICtrl * mSnapshotPanel; + LLUICtrl * mResolutionComboBox; + LLUICtrl * mRefreshBtn; + LLUICtrl * mWorkingLabel; + LLUICtrl * mThumbnailPlaceholder; + LLUICtrl * mCaptionTextBox; + LLUICtrl * mLocationCheckbox; + LLUICtrl * mPostButton; + LLUICtrl* mCancelButton; +}; + +class LLTwitterAccountPanel : public LLPanel +{ +public: + LLTwitterAccountPanel(); + BOOL postBuild(); + void draw(); + +private: + void onVisibilityChange(const LLSD& new_visibility); + bool onTwitterConnectStateChange(const LLSD& data); + bool onTwitterConnectInfoChange(); + void onConnect(); + void onUseAnotherAccount(); + void onDisconnect(); + + void showConnectButton(); + void hideConnectButton(); + void showDisconnectedLayout(); + void showConnectedLayout(); + + LLTextBox * mAccountCaptionLabel; + LLTextBox * mAccountNameLabel; + LLUICtrl * mPanelButtons; + LLUICtrl * mConnectButton; + LLUICtrl * mDisconnectButton; +}; + + +class LLFloaterTwitter : public LLFloater +{ +public: + LLFloaterTwitter(const LLSD& key); + BOOL postBuild(); + void draw(); + void onCancel(); + + static void preUpdate(); + static void postUpdate(); + +private: + LLTwitterPhotoPanel* mSocialPhotoPanel; + LLTextBox* mStatusErrorText; + LLTextBox* mStatusLoadingText; + LLUICtrl* mStatusLoadingIndicator; +}; + +#endif // LL_LLFLOATERTWITTER_H + diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp index afd9942e77..67952f83c7 100644 --- a/indra/newview/llsnapshotlivepreview.cpp +++ b/indra/newview/llsnapshotlivepreview.cpp @@ -36,6 +36,7 @@ #include "llfloaterreg.h" #include "llfloatersocial.h" #include "llfloaterflickr.h" +#include "llfloatertwitter.h" #include "llimagebmp.h" #include "llimagej2c.h" #include "llimagejpeg.h" @@ -211,6 +212,7 @@ void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail LLFloaterSnapshot::preUpdate(); LLFloaterSocial::preUpdate(); LLFloaterFlickr::preUpdate(); + LLFloaterTwitter::preUpdate(); } // Update thumbnail if requested. @@ -769,6 +771,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) LLFloaterSnapshot::postUpdate(); LLFloaterSocial::postUpdate(); LLFloaterFlickr::postUpdate(); + LLFloaterTwitter::postUpdate(); return TRUE; } diff --git a/indra/newview/lltwitterconnect.cpp b/indra/newview/lltwitterconnect.cpp index 80142e7073..5abd654d0c 100644 --- a/indra/newview/lltwitterconnect.cpp +++ b/indra/newview/lltwitterconnect.cpp @@ -296,7 +296,8 @@ std::string LLTwitterConnect::getTwitterConnectURL(const std::string& route, boo LLViewerRegion *regionp = gAgent.getRegion(); if (regionp) { - url = regionp->getCapability("TwitterConnect"); + url = "http://pdp15.lindenlab.com/twitter/agent/" + gAgentID.asString(); // TEMPORARY FOR TESTING - CHO + //url = regionp->getCapability("TwitterConnect"); url += route; if (include_read_from_master && mReadFromMaster) diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 0541da95fc..e74e6fef3d 100755 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -116,6 +116,7 @@ #include "llfloatertopobjects.h" #include "llfloatertoybox.h" #include "llfloatertranslationsettings.h" +#include "llfloatertwitter.h" #include "llfloateruipreview.h" #include "llfloatervoiceeffect.h" #include "llfloatervoicevolume.h" @@ -307,6 +308,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("sound_devices", "floater_sound_devices.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("social", "floater_social.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("flickr", "floater_flickr.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("twitter", "floater_twitter.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("stats", "floater_stats.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("start_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("stop_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/skins/default/xui/en/floater_twitter.xml b/indra/newview/skins/default/xui/en/floater_twitter.xml new file mode 100644 index 0000000000..7007a14cdb --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_twitter.xml @@ -0,0 +1,89 @@ + + + + + + + + + + Error + + + + Loading... + + + + diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index bbd6e94579..79adb4e8bb 100755 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -282,14 +282,21 @@ + name="Facebook"> + + + + name="Flickr"> diff --git a/indra/newview/skins/default/xui/en/panel_twitter_account.xml b/indra/newview/skins/default/xui/en/panel_twitter_account.xml new file mode 100644 index 0000000000..4a413bd711 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_twitter_account.xml @@ -0,0 +1,75 @@ + + + + + Not connected to Twitter. + + + + + + + + [http://community.secondlife.com/t5/English-Knowledge-Base/Second-Life-Share/ta-p/2149711 Learn about posting to Twitter] + + + diff --git a/indra/newview/skins/default/xui/en/panel_twitter_photo.xml b/indra/newview/skins/default/xui/en/panel_twitter_photo.xml new file mode 100644 index 0000000000..058c65402a --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_twitter_photo.xml @@ -0,0 +1,152 @@ + + + + + + + + + + + [SIZE] KB + + + + + + Refreshing... + + + Comment (optional): + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index ce09faeac0..2b707ed84b 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -148,7 +148,7 @@ Please try logging in again in a minute. You were sent to an invalid region. Testing viewer disconnect - + Connecting to Facebook... Posting... Disconnecting from Facebook... @@ -161,6 +161,12 @@ Please try logging in again in a minute. Problem connecting to Flickr Problem posting to Flickr Problem disconnecting from Flickr + Connecting to Twitter... + Posting... + Disconnecting from Twitter... + Problem connecting to Twitter + Problem posting to Twitter + Problem disconnecting from Twitter Person -- cgit v1.2.3 From 181a7d22964b7cfbdd108493560ea60064a65f86 Mon Sep 17 00:00:00 2001 From: Cho Date: Wed, 6 Nov 2013 01:38:49 +0000 Subject: fixed backwards-compatibility with FBC SLURL for ACME-1154 --- indra/newview/llfacebookconnect.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index 99fcab3dc3..b0111f63fa 100644 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -76,7 +76,7 @@ public: bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web) { - if (tokens.size() >= 2) + if (tokens.size() >= 1) { if (tokens[0].asString() == "connect") { @@ -87,16 +87,7 @@ public: fbc_web->closeFloater(); } - if (tokens[1].asString() == "facebook") - { - // connect to facebook - if (query_map.has("code")) - { - LLFacebookConnect::instance().connectToFacebook(query_map["code"], query_map.get("state")); - } - return true; - } - else if (tokens[1].asString() == "flickr") + if (tokens.size() >= 2 && tokens[1].asString() == "flickr") { // connect to flickr if (query_map.has("oauth_token")) @@ -105,7 +96,7 @@ public: } return true; } - else if (tokens[1].asString() == "twitter") + else if (tokens.size() >= 2 && tokens[1].asString() == "twitter") { // connect to twitter if (query_map.has("oauth_token")) @@ -114,6 +105,15 @@ public: } return true; } + else //if (tokens.size() >= 2 && tokens[1].asString() == "facebook") + { + // connect to facebook + if (query_map.has("code")) + { + LLFacebookConnect::instance().connectToFacebook(query_map["code"], query_map.get("state")); + } + return true; + } } } return false; -- cgit v1.2.3 From 1a1826a4f7110dc2b7859f6ce871ab0ac957525f Mon Sep 17 00:00:00 2001 From: Cho Date: Wed, 6 Nov 2013 02:06:53 +0000 Subject: separated web floaters for Facebook, Flickr, and Twitter to fix ACME-1151 --- indra/newview/llfacebookconnect.cpp | 28 +++++++++++++++++++++------- indra/newview/llflickrconnect.cpp | 6 +++--- indra/newview/llfloaterwebcontent.cpp | 11 ++++++++++- indra/newview/lltwitterconnect.cpp | 6 +++--- indra/newview/llviewerfloaterreg.cpp | 4 +++- 5 files changed, 40 insertions(+), 15 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index b0111f63fa..bf517fbc9e 100644 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -80,15 +80,15 @@ public: { if (tokens[0].asString() == "connect") { - // this command probably came from the fbc_web browser, so close it - LLFloater* fbc_web = LLFloaterReg::getInstance("fbc_web"); - if (fbc_web) - { - fbc_web->closeFloater(); - } - if (tokens.size() >= 2 && tokens[1].asString() == "flickr") { + // this command probably came from the flickr_web browser, so close it + LLFloater* flickr_web = LLFloaterReg::getInstance("flickr_web"); + if (flickr_web) + { + flickr_web->closeFloater(); + } + // connect to flickr if (query_map.has("oauth_token")) { @@ -98,6 +98,13 @@ public: } else if (tokens.size() >= 2 && tokens[1].asString() == "twitter") { + // this command probably came from the twitter_web browser, so close it + LLFloater* twitter_web = LLFloaterReg::getInstance("twitter_web"); + if (twitter_web) + { + twitter_web->closeFloater(); + } + // connect to twitter if (query_map.has("oauth_token")) { @@ -107,6 +114,13 @@ public: } else //if (tokens.size() >= 2 && tokens[1].asString() == "facebook") { + // this command probably came from the fbc_web browser, so close it + LLFloater* fbc_web = LLFloaterReg::getInstance("fbc_web"); + if (fbc_web) + { + fbc_web->closeFloater(); + } + // connect to facebook if (query_map.has("code")) { diff --git a/indra/newview/llflickrconnect.cpp b/indra/newview/llflickrconnect.cpp index 62c8110ea7..3da3ef22b2 100644 --- a/indra/newview/llflickrconnect.cpp +++ b/indra/newview/llflickrconnect.cpp @@ -280,11 +280,11 @@ void LLFlickrConnect::openFlickrWeb(std::string url) p.url(url).allow_address_entry(false); p.url(url).allow_back_forward_navigation(false); p.url(url).trusted_content(true); - LLFloater *floater = LLFloaterReg::showInstance("fbc_web", p); + LLFloater *floater = LLFloaterReg::showInstance("flickr_web", p); //the internal web browser has a bug that prevents it from gaining focus unless a mouse event occurs first (it seems). - //So when showing the internal web browser, set focus to it's containing floater "fbc_web". When a mouse event + //So when showing the internal web browser, set focus to it's containing floater "flickr_web". When a mouse event //occurs on the "webbrowser" panel part of the floater, a mouse cursor will properly show and the "webbrowser" will gain focus. - //fbc_web floater contains the "webbrowser" panel. JIRA: ACME-744 + //flickr_web floater contains the "webbrowser" panel. JIRA: ACME-744 gFocusMgr.setKeyboardFocus( floater ); //LLUrlAction::openURLExternal(url); diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp index 4fa2d4cb20..814c91ef6c 100755 --- a/indra/newview/llfloaterwebcontent.cpp +++ b/indra/newview/llfloaterwebcontent.cpp @@ -299,16 +299,25 @@ void LLFloaterWebContent::onClose(bool app_quitting) { LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_CONNECTION_FAILED); } + } + // Same with Flickr + LLFloater* flickr_web = LLFloaterReg::getInstance("flickr_web"); + if (flickr_web == this) + { if (!LLFlickrConnect::instance().isConnected()) { LLFlickrConnect::instance().setConnectionState(LLFlickrConnect::FLICKR_CONNECTION_FAILED); } + } + // And Twitter + LLFloater* twitter_web = LLFloaterReg::getInstance("twitter_web"); + if (twitter_web == this) + { if (!LLTwitterConnect::instance().isConnected()) { LLTwitterConnect::instance().setConnectionState(LLTwitterConnect::TWITTER_CONNECTION_FAILED); } } - LLViewerMedia::proxyWindowClosed(mUUID); destroy(); } diff --git a/indra/newview/lltwitterconnect.cpp b/indra/newview/lltwitterconnect.cpp index 5abd654d0c..fe45d3e4d0 100644 --- a/indra/newview/lltwitterconnect.cpp +++ b/indra/newview/lltwitterconnect.cpp @@ -280,11 +280,11 @@ void LLTwitterConnect::openTwitterWeb(std::string url) p.url(url).allow_address_entry(false); p.url(url).allow_back_forward_navigation(false); p.url(url).trusted_content(true); - LLFloater *floater = LLFloaterReg::showInstance("fbc_web", p); + LLFloater *floater = LLFloaterReg::showInstance("twitter_web", p); //the internal web browser has a bug that prevents it from gaining focus unless a mouse event occurs first (it seems). - //So when showing the internal web browser, set focus to it's containing floater "fbc_web". When a mouse event + //So when showing the internal web browser, set focus to it's containing floater "twitter_web". When a mouse event //occurs on the "webbrowser" panel part of the floater, a mouse cursor will properly show and the "webbrowser" will gain focus. - //fbc_web floater contains the "webbrowser" panel. JIRA: ACME-744 + //twitter_web floater contains the "webbrowser" panel. JIRA: ACME-744 gFocusMgr.setKeyboardFocus( floater ); //LLUrlAction::openURLExternal(url); diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index e74e6fef3d..1e07aaf5ec 100755 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -316,8 +316,10 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("search", "floater_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("my_profile", "floater_my_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebProfile::create); LLFloaterReg::add("profile", "floater_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebProfile::create); - LLFloaterReg::add("how_to", "floater_how_to.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); + LLFloaterReg::add("how_to", "floater_how_to.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); LLFloaterReg::add("fbc_web", "floater_fbc_web.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); + LLFloaterReg::add("flickr_web", "floater_fbc_web.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); + LLFloaterReg::add("twitter_web", "floater_fbc_web.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); LLFloaterUIPreviewUtil::registerFloater(); LLFloaterReg::add("upload_anim_bvh", "floater_animation_bvh_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); -- cgit v1.2.3 From 5301bd38deee7e2c443b4cfba19f9c595747c20a Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Thu, 7 Nov 2013 00:23:24 +0000 Subject: STORM-1831 Increasing source text buffer to 256 KB (As discussed in Server/Scripting and Open Source User Groups). This change also addresses/closes: VWR-22401 --- indra/newview/skins/default/xui/en/panel_script_ed.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/panel_script_ed.xml b/indra/newview/skins/default/xui/en/panel_script_ed.xml index bcdef96138..d1b35dce9d 100755 --- a/indra/newview/skins/default/xui/en/panel_script_ed.xml +++ b/indra/newview/skins/default/xui/en/panel_script_ed.xml @@ -157,7 +157,7 @@ height="376" ignore_tab="false" layout="topleft" - max_length="65536" + max_length="262144" name="Script Editor" text_readonly_color="DkGray" width="487" -- cgit v1.2.3 From 9ec7c9e8afaadbe91d888e588ebfcf7cba44dfdc Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Thu, 7 Nov 2013 00:24:51 +0000 Subject: STORM-1831 Adding "LSLSyntax" to list of capabilities the region keeps track of. --- indra/newview/llviewerregion.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 678f24fb3c..854f05f116 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1614,6 +1614,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("GroupProposalBallot"); capabilityNames.append("HomeLocation"); capabilityNames.append("LandResources"); + capabilityNames.append("LSLSyntax"); capabilityNames.append("MapLayer"); capabilityNames.append("MapLayerGod"); capabilityNames.append("MeshUploadFlag"); -- cgit v1.2.3 From be23aaefe53cd245752d3973bf930c87f67c6253 Mon Sep 17 00:00:00 2001 From: Cho Date: Thu, 7 Nov 2013 01:30:36 +0000 Subject: added title, descriptions, tags, and safety level to panel_flickr_photo.xml for ACME-1142 --- indra/newview/llfloaterflickr.cpp | 40 ++++++--- indra/newview/llfloaterflickr.h | 5 +- .../skins/default/xui/en/floater_flickr.xml | 6 +- .../skins/default/xui/en/panel_flickr_account.xml | 2 +- .../skins/default/xui/en/panel_flickr_photo.xml | 98 ++++++++++++++++++++-- .../skins/default/xui/en/panel_twitter_photo.xml | 2 +- 6 files changed, 126 insertions(+), 27 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterflickr.cpp b/indra/newview/llfloaterflickr.cpp index 290d174619..1edc61fcf6 100644 --- a/indra/newview/llfloaterflickr.cpp +++ b/indra/newview/llfloaterflickr.cpp @@ -63,8 +63,11 @@ mResolutionComboBox(NULL), mRefreshBtn(NULL), mWorkingLabel(NULL), mThumbnailPlaceholder(NULL), -mCaptionTextBox(NULL), +mTitleTextBox(NULL), +mDescriptionTextBox(NULL), mLocationCheckbox(NULL), +mTagsTextBox(NULL), +mRatingComboBox(NULL), mPostButton(NULL) { mCommitCallbackRegistrar.add("SocialSharing.SendPhoto", boost::bind(&LLFlickrPhotoPanel::onSend, this)); @@ -89,8 +92,11 @@ BOOL LLFlickrPhotoPanel::postBuild() mRefreshBtn = getChild("new_snapshot_btn"); mWorkingLabel = getChild("working_lbl"); mThumbnailPlaceholder = getChild("thumbnail_placeholder"); - mCaptionTextBox = getChild("photo_caption"); + mTitleTextBox = getChild("photo_title"); + mDescriptionTextBox = getChild("photo_description"); mLocationCheckbox = getChild("add_location_cb"); + mTagsTextBox = getChild("photo_tags"); + mRatingComboBox = getChild("rating_combobox"); mPostButton = getChild("post_photo_btn"); mCancelButton = getChild("cancel_photo_btn"); @@ -104,7 +110,10 @@ void LLFlickrPhotoPanel::draw() // Enable interaction only if no transaction with the service is on-going (prevent duplicated posts) bool no_ongoing_connection = !(LLFlickrConnect::instance().isTransactionOngoing()); mCancelButton->setEnabled(no_ongoing_connection); - mCaptionTextBox->setEnabled(no_ongoing_connection); + mTitleTextBox->setEnabled(no_ongoing_connection); + mDescriptionTextBox->setEnabled(no_ongoing_connection); + mTagsTextBox->setEnabled(no_ongoing_connection); + mRatingComboBox->setEnabled(no_ongoing_connection); mResolutionComboBox->setEnabled(no_ongoing_connection); mRefreshBtn->setEnabled(no_ongoing_connection); mLocationCheckbox->setEnabled(no_ongoing_connection); @@ -144,7 +153,7 @@ void LLFlickrPhotoPanel::draw() mWorkingLabel->setVisible(!(previewp && previewp->getSnapshotUpToDate())); // Enable Post if we have a preview to send and no on going connection being processed - mPostButton->setEnabled(no_ongoing_connection && (previewp && previewp->getSnapshotUpToDate())); + mPostButton->setEnabled(no_ongoing_connection && (previewp && previewp->getSnapshotUpToDate()) && (mRatingComboBox && mRatingComboBox->getValue().isDefined())); // Draw the rest of the panel on top of it LLPanel::draw(); @@ -234,8 +243,10 @@ bool LLFlickrPhotoPanel::onFlickrConnectStateChange(const LLSD& data) void LLFlickrPhotoPanel::sendPhoto() { - // Get the caption - std::string caption = mCaptionTextBox->getValue().asString(); + // Get the title, description, and tags + std::string title = mTitleTextBox->getValue().asString(); + std::string description = mDescriptionTextBox->getValue().asString(); + std::string tags = mTagsTextBox->getValue().asString(); // Add the location if required bool add_location = mLocationCheckbox->getValue().asBoolean(); @@ -249,25 +260,30 @@ void LLFlickrPhotoPanel::sendPhoto() // Add query parameters so Google Analytics can track incoming clicks! slurl_string += DEFAULT_PHOTO_QUERY_PARAMETERS; - // Add it to the caption (pretty crude, but we don't have a better option with photos) - if (caption.empty()) - caption = slurl_string; + // Add it to the description (pretty crude, but we don't have a better option with photos) + if (description.empty()) + description = slurl_string; else - caption = caption + " " + slurl_string; + description = description + " " + slurl_string; } + // Get the content rating + int content_rating = mRatingComboBox->getValue().asInteger(); + // Get the image LLSnapshotLivePreview* previewp = getPreviewView(); // Post to Flickr - LLFlickrConnect::instance().uploadPhoto(previewp->getFormattedImage(), "", caption, "", 1); + LLFlickrConnect::instance().uploadPhoto(previewp->getFormattedImage(), title, description, tags, content_rating); updateControls(); } void LLFlickrPhotoPanel::clearAndClose() { - mCaptionTextBox->setValue(""); + mTitleTextBox->setValue(""); + mDescriptionTextBox->setValue(""); + mTagsTextBox->setValue(""); LLFloater* floater = getParentByType(); if (floater) diff --git a/indra/newview/llfloaterflickr.h b/indra/newview/llfloaterflickr.h index d98a470d5c..8cf2cd2dd6 100644 --- a/indra/newview/llfloaterflickr.h +++ b/indra/newview/llfloaterflickr.h @@ -66,8 +66,11 @@ private: LLUICtrl * mRefreshBtn; LLUICtrl * mWorkingLabel; LLUICtrl * mThumbnailPlaceholder; - LLUICtrl * mCaptionTextBox; + LLUICtrl * mTitleTextBox; + LLUICtrl * mDescriptionTextBox; LLUICtrl * mLocationCheckbox; + LLUICtrl * mTagsTextBox; + LLUICtrl * mRatingComboBox; LLUICtrl * mPostButton; LLUICtrl* mCancelButton; }; diff --git a/indra/newview/skins/default/xui/en/floater_flickr.xml b/indra/newview/skins/default/xui/en/floater_flickr.xml index 441e3ee73d..57014f8427 100644 --- a/indra/newview/skins/default/xui/en/floater_flickr.xml +++ b/indra/newview/skins/default/xui/en/floater_flickr.xml @@ -10,10 +10,10 @@ single_instance="true" reuse_instance="true" title="UPLOAD TO FLICKR" - height="482" + height="622" width="304"> diff --git a/indra/newview/skins/default/xui/en/panel_flickr_photo.xml b/indra/newview/skins/default/xui/en/panel_flickr_photo.xml index 1fc4927ac2..d7d3fb6c1b 100644 --- a/indra/newview/skins/default/xui/en/panel_flickr_photo.xml +++ b/indra/newview/skins/default/xui/en/panel_flickr_photo.xml @@ -1,19 +1,19 @@ + height="507"> - Comment (optional): + Title: + + + Description: + + + + Tags: + + +Separate tags with spaces +Use "" for multi-word tags + + + + + + + + Date: Thu, 7 Nov 2013 18:12:45 +0000 Subject: storm-1831 General cleanup of cruft created during caps experiments ;-) --- indra/newview/llsyntaxid.cpp | 191 ++++++++++++++++++++++++++----------------- indra/newview/llsyntaxid.h | 31 +++++-- 2 files changed, 142 insertions(+), 80 deletions(-) (limited to 'indra') diff --git a/indra/newview/llsyntaxid.cpp b/indra/newview/llsyntaxid.cpp index 442793bff1..7d0c7e376a 100644 --- a/indra/newview/llsyntaxid.cpp +++ b/indra/newview/llsyntaxid.cpp @@ -31,53 +31,54 @@ #include "llhttpclient.h" #include "llagent.h" #include "llappviewer.h" -#include "llcurl.h" -#include "llenvmanager.h" #include "llsdserialize.h" #include "llsyntaxid.h" + //----------------------------------------------------------------------------- // fetchKeywordsFileResponder //----------------------------------------------------------------------------- -class fetchKeywordsFileResponder : public LLCurl::Responder +fetchKeywordsFileResponder::fetchKeywordsFileResponder(std::string filespec) { -public: - std::string mFileSpec; + mFileSpec = filespec; + LL_WARNS("") + << "Instantiating with file saving to: '" << filespec << "'" + << LL_ENDL; +} - fetchKeywordsFileResponder(std::string filespec) - { - mFileSpec = filespec; - } - void errorWithContent(U32 status, +void fetchKeywordsFileResponder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) - { - LL_WARNS("") - << "fetchKeywordsFileResponder error [status:" - << status - << "]: " - << content - << LL_ENDL; - } +{ + LL_WARNS("") + << "fetchKeywordsFileResponder error [status:" + << status + << "]: " + << content + << LL_ENDL; +} - void result(const LLSD& content_ref) - { - //LLSyntaxIdLSL::setKeywordsXml(content_ref); +void fetchKeywordsFileResponder::result(const LLSD& content_ref) +{ + LLSyntaxIdLSL::setKeywordsXml(content_ref); - std::stringstream str; - LLSDSerialize::toPrettyXML(content_ref, str); - LL_WARNS("") - << "fetchKeywordsFileResponder result:" << str.str() - << "filename: '" << mFileSpec << "'" - << LL_ENDL; + std::stringstream str; + LLSDSerialize::toPrettyXML(content_ref, str); + const std::string xml = str.str(); - // TODO save the damn str to disc - //llofstream file(mFileSpec, std::ios_base::out); - //file.write(str.str(), str.str().size()); - //file.close(); - } -}; + // save the str to disc + llofstream file(mFileSpec, std::ios_base::out); + file.write(xml.c_str(), str.str().size()); + file.close(); + + LL_WARNS("") + << "Syntax file received, saving as: '" << mFileSpec << "'" + << LL_ENDL; +} + + +LLSD LLSyntaxIdLSL::sKeywordsXml; //----------------------------------------------------------------------------- // LLSyntaxIdLSL @@ -90,16 +91,34 @@ LLSyntaxIdLSL::LLSyntaxIdLSL() : mFileNameDefault("keywords_lsl_default.xml"), mSimulatorFeature("LSLSyntaxId"), mCapabilityName("LSLSyntax"), + mCapabilityURL(""), mFilePath(LL_PATH_APP_SETTINGS) { - mCurrentSyntaxId = LLUUID(); + mSyntaxIdCurrent = LLUUID(); mFileNameCurrent = mFileNameDefault; } -std::string LLSyntaxIdLSL::buildFileName(LLUUID& SyntaxId) +std::string LLSyntaxIdLSL::buildFileNameNew() { - std::string filename = "keywords_lsl_" + SyntaxId.asString() + "_" + gLastVersionChannel + ".llsd.xml"; - return filename; + std::string filename = "keywords_lsl_"; + if (!mSyntaxIdNew.isNull()) + { + filename += gLastVersionChannel + "_" + mSyntaxIdNew.asString(); + } + else + { + filename += mFileNameDefault; + } + mFileNameNew = filename + ".llsd.xml"; + return mFileNameNew; +} + +std::string LLSyntaxIdLSL::buildFullFileSpec() +{ + ELLPath path = mSyntaxIdNew.isNull() ? LL_PATH_APP_SETTINGS : LL_PATH_CACHE; + buildFileNameNew(); + mFullFileSpec = gDirUtilp->getExpandedFilename(path, mFileNameNew); + return mFullFileSpec; } //----------------------------------------------------------------------------- @@ -112,15 +131,9 @@ bool LLSyntaxIdLSL::checkSyntaxIdChanged() if (region) { - /* - LL_WARNS("LSLSyntax") - << "REGION is '" << region->getName() << "'" - << LL_ENDL; - */ - if (!region->capabilitiesReceived()) { // Shouldn't be possible, but experience shows that it's needed -// region->setCapabilitiesReceivedCallback(boost::bind(&LLSyntaxIdLSL::checkSyntaxIdChange, this)); + //region->setCapabilitiesReceivedCallback(boost::bind(&LLSyntaxIdLSL::checkSyntaxIdChange, this)); LL_WARNS("LSLSyntax") << "region '" << region->getName() << "' has not received capabilities yet! Setting a callback for when they arrive." @@ -133,18 +146,18 @@ bool LLSyntaxIdLSL::checkSyntaxIdChanged() region->getSimulatorFeatures(simFeatures); if (simFeatures.has("LSLSyntaxId")) { - LLUUID SyntaxId = simFeatures["LSLSyntaxId"].asUUID(); - if (mCurrentSyntaxId != SyntaxId) + mSyntaxIdNew = simFeatures["LSLSyntaxId"].asUUID(); + mCapabilityURL = region->getCapability(mCapabilityName); + if (mSyntaxIdCurrent != mSyntaxIdNew) { // set the properties for the fetcher to use - mFileNameCurrent = buildFileName(SyntaxId); - mFilePath = LL_PATH_CACHE; - mCurrentSyntaxId = SyntaxId; + //mFileNameNew = buildFileNameNew(mSyntaxIdNew); + //mFilePath = LL_PATH_CACHE; LL_WARNS("LSLSyntax") << "Region changed to '" << region->getName() << "' it has LSLSyntaxId capability, and the new hash is '" - << SyntaxId << "'" + << mSyntaxIdNew << "'" << LL_ENDL; changed = true; @@ -154,14 +167,14 @@ bool LLSyntaxIdLSL::checkSyntaxIdChanged() LL_WARNS("LSLSyntax") << "Region changed to '" << region->getName() << "' it has the same LSLSyntaxId! Leaving hash as '" - << mCurrentSyntaxId << "'" + << mSyntaxIdCurrent << "'" << LL_ENDL; } } else { // Set the hash to NULL_KEY to indicate use of default keywords file - if ( mCurrentSyntaxId.isNull() ) + if ( mSyntaxIdCurrent.isNull() ) { LL_WARNS("LSLSyntax") << "Region changed to '" << region->getName() @@ -170,9 +183,9 @@ bool LLSyntaxIdLSL::checkSyntaxIdChanged() } else { - mCurrentSyntaxId = LLUUID(); - mFileNameCurrent = mFileNameDefault; - mFilePath = LL_PATH_APP_SETTINGS; + mSyntaxIdNew = LLUUID(); + //mFileNameNew = mFileNameDefault; + //mFilePath = LL_PATH_APP_SETTINGS; LL_WARNS("LSLSyntax") << "Region changed to '" << region->getName() @@ -190,18 +203,27 @@ bool LLSyntaxIdLSL::checkSyntaxIdChanged() //----------------------------------------------------------------------------- // fetchKeywordsFile //----------------------------------------------------------------------------- -bool LLSyntaxIdLSL::fetchKeywordsFile() +void LLSyntaxIdLSL::fetchKeywordsFile() { - LLViewerRegion* region = gAgent.getRegion(); - bool fetched = false; - - std::string cap_url = region->getCapability(mCapabilityName); - if ( !cap_url.empty() ) + if ( !mCapabilityURL.empty() ) { - LLHTTPClient::get(cap_url, new fetchKeywordsFileResponder(mFullFileSpec)); + //buildFullFileSpec(); + LLHTTPClient::get(mCapabilityURL, + new fetchKeywordsFileResponder(mFullFileSpec), + LLSD(), 30.f + ); + LL_WARNS("LSLSyntax") + << "LSLSyntaxId capability URL is: " << mCapabilityURL + << ". Filename to use is: '" << mFullFileSpec << "'." + << LL_ENDL; + } + else + { + LL_WARNS("LSLSyntax") + << "LSLSyntaxId capability URL is empty using capability: '" + << mCapabilityName << "'" + << LL_ENDL; } - - return fetched; } void LLSyntaxIdLSL::initialise() @@ -212,24 +234,42 @@ void LLSyntaxIdLSL::initialise() << "Change to syntax, setting up new file." << LL_ENDL; - setFileNameNew(gDirUtilp->getExpandedFilename( - mFilePath, - mFileNameCurrent - )); - if ( !mCurrentSyntaxId.isNull() ) + // Need a full spec built regardless of file source + buildFullFileSpec(); + if ( !mSyntaxIdNew.isNull() ) { - bool success = false; + LL_WARNS("LSLSyntax") + << "ID is not null so must be processed!" + << LL_ENDL; + if ( !gDirUtilp->fileExists(mFullFileSpec) ) { // Does not exist, so fetch it from the capability - success = fetchKeywordsFile(); + fetchKeywordsFile(); + LL_WARNS("LSLSyntax") + << "Filename is not cached, we will try to download it!" + << LL_ENDL; + } + else + { + LL_WARNS("LSLSyntax") + << "Filename is cached, no need to download!" + << LL_ENDL; + openKeywordsFile(); } } + else + { // Need to open the default + LL_WARNS("LSLSyntax") + << "ID is null so SyntaxID does not need to be processed!" + << LL_ENDL; + openKeywordsFile(); + } // TODO add a signal here to tell the editor the hash has changed? } else { LL_WARNS("LSLSyntax") - << "Apparently there is no change to Syntax!" + << "No change to Syntax! Nothing to see here. Move along now!" << LL_ENDL; } @@ -239,7 +279,10 @@ void LLSyntaxIdLSL::initialise() //----------------------------------------------------------------------------- // openKeywordsFile //----------------------------------------------------------------------------- -void openKeywordsFile() +void LLSyntaxIdLSL::openKeywordsFile() { - ; + LL_WARNS("LSLSyntax") + << "Trying to open default or cached keyword file ;-)" + << LL_ENDL; + // TODO Open the file and load LLSD into sKeywordsXml } diff --git a/indra/newview/llsyntaxid.h b/indra/newview/llsyntaxid.h index f7e3d6896e..d9f2572863 100644 --- a/indra/newview/llsyntaxid.h +++ b/indra/newview/llsyntaxid.h @@ -12,6 +12,21 @@ #include "llviewerregion.h" +class fetchKeywordsFileResponder : public LLHTTPClient::Responder +{ +public: + std::string mFileSpec; + + fetchKeywordsFileResponder(std::string filespec); + + void errorWithContent(U32 status, + const std::string& reason, + const LLSD& content); + + void result(const LLSD& content_ref); +}; + + /** * @file llsyntaxid.h * @brief The LLSyntaxIdLSL class @@ -24,7 +39,7 @@ public: bool checkSyntaxIdChanged(); std::string getFileNameCurrent() const { return mFileNameCurrent; } ELLPath getFilePath() const { return mFilePath; } - LLUUID getSyntaxId() const { return mCurrentSyntaxId; } + LLUUID getSyntaxId() const { return mSyntaxIdCurrent; } void initialise(); @@ -32,13 +47,14 @@ public: protected: - std::string buildFileName(LLUUID& SyntaxId); - bool fetchKeywordsFile(); + std::string buildFileNameNew(); + std::string buildFullFileSpec(); + void fetchKeywordsFile(); void openKeywordsFile(); - void setSyntaxId(LLUUID SyntaxId) { mCurrentSyntaxId = SyntaxId; } + void setSyntaxId(LLUUID SyntaxId) { mSyntaxIdCurrent = SyntaxId; } void setFileNameCurrent(std::string& name) { mFileNameCurrent = name; } void setFileNameDefault(std::string& name) { mFileNameDefault = name; } - void setFileNameNew(std::string& name) { mFileNameNew = name; } + void setFileNameNew(std::string name) { mFileNameNew = name; } void setSimulatorFeatureName(const std::string& name) { mSimulatorFeature = name; } @@ -51,13 +67,16 @@ protected: private: std::string mCapabilityName; - LLUUID mCurrentSyntaxId; + std::string mCapabilityURL; std::string mFileNameCurrent; std::string mFileNameDefault; std::string mFileNameNew; ELLPath mFilePath; std::string mFullFileSpec; std::string mSimulatorFeature; + LLUUID mSyntaxIdCurrent; + LLUUID mSyntaxIdNew; static LLSD sKeywordsXml; + }; -- cgit v1.2.3 From c8b8c29371a0eb4d53537030d0b007afcc500b3d Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Thu, 7 Nov 2013 18:31:05 +0000 Subject: Fixing LL_WARNS without labels and removing some crufty comments missed before --- indra/newview/llsyntaxid.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/newview/llsyntaxid.cpp b/indra/newview/llsyntaxid.cpp index 7d0c7e376a..0249607834 100644 --- a/indra/newview/llsyntaxid.cpp +++ b/indra/newview/llsyntaxid.cpp @@ -41,7 +41,7 @@ fetchKeywordsFileResponder::fetchKeywordsFileResponder(std::string filespec) { mFileSpec = filespec; - LL_WARNS("") + LL_WARNS("LSLSyntax") << "Instantiating with file saving to: '" << filespec << "'" << LL_ENDL; } @@ -51,7 +51,7 @@ void fetchKeywordsFileResponder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - LL_WARNS("") + LL_WARNS("LSLSyntax") << "fetchKeywordsFileResponder error [status:" << status << "]: " @@ -72,7 +72,7 @@ void fetchKeywordsFileResponder::result(const LLSD& content_ref) file.write(xml.c_str(), str.str().size()); file.close(); - LL_WARNS("") + LL_WARNS("LSLSyntax") << "Syntax file received, saving as: '" << mFileSpec << "'" << LL_ENDL; } @@ -150,10 +150,6 @@ bool LLSyntaxIdLSL::checkSyntaxIdChanged() mCapabilityURL = region->getCapability(mCapabilityName); if (mSyntaxIdCurrent != mSyntaxIdNew) { - // set the properties for the fetcher to use - //mFileNameNew = buildFileNameNew(mSyntaxIdNew); - //mFilePath = LL_PATH_CACHE; - LL_WARNS("LSLSyntax") << "Region changed to '" << region->getName() << "' it has LSLSyntaxId capability, and the new hash is '" @@ -184,8 +180,6 @@ bool LLSyntaxIdLSL::checkSyntaxIdChanged() else { mSyntaxIdNew = LLUUID(); - //mFileNameNew = mFileNameDefault; - //mFilePath = LL_PATH_APP_SETTINGS; LL_WARNS("LSLSyntax") << "Region changed to '" << region->getName() -- cgit v1.2.3 From 389ddfd5add78998aaadb171593b5b036d2dbee0 Mon Sep 17 00:00:00 2001 From: Cho Date: Thu, 7 Nov 2013 19:06:39 +0000 Subject: updated panel_twitter_photo.xml to match design spec for ACME-1153 --- indra/newview/llfloatertwitter.cpp | 61 ++++++++----------- indra/newview/llfloatertwitter.h | 4 +- .../skins/default/xui/en/panel_twitter_photo.xml | 70 ++++++++++++---------- 3 files changed, 65 insertions(+), 70 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatertwitter.cpp b/indra/newview/llfloatertwitter.cpp index b45cf32945..5a2402cdd6 100644 --- a/indra/newview/llfloatertwitter.cpp +++ b/indra/newview/llfloatertwitter.cpp @@ -63,8 +63,8 @@ mResolutionComboBox(NULL), mRefreshBtn(NULL), mWorkingLabel(NULL), mThumbnailPlaceholder(NULL), -mCaptionTextBox(NULL), -mLocationCheckbox(NULL), +mStatusTextBox(NULL), +mPhotoCheckbox(NULL), mPostButton(NULL) { mCommitCallbackRegistrar.add("SocialSharing.SendPhoto", boost::bind(&LLTwitterPhotoPanel::onSend, this)); @@ -89,8 +89,8 @@ BOOL LLTwitterPhotoPanel::postBuild() mRefreshBtn = getChild("new_snapshot_btn"); mWorkingLabel = getChild("working_lbl"); mThumbnailPlaceholder = getChild("thumbnail_placeholder"); - mCaptionTextBox = getChild("photo_caption"); - mLocationCheckbox = getChild("add_location_cb"); + mStatusTextBox = getChild("photo_status"); + mPhotoCheckbox = getChild("add_photo_cb"); mPostButton = getChild("post_photo_btn"); mCancelButton = getChild("cancel_photo_btn"); @@ -104,11 +104,11 @@ void LLTwitterPhotoPanel::draw() // Enable interaction only if no transaction with the service is on-going (prevent duplicated posts) bool no_ongoing_connection = !(LLTwitterConnect::instance().isTransactionOngoing()); mCancelButton->setEnabled(no_ongoing_connection); - mCaptionTextBox->setEnabled(no_ongoing_connection); - mResolutionComboBox->setEnabled(no_ongoing_connection); - mRefreshBtn->setEnabled(no_ongoing_connection); - mLocationCheckbox->setEnabled(no_ongoing_connection); - + mStatusTextBox->setEnabled(no_ongoing_connection); + mResolutionComboBox->setEnabled(no_ongoing_connection && mPhotoCheckbox->getValue().asBoolean()); + mRefreshBtn->setEnabled(no_ongoing_connection && mPhotoCheckbox->getValue().asBoolean()); + mPhotoCheckbox->setEnabled(no_ongoing_connection); + // Display the preview if one is available if (previewp && previewp->getThumbnailImage()) { @@ -131,7 +131,7 @@ void LLTwitterPhotoPanel::draw() gGL.matrixMode(LLRender::MM_MODELVIEW); // Apply floater transparency to the texture unless the floater is focused. - F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); + F32 alpha = (mPhotoCheckbox->getValue().asBoolean() ? (getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency()) : 0.5f); LLColor4 color = LLColor4::white; gl_draw_scaled_image(offset_x, offset_y, thumbnail_w, thumbnail_h, @@ -234,40 +234,31 @@ bool LLTwitterPhotoPanel::onTwitterConnectStateChange(const LLSD& data) void LLTwitterPhotoPanel::sendPhoto() { - // Get the caption - std::string caption = mCaptionTextBox->getValue().asString(); + // Get the status text + std::string status = mStatusTextBox->getValue().asString(); - // Add the location if required - bool add_location = mLocationCheckbox->getValue().asBoolean(); - if (add_location) + // Add the photo if required + bool add_photo = mPhotoCheckbox->getValue().asBoolean(); + if (add_photo) { - // Get the SLURL for the location - LLSLURL slurl; - LLAgentUI::buildSLURL(slurl); - std::string slurl_string = slurl.getSLURLString(); - - // Add query parameters so Google Analytics can track incoming clicks! - slurl_string += DEFAULT_PHOTO_QUERY_PARAMETERS; - - // Add it to the caption (pretty crude, but we don't have a better option with photos) - if (caption.empty()) - caption = slurl_string; - else - caption = caption + " " + slurl_string; - } - - // Get the image - LLSnapshotLivePreview* previewp = getPreviewView(); + // Get the image + LLSnapshotLivePreview* previewp = getPreviewView(); - // Post to Twitter - LLTwitterConnect::instance().uploadPhoto(previewp->getFormattedImage(), caption); + // Post to Twitter + LLTwitterConnect::instance().uploadPhoto(previewp->getFormattedImage(), status); + } + else + { + // Just post the status to Twitter + LLTwitterConnect::instance().updateStatus(status); + } updateControls(); } void LLTwitterPhotoPanel::clearAndClose() { - mCaptionTextBox->setValue(""); + mStatusTextBox->setValue(""); LLFloater* floater = getParentByType(); if (floater) diff --git a/indra/newview/llfloatertwitter.h b/indra/newview/llfloatertwitter.h index d0c7b57eef..090e01872a 100644 --- a/indra/newview/llfloatertwitter.h +++ b/indra/newview/llfloatertwitter.h @@ -66,8 +66,8 @@ private: LLUICtrl * mRefreshBtn; LLUICtrl * mWorkingLabel; LLUICtrl * mThumbnailPlaceholder; - LLUICtrl * mCaptionTextBox; - LLUICtrl * mLocationCheckbox; + LLUICtrl * mStatusTextBox; + LLUICtrl * mPhotoCheckbox; LLUICtrl * mPostButton; LLUICtrl* mCancelButton; }; diff --git a/indra/newview/skins/default/xui/en/panel_twitter_photo.xml b/indra/newview/skins/default/xui/en/panel_twitter_photo.xml index 540bc0f807..84206c608b 100644 --- a/indra/newview/skins/default/xui/en/panel_twitter_photo.xml +++ b/indra/newview/skins/default/xui/en/panel_twitter_photo.xml @@ -11,9 +11,43 @@ orientation="vertical" name="stack_photo" top="8"> - + + + What's happening? + + + + + + Refreshing... - - Comment (optional): - - - - Date: Thu, 7 Nov 2013 16:27:38 -0500 Subject: STORM-68 Add initial support to use a capability for setting default object permissions on the server. --- indra/newview/llfloaterperms.cpp | 45 ++++++++++++++++++++-- indra/newview/llfloaterperms.h | 1 + indra/newview/llviewerregion.cpp | 4 ++ .../newview/skins/default/xui/en/notifications.xml | 11 ++++++ 4 files changed, 58 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index 4e9acfc780..c167c03c30 100644 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -32,7 +32,9 @@ #include "llviewerwindow.h" #include "lluictrlfactory.h" #include "llpermissions.h" - +#include "llagent.h" +#include "llviewerregion.h" +#include "llnotificationsutil.h" LLFloaterPerms::LLFloaterPerms(const LLSD& seed) : LLFloater(seed) @@ -96,7 +98,7 @@ U32 LLFloaterPerms::getNextOwnerPermsInverted(std::string prefix) } LLFloaterPermsDefault::LLFloaterPermsDefault(const LLSD& seed) -: LLFloater(seed) + : LLFloater(seed) { mCommitCallbackRegistrar.add("PermsDefault.Copy", boost::bind(&LLFloaterPermsDefault::onCommitCopy, this, _2)); mCommitCallbackRegistrar.add("PermsDefault.OK", boost::bind(&LLFloaterPermsDefault::onClickOK, this)); @@ -145,9 +147,46 @@ void LLFloaterPermsDefault::onCommitCopy(const LLSD& user_data) xfer->setEnabled(copyable); } +class LLFloaterPermsResponder : public LLHTTPClient::Responder +{ +public: + LLFloaterPermsResponder(): LLHTTPClient::Responder() {} + + void error(U32 status, const std::string& reason) + { + LLSD args; + args["REASON"] = reason; + LLNotificationsUtil::add("DefaultObjectPermissions", args); + } + void result(const LLSD& content) + { + LL_INFOS("FloaterPermsResponder") << "Set new values" << LL_ENDL; + } +}; + +void LLFloaterPermsDefault::updateCap() +{ + std::string object_url = gAgent.getRegion()->getCapability("DefaultObjectPermissions"); + + if(!object_url.empty()) + { + LLSD report = LLSD::emptyMap(); + report["Group"] = (LLSD::Integer)LLFloaterPerms::getGroupPerms("Objects"); + report["Everyone"] = (LLSD::Integer)LLFloaterPerms::getEveryonePerms("Objects"); + report["NextOwner"] = (LLSD::Integer)LLFloaterPerms::getNextOwnerPerms("Objects"); + LLHTTPClient::post(object_url, report, new LLFloaterPermsResponder()); + } +} + void LLFloaterPermsDefault::ok() { - refresh(); // Changes were already applied to saved settings. Refreshing internal values makes it official. +// Changes were already applied automatically to saved settings. +// Refreshing internal values makes it official. + refresh(); + +// We know some setting has changed but not which one. Just in case it was a setting for +// object permissions tell the server what the values are. + updateCap(); } void LLFloaterPermsDefault::cancel() diff --git a/indra/newview/llfloaterperms.h b/indra/newview/llfloaterperms.h index bb4a6f9702..5fe39a2c1b 100644 --- a/indra/newview/llfloaterperms.h +++ b/indra/newview/llfloaterperms.h @@ -59,6 +59,7 @@ public: void onClickOK(); void onClickCancel(); void onCommitCopy(const LLSD& user_data); + static void updateCap(); enum Categories { diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index e3cb985ddb..7b5721cb39 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -70,6 +70,7 @@ #include "stringize.h" #include "llviewercontrol.h" #include "llsdserialize.h" +#include "llfloaterperms.h" #ifdef LL_WINDOWS #pragma warning(disable:4355) @@ -1485,6 +1486,8 @@ void LLViewerRegion::unpackRegionHandshake() msg->nextBlock("RegionInfo"); msg->addU32("Flags", 0x0 ); msg->sendReliable(host); + + LLFloaterPermsDefault::updateCap(); } void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) @@ -1494,6 +1497,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("ChatSessionRequest"); capabilityNames.append("CopyInventoryFromNotecard"); capabilityNames.append("CreateInventoryCategory"); + capabilityNames.append("DefaultObjectPermissions"); capabilityNames.append("DispatchRegionInfo"); capabilityNames.append("EstateChangeInfo"); capabilityNames.append("EventQueueGet"); diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index afc5b916e7..a46cce996b 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -7722,5 +7722,16 @@ Disabling future updates for this file. Attempted to add an invalid or unreadable image file [FNAME] which could not be opened or decoded. Attempt cancelled. + + + There was a problem saving the default permissions due to the following reason: [REASON]. Please try setting the default permissions later. + fail + + -- cgit v1.2.3 From 15434d53ea1f1bca37b7b9d6d569b3cb61d09bbe Mon Sep 17 00:00:00 2001 From: Cho Date: Fri, 8 Nov 2013 00:33:14 +0000 Subject: added SLShare links to snapshot floater for ACME-1167 --- indra/newview/llfloatertwitter.cpp | 6 ++-- indra/newview/llpanelsnapshotoptions.cpp | 36 ++++++++++++++++++++++ .../skins/default/xui/en/floater_snapshot.xml | 2 +- .../default/xui/en/panel_snapshot_options.xml | 36 ++++++++++++++++++++++ 4 files changed, 77 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatertwitter.cpp b/indra/newview/llfloatertwitter.cpp index 5a2402cdd6..1324bd5fd8 100644 --- a/indra/newview/llfloatertwitter.cpp +++ b/indra/newview/llfloatertwitter.cpp @@ -109,6 +109,8 @@ void LLTwitterPhotoPanel::draw() mRefreshBtn->setEnabled(no_ongoing_connection && mPhotoCheckbox->getValue().asBoolean()); mPhotoCheckbox->setEnabled(no_ongoing_connection); + bool add_photo = mPhotoCheckbox->getValue().asBoolean(); + // Display the preview if one is available if (previewp && previewp->getThumbnailImage()) { @@ -131,7 +133,7 @@ void LLTwitterPhotoPanel::draw() gGL.matrixMode(LLRender::MM_MODELVIEW); // Apply floater transparency to the texture unless the floater is focused. - F32 alpha = (mPhotoCheckbox->getValue().asBoolean() ? (getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency()) : 0.5f); + F32 alpha = (add_photo ? (getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency()) : 0.5f); LLColor4 color = LLColor4::white; gl_draw_scaled_image(offset_x, offset_y, thumbnail_w, thumbnail_h, @@ -144,7 +146,7 @@ void LLTwitterPhotoPanel::draw() mWorkingLabel->setVisible(!(previewp && previewp->getSnapshotUpToDate())); // Enable Post if we have a preview to send and no on going connection being processed - mPostButton->setEnabled(no_ongoing_connection && (previewp && previewp->getSnapshotUpToDate())); + mPostButton->setEnabled(no_ongoing_connection && ((add_photo && previewp && previewp->getSnapshotUpToDate()) || !mStatusTextBox->getValue().asString().empty())); // Draw the rest of the panel on top of it LLPanel::draw(); diff --git a/indra/newview/llpanelsnapshotoptions.cpp b/indra/newview/llpanelsnapshotoptions.cpp index 554fabe5b3..1967c50a29 100755 --- a/indra/newview/llpanelsnapshotoptions.cpp +++ b/indra/newview/llpanelsnapshotoptions.cpp @@ -31,6 +31,7 @@ #include "llsidetraypanelcontainer.h" #include "llfloatersnapshot.h" // FIXME: create a snapshot model +#include "llfloaterreg.h" /** * Provides several ways to save a snapshot. @@ -44,6 +45,7 @@ class LLPanelSnapshotOptions public: LLPanelSnapshotOptions(); ~LLPanelSnapshotOptions(); + /*virtual*/ BOOL postBuild(); /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void onEconomyDataChange() { updateUploadCost(); } @@ -54,6 +56,9 @@ private: void onSaveToEmail(); void onSaveToInventory(); void onSaveToComputer(); + void onSendToFacebook(); + void onSendToTwitter(); + void onSendToFlickr(); }; static LLRegisterPanelClassWrapper panel_class("llpanelsnapshotoptions"); @@ -73,6 +78,19 @@ LLPanelSnapshotOptions::~LLPanelSnapshotOptions() LLGlobalEconomy::Singleton::getInstance()->removeObserver(this); } +// virtual +BOOL LLPanelSnapshotOptions::postBuild() +{ + LLTextBox* sendToFacebookTextBox = getChild("send_to_facebook_textbox"); + sendToFacebookTextBox->setURLClickedCallback(boost::bind(&LLPanelSnapshotOptions::onSendToFacebook, this)); + LLTextBox* sendToTwitterTextBox = getChild("send_to_twitter_textbox"); + sendToTwitterTextBox->setURLClickedCallback(boost::bind(&LLPanelSnapshotOptions::onSendToTwitter, this)); + LLTextBox* sendToFlickrTextBox = getChild("send_to_flickr_textbox"); + sendToFlickrTextBox->setURLClickedCallback(boost::bind(&LLPanelSnapshotOptions::onSendToFlickr, this)); + + return LLPanel::postBuild(); +} + // virtual void LLPanelSnapshotOptions::onOpen(const LLSD& key) { @@ -118,3 +136,21 @@ void LLPanelSnapshotOptions::onSaveToComputer() { openPanel("panel_snapshot_local"); } + +void LLPanelSnapshotOptions::onSendToFacebook() +{ + LLFloaterReg::hideInstance("snapshot"); + LLFloaterReg::showInstance("social"); +} + +void LLPanelSnapshotOptions::onSendToTwitter() +{ + LLFloaterReg::hideInstance("snapshot"); + LLFloaterReg::showInstance("twitter"); +} + +void LLPanelSnapshotOptions::onSendToFlickr() +{ + LLFloaterReg::hideInstance("snapshot"); + LLFloaterReg::showInstance("flickr"); +} diff --git a/indra/newview/skins/default/xui/en/floater_snapshot.xml b/indra/newview/skins/default/xui/en/floater_snapshot.xml index 853c209bca..019ddad33c 100755 --- a/indra/newview/skins/default/xui/en/floater_snapshot.xml +++ b/indra/newview/skins/default/xui/en/floater_snapshot.xml @@ -10,7 +10,7 @@ help_topic="snapshot" save_rect="true" save_visibility="false" - title="SNAPSHOT PREVIEW" + title="SNAPSHOT" width="470"> diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_options.xml b/indra/newview/skins/default/xui/en/panel_snapshot_options.xml index 61c8c971c2..eff60f8228 100755 --- a/indra/newview/skins/default/xui/en/panel_snapshot_options.xml +++ b/indra/newview/skins/default/xui/en/panel_snapshot_options.xml @@ -81,4 +81,40 @@ + + Send to: [secondlife:/// Facebook] + + + [secondlife:/// Twitter] + + + [secondlife:/// Flickr] + -- cgit v1.2.3 From 4af21580297dd85727ffdc5d4eee89ad58ead271 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sat, 9 Nov 2013 11:31:32 +0000 Subject: Adding method to load cached/default syntax file and method to access sKeyWordsXML. --- indra/llui/llkeywords.cpp | 12 +++++----- indra/llui/llkeywords.h | 20 ++++++++--------- indra/newview/llpreviewscript.cpp | 15 ++++++++----- indra/newview/llpreviewscript.h | 1 + indra/newview/llsyntaxid.cpp | 47 ++++++++++++++++++++++++++++++++------- indra/newview/llsyntaxid.h | 4 +++- 6 files changed, 69 insertions(+), 30 deletions(-) (limited to 'indra') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 687c2fb31d..832264f074 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -34,7 +34,7 @@ #include "lltexteditor.h" #include "llstl.h" -inline BOOL LLKeywordToken::isHead(const llwchar* s) const +inline bool LLKeywordToken::isHead(const llwchar* s) const { // strncmp is much faster than string compare BOOL res = TRUE; @@ -51,7 +51,7 @@ inline BOOL LLKeywordToken::isHead(const llwchar* s) const return res; } -inline BOOL LLKeywordToken::isTail(const llwchar* s) const +inline bool LLKeywordToken::isTail(const llwchar* s) const { BOOL res = TRUE; const llwchar* t = mDelimiter.c_str(); @@ -198,7 +198,7 @@ LLColor4 LLKeywords::getColorGroup(const std::string key_in) return LLUIColorTable::instance().getColor(ColourGroup); } -BOOL LLKeywords::initialise(ELLPath path, const std::string filename) +bool LLKeywords::initialise(ELLPath path, const std::string filename) { mReady = false; setFilenameSyntax( gDirUtilp->getExpandedFilename(path, filename) ); @@ -214,7 +214,7 @@ BOOL LLKeywords::initialise(ELLPath path, const std::string filename) return mReady; } -BOOL LLKeywords::loadFromFile() +bool LLKeywords::loadFromFile() { processTokens(); return true; @@ -226,14 +226,14 @@ BOOL LLKeywords::loadFromFile() * contained data to the specified LLSD object. * @return Returns boolean true/false indicating success or failure. */ -BOOL LLKeywords::loadIntoLLSD(const std::string& filename, LLSD& data) +bool LLKeywords::loadIntoLLSD(const std::string& filename, LLSD& data) { mLoaded = false; llifstream file; file.open(filename); if(file.is_open()) { - mLoaded = (BOOL)LLSDSerialize::fromXML(data, file); + mLoaded = (bool)LLSDSerialize::fromXML(data, file); if (!mLoaded) { LL_WARNS("") << "Unable to deserialise file: " << filename << LL_ENDL; diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index 1bd23549d2..f98453405d 100755 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -83,8 +83,8 @@ public: S32 getLengthHead() const { return mToken.size(); } S32 getLengthTail() const { return mDelimiter.size(); } - BOOL isHead(const llwchar* s) const; - BOOL isTail(const llwchar* s) const; + bool isHead(const llwchar* s) const; + bool isTail(const llwchar* s) const; const LLWString& getToken() const { return mToken; } const LLColor4& getColor() const { return mColor; } TOKEN_TYPE getType() const { return mType; } @@ -111,13 +111,13 @@ public: void addColorGroup(const std::string key_in, const LLColor4 color); LLColor4 getColorGroup(const std::string key_in); - BOOL loadFromFile(); - BOOL loadFromFile(const std::string& filename); - BOOL isLoaded() const { return mLoaded; } + bool loadFromFile(); + bool loadFromFile(const std::string& filename); + bool isLoaded() const { return mLoaded; } void setFilenameSyntax(const std::string filename) { mFilenameSyntax = filename; } void findSegments(std::vector *seg_list, const LLWString& text, const LLColor4 &defaultColor, class LLTextEditor& editor ); - BOOL initialise(ELLPath path, const std::string filename); + bool initialise(ELLPath path, const std::string filename); std::string processColors(); std::string processColors(LLSD &data, const std::string strGroup); void processTokens(); @@ -176,10 +176,10 @@ protected: LLColor4 readColor(LLSD& sd); void insertSegment(std::vector& seg_list, LLTextSegmentPtr new_segment, S32 text_len, const LLColor4 &defaultColor, class LLTextEditor& editor); void insertSegments(const LLWString& wtext, std::vector& seg_list, LLKeywordToken* token, S32 text_len, S32 seg_start, S32 seg_end, const LLColor4 &defaultColor, LLTextEditor& editor); - BOOL loadIntoLLSD( const std::string& filename, LLSD& data ); + bool loadIntoLLSD( const std::string& filename, LLSD& data ); LLSD mColors; - BOOL mLoaded; + bool mLoaded; LLSD mSyntax; word_token_map_t mWordTokenMap; typedef std::deque token_list_t; @@ -194,8 +194,8 @@ protected: std::string getArguments(LLSD& args); private: - BOOL ready() { return mReady; } - BOOL mReady; + bool ready() { return mReady; } + bool mReady; std::string mFilenameSyntax; }; diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 5f23249c8d..705872328a 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -406,11 +406,7 @@ BOOL LLScriptEdCore::postBuild() initMenu(); -// Make this work ;-) - mSyntaxIdLSL.initialise(); - // ... - mEditor->mKeywords.initialise(LL_PATH_APP_SETTINGS, "keywords_lsl_default.xml"); -// mEditor->mKeywords.initialise(mSyntaxIdLSL.getFullFileSpec()); + LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLScriptEdCore::initKeywords(), this)); // FIX: Refactor LLTextEditor::loadKeywords so these can be removed. std::vector funcs; @@ -456,6 +452,15 @@ BOOL LLScriptEdCore::postBuild() return TRUE; } +void LLScriptEdCore::initKeywords() +{ + // Make this work ;-) + mSyntaxIdLSL.initialise(); + // ... + mEditor->mKeywords.initialise(LL_PATH_APP_SETTINGS, "keywords_lsl_default.xml"); + // mEditor->mKeywords.initialise(mSyntaxIdLSL.getKeywordsXML()); +} + void LLScriptEdCore::initMenu() { // *TODO: Skinning - make these callbacks data driven diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index 73ccaab0b8..149c27461e 100755 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -78,6 +78,7 @@ public: ~LLScriptEdCore(); void initMenu(); + void initKeywords(); virtual void draw(); /*virtual*/ BOOL postBuild(); diff --git a/indra/newview/llsyntaxid.cpp b/indra/newview/llsyntaxid.cpp index 0249607834..00e6086546 100644 --- a/indra/newview/llsyntaxid.cpp +++ b/indra/newview/llsyntaxid.cpp @@ -248,7 +248,7 @@ void LLSyntaxIdLSL::initialise() LL_WARNS("LSLSyntax") << "Filename is cached, no need to download!" << LL_ENDL; - openKeywordsFile(); + loadKeywordsFileIntoLLSD(); } } else @@ -256,27 +256,58 @@ void LLSyntaxIdLSL::initialise() LL_WARNS("LSLSyntax") << "ID is null so SyntaxID does not need to be processed!" << LL_ENDL; - openKeywordsFile(); + loadKeywordsFileIntoLLSD(); } - // TODO add a signal here to tell the editor the hash has changed? + mFileNameCurrent = mFileNameNew; + mSyntaxIdCurrent = mSyntaxIdNew; } else { LL_WARNS("LSLSyntax") << "No change to Syntax! Nothing to see here. Move along now!" << LL_ENDL; - } - //LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLSyntaxIdLSL::checkSyntaxIdChange(), this)); } //----------------------------------------------------------------------------- -// openKeywordsFile +// loadKeywordsFileIntoLLSD //----------------------------------------------------------------------------- -void LLSyntaxIdLSL::openKeywordsFile() +/** + * @brief Load xml serialised LLSD + * @desc Opens the specified filespec and attempts to deserialise the + * contained data to the specified LLSD object. + * @return Returns boolean true/false indicating success or failure. + */ +bool LLSyntaxIdLSL::loadKeywordsFileIntoLLSD() { LL_WARNS("LSLSyntax") << "Trying to open default or cached keyword file ;-)" << LL_ENDL; - // TODO Open the file and load LLSD into sKeywordsXml + + bool loaded = false; + LLSD content; + llifstream file; + file.open(mFullFileSpec); + if (file.is_open()) + { + loaded = (bool)LLSDSerialize::fromXML(content, file); + if (!loaded) + { + LL_WARNS("LSLSyntax") << "Unable to deserialise file: " << filename << LL_ENDL; + + // Is this the right thing to do, or should we leave the old content + // even if it isn't entirely accurate anymore? + sKeywordsXml = LLSD.emptyMap(); + } + else + { + sKeywordsXml = content; + LL_INFOS("LSLSyntax") << "Deserialised file: " << filename << LL_ENDL; + } + } + else + { + LL_WARNS("LSLSyntax") << "Unable to open file: " << filename << LL_ENDL; + } + return loaded; } diff --git a/indra/newview/llsyntaxid.h b/indra/newview/llsyntaxid.h index d9f2572863..50013a8380 100644 --- a/indra/newview/llsyntaxid.h +++ b/indra/newview/llsyntaxid.h @@ -39,6 +39,7 @@ public: bool checkSyntaxIdChanged(); std::string getFileNameCurrent() const { return mFileNameCurrent; } ELLPath getFilePath() const { return mFilePath; } + LLSD getKeywordsXML() const { return sKeywordsXml; } LLUUID getSyntaxId() const { return mSyntaxIdCurrent; } void initialise(); @@ -50,7 +51,8 @@ protected: std::string buildFileNameNew(); std::string buildFullFileSpec(); void fetchKeywordsFile(); - void openKeywordsFile(); + //void openKeywordsFile(); + bool loadKeywordsFileIntoLLSD(); void setSyntaxId(LLUUID SyntaxId) { mSyntaxIdCurrent = SyntaxId; } void setFileNameCurrent(std::string& name) { mFileNameCurrent = name; } void setFileNameDefault(std::string& name) { mFileNameDefault = name; } -- cgit v1.2.3 From 29b2129e1eec0dbbb909422e82766a58f14c5da3 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sat, 9 Nov 2013 11:32:08 +0000 Subject: Backed out changeset: e82d9467bec8 --- indra/llui/llkeywords.cpp | 12 +++++----- indra/llui/llkeywords.h | 20 ++++++++--------- indra/newview/llpreviewscript.cpp | 15 +++++-------- indra/newview/llpreviewscript.h | 1 - indra/newview/llsyntaxid.cpp | 47 +++++++-------------------------------- indra/newview/llsyntaxid.h | 4 +--- 6 files changed, 30 insertions(+), 69 deletions(-) (limited to 'indra') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 832264f074..687c2fb31d 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -34,7 +34,7 @@ #include "lltexteditor.h" #include "llstl.h" -inline bool LLKeywordToken::isHead(const llwchar* s) const +inline BOOL LLKeywordToken::isHead(const llwchar* s) const { // strncmp is much faster than string compare BOOL res = TRUE; @@ -51,7 +51,7 @@ inline bool LLKeywordToken::isHead(const llwchar* s) const return res; } -inline bool LLKeywordToken::isTail(const llwchar* s) const +inline BOOL LLKeywordToken::isTail(const llwchar* s) const { BOOL res = TRUE; const llwchar* t = mDelimiter.c_str(); @@ -198,7 +198,7 @@ LLColor4 LLKeywords::getColorGroup(const std::string key_in) return LLUIColorTable::instance().getColor(ColourGroup); } -bool LLKeywords::initialise(ELLPath path, const std::string filename) +BOOL LLKeywords::initialise(ELLPath path, const std::string filename) { mReady = false; setFilenameSyntax( gDirUtilp->getExpandedFilename(path, filename) ); @@ -214,7 +214,7 @@ bool LLKeywords::initialise(ELLPath path, const std::string filename) return mReady; } -bool LLKeywords::loadFromFile() +BOOL LLKeywords::loadFromFile() { processTokens(); return true; @@ -226,14 +226,14 @@ bool LLKeywords::loadFromFile() * contained data to the specified LLSD object. * @return Returns boolean true/false indicating success or failure. */ -bool LLKeywords::loadIntoLLSD(const std::string& filename, LLSD& data) +BOOL LLKeywords::loadIntoLLSD(const std::string& filename, LLSD& data) { mLoaded = false; llifstream file; file.open(filename); if(file.is_open()) { - mLoaded = (bool)LLSDSerialize::fromXML(data, file); + mLoaded = (BOOL)LLSDSerialize::fromXML(data, file); if (!mLoaded) { LL_WARNS("") << "Unable to deserialise file: " << filename << LL_ENDL; diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index f98453405d..1bd23549d2 100755 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -83,8 +83,8 @@ public: S32 getLengthHead() const { return mToken.size(); } S32 getLengthTail() const { return mDelimiter.size(); } - bool isHead(const llwchar* s) const; - bool isTail(const llwchar* s) const; + BOOL isHead(const llwchar* s) const; + BOOL isTail(const llwchar* s) const; const LLWString& getToken() const { return mToken; } const LLColor4& getColor() const { return mColor; } TOKEN_TYPE getType() const { return mType; } @@ -111,13 +111,13 @@ public: void addColorGroup(const std::string key_in, const LLColor4 color); LLColor4 getColorGroup(const std::string key_in); - bool loadFromFile(); - bool loadFromFile(const std::string& filename); - bool isLoaded() const { return mLoaded; } + BOOL loadFromFile(); + BOOL loadFromFile(const std::string& filename); + BOOL isLoaded() const { return mLoaded; } void setFilenameSyntax(const std::string filename) { mFilenameSyntax = filename; } void findSegments(std::vector *seg_list, const LLWString& text, const LLColor4 &defaultColor, class LLTextEditor& editor ); - bool initialise(ELLPath path, const std::string filename); + BOOL initialise(ELLPath path, const std::string filename); std::string processColors(); std::string processColors(LLSD &data, const std::string strGroup); void processTokens(); @@ -176,10 +176,10 @@ protected: LLColor4 readColor(LLSD& sd); void insertSegment(std::vector& seg_list, LLTextSegmentPtr new_segment, S32 text_len, const LLColor4 &defaultColor, class LLTextEditor& editor); void insertSegments(const LLWString& wtext, std::vector& seg_list, LLKeywordToken* token, S32 text_len, S32 seg_start, S32 seg_end, const LLColor4 &defaultColor, LLTextEditor& editor); - bool loadIntoLLSD( const std::string& filename, LLSD& data ); + BOOL loadIntoLLSD( const std::string& filename, LLSD& data ); LLSD mColors; - bool mLoaded; + BOOL mLoaded; LLSD mSyntax; word_token_map_t mWordTokenMap; typedef std::deque token_list_t; @@ -194,8 +194,8 @@ protected: std::string getArguments(LLSD& args); private: - bool ready() { return mReady; } - bool mReady; + BOOL ready() { return mReady; } + BOOL mReady; std::string mFilenameSyntax; }; diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 705872328a..5f23249c8d 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -406,7 +406,11 @@ BOOL LLScriptEdCore::postBuild() initMenu(); - LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLScriptEdCore::initKeywords(), this)); +// Make this work ;-) + mSyntaxIdLSL.initialise(); + // ... + mEditor->mKeywords.initialise(LL_PATH_APP_SETTINGS, "keywords_lsl_default.xml"); +// mEditor->mKeywords.initialise(mSyntaxIdLSL.getFullFileSpec()); // FIX: Refactor LLTextEditor::loadKeywords so these can be removed. std::vector funcs; @@ -452,15 +456,6 @@ BOOL LLScriptEdCore::postBuild() return TRUE; } -void LLScriptEdCore::initKeywords() -{ - // Make this work ;-) - mSyntaxIdLSL.initialise(); - // ... - mEditor->mKeywords.initialise(LL_PATH_APP_SETTINGS, "keywords_lsl_default.xml"); - // mEditor->mKeywords.initialise(mSyntaxIdLSL.getKeywordsXML()); -} - void LLScriptEdCore::initMenu() { // *TODO: Skinning - make these callbacks data driven diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index 149c27461e..73ccaab0b8 100755 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -78,7 +78,6 @@ public: ~LLScriptEdCore(); void initMenu(); - void initKeywords(); virtual void draw(); /*virtual*/ BOOL postBuild(); diff --git a/indra/newview/llsyntaxid.cpp b/indra/newview/llsyntaxid.cpp index 00e6086546..0249607834 100644 --- a/indra/newview/llsyntaxid.cpp +++ b/indra/newview/llsyntaxid.cpp @@ -248,7 +248,7 @@ void LLSyntaxIdLSL::initialise() LL_WARNS("LSLSyntax") << "Filename is cached, no need to download!" << LL_ENDL; - loadKeywordsFileIntoLLSD(); + openKeywordsFile(); } } else @@ -256,58 +256,27 @@ void LLSyntaxIdLSL::initialise() LL_WARNS("LSLSyntax") << "ID is null so SyntaxID does not need to be processed!" << LL_ENDL; - loadKeywordsFileIntoLLSD(); + openKeywordsFile(); } - mFileNameCurrent = mFileNameNew; - mSyntaxIdCurrent = mSyntaxIdNew; + // TODO add a signal here to tell the editor the hash has changed? } else { LL_WARNS("LSLSyntax") << "No change to Syntax! Nothing to see here. Move along now!" << LL_ENDL; + } + //LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLSyntaxIdLSL::checkSyntaxIdChange(), this)); } //----------------------------------------------------------------------------- -// loadKeywordsFileIntoLLSD +// openKeywordsFile //----------------------------------------------------------------------------- -/** - * @brief Load xml serialised LLSD - * @desc Opens the specified filespec and attempts to deserialise the - * contained data to the specified LLSD object. - * @return Returns boolean true/false indicating success or failure. - */ -bool LLSyntaxIdLSL::loadKeywordsFileIntoLLSD() +void LLSyntaxIdLSL::openKeywordsFile() { LL_WARNS("LSLSyntax") << "Trying to open default or cached keyword file ;-)" << LL_ENDL; - - bool loaded = false; - LLSD content; - llifstream file; - file.open(mFullFileSpec); - if (file.is_open()) - { - loaded = (bool)LLSDSerialize::fromXML(content, file); - if (!loaded) - { - LL_WARNS("LSLSyntax") << "Unable to deserialise file: " << filename << LL_ENDL; - - // Is this the right thing to do, or should we leave the old content - // even if it isn't entirely accurate anymore? - sKeywordsXml = LLSD.emptyMap(); - } - else - { - sKeywordsXml = content; - LL_INFOS("LSLSyntax") << "Deserialised file: " << filename << LL_ENDL; - } - } - else - { - LL_WARNS("LSLSyntax") << "Unable to open file: " << filename << LL_ENDL; - } - return loaded; + // TODO Open the file and load LLSD into sKeywordsXml } diff --git a/indra/newview/llsyntaxid.h b/indra/newview/llsyntaxid.h index 50013a8380..d9f2572863 100644 --- a/indra/newview/llsyntaxid.h +++ b/indra/newview/llsyntaxid.h @@ -39,7 +39,6 @@ public: bool checkSyntaxIdChanged(); std::string getFileNameCurrent() const { return mFileNameCurrent; } ELLPath getFilePath() const { return mFilePath; } - LLSD getKeywordsXML() const { return sKeywordsXml; } LLUUID getSyntaxId() const { return mSyntaxIdCurrent; } void initialise(); @@ -51,8 +50,7 @@ protected: std::string buildFileNameNew(); std::string buildFullFileSpec(); void fetchKeywordsFile(); - //void openKeywordsFile(); - bool loadKeywordsFileIntoLLSD(); + void openKeywordsFile(); void setSyntaxId(LLUUID SyntaxId) { mSyntaxIdCurrent = SyntaxId; } void setFileNameCurrent(std::string& name) { mFileNameCurrent = name; } void setFileNameDefault(std::string& name) { mFileNameDefault = name; } -- cgit v1.2.3 From 3b03ffbd70bff48a747f9f3a45056069724fc42f Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sat, 9 Nov 2013 11:39:53 +0000 Subject: Changing method openKeywordFile to loadKeywordFileIntoLLSD to load cached/default syntax file and method to access sKeyWordsXML. loadKeywordFileIntoLLSD was taken almost verbatim from LLKeywords::loadIntoLLSD which can be removed later. I know the name is long but I wanted to remember where it came from and why it is how it is. Removed a little cruft also. --- indra/newview/llsyntaxid.cpp | 47 ++++++++++++++++++++++++++++++++++++-------- indra/newview/llsyntaxid.h | 4 +++- 2 files changed, 42 insertions(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/newview/llsyntaxid.cpp b/indra/newview/llsyntaxid.cpp index 0249607834..00e6086546 100644 --- a/indra/newview/llsyntaxid.cpp +++ b/indra/newview/llsyntaxid.cpp @@ -248,7 +248,7 @@ void LLSyntaxIdLSL::initialise() LL_WARNS("LSLSyntax") << "Filename is cached, no need to download!" << LL_ENDL; - openKeywordsFile(); + loadKeywordsFileIntoLLSD(); } } else @@ -256,27 +256,58 @@ void LLSyntaxIdLSL::initialise() LL_WARNS("LSLSyntax") << "ID is null so SyntaxID does not need to be processed!" << LL_ENDL; - openKeywordsFile(); + loadKeywordsFileIntoLLSD(); } - // TODO add a signal here to tell the editor the hash has changed? + mFileNameCurrent = mFileNameNew; + mSyntaxIdCurrent = mSyntaxIdNew; } else { LL_WARNS("LSLSyntax") << "No change to Syntax! Nothing to see here. Move along now!" << LL_ENDL; - } - //LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLSyntaxIdLSL::checkSyntaxIdChange(), this)); } //----------------------------------------------------------------------------- -// openKeywordsFile +// loadKeywordsFileIntoLLSD //----------------------------------------------------------------------------- -void LLSyntaxIdLSL::openKeywordsFile() +/** + * @brief Load xml serialised LLSD + * @desc Opens the specified filespec and attempts to deserialise the + * contained data to the specified LLSD object. + * @return Returns boolean true/false indicating success or failure. + */ +bool LLSyntaxIdLSL::loadKeywordsFileIntoLLSD() { LL_WARNS("LSLSyntax") << "Trying to open default or cached keyword file ;-)" << LL_ENDL; - // TODO Open the file and load LLSD into sKeywordsXml + + bool loaded = false; + LLSD content; + llifstream file; + file.open(mFullFileSpec); + if (file.is_open()) + { + loaded = (bool)LLSDSerialize::fromXML(content, file); + if (!loaded) + { + LL_WARNS("LSLSyntax") << "Unable to deserialise file: " << filename << LL_ENDL; + + // Is this the right thing to do, or should we leave the old content + // even if it isn't entirely accurate anymore? + sKeywordsXml = LLSD.emptyMap(); + } + else + { + sKeywordsXml = content; + LL_INFOS("LSLSyntax") << "Deserialised file: " << filename << LL_ENDL; + } + } + else + { + LL_WARNS("LSLSyntax") << "Unable to open file: " << filename << LL_ENDL; + } + return loaded; } diff --git a/indra/newview/llsyntaxid.h b/indra/newview/llsyntaxid.h index d9f2572863..50013a8380 100644 --- a/indra/newview/llsyntaxid.h +++ b/indra/newview/llsyntaxid.h @@ -39,6 +39,7 @@ public: bool checkSyntaxIdChanged(); std::string getFileNameCurrent() const { return mFileNameCurrent; } ELLPath getFilePath() const { return mFilePath; } + LLSD getKeywordsXML() const { return sKeywordsXml; } LLUUID getSyntaxId() const { return mSyntaxIdCurrent; } void initialise(); @@ -50,7 +51,8 @@ protected: std::string buildFileNameNew(); std::string buildFullFileSpec(); void fetchKeywordsFile(); - void openKeywordsFile(); + //void openKeywordsFile(); + bool loadKeywordsFileIntoLLSD(); void setSyntaxId(LLUUID SyntaxId) { mSyntaxIdCurrent = SyntaxId; } void setFileNameCurrent(std::string& name) { mFileNameCurrent = name; } void setFileNameDefault(std::string& name) { mFileNameDefault = name; } -- cgit v1.2.3 From bea2e9822b52b66e3644925143b852526c669248 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sat, 9 Nov 2013 11:51:45 +0000 Subject: Fixing some references to 'filename' I forgot to rename to mFullFileSpec. --- indra/newview/llsyntaxid.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/llsyntaxid.cpp b/indra/newview/llsyntaxid.cpp index 00e6086546..c5960fb16e 100644 --- a/indra/newview/llsyntaxid.cpp +++ b/indra/newview/llsyntaxid.cpp @@ -293,7 +293,7 @@ bool LLSyntaxIdLSL::loadKeywordsFileIntoLLSD() loaded = (bool)LLSDSerialize::fromXML(content, file); if (!loaded) { - LL_WARNS("LSLSyntax") << "Unable to deserialise file: " << filename << LL_ENDL; + LL_WARNS("LSLSyntax") << "Unable to deserialise file: " << mFullFileSpec << LL_ENDL; // Is this the right thing to do, or should we leave the old content // even if it isn't entirely accurate anymore? @@ -302,12 +302,12 @@ bool LLSyntaxIdLSL::loadKeywordsFileIntoLLSD() else { sKeywordsXml = content; - LL_INFOS("LSLSyntax") << "Deserialised file: " << filename << LL_ENDL; + LL_INFOS("LSLSyntax") << "Deserialised file: " << mFullFileSpec << LL_ENDL; } } else { - LL_WARNS("LSLSyntax") << "Unable to open file: " << filename << LL_ENDL; + LL_WARNS("LSLSyntax") << "Unable to open file: " << mFullFileSpec << LL_ENDL; } return loaded; } -- cgit v1.2.3 From a4c5b5c416e9a289fa2caa6d61d05e1f68605b5a Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sun, 10 Nov 2013 17:39:34 +0000 Subject: Fixing missing parenthesis. --- indra/newview/llsyntaxid.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llsyntaxid.cpp b/indra/newview/llsyntaxid.cpp index c5960fb16e..2388f1c5ef 100644 --- a/indra/newview/llsyntaxid.cpp +++ b/indra/newview/llsyntaxid.cpp @@ -297,7 +297,7 @@ bool LLSyntaxIdLSL::loadKeywordsFileIntoLLSD() // Is this the right thing to do, or should we leave the old content // even if it isn't entirely accurate anymore? - sKeywordsXml = LLSD.emptyMap(); + sKeywordsXml = LLSD().emptyMap(); } else { -- cgit v1.2.3 From da0cd7b845028f679e6ce7243715d52481f0c430 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sun, 10 Nov 2013 17:43:17 +0000 Subject: Adding getter for mFullFileSpec, shortening loadKeywordsFileIntoLLSD to loadKeywordsIntoLLSD. --- indra/newview/llsyntaxid.cpp | 6 +++--- indra/newview/llsyntaxid.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/llsyntaxid.cpp b/indra/newview/llsyntaxid.cpp index 2388f1c5ef..18869c215d 100644 --- a/indra/newview/llsyntaxid.cpp +++ b/indra/newview/llsyntaxid.cpp @@ -248,7 +248,7 @@ void LLSyntaxIdLSL::initialise() LL_WARNS("LSLSyntax") << "Filename is cached, no need to download!" << LL_ENDL; - loadKeywordsFileIntoLLSD(); + loadKeywordsIntoLLSD(); } } else @@ -256,7 +256,7 @@ void LLSyntaxIdLSL::initialise() LL_WARNS("LSLSyntax") << "ID is null so SyntaxID does not need to be processed!" << LL_ENDL; - loadKeywordsFileIntoLLSD(); + loadKeywordsIntoLLSD(); } mFileNameCurrent = mFileNameNew; mSyntaxIdCurrent = mSyntaxIdNew; @@ -278,7 +278,7 @@ void LLSyntaxIdLSL::initialise() * contained data to the specified LLSD object. * @return Returns boolean true/false indicating success or failure. */ -bool LLSyntaxIdLSL::loadKeywordsFileIntoLLSD() +bool LLSyntaxIdLSL::loadKeywordsIntoLLSD() { LL_WARNS("LSLSyntax") << "Trying to open default or cached keyword file ;-)" diff --git a/indra/newview/llsyntaxid.h b/indra/newview/llsyntaxid.h index 50013a8380..fc875a835f 100644 --- a/indra/newview/llsyntaxid.h +++ b/indra/newview/llsyntaxid.h @@ -39,6 +39,7 @@ public: bool checkSyntaxIdChanged(); std::string getFileNameCurrent() const { return mFileNameCurrent; } ELLPath getFilePath() const { return mFilePath; } + std::string getFileSpec() const { return mFullFileSpec; } LLSD getKeywordsXML() const { return sKeywordsXml; } LLUUID getSyntaxId() const { return mSyntaxIdCurrent; } @@ -51,8 +52,7 @@ protected: std::string buildFileNameNew(); std::string buildFullFileSpec(); void fetchKeywordsFile(); - //void openKeywordsFile(); - bool loadKeywordsFileIntoLLSD(); + bool loadKeywordsIntoLLSD(); void setSyntaxId(LLUUID SyntaxId) { mSyntaxIdCurrent = SyntaxId; } void setFileNameCurrent(std::string& name) { mFileNameCurrent = name; } void setFileNameDefault(std::string& name) { mFileNameDefault = name; } -- cgit v1.2.3 From 06ed74f177983e2eb170426712f422253a0b48e7 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sun, 10 Nov 2013 18:29:22 +0000 Subject: Tidying up llsyntaxid files --- indra/newview/llsyntaxid.cpp | 40 ++++++++++++++--------------- indra/newview/llsyntaxid.h | 60 ++++++++++++++++++++++++++------------------ 2 files changed, 54 insertions(+), 46 deletions(-) (limited to 'indra') diff --git a/indra/newview/llsyntaxid.cpp b/indra/newview/llsyntaxid.cpp index 18869c215d..5d8879195a 100644 --- a/indra/newview/llsyntaxid.cpp +++ b/indra/newview/llsyntaxid.cpp @@ -28,9 +28,9 @@ #include "llviewerprecompiledheaders.h" -#include "llhttpclient.h" #include "llagent.h" #include "llappviewer.h" +#include "llhttpclient.h" #include "llsdserialize.h" #include "llsyntaxid.h" @@ -46,10 +46,9 @@ fetchKeywordsFileResponder::fetchKeywordsFileResponder(std::string filespec) << LL_ENDL; } - void fetchKeywordsFileResponder::errorWithContent(U32 status, - const std::string& reason, - const LLSD& content) + const std::string& reason, + const LLSD& content) { LL_WARNS("LSLSyntax") << "fetchKeywordsFileResponder error [status:" @@ -67,7 +66,7 @@ void fetchKeywordsFileResponder::result(const LLSD& content_ref) LLSDSerialize::toPrettyXML(content_ref, str); const std::string xml = str.str(); - // save the str to disc + // save the str to disc, usually to the cache. llofstream file(mFileSpec, std::ios_base::out); file.write(xml.c_str(), str.str().size()); file.close(); @@ -78,8 +77,6 @@ void fetchKeywordsFileResponder::result(const LLSD& content_ref) } -LLSD LLSyntaxIdLSL::sKeywordsXml; - //----------------------------------------------------------------------------- // LLSyntaxIdLSL //----------------------------------------------------------------------------- @@ -98,6 +95,8 @@ LLSyntaxIdLSL::LLSyntaxIdLSL() : mFileNameCurrent = mFileNameDefault; } +LLSD LLSyntaxIdLSL::sKeywordsXml; + std::string LLSyntaxIdLSL::buildFileNameNew() { std::string filename = "keywords_lsl_"; @@ -151,7 +150,7 @@ bool LLSyntaxIdLSL::checkSyntaxIdChanged() if (mSyntaxIdCurrent != mSyntaxIdNew) { LL_WARNS("LSLSyntax") - << "Region changed to '" << region->getName() + << "Region is '" << region->getName() << "' it has LSLSyntaxId capability, and the new hash is '" << mSyntaxIdNew << "'" << LL_ENDL; @@ -161,7 +160,7 @@ bool LLSyntaxIdLSL::checkSyntaxIdChanged() else { LL_WARNS("LSLSyntax") - << "Region changed to '" << region->getName() + << "Region is '" << region->getName() << "' it has the same LSLSyntaxId! Leaving hash as '" << mSyntaxIdCurrent << "'" << LL_ENDL; @@ -173,7 +172,7 @@ bool LLSyntaxIdLSL::checkSyntaxIdChanged() if ( mSyntaxIdCurrent.isNull() ) { LL_WARNS("LSLSyntax") - << "Region changed to '" << region->getName() + << "Region is '" << region->getName() << " it does not have LSLSyntaxId capability, remaining with default keywords file!" << LL_ENDL; } @@ -182,7 +181,7 @@ bool LLSyntaxIdLSL::checkSyntaxIdChanged() mSyntaxIdNew = LLUUID(); LL_WARNS("LSLSyntax") - << "Region changed to '" << region->getName() + << "Region is '" << region->getName() << " it does not have LSLSyntaxId capability, using default keywords file!" << LL_ENDL; @@ -201,7 +200,6 @@ void LLSyntaxIdLSL::fetchKeywordsFile() { if ( !mCapabilityURL.empty() ) { - //buildFullFileSpec(); LLHTTPClient::get(mCapabilityURL, new fetchKeywordsFileResponder(mFullFileSpec), LLSD(), 30.f @@ -225,28 +223,28 @@ void LLSyntaxIdLSL::initialise() if (checkSyntaxIdChanged()) { LL_WARNS("LSLSyntax") - << "Change to syntax, setting up new file." + << "Change to LSL version, getting appropriate file." << LL_ENDL; - // Need a full spec built regardless of file source + // Need a full spec regardless of file source, so build it now. buildFullFileSpec(); if ( !mSyntaxIdNew.isNull() ) { LL_WARNS("LSLSyntax") - << "ID is not null so must be processed!" + << "We have an ID for the version, so we will process it!" << LL_ENDL; if ( !gDirUtilp->fileExists(mFullFileSpec) ) { // Does not exist, so fetch it from the capability fetchKeywordsFile(); LL_WARNS("LSLSyntax") - << "Filename is not cached, we will try to download it!" + << "File is not cached, we will try to download it!" << LL_ENDL; } else { LL_WARNS("LSLSyntax") - << "Filename is cached, no need to download!" + << "File is cached, no need to download!" << LL_ENDL; loadKeywordsIntoLLSD(); } @@ -254,7 +252,7 @@ void LLSyntaxIdLSL::initialise() else { // Need to open the default LL_WARNS("LSLSyntax") - << "ID is null so SyntaxID does not need to be processed!" + << "ID is null so we will use the default file!" << LL_ENDL; loadKeywordsIntoLLSD(); } @@ -263,8 +261,8 @@ void LLSyntaxIdLSL::initialise() } else { - LL_WARNS("LSLSyntax") - << "No change to Syntax! Nothing to see here. Move along now!" + LL_INFOS("LSLSyntax") + << "No change to Syntax! Nothing to see. Move along now!" << LL_ENDL; } } @@ -281,7 +279,7 @@ void LLSyntaxIdLSL::initialise() bool LLSyntaxIdLSL::loadKeywordsIntoLLSD() { LL_WARNS("LSLSyntax") - << "Trying to open default or cached keyword file ;-)" + << "Trying to open cached or default keyword file ;-)" << LL_ENDL; bool loaded = false; diff --git a/indra/newview/llsyntaxid.h b/indra/newview/llsyntaxid.h index fc875a835f..472e88744f 100644 --- a/indra/newview/llsyntaxid.h +++ b/indra/newview/llsyntaxid.h @@ -11,28 +11,61 @@ #include "llhttpclient.h" #include "llviewerregion.h" - +/** + * @file llsyntaxid.h + * @brief Handles responses for the LSLSyntax capability's get call. + */ class fetchKeywordsFileResponder : public LLHTTPClient::Responder { public: std::string mFileSpec; + /** + * @brief fetchKeywordsFileResponder + * @param filespec File path and name of where to save the returned data + */ fetchKeywordsFileResponder(std::string filespec); void errorWithContent(U32 status, const std::string& reason, const LLSD& content); + /** + * @brief Saves the returned file to the location provided at instantiation. + * @param content_ref The LSL syntax file for the sim. + */ void result(const LLSD& content_ref); }; /** * @file llsyntaxid.h - * @brief The LLSyntaxIdLSL class + * @brief Tracks the file needed to decorate the current sim's version of LSL. */ class LLSyntaxIdLSL { +public: + + +protected: + LLViewerRegion* region; + + +private: + std::string mCapabilityName; + std::string mCapabilityURL; + std::string mFileNameCurrent; + std::string mFileNameDefault; + std::string mFileNameNew; + ELLPath mFilePath; + std::string mFullFileSpec; + std::string mSimulatorFeature; + LLUUID mSyntaxIdCurrent; + LLUUID mSyntaxIdNew; + + static LLSD sKeywordsXml; + + public: LLSyntaxIdLSL(); @@ -58,27 +91,4 @@ protected: void setFileNameDefault(std::string& name) { mFileNameDefault = name; } void setFileNameNew(std::string name) { mFileNameNew = name; } void setSimulatorFeatureName(const std::string& name) { mSimulatorFeature = name; } - - -//public: - - -protected: - LLViewerRegion* region; - - -private: - std::string mCapabilityName; - std::string mCapabilityURL; - std::string mFileNameCurrent; - std::string mFileNameDefault; - std::string mFileNameNew; - ELLPath mFilePath; - std::string mFullFileSpec; - std::string mSimulatorFeature; - LLUUID mSyntaxIdCurrent; - LLUUID mSyntaxIdNew; - - static LLSD sKeywordsXml; - }; -- cgit v1.2.3 From 5e27952ee4698006c86ebdca60c4eab305ddebac Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sun, 10 Nov 2013 20:24:13 +0000 Subject: storm-1831 Switch to use the llsyntaxid keywords LLSD directly --- indra/llui/llkeywords.cpp | 15 +++------------ indra/llui/llkeywords.h | 2 +- indra/newview/llpreviewscript.cpp | 3 +-- 3 files changed, 5 insertions(+), 15 deletions(-) (limited to 'indra') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 687c2fb31d..ac95a20588 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -198,19 +198,10 @@ LLColor4 LLKeywords::getColorGroup(const std::string key_in) return LLUIColorTable::instance().getColor(ColourGroup); } -BOOL LLKeywords::initialise(ELLPath path, const std::string filename) +bool LLKeywords::initialise(LLSD SyntaxXML) { - mReady = false; - setFilenameSyntax( gDirUtilp->getExpandedFilename(path, filename) ); - - if (! loadIntoLLSD(mFilenameSyntax, mSyntax) ) - { - LL_ERRS("") << "Failed to load syntax data from '" << mFilenameSyntax << "', cannot continue!" << LL_ENDL; - } - else - { - mReady = true; - } + mSyntax = SyntaxXML; + mLoaded = mReady = true; return mReady; } diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index 1bd23549d2..24a0450912 100755 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -117,7 +117,7 @@ public: void setFilenameSyntax(const std::string filename) { mFilenameSyntax = filename; } void findSegments(std::vector *seg_list, const LLWString& text, const LLColor4 &defaultColor, class LLTextEditor& editor ); - BOOL initialise(ELLPath path, const std::string filename); + bool initialise(LLSD SyntaxXML); std::string processColors(); std::string processColors(LLSD &data, const std::string strGroup); void processTokens(); diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 5f23249c8d..b464845256 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -409,8 +409,7 @@ BOOL LLScriptEdCore::postBuild() // Make this work ;-) mSyntaxIdLSL.initialise(); // ... - mEditor->mKeywords.initialise(LL_PATH_APP_SETTINGS, "keywords_lsl_default.xml"); -// mEditor->mKeywords.initialise(mSyntaxIdLSL.getFullFileSpec()); + mEditor->mKeywords.initialise(mSyntaxIdLSL.getKeywordsXML()); // FIX: Refactor LLTextEditor::loadKeywords so these can be removed. std::vector funcs; -- cgit v1.2.3 From 488964157cb02b44ac9c72bb6c57e47c2b21ee53 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sun, 10 Nov 2013 21:57:29 +0000 Subject: Moving keywords code into its own method. --- indra/newview/llpreviewscript.cpp | 87 +++++++++++++++++++++------------------ indra/newview/llpreviewscript.h | 1 + 2 files changed, 47 insertions(+), 41 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index b464845256..0cf8dbe9c5 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -406,53 +406,58 @@ BOOL LLScriptEdCore::postBuild() initMenu(); -// Make this work ;-) - mSyntaxIdLSL.initialise(); - // ... - mEditor->mKeywords.initialise(mSyntaxIdLSL.getKeywordsXML()); - - // FIX: Refactor LLTextEditor::loadKeywords so these can be removed. - std::vector funcs; - std::vector tooltips; - - LLColor3 color(0.5f, 0.0f, 0.15f); - mEditor->loadKeywords(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"keywords.ini"), funcs, tooltips, color); - - std::vector primary_keywords; - std::vector secondary_keywords; - LLKeywordToken *token; - LLKeywords::keyword_iterator_t token_it; - for (token_it = mEditor->keywordsBegin(); token_it != mEditor->keywordsEnd(); ++token_it) - { - token = token_it->second; - // FIX: change this to use the new Token Type enum entries. - if (token->getColor() == color) // Wow, what a disgusting hack. - { - primary_keywords.push_back( wstring_to_utf8str(token->getToken()) ); - } - else + return initKeywords(); +} + +bool LLScriptEdCore::initKeywords() +{ + // Make this work ;-) + mSyntaxIdLSL.initialise(); + // ... + mEditor->mKeywords.initialise(mSyntaxIdLSL.getKeywordsXML()); + + // FIX: Refactor LLTextEditor::loadKeywords so these can be removed. + //std::vector funcs; + //std::vector tooltips; + + LLColor3 color(0.5f, 0.0f, 0.15f); + mEditor->loadKeywords(); + + std::vector primary_keywords; + std::vector secondary_keywords; + LLKeywordToken *token; + LLKeywords::keyword_iterator_t token_it; + for (token_it = mEditor->keywordsBegin(); token_it != mEditor->keywordsEnd(); ++token_it) { - secondary_keywords.push_back( wstring_to_utf8str(token->getToken()) ); + token = token_it->second; + // FIX: change this to use the new Token Type enum entries. + if (token->getColor() == color) // Wow, what a disgusting hack. + { + primary_keywords.push_back( wstring_to_utf8str(token->getToken()) ); + } + else + { + secondary_keywords.push_back( wstring_to_utf8str(token->getToken()) ); + } } - } - // Case-insensitive dictionary sort for primary keywords. We don't sort the secondary - // keywords. They're intelligently grouped in keywords.ini. - std::stable_sort( primary_keywords.begin(), primary_keywords.end(), LLSECKeywordCompare() ); + // Case-insensitive dictionary sort for primary keywords. We don't sort the secondary + // keywords. They're intelligently grouped in keywords.ini. + std::stable_sort( primary_keywords.begin(), primary_keywords.end(), LLSECKeywordCompare() ); - for (std::vector::const_iterator iter= primary_keywords.begin(); - iter!= primary_keywords.end(); ++iter) - { - mFunctions->add(*iter); - } + for (std::vector::const_iterator iter= primary_keywords.begin(); + iter!= primary_keywords.end(); ++iter) + { + mFunctions->add(*iter); + } - for (std::vector::const_iterator iter= secondary_keywords.begin(); - iter!= secondary_keywords.end(); ++iter) - { - mFunctions->add(*iter); - } + for (std::vector::const_iterator iter= secondary_keywords.begin(); + iter!= secondary_keywords.end(); ++iter) + { + mFunctions->add(*iter); + } - return TRUE; + return TRUE; } void LLScriptEdCore::initMenu() diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index 73ccaab0b8..bc0256703e 100755 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -78,6 +78,7 @@ public: ~LLScriptEdCore(); void initMenu(); + bool initKeywords(); virtual void draw(); /*virtual*/ BOOL postBuild(); -- cgit v1.2.3 From dc317ed70ac8b8344a745b4f43116460efdfdbca Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sun, 10 Nov 2013 21:58:17 +0000 Subject: Refactoring load routines to remove uneeded methods --- indra/llui/llkeywords.cpp | 36 ------------------------------------ indra/llui/lltexteditor.cpp | 24 ++++++++++-------------- indra/llui/lltexteditor.h | 5 +---- 3 files changed, 11 insertions(+), 54 deletions(-) (limited to 'indra') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index ac95a20588..65ede3e46f 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -205,42 +205,6 @@ bool LLKeywords::initialise(LLSD SyntaxXML) return mReady; } -BOOL LLKeywords::loadFromFile() -{ - processTokens(); - return true; -} - -/** - * @brief Load xml serialised LLSD - * @desc Opens the specified filespec and attempts to deserialise the - * contained data to the specified LLSD object. - * @return Returns boolean true/false indicating success or failure. - */ -BOOL LLKeywords::loadIntoLLSD(const std::string& filename, LLSD& data) -{ - mLoaded = false; - llifstream file; - file.open(filename); - if(file.is_open()) - { - mLoaded = (BOOL)LLSDSerialize::fromXML(data, file); - if (!mLoaded) - { - LL_WARNS("") << "Unable to deserialise file: " << filename << LL_ENDL; - } - else - { - LL_INFOS("") << "Deserialised file: " << filename << LL_ENDL; - } - } - else - { - LL_WARNS("") << "Unable to open file: " << filename << LL_ENDL; - } - return mLoaded; -} - ///** // * @brief Start processing the colour LLSD from its beginning. // * diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 4bab68b339..b6c2e20a9d 100755 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -2502,23 +2502,19 @@ BOOL LLTextEditor::tryToRevertToPristineState() static LLFastTimer::DeclareTimer FTM_SYNTAX_HIGHLIGHTING("Syntax Highlighting"); -void LLTextEditor::loadKeywords(const std::string& filename, - const std::vector& funcs, - const std::vector& tooltips, - const LLColor4& color) +void LLTextEditor::loadKeywords() { LLFastTimer ft(FTM_SYNTAX_HIGHLIGHTING); - if(mKeywords.loadFromFile()) - { - segment_vec_t segment_list; - mKeywords.findSegments(&segment_list, getWText(), mDefaultColor.get(), *this); + mKeywords.processTokens(); - mSegments.clear(); - segment_set_t::iterator insert_it = mSegments.begin(); - for (segment_vec_t::iterator list_it = segment_list.begin(); list_it != segment_list.end(); ++list_it) - { - insert_it = mSegments.insert(insert_it, *list_it); - } + segment_vec_t segment_list; + mKeywords.findSegments(&segment_list, getWText(), mDefaultColor.get(), *this); + + mSegments.clear(); + segment_set_t::iterator insert_it = mSegments.begin(); + for (segment_vec_t::iterator list_it = segment_list.begin(); list_it != segment_list.end(); ++list_it) + { + insert_it = mSegments.insert(insert_it, *list_it); } } diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 8cc0e03712..0b4a22b08b 100755 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -187,10 +187,7 @@ public: void getCurrentLineAndColumn( S32* line, S32* col, BOOL include_wordwrap ); LLKeywords mKeywords; - void loadKeywords(const std::string& filename, - const std::vector& funcs, - const std::vector& tooltips, - const LLColor4& func_color); + void loadKeywords(); LLKeywords::keyword_iterator_t keywordsBegin() { return mKeywords.begin(); } LLKeywords::keyword_iterator_t keywordsEnd() { return mKeywords.end(); } -- cgit v1.2.3 From 009245510149c26337ac1cca64a367cd2234725b Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sun, 10 Nov 2013 22:35:49 +0000 Subject: Removing unused getter/setter and property for mFilenameSyntax, mReady. --- indra/llui/llkeywords.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'indra') diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index 24a0450912..f14605157d 100755 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -113,8 +113,7 @@ public: LLColor4 getColorGroup(const std::string key_in); BOOL loadFromFile(); BOOL loadFromFile(const std::string& filename); - BOOL isLoaded() const { return mLoaded; } - void setFilenameSyntax(const std::string filename) { mFilenameSyntax = filename; } + bool isLoaded() const { return mLoaded; } void findSegments(std::vector *seg_list, const LLWString& text, const LLColor4 &defaultColor, class LLTextEditor& editor ); bool initialise(LLSD SyntaxXML); @@ -179,7 +178,7 @@ protected: BOOL loadIntoLLSD( const std::string& filename, LLSD& data ); LLSD mColors; - BOOL mLoaded; + bool mLoaded; LLSD mSyntax; word_token_map_t mWordTokenMap; typedef std::deque token_list_t; @@ -194,9 +193,6 @@ protected: std::string getArguments(LLSD& args); private: - BOOL ready() { return mReady; } - BOOL mReady; - std::string mFilenameSyntax; }; #endif // LL_LLKEYWORDS_H -- cgit v1.2.3 From 1cf2acf6d70c5ce68d6faedffbbf2b070f2a6fd7 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sun, 10 Nov 2013 22:47:34 +0000 Subject: Fixing some small discrepencies. --- indra/newview/llpreviewscript.cpp | 15 +++++---------- indra/newview/llpreviewscript.h | 2 +- 2 files changed, 6 insertions(+), 11 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 0cf8dbe9c5..143703f60e 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -406,20 +406,16 @@ BOOL LLScriptEdCore::postBuild() initMenu(); - return initKeywords(); + initKeywords(); + + return TRUE; } -bool LLScriptEdCore::initKeywords() +void LLScriptEdCore::initKeywords() { - // Make this work ;-) mSyntaxIdLSL.initialise(); - // ... mEditor->mKeywords.initialise(mSyntaxIdLSL.getKeywordsXML()); - // FIX: Refactor LLTextEditor::loadKeywords so these can be removed. - //std::vector funcs; - //std::vector tooltips; - LLColor3 color(0.5f, 0.0f, 0.15f); mEditor->loadKeywords(); @@ -443,6 +439,7 @@ bool LLScriptEdCore::initKeywords() // Case-insensitive dictionary sort for primary keywords. We don't sort the secondary // keywords. They're intelligently grouped in keywords.ini. + // As we don't use keywords.ini, this is no longer true. Do we need to sort now? std::stable_sort( primary_keywords.begin(), primary_keywords.end(), LLSECKeywordCompare() ); for (std::vector::const_iterator iter= primary_keywords.begin(); @@ -456,8 +453,6 @@ bool LLScriptEdCore::initKeywords() { mFunctions->add(*iter); } - - return TRUE; } void LLScriptEdCore::initMenu() diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index bc0256703e..149c27461e 100755 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -78,7 +78,7 @@ public: ~LLScriptEdCore(); void initMenu(); - bool initKeywords(); + void initKeywords(); virtual void draw(); /*virtual*/ BOOL postBuild(); -- cgit v1.2.3 From f6d8e55eb9e9ec377e3a9ce9b25de702c3239090 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Mon, 11 Nov 2013 13:36:33 +0000 Subject: Fixing indentation of LLScriptEdCore::initKeywords --- indra/newview/llpreviewscript.cpp | 66 +++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 143703f60e..34ad95e228 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -413,46 +413,46 @@ BOOL LLScriptEdCore::postBuild() void LLScriptEdCore::initKeywords() { - mSyntaxIdLSL.initialise(); - mEditor->mKeywords.initialise(mSyntaxIdLSL.getKeywordsXML()); + mSyntaxIdLSL.initialise(); + mEditor->mKeywords.initialise(mSyntaxIdLSL.getKeywordsXML()); - LLColor3 color(0.5f, 0.0f, 0.15f); - mEditor->loadKeywords(); + LLColor3 color(0.5f, 0.0f, 0.15f); + mEditor->loadKeywords(); - std::vector primary_keywords; - std::vector secondary_keywords; - LLKeywordToken *token; - LLKeywords::keyword_iterator_t token_it; - for (token_it = mEditor->keywordsBegin(); token_it != mEditor->keywordsEnd(); ++token_it) + std::vector primary_keywords; + std::vector secondary_keywords; + LLKeywordToken *token; + LLKeywords::keyword_iterator_t token_it; + for (token_it = mEditor->keywordsBegin(); token_it != mEditor->keywordsEnd(); ++token_it) + { + token = token_it->second; + // FIX: change this to use the new Token Type enum entries. + if (token->getColor() == color) // Wow, what a disgusting hack. { - token = token_it->second; - // FIX: change this to use the new Token Type enum entries. - if (token->getColor() == color) // Wow, what a disgusting hack. - { - primary_keywords.push_back( wstring_to_utf8str(token->getToken()) ); - } - else - { - secondary_keywords.push_back( wstring_to_utf8str(token->getToken()) ); - } + primary_keywords.push_back( wstring_to_utf8str(token->getToken()) ); } - - // Case-insensitive dictionary sort for primary keywords. We don't sort the secondary - // keywords. They're intelligently grouped in keywords.ini. - // As we don't use keywords.ini, this is no longer true. Do we need to sort now? - std::stable_sort( primary_keywords.begin(), primary_keywords.end(), LLSECKeywordCompare() ); - - for (std::vector::const_iterator iter= primary_keywords.begin(); - iter!= primary_keywords.end(); ++iter) + else { - mFunctions->add(*iter); + secondary_keywords.push_back( wstring_to_utf8str(token->getToken()) ); } + } - for (std::vector::const_iterator iter= secondary_keywords.begin(); - iter!= secondary_keywords.end(); ++iter) - { - mFunctions->add(*iter); - } + // Case-insensitive dictionary sort for primary keywords. We don't sort the secondary + // keywords. They're intelligently grouped in keywords.ini. + // As we don't use keywords.ini, this is no longer true. Do we need to sort now? + std::stable_sort( primary_keywords.begin(), primary_keywords.end(), LLSECKeywordCompare() ); + + for (std::vector::const_iterator iter= primary_keywords.begin(); + iter!= primary_keywords.end(); ++iter) + { + mFunctions->add(*iter); + } + + for (std::vector::const_iterator iter= secondary_keywords.begin(); + iter!= secondary_keywords.end(); ++iter) + { + mFunctions->add(*iter); + } } void LLScriptEdCore::initMenu() -- cgit v1.2.3 From 3e41917403fb3519adac2343ca21a1f289596621 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Mon, 11 Nov 2013 16:33:04 +0000 Subject: Removing no longer used member variable, adding method to reset the mLoaded status --- indra/llui/llkeywords.cpp | 4 ++-- indra/llui/llkeywords.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 65ede3e46f..6aeaf4798b 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -201,8 +201,8 @@ LLColor4 LLKeywords::getColorGroup(const std::string key_in) bool LLKeywords::initialise(LLSD SyntaxXML) { mSyntax = SyntaxXML; - mLoaded = mReady = true; - return mReady; + mLoaded = true; + return mLoaded; } ///** diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index f14605157d..074cedfc63 100755 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -110,6 +110,7 @@ public: ~LLKeywords(); void addColorGroup(const std::string key_in, const LLColor4 color); + void clearLoaded() { mLoaded = false; } LLColor4 getColorGroup(const std::string key_in); BOOL loadFromFile(); BOOL loadFromFile(const std::string& filename); -- cgit v1.2.3 From 377eb5561f885902585830226fd82c4ceeec4e05 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Mon, 11 Nov 2013 16:34:16 +0000 Subject: Renaming initKeywords to better reflect its intended use (onRegionChangeInitialiseKeywords) --- indra/newview/llpreviewscript.cpp | 8 +++++--- indra/newview/llpreviewscript.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 34ad95e228..19aab8f383 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -34,6 +34,7 @@ #include "llcheckboxctrl.h" #include "llcombobox.h" #include "lldir.h" +#include "llenvmanager.h" #include "llexternaleditor.h" #include "llfilepicker.h" #include "llfloaterreg.h" @@ -406,13 +407,14 @@ BOOL LLScriptEdCore::postBuild() initMenu(); - initKeywords(); - + onRegionChangeInitialiseKeywords(); + //LLEnvManagerNew::getInstance()->setRegionChangeCallback(boost::bind(&LLScriptEdCore::onRegionChangeInitialiseKeywords(), this)); return TRUE; } -void LLScriptEdCore::initKeywords() +void LLScriptEdCore::onRegionChangeInitialiseKeywords() { + mEditor->mKeywords.clearLoaded(); mSyntaxIdLSL.initialise(); mEditor->mKeywords.initialise(mSyntaxIdLSL.getKeywordsXML()); diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index 149c27461e..2dd5a1b6a7 100755 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -78,7 +78,7 @@ public: ~LLScriptEdCore(); void initMenu(); - void initKeywords(); + void onRegionChangeInitialiseKeywords(); virtual void draw(); /*virtual*/ BOOL postBuild(); -- cgit v1.2.3 From da240d7cf0cccf54a65ca906b612579932aa78e3 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Mon, 11 Nov 2013 16:35:30 +0000 Subject: Commenting out an include for lscript_rt_interface.h, intend to track down and remove all of these, where appropriate, later. --- indra/newview/llfloaterbulkpermission.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llfloaterbulkpermission.cpp b/indra/newview/llfloaterbulkpermission.cpp index 76f62a7880..c3e9a6f5fb 100755 --- a/indra/newview/llfloaterbulkpermission.cpp +++ b/indra/newview/llfloaterbulkpermission.cpp @@ -36,7 +36,7 @@ #include "llviewerobject.h" #include "llviewerobjectlist.h" #include "llviewerregion.h" -#include "lscript_rt_interface.h" +//#include "lscript_rt_interface.h" #include "llviewercontrol.h" #include "llviewerinventory.h" #include "llviewerobject.h" -- cgit v1.2.3 From 56b1b35a18c21f6dad4147df35ba4594f31b67e3 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Mon, 11 Nov 2013 13:21:12 -0500 Subject: STORM-68 Send default permissions to simulator just once after logging in --- indra/newview/llfloaterperms.cpp | 19 ++++++++++++++++--- indra/newview/llfloaterperms.h | 3 ++- indra/newview/llviewerregion.cpp | 5 ++++- 3 files changed, 22 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index c167c03c30..f5a9bc7bb5 100644 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -97,6 +97,8 @@ U32 LLFloaterPerms::getNextOwnerPermsInverted(std::string prefix) return flags; } +static bool mCapSent = false; + LLFloaterPermsDefault::LLFloaterPermsDefault(const LLSD& seed) : LLFloater(seed) { @@ -160,12 +162,18 @@ public: } void result(const LLSD& content) { - LL_INFOS("FloaterPermsResponder") << "Set new values" << LL_ENDL; + LLFloaterPermsDefault::setCapSent(true); + LL_INFOS("FloaterPermsResponder") << "Sent default permissions to simulator" << LL_ENDL; } }; -void LLFloaterPermsDefault::updateCap() +void LLFloaterPermsDefault::updateCap(bool alwaysUpdate) { + if(!alwaysUpdate && mCapSent) + { + return; + } + std::string object_url = gAgent.getRegion()->getCapability("DefaultObjectPermissions"); if(!object_url.empty()) @@ -178,6 +186,11 @@ void LLFloaterPermsDefault::updateCap() } } +void LLFloaterPermsDefault::setCapSent(bool cap_sent) +{ + mCapSent = cap_sent; +} + void LLFloaterPermsDefault::ok() { // Changes were already applied automatically to saved settings. @@ -186,7 +199,7 @@ void LLFloaterPermsDefault::ok() // We know some setting has changed but not which one. Just in case it was a setting for // object permissions tell the server what the values are. - updateCap(); + updateCap(true); } void LLFloaterPermsDefault::cancel() diff --git a/indra/newview/llfloaterperms.h b/indra/newview/llfloaterperms.h index 5fe39a2c1b..a31d034ec8 100644 --- a/indra/newview/llfloaterperms.h +++ b/indra/newview/llfloaterperms.h @@ -59,7 +59,8 @@ public: void onClickOK(); void onClickCancel(); void onCommitCopy(const LLSD& user_data); - static void updateCap(); + static void updateCap(bool alwaysUpdate); + static void setCapSent(bool cap_sent); enum Categories { diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 7b5721cb39..68db98580f 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1487,7 +1487,10 @@ void LLViewerRegion::unpackRegionHandshake() msg->addU32("Flags", 0x0 ); msg->sendReliable(host); - LLFloaterPermsDefault::updateCap(); + // Supplying false in this call means only send the default permissions to the simulator if + // it has never been sent. Once this data is sent the simulator will pass this data to new + // simulators as the agent moves around. + LLFloaterPermsDefault::updateCap(false); } void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) -- cgit v1.2.3 From dbab46ae786166ac5d6c929e2c444d8f490edd58 Mon Sep 17 00:00:00 2001 From: Cho Date: Mon, 11 Nov 2013 23:13:01 +0000 Subject: made floater_snapshot links open the photo tab on the corresponding floater for ACME-1168 --- indra/newview/llfloaterflickr.cpp | 13 +++++++++++++ indra/newview/llfloaterflickr.h | 2 ++ indra/newview/llfloatersocial.cpp | 13 +++++++++++++ indra/newview/llfloatersocial.h | 2 ++ indra/newview/llfloatertwitter.cpp | 13 +++++++++++++ indra/newview/llfloatertwitter.h | 2 ++ indra/newview/llpanelsnapshotoptions.cpp | 21 +++++++++++++++++++++ 7 files changed, 66 insertions(+) (limited to 'indra') diff --git a/indra/newview/llfloaterflickr.cpp b/indra/newview/llfloaterflickr.cpp index 1edc61fcf6..7140b527b9 100644 --- a/indra/newview/llfloaterflickr.cpp +++ b/indra/newview/llfloaterflickr.cpp @@ -46,6 +46,7 @@ #include "llviewerregion.h" #include "llviewercontrol.h" #include "llviewermedia.h" +#include "lltabcontainer.h" static LLRegisterPanelClassWrapper t_panel_photo("llflickrphotopanel"); static LLRegisterPanelClassWrapper t_panel_account("llflickraccountpanel"); @@ -588,6 +589,18 @@ BOOL LLFloaterFlickr::postBuild() return LLFloater::postBuild(); } +void LLFloaterFlickr::showPhotoPanel() +{ + LLTabContainer* parent = dynamic_cast(mSocialPhotoPanel->getParent()); + if (!parent) + { + llwarns << "Cannot find panel container" << llendl; + return; + } + + parent->selectTabPanel(mSocialPhotoPanel); +} + // static void LLFloaterFlickr::preUpdate() { diff --git a/indra/newview/llfloaterflickr.h b/indra/newview/llfloaterflickr.h index 8cf2cd2dd6..e9005444d8 100644 --- a/indra/newview/llfloaterflickr.h +++ b/indra/newview/llfloaterflickr.h @@ -110,6 +110,8 @@ public: BOOL postBuild(); void draw(); void onCancel(); + + void showPhotoPanel(); static void preUpdate(); static void postUpdate(); diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 2a74c8e3ea..31404da7d3 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -46,6 +46,7 @@ #include "llviewerregion.h" #include "llviewercontrol.h" #include "llviewermedia.h" +#include "lltabcontainer.h" static LLRegisterPanelClassWrapper t_panel_status("llsocialstatuspanel"); static LLRegisterPanelClassWrapper t_panel_photo("llsocialphotopanel"); @@ -823,6 +824,18 @@ BOOL LLFloaterSocial::postBuild() return LLFloater::postBuild(); } +void LLFloaterSocial::showPhotoPanel() +{ + LLTabContainer* parent = dynamic_cast(mSocialPhotoPanel->getParent()); + if (!parent) + { + llwarns << "Cannot find panel container" << llendl; + return; + } + + parent->selectTabPanel(mSocialPhotoPanel); +} + // static void LLFloaterSocial::preUpdate() { diff --git a/indra/newview/llfloatersocial.h b/indra/newview/llfloatersocial.h index bbe07c9704..041ae8a268 100644 --- a/indra/newview/llfloatersocial.h +++ b/indra/newview/llfloatersocial.h @@ -150,6 +150,8 @@ public: BOOL postBuild(); void draw(); void onCancel(); + + void showPhotoPanel(); static void preUpdate(); static void postUpdate(); diff --git a/indra/newview/llfloatertwitter.cpp b/indra/newview/llfloatertwitter.cpp index 1324bd5fd8..0da0d64426 100644 --- a/indra/newview/llfloatertwitter.cpp +++ b/indra/newview/llfloatertwitter.cpp @@ -46,6 +46,7 @@ #include "llviewerregion.h" #include "llviewercontrol.h" #include "llviewermedia.h" +#include "lltabcontainer.h" static LLRegisterPanelClassWrapper t_panel_photo("lltwitterphotopanel"); static LLRegisterPanelClassWrapper t_panel_account("lltwitteraccountpanel"); @@ -565,6 +566,18 @@ BOOL LLFloaterTwitter::postBuild() return LLFloater::postBuild(); } +void LLFloaterTwitter::showPhotoPanel() +{ + LLTabContainer* parent = dynamic_cast(mSocialPhotoPanel->getParent()); + if (!parent) + { + llwarns << "Cannot find panel container" << llendl; + return; + } + + parent->selectTabPanel(mSocialPhotoPanel); +} + // static void LLFloaterTwitter::preUpdate() { diff --git a/indra/newview/llfloatertwitter.h b/indra/newview/llfloatertwitter.h index 090e01872a..12e1d41210 100644 --- a/indra/newview/llfloatertwitter.h +++ b/indra/newview/llfloatertwitter.h @@ -108,6 +108,8 @@ public: void draw(); void onCancel(); + void showPhotoPanel(); + static void preUpdate(); static void postUpdate(); diff --git a/indra/newview/llpanelsnapshotoptions.cpp b/indra/newview/llpanelsnapshotoptions.cpp index 1967c50a29..4cadd837d1 100755 --- a/indra/newview/llpanelsnapshotoptions.cpp +++ b/indra/newview/llpanelsnapshotoptions.cpp @@ -32,6 +32,9 @@ #include "llfloatersnapshot.h" // FIXME: create a snapshot model #include "llfloaterreg.h" +#include "llfloatersocial.h" +#include "llfloaterflickr.h" +#include "llfloatertwitter.h" /** * Provides several ways to save a snapshot. @@ -140,17 +143,35 @@ void LLPanelSnapshotOptions::onSaveToComputer() void LLPanelSnapshotOptions::onSendToFacebook() { LLFloaterReg::hideInstance("snapshot"); + + LLFloaterSocial* social_floater = dynamic_cast(LLFloaterReg::getInstance("social")); + if (social_floater) + { + social_floater->showPhotoPanel(); + } LLFloaterReg::showInstance("social"); } void LLPanelSnapshotOptions::onSendToTwitter() { LLFloaterReg::hideInstance("snapshot"); + + LLFloaterTwitter* twitter_floater = dynamic_cast(LLFloaterReg::getInstance("twitter")); + if (twitter_floater) + { + twitter_floater->showPhotoPanel(); + } LLFloaterReg::showInstance("twitter"); } void LLPanelSnapshotOptions::onSendToFlickr() { LLFloaterReg::hideInstance("snapshot"); + + LLFloaterFlickr* flickr_floater = dynamic_cast(LLFloaterReg::getInstance("flickr")); + if (flickr_floater) + { + flickr_floater->showPhotoPanel(); + } LLFloaterReg::showInstance("flickr"); } -- cgit v1.2.3 From 86442d1f8beae66890231c12ddc1cd9e1f1a6170 Mon Sep 17 00:00:00 2001 From: Cho Date: Tue, 12 Nov 2013 01:43:00 +0000 Subject: added Flickr and Twitter FUI buttons for ACME-1179 --- indra/newview/app_settings/commands.xml | 20 ++++++++++++++++++++ indra/newview/app_settings/toolbars.xml | 2 +- indra/newview/skins/default/xui/en/strings.xml | 4 ++++ 3 files changed, 25 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index 60c942094a..6c9b67ac0b 100755 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -226,6 +226,26 @@ is_running_function="Floater.IsOpen" is_running_parameters="social" /> + + - @@ -22,5 +21,6 @@ + diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 2b707ed84b..b24cca588e 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -3893,6 +3893,8 @@ Try enclosing path to the editor with double quotes. Search Snapshot Facebook + Flickr + Twitter Speak Camera controls Voice settings @@ -3921,6 +3923,8 @@ Try enclosing path to the editor with double quotes. Find places, events, people Take a picture Post to Facebook + Upload to Flickr + Twitter Speak with people nearby using your microphone Changing camera angle Volume controls for calls and people near you in world -- cgit v1.2.3 From a718b0d182dd35bdb01973eb3108e8b4a58a627c Mon Sep 17 00:00:00 2001 From: Cho Date: Tue, 12 Nov 2013 18:04:23 +0000 Subject: updated Flickr photo upload UI content rating text for ACME-1178 --- indra/newview/skins/default/xui/en/panel_flickr_photo.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/panel_flickr_photo.xml b/indra/newview/skins/default/xui/en/panel_flickr_photo.xml index d7d3fb6c1b..39935a7687 100644 --- a/indra/newview/skins/default/xui/en/panel_flickr_photo.xml +++ b/indra/newview/skins/default/xui/en/panel_flickr_photo.xml @@ -189,15 +189,15 @@ Use "" for multi-word tags height="21" width="250"> -- cgit v1.2.3 From 9946965c4decd59793adcaa39c70dbf9778d61dd Mon Sep 17 00:00:00 2001 From: Cho Date: Tue, 12 Nov 2013 20:07:54 +0000 Subject: replaced Flickr and Twitter FUI icons for ACME-1181 --- indra/newview/app_settings/commands.xml | 4 ++-- indra/newview/skins/default/textures/textures.xml | 2 ++ .../skins/default/textures/toolbar_icons/flickr.png | Bin 0 -> 15530 bytes .../skins/default/textures/toolbar_icons/twitter.png | Bin 0 -> 16051 bytes 4 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 indra/newview/skins/default/textures/toolbar_icons/flickr.png create mode 100644 indra/newview/skins/default/textures/toolbar_icons/twitter.png (limited to 'indra') diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index 6c9b67ac0b..f4e9cc0136 100755 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -228,7 +228,7 @@ /> + + diff --git a/indra/newview/skins/default/textures/toolbar_icons/flickr.png b/indra/newview/skins/default/textures/toolbar_icons/flickr.png new file mode 100644 index 0000000000..7fce9f0df2 Binary files /dev/null and b/indra/newview/skins/default/textures/toolbar_icons/flickr.png differ diff --git a/indra/newview/skins/default/textures/toolbar_icons/twitter.png b/indra/newview/skins/default/textures/toolbar_icons/twitter.png new file mode 100644 index 0000000000..a99c490887 Binary files /dev/null and b/indra/newview/skins/default/textures/toolbar_icons/twitter.png differ -- cgit v1.2.3 From 9e6dd1811e890d6d5e23059c67f13d9960e56366 Mon Sep 17 00:00:00 2001 From: Cho Date: Tue, 12 Nov 2013 22:18:05 +0000 Subject: implemented Twitter character limits for status text box for ACME-1171 and ACME-1172 --- indra/newview/llfloatertwitter.cpp | 13 +++++++++++++ indra/newview/skins/default/xui/en/panel_twitter_photo.xml | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llfloatertwitter.cpp b/indra/newview/llfloatertwitter.cpp index 0da0d64426..46cad7ec45 100644 --- a/indra/newview/llfloatertwitter.cpp +++ b/indra/newview/llfloatertwitter.cpp @@ -47,6 +47,7 @@ #include "llviewercontrol.h" #include "llviewermedia.h" #include "lltabcontainer.h" +#include "lltexteditor.h" static LLRegisterPanelClassWrapper t_panel_photo("lltwitterphotopanel"); static LLRegisterPanelClassWrapper t_panel_account("lltwitteraccountpanel"); @@ -112,6 +113,18 @@ void LLTwitterPhotoPanel::draw() bool add_photo = mPhotoCheckbox->getValue().asBoolean(); + // Restrict the status text length to Twitter's character limit + LLTextEditor* status_text_box = dynamic_cast(mStatusTextBox); + if (status_text_box) + { + int max_status_length = add_photo ? 119 : 140; + status_text_box->setMaxTextLength(max_status_length); + if (status_text_box->getText().length() > max_status_length) + { + status_text_box->setText(status_text_box->getText().substr(0, max_status_length)); + } + } + // Display the preview if one is available if (previewp && previewp->getThumbnailImage()) { diff --git a/indra/newview/skins/default/xui/en/panel_twitter_photo.xml b/indra/newview/skins/default/xui/en/panel_twitter_photo.xml index 84206c608b..fd2bffe675 100644 --- a/indra/newview/skins/default/xui/en/panel_twitter_photo.xml +++ b/indra/newview/skins/default/xui/en/panel_twitter_photo.xml @@ -31,7 +31,7 @@ width="250" left="9" length="1" - max_length="700" + max_length="119" name="photo_status" type="string" word_wrap="true"> -- cgit v1.2.3 From 19c1be0e055bd06cb3083a9c9d126a4907a90788 Mon Sep 17 00:00:00 2001 From: Cho Date: Tue, 12 Nov 2013 22:37:24 +0000 Subject: replaced Flickr title text_editor to a line_editor for ACME-1169 --- indra/newview/skins/default/xui/en/panel_flickr_photo.xml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/panel_flickr_photo.xml b/indra/newview/skins/default/xui/en/panel_flickr_photo.xml index 39935a7687..b3af271f34 100644 --- a/indra/newview/skins/default/xui/en/panel_flickr_photo.xml +++ b/indra/newview/skins/default/xui/en/panel_flickr_photo.xml @@ -102,7 +102,7 @@ type="string"> Title: - - + type="string"> + Date: Wed, 13 Nov 2013 18:44:33 +0000 Subject: changed Twitter photo character limit to 100 just to be safe, and switched to use cap server for Flickr and Twitter service --- indra/newview/llflickrconnect.cpp | 4 ++-- indra/newview/llfloaterflickr.cpp | 4 +++- indra/newview/llfloatertwitter.cpp | 2 +- indra/newview/lltwitterconnect.cpp | 4 ++-- indra/newview/skins/default/xui/en/panel_twitter_photo.xml | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) (limited to 'indra') diff --git a/indra/newview/llflickrconnect.cpp b/indra/newview/llflickrconnect.cpp index 3da3ef22b2..3a21933b63 100644 --- a/indra/newview/llflickrconnect.cpp +++ b/indra/newview/llflickrconnect.cpp @@ -296,8 +296,8 @@ std::string LLFlickrConnect::getFlickrConnectURL(const std::string& route, bool LLViewerRegion *regionp = gAgent.getRegion(); if (regionp) { - url = "http://pdp15.lindenlab.com/flickr/agent/" + gAgentID.asString(); // TEMPORARY FOR TESTING - CHO - //url = regionp->getCapability("FlickrConnect"); + //url = "http://pdp15.lindenlab.com/flickr/agent/" + gAgentID.asString(); // TEMPORARY FOR TESTING - CHO + url = regionp->getCapability("FlickrConnect"); url += route; if (include_read_from_master && mReadFromMaster) diff --git a/indra/newview/llfloaterflickr.cpp b/indra/newview/llfloaterflickr.cpp index 7140b527b9..0bfbd02a04 100644 --- a/indra/newview/llfloaterflickr.cpp +++ b/indra/newview/llfloaterflickr.cpp @@ -261,11 +261,13 @@ void LLFlickrPhotoPanel::sendPhoto() // Add query parameters so Google Analytics can track incoming clicks! slurl_string += DEFAULT_PHOTO_QUERY_PARAMETERS; + slurl_string = "VISIT THIS LOCATION"; + // Add it to the description (pretty crude, but we don't have a better option with photos) if (description.empty()) description = slurl_string; else - description = description + " " + slurl_string; + description = description + "\n\n" + slurl_string; } // Get the content rating diff --git a/indra/newview/llfloatertwitter.cpp b/indra/newview/llfloatertwitter.cpp index 46cad7ec45..6f8ad109c6 100644 --- a/indra/newview/llfloatertwitter.cpp +++ b/indra/newview/llfloatertwitter.cpp @@ -117,7 +117,7 @@ void LLTwitterPhotoPanel::draw() LLTextEditor* status_text_box = dynamic_cast(mStatusTextBox); if (status_text_box) { - int max_status_length = add_photo ? 119 : 140; + int max_status_length = add_photo ? 100 : 140; status_text_box->setMaxTextLength(max_status_length); if (status_text_box->getText().length() > max_status_length) { diff --git a/indra/newview/lltwitterconnect.cpp b/indra/newview/lltwitterconnect.cpp index fe45d3e4d0..e015867df2 100644 --- a/indra/newview/lltwitterconnect.cpp +++ b/indra/newview/lltwitterconnect.cpp @@ -296,8 +296,8 @@ std::string LLTwitterConnect::getTwitterConnectURL(const std::string& route, boo LLViewerRegion *regionp = gAgent.getRegion(); if (regionp) { - url = "http://pdp15.lindenlab.com/twitter/agent/" + gAgentID.asString(); // TEMPORARY FOR TESTING - CHO - //url = regionp->getCapability("TwitterConnect"); + //url = "http://pdp15.lindenlab.com/twitter/agent/" + gAgentID.asString(); // TEMPORARY FOR TESTING - CHO + url = regionp->getCapability("TwitterConnect"); url += route; if (include_read_from_master && mReadFromMaster) diff --git a/indra/newview/skins/default/xui/en/panel_twitter_photo.xml b/indra/newview/skins/default/xui/en/panel_twitter_photo.xml index fd2bffe675..8e2412c84e 100644 --- a/indra/newview/skins/default/xui/en/panel_twitter_photo.xml +++ b/indra/newview/skins/default/xui/en/panel_twitter_photo.xml @@ -31,7 +31,7 @@ width="250" left="9" length="1" - max_length="119" + max_length="140" name="photo_status" type="string" word_wrap="true"> -- cgit v1.2.3 From 377dd51688dea6bd83f0a9b70be12528f8a891c3 Mon Sep 17 00:00:00 2001 From: Cho Date: Wed, 13 Nov 2013 20:32:06 +0000 Subject: added fancier link description text and switched back to using dev servers instead of caps for Flickr and Twitter --- indra/newview/llflickrconnect.cpp | 4 ++-- indra/newview/llfloaterflickr.cpp | 3 ++- indra/newview/lltwitterconnect.cpp | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/llflickrconnect.cpp b/indra/newview/llflickrconnect.cpp index 3a21933b63..3da3ef22b2 100644 --- a/indra/newview/llflickrconnect.cpp +++ b/indra/newview/llflickrconnect.cpp @@ -296,8 +296,8 @@ std::string LLFlickrConnect::getFlickrConnectURL(const std::string& route, bool LLViewerRegion *regionp = gAgent.getRegion(); if (regionp) { - //url = "http://pdp15.lindenlab.com/flickr/agent/" + gAgentID.asString(); // TEMPORARY FOR TESTING - CHO - url = regionp->getCapability("FlickrConnect"); + url = "http://pdp15.lindenlab.com/flickr/agent/" + gAgentID.asString(); // TEMPORARY FOR TESTING - CHO + //url = regionp->getCapability("FlickrConnect"); url += route; if (include_read_from_master && mReadFromMaster) diff --git a/indra/newview/llfloaterflickr.cpp b/indra/newview/llfloaterflickr.cpp index 0bfbd02a04..5a05c47416 100644 --- a/indra/newview/llfloaterflickr.cpp +++ b/indra/newview/llfloaterflickr.cpp @@ -53,6 +53,7 @@ static LLRegisterPanelClassWrapper t_panel_account("llflic const S32 MAX_POSTCARD_DATASIZE = 1024 * 1024; // one megabyte const std::string DEFAULT_PHOTO_QUERY_PARAMETERS = "?sourceid=slshare_photo&utm_source=flickr&utm_medium=photo&utm_campaign=slshare"; +const std::string DEFAULT_PHOTO_LINK_TEXT = "VISIT THIS LOCATION NOW"; /////////////////////////// //LLFlickrPhotoPanel/////// @@ -261,7 +262,7 @@ void LLFlickrPhotoPanel::sendPhoto() // Add query parameters so Google Analytics can track incoming clicks! slurl_string += DEFAULT_PHOTO_QUERY_PARAMETERS; - slurl_string = "VISIT THIS LOCATION"; + slurl_string = "" + DEFAULT_PHOTO_LINK_TEXT + ""; // Add it to the description (pretty crude, but we don't have a better option with photos) if (description.empty()) diff --git a/indra/newview/lltwitterconnect.cpp b/indra/newview/lltwitterconnect.cpp index e015867df2..fe45d3e4d0 100644 --- a/indra/newview/lltwitterconnect.cpp +++ b/indra/newview/lltwitterconnect.cpp @@ -296,8 +296,8 @@ std::string LLTwitterConnect::getTwitterConnectURL(const std::string& route, boo LLViewerRegion *regionp = gAgent.getRegion(); if (regionp) { - //url = "http://pdp15.lindenlab.com/twitter/agent/" + gAgentID.asString(); // TEMPORARY FOR TESTING - CHO - url = regionp->getCapability("TwitterConnect"); + url = "http://pdp15.lindenlab.com/twitter/agent/" + gAgentID.asString(); // TEMPORARY FOR TESTING - CHO + //url = regionp->getCapability("TwitterConnect"); url += route; if (include_read_from_master && mReadFromMaster) -- cgit v1.2.3 From b267f6754efd2c77042fd4a3f6d2397eac461ce2 Mon Sep 17 00:00:00 2001 From: Cho Date: Wed, 13 Nov 2013 20:39:07 +0000 Subject: included default secondlife tag in Flickr photo upload for ACME-1184 --- indra/newview/llfloaterflickr.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llfloaterflickr.cpp b/indra/newview/llfloaterflickr.cpp index 5a05c47416..97361643ed 100644 --- a/indra/newview/llfloaterflickr.cpp +++ b/indra/newview/llfloaterflickr.cpp @@ -54,6 +54,7 @@ static LLRegisterPanelClassWrapper t_panel_account("llflic const S32 MAX_POSTCARD_DATASIZE = 1024 * 1024; // one megabyte const std::string DEFAULT_PHOTO_QUERY_PARAMETERS = "?sourceid=slshare_photo&utm_source=flickr&utm_medium=photo&utm_campaign=slshare"; const std::string DEFAULT_PHOTO_LINK_TEXT = "VISIT THIS LOCATION NOW"; +const std::string DEFAULT_TAG_TEXT = "secondlife "; /////////////////////////// //LLFlickrPhotoPanel/////// @@ -98,6 +99,7 @@ BOOL LLFlickrPhotoPanel::postBuild() mDescriptionTextBox = getChild("photo_description"); mLocationCheckbox = getChild("add_location_cb"); mTagsTextBox = getChild("photo_tags"); + mTagsTextBox->setValue(DEFAULT_TAG_TEXT); mRatingComboBox = getChild("rating_combobox"); mPostButton = getChild("post_photo_btn"); mCancelButton = getChild("cancel_photo_btn"); @@ -287,7 +289,7 @@ void LLFlickrPhotoPanel::clearAndClose() { mTitleTextBox->setValue(""); mDescriptionTextBox->setValue(""); - mTagsTextBox->setValue(""); + mTagsTextBox->setValue(DEFAULT_TAG_TEXT); LLFloater* floater = getParentByType(); if (floater) -- cgit v1.2.3 From 758f656100406015bc8b27284670088decbbfabb Mon Sep 17 00:00:00 2001 From: Cho Date: Wed, 13 Nov 2013 21:38:19 +0000 Subject: made Twitter status text truncate and untruncate for ACME-1183 --- indra/newview/llfloatertwitter.cpp | 11 ++++++++++- indra/newview/llfloatertwitter.h | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llfloatertwitter.cpp b/indra/newview/llfloatertwitter.cpp index 6f8ad109c6..06d0fb5542 100644 --- a/indra/newview/llfloatertwitter.cpp +++ b/indra/newview/llfloatertwitter.cpp @@ -119,9 +119,18 @@ void LLTwitterPhotoPanel::draw() { int max_status_length = add_photo ? 100 : 140; status_text_box->setMaxTextLength(max_status_length); + if (!add_photo) + { + if (mOldStatusText.length() > status_text_box->getText().length() && status_text_box->getText() == mOldStatusText.substr(0, status_text_box->getText().length())) + { + status_text_box->setText(mOldStatusText); + } + mOldStatusText = ""; + } if (status_text_box->getText().length() > max_status_length) { - status_text_box->setText(status_text_box->getText().substr(0, max_status_length)); + mOldStatusText = status_text_box->getText(); + status_text_box->setText(mOldStatusText.substr(0, max_status_length)); } } diff --git a/indra/newview/llfloatertwitter.h b/indra/newview/llfloatertwitter.h index 12e1d41210..686e167b1f 100644 --- a/indra/newview/llfloatertwitter.h +++ b/indra/newview/llfloatertwitter.h @@ -70,6 +70,8 @@ private: LLUICtrl * mPhotoCheckbox; LLUICtrl * mPostButton; LLUICtrl* mCancelButton; + + std::string mOldStatusText; }; class LLTwitterAccountPanel : public LLPanel -- cgit v1.2.3 From 08e0b94ff043b77d96609d9d8f395c0acf2640d0 Mon Sep 17 00:00:00 2001 From: Cho Date: Thu, 14 Nov 2013 18:48:13 +0000 Subject: changed capitalization of Flickr SLURL link text to 'Visit this location now' for ACME-1186 --- indra/newview/llfloaterflickr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llfloaterflickr.cpp b/indra/newview/llfloaterflickr.cpp index 97361643ed..61ebe563a3 100644 --- a/indra/newview/llfloaterflickr.cpp +++ b/indra/newview/llfloaterflickr.cpp @@ -53,7 +53,7 @@ static LLRegisterPanelClassWrapper t_panel_account("llflic const S32 MAX_POSTCARD_DATASIZE = 1024 * 1024; // one megabyte const std::string DEFAULT_PHOTO_QUERY_PARAMETERS = "?sourceid=slshare_photo&utm_source=flickr&utm_medium=photo&utm_campaign=slshare"; -const std::string DEFAULT_PHOTO_LINK_TEXT = "VISIT THIS LOCATION NOW"; +const std::string DEFAULT_PHOTO_LINK_TEXT = "Visit this location now"; const std::string DEFAULT_TAG_TEXT = "secondlife "; /////////////////////////// -- cgit v1.2.3 From df78262f0ac19c888bb3416da0df37ece77729dc Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Fri, 15 Nov 2013 23:17:06 +0000 Subject: Fixing the stupid mistake that prevented this from compiling. Thanks to Jonathan Yap for spotting it. --- indra/newview/llpreviewscript.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 19aab8f383..c662343238 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -407,8 +407,11 @@ BOOL LLScriptEdCore::postBuild() initMenu(); + // Intialise keyword highlighting for the current simulator's version of LSL onRegionChangeInitialiseKeywords(); - //LLEnvManagerNew::getInstance()->setRegionChangeCallback(boost::bind(&LLScriptEdCore::onRegionChangeInitialiseKeywords(), this)); + // Set up a callback for region changes, so that highlighting is updated to the new region's version of LSL + LLEnvManagerNew::getInstance()->setRegionChangeCallback(boost::bind(&LLScriptEdCore::onRegionChangeInitialiseKeywords, this)); + return TRUE; } -- cgit v1.2.3 From 6b451ffdd6b1c75bd363864e48fbcf9b045dbd67 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 18 Nov 2013 13:50:49 -0500 Subject: add license header --- indra/newview/llsyntaxid.h | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llsyntaxid.h b/indra/newview/llsyntaxid.h index 472e88744f..a79a19be91 100644 --- a/indra/newview/llsyntaxid.h +++ b/indra/newview/llsyntaxid.h @@ -1,4 +1,29 @@ - +/** + * @file llagentdata.h + * @brief Contains commonly used agent data + * @author Ima Mechanique + * + * $LicenseInfo:firstyear=2013&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2013, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ #ifndef LLSYSNTAXIDLSL_H #define LLSYSNTAXIDLSL_H -- cgit v1.2.3 From b7edc965bc77ab21e9a1e3f6b424299a50053529 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 19 Nov 2013 16:32:41 -0500 Subject: STORM-68 Place initial call to send cap in new, better location. Make processing of debug setting names a little more elegant. --- indra/newview/llagent.cpp | 3 +++ indra/newview/llfloaterperms.cpp | 50 ++++++++++++++++++++++------------------ indra/newview/llfloaterperms.h | 5 ++-- indra/newview/llviewerregion.cpp | 1 - 4 files changed, 34 insertions(+), 25 deletions(-) (limited to 'indra') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 3870a3be2e..f9301b61a1 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -737,6 +737,9 @@ void LLAgent::setRegion(LLViewerRegion *regionp) // Update all of the regions. LLWorld::getInstance()->updateAgentOffset(mAgentOriginGlobal); + + // Send default object permissions to simulator + LLFloaterPermsDefault::updateCap(false); } // Pass new region along to metrics components that care about this level of detail. diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index f5a9bc7bb5..dc4969f5e6 100644 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -1,7 +1,7 @@ /** * @file llfloaterperms.cpp * @brief Asset creation permission preferences. - * @author Coco + * @author Jonathan Yap * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code @@ -43,7 +43,7 @@ LLFloaterPerms::LLFloaterPerms(const LLSD& seed) BOOL LLFloaterPerms::postBuild() { - return true; + return TRUE; } //static @@ -107,17 +107,23 @@ LLFloaterPermsDefault::LLFloaterPermsDefault(const LLSD& seed) mCommitCallbackRegistrar.add("PermsDefault.Cancel", boost::bind(&LLFloaterPermsDefault::onClickCancel, this)); } + +// String equivalents of enum Categories - initialization order must match enum order! +const std::string LLFloaterPermsDefault::sCategoryNames[CAT_LAST] = +{ + "Objects", + "Uploads", + "Scripts", + "Notecards", + "Gestures", + "Wearables" +}; + + BOOL LLFloaterPermsDefault::postBuild() { mCloseSignal.connect(boost::bind(&LLFloaterPermsDefault::cancel, this)); - category_names[CAT_OBJECTS] = "Objects"; - category_names[CAT_UPLOADS] = "Uploads"; - category_names[CAT_SCRIPTS] = "Scripts"; - category_names[CAT_NOTECARDS] = "Notecards"; - category_names[CAT_GESTURES] = "Gestures"; - category_names[CAT_WEARABLES] = "Wearables"; - refresh(); return true; @@ -179,9 +185,9 @@ void LLFloaterPermsDefault::updateCap(bool alwaysUpdate) if(!object_url.empty()) { LLSD report = LLSD::emptyMap(); - report["Group"] = (LLSD::Integer)LLFloaterPerms::getGroupPerms("Objects"); - report["Everyone"] = (LLSD::Integer)LLFloaterPerms::getEveryonePerms("Objects"); - report["NextOwner"] = (LLSD::Integer)LLFloaterPerms::getNextOwnerPerms("Objects"); + report["Group"] = (LLSD::Integer)LLFloaterPerms::getGroupPerms(sCategoryNames[CAT_OBJECTS]); + report["Everyone"] = (LLSD::Integer)LLFloaterPerms::getEveryonePerms(sCategoryNames[CAT_OBJECTS]); + report["NextOwner"] = (LLSD::Integer)LLFloaterPerms::getNextOwnerPerms(sCategoryNames[CAT_OBJECTS]); LLHTTPClient::post(object_url, report, new LLFloaterPermsResponder()); } } @@ -206,11 +212,11 @@ void LLFloaterPermsDefault::cancel() { for (U32 iter = CAT_OBJECTS; iter < CAT_LAST; iter++) { - gSavedSettings.setBOOL(category_names[iter]+"NextOwnerCopy", mNextOwnerCopy[iter]); - gSavedSettings.setBOOL(category_names[iter]+"NextOwnerModify", mNextOwnerModify[iter]); - gSavedSettings.setBOOL(category_names[iter]+"NextOwnerTransfer", mNextOwnerTransfer[iter]); - gSavedSettings.setBOOL(category_names[iter]+"ShareWithGroup", mShareWithGroup[iter]); - gSavedSettings.setBOOL(category_names[iter]+"EveryoneCopy", mEveryoneCopy[iter]); + gSavedSettings.setBOOL(sCategoryNames[iter]+"NextOwnerCopy", mNextOwnerCopy[iter]); + gSavedSettings.setBOOL(sCategoryNames[iter]+"NextOwnerModify", mNextOwnerModify[iter]); + gSavedSettings.setBOOL(sCategoryNames[iter]+"NextOwnerTransfer", mNextOwnerTransfer[iter]); + gSavedSettings.setBOOL(sCategoryNames[iter]+"ShareWithGroup", mShareWithGroup[iter]); + gSavedSettings.setBOOL(sCategoryNames[iter]+"EveryoneCopy", mEveryoneCopy[iter]); } } @@ -218,10 +224,10 @@ void LLFloaterPermsDefault::refresh() { for (U32 iter = CAT_OBJECTS; iter < CAT_LAST; iter++) { - mShareWithGroup[iter] = gSavedSettings.getBOOL(category_names[iter]+"ShareWithGroup"); - mEveryoneCopy[iter] = gSavedSettings.getBOOL(category_names[iter]+"EveryoneCopy"); - mNextOwnerCopy[iter] = gSavedSettings.getBOOL(category_names[iter]+"NextOwnerCopy"); - mNextOwnerModify[iter] = gSavedSettings.getBOOL(category_names[iter]+"NextOwnerModify"); - mNextOwnerTransfer[iter] = gSavedSettings.getBOOL(category_names[iter]+"NextOwnerTransfer"); + mShareWithGroup[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"ShareWithGroup"); + mEveryoneCopy[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"EveryoneCopy"); + mNextOwnerCopy[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"NextOwnerCopy"); + mNextOwnerModify[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"NextOwnerModify"); + mNextOwnerTransfer[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"NextOwnerTransfer"); } } diff --git a/indra/newview/llfloaterperms.h b/indra/newview/llfloaterperms.h index a31d034ec8..b4b5d58aa5 100644 --- a/indra/newview/llfloaterperms.h +++ b/indra/newview/llfloaterperms.h @@ -1,7 +1,7 @@ /** * @file llfloaterperms.h * @brief Asset creation permission preferences. - * @author Coco + * @author Jonathan Yap * * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code @@ -62,6 +62,7 @@ public: static void updateCap(bool alwaysUpdate); static void setCapSent(bool cap_sent); +// Update instantiation of sCategoryNames in the .cpp file to match if you change this! enum Categories { CAT_OBJECTS, @@ -77,7 +78,7 @@ private: LLFloaterPermsDefault(const LLSD& seed); void refresh(); - std::string category_names[CAT_LAST]; + static const std::string sCategoryNames[CAT_LAST]; // cached values only for implementing cancel. bool mShareWithGroup[CAT_LAST]; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 68db98580f..21e0db46c9 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1490,7 +1490,6 @@ void LLViewerRegion::unpackRegionHandshake() // Supplying false in this call means only send the default permissions to the simulator if // it has never been sent. Once this data is sent the simulator will pass this data to new // simulators as the agent moves around. - LLFloaterPermsDefault::updateCap(false); } void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) -- cgit v1.2.3 From 176901422f0122dad8d1e4e423d0bc19e9e4ad8a Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Wed, 20 Nov 2013 10:21:41 -0500 Subject: STORM-68 Reapply changes to inventory processing lost in the merge. Move call to updateCap back to where it was. The place it was moved to was too early in the login sequence and was causing a crash. --- indra/newview/llagent.cpp | 3 -- indra/newview/llfloaterperms.cpp | 3 ++ indra/newview/llviewerinventory.cpp | 99 ++++++++++++++++++++++++++++++------- indra/newview/llviewerinventory.h | 2 + indra/newview/llviewerregion.cpp | 1 + 5 files changed, 88 insertions(+), 20 deletions(-) (limited to 'indra') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 7d2b4f6269..d210456993 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -898,9 +898,6 @@ void LLAgent::setRegion(LLViewerRegion *regionp) // Update all of the regions. LLWorld::getInstance()->updateAgentOffset(mAgentOriginGlobal); - - // Send default object permissions to simulator - LLFloaterPermsDefault::updateCap(false); } // Pass new region along to metrics components that care about this level of detail. diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index dc4969f5e6..4923420a3e 100755 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -175,15 +175,18 @@ public: void LLFloaterPermsDefault::updateCap(bool alwaysUpdate) { +llwarns << "DBG start" << llendl; if(!alwaysUpdate && mCapSent) { return; } +llwarns << "DBG getRegion" << llendl; std::string object_url = gAgent.getRegion()->getCapability("DefaultObjectPermissions"); if(!object_url.empty()) { +llwarns << "DBG post" << llendl; LLSD report = LLSD::emptyMap(); report["Group"] = (LLSD::Integer)LLFloaterPerms::getGroupPerms(sCategoryNames[CAT_OBJECTS]); report["Everyone"] = (LLSD::Integer)LLFloaterPerms::getEveryonePerms(sCategoryNames[CAT_OBJECTS]); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index fff9821e86..5e3df16c38 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -65,6 +65,7 @@ #include "llavataractions.h" #include "lllogininstance.h" #include "llfavoritesbar.h" +#include "llfloaterperms.h" // Two do-nothing ops for use in callbacks. void no_op_inventory_func(const LLUUID&) {} @@ -989,6 +990,24 @@ void activate_gesture_cb(const LLUUID& inv_item) LLGestureMgr::instance().activateGesture(inv_item); } +void create_script_cb(const LLUUID& inv_item) +{ + if (inv_item.isNull()) + return; + + LLViewerInventoryItem* item = gInventory.getItem(inv_item); + if (!item) return; + + LLPermissions perm = item->getPermissions(); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Scripts")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Scripts")); + + item->setPermissions(perm); + + gInventory.updateItem(item); + gInventory.notifyObservers(); +} + void create_gesture_cb(const LLUUID& inv_item) { if (inv_item.isNull()) @@ -998,6 +1017,13 @@ void create_gesture_cb(const LLUUID& inv_item) LLViewerInventoryItem* item = gInventory.getItem(inv_item); if (!item) return; + + LLPermissions perm = item->getPermissions(); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Gestures")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Gestures")); + + item->setPermissions(perm); + gInventory.updateItem(item); gInventory.notifyObservers(); @@ -1007,6 +1033,24 @@ void create_gesture_cb(const LLUUID& inv_item) } +void create_notecard_cb(const LLUUID& inv_item) +{ + if (inv_item.isNull()) + return; + + LLViewerInventoryItem* item = gInventory.getItem(inv_item); + if (!item) return; + + LLPermissions perm = item->getPermissions(); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Notecards")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Notecards")); + + item->setPermissions(perm); + + gInventory.updateItem(item); + gInventory.notifyObservers(); +} + LLInventoryCallbackManager gInventoryCallbacks; void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id, @@ -1260,22 +1304,43 @@ void create_new_item(const std::string& name, LLViewerAssetType::generateDescriptionFor(asset_type, desc); next_owner_perm = (next_owner_perm) ? next_owner_perm : PERM_MOVE | PERM_TRANSFER; - - if (inv_type == LLInventoryType::IT_GESTURE) - { - LLPointer cb = new LLBoostFuncInventoryCallback(create_gesture_cb); - create_inventory_item(gAgent.getID(), gAgent.getSessionID(), - parent_id, LLTransactionID::tnull, name, desc, asset_type, inv_type, - NOT_WEARABLE, next_owner_perm, cb); - } - else + LLPointer cb = NULL; + + switch (inv_type) { - LLPointer cb = NULL; - create_inventory_item(gAgent.getID(), gAgent.getSessionID(), - parent_id, LLTransactionID::tnull, name, desc, asset_type, inv_type, - NOT_WEARABLE, next_owner_perm, cb); + case LLInventoryType::IT_LSL: + { + cb = new LLBoostFuncInventoryCallback(create_script_cb); + next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Scripts"); + break; + } + + case LLInventoryType::IT_GESTURE: + { + cb = new LLBoostFuncInventoryCallback(create_gesture_cb); + next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Gestures"); + break; + } + + case LLInventoryType::IT_NOTECARD: + { + cb = new LLBoostFuncInventoryCallback(create_notecard_cb); + next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Notecards"); + break; + } } - + + create_inventory_item(gAgent.getID(), + gAgent.getSessionID(), + parent_id, + LLTransactionID::tnull, + name, + desc, + asset_type, + inv_type, + NOT_WEARABLE, + next_owner_perm, + cb); } const std::string NEW_LSL_NAME = "New Script"; // *TODO:Translate? (probably not) @@ -1316,7 +1381,7 @@ void menu_create_inventory_item(LLInventoryPanel* panel, LLFolderBridge *bridge, parent_id, LLAssetType::AT_LSL_TEXT, LLInventoryType::IT_LSL, - PERM_MOVE | PERM_TRANSFER); + PERM_MOVE | PERM_TRANSFER); // overridden in create_new_item } else if ("notecard" == type_name) { @@ -1325,7 +1390,7 @@ void menu_create_inventory_item(LLInventoryPanel* panel, LLFolderBridge *bridge, parent_id, LLAssetType::AT_NOTECARD, LLInventoryType::IT_NOTECARD, - PERM_ALL); + PERM_ALL); // overridden in create_new_item } else if ("gesture" == type_name) { @@ -1334,7 +1399,7 @@ void menu_create_inventory_item(LLInventoryPanel* panel, LLFolderBridge *bridge, parent_id, LLAssetType::AT_GESTURE, LLInventoryType::IT_GESTURE, - PERM_ALL); + PERM_ALL); // overridden in create_new_item } else { diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index ab19a12014..dc2fdb8c8d 100755 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -249,7 +249,9 @@ void rez_attachment_cb(const LLUUID& inv_item, LLViewerJointAttachment *attachme void activate_gesture_cb(const LLUUID& inv_item); +void create_script_cb(const LLUUID& inv_item); void create_gesture_cb(const LLUUID& inv_item); +void create_notecard_cb(const LLUUID& inv_item); class AddFavoriteLandmarkCallback : public LLInventoryCallback { diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index c6e67355c3..dd88c5b846 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1577,6 +1577,7 @@ void LLViewerRegion::unpackRegionHandshake() // Supplying false in this call means only send the default permissions to the simulator if // it has never been sent. Once this data is sent the simulator will pass this data to new // simulators as the agent moves around. + LLFloaterPermsDefault::updateCap(false); } void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) -- cgit v1.2.3 From aec2fde7a4c3114b9081fa3c90f891f8337595ad Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Wed, 20 Nov 2013 14:47:00 -0500 Subject: STORM-68 Added default clause to switch statement to try to fix linux compile error. --- indra/newview/llviewerinventory.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 5e3df16c38..c52505e4b3 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1328,6 +1328,8 @@ void create_new_item(const std::string& name, next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Notecards"); break; } + default: + break; } create_inventory_item(gAgent.getID(), -- cgit v1.2.3 From 7e749052ca05024ed2ca4c8a799d7ddaf64191d9 Mon Sep 17 00:00:00 2001 From: "niel@mint-32" Date: Wed, 20 Nov 2013 23:59:37 +0000 Subject: storm-1831 Expanding/fixing copyright header --- indra/newview/llsyntaxid.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llsyntaxid.h b/indra/newview/llsyntaxid.h index a79a19be91..3a711d7460 100644 --- a/indra/newview/llsyntaxid.h +++ b/indra/newview/llsyntaxid.h @@ -1,6 +1,7 @@ /** - * @file llagentdata.h - * @brief Contains commonly used agent data + * @file llsyntaxid.h + * @brief Contains methods to access the LSLSyntaxId feature and LSLSyntax capability + * to use the appropriate syntax file for the current region's LSL version. * @author Ima Mechanique * * $LicenseInfo:firstyear=2013&license=viewerlgpl$ -- cgit v1.2.3 From 25c7ea0532b6316639b7efbbfb9f10bfe7e38635 Mon Sep 17 00:00:00 2001 From: "niel@mint-32" Date: Thu, 21 Nov 2013 00:02:15 +0000 Subject: storm-1831 Replacing old region changed callback setup with the shiny new one. --- indra/newview/llpreviewscript.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index c662343238..362836b5b9 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -410,7 +410,7 @@ BOOL LLScriptEdCore::postBuild() // Intialise keyword highlighting for the current simulator's version of LSL onRegionChangeInitialiseKeywords(); // Set up a callback for region changes, so that highlighting is updated to the new region's version of LSL - LLEnvManagerNew::getInstance()->setRegionChangeCallback(boost::bind(&LLScriptEdCore::onRegionChangeInitialiseKeywords, this)); + gAgent.addRegionChangedCallback(boost::bind(&LLScriptEdCore::onRegionChangeInitialiseKeywords, this)); return TRUE; } -- cgit v1.2.3 From 483c829aa370dabfc18cbba770a347b25ec80010 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Thu, 21 Nov 2013 02:37:40 +0000 Subject: storm-1831 Removing am uneccessary message. --- indra/newview/llsyntaxid.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra') diff --git a/indra/newview/llsyntaxid.cpp b/indra/newview/llsyntaxid.cpp index 66e0777525..e09b083d9c 100644 --- a/indra/newview/llsyntaxid.cpp +++ b/indra/newview/llsyntaxid.cpp @@ -223,10 +223,6 @@ void LLSyntaxIdLSL::initialise() buildFullFileSpec(); if ( !mSyntaxIdNew.isNull() ) { - LL_INFOS("LSLSyntax") - << "We have an ID for the version, processing it!" - << LL_ENDL; - if ( !gDirUtilp->fileExists(mFullFileSpec) ) { // Does not exist, so fetch it from the capability fetchKeywordsFile(); -- cgit v1.2.3 From b5eb40cfd4849685274f9545b22becd90ba7c858 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Thu, 21 Nov 2013 19:28:35 +0000 Subject: storm-1831 Cleaning up output messages SyntaxLSL. --- indra/newview/llsyntaxid.cpp | 55 ++++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 32 deletions(-) (limited to 'indra') diff --git a/indra/newview/llsyntaxid.cpp b/indra/newview/llsyntaxid.cpp index e09b083d9c..605d49b175 100644 --- a/indra/newview/llsyntaxid.cpp +++ b/indra/newview/llsyntaxid.cpp @@ -41,7 +41,7 @@ fetchKeywordsFileResponder::fetchKeywordsFileResponder(std::string filespec) { mFileSpec = filespec; - LL_WARNS("LSLSyntax") + LL_INFOS("SyntaxLSL") << "Instantiating with file saving to: '" << filespec << "'" << LL_ENDL; } @@ -50,11 +50,9 @@ void fetchKeywordsFileResponder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - LL_WARNS("LSLSyntax") + LL_ERRS("SyntaxLSL") << "fetchKeywordsFileResponder error [status:" - << status - << "]: " - << content + << status << "]: " << content << LL_ENDL; } @@ -71,7 +69,7 @@ void fetchKeywordsFileResponder::result(const LLSD& content_ref) file.write(xml.c_str(), str.str().size()); file.close(); - LL_WARNS("LSLSyntax") + LL_INFOS("SyntaxLSL") << "Syntax file received, saving as: '" << mFileSpec << "'" << LL_ENDL; } @@ -131,8 +129,8 @@ bool LLSyntaxIdLSL::checkSyntaxIdChanged() { if (!region->capabilitiesReceived()) { // Shouldn't be possible, but experience shows that it may be needed. - LL_WARNS("LSLSyntax") - << "region '" << region->getName() + LL_WARNS("SyntaxLSL") + << "Region '" << region->getName() << "' has not received capabilities yet! Cannot process SyntaxId." << LL_ENDL; } @@ -149,23 +147,16 @@ bool LLSyntaxIdLSL::checkSyntaxIdChanged() mCapabilityURL = region->getCapability(mCapabilityName); if (mSyntaxIdCurrent != mSyntaxIdNew) { - LL_WARNS("LSLSyntax") - << "Region is '" << region->getName() - << "' it has LSLSyntaxId capability, and the new hash is '" - << mSyntaxIdNew << "'" - << LL_ENDL; + message = "' it has LSLSyntaxId capability, and the new hash is '" + + mSyntaxIdNew.asString() + "'"; changed = true; } else { - LL_WARNS("LSLSyntax") - << "Region is '" << region->getName() - << "' it has the same LSLSyntaxId! Leaving hash as '" - << mSyntaxIdCurrent << "'" - << LL_ENDL; + message = "' it has the same LSLSyntaxId! Leaving hash as '" + + mSyntaxIdCurrent + "'"; } - } else { @@ -180,9 +171,9 @@ bool LLSyntaxIdLSL::checkSyntaxIdChanged() message = " it does not have LSLSyntaxId capability, using default keywords file!"; changed = true; } - LL_WARNS("LSLSyntax") - << "Region is '" << region->getName() << message << LL_ENDL; } + LL_INFOS("SyntaxLSL") + << "Region is '" << region->getName() << message << LL_ENDL; } } return changed; @@ -199,14 +190,14 @@ void LLSyntaxIdLSL::fetchKeywordsFile() new fetchKeywordsFileResponder(mFullFileSpec), LLSD(), 30.f ); - LL_INFOS("LSLSyntax") + LL_INFOS("SyntaxLSL") << "LSLSyntaxId capability URL is: " << mCapabilityURL << ". Filename to use is: '" << mFullFileSpec << "'." << LL_ENDL; } else { - LL_WARNS("LSLSyntax") + LL_ERRS("SyntaxLSL") << "LSLSyntaxId capability URL is empty!!" << LL_ENDL; } } @@ -215,7 +206,7 @@ void LLSyntaxIdLSL::initialise() { if (checkSyntaxIdChanged()) { - LL_INFOS("LSLSyntax") + LL_INFOS("SyntaxLSL") << "LSL version has changed, getting appropriate file." << LL_ENDL; @@ -226,13 +217,13 @@ void LLSyntaxIdLSL::initialise() if ( !gDirUtilp->fileExists(mFullFileSpec) ) { // Does not exist, so fetch it from the capability fetchKeywordsFile(); - LL_INFOS("LSLSyntax") + LL_INFOS("SyntaxLSL") << "File is not cached, we will try to download it!" << LL_ENDL; } else { - LL_INFOS("LSLSyntax") + LL_INFOS("SyntaxLSL") << "File is cached, no need to download!" << LL_ENDL; loadKeywordsIntoLLSD(); @@ -240,7 +231,7 @@ void LLSyntaxIdLSL::initialise() } else { // Need to open the default - LL_INFOS("LSLSyntax") + LL_INFOS("SyntaxLSL") << "LSLSyntaxId is null so we will use the default file!" << LL_ENDL; loadKeywordsIntoLLSD(); @@ -250,7 +241,7 @@ void LLSyntaxIdLSL::initialise() } else { - LL_INFOS("LSLSyntax") + LL_INFOS("SyntaxLSL") << "No change to Syntax! Nothing to see. Move along now!" << LL_ENDL; } @@ -267,7 +258,7 @@ void LLSyntaxIdLSL::initialise() */ bool LLSyntaxIdLSL::loadKeywordsIntoLLSD() { - LL_INFOS("LSLSyntax") + LL_INFOS("SyntaxLSL") << "Trying to open cached or default keyword file ;-)" << LL_ENDL; @@ -280,7 +271,7 @@ bool LLSyntaxIdLSL::loadKeywordsIntoLLSD() loaded = (bool)LLSDSerialize::fromXML(content, file); if (!loaded) { - LL_WARNS("LSLSyntax") << "Unable to deserialise file: " << mFullFileSpec << LL_ENDL; + LL_ERRS("SyntaxLSL") << "Unable to deserialise file: " << mFullFileSpec << LL_ENDL; // Is this the right thing to do, or should we leave the old content // even if it isn't entirely accurate anymore? @@ -289,12 +280,12 @@ bool LLSyntaxIdLSL::loadKeywordsIntoLLSD() else { sKeywordsXml = content; - LL_INFOS("LSLSyntax") << "Deserialised file: " << mFullFileSpec << LL_ENDL; + LL_INFOS("SyntaxLSL") << "Deserialised file: " << mFullFileSpec << LL_ENDL; } } else { - LL_WARNS("LSLSyntax") << "Unable to open file: " << mFullFileSpec << LL_ENDL; + LL_ERRS("SyntaxLSL") << "Unable to open file: " << mFullFileSpec << LL_ENDL; } return loaded; } -- cgit v1.2.3 From fa5c3320cc9c50462b222b1b1197d9c16064983e Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Thu, 21 Nov 2013 19:55:38 +0000 Subject: storm-1831 Cleaning up colour LLSD processing code which is no longer used as colours come from the colors XML file. --- indra/llui/llkeywords.cpp | 58 +---------------------------------------------- indra/llui/llkeywords.h | 2 -- 2 files changed, 1 insertion(+), 59 deletions(-) (limited to 'indra') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 6aeaf4798b..5f5810812e 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -67,10 +67,7 @@ inline BOOL LLKeywordToken::isTail(const llwchar* s) const return res; } -LLKeywords::LLKeywords() : mLoaded(FALSE) -{ - //setFilenameSyntax( gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"keywords_lsl_default.xml") ); -} +LLKeywords::LLKeywords() : mLoaded(FALSE) { } LLKeywords::~LLKeywords() { @@ -205,59 +202,6 @@ bool LLKeywords::initialise(LLSD SyntaxXML) return mLoaded; } -///** -// * @brief Start processing the colour LLSD from its beginning. -// * -// */ -//std::string LLKeywords::processColors() -//{ -// return processColors(mColors, ""); -//} - -///** -// * @brief Recursively process the colour LLSD from an arbitrary level. -// * @desc Process the supplied LLSD for colour data. The strPrefix is a string -// * of hyphen separated keys from previous levels. -// */ -//std::string LLKeywords::processColors(LLSD &settings, const std::string strPrefix) -//{ -// if (settings.isMap() || (! settings.isMap() && strPrefix != "") ) -// { -// LLSD llsd_map = settings; - -// LLSD::map_iterator my_iter = llsd_map.beginMap(); -// for ( ; my_iter != llsd_map.endMap(); ++my_iter) -// { -// std::string strGroup = strPrefix; -// const LLSD::String& key = my_iter->first; -// LLSD& value = my_iter->second; -// -// if (key == "color") -// { -// if (value.isMap() || value.isArray()) -// { -// addColorGroup(strGroup, readColor(value)); -// } -// else -// { -// LL_WARNS("Invalid Color") << "Invalid Color Entry - first: '" << key << "' second: '" << value << "'" << LL_ENDL; -// } -// } -// else if (value.isMap()) -// { -// strGroup += (strGroup.length() == 0) ? my_iter->first : "-" + my_iter->first; -// strGroup = processColors(value, strGroup); -// } -// else -// { -// LL_WARNS("Invalid Color") << "Invalid Color Entry - first: '" << key << "' second: '" << value << "'" << LL_ENDL; -// } -// } -// } -// return strPrefix; -//} -//*/ - void LLKeywords::processTokens() { // Add 'standard' stuff: Quotes, Comments, Strings, Labels, etc. before processing the LLSD diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index 074cedfc63..d0f1de8389 100755 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -118,8 +118,6 @@ public: void findSegments(std::vector *seg_list, const LLWString& text, const LLColor4 &defaultColor, class LLTextEditor& editor ); bool initialise(LLSD SyntaxXML); - std::string processColors(); - std::string processColors(LLSD &data, const std::string strGroup); void processTokens(); // Add the token as described -- cgit v1.2.3 From 380334956c6689c2091e95969a7f79a29db49a4d Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Thu, 21 Nov 2013 21:29:24 +0000 Subject: storm-1831 Fixing message string UUID assignment --- indra/newview/llsyntaxid.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llsyntaxid.cpp b/indra/newview/llsyntaxid.cpp index 605d49b175..43f840544c 100644 --- a/indra/newview/llsyntaxid.cpp +++ b/indra/newview/llsyntaxid.cpp @@ -155,7 +155,7 @@ bool LLSyntaxIdLSL::checkSyntaxIdChanged() else { message = "' it has the same LSLSyntaxId! Leaving hash as '" - + mSyntaxIdCurrent + "'"; + + mSyntaxIdCurrent.asString() + "'"; } } else -- cgit v1.2.3 From 7563fb0b5181fa7223cb08f79e2710f9d44aded3 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Fri, 22 Nov 2013 01:01:29 +0000 Subject: storm-1831 Replacing old hack with an ENUM check. --- indra/newview/llpreviewscript.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 362836b5b9..41c172e629 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -421,7 +421,6 @@ void LLScriptEdCore::onRegionChangeInitialiseKeywords() mSyntaxIdLSL.initialise(); mEditor->mKeywords.initialise(mSyntaxIdLSL.getKeywordsXML()); - LLColor3 color(0.5f, 0.0f, 0.15f); mEditor->loadKeywords(); std::vector primary_keywords; @@ -431,8 +430,7 @@ void LLScriptEdCore::onRegionChangeInitialiseKeywords() for (token_it = mEditor->keywordsBegin(); token_it != mEditor->keywordsEnd(); ++token_it) { token = token_it->second; - // FIX: change this to use the new Token Type enum entries. - if (token->getColor() == color) // Wow, what a disgusting hack. + if (token->getType() == LLKeywordToken::TT_FUNCTION) { primary_keywords.push_back( wstring_to_utf8str(token->getToken()) ); } -- cgit v1.2.3 From bf86275d78b041faffc646195bc16ecabaa3bdb7 Mon Sep 17 00:00:00 2001 From: Cho Date: Tue, 26 Nov 2013 01:47:37 +0000 Subject: LLTwitterConnect and LLFlickrConnect now use caps again, instead of pdp15 --- indra/newview/llflickrconnect.cpp | 4 ++-- indra/newview/lltwitterconnect.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/newview/llflickrconnect.cpp b/indra/newview/llflickrconnect.cpp index 3da3ef22b2..3a21933b63 100644 --- a/indra/newview/llflickrconnect.cpp +++ b/indra/newview/llflickrconnect.cpp @@ -296,8 +296,8 @@ std::string LLFlickrConnect::getFlickrConnectURL(const std::string& route, bool LLViewerRegion *regionp = gAgent.getRegion(); if (regionp) { - url = "http://pdp15.lindenlab.com/flickr/agent/" + gAgentID.asString(); // TEMPORARY FOR TESTING - CHO - //url = regionp->getCapability("FlickrConnect"); + //url = "http://pdp15.lindenlab.com/flickr/agent/" + gAgentID.asString(); // TEMPORARY FOR TESTING - CHO + url = regionp->getCapability("FlickrConnect"); url += route; if (include_read_from_master && mReadFromMaster) diff --git a/indra/newview/lltwitterconnect.cpp b/indra/newview/lltwitterconnect.cpp index fe45d3e4d0..e015867df2 100644 --- a/indra/newview/lltwitterconnect.cpp +++ b/indra/newview/lltwitterconnect.cpp @@ -296,8 +296,8 @@ std::string LLTwitterConnect::getTwitterConnectURL(const std::string& route, boo LLViewerRegion *regionp = gAgent.getRegion(); if (regionp) { - url = "http://pdp15.lindenlab.com/twitter/agent/" + gAgentID.asString(); // TEMPORARY FOR TESTING - CHO - //url = regionp->getCapability("TwitterConnect"); + //url = "http://pdp15.lindenlab.com/twitter/agent/" + gAgentID.asString(); // TEMPORARY FOR TESTING - CHO + url = regionp->getCapability("TwitterConnect"); url += route; if (include_read_from_master && mReadFromMaster) -- cgit v1.2.3 From 9e8a7869ce4e51d5caeb46118972509a0110f766 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 3 Dec 2013 10:44:44 -0500 Subject: STORM-68 Change CAP name to AgentPreferences and adjust LLSD format to mesh with server changes --- indra/newview/llfloaterperms.cpp | 13 ++++++++----- indra/newview/llviewerregion.cpp | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index 4923420a3e..b03a4e9013 100755 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -182,15 +182,18 @@ llwarns << "DBG start" << llendl; } llwarns << "DBG getRegion" << llendl; - std::string object_url = gAgent.getRegion()->getCapability("DefaultObjectPermissions"); + std::string object_url = gAgent.getRegion()->getCapability("AgentPreferences"); if(!object_url.empty()) { -llwarns << "DBG post" << llendl; LLSD report = LLSD::emptyMap(); - report["Group"] = (LLSD::Integer)LLFloaterPerms::getGroupPerms(sCategoryNames[CAT_OBJECTS]); - report["Everyone"] = (LLSD::Integer)LLFloaterPerms::getEveryonePerms(sCategoryNames[CAT_OBJECTS]); - report["NextOwner"] = (LLSD::Integer)LLFloaterPerms::getNextOwnerPerms(sCategoryNames[CAT_OBJECTS]); + report["default_object_perm_masks"]["Group"] = + (LLSD::Integer)LLFloaterPerms::getGroupPerms(sCategoryNames[CAT_OBJECTS]); + report["default_object_perm_masks"]["Everyone"] = + (LLSD::Integer)LLFloaterPerms::getEveryonePerms(sCategoryNames[CAT_OBJECTS]); + report["default_object_perm_masks"]["NextOwner"] = + (LLSD::Integer)LLFloaterPerms::getNextOwnerPerms(sCategoryNames[CAT_OBJECTS]); +llwarns << "DBG post:" << report << llendl; LLHTTPClient::post(object_url, report, new LLFloaterPermsResponder()); } } diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index dd88c5b846..4cd9f9769a 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1582,6 +1582,7 @@ void LLViewerRegion::unpackRegionHandshake() void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) { + capabilityNames.append("AgentPreferences"); capabilityNames.append("AgentState"); capabilityNames.append("AttachmentResources"); capabilityNames.append("AvatarPickerSearch"); @@ -1589,7 +1590,6 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("ChatSessionRequest"); capabilityNames.append("CopyInventoryFromNotecard"); capabilityNames.append("CreateInventoryCategory"); - capabilityNames.append("DefaultObjectPermissions"); capabilityNames.append("DispatchRegionInfo"); capabilityNames.append("EnvironmentSettings"); capabilityNames.append("EstateChangeInfo"); -- cgit v1.2.3 From ffff7ef59f43c66f966f259cb30e069a2445aa66 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 3 Dec 2013 14:22:27 -0800 Subject: ACME-1117 : Fixed crash in Facebook checkin in logged out situation, check presence of region before accessing it --- indra/newview/llfloatersocial.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 31404da7d3..e7be8cc8cc 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -62,9 +62,10 @@ const std::string DEFAULT_PHOTO_QUERY_PARAMETERS = "?sourceid=slshare_photo&utm_ std::string get_map_url() { LLVector3d center_agent; - if (gAgent.getRegion()) + LLViewerRegion *regionp = gAgent.getRegion(); + if (regionp) { - center_agent = gAgent.getRegion()->getCenterGlobal(); + center_agent = regionp->getCenterGlobal(); } int x_pos = center_agent[0] / 256.0; int y_pos = center_agent[1] / 256.0; @@ -607,7 +608,12 @@ void LLSocialCheckinPanel::sendCheckin() slurl_string += DEFAULT_CHECKIN_QUERY_PARAMETERS; // Get the region name - std::string region_name = gAgent.getRegion()->getName(); + std::string region_name(""); + LLViewerRegion *regionp = gAgent.getRegion(); + if (regionp) + { + region_name = regionp->getName(); + } // Get the region description std::string description; -- cgit v1.2.3 From b6d02ae9c84e185f2507323c47c0475ce43f9e7a Mon Sep 17 00:00:00 2001 From: Cho Date: Wed, 4 Dec 2013 18:19:47 +0000 Subject: Added SLURL checkbox to floater_twitter for ACME-1216 --- indra/newview/llfloatertwitter.cpp | 96 +++++++++++++++++----- indra/newview/llfloatertwitter.h | 4 + .../skins/default/xui/en/floater_twitter.xml | 6 +- .../skins/default/xui/en/panel_twitter_photo.xml | 14 +++- 4 files changed, 92 insertions(+), 28 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatertwitter.cpp b/indra/newview/llfloatertwitter.cpp index 06d0fb5542..ea17497d95 100644 --- a/indra/newview/llfloatertwitter.cpp +++ b/indra/newview/llfloatertwitter.cpp @@ -66,6 +66,7 @@ mRefreshBtn(NULL), mWorkingLabel(NULL), mThumbnailPlaceholder(NULL), mStatusTextBox(NULL), +mLocationCheckbox(NULL), mPhotoCheckbox(NULL), mPostButton(NULL) { @@ -92,7 +93,10 @@ BOOL LLTwitterPhotoPanel::postBuild() mWorkingLabel = getChild("working_lbl"); mThumbnailPlaceholder = getChild("thumbnail_placeholder"); mStatusTextBox = getChild("photo_status"); + mLocationCheckbox = getChild("add_location_cb"); + mLocationCheckbox->setCommitCallback(boost::bind(&LLTwitterPhotoPanel::onAddLocationToggled, this)); mPhotoCheckbox = getChild("add_photo_cb"); + mPhotoCheckbox->setCommitCallback(boost::bind(&LLTwitterPhotoPanel::onAddPhotoToggled, this)); mPostButton = getChild("post_photo_btn"); mCancelButton = getChild("cancel_photo_btn"); @@ -109,30 +113,12 @@ void LLTwitterPhotoPanel::draw() mStatusTextBox->setEnabled(no_ongoing_connection); mResolutionComboBox->setEnabled(no_ongoing_connection && mPhotoCheckbox->getValue().asBoolean()); mRefreshBtn->setEnabled(no_ongoing_connection && mPhotoCheckbox->getValue().asBoolean()); + mLocationCheckbox->setEnabled(no_ongoing_connection); mPhotoCheckbox->setEnabled(no_ongoing_connection); + bool add_location = mLocationCheckbox->getValue().asBoolean(); bool add_photo = mPhotoCheckbox->getValue().asBoolean(); - - // Restrict the status text length to Twitter's character limit - LLTextEditor* status_text_box = dynamic_cast(mStatusTextBox); - if (status_text_box) - { - int max_status_length = add_photo ? 100 : 140; - status_text_box->setMaxTextLength(max_status_length); - if (!add_photo) - { - if (mOldStatusText.length() > status_text_box->getText().length() && status_text_box->getText() == mOldStatusText.substr(0, status_text_box->getText().length())) - { - status_text_box->setText(mOldStatusText); - } - mOldStatusText = ""; - } - if (status_text_box->getText().length() > max_status_length) - { - mOldStatusText = status_text_box->getText(); - status_text_box->setText(mOldStatusText.substr(0, max_status_length)); - } - } + updateStatusTextLength(false); // Display the preview if one is available if (previewp && previewp->getThumbnailImage()) @@ -169,7 +155,7 @@ void LLTwitterPhotoPanel::draw() mWorkingLabel->setVisible(!(previewp && previewp->getSnapshotUpToDate())); // Enable Post if we have a preview to send and no on going connection being processed - mPostButton->setEnabled(no_ongoing_connection && ((add_photo && previewp && previewp->getSnapshotUpToDate()) || !mStatusTextBox->getValue().asString().empty())); + mPostButton->setEnabled(no_ongoing_connection && ((add_photo && previewp && previewp->getSnapshotUpToDate()) || add_location || !mStatusTextBox->getValue().asString().empty())); // Draw the rest of the panel on top of it LLPanel::draw(); @@ -213,6 +199,18 @@ void LLTwitterPhotoPanel::onVisibilityChange(const LLSD& new_visibility) } } +void LLTwitterPhotoPanel::onAddLocationToggled() +{ + bool add_location = mLocationCheckbox->getValue().asBoolean(); + updateStatusTextLength(!add_location); +} + +void LLTwitterPhotoPanel::onAddPhotoToggled() +{ + bool add_photo = mPhotoCheckbox->getValue().asBoolean(); + updateStatusTextLength(!add_photo); +} + void LLTwitterPhotoPanel::onClickNewSnapshot() { LLSnapshotLivePreview* previewp = getPreviewView(); @@ -261,6 +259,26 @@ void LLTwitterPhotoPanel::sendPhoto() { // Get the status text std::string status = mStatusTextBox->getValue().asString(); + + // Add the location if required + bool add_location = mLocationCheckbox->getValue().asBoolean(); + if (add_location) + { + // Get the SLURL for the location + LLSLURL slurl; + LLAgentUI::buildSLURL(slurl); + std::string slurl_string = slurl.getSLURLString(); + + // Add query parameters so Google Analytics can track incoming clicks! + slurl_string += DEFAULT_PHOTO_QUERY_PARAMETERS; + + // Add it to the status (pretty crude, but we don't have a better option with photos) + if (status.empty()) + status = slurl_string; + else + status = status + " " + slurl_string; + } + // Add the photo if required bool add_photo = mPhotoCheckbox->getValue().asBoolean(); @@ -292,6 +310,40 @@ void LLTwitterPhotoPanel::clearAndClose() } } +void LLTwitterPhotoPanel::updateStatusTextLength(BOOL restore_old_status_text) +{ + bool add_location = mLocationCheckbox->getValue().asBoolean(); + bool add_photo = mPhotoCheckbox->getValue().asBoolean(); + + // Restrict the status text length to Twitter's character limit + LLTextEditor* status_text_box = dynamic_cast(mStatusTextBox); + if (status_text_box) + { + int max_status_length = 140 - (add_location ? 40 : 0) - (add_photo ? 40 : 0); + status_text_box->setMaxTextLength(max_status_length); + if (restore_old_status_text) + { + if (mOldStatusText.length() > status_text_box->getText().length() && status_text_box->getText() == mOldStatusText.substr(0, status_text_box->getText().length())) + { + status_text_box->setText(mOldStatusText); + } + if (mOldStatusText.length() <= max_status_length) + { + mOldStatusText = ""; + } + } + if (status_text_box->getText().length() > max_status_length) + { + if (mOldStatusText.length() < status_text_box->getText().length() || status_text_box->getText() != mOldStatusText.substr(0, status_text_box->getText().length())) + { + mOldStatusText = status_text_box->getText(); + } + status_text_box->setText(mOldStatusText.substr(0, max_status_length)); + } + } + +} + void LLTwitterPhotoPanel::updateControls() { LLSnapshotLivePreview* previewp = getPreviewView(); diff --git a/indra/newview/llfloatertwitter.h b/indra/newview/llfloatertwitter.h index 686e167b1f..be3a099d5f 100644 --- a/indra/newview/llfloatertwitter.h +++ b/indra/newview/llfloatertwitter.h @@ -46,6 +46,8 @@ public: LLSnapshotLivePreview* getPreviewView(); void onVisibilityChange(const LLSD& new_visibility); + void onAddLocationToggled(); + void onAddPhotoToggled(); void onClickNewSnapshot(); void onSend(); bool onTwitterConnectStateChange(const LLSD& data); @@ -53,6 +55,7 @@ public: void sendPhoto(); void clearAndClose(); + void updateStatusTextLength(BOOL restore_old_status_text); void updateControls(); void updateResolution(BOOL do_update); void checkAspectRatio(S32 index); @@ -67,6 +70,7 @@ private: LLUICtrl * mWorkingLabel; LLUICtrl * mThumbnailPlaceholder; LLUICtrl * mStatusTextBox; + LLUICtrl * mLocationCheckbox; LLUICtrl * mPhotoCheckbox; LLUICtrl * mPostButton; LLUICtrl* mCancelButton; diff --git a/indra/newview/skins/default/xui/en/floater_twitter.xml b/indra/newview/skins/default/xui/en/floater_twitter.xml index 7007a14cdb..751914141c 100644 --- a/indra/newview/skins/default/xui/en/floater_twitter.xml +++ b/indra/newview/skins/default/xui/en/floater_twitter.xml @@ -10,10 +10,10 @@ single_instance="true" reuse_instance="true" title="TWITTER" - height="482" + height="502" width="304"> + height="160"> + Date: Wed, 4 Dec 2013 19:45:26 +0000 Subject: Add character count display to floater_twitter for ACME-1215 --- indra/newview/llfloatertwitter.cpp | 6 ++++++ indra/newview/llfloatertwitter.h | 1 + indra/newview/skins/default/xui/en/panel_twitter_photo.xml | 14 ++++++++++++++ 3 files changed, 21 insertions(+) (limited to 'indra') diff --git a/indra/newview/llfloatertwitter.cpp b/indra/newview/llfloatertwitter.cpp index ea17497d95..82ed066b1a 100644 --- a/indra/newview/llfloatertwitter.cpp +++ b/indra/newview/llfloatertwitter.cpp @@ -65,6 +65,7 @@ mResolutionComboBox(NULL), mRefreshBtn(NULL), mWorkingLabel(NULL), mThumbnailPlaceholder(NULL), +mStatusCounterLabel(NULL), mStatusTextBox(NULL), mLocationCheckbox(NULL), mPhotoCheckbox(NULL), @@ -92,6 +93,7 @@ BOOL LLTwitterPhotoPanel::postBuild() mRefreshBtn = getChild("new_snapshot_btn"); mWorkingLabel = getChild("working_lbl"); mThumbnailPlaceholder = getChild("thumbnail_placeholder"); + mStatusCounterLabel = getChild("status_counter_label"); mStatusTextBox = getChild("photo_status"); mLocationCheckbox = getChild("add_location_cb"); mLocationCheckbox->setCommitCallback(boost::bind(&LLTwitterPhotoPanel::onAddLocationToggled, this)); @@ -340,6 +342,10 @@ void LLTwitterPhotoPanel::updateStatusTextLength(BOOL restore_old_status_text) } status_text_box->setText(mOldStatusText.substr(0, max_status_length)); } + + // Update the status character counter + int characters_remaining = max_status_length - status_text_box->getText().length(); + mStatusCounterLabel->setValue(characters_remaining); } } diff --git a/indra/newview/llfloatertwitter.h b/indra/newview/llfloatertwitter.h index be3a099d5f..5305143552 100644 --- a/indra/newview/llfloatertwitter.h +++ b/indra/newview/llfloatertwitter.h @@ -69,6 +69,7 @@ private: LLUICtrl * mRefreshBtn; LLUICtrl * mWorkingLabel; LLUICtrl * mThumbnailPlaceholder; + LLUICtrl * mStatusCounterLabel; LLUICtrl * mStatusTextBox; LLUICtrl * mLocationCheckbox; LLUICtrl * mPhotoCheckbox; diff --git a/indra/newview/skins/default/xui/en/panel_twitter_photo.xml b/indra/newview/skins/default/xui/en/panel_twitter_photo.xml index 3ddec9b989..14268c1bcf 100644 --- a/indra/newview/skins/default/xui/en/panel_twitter_photo.xml +++ b/indra/newview/skins/default/xui/en/panel_twitter_photo.xml @@ -25,6 +25,20 @@ type="string"> What's happening? + + 140 + Date: Thu, 5 Dec 2013 00:28:28 +0000 Subject: Renamed floater_social to floater_facebook for ACME-1205 --- indra/newview/CMakeLists.txt | 4 +- indra/newview/app_settings/commands.xml | 12 +- indra/newview/app_settings/settings.xml | 2 +- indra/newview/app_settings/toolbars.xml | 2 +- indra/newview/llfloaterfacebook.cpp | 939 +++++++++++++++++++++ indra/newview/llfloaterfacebook.h | 167 ++++ indra/newview/llfloaterflickr.cpp | 14 +- indra/newview/llfloaterflickr.h | 2 +- indra/newview/llfloatersnapshot.cpp | 6 +- indra/newview/llfloatersocial.cpp | 939 --------------------- indra/newview/llfloatersocial.h | 167 ---- indra/newview/llfloatertwitter.cpp | 14 +- indra/newview/llfloatertwitter.h | 2 +- indra/newview/llpanelsnapshotoptions.cpp | 10 +- indra/newview/llsnapshotlivepreview.cpp | 6 +- indra/newview/llviewerfloaterreg.cpp | 10 +- indra/newview/skins/default/textures/textures.xml | 6 +- .../skins/default/xui/en/floater_facebook.xml | 101 +++ .../skins/default/xui/en/floater_social.xml | 101 --- indra/newview/skins/default/xui/en/menu_viewer.xml | 2 +- .../default/xui/en/panel_facebook_account.xml | 75 ++ .../skins/default/xui/en/panel_facebook_photo.xml | 152 ++++ .../skins/default/xui/en/panel_facebook_place.xml | 132 +++ .../skins/default/xui/en/panel_facebook_status.xml | 67 ++ .../skins/default/xui/en/panel_social_account.xml | 75 -- .../skins/default/xui/en/panel_social_photo.xml | 152 ---- .../skins/default/xui/en/panel_social_place.xml | 132 --- .../skins/default/xui/en/panel_social_status.xml | 67 -- indra/newview/skins/default/xui/en/strings.xml | 12 +- 29 files changed, 1686 insertions(+), 1684 deletions(-) create mode 100644 indra/newview/llfloaterfacebook.cpp create mode 100644 indra/newview/llfloaterfacebook.h delete mode 100644 indra/newview/llfloatersocial.cpp delete mode 100644 indra/newview/llfloatersocial.h create mode 100644 indra/newview/skins/default/xui/en/floater_facebook.xml delete mode 100644 indra/newview/skins/default/xui/en/floater_social.xml create mode 100644 indra/newview/skins/default/xui/en/panel_facebook_account.xml create mode 100644 indra/newview/skins/default/xui/en/panel_facebook_photo.xml create mode 100644 indra/newview/skins/default/xui/en/panel_facebook_place.xml create mode 100644 indra/newview/skins/default/xui/en/panel_facebook_status.xml delete mode 100644 indra/newview/skins/default/xui/en/panel_social_account.xml delete mode 100644 indra/newview/skins/default/xui/en/panel_social_photo.xml delete mode 100644 indra/newview/skins/default/xui/en/panel_social_place.xml delete mode 100644 indra/newview/skins/default/xui/en/panel_social_status.xml (limited to 'indra') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 746991a6f0..b937d53bd8 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -229,6 +229,7 @@ set(viewer_SOURCE_FILES llfloatereditwater.cpp llfloaterenvironmentsettings.cpp llfloaterevent.cpp + llfloaterfacebook.cpp llfloaterflickr.cpp llfloaterfonttest.cpp llfloatergesture.cpp @@ -276,7 +277,6 @@ set(viewer_SOURCE_FILES llfloatersettingsdebug.cpp llfloatersidepanelcontainer.cpp llfloatersnapshot.cpp - llfloatersocial.cpp llfloatersounddevices.cpp llfloaterspellchecksettings.cpp llfloatertelehub.cpp @@ -821,6 +821,7 @@ set(viewer_HEADER_FILES llfloatereditwater.h llfloaterenvironmentsettings.h llfloaterevent.h + llfloaterfacebook.h llfloaterflickr.h llfloaterfonttest.h llfloatergesture.h @@ -868,7 +869,6 @@ set(viewer_HEADER_FILES llfloatersettingsdebug.h llfloatersidepanelcontainer.h llfloatersnapshot.h - llfloatersocial.h llfloatersounddevices.h llfloaterspellchecksettings.h llfloatertelehub.h diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index f4e9cc0136..7b329e2092 100755 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -216,15 +216,15 @@ is_running_function="Floater.IsOpen" is_running_parameters="snapshot" /> - SocialPhotoResolution Comment - Default resolution when sharing photo using the social floater + Default resolution when sharing photo using the social floaters Persist 1 Type diff --git a/indra/newview/app_settings/toolbars.xml b/indra/newview/app_settings/toolbars.xml index c65b79affb..d61aee9a14 100755 --- a/indra/newview/app_settings/toolbars.xml +++ b/indra/newview/app_settings/toolbars.xml @@ -21,6 +21,6 @@ - + diff --git a/indra/newview/llfloaterfacebook.cpp b/indra/newview/llfloaterfacebook.cpp new file mode 100644 index 0000000000..6488e7ea00 --- /dev/null +++ b/indra/newview/llfloaterfacebook.cpp @@ -0,0 +1,939 @@ +/** +* @file llfloaterfacebook.cpp +* @brief Implementation of llfloaterfacebook +* @author Gilbert@lindenlab.com +* +* $LicenseInfo:firstyear=2013&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2013, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterfacebook.h" + +#include "llagent.h" +#include "llagentui.h" +#include "llcheckboxctrl.h" +#include "llcombobox.h" +#include "llfacebookconnect.h" +#include "llfloaterreg.h" +#include "lliconctrl.h" +#include "llresmgr.h" // LLLocale +#include "llsdserialize.h" +#include "llloadingindicator.h" +#include "llplugincookiestore.h" +#include "llslurl.h" +#include "lltrans.h" +#include "llsnapshotlivepreview.h" +#include "llviewerregion.h" +#include "llviewercontrol.h" +#include "llviewermedia.h" +#include "lltabcontainer.h" + +static LLRegisterPanelClassWrapper t_panel_status("llfacebookstatuspanel"); +static LLRegisterPanelClassWrapper t_panel_photo("llfacebookphotopanel"); +static LLRegisterPanelClassWrapper t_panel_checkin("llfacebookcheckinpanel"); +static LLRegisterPanelClassWrapper t_panel_account("llfacebookaccountpanel"); + +const S32 MAX_POSTCARD_DATASIZE = 1024 * 1024; // one megabyte +const std::string DEFAULT_CHECKIN_LOCATION_URL = "http://maps.secondlife.com/"; +const std::string DEFAULT_CHECKIN_ICON_URL = "http://map.secondlife.com.s3.amazonaws.com/map_placeholder.png"; +const std::string DEFAULT_CHECKIN_QUERY_PARAMETERS = "?sourceid=slshare_checkin&utm_source=facebook&utm_medium=checkin&utm_campaign=slshare"; +const std::string DEFAULT_PHOTO_QUERY_PARAMETERS = "?sourceid=slshare_photo&utm_source=facebook&utm_medium=photo&utm_campaign=slshare"; + +std::string get_map_url() +{ + LLVector3d center_agent; + LLViewerRegion *regionp = gAgent.getRegion(); + if (regionp) + { + center_agent = regionp->getCenterGlobal(); + } + int x_pos = center_agent[0] / 256.0; + int y_pos = center_agent[1] / 256.0; + std::string map_url = gSavedSettings.getString("CurrentMapServerURL") + llformat("map-1-%d-%d-objects.jpg", x_pos, y_pos); + return map_url; +} + +/////////////////////////// +//LLFacebookStatusPanel////// +/////////////////////////// + +LLFacebookStatusPanel::LLFacebookStatusPanel() : + mMessageTextEditor(NULL), + mPostButton(NULL), + mCancelButton(NULL) +{ + mCommitCallbackRegistrar.add("SocialSharing.SendStatus", boost::bind(&LLFacebookStatusPanel::onSend, this)); +} + +BOOL LLFacebookStatusPanel::postBuild() +{ + mMessageTextEditor = getChild("status_message"); + mPostButton = getChild("post_status_btn"); + mCancelButton = getChild("cancel_status_btn"); + + return LLPanel::postBuild(); +} + +void LLFacebookStatusPanel::draw() +{ + if (mMessageTextEditor && mPostButton && mCancelButton) + { + bool no_ongoing_connection = !(LLFacebookConnect::instance().isTransactionOngoing()); + std::string message = mMessageTextEditor->getValue().asString(); + mMessageTextEditor->setEnabled(no_ongoing_connection); + mCancelButton->setEnabled(no_ongoing_connection); + mPostButton->setEnabled(no_ongoing_connection && !message.empty()); + } + + LLPanel::draw(); +} + +void LLFacebookStatusPanel::onSend() +{ + LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookStatusPanel"); // just in case it is already listening + LLEventPumps::instance().obtain("FacebookConnectState").listen("LLFacebookStatusPanel", boost::bind(&LLFacebookStatusPanel::onFacebookConnectStateChange, this, _1)); + + // Connect to Facebook if necessary and then post + if (LLFacebookConnect::instance().isConnected()) + { + sendStatus(); + } + else + { + LLFacebookConnect::instance().checkConnectionToFacebook(true); + } +} + +bool LLFacebookStatusPanel::onFacebookConnectStateChange(const LLSD& data) +{ + switch (data.get("enum").asInteger()) + { + case LLFacebookConnect::FB_CONNECTED: + sendStatus(); + break; + + case LLFacebookConnect::FB_POSTED: + LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookStatusPanel"); + clearAndClose(); + break; + } + + return false; +} + +void LLFacebookStatusPanel::sendStatus() +{ + std::string message = mMessageTextEditor->getValue().asString(); + if (!message.empty()) + { + LLFacebookConnect::instance().updateStatus(message); + } +} + +void LLFacebookStatusPanel::clearAndClose() +{ + mMessageTextEditor->setValue(""); + + LLFloater* floater = getParentByType(); + if (floater) + { + floater->closeFloater(); + } +} + +/////////////////////////// +//LLFacebookPhotoPanel/////// +/////////////////////////// + +LLFacebookPhotoPanel::LLFacebookPhotoPanel() : +mSnapshotPanel(NULL), +mResolutionComboBox(NULL), +mRefreshBtn(NULL), +mWorkingLabel(NULL), +mThumbnailPlaceholder(NULL), +mCaptionTextBox(NULL), +mLocationCheckbox(NULL), +mPostButton(NULL) +{ + mCommitCallbackRegistrar.add("SocialSharing.SendPhoto", boost::bind(&LLFacebookPhotoPanel::onSend, this)); + mCommitCallbackRegistrar.add("SocialSharing.RefreshPhoto", boost::bind(&LLFacebookPhotoPanel::onClickNewSnapshot, this)); +} + +LLFacebookPhotoPanel::~LLFacebookPhotoPanel() +{ + if(mPreviewHandle.get()) + { + mPreviewHandle.get()->die(); + } +} + +BOOL LLFacebookPhotoPanel::postBuild() +{ + setVisibleCallback(boost::bind(&LLFacebookPhotoPanel::onVisibilityChange, this, _2)); + + mSnapshotPanel = getChild("snapshot_panel"); + mResolutionComboBox = getChild("resolution_combobox"); + mResolutionComboBox->setCommitCallback(boost::bind(&LLFacebookPhotoPanel::updateResolution, this, TRUE)); + mRefreshBtn = getChild("new_snapshot_btn"); + mWorkingLabel = getChild("working_lbl"); + mThumbnailPlaceholder = getChild("thumbnail_placeholder"); + mCaptionTextBox = getChild("photo_caption"); + mLocationCheckbox = getChild("add_location_cb"); + mPostButton = getChild("post_photo_btn"); + mCancelButton = getChild("cancel_photo_btn"); + + return LLPanel::postBuild(); +} + +void LLFacebookPhotoPanel::draw() +{ + LLSnapshotLivePreview * previewp = static_cast(mPreviewHandle.get()); + + // Enable interaction only if no transaction with the service is on-going (prevent duplicated posts) + bool no_ongoing_connection = !(LLFacebookConnect::instance().isTransactionOngoing()); + mCancelButton->setEnabled(no_ongoing_connection); + mCaptionTextBox->setEnabled(no_ongoing_connection); + mResolutionComboBox->setEnabled(no_ongoing_connection); + mRefreshBtn->setEnabled(no_ongoing_connection); + mLocationCheckbox->setEnabled(no_ongoing_connection); + + // Display the preview if one is available + if (previewp && previewp->getThumbnailImage()) + { + const LLRect& thumbnail_rect = mThumbnailPlaceholder->getRect(); + const S32 thumbnail_w = previewp->getThumbnailWidth(); + const S32 thumbnail_h = previewp->getThumbnailHeight(); + + // calc preview offset within the preview rect + const S32 local_offset_x = (thumbnail_rect.getWidth() - thumbnail_w) / 2 ; + const S32 local_offset_y = (thumbnail_rect.getHeight() - thumbnail_h) / 2 ; + + // calc preview offset within the floater rect + // Hack : To get the full offset, we need to take into account each and every offset of each widgets up to the floater. + // This is almost as arbitrary as using a fixed offset so that's what we do here for the sake of simplicity. + // *TODO : Get the offset looking through the hierarchy of widgets, should be done in postBuild() so to avoid traversing the hierarchy each time. + S32 offset_x = thumbnail_rect.mLeft + local_offset_x - 1; + S32 offset_y = thumbnail_rect.mBottom + local_offset_y - 39; + + mSnapshotPanel->localPointToOtherView(offset_x, offset_y, &offset_x, &offset_y, getParentByType()); + + gGL.matrixMode(LLRender::MM_MODELVIEW); + // Apply floater transparency to the texture unless the floater is focused. + F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); + LLColor4 color = LLColor4::white; + gl_draw_scaled_image(offset_x, offset_y, + thumbnail_w, thumbnail_h, + previewp->getThumbnailImage(), color % alpha); + + previewp->drawPreviewRect(offset_x, offset_y) ; + } + + // Update the visibility of the working (computing preview) label + mWorkingLabel->setVisible(!(previewp && previewp->getSnapshotUpToDate())); + + // Enable Post if we have a preview to send and no on going connection being processed + mPostButton->setEnabled(no_ongoing_connection && (previewp && previewp->getSnapshotUpToDate())); + + // Draw the rest of the panel on top of it + LLPanel::draw(); +} + +LLSnapshotLivePreview* LLFacebookPhotoPanel::getPreviewView() +{ + LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)mPreviewHandle.get(); + return previewp; +} + +void LLFacebookPhotoPanel::onVisibilityChange(const LLSD& new_visibility) +{ + bool visible = new_visibility.asBoolean(); + if (visible) + { + if (mPreviewHandle.get()) + { + LLSnapshotLivePreview* preview = getPreviewView(); + if(preview) + { + lldebugs << "opened, updating snapshot" << llendl; + preview->updateSnapshot(TRUE); + } + } + else + { + LLRect full_screen_rect = getRootView()->getRect(); + LLSnapshotLivePreview::Params p; + p.rect(full_screen_rect); + LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p); + mPreviewHandle = previewp->getHandle(); + + previewp->setSnapshotType(previewp->SNAPSHOT_WEB); + previewp->setSnapshotFormat(LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG); + //previewp->setSnapshotQuality(98); + previewp->setThumbnailPlaceholderRect(mThumbnailPlaceholder->getRect()); + + updateControls(); + } + } +} + +void LLFacebookPhotoPanel::onClickNewSnapshot() +{ + LLSnapshotLivePreview* previewp = getPreviewView(); + if (previewp) + { + //setStatus(Impl::STATUS_READY); + lldebugs << "updating snapshot" << llendl; + previewp->updateSnapshot(TRUE); + } +} + +void LLFacebookPhotoPanel::onSend() +{ + LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookPhotoPanel"); // just in case it is already listening + LLEventPumps::instance().obtain("FacebookConnectState").listen("LLFacebookPhotoPanel", boost::bind(&LLFacebookPhotoPanel::onFacebookConnectStateChange, this, _1)); + + // Connect to Facebook if necessary and then post + if (LLFacebookConnect::instance().isConnected()) + { + sendPhoto(); + } + else + { + LLFacebookConnect::instance().checkConnectionToFacebook(true); + } +} + +bool LLFacebookPhotoPanel::onFacebookConnectStateChange(const LLSD& data) +{ + switch (data.get("enum").asInteger()) + { + case LLFacebookConnect::FB_CONNECTED: + sendPhoto(); + break; + + case LLFacebookConnect::FB_POSTED: + LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookPhotoPanel"); + clearAndClose(); + break; + } + + return false; +} + +void LLFacebookPhotoPanel::sendPhoto() +{ + // Get the caption + std::string caption = mCaptionTextBox->getValue().asString(); + + // Add the location if required + bool add_location = mLocationCheckbox->getValue().asBoolean(); + if (add_location) + { + // Get the SLURL for the location + LLSLURL slurl; + LLAgentUI::buildSLURL(slurl); + std::string slurl_string = slurl.getSLURLString(); + + // Add query parameters so Google Analytics can track incoming clicks! + slurl_string += DEFAULT_PHOTO_QUERY_PARAMETERS; + + // Add it to the caption (pretty crude, but we don't have a better option with photos) + if (caption.empty()) + caption = slurl_string; + else + caption = caption + " " + slurl_string; + } + + // Get the image + LLSnapshotLivePreview* previewp = getPreviewView(); + + // Post to Facebook + LLFacebookConnect::instance().sharePhoto(previewp->getFormattedImage(), caption); + + updateControls(); +} + +void LLFacebookPhotoPanel::clearAndClose() +{ + mCaptionTextBox->setValue(""); + + LLFloater* floater = getParentByType(); + if (floater) + { + floater->closeFloater(); + } +} + +void LLFacebookPhotoPanel::updateControls() +{ + LLSnapshotLivePreview* previewp = getPreviewView(); + BOOL got_bytes = previewp && previewp->getDataSize() > 0; + BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); + LLSnapshotLivePreview::ESnapshotType shot_type = (previewp ? previewp->getSnapshotType() : LLSnapshotLivePreview::SNAPSHOT_POSTCARD); + + // *TODO: Separate maximum size for Web images from postcards + lldebugs << "Is snapshot up-to-date? " << got_snap << llendl; + + LLLocale locale(LLLocale::USER_LOCALE); + std::string bytes_string; + if (got_snap) + { + LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 ); + } + + //getChild("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : getString("unknown")); <---uses localized string + getChild("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : "unknown"); + getChild("file_size_label")->setColor( + shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD + && got_bytes + && previewp->getDataSize() > MAX_POSTCARD_DATASIZE ? LLUIColor(LLColor4::red) : LLUIColorTable::instance().getColor( "LabelTextColor" )); + + updateResolution(FALSE); +} + +void LLFacebookPhotoPanel::updateResolution(BOOL do_update) +{ + LLComboBox* combobox = static_cast(mResolutionComboBox); + + std::string sdstring = combobox->getSelectedValue(); + LLSD sdres; + std::stringstream sstream(sdstring); + LLSDSerialize::fromNotation(sdres, sstream, sdstring.size()); + + S32 width = sdres[0]; + S32 height = sdres[1]; + + LLSnapshotLivePreview * previewp = static_cast(mPreviewHandle.get()); + if (previewp && combobox->getCurrentIndex() >= 0) + { + S32 original_width = 0 , original_height = 0 ; + previewp->getSize(original_width, original_height) ; + + if (width == 0 || height == 0) + { + // take resolution from current window size + lldebugs << "Setting preview res from window: " << gViewerWindow->getWindowWidthRaw() << "x" << gViewerWindow->getWindowHeightRaw() << llendl; + previewp->setSize(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw()); + } + else + { + // use the resolution from the selected pre-canned drop-down choice + lldebugs << "Setting preview res selected from combo: " << width << "x" << height << llendl; + previewp->setSize(width, height); + } + + checkAspectRatio(width); + + previewp->getSize(width, height); + + if(original_width != width || original_height != height) + { + previewp->setSize(width, height); + + // hide old preview as the aspect ratio could be wrong + lldebugs << "updating thumbnail" << llendl; + + previewp->updateSnapshot(FALSE, TRUE); + if(do_update) + { + lldebugs << "Will update controls" << llendl; + updateControls(); + LLFacebookPhotoPanel::onClickNewSnapshot(); + } + } + + } +} + +void LLFacebookPhotoPanel::checkAspectRatio(S32 index) +{ + LLSnapshotLivePreview *previewp = getPreviewView() ; + + BOOL keep_aspect = FALSE; + + if (0 == index) // current window size + { + keep_aspect = TRUE; + } + else // predefined resolution + { + keep_aspect = FALSE; + } + + if (previewp) + { + previewp->mKeepAspectRatio = keep_aspect; + } +} + +LLUICtrl* LLFacebookPhotoPanel::getRefreshBtn() +{ + return mRefreshBtn; +} + +//////////////////////// +//LLFacebookCheckinPanel// +//////////////////////// + +LLFacebookCheckinPanel::LLFacebookCheckinPanel() : + mMapUrl(""), + mReloadingMapTexture(false) +{ + mCommitCallbackRegistrar.add("SocialSharing.SendCheckin", boost::bind(&LLFacebookCheckinPanel::onSend, this)); +} + +BOOL LLFacebookCheckinPanel::postBuild() +{ + // Keep pointers to widgets so we don't traverse the UI hierarchy too often + mPostButton = getChild("post_place_btn"); + mCancelButton = getChild("cancel_place_btn"); + mMessageTextEditor = getChild("place_caption"); + mMapLoadingIndicator = getChild("map_loading_indicator"); + mMapPlaceholder = getChild("map_placeholder"); + mMapDefault = getChild("map_default"); + mMapCheckBox = getChild("add_place_view_cb"); + + return LLPanel::postBuild(); +} + +void LLFacebookCheckinPanel::draw() +{ + bool no_ongoing_connection = !(LLFacebookConnect::instance().isTransactionOngoing()); + mPostButton->setEnabled(no_ongoing_connection); + mCancelButton->setEnabled(no_ongoing_connection); + mMessageTextEditor->setEnabled(no_ongoing_connection); + mMapCheckBox->setEnabled(no_ongoing_connection); + + std::string map_url = get_map_url(); + // Did we change location? + if (map_url != mMapUrl) + { + mMapUrl = map_url; + // Load the map tile + mMapTexture = LLViewerTextureManager::getFetchedTextureFromUrl(mMapUrl, FTT_MAP_TILE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + mMapTexture->setBoostLevel(LLGLTexture::BOOST_MAP); + mReloadingMapTexture = true; + // In the meantime, put the "loading" indicator on, hide the tile map and disable the checkbox + mMapLoadingIndicator->setVisible(true); + mMapPlaceholder->setVisible(false); + } + // Are we done loading the map tile? + if (mReloadingMapTexture && mMapTexture->isFullyLoaded()) + { + // Don't do it again next time around + mReloadingMapTexture = false; + // Convert the map texture to the appropriate image object + LLPointer ui_image = new LLUIImage(mMapUrl, mMapTexture); + // Load the map widget with the correct map tile image + mMapPlaceholder->setImage(ui_image); + // Now hide the loading indicator, bring the tile in view and reenable the checkbox with its previous value + mMapLoadingIndicator->setVisible(false); + mMapPlaceholder->setVisible(true); + } + // Show the default icon if that's the checkbox value (the real one...) + // This will hide/show the loading indicator and/or tile underneath + mMapDefault->setVisible(!(mMapCheckBox->get())); + + LLPanel::draw(); +} + +void LLFacebookCheckinPanel::onSend() +{ + LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookCheckinPanel"); // just in case it is already listening + LLEventPumps::instance().obtain("FacebookConnectState").listen("LLFacebookCheckinPanel", boost::bind(&LLFacebookCheckinPanel::onFacebookConnectStateChange, this, _1)); + + // Connect to Facebook if necessary and then post + if (LLFacebookConnect::instance().isConnected()) + { + sendCheckin(); + } + else + { + LLFacebookConnect::instance().checkConnectionToFacebook(true); + } +} + +bool LLFacebookCheckinPanel::onFacebookConnectStateChange(const LLSD& data) +{ + switch (data.get("enum").asInteger()) + { + case LLFacebookConnect::FB_CONNECTED: + sendCheckin(); + break; + + case LLFacebookConnect::FB_POSTED: + LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookCheckinPanel"); + clearAndClose(); + break; + } + + return false; +} + +void LLFacebookCheckinPanel::sendCheckin() +{ + // Get the location SLURL + LLSLURL slurl; + LLAgentUI::buildSLURL(slurl); + std::string slurl_string = slurl.getSLURLString(); + + // Use a valid http:// URL if the scheme is secondlife:// + LLURI slurl_uri(slurl_string); + if (slurl_uri.scheme() == LLSLURL::SLURL_SECONDLIFE_SCHEME) + { + slurl_string = DEFAULT_CHECKIN_LOCATION_URL; + } + + // Add query parameters so Google Analytics can track incoming clicks! + slurl_string += DEFAULT_CHECKIN_QUERY_PARAMETERS; + + // Get the region name + std::string region_name(""); + LLViewerRegion *regionp = gAgent.getRegion(); + if (regionp) + { + region_name = regionp->getName(); + } + + // Get the region description + std::string description; + LLAgentUI::buildLocationString(description, LLAgentUI::LOCATION_FORMAT_NORMAL_COORDS, gAgent.getPositionAgent()); + + // Optionally add the region map view + bool add_map_view = mMapCheckBox->getValue().asBoolean(); + std::string map_url = (add_map_view ? get_map_url() : DEFAULT_CHECKIN_ICON_URL); + + // Get the caption + std::string caption = mMessageTextEditor->getValue().asString(); + + // Post to Facebook + LLFacebookConnect::instance().postCheckin(slurl_string, region_name, description, map_url, caption); +} + +void LLFacebookCheckinPanel::clearAndClose() +{ + mMessageTextEditor->setValue(""); + + LLFloater* floater = getParentByType(); + if (floater) + { + floater->closeFloater(); + } +} + +/////////////////////////// +//LLFacebookAccountPanel////// +/////////////////////////// + +LLFacebookAccountPanel::LLFacebookAccountPanel() : +mAccountCaptionLabel(NULL), +mAccountNameLabel(NULL), +mPanelButtons(NULL), +mConnectButton(NULL), +mDisconnectButton(NULL) +{ + mCommitCallbackRegistrar.add("SocialSharing.Connect", boost::bind(&LLFacebookAccountPanel::onConnect, this)); + mCommitCallbackRegistrar.add("SocialSharing.Disconnect", boost::bind(&LLFacebookAccountPanel::onDisconnect, this)); + + setVisibleCallback(boost::bind(&LLFacebookAccountPanel::onVisibilityChange, this, _2)); +} + +BOOL LLFacebookAccountPanel::postBuild() +{ + mAccountCaptionLabel = getChild("account_caption_label"); + mAccountNameLabel = getChild("account_name_label"); + mPanelButtons = getChild("panel_buttons"); + mConnectButton = getChild("connect_btn"); + mDisconnectButton = getChild("disconnect_btn"); + + return LLPanel::postBuild(); +} + +void LLFacebookAccountPanel::draw() +{ + LLFacebookConnect::EConnectionState connection_state = LLFacebookConnect::instance().getConnectionState(); + + //Disable the 'disconnect' button and the 'use another account' button when disconnecting in progress + bool disconnecting = connection_state == LLFacebookConnect::FB_DISCONNECTING; + mDisconnectButton->setEnabled(!disconnecting); + + //Disable the 'connect' button when a connection is in progress + bool connecting = connection_state == LLFacebookConnect::FB_CONNECTION_IN_PROGRESS; + mConnectButton->setEnabled(!connecting); + + LLPanel::draw(); +} + +void LLFacebookAccountPanel::onVisibilityChange(const LLSD& new_visibility) +{ + bool visible = new_visibility.asBoolean(); + + if(visible) + { + LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookAccountPanel"); + LLEventPumps::instance().obtain("FacebookConnectState").listen("LLFacebookAccountPanel", boost::bind(&LLFacebookAccountPanel::onFacebookConnectStateChange, this, _1)); + + LLEventPumps::instance().obtain("FacebookConnectInfo").stopListening("LLFacebookAccountPanel"); + LLEventPumps::instance().obtain("FacebookConnectInfo").listen("LLFacebookAccountPanel", boost::bind(&LLFacebookAccountPanel::onFacebookConnectInfoChange, this)); + + //Connected + if(LLFacebookConnect::instance().isConnected()) + { + showConnectedLayout(); + } + //Check if connected (show disconnected layout in meantime) + else + { + showDisconnectedLayout(); + } + if ((LLFacebookConnect::instance().getConnectionState() == LLFacebookConnect::FB_NOT_CONNECTED) || + (LLFacebookConnect::instance().getConnectionState() == LLFacebookConnect::FB_CONNECTION_FAILED)) + { + LLFacebookConnect::instance().checkConnectionToFacebook(); + } + } + else + { + LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookAccountPanel"); + LLEventPumps::instance().obtain("FacebookConnectInfo").stopListening("LLFacebookAccountPanel"); + } +} + +bool LLFacebookAccountPanel::onFacebookConnectStateChange(const LLSD& data) +{ + if(LLFacebookConnect::instance().isConnected()) + { + //In process of disconnecting so leave the layout as is + if(data.get("enum").asInteger() != LLFacebookConnect::FB_DISCONNECTING) + { + showConnectedLayout(); + } + } + else + { + showDisconnectedLayout(); + } + + return false; +} + +bool LLFacebookAccountPanel::onFacebookConnectInfoChange() +{ + LLSD info = LLFacebookConnect::instance().getInfo(); + std::string clickable_name; + + //Strings of format [http://www.somewebsite.com Click Me] become clickable text + if(info.has("link") && info.has("name")) + { + clickable_name = "[" + info["link"].asString() + " " + info["name"].asString() + "]"; + } + + mAccountNameLabel->setText(clickable_name); + + return false; +} + +void LLFacebookAccountPanel::showConnectButton() +{ + if(!mConnectButton->getVisible()) + { + mConnectButton->setVisible(TRUE); + mDisconnectButton->setVisible(FALSE); + } +} + +void LLFacebookAccountPanel::hideConnectButton() +{ + if(mConnectButton->getVisible()) + { + mConnectButton->setVisible(FALSE); + mDisconnectButton->setVisible(TRUE); + } +} + +void LLFacebookAccountPanel::showDisconnectedLayout() +{ + mAccountCaptionLabel->setText(getString("facebook_disconnected")); + mAccountNameLabel->setText(std::string("")); + showConnectButton(); +} + +void LLFacebookAccountPanel::showConnectedLayout() +{ + LLFacebookConnect::instance().loadFacebookInfo(); + + mAccountCaptionLabel->setText(getString("facebook_connected")); + hideConnectButton(); +} + +void LLFacebookAccountPanel::onConnect() +{ + LLFacebookConnect::instance().checkConnectionToFacebook(true); + + //Clear only the facebook browser cookies so that the facebook login screen appears + LLViewerMedia::getCookieStore()->removeCookiesByDomain(".facebook.com"); +} + +void LLFacebookAccountPanel::onDisconnect() +{ + LLFacebookConnect::instance().disconnectFromFacebook(); + + LLViewerMedia::getCookieStore()->removeCookiesByDomain(".facebook.com"); +} + +//////////////////////// +//LLFloaterFacebook/////// +//////////////////////// + +LLFloaterFacebook::LLFloaterFacebook(const LLSD& key) : LLFloater(key), + mFacebookPhotoPanel(NULL), + mStatusErrorText(NULL), + mStatusLoadingText(NULL), + mStatusLoadingIndicator(NULL) +{ + mCommitCallbackRegistrar.add("SocialSharing.Cancel", boost::bind(&LLFloaterFacebook::onCancel, this)); +} + +void LLFloaterFacebook::onCancel() +{ + closeFloater(); +} + +BOOL LLFloaterFacebook::postBuild() +{ + // Keep tab of the Photo Panel + mFacebookPhotoPanel = static_cast(getChild("panel_facebook_photo")); + // Connection status widgets + mStatusErrorText = getChild("connection_error_text"); + mStatusLoadingText = getChild("connection_loading_text"); + mStatusLoadingIndicator = getChild("connection_loading_indicator"); + return LLFloater::postBuild(); +} + +void LLFloaterFacebook::showPhotoPanel() +{ + LLTabContainer* parent = dynamic_cast(mFacebookPhotoPanel->getParent()); + if (!parent) + { + llwarns << "Cannot find panel container" << llendl; + return; + } + + parent->selectTabPanel(mFacebookPhotoPanel); +} + +// static +void LLFloaterFacebook::preUpdate() +{ + LLFloaterFacebook* instance = LLFloaterReg::findTypedInstance("facebook"); + if (instance) + { + //Will set file size text to 'unknown' + instance->mFacebookPhotoPanel->updateControls(); + } +} + +// static +void LLFloaterFacebook::postUpdate() +{ + LLFloaterFacebook* instance = LLFloaterReg::findTypedInstance("facebook"); + if (instance) + { + //Will set the file size text + instance->mFacebookPhotoPanel->updateControls(); + + // The refresh button is initially hidden. We show it after the first update, + // i.e. after snapshot is taken + LLUICtrl * refresh_button = instance->mFacebookPhotoPanel->getRefreshBtn(); + + if (!refresh_button->getVisible()) + { + refresh_button->setVisible(true); + } + + } +} + +void LLFloaterFacebook::draw() +{ + if (mStatusErrorText && mStatusLoadingText && mStatusLoadingIndicator) + { + mStatusErrorText->setVisible(false); + mStatusLoadingText->setVisible(false); + mStatusLoadingIndicator->setVisible(false); + LLFacebookConnect::EConnectionState connection_state = LLFacebookConnect::instance().getConnectionState(); + std::string status_text; + + switch (connection_state) + { + case LLFacebookConnect::FB_NOT_CONNECTED: + // No status displayed when first opening the panel and no connection done + case LLFacebookConnect::FB_CONNECTED: + // When successfully connected, no message is displayed + case LLFacebookConnect::FB_POSTED: + // No success message to show since we actually close the floater after successful posting completion + break; + case LLFacebookConnect::FB_CONNECTION_IN_PROGRESS: + // Connection loading indicator + mStatusLoadingText->setVisible(true); + status_text = LLTrans::getString("SocialFacebookConnecting"); + mStatusLoadingText->setValue(status_text); + mStatusLoadingIndicator->setVisible(true); + break; + case LLFacebookConnect::FB_POSTING: + // Posting indicator + mStatusLoadingText->setVisible(true); + status_text = LLTrans::getString("SocialFacebookPosting"); + mStatusLoadingText->setValue(status_text); + mStatusLoadingIndicator->setVisible(true); + break; + case LLFacebookConnect::FB_CONNECTION_FAILED: + // Error connecting to the service + mStatusErrorText->setVisible(true); + status_text = LLTrans::getString("SocialFacebookErrorConnecting"); + mStatusErrorText->setValue(status_text); + break; + case LLFacebookConnect::FB_POST_FAILED: + // Error posting to the service + mStatusErrorText->setVisible(true); + status_text = LLTrans::getString("SocialFacebookErrorPosting"); + mStatusErrorText->setValue(status_text); + break; + case LLFacebookConnect::FB_DISCONNECTING: + // Disconnecting loading indicator + mStatusLoadingText->setVisible(true); + status_text = LLTrans::getString("SocialFacebookDisconnecting"); + mStatusLoadingText->setValue(status_text); + mStatusLoadingIndicator->setVisible(true); + break; + case LLFacebookConnect::FB_DISCONNECT_FAILED: + // Error disconnecting from the service + mStatusErrorText->setVisible(true); + status_text = LLTrans::getString("SocialFacebookErrorDisconnecting"); + mStatusErrorText->setValue(status_text); + break; + } + } + LLFloater::draw(); +} + diff --git a/indra/newview/llfloaterfacebook.h b/indra/newview/llfloaterfacebook.h new file mode 100644 index 0000000000..ab6420264b --- /dev/null +++ b/indra/newview/llfloaterfacebook.h @@ -0,0 +1,167 @@ +/** +* @file llfloaterfacebook.h +* @brief Header file for llfloaterfacebook +* @author Gilbert@lindenlab.com +* +* $LicenseInfo:firstyear=2013&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2013, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ +#ifndef LL_LLFLOATERFACEBOOK_H +#define LL_LLFLOATERFACEBOOK_H + +#include "llfloater.h" +#include "lltextbox.h" +#include "llviewertexture.h" + +class LLIconCtrl; +class LLCheckBoxCtrl; +class LLSnapshotLivePreview; + +class LLFacebookStatusPanel : public LLPanel +{ +public: + LLFacebookStatusPanel(); + BOOL postBuild(); + void draw(); + void onSend(); + bool onFacebookConnectStateChange(const LLSD& data); + + void sendStatus(); + void clearAndClose(); + +private: + LLUICtrl* mMessageTextEditor; + LLUICtrl* mPostButton; + LLUICtrl* mCancelButton; +}; + +class LLFacebookPhotoPanel : public LLPanel +{ +public: + LLFacebookPhotoPanel(); + ~LLFacebookPhotoPanel(); + + BOOL postBuild(); + void draw(); + + LLSnapshotLivePreview* getPreviewView(); + void onVisibilityChange(const LLSD& new_visibility); + void onClickNewSnapshot(); + void onSend(); + bool onFacebookConnectStateChange(const LLSD& data); + + void sendPhoto(); + void clearAndClose(); + + void updateControls(); + void updateResolution(BOOL do_update); + void checkAspectRatio(S32 index); + LLUICtrl* getRefreshBtn(); + +private: + LLHandle mPreviewHandle; + + LLUICtrl * mSnapshotPanel; + LLUICtrl * mResolutionComboBox; + LLUICtrl * mRefreshBtn; + LLUICtrl * mWorkingLabel; + LLUICtrl * mThumbnailPlaceholder; + LLUICtrl * mCaptionTextBox; + LLUICtrl * mLocationCheckbox; + LLUICtrl * mPostButton; + LLUICtrl* mCancelButton; +}; + +class LLFacebookCheckinPanel : public LLPanel +{ +public: + LLFacebookCheckinPanel(); + BOOL postBuild(); + void draw(); + void onSend(); + bool onFacebookConnectStateChange(const LLSD& data); + + void sendCheckin(); + void clearAndClose(); + +private: + std::string mMapUrl; + LLPointer mMapTexture; + LLUICtrl* mPostButton; + LLUICtrl* mCancelButton; + LLUICtrl* mMessageTextEditor; + LLUICtrl* mMapLoadingIndicator; + LLIconCtrl* mMapPlaceholder; + LLIconCtrl* mMapDefault; + LLCheckBoxCtrl* mMapCheckBox; + bool mReloadingMapTexture; +}; + +class LLFacebookAccountPanel : public LLPanel +{ +public: + LLFacebookAccountPanel(); + BOOL postBuild(); + void draw(); + +private: + void onVisibilityChange(const LLSD& new_visibility); + bool onFacebookConnectStateChange(const LLSD& data); + bool onFacebookConnectInfoChange(); + void onConnect(); + void onUseAnotherAccount(); + void onDisconnect(); + + void showConnectButton(); + void hideConnectButton(); + void showDisconnectedLayout(); + void showConnectedLayout(); + + LLTextBox * mAccountCaptionLabel; + LLTextBox * mAccountNameLabel; + LLUICtrl * mPanelButtons; + LLUICtrl * mConnectButton; + LLUICtrl * mDisconnectButton; +}; + + +class LLFloaterFacebook : public LLFloater +{ +public: + LLFloaterFacebook(const LLSD& key); + BOOL postBuild(); + void draw(); + void onCancel(); + + void showPhotoPanel(); + + static void preUpdate(); + static void postUpdate(); + +private: + LLFacebookPhotoPanel* mFacebookPhotoPanel; + LLTextBox* mStatusErrorText; + LLTextBox* mStatusLoadingText; + LLUICtrl* mStatusLoadingIndicator; +}; + +#endif // LL_LLFLOATERFACEBOOK_H + diff --git a/indra/newview/llfloaterflickr.cpp b/indra/newview/llfloaterflickr.cpp index 61ebe563a3..0a4c3f091b 100644 --- a/indra/newview/llfloaterflickr.cpp +++ b/indra/newview/llfloaterflickr.cpp @@ -570,7 +570,7 @@ void LLFlickrAccountPanel::onDisconnect() //////////////////////// LLFloaterFlickr::LLFloaterFlickr(const LLSD& key) : LLFloater(key), - mSocialPhotoPanel(NULL), + mFlickrPhotoPanel(NULL), mStatusErrorText(NULL), mStatusLoadingText(NULL), mStatusLoadingIndicator(NULL) @@ -586,7 +586,7 @@ void LLFloaterFlickr::onCancel() BOOL LLFloaterFlickr::postBuild() { // Keep tab of the Photo Panel - mSocialPhotoPanel = static_cast(getChild("panel_flickr_photo")); + mFlickrPhotoPanel = static_cast(getChild("panel_flickr_photo")); // Connection status widgets mStatusErrorText = getChild("connection_error_text"); mStatusLoadingText = getChild("connection_loading_text"); @@ -596,14 +596,14 @@ BOOL LLFloaterFlickr::postBuild() void LLFloaterFlickr::showPhotoPanel() { - LLTabContainer* parent = dynamic_cast(mSocialPhotoPanel->getParent()); + LLTabContainer* parent = dynamic_cast(mFlickrPhotoPanel->getParent()); if (!parent) { llwarns << "Cannot find panel container" << llendl; return; } - parent->selectTabPanel(mSocialPhotoPanel); + parent->selectTabPanel(mFlickrPhotoPanel); } // static @@ -613,7 +613,7 @@ void LLFloaterFlickr::preUpdate() if (instance) { //Will set file size text to 'unknown' - instance->mSocialPhotoPanel->updateControls(); + instance->mFlickrPhotoPanel->updateControls(); } } @@ -624,11 +624,11 @@ void LLFloaterFlickr::postUpdate() if (instance) { //Will set the file size text - instance->mSocialPhotoPanel->updateControls(); + instance->mFlickrPhotoPanel->updateControls(); // The refresh button is initially hidden. We show it after the first update, // i.e. after snapshot is taken - LLUICtrl * refresh_button = instance->mSocialPhotoPanel->getRefreshBtn(); + LLUICtrl * refresh_button = instance->mFlickrPhotoPanel->getRefreshBtn(); if (!refresh_button->getVisible()) { diff --git a/indra/newview/llfloaterflickr.h b/indra/newview/llfloaterflickr.h index e9005444d8..9a329d4451 100644 --- a/indra/newview/llfloaterflickr.h +++ b/indra/newview/llfloaterflickr.h @@ -117,7 +117,7 @@ public: static void postUpdate(); private: - LLFlickrPhotoPanel* mSocialPhotoPanel; + LLFlickrPhotoPanel* mFlickrPhotoPanel; LLTextBox* mStatusErrorText; LLTextBox* mStatusLoadingText; LLUICtrl* mStatusLoadingIndicator; diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 4701e128d3..c3efc26991 100755 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -31,7 +31,7 @@ #include "llagent.h" #include "llfacebookconnect.h" #include "llfloaterreg.h" -#include "llfloatersocial.h" +#include "llfloaterfacebook.h" #include "llfloaterflickr.h" #include "llfloatertwitter.h" #include "llcheckboxctrl.h" @@ -1266,11 +1266,11 @@ S32 LLFloaterSnapshot::notify(const LLSD& info) void LLFloaterSnapshot::update() { LLFloaterSnapshot* inst = LLFloaterReg::findTypedInstance("snapshot"); - LLFloaterSocial* floater_social = LLFloaterReg::findTypedInstance("social"); + LLFloaterFacebook* floater_facebook = LLFloaterReg::findTypedInstance("facebook"); LLFloaterFlickr* floater_flickr = LLFloaterReg::findTypedInstance("flickr"); LLFloaterTwitter* floater_twitter = LLFloaterReg::findTypedInstance("twitter"); - if (!inst && !floater_social && !floater_flickr && !floater_twitter) + if (!inst && !floater_facebook && !floater_flickr && !floater_twitter) return; BOOL changed = FALSE; diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp deleted file mode 100644 index e7be8cc8cc..0000000000 --- a/indra/newview/llfloatersocial.cpp +++ /dev/null @@ -1,939 +0,0 @@ -/** -* @file llfloatersocial.cpp -* @brief Implementation of llfloatersocial -* @author Gilbert@lindenlab.com -* -* $LicenseInfo:firstyear=2013&license=viewerlgpl$ -* Second Life Viewer Source Code -* Copyright (C) 2013, Linden Research, Inc. -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU Lesser General Public -* License as published by the Free Software Foundation; -* version 2.1 of the License only. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -* -* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA -* $/LicenseInfo$ -*/ - -#include "llviewerprecompiledheaders.h" - -#include "llfloatersocial.h" - -#include "llagent.h" -#include "llagentui.h" -#include "llcheckboxctrl.h" -#include "llcombobox.h" -#include "llfacebookconnect.h" -#include "llfloaterreg.h" -#include "lliconctrl.h" -#include "llresmgr.h" // LLLocale -#include "llsdserialize.h" -#include "llloadingindicator.h" -#include "llplugincookiestore.h" -#include "llslurl.h" -#include "lltrans.h" -#include "llsnapshotlivepreview.h" -#include "llviewerregion.h" -#include "llviewercontrol.h" -#include "llviewermedia.h" -#include "lltabcontainer.h" - -static LLRegisterPanelClassWrapper t_panel_status("llsocialstatuspanel"); -static LLRegisterPanelClassWrapper t_panel_photo("llsocialphotopanel"); -static LLRegisterPanelClassWrapper t_panel_checkin("llsocialcheckinpanel"); -static LLRegisterPanelClassWrapper t_panel_account("llsocialaccountpanel"); - -const S32 MAX_POSTCARD_DATASIZE = 1024 * 1024; // one megabyte -const std::string DEFAULT_CHECKIN_LOCATION_URL = "http://maps.secondlife.com/"; -const std::string DEFAULT_CHECKIN_ICON_URL = "http://map.secondlife.com.s3.amazonaws.com/map_placeholder.png"; -const std::string DEFAULT_CHECKIN_QUERY_PARAMETERS = "?sourceid=slshare_checkin&utm_source=facebook&utm_medium=checkin&utm_campaign=slshare"; -const std::string DEFAULT_PHOTO_QUERY_PARAMETERS = "?sourceid=slshare_photo&utm_source=facebook&utm_medium=photo&utm_campaign=slshare"; - -std::string get_map_url() -{ - LLVector3d center_agent; - LLViewerRegion *regionp = gAgent.getRegion(); - if (regionp) - { - center_agent = regionp->getCenterGlobal(); - } - int x_pos = center_agent[0] / 256.0; - int y_pos = center_agent[1] / 256.0; - std::string map_url = gSavedSettings.getString("CurrentMapServerURL") + llformat("map-1-%d-%d-objects.jpg", x_pos, y_pos); - return map_url; -} - -/////////////////////////// -//LLSocialStatusPanel////// -/////////////////////////// - -LLSocialStatusPanel::LLSocialStatusPanel() : - mMessageTextEditor(NULL), - mPostButton(NULL), - mCancelButton(NULL) -{ - mCommitCallbackRegistrar.add("SocialSharing.SendStatus", boost::bind(&LLSocialStatusPanel::onSend, this)); -} - -BOOL LLSocialStatusPanel::postBuild() -{ - mMessageTextEditor = getChild("status_message"); - mPostButton = getChild("post_status_btn"); - mCancelButton = getChild("cancel_status_btn"); - - return LLPanel::postBuild(); -} - -void LLSocialStatusPanel::draw() -{ - if (mMessageTextEditor && mPostButton && mCancelButton) - { - bool no_ongoing_connection = !(LLFacebookConnect::instance().isTransactionOngoing()); - std::string message = mMessageTextEditor->getValue().asString(); - mMessageTextEditor->setEnabled(no_ongoing_connection); - mCancelButton->setEnabled(no_ongoing_connection); - mPostButton->setEnabled(no_ongoing_connection && !message.empty()); - } - - LLPanel::draw(); -} - -void LLSocialStatusPanel::onSend() -{ - LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialStatusPanel"); // just in case it is already listening - LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialStatusPanel", boost::bind(&LLSocialStatusPanel::onFacebookConnectStateChange, this, _1)); - - // Connect to Facebook if necessary and then post - if (LLFacebookConnect::instance().isConnected()) - { - sendStatus(); - } - else - { - LLFacebookConnect::instance().checkConnectionToFacebook(true); - } -} - -bool LLSocialStatusPanel::onFacebookConnectStateChange(const LLSD& data) -{ - switch (data.get("enum").asInteger()) - { - case LLFacebookConnect::FB_CONNECTED: - sendStatus(); - break; - - case LLFacebookConnect::FB_POSTED: - LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialStatusPanel"); - clearAndClose(); - break; - } - - return false; -} - -void LLSocialStatusPanel::sendStatus() -{ - std::string message = mMessageTextEditor->getValue().asString(); - if (!message.empty()) - { - LLFacebookConnect::instance().updateStatus(message); - } -} - -void LLSocialStatusPanel::clearAndClose() -{ - mMessageTextEditor->setValue(""); - - LLFloater* floater = getParentByType(); - if (floater) - { - floater->closeFloater(); - } -} - -/////////////////////////// -//LLSocialPhotoPanel/////// -/////////////////////////// - -LLSocialPhotoPanel::LLSocialPhotoPanel() : -mSnapshotPanel(NULL), -mResolutionComboBox(NULL), -mRefreshBtn(NULL), -mWorkingLabel(NULL), -mThumbnailPlaceholder(NULL), -mCaptionTextBox(NULL), -mLocationCheckbox(NULL), -mPostButton(NULL) -{ - mCommitCallbackRegistrar.add("SocialSharing.SendPhoto", boost::bind(&LLSocialPhotoPanel::onSend, this)); - mCommitCallbackRegistrar.add("SocialSharing.RefreshPhoto", boost::bind(&LLSocialPhotoPanel::onClickNewSnapshot, this)); -} - -LLSocialPhotoPanel::~LLSocialPhotoPanel() -{ - if(mPreviewHandle.get()) - { - mPreviewHandle.get()->die(); - } -} - -BOOL LLSocialPhotoPanel::postBuild() -{ - setVisibleCallback(boost::bind(&LLSocialPhotoPanel::onVisibilityChange, this, _2)); - - mSnapshotPanel = getChild("snapshot_panel"); - mResolutionComboBox = getChild("resolution_combobox"); - mResolutionComboBox->setCommitCallback(boost::bind(&LLSocialPhotoPanel::updateResolution, this, TRUE)); - mRefreshBtn = getChild("new_snapshot_btn"); - mWorkingLabel = getChild("working_lbl"); - mThumbnailPlaceholder = getChild("thumbnail_placeholder"); - mCaptionTextBox = getChild("photo_caption"); - mLocationCheckbox = getChild("add_location_cb"); - mPostButton = getChild("post_photo_btn"); - mCancelButton = getChild("cancel_photo_btn"); - - return LLPanel::postBuild(); -} - -void LLSocialPhotoPanel::draw() -{ - LLSnapshotLivePreview * previewp = static_cast(mPreviewHandle.get()); - - // Enable interaction only if no transaction with the service is on-going (prevent duplicated posts) - bool no_ongoing_connection = !(LLFacebookConnect::instance().isTransactionOngoing()); - mCancelButton->setEnabled(no_ongoing_connection); - mCaptionTextBox->setEnabled(no_ongoing_connection); - mResolutionComboBox->setEnabled(no_ongoing_connection); - mRefreshBtn->setEnabled(no_ongoing_connection); - mLocationCheckbox->setEnabled(no_ongoing_connection); - - // Display the preview if one is available - if (previewp && previewp->getThumbnailImage()) - { - const LLRect& thumbnail_rect = mThumbnailPlaceholder->getRect(); - const S32 thumbnail_w = previewp->getThumbnailWidth(); - const S32 thumbnail_h = previewp->getThumbnailHeight(); - - // calc preview offset within the preview rect - const S32 local_offset_x = (thumbnail_rect.getWidth() - thumbnail_w) / 2 ; - const S32 local_offset_y = (thumbnail_rect.getHeight() - thumbnail_h) / 2 ; - - // calc preview offset within the floater rect - // Hack : To get the full offset, we need to take into account each and every offset of each widgets up to the floater. - // This is almost as arbitrary as using a fixed offset so that's what we do here for the sake of simplicity. - // *TODO : Get the offset looking through the hierarchy of widgets, should be done in postBuild() so to avoid traversing the hierarchy each time. - S32 offset_x = thumbnail_rect.mLeft + local_offset_x - 1; - S32 offset_y = thumbnail_rect.mBottom + local_offset_y - 39; - - mSnapshotPanel->localPointToOtherView(offset_x, offset_y, &offset_x, &offset_y, getParentByType()); - - gGL.matrixMode(LLRender::MM_MODELVIEW); - // Apply floater transparency to the texture unless the floater is focused. - F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); - LLColor4 color = LLColor4::white; - gl_draw_scaled_image(offset_x, offset_y, - thumbnail_w, thumbnail_h, - previewp->getThumbnailImage(), color % alpha); - - previewp->drawPreviewRect(offset_x, offset_y) ; - } - - // Update the visibility of the working (computing preview) label - mWorkingLabel->setVisible(!(previewp && previewp->getSnapshotUpToDate())); - - // Enable Post if we have a preview to send and no on going connection being processed - mPostButton->setEnabled(no_ongoing_connection && (previewp && previewp->getSnapshotUpToDate())); - - // Draw the rest of the panel on top of it - LLPanel::draw(); -} - -LLSnapshotLivePreview* LLSocialPhotoPanel::getPreviewView() -{ - LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)mPreviewHandle.get(); - return previewp; -} - -void LLSocialPhotoPanel::onVisibilityChange(const LLSD& new_visibility) -{ - bool visible = new_visibility.asBoolean(); - if (visible) - { - if (mPreviewHandle.get()) - { - LLSnapshotLivePreview* preview = getPreviewView(); - if(preview) - { - lldebugs << "opened, updating snapshot" << llendl; - preview->updateSnapshot(TRUE); - } - } - else - { - LLRect full_screen_rect = getRootView()->getRect(); - LLSnapshotLivePreview::Params p; - p.rect(full_screen_rect); - LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p); - mPreviewHandle = previewp->getHandle(); - - previewp->setSnapshotType(previewp->SNAPSHOT_WEB); - previewp->setSnapshotFormat(LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG); - //previewp->setSnapshotQuality(98); - previewp->setThumbnailPlaceholderRect(mThumbnailPlaceholder->getRect()); - - updateControls(); - } - } -} - -void LLSocialPhotoPanel::onClickNewSnapshot() -{ - LLSnapshotLivePreview* previewp = getPreviewView(); - if (previewp) - { - //setStatus(Impl::STATUS_READY); - lldebugs << "updating snapshot" << llendl; - previewp->updateSnapshot(TRUE); - } -} - -void LLSocialPhotoPanel::onSend() -{ - LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialPhotoPanel"); // just in case it is already listening - LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialPhotoPanel", boost::bind(&LLSocialPhotoPanel::onFacebookConnectStateChange, this, _1)); - - // Connect to Facebook if necessary and then post - if (LLFacebookConnect::instance().isConnected()) - { - sendPhoto(); - } - else - { - LLFacebookConnect::instance().checkConnectionToFacebook(true); - } -} - -bool LLSocialPhotoPanel::onFacebookConnectStateChange(const LLSD& data) -{ - switch (data.get("enum").asInteger()) - { - case LLFacebookConnect::FB_CONNECTED: - sendPhoto(); - break; - - case LLFacebookConnect::FB_POSTED: - LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialPhotoPanel"); - clearAndClose(); - break; - } - - return false; -} - -void LLSocialPhotoPanel::sendPhoto() -{ - // Get the caption - std::string caption = mCaptionTextBox->getValue().asString(); - - // Add the location if required - bool add_location = mLocationCheckbox->getValue().asBoolean(); - if (add_location) - { - // Get the SLURL for the location - LLSLURL slurl; - LLAgentUI::buildSLURL(slurl); - std::string slurl_string = slurl.getSLURLString(); - - // Add query parameters so Google Analytics can track incoming clicks! - slurl_string += DEFAULT_PHOTO_QUERY_PARAMETERS; - - // Add it to the caption (pretty crude, but we don't have a better option with photos) - if (caption.empty()) - caption = slurl_string; - else - caption = caption + " " + slurl_string; - } - - // Get the image - LLSnapshotLivePreview* previewp = getPreviewView(); - - // Post to Facebook - LLFacebookConnect::instance().sharePhoto(previewp->getFormattedImage(), caption); - - updateControls(); -} - -void LLSocialPhotoPanel::clearAndClose() -{ - mCaptionTextBox->setValue(""); - - LLFloater* floater = getParentByType(); - if (floater) - { - floater->closeFloater(); - } -} - -void LLSocialPhotoPanel::updateControls() -{ - LLSnapshotLivePreview* previewp = getPreviewView(); - BOOL got_bytes = previewp && previewp->getDataSize() > 0; - BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); - LLSnapshotLivePreview::ESnapshotType shot_type = (previewp ? previewp->getSnapshotType() : LLSnapshotLivePreview::SNAPSHOT_POSTCARD); - - // *TODO: Separate maximum size for Web images from postcards - lldebugs << "Is snapshot up-to-date? " << got_snap << llendl; - - LLLocale locale(LLLocale::USER_LOCALE); - std::string bytes_string; - if (got_snap) - { - LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 ); - } - - //getChild("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : getString("unknown")); <---uses localized string - getChild("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : "unknown"); - getChild("file_size_label")->setColor( - shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD - && got_bytes - && previewp->getDataSize() > MAX_POSTCARD_DATASIZE ? LLUIColor(LLColor4::red) : LLUIColorTable::instance().getColor( "LabelTextColor" )); - - updateResolution(FALSE); -} - -void LLSocialPhotoPanel::updateResolution(BOOL do_update) -{ - LLComboBox* combobox = static_cast(mResolutionComboBox); - - std::string sdstring = combobox->getSelectedValue(); - LLSD sdres; - std::stringstream sstream(sdstring); - LLSDSerialize::fromNotation(sdres, sstream, sdstring.size()); - - S32 width = sdres[0]; - S32 height = sdres[1]; - - LLSnapshotLivePreview * previewp = static_cast(mPreviewHandle.get()); - if (previewp && combobox->getCurrentIndex() >= 0) - { - S32 original_width = 0 , original_height = 0 ; - previewp->getSize(original_width, original_height) ; - - if (width == 0 || height == 0) - { - // take resolution from current window size - lldebugs << "Setting preview res from window: " << gViewerWindow->getWindowWidthRaw() << "x" << gViewerWindow->getWindowHeightRaw() << llendl; - previewp->setSize(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw()); - } - else - { - // use the resolution from the selected pre-canned drop-down choice - lldebugs << "Setting preview res selected from combo: " << width << "x" << height << llendl; - previewp->setSize(width, height); - } - - checkAspectRatio(width); - - previewp->getSize(width, height); - - if(original_width != width || original_height != height) - { - previewp->setSize(width, height); - - // hide old preview as the aspect ratio could be wrong - lldebugs << "updating thumbnail" << llendl; - - previewp->updateSnapshot(FALSE, TRUE); - if(do_update) - { - lldebugs << "Will update controls" << llendl; - updateControls(); - LLSocialPhotoPanel::onClickNewSnapshot(); - } - } - - } -} - -void LLSocialPhotoPanel::checkAspectRatio(S32 index) -{ - LLSnapshotLivePreview *previewp = getPreviewView() ; - - BOOL keep_aspect = FALSE; - - if (0 == index) // current window size - { - keep_aspect = TRUE; - } - else // predefined resolution - { - keep_aspect = FALSE; - } - - if (previewp) - { - previewp->mKeepAspectRatio = keep_aspect; - } -} - -LLUICtrl* LLSocialPhotoPanel::getRefreshBtn() -{ - return mRefreshBtn; -} - -//////////////////////// -//LLSocialCheckinPanel// -//////////////////////// - -LLSocialCheckinPanel::LLSocialCheckinPanel() : - mMapUrl(""), - mReloadingMapTexture(false) -{ - mCommitCallbackRegistrar.add("SocialSharing.SendCheckin", boost::bind(&LLSocialCheckinPanel::onSend, this)); -} - -BOOL LLSocialCheckinPanel::postBuild() -{ - // Keep pointers to widgets so we don't traverse the UI hierarchy too often - mPostButton = getChild("post_place_btn"); - mCancelButton = getChild("cancel_place_btn"); - mMessageTextEditor = getChild("place_caption"); - mMapLoadingIndicator = getChild("map_loading_indicator"); - mMapPlaceholder = getChild("map_placeholder"); - mMapDefault = getChild("map_default"); - mMapCheckBox = getChild("add_place_view_cb"); - - return LLPanel::postBuild(); -} - -void LLSocialCheckinPanel::draw() -{ - bool no_ongoing_connection = !(LLFacebookConnect::instance().isTransactionOngoing()); - mPostButton->setEnabled(no_ongoing_connection); - mCancelButton->setEnabled(no_ongoing_connection); - mMessageTextEditor->setEnabled(no_ongoing_connection); - mMapCheckBox->setEnabled(no_ongoing_connection); - - std::string map_url = get_map_url(); - // Did we change location? - if (map_url != mMapUrl) - { - mMapUrl = map_url; - // Load the map tile - mMapTexture = LLViewerTextureManager::getFetchedTextureFromUrl(mMapUrl, FTT_MAP_TILE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); - mMapTexture->setBoostLevel(LLGLTexture::BOOST_MAP); - mReloadingMapTexture = true; - // In the meantime, put the "loading" indicator on, hide the tile map and disable the checkbox - mMapLoadingIndicator->setVisible(true); - mMapPlaceholder->setVisible(false); - } - // Are we done loading the map tile? - if (mReloadingMapTexture && mMapTexture->isFullyLoaded()) - { - // Don't do it again next time around - mReloadingMapTexture = false; - // Convert the map texture to the appropriate image object - LLPointer ui_image = new LLUIImage(mMapUrl, mMapTexture); - // Load the map widget with the correct map tile image - mMapPlaceholder->setImage(ui_image); - // Now hide the loading indicator, bring the tile in view and reenable the checkbox with its previous value - mMapLoadingIndicator->setVisible(false); - mMapPlaceholder->setVisible(true); - } - // Show the default icon if that's the checkbox value (the real one...) - // This will hide/show the loading indicator and/or tile underneath - mMapDefault->setVisible(!(mMapCheckBox->get())); - - LLPanel::draw(); -} - -void LLSocialCheckinPanel::onSend() -{ - LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialCheckinPanel"); // just in case it is already listening - LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialCheckinPanel", boost::bind(&LLSocialCheckinPanel::onFacebookConnectStateChange, this, _1)); - - // Connect to Facebook if necessary and then post - if (LLFacebookConnect::instance().isConnected()) - { - sendCheckin(); - } - else - { - LLFacebookConnect::instance().checkConnectionToFacebook(true); - } -} - -bool LLSocialCheckinPanel::onFacebookConnectStateChange(const LLSD& data) -{ - switch (data.get("enum").asInteger()) - { - case LLFacebookConnect::FB_CONNECTED: - sendCheckin(); - break; - - case LLFacebookConnect::FB_POSTED: - LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialCheckinPanel"); - clearAndClose(); - break; - } - - return false; -} - -void LLSocialCheckinPanel::sendCheckin() -{ - // Get the location SLURL - LLSLURL slurl; - LLAgentUI::buildSLURL(slurl); - std::string slurl_string = slurl.getSLURLString(); - - // Use a valid http:// URL if the scheme is secondlife:// - LLURI slurl_uri(slurl_string); - if (slurl_uri.scheme() == LLSLURL::SLURL_SECONDLIFE_SCHEME) - { - slurl_string = DEFAULT_CHECKIN_LOCATION_URL; - } - - // Add query parameters so Google Analytics can track incoming clicks! - slurl_string += DEFAULT_CHECKIN_QUERY_PARAMETERS; - - // Get the region name - std::string region_name(""); - LLViewerRegion *regionp = gAgent.getRegion(); - if (regionp) - { - region_name = regionp->getName(); - } - - // Get the region description - std::string description; - LLAgentUI::buildLocationString(description, LLAgentUI::LOCATION_FORMAT_NORMAL_COORDS, gAgent.getPositionAgent()); - - // Optionally add the region map view - bool add_map_view = mMapCheckBox->getValue().asBoolean(); - std::string map_url = (add_map_view ? get_map_url() : DEFAULT_CHECKIN_ICON_URL); - - // Get the caption - std::string caption = mMessageTextEditor->getValue().asString(); - - // Post to Facebook - LLFacebookConnect::instance().postCheckin(slurl_string, region_name, description, map_url, caption); -} - -void LLSocialCheckinPanel::clearAndClose() -{ - mMessageTextEditor->setValue(""); - - LLFloater* floater = getParentByType(); - if (floater) - { - floater->closeFloater(); - } -} - -/////////////////////////// -//LLSocialAccountPanel////// -/////////////////////////// - -LLSocialAccountPanel::LLSocialAccountPanel() : -mAccountCaptionLabel(NULL), -mAccountNameLabel(NULL), -mPanelButtons(NULL), -mConnectButton(NULL), -mDisconnectButton(NULL) -{ - mCommitCallbackRegistrar.add("SocialSharing.Connect", boost::bind(&LLSocialAccountPanel::onConnect, this)); - mCommitCallbackRegistrar.add("SocialSharing.Disconnect", boost::bind(&LLSocialAccountPanel::onDisconnect, this)); - - setVisibleCallback(boost::bind(&LLSocialAccountPanel::onVisibilityChange, this, _2)); -} - -BOOL LLSocialAccountPanel::postBuild() -{ - mAccountCaptionLabel = getChild("account_caption_label"); - mAccountNameLabel = getChild("account_name_label"); - mPanelButtons = getChild("panel_buttons"); - mConnectButton = getChild("connect_btn"); - mDisconnectButton = getChild("disconnect_btn"); - - return LLPanel::postBuild(); -} - -void LLSocialAccountPanel::draw() -{ - LLFacebookConnect::EConnectionState connection_state = LLFacebookConnect::instance().getConnectionState(); - - //Disable the 'disconnect' button and the 'use another account' button when disconnecting in progress - bool disconnecting = connection_state == LLFacebookConnect::FB_DISCONNECTING; - mDisconnectButton->setEnabled(!disconnecting); - - //Disable the 'connect' button when a connection is in progress - bool connecting = connection_state == LLFacebookConnect::FB_CONNECTION_IN_PROGRESS; - mConnectButton->setEnabled(!connecting); - - LLPanel::draw(); -} - -void LLSocialAccountPanel::onVisibilityChange(const LLSD& new_visibility) -{ - bool visible = new_visibility.asBoolean(); - - if(visible) - { - LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialAccountPanel"); - LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialAccountPanel", boost::bind(&LLSocialAccountPanel::onFacebookConnectStateChange, this, _1)); - - LLEventPumps::instance().obtain("FacebookConnectInfo").stopListening("LLSocialAccountPanel"); - LLEventPumps::instance().obtain("FacebookConnectInfo").listen("LLSocialAccountPanel", boost::bind(&LLSocialAccountPanel::onFacebookConnectInfoChange, this)); - - //Connected - if(LLFacebookConnect::instance().isConnected()) - { - showConnectedLayout(); - } - //Check if connected (show disconnected layout in meantime) - else - { - showDisconnectedLayout(); - } - if ((LLFacebookConnect::instance().getConnectionState() == LLFacebookConnect::FB_NOT_CONNECTED) || - (LLFacebookConnect::instance().getConnectionState() == LLFacebookConnect::FB_CONNECTION_FAILED)) - { - LLFacebookConnect::instance().checkConnectionToFacebook(); - } - } - else - { - LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialAccountPanel"); - LLEventPumps::instance().obtain("FacebookConnectInfo").stopListening("LLSocialAccountPanel"); - } -} - -bool LLSocialAccountPanel::onFacebookConnectStateChange(const LLSD& data) -{ - if(LLFacebookConnect::instance().isConnected()) - { - //In process of disconnecting so leave the layout as is - if(data.get("enum").asInteger() != LLFacebookConnect::FB_DISCONNECTING) - { - showConnectedLayout(); - } - } - else - { - showDisconnectedLayout(); - } - - return false; -} - -bool LLSocialAccountPanel::onFacebookConnectInfoChange() -{ - LLSD info = LLFacebookConnect::instance().getInfo(); - std::string clickable_name; - - //Strings of format [http://www.somewebsite.com Click Me] become clickable text - if(info.has("link") && info.has("name")) - { - clickable_name = "[" + info["link"].asString() + " " + info["name"].asString() + "]"; - } - - mAccountNameLabel->setText(clickable_name); - - return false; -} - -void LLSocialAccountPanel::showConnectButton() -{ - if(!mConnectButton->getVisible()) - { - mConnectButton->setVisible(TRUE); - mDisconnectButton->setVisible(FALSE); - } -} - -void LLSocialAccountPanel::hideConnectButton() -{ - if(mConnectButton->getVisible()) - { - mConnectButton->setVisible(FALSE); - mDisconnectButton->setVisible(TRUE); - } -} - -void LLSocialAccountPanel::showDisconnectedLayout() -{ - mAccountCaptionLabel->setText(getString("facebook_disconnected")); - mAccountNameLabel->setText(std::string("")); - showConnectButton(); -} - -void LLSocialAccountPanel::showConnectedLayout() -{ - LLFacebookConnect::instance().loadFacebookInfo(); - - mAccountCaptionLabel->setText(getString("facebook_connected")); - hideConnectButton(); -} - -void LLSocialAccountPanel::onConnect() -{ - LLFacebookConnect::instance().checkConnectionToFacebook(true); - - //Clear only the facebook browser cookies so that the facebook login screen appears - LLViewerMedia::getCookieStore()->removeCookiesByDomain(".facebook.com"); -} - -void LLSocialAccountPanel::onDisconnect() -{ - LLFacebookConnect::instance().disconnectFromFacebook(); - - LLViewerMedia::getCookieStore()->removeCookiesByDomain(".facebook.com"); -} - -//////////////////////// -//LLFloaterSocial/////// -//////////////////////// - -LLFloaterSocial::LLFloaterSocial(const LLSD& key) : LLFloater(key), - mSocialPhotoPanel(NULL), - mStatusErrorText(NULL), - mStatusLoadingText(NULL), - mStatusLoadingIndicator(NULL) -{ - mCommitCallbackRegistrar.add("SocialSharing.Cancel", boost::bind(&LLFloaterSocial::onCancel, this)); -} - -void LLFloaterSocial::onCancel() -{ - closeFloater(); -} - -BOOL LLFloaterSocial::postBuild() -{ - // Keep tab of the Photo Panel - mSocialPhotoPanel = static_cast(getChild("panel_social_photo")); - // Connection status widgets - mStatusErrorText = getChild("connection_error_text"); - mStatusLoadingText = getChild("connection_loading_text"); - mStatusLoadingIndicator = getChild("connection_loading_indicator"); - return LLFloater::postBuild(); -} - -void LLFloaterSocial::showPhotoPanel() -{ - LLTabContainer* parent = dynamic_cast(mSocialPhotoPanel->getParent()); - if (!parent) - { - llwarns << "Cannot find panel container" << llendl; - return; - } - - parent->selectTabPanel(mSocialPhotoPanel); -} - -// static -void LLFloaterSocial::preUpdate() -{ - LLFloaterSocial* instance = LLFloaterReg::findTypedInstance("social"); - if (instance) - { - //Will set file size text to 'unknown' - instance->mSocialPhotoPanel->updateControls(); - } -} - -// static -void LLFloaterSocial::postUpdate() -{ - LLFloaterSocial* instance = LLFloaterReg::findTypedInstance("social"); - if (instance) - { - //Will set the file size text - instance->mSocialPhotoPanel->updateControls(); - - // The refresh button is initially hidden. We show it after the first update, - // i.e. after snapshot is taken - LLUICtrl * refresh_button = instance->mSocialPhotoPanel->getRefreshBtn(); - - if (!refresh_button->getVisible()) - { - refresh_button->setVisible(true); - } - - } -} - -void LLFloaterSocial::draw() -{ - if (mStatusErrorText && mStatusLoadingText && mStatusLoadingIndicator) - { - mStatusErrorText->setVisible(false); - mStatusLoadingText->setVisible(false); - mStatusLoadingIndicator->setVisible(false); - LLFacebookConnect::EConnectionState connection_state = LLFacebookConnect::instance().getConnectionState(); - std::string status_text; - - switch (connection_state) - { - case LLFacebookConnect::FB_NOT_CONNECTED: - // No status displayed when first opening the panel and no connection done - case LLFacebookConnect::FB_CONNECTED: - // When successfully connected, no message is displayed - case LLFacebookConnect::FB_POSTED: - // No success message to show since we actually close the floater after successful posting completion - break; - case LLFacebookConnect::FB_CONNECTION_IN_PROGRESS: - // Connection loading indicator - mStatusLoadingText->setVisible(true); - status_text = LLTrans::getString("SocialFacebookConnecting"); - mStatusLoadingText->setValue(status_text); - mStatusLoadingIndicator->setVisible(true); - break; - case LLFacebookConnect::FB_POSTING: - // Posting indicator - mStatusLoadingText->setVisible(true); - status_text = LLTrans::getString("SocialFacebookPosting"); - mStatusLoadingText->setValue(status_text); - mStatusLoadingIndicator->setVisible(true); - break; - case LLFacebookConnect::FB_CONNECTION_FAILED: - // Error connecting to the service - mStatusErrorText->setVisible(true); - status_text = LLTrans::getString("SocialFacebookErrorConnecting"); - mStatusErrorText->setValue(status_text); - break; - case LLFacebookConnect::FB_POST_FAILED: - // Error posting to the service - mStatusErrorText->setVisible(true); - status_text = LLTrans::getString("SocialFacebookErrorPosting"); - mStatusErrorText->setValue(status_text); - break; - case LLFacebookConnect::FB_DISCONNECTING: - // Disconnecting loading indicator - mStatusLoadingText->setVisible(true); - status_text = LLTrans::getString("SocialFacebookDisconnecting"); - mStatusLoadingText->setValue(status_text); - mStatusLoadingIndicator->setVisible(true); - break; - case LLFacebookConnect::FB_DISCONNECT_FAILED: - // Error disconnecting from the service - mStatusErrorText->setVisible(true); - status_text = LLTrans::getString("SocialFacebookErrorDisconnecting"); - mStatusErrorText->setValue(status_text); - break; - } - } - LLFloater::draw(); -} - diff --git a/indra/newview/llfloatersocial.h b/indra/newview/llfloatersocial.h deleted file mode 100644 index 041ae8a268..0000000000 --- a/indra/newview/llfloatersocial.h +++ /dev/null @@ -1,167 +0,0 @@ -/** -* @file llfloatersocial.h -* @brief Header file for llfloatersocial -* @author Gilbert@lindenlab.com -* -* $LicenseInfo:firstyear=2013&license=viewerlgpl$ -* Second Life Viewer Source Code -* Copyright (C) 2013, Linden Research, Inc. -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU Lesser General Public -* License as published by the Free Software Foundation; -* version 2.1 of the License only. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -* -* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA -* $/LicenseInfo$ -*/ -#ifndef LL_LLFLOATERSOCIAL_H -#define LL_LLFLOATERSOCIAL_H - -#include "llfloater.h" -#include "lltextbox.h" -#include "llviewertexture.h" - -class LLIconCtrl; -class LLCheckBoxCtrl; -class LLSnapshotLivePreview; - -class LLSocialStatusPanel : public LLPanel -{ -public: - LLSocialStatusPanel(); - BOOL postBuild(); - void draw(); - void onSend(); - bool onFacebookConnectStateChange(const LLSD& data); - - void sendStatus(); - void clearAndClose(); - -private: - LLUICtrl* mMessageTextEditor; - LLUICtrl* mPostButton; - LLUICtrl* mCancelButton; -}; - -class LLSocialPhotoPanel : public LLPanel -{ -public: - LLSocialPhotoPanel(); - ~LLSocialPhotoPanel(); - - BOOL postBuild(); - void draw(); - - LLSnapshotLivePreview* getPreviewView(); - void onVisibilityChange(const LLSD& new_visibility); - void onClickNewSnapshot(); - void onSend(); - bool onFacebookConnectStateChange(const LLSD& data); - - void sendPhoto(); - void clearAndClose(); - - void updateControls(); - void updateResolution(BOOL do_update); - void checkAspectRatio(S32 index); - LLUICtrl* getRefreshBtn(); - -private: - LLHandle mPreviewHandle; - - LLUICtrl * mSnapshotPanel; - LLUICtrl * mResolutionComboBox; - LLUICtrl * mRefreshBtn; - LLUICtrl * mWorkingLabel; - LLUICtrl * mThumbnailPlaceholder; - LLUICtrl * mCaptionTextBox; - LLUICtrl * mLocationCheckbox; - LLUICtrl * mPostButton; - LLUICtrl* mCancelButton; -}; - -class LLSocialCheckinPanel : public LLPanel -{ -public: - LLSocialCheckinPanel(); - BOOL postBuild(); - void draw(); - void onSend(); - bool onFacebookConnectStateChange(const LLSD& data); - - void sendCheckin(); - void clearAndClose(); - -private: - std::string mMapUrl; - LLPointer mMapTexture; - LLUICtrl* mPostButton; - LLUICtrl* mCancelButton; - LLUICtrl* mMessageTextEditor; - LLUICtrl* mMapLoadingIndicator; - LLIconCtrl* mMapPlaceholder; - LLIconCtrl* mMapDefault; - LLCheckBoxCtrl* mMapCheckBox; - bool mReloadingMapTexture; -}; - -class LLSocialAccountPanel : public LLPanel -{ -public: - LLSocialAccountPanel(); - BOOL postBuild(); - void draw(); - -private: - void onVisibilityChange(const LLSD& new_visibility); - bool onFacebookConnectStateChange(const LLSD& data); - bool onFacebookConnectInfoChange(); - void onConnect(); - void onUseAnotherAccount(); - void onDisconnect(); - - void showConnectButton(); - void hideConnectButton(); - void showDisconnectedLayout(); - void showConnectedLayout(); - - LLTextBox * mAccountCaptionLabel; - LLTextBox * mAccountNameLabel; - LLUICtrl * mPanelButtons; - LLUICtrl * mConnectButton; - LLUICtrl * mDisconnectButton; -}; - - -class LLFloaterSocial : public LLFloater -{ -public: - LLFloaterSocial(const LLSD& key); - BOOL postBuild(); - void draw(); - void onCancel(); - - void showPhotoPanel(); - - static void preUpdate(); - static void postUpdate(); - -private: - LLSocialPhotoPanel* mSocialPhotoPanel; - LLTextBox* mStatusErrorText; - LLTextBox* mStatusLoadingText; - LLUICtrl* mStatusLoadingIndicator; -}; - -#endif // LL_LLFLOATERSOCIAL_H - diff --git a/indra/newview/llfloatertwitter.cpp b/indra/newview/llfloatertwitter.cpp index 82ed066b1a..18a1fcbba9 100644 --- a/indra/newview/llfloatertwitter.cpp +++ b/indra/newview/llfloatertwitter.cpp @@ -622,7 +622,7 @@ void LLTwitterAccountPanel::onDisconnect() //////////////////////// LLFloaterTwitter::LLFloaterTwitter(const LLSD& key) : LLFloater(key), - mSocialPhotoPanel(NULL), + mTwitterPhotoPanel(NULL), mStatusErrorText(NULL), mStatusLoadingText(NULL), mStatusLoadingIndicator(NULL) @@ -638,7 +638,7 @@ void LLFloaterTwitter::onCancel() BOOL LLFloaterTwitter::postBuild() { // Keep tab of the Photo Panel - mSocialPhotoPanel = static_cast(getChild("panel_twitter_photo")); + mTwitterPhotoPanel = static_cast(getChild("panel_twitter_photo")); // Connection status widgets mStatusErrorText = getChild("connection_error_text"); mStatusLoadingText = getChild("connection_loading_text"); @@ -648,14 +648,14 @@ BOOL LLFloaterTwitter::postBuild() void LLFloaterTwitter::showPhotoPanel() { - LLTabContainer* parent = dynamic_cast(mSocialPhotoPanel->getParent()); + LLTabContainer* parent = dynamic_cast(mTwitterPhotoPanel->getParent()); if (!parent) { llwarns << "Cannot find panel container" << llendl; return; } - parent->selectTabPanel(mSocialPhotoPanel); + parent->selectTabPanel(mTwitterPhotoPanel); } // static @@ -665,7 +665,7 @@ void LLFloaterTwitter::preUpdate() if (instance) { //Will set file size text to 'unknown' - instance->mSocialPhotoPanel->updateControls(); + instance->mTwitterPhotoPanel->updateControls(); } } @@ -676,11 +676,11 @@ void LLFloaterTwitter::postUpdate() if (instance) { //Will set the file size text - instance->mSocialPhotoPanel->updateControls(); + instance->mTwitterPhotoPanel->updateControls(); // The refresh button is initially hidden. We show it after the first update, // i.e. after snapshot is taken - LLUICtrl * refresh_button = instance->mSocialPhotoPanel->getRefreshBtn(); + LLUICtrl * refresh_button = instance->mTwitterPhotoPanel->getRefreshBtn(); if (!refresh_button->getVisible()) { diff --git a/indra/newview/llfloatertwitter.h b/indra/newview/llfloatertwitter.h index 5305143552..f267f76694 100644 --- a/indra/newview/llfloatertwitter.h +++ b/indra/newview/llfloatertwitter.h @@ -121,7 +121,7 @@ public: static void postUpdate(); private: - LLTwitterPhotoPanel* mSocialPhotoPanel; + LLTwitterPhotoPanel* mTwitterPhotoPanel; LLTextBox* mStatusErrorText; LLTextBox* mStatusLoadingText; LLUICtrl* mStatusLoadingIndicator; diff --git a/indra/newview/llpanelsnapshotoptions.cpp b/indra/newview/llpanelsnapshotoptions.cpp index 4cadd837d1..a7b9b6d22e 100755 --- a/indra/newview/llpanelsnapshotoptions.cpp +++ b/indra/newview/llpanelsnapshotoptions.cpp @@ -32,7 +32,7 @@ #include "llfloatersnapshot.h" // FIXME: create a snapshot model #include "llfloaterreg.h" -#include "llfloatersocial.h" +#include "llfloaterfacebook.h" #include "llfloaterflickr.h" #include "llfloatertwitter.h" @@ -144,12 +144,12 @@ void LLPanelSnapshotOptions::onSendToFacebook() { LLFloaterReg::hideInstance("snapshot"); - LLFloaterSocial* social_floater = dynamic_cast(LLFloaterReg::getInstance("social")); - if (social_floater) + LLFloaterFacebook* facebook_floater = dynamic_cast(LLFloaterReg::getInstance("facebook")); + if (facebook_floater) { - social_floater->showPhotoPanel(); + facebook_floater->showPhotoPanel(); } - LLFloaterReg::showInstance("social"); + LLFloaterReg::showInstance("facebook"); } void LLPanelSnapshotOptions::onSendToTwitter() diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp index 67952f83c7..9feeea1644 100644 --- a/indra/newview/llsnapshotlivepreview.cpp +++ b/indra/newview/llsnapshotlivepreview.cpp @@ -34,7 +34,7 @@ #include "lleconomy.h" #include "llfloaterperms.h" #include "llfloaterreg.h" -#include "llfloatersocial.h" +#include "llfloaterfacebook.h" #include "llfloaterflickr.h" #include "llfloatertwitter.h" #include "llimagebmp.h" @@ -210,7 +210,7 @@ void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail mSnapshotDelayTimer.start(); mSnapshotDelayTimer.setTimerExpirySec(delay); LLFloaterSnapshot::preUpdate(); - LLFloaterSocial::preUpdate(); + LLFloaterFacebook::preUpdate(); LLFloaterFlickr::preUpdate(); LLFloaterTwitter::preUpdate(); } @@ -769,7 +769,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) } lldebugs << "done creating snapshot" << llendl; LLFloaterSnapshot::postUpdate(); - LLFloaterSocial::postUpdate(); + LLFloaterFacebook::postUpdate(); LLFloaterFlickr::postUpdate(); LLFloaterTwitter::postUpdate(); diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 1e07aaf5ec..e38ffbbc63 100755 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -60,6 +60,7 @@ #include "llfloatereditwater.h" #include "llfloaterenvironmentsettings.h" #include "llfloaterevent.h" +#include "llfloaterfacebook.h" #include "llfloaterflickr.h" #include "llfloaterfonttest.h" #include "llfloatergesture.h" @@ -104,7 +105,6 @@ #include "llfloatersettingsdebug.h" #include "llfloatersidepanelcontainer.h" #include "llfloatersnapshot.h" -#include "llfloatersocial.h" #include "llfloatersounddevices.h" #include "llfloaterspellchecksettings.h" #include "llfloatertelehub.h" @@ -306,9 +306,6 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("sell_land", "floater_sell_land.xml", &LLFloaterSellLand::buildFloater); LLFloaterReg::add("settings_debug", "floater_settings_debug.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("sound_devices", "floater_sound_devices.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("social", "floater_social.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("flickr", "floater_flickr.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("twitter", "floater_twitter.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("stats", "floater_stats.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("start_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("stop_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); @@ -317,10 +314,15 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("my_profile", "floater_my_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebProfile::create); LLFloaterReg::add("profile", "floater_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebProfile::create); LLFloaterReg::add("how_to", "floater_how_to.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); + LLFloaterReg::add("fbc_web", "floater_fbc_web.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); LLFloaterReg::add("flickr_web", "floater_fbc_web.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); LLFloaterReg::add("twitter_web", "floater_fbc_web.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); + LLFloaterReg::add("facebook", "floater_facebook.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("flickr", "floater_flickr.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("twitter", "floater_twitter.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterUIPreviewUtil::registerFloater(); LLFloaterReg::add("upload_anim_bvh", "floater_animation_bvh_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); LLFloaterReg::add("upload_anim_anim", "floater_animation_anim_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index e42743824e..751558fc93 100755 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -133,6 +133,8 @@ with the same filename but different name + + @@ -148,11 +150,9 @@ with the same filename but different name - - - + diff --git a/indra/newview/skins/default/xui/en/floater_facebook.xml b/indra/newview/skins/default/xui/en/floater_facebook.xml new file mode 100644 index 0000000000..820e105e53 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_facebook.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + Error + + + + Loading... + + + + diff --git a/indra/newview/skins/default/xui/en/floater_social.xml b/indra/newview/skins/default/xui/en/floater_social.xml deleted file mode 100644 index b7ff374d5f..0000000000 --- a/indra/newview/skins/default/xui/en/floater_social.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - Error - - - - Loading... - - - - diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 79adb4e8bb..905988e09d 100755 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -285,7 +285,7 @@ name="Facebook"> + parameter="facebook"/> + + + + Not connected to Facebook. + + + + + + + + [http://community.secondlife.com/t5/English-Knowledge-Base/Second-Life-Share/ta-p/2149711 Learn about posting to Facebook] + + + diff --git a/indra/newview/skins/default/xui/en/panel_facebook_photo.xml b/indra/newview/skins/default/xui/en/panel_facebook_photo.xml new file mode 100644 index 0000000000..19f9f2fb74 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_facebook_photo.xml @@ -0,0 +1,152 @@ + + + + + + + + + + + [SIZE] KB + + + + + + Refreshing... + + + Comment (optional): + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_facebook_place.xml b/indra/newview/skins/default/xui/en/panel_facebook_place.xml new file mode 100644 index 0000000000..1eea8f317b --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_facebook_place.xml @@ -0,0 +1,132 @@ + + + + + Say something about where you are: + + + + + + + + + + + + + + + Include overhead view of location + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_facebook_status.xml b/indra/newview/skins/default/xui/en/panel_facebook_status.xml new file mode 100644 index 0000000000..50e15c2e80 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_facebook_status.xml @@ -0,0 +1,67 @@ + + + + + What's on your mind? + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_social_account.xml b/indra/newview/skins/default/xui/en/panel_social_account.xml deleted file mode 100644 index d7235396fe..0000000000 --- a/indra/newview/skins/default/xui/en/panel_social_account.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - Not connected to Facebook. - - - - - - - - [http://community.secondlife.com/t5/English-Knowledge-Base/Second-Life-Share/ta-p/2149711 Learn about posting to Facebook] - - - diff --git a/indra/newview/skins/default/xui/en/panel_social_photo.xml b/indra/newview/skins/default/xui/en/panel_social_photo.xml deleted file mode 100644 index a55613b52a..0000000000 --- a/indra/newview/skins/default/xui/en/panel_social_photo.xml +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - - - - - - [SIZE] KB - - - - - - Refreshing... - - - Comment (optional): - - - - - - - - - - - diff --git a/indra/newview/skins/default/xui/en/panel_social_place.xml b/indra/newview/skins/default/xui/en/panel_social_place.xml deleted file mode 100644 index 13e94f6998..0000000000 --- a/indra/newview/skins/default/xui/en/panel_social_place.xml +++ /dev/null @@ -1,132 +0,0 @@ - - - - - Say something about where you are: - - - - - - - - - - - - - - - Include overhead view of location - - - - - - - - diff --git a/indra/newview/skins/default/xui/en/panel_social_status.xml b/indra/newview/skins/default/xui/en/panel_social_status.xml deleted file mode 100644 index 54cfa3f524..0000000000 --- a/indra/newview/skins/default/xui/en/panel_social_status.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - What's on your mind? - - - - - - - - - - diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index b24cca588e..3806e1287c 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -3877,6 +3877,8 @@ Try enclosing path to the editor with double quotes. Conversations Compass Destinations + Facebook + Flickr Gestures How to Inventory @@ -3892,10 +3894,8 @@ Try enclosing path to the editor with double quotes. Profile Search Snapshot - Facebook - Flickr - Twitter Speak + Twitter Camera controls Voice settings @@ -3907,6 +3907,8 @@ Try enclosing path to the editor with double quotes. Converse with everyone Compass Destinations of interest + Post to Facebook + Upload to Flickr Gestures for your avatar How to do common tasks View and use your belongings @@ -3922,10 +3924,8 @@ Try enclosing path to the editor with double quotes. Edit or view your profile Find places, events, people Take a picture - Post to Facebook - Upload to Flickr - Twitter Speak with people nearby using your microphone + Twitter Changing camera angle Volume controls for calls and people near you in world -- cgit v1.2.3 From 5a23bf50bcee13a5841f680b13ca480753d367a1 Mon Sep 17 00:00:00 2001 From: Cho Date: Thu, 5 Dec 2013 00:29:12 +0000 Subject: Added slshare SLapp support for ACME-1214 --- indra/newview/llfacebookconnect.cpp | 69 +++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) (limited to 'indra') diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index 0a662b4671..860f488945 100644 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -69,6 +69,75 @@ void toast_user_for_facebook_success() /////////////////////////////////////////////////////////////////////////////// // +class LLSLShareHandler : public LLCommandHandler +{ +public: + LLSLShareHandler() : LLCommandHandler("slshare", UNTRUSTED_THROTTLE) { } + + bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web) + { + if (tokens.size() >= 1) + { + if (tokens[0].asString() == "connect") + { + if (tokens.size() >= 2 && tokens[1].asString() == "flickr") + { + // this command probably came from the flickr_web browser, so close it + LLFloater* flickr_web = LLFloaterReg::getInstance("flickr_web"); + if (flickr_web) + { + flickr_web->closeFloater(); + } + + // connect to flickr + if (query_map.has("oauth_token")) + { + LLFlickrConnect::instance().connectToFlickr(query_map["oauth_token"], query_map.get("oauth_verifier")); + } + return true; + } + else if (tokens.size() >= 2 && tokens[1].asString() == "twitter") + { + // this command probably came from the twitter_web browser, so close it + LLFloater* twitter_web = LLFloaterReg::getInstance("twitter_web"); + if (twitter_web) + { + twitter_web->closeFloater(); + } + + // connect to twitter + if (query_map.has("oauth_token")) + { + LLTwitterConnect::instance().connectToTwitter(query_map["oauth_token"], query_map.get("oauth_verifier")); + } + return true; + } + else //if (tokens.size() >= 2 && tokens[1].asString() == "facebook") + { + // this command probably came from the fbc_web browser, so close it + LLFloater* fbc_web = LLFloaterReg::getInstance("fbc_web"); + if (fbc_web) + { + fbc_web->closeFloater(); + } + + // connect to facebook + if (query_map.has("code")) + { + LLFacebookConnect::instance().connectToFacebook(query_map["code"], query_map.get("state")); + } + return true; + } + } + } + return false; + } +}; +LLSLShareHandler gSLShareHandler; + +/////////////////////////////////////////////////////////////////////////////// +// +// DEPRECATED - please remove once "fbc" is phased out of the web service class LLFacebookConnectHandler : public LLCommandHandler { public: -- cgit v1.2.3 From a36c4f45b4bf03c707089398bccf62a12ac44f0b Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 4 Dec 2013 18:02:04 -0800 Subject: ACME-1043 : WIP : Add an argument to open trusted content with js and other enabled options, bypassing prefs --- indra/newview/llfacebookconnect.cpp | 10 +++++---- indra/newview/llfloaterwebcontent.cpp | 6 ++++-- indra/newview/llfloaterwebcontent.h | 3 ++- indra/newview/llmediactrl.cpp | 4 ++-- indra/newview/llmediactrl.h | 2 +- indra/newview/llviewermedia.cpp | 39 ++++++++++++++++++++++------------- indra/newview/llviewermedia.h | 5 +++-- 7 files changed, 43 insertions(+), 26 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index 0a662b4671..8cde871cd1 100644 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -377,10 +377,12 @@ void LLFacebookConnect::openFacebookWeb(std::string url) { // Open the URL in an internal browser window without navigation UI LLFloaterWebContent::Params p; - p.url(url).show_chrome(true); - p.url(url).allow_address_entry(false); - p.url(url).allow_back_forward_navigation(false); - p.url(url).trusted_content(true); + p.url(url); + p.show_chrome(true); + p.allow_address_entry(false); + p.allow_back_forward_navigation(false); + p.trusted_content(true); + p.clean_browser(true); LLFloater *floater = LLFloaterReg::showInstance("fbc_web", p); //the internal web browser has a bug that prevents it from gaining focus unless a mouse event occurs first (it seems). //So when showing the internal web browser, set focus to it's containing floater "fbc_web". When a mouse event diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp index 814c91ef6c..2e08b3792f 100755 --- a/indra/newview/llfloaterwebcontent.cpp +++ b/indra/newview/llfloaterwebcontent.cpp @@ -53,7 +53,8 @@ LLFloaterWebContent::_Params::_Params() allow_back_forward_navigation("allow_back_forward_navigation", true), preferred_media_size("preferred_media_size"), trusted_content("trusted_content", false), - show_page_title("show_page_title", true) + show_page_title("show_page_title", true), + clean_browser("clean_browser", false) {} LLFloaterWebContent::LLFloaterWebContent( const Params& params ) @@ -240,11 +241,12 @@ void LLFloaterWebContent::preCreate(LLFloaterWebContent::Params& p) void LLFloaterWebContent::open_media(const Params& p) { + llinfos << "Merov : LLFloaterWebContent::open_media, allow_address_entry = " << p.allow_address_entry << ", clean_browser = " << p.clean_browser << llendl; // Specifying a mime type of text/html here causes the plugin system to skip the MIME type probe and just open a browser plugin. LLViewerMedia::proxyWindowOpened(p.target(), p.id()); mWebBrowser->setHomePageUrl(p.url, "text/html"); mWebBrowser->setTarget(p.target); - mWebBrowser->navigateTo(p.url, "text/html"); + mWebBrowser->navigateTo(p.url, "text/html", p.clean_browser); set_current_url(p.url); diff --git a/indra/newview/llfloaterwebcontent.h b/indra/newview/llfloaterwebcontent.h index f22940cd07..2bb8e3271f 100755 --- a/indra/newview/llfloaterwebcontent.h +++ b/indra/newview/llfloaterwebcontent.h @@ -57,7 +57,8 @@ public: allow_address_entry, allow_back_forward_navigation, trusted_content, - show_page_title; + show_page_title, + clean_browser; Optional preferred_media_size; _Params(); diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 2075aeed63..229542c1c4 100755 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -539,7 +539,7 @@ void LLMediaCtrl::clearCache() //////////////////////////////////////////////////////////////////////////////// // -void LLMediaCtrl::navigateTo( std::string url_in, std::string mime_type) +void LLMediaCtrl::navigateTo( std::string url_in, std::string mime_type, bool clean_browser) { // don't browse to anything that starts with secondlife:// or sl:// const std::string protocol1 = "secondlife://"; @@ -556,7 +556,7 @@ void LLMediaCtrl::navigateTo( std::string url_in, std::string mime_type) { mCurrentNavUrl = url_in; mMediaSource->setSize(mTextureWidth, mTextureHeight); - mMediaSource->navigateTo(url_in, mime_type, mime_type.empty()); + mMediaSource->navigateTo(url_in, mime_type, mime_type.empty(), false, clean_browser); } } diff --git a/indra/newview/llmediactrl.h b/indra/newview/llmediactrl.h index 6c38c1fb56..8429d8188e 100755 --- a/indra/newview/llmediactrl.h +++ b/indra/newview/llmediactrl.h @@ -95,7 +95,7 @@ public: virtual BOOL handleToolTip(S32 x, S32 y, MASK mask); // navigation - void navigateTo( std::string url_in, std::string mime_type = ""); + void navigateTo( std::string url_in, std::string mime_type = "", bool clean_browser = false); void navigateBack(); void navigateHome(); void navigateForward(); diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 13483790ed..2393a932a2 100755 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -429,7 +429,7 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s // Try to find media with the same media ID viewer_media_t media_impl = getMediaImplFromTextureID(media_entry->getMediaID()); - lldebugs << "called, current URL is \"" << media_entry->getCurrentURL() + llinfos << "Merov : called, current URL is \"" << media_entry->getCurrentURL() << "\", previous URL is \"" << previous_url << "\", update_from_self is " << (update_from_self?"true":"false") << llendl; @@ -790,6 +790,8 @@ void LLViewerMedia::updateMedia(void *dummy_arg) { LLFastTimer t1(FTM_MEDIA_UPDATE); + //llinfos << "Merov : updateMedia called" << llendl; + // Enable/disable the plugin read thread LLPluginProcessParent::setUseReadThread(gSavedSettings.getBOOL("PluginUseReadThread")); @@ -1534,7 +1536,8 @@ void LLViewerMedia::createSpareBrowserMediaSource() // popping up at the moment we start a media plugin. if (!sSpareBrowserMediaSource && !gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins")) { - // The null owner will keep the browser plugin from fully initializing + llinfos << "Merov : createSpareBrowserMediaSource : need to create a spare browser..." << llendl; + // The null owner will keep the browser plugin from fully initializing // (specifically, it keeps LLPluginClassMedia from negotiating a size change, // which keeps MediaPluginWebkit::initBrowserWindow from doing anything until we have some necessary data, like the background color) sSpareBrowserMediaSource = LLViewerMediaImpl::newSourceFromMediaType("text/html", NULL, 0, 0); @@ -1543,8 +1546,9 @@ void LLViewerMedia::createSpareBrowserMediaSource() ///////////////////////////////////////////////////////////////////////////////////////// // static -LLPluginClassMedia* LLViewerMedia::getSpareBrowserMediaSource() +LLPluginClassMedia* LLViewerMedia::getSpareBrowserMediaSource() { + llinfos << "Merov : getSpareBrowserMediaSource : give up the spare browser..." << llendl; LLPluginClassMedia* result = sSpareBrowserMediaSource; sSpareBrowserMediaSource = NULL; return result; @@ -1592,7 +1596,8 @@ std::string LLViewerMedia::getParcelAudioURL() // static void LLViewerMedia::initClass() { - gIdleCallbacks.addFunction(LLViewerMedia::updateMedia, NULL); + llinfos << "Merov : initClass called" << llendl; + gIdleCallbacks.addFunction(LLViewerMedia::updateMedia, NULL); sTeleportFinishConnection = LLViewerParcelMgr::getInstance()-> setTeleportFinishedCallback(boost::bind(&LLViewerMedia::onTeleportFinished)); } @@ -1601,6 +1606,7 @@ void LLViewerMedia::initClass() // static void LLViewerMedia::cleanupClass() { + llinfos << "Merov : cleanupClass called" << llendl; gIdleCallbacks.deleteFunction(LLViewerMedia::updateMedia, NULL); sTeleportFinishConnection.disconnect(); } @@ -1669,7 +1675,8 @@ LLViewerMediaImpl::LLViewerMediaImpl( const LLUUID& texture_id, mNavigateSuspendedDeferred(false), mIsUpdated(false), mTrustedBrowser(false), - mZoomFactor(1.0) + mZoomFactor(1.0), + mCleanBrowser(false) { // Set up the mute list observer if it hasn't been set up already. @@ -1793,14 +1800,15 @@ void LLViewerMediaImpl::setMediaType(const std::string& media_type) ////////////////////////////////////////////////////////////////////////////////////////// /*static*/ -LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_type, LLPluginClassMediaOwner *owner /* may be NULL */, S32 default_width, S32 default_height, const std::string target) +LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_type, LLPluginClassMediaOwner *owner /* may be NULL */, S32 default_width, S32 default_height, const std::string target, bool get_clean_source) { std::string plugin_basename = LLMIMETypes::implType(media_type); LLPluginClassMedia* media_source = NULL; // HACK: we always try to keep a spare running webkit plugin around to improve launch times. // If a spare was already created before PluginAttachDebuggerToPlugins was set, don't use it. - if(plugin_basename == "media_plugin_webkit" && !gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins")) + // Merov : do not use a spare if launching with full viewer control (e.g. Facebook, Twitter and few others) + if(plugin_basename == "media_plugin_webkit" && !gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins") && !get_clean_source) { media_source = LLViewerMedia::getSpareBrowserMediaSource(); if(media_source) @@ -1812,7 +1820,7 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_ return media_source; } } - + llinfos << "Merov : newSourceFromMediaType, get_clean_source = " << get_clean_source << llendl; if(plugin_basename.empty()) { LL_WARNS_ONCE("Media") << "Couldn't find plugin for media type " << media_type << LL_ENDL; @@ -1856,18 +1864,19 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_ // collect 'cookies enabled' setting from prefs and send to embedded browser bool cookies_enabled = gSavedSettings.getBOOL( "CookiesEnabled" ); - media_source->enable_cookies( cookies_enabled ); + media_source->enable_cookies( cookies_enabled || get_clean_source); // collect 'plugins enabled' setting from prefs and send to embedded browser bool plugins_enabled = gSavedSettings.getBOOL( "BrowserPluginsEnabled" ); - media_source->setPluginsEnabled( plugins_enabled ); + media_source->setPluginsEnabled( plugins_enabled || get_clean_source); // collect 'javascript enabled' setting from prefs and send to embedded browser bool javascript_enabled = gSavedSettings.getBOOL( "BrowserJavascriptEnabled" ); - media_source->setJavascriptEnabled( javascript_enabled ); + llinfos << "Merov : setting javascript flag : " << javascript_enabled << llendl; + media_source->setJavascriptEnabled( javascript_enabled || get_clean_source); bool media_plugin_debugging_enabled = gSavedSettings.getBOOL("MediaPluginDebugging"); - media_source->enableMediaPluginDebugging( media_plugin_debugging_enabled ); + media_source->enableMediaPluginDebugging( media_plugin_debugging_enabled || get_clean_source); media_source->setTarget(target); @@ -1922,7 +1931,7 @@ bool LLViewerMediaImpl::initializePlugin(const std::string& media_type) // Save the MIME type that really caused the plugin to load mCurrentMimeType = mMimeType; - LLPluginClassMedia* media_source = newSourceFromMediaType(mMimeType, this, mMediaWidth, mMediaHeight, mTarget); + LLPluginClassMedia* media_source = newSourceFromMediaType(mMimeType, this, mMediaWidth, mMediaHeight, mTarget, mCleanBrowser); if (media_source) { @@ -2543,7 +2552,7 @@ void LLViewerMediaImpl::unload() } ////////////////////////////////////////////////////////////////////////////////////////// -void LLViewerMediaImpl::navigateTo(const std::string& url, const std::string& mime_type, bool rediscover_type, bool server_request) +void LLViewerMediaImpl::navigateTo(const std::string& url, const std::string& mime_type, bool rediscover_type, bool server_request, bool clean_browser) { cancelMimeTypeProbe(); @@ -2554,8 +2563,10 @@ void LLViewerMediaImpl::navigateTo(const std::string& url, const std::string& mi } // Always set the current URL and MIME type. + llinfos << "Merov : LLViewerMediaImpl::navigateTo url = " << url << llendl; mMediaURL = url; mMimeType = mime_type; + mCleanBrowser = clean_browser; // Clear the current media URL, since it will no longer be correct. mCurrentMediaURL.clear(); diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index fff5b3fc08..07125e07e5 100755 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -234,7 +234,7 @@ public: void navigateReload(); void navigateHome(); void unload(); - void navigateTo(const std::string& url, const std::string& mime_type = "", bool rediscover_type = false, bool server_request = false); + void navigateTo(const std::string& url, const std::string& mime_type = "", bool rediscover_type = false, bool server_request = false, bool clean_browser = false); void navigateInternal(); void navigateStop(); bool handleKeyHere(KEY key, MASK mask); @@ -289,7 +289,7 @@ public: void setTarget(const std::string& target) { mTarget = target; } // utility function to create a ready-to-use media instance from a desired media type. - static LLPluginClassMedia* newSourceFromMediaType(std::string media_type, LLPluginClassMediaOwner *owner /* may be NULL */, S32 default_width, S32 default_height, const std::string target = LLStringUtil::null); + static LLPluginClassMedia* newSourceFromMediaType(std::string media_type, LLPluginClassMediaOwner *owner /* may be NULL */, S32 default_width, S32 default_height, const std::string target = LLStringUtil::null, bool get_clean_source = false); // Internally set our desired browser user agent string, including // the Second Life version and skin name. Used because we can @@ -464,6 +464,7 @@ private: bool mTrustedBrowser; std::string mTarget; LLNotificationPtr mNotification; + bool mCleanBrowser; // force the creation of a clean browsing target with full options enabled private: BOOL mIsUpdated ; -- cgit v1.2.3 From f5b356a7d4b51fbf509926295cb38d3a1e8442e3 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 4 Dec 2013 21:14:40 -0800 Subject: ACME-1043 : Fixed! Added an argument to force a clean full feature browser window in some situations --- indra/newview/llfloaterwebcontent.cpp | 1 - indra/newview/llviewermedia.cpp | 26 +++++++++----------------- indra/newview/llviewermedia.h | 2 +- 3 files changed, 10 insertions(+), 19 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp index 2e08b3792f..4eb5236c6a 100755 --- a/indra/newview/llfloaterwebcontent.cpp +++ b/indra/newview/llfloaterwebcontent.cpp @@ -241,7 +241,6 @@ void LLFloaterWebContent::preCreate(LLFloaterWebContent::Params& p) void LLFloaterWebContent::open_media(const Params& p) { - llinfos << "Merov : LLFloaterWebContent::open_media, allow_address_entry = " << p.allow_address_entry << ", clean_browser = " << p.clean_browser << llendl; // Specifying a mime type of text/html here causes the plugin system to skip the MIME type probe and just open a browser plugin. LLViewerMedia::proxyWindowOpened(p.target(), p.id()); mWebBrowser->setHomePageUrl(p.url, "text/html"); diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 2393a932a2..1a19589a26 100755 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -429,7 +429,7 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s // Try to find media with the same media ID viewer_media_t media_impl = getMediaImplFromTextureID(media_entry->getMediaID()); - llinfos << "Merov : called, current URL is \"" << media_entry->getCurrentURL() + lldebugs << "called, current URL is \"" << media_entry->getCurrentURL() << "\", previous URL is \"" << previous_url << "\", update_from_self is " << (update_from_self?"true":"false") << llendl; @@ -790,8 +790,6 @@ void LLViewerMedia::updateMedia(void *dummy_arg) { LLFastTimer t1(FTM_MEDIA_UPDATE); - //llinfos << "Merov : updateMedia called" << llendl; - // Enable/disable the plugin read thread LLPluginProcessParent::setUseReadThread(gSavedSettings.getBOOL("PluginUseReadThread")); @@ -1536,7 +1534,6 @@ void LLViewerMedia::createSpareBrowserMediaSource() // popping up at the moment we start a media plugin. if (!sSpareBrowserMediaSource && !gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins")) { - llinfos << "Merov : createSpareBrowserMediaSource : need to create a spare browser..." << llendl; // The null owner will keep the browser plugin from fully initializing // (specifically, it keeps LLPluginClassMedia from negotiating a size change, // which keeps MediaPluginWebkit::initBrowserWindow from doing anything until we have some necessary data, like the background color) @@ -1548,7 +1545,6 @@ void LLViewerMedia::createSpareBrowserMediaSource() // static LLPluginClassMedia* LLViewerMedia::getSpareBrowserMediaSource() { - llinfos << "Merov : getSpareBrowserMediaSource : give up the spare browser..." << llendl; LLPluginClassMedia* result = sSpareBrowserMediaSource; sSpareBrowserMediaSource = NULL; return result; @@ -1596,7 +1592,6 @@ std::string LLViewerMedia::getParcelAudioURL() // static void LLViewerMedia::initClass() { - llinfos << "Merov : initClass called" << llendl; gIdleCallbacks.addFunction(LLViewerMedia::updateMedia, NULL); sTeleportFinishConnection = LLViewerParcelMgr::getInstance()-> setTeleportFinishedCallback(boost::bind(&LLViewerMedia::onTeleportFinished)); @@ -1606,7 +1601,6 @@ void LLViewerMedia::initClass() // static void LLViewerMedia::cleanupClass() { - llinfos << "Merov : cleanupClass called" << llendl; gIdleCallbacks.deleteFunction(LLViewerMedia::updateMedia, NULL); sTeleportFinishConnection.disconnect(); } @@ -1800,15 +1794,16 @@ void LLViewerMediaImpl::setMediaType(const std::string& media_type) ////////////////////////////////////////////////////////////////////////////////////////// /*static*/ -LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_type, LLPluginClassMediaOwner *owner /* may be NULL */, S32 default_width, S32 default_height, const std::string target, bool get_clean_source) +LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_type, LLPluginClassMediaOwner *owner /* may be NULL */, S32 default_width, S32 default_height, const std::string target, bool clean_browser) { std::string plugin_basename = LLMIMETypes::implType(media_type); LLPluginClassMedia* media_source = NULL; // HACK: we always try to keep a spare running webkit plugin around to improve launch times. // If a spare was already created before PluginAttachDebuggerToPlugins was set, don't use it. - // Merov : do not use a spare if launching with full viewer control (e.g. Facebook, Twitter and few others) - if(plugin_basename == "media_plugin_webkit" && !gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins") && !get_clean_source) + // Do not use a spare if launching with full viewer control (e.g. Facebook, Twitter and few others) + if ((plugin_basename == "media_plugin_webkit") && + !gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins") && !clean_browser) { media_source = LLViewerMedia::getSpareBrowserMediaSource(); if(media_source) @@ -1820,7 +1815,6 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_ return media_source; } } - llinfos << "Merov : newSourceFromMediaType, get_clean_source = " << get_clean_source << llendl; if(plugin_basename.empty()) { LL_WARNS_ONCE("Media") << "Couldn't find plugin for media type " << media_type << LL_ENDL; @@ -1864,19 +1858,18 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_ // collect 'cookies enabled' setting from prefs and send to embedded browser bool cookies_enabled = gSavedSettings.getBOOL( "CookiesEnabled" ); - media_source->enable_cookies( cookies_enabled || get_clean_source); + media_source->enable_cookies( cookies_enabled || clean_browser); // collect 'plugins enabled' setting from prefs and send to embedded browser bool plugins_enabled = gSavedSettings.getBOOL( "BrowserPluginsEnabled" ); - media_source->setPluginsEnabled( plugins_enabled || get_clean_source); + media_source->setPluginsEnabled( plugins_enabled || clean_browser); // collect 'javascript enabled' setting from prefs and send to embedded browser bool javascript_enabled = gSavedSettings.getBOOL( "BrowserJavascriptEnabled" ); - llinfos << "Merov : setting javascript flag : " << javascript_enabled << llendl; - media_source->setJavascriptEnabled( javascript_enabled || get_clean_source); + media_source->setJavascriptEnabled( javascript_enabled || clean_browser); bool media_plugin_debugging_enabled = gSavedSettings.getBOOL("MediaPluginDebugging"); - media_source->enableMediaPluginDebugging( media_plugin_debugging_enabled || get_clean_source); + media_source->enableMediaPluginDebugging( media_plugin_debugging_enabled || clean_browser); media_source->setTarget(target); @@ -2563,7 +2556,6 @@ void LLViewerMediaImpl::navigateTo(const std::string& url, const std::string& mi } // Always set the current URL and MIME type. - llinfos << "Merov : LLViewerMediaImpl::navigateTo url = " << url << llendl; mMediaURL = url; mMimeType = mime_type; mCleanBrowser = clean_browser; diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index 07125e07e5..6803adfaa2 100755 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -289,7 +289,7 @@ public: void setTarget(const std::string& target) { mTarget = target; } // utility function to create a ready-to-use media instance from a desired media type. - static LLPluginClassMedia* newSourceFromMediaType(std::string media_type, LLPluginClassMediaOwner *owner /* may be NULL */, S32 default_width, S32 default_height, const std::string target = LLStringUtil::null, bool get_clean_source = false); + static LLPluginClassMedia* newSourceFromMediaType(std::string media_type, LLPluginClassMediaOwner *owner /* may be NULL */, S32 default_width, S32 default_height, const std::string target = LLStringUtil::null, bool clean_browser = false); // Internally set our desired browser user agent string, including // the Second Life version and skin name. Used because we can -- cgit v1.2.3 From 944840c8b164aa0f254d3d0eb38292a49b0dcae6 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Thu, 5 Dec 2013 13:26:43 -0500 Subject: STORM-68 Code cleanup/function renaming --- indra/newview/llfloaterperms.cpp | 34 +++++++++++++++++++++++----------- indra/newview/llfloaterperms.h | 3 ++- indra/newview/llviewerregion.cpp | 5 +---- 3 files changed, 26 insertions(+), 16 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index b03a4e9013..28fb76160a 100755 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -158,30 +158,42 @@ void LLFloaterPermsDefault::onCommitCopy(const LLSD& user_data) class LLFloaterPermsResponder : public LLHTTPClient::Responder { public: - LLFloaterPermsResponder(): LLHTTPClient::Responder() {} + LLFloaterPermsResponder(): LLHTTPClient::Responder() {} +private: + std::string mPreviousReason; void error(U32 status, const std::string& reason) { - LLSD args; - args["REASON"] = reason; - LLNotificationsUtil::add("DefaultObjectPermissions", args); +llwarns << "DBG !" << mPreviousReason << "!" << llendl; + // Do not display the same error more than once in a row + if (reason != mPreviousReason) + { + mPreviousReason = reason; + LLSD args; + args["REASON"] = reason; + LLNotificationsUtil::add("DefaultObjectPermissions", args); + } } void result(const LLSD& content) { + // Since we have had a successful POST call be sure to display the next error message + // even if it is the same as a previous one. + mPreviousReason = ""; LLFloaterPermsDefault::setCapSent(true); LL_INFOS("FloaterPermsResponder") << "Sent default permissions to simulator" << LL_ENDL; } }; -void LLFloaterPermsDefault::updateCap(bool alwaysUpdate) +void LLFloaterPermsDefault::sendInitialPerms() { -llwarns << "DBG start" << llendl; - if(!alwaysUpdate && mCapSent) + if(!mCapSent) { - return; + updateCap(); } +} -llwarns << "DBG getRegion" << llendl; +void LLFloaterPermsDefault::updateCap() +{ std::string object_url = gAgent.getRegion()->getCapability("AgentPreferences"); if(!object_url.empty()) @@ -193,7 +205,7 @@ llwarns << "DBG getRegion" << llendl; (LLSD::Integer)LLFloaterPerms::getEveryonePerms(sCategoryNames[CAT_OBJECTS]); report["default_object_perm_masks"]["NextOwner"] = (LLSD::Integer)LLFloaterPerms::getNextOwnerPerms(sCategoryNames[CAT_OBJECTS]); -llwarns << "DBG post:" << report << llendl; + LLHTTPClient::post(object_url, report, new LLFloaterPermsResponder()); } } @@ -211,7 +223,7 @@ void LLFloaterPermsDefault::ok() // We know some setting has changed but not which one. Just in case it was a setting for // object permissions tell the server what the values are. - updateCap(true); + updateCap(); } void LLFloaterPermsDefault::cancel() diff --git a/indra/newview/llfloaterperms.h b/indra/newview/llfloaterperms.h index b4b5d58aa5..2bb0a19dc1 100755 --- a/indra/newview/llfloaterperms.h +++ b/indra/newview/llfloaterperms.h @@ -59,7 +59,8 @@ public: void onClickOK(); void onClickCancel(); void onCommitCopy(const LLSD& user_data); - static void updateCap(bool alwaysUpdate); + static void sendInitialPerms(); + static void updateCap(); static void setCapSent(bool cap_sent); // Update instantiation of sCategoryNames in the .cpp file to match if you change this! diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 4cd9f9769a..dcecddece5 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1574,10 +1574,7 @@ void LLViewerRegion::unpackRegionHandshake() msg->addU32("Flags", 0x0 ); msg->sendReliable(host); - // Supplying false in this call means only send the default permissions to the simulator if - // it has never been sent. Once this data is sent the simulator will pass this data to new - // simulators as the agent moves around. - LLFloaterPermsDefault::updateCap(false); + LLFloaterPermsDefault::sendInitialPerms(); } void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) -- cgit v1.2.3 From 096530b7265223ade02a86977973b7e5df12e93c Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Thu, 5 Dec 2013 14:42:14 -0500 Subject: STORM-68 Get display error message once to work properly --- indra/newview/llfloaterperms.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index 28fb76160a..b4ea34d5f1 100755 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -160,15 +160,15 @@ class LLFloaterPermsResponder : public LLHTTPClient::Responder public: LLFloaterPermsResponder(): LLHTTPClient::Responder() {} private: - std::string mPreviousReason; + static std::string sPreviousReason; void error(U32 status, const std::string& reason) { -llwarns << "DBG !" << mPreviousReason << "!" << llendl; +llwarns << "DBG !" << sPreviousReason << "!" << llendl; // Do not display the same error more than once in a row - if (reason != mPreviousReason) + if (reason != sPreviousReason) { - mPreviousReason = reason; + sPreviousReason = reason; LLSD args; args["REASON"] = reason; LLNotificationsUtil::add("DefaultObjectPermissions", args); @@ -178,12 +178,14 @@ llwarns << "DBG !" << mPreviousReason << "!" << llendl; { // Since we have had a successful POST call be sure to display the next error message // even if it is the same as a previous one. - mPreviousReason = ""; + sPreviousReason = ""; LLFloaterPermsDefault::setCapSent(true); LL_INFOS("FloaterPermsResponder") << "Sent default permissions to simulator" << LL_ENDL; } }; + std::string LLFloaterPermsResponder::sPreviousReason; + void LLFloaterPermsDefault::sendInitialPerms() { if(!mCapSent) -- cgit v1.2.3 From 11e3f8c3a1209c17814d90978a1c0b80225bc122 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 5 Dec 2013 12:54:15 -0800 Subject: ACME-1043 : Use a clean browser for connection to Flickr and Twitter as well --- indra/newview/llflickrconnect.cpp | 10 ++++++---- indra/newview/lltwitterconnect.cpp | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/newview/llflickrconnect.cpp b/indra/newview/llflickrconnect.cpp index 3a21933b63..8f9f55c1ea 100644 --- a/indra/newview/llflickrconnect.cpp +++ b/indra/newview/llflickrconnect.cpp @@ -276,10 +276,12 @@ void LLFlickrConnect::openFlickrWeb(std::string url) { // Open the URL in an internal browser window without navigation UI LLFloaterWebContent::Params p; - p.url(url).show_chrome(true); - p.url(url).allow_address_entry(false); - p.url(url).allow_back_forward_navigation(false); - p.url(url).trusted_content(true); + p.url(url); + p.show_chrome(true); + p.allow_address_entry(false); + p.allow_back_forward_navigation(false); + p.trusted_content(true); + p.clean_browser(true); LLFloater *floater = LLFloaterReg::showInstance("flickr_web", p); //the internal web browser has a bug that prevents it from gaining focus unless a mouse event occurs first (it seems). //So when showing the internal web browser, set focus to it's containing floater "flickr_web". When a mouse event diff --git a/indra/newview/lltwitterconnect.cpp b/indra/newview/lltwitterconnect.cpp index e015867df2..7942b21319 100644 --- a/indra/newview/lltwitterconnect.cpp +++ b/indra/newview/lltwitterconnect.cpp @@ -276,10 +276,12 @@ void LLTwitterConnect::openTwitterWeb(std::string url) { // Open the URL in an internal browser window without navigation UI LLFloaterWebContent::Params p; - p.url(url).show_chrome(true); - p.url(url).allow_address_entry(false); - p.url(url).allow_back_forward_navigation(false); - p.url(url).trusted_content(true); + p.url(url); + p.show_chrome(true); + p.allow_address_entry(false); + p.allow_back_forward_navigation(false); + p.trusted_content(true); + p.clean_browser(true); LLFloater *floater = LLFloaterReg::showInstance("twitter_web", p); //the internal web browser has a bug that prevents it from gaining focus unless a mouse event occurs first (it seems). //So when showing the internal web browser, set focus to it's containing floater "twitter_web". When a mouse event -- cgit v1.2.3 From b6cda94fa5daae104be37cdce393e255022c79cd Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Fri, 6 Dec 2013 17:48:12 -0500 Subject: STORM-68 Remove incorrect method of setting default object permissions --- indra/newview/llviewerobjectlist.cpp | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 34d36dd887..b7a4510bac 100755 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -266,17 +266,6 @@ void LLViewerObjectList::processUpdateCore(LLViewerObject* objectp, // llinfos << "DEBUG selecting " << objectp->mID << " " // << objectp->mLocalID << llendl; LLSelectMgr::getInstance()->selectObjectAndFamily(objectp); - - // This is a bit of a hack. Because the server ensures one of either COPY or TRANSFER is always be on - // to set the bits we want it is first necessary to set them all on and then clear the ones that - // are not needed. - LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_NEXT_OWNER, TRUE, PERM_COPY | PERM_MODIFY | PERM_TRANSFER); - LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_NEXT_OWNER, FALSE, LLFloaterPerms::getNextOwnerPermsInverted("Objects")); - - LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_EVERYONE, TRUE, LLFloaterPerms::getEveryonePerms("Objects")); - - LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_GROUP, TRUE, LLFloaterPerms::getGroupPerms("Objects")); - dialog_refresh_all(); } -- cgit v1.2.3 From 88f139594bb819bc31b438edcceaf9cd661b3f82 Mon Sep 17 00:00:00 2001 From: Cho Date: Tue, 10 Dec 2013 18:55:49 +0000 Subject: Added placeholder http SLURL for Twitter sharing on Aditi for ACME-1216 --- indra/newview/llfloatertwitter.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llfloatertwitter.cpp b/indra/newview/llfloatertwitter.cpp index 18a1fcbba9..ea263566a6 100644 --- a/indra/newview/llfloatertwitter.cpp +++ b/indra/newview/llfloatertwitter.cpp @@ -53,6 +53,7 @@ static LLRegisterPanelClassWrapper t_panel_photo("lltwitter static LLRegisterPanelClassWrapper t_panel_account("lltwitteraccountpanel"); const S32 MAX_POSTCARD_DATASIZE = 1024 * 1024; // one megabyte +const std::string DEFAULT_PHOTO_LOCATION_URL = "http://maps.secondlife.com/"; const std::string DEFAULT_PHOTO_QUERY_PARAMETERS = "?sourceid=slshare_photo&utm_source=twitter&utm_medium=photo&utm_campaign=slshare"; /////////////////////////// @@ -271,6 +272,13 @@ void LLTwitterPhotoPanel::sendPhoto() LLAgentUI::buildSLURL(slurl); std::string slurl_string = slurl.getSLURLString(); + // Use a valid http:// URL if the scheme is secondlife:// + LLURI slurl_uri(slurl_string); + if (slurl_uri.scheme() == LLSLURL::SLURL_SECONDLIFE_SCHEME) + { + slurl_string = DEFAULT_PHOTO_LOCATION_URL; + } + // Add query parameters so Google Analytics can track incoming clicks! slurl_string += DEFAULT_PHOTO_QUERY_PARAMETERS; @@ -281,7 +289,6 @@ void LLTwitterPhotoPanel::sendPhoto() status = status + " " + slurl_string; } - // Add the photo if required bool add_photo = mPhotoCheckbox->getValue().asBoolean(); if (add_photo) -- cgit v1.2.3 From b562de469a04c5b267e46c0a0bbf4d898e36d3f7 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 10 Dec 2013 16:25:57 -0500 Subject: STORM-68 Move initial call to POST default permissions to a better location. --- indra/newview/llviewerregion.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index dcecddece5..e3df09022c 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1573,8 +1573,6 @@ void LLViewerRegion::unpackRegionHandshake() msg->nextBlock("RegionInfo"); msg->addU32("Flags", 0x0 ); msg->sendReliable(host); - - LLFloaterPermsDefault::sendInitialPerms(); } void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) @@ -1847,6 +1845,8 @@ void LLViewerRegion::setCapabilitiesReceived(bool received) { mCapabilitiesReceivedSignal(getRegionID()); + LLFloaterPermsDefault::sendInitialPerms(); + // This is a single-shot signal. Forget callbacks to save resources. mCapabilitiesReceivedSignal.disconnect_all_slots(); } -- cgit v1.2.3 From 35daa8031979fc708640e2f2f9ab849e6cb156dd Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Wed, 11 Dec 2013 12:09:39 -0500 Subject: STORM-68 Re-add wearables callback that did not carry through in the merge. --- indra/newview/llagentwearables.cpp | 42 +++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 17 deletions(-) (limited to 'indra') diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index c741f6403d..f71b49010d 100755 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -86,27 +86,26 @@ void wear_and_edit_cb(const LLUUID& inv_item) LLAppearanceMgr::instance().wearItemOnAvatar(inv_item); } -class LLCreateWearableCallback : public LLInventoryCallback +void wear_cb(const LLUUID& inv_item) { - void fire(const LLUUID& inv_item) + if (inv_item.isNull()) { - if (inv_item.isNull()) - return; + return; + } - LLViewerInventoryItem* item = gInventory.getItem(inv_item); - if (!item) return; + LLViewerInventoryItem* item = gInventory.getItem(inv_item); + if (!item) return; - LLPermissions perm = item->getPermissions(); - perm.setMaskNext(LLFloaterPerms::getNextOwnerPerms("Wearables")); - perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Wearables")); - perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Wearables")); - item->setPermissions(perm); + LLPermissions perm = item->getPermissions(); + perm.setMaskNext(LLFloaterPerms::getNextOwnerPerms("Wearables")); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Wearables")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Wearables")); + item->setPermissions(perm); - item->updateServer(FALSE); - gInventory.updateItem(item); - gInventory.notifyObservers(); - } -}; + item->updateServer(FALSE); + gInventory.updateItem(item); + gInventory.notifyObservers(); +} /////////////////////////////////////////////////////////////////////////////// @@ -1841,7 +1840,16 @@ void LLAgentWearables::createWearable(LLWearableType::EType type, bool wear, con LLViewerWearable* wearable = LLWearableList::instance().createNewWearable(type, gAgentAvatarp); LLAssetType::EType asset_type = wearable->getAssetType(); LLInventoryType::EType inv_type = LLInventoryType::IT_WEARABLE; - LLPointer cb = wear ? new LLBoostFuncInventoryCallback(wear_and_edit_cb) : NULL; + LLPointer cb; + if(wear) + { + cb = new LLBoostFuncInventoryCallback(wear_and_edit_cb); + } + else + { + cb = new LLBoostFuncInventoryCallback(wear_cb); + } + LLUUID folder_id; if (parent_id.notNull()) -- cgit v1.2.3 From 26a6668fb23ce289b67154ba3e3ac35f25a54978 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 11 Dec 2013 21:46:17 -0800 Subject: ACME-1233 : Set the quality for jpeg images send to Facebook correctly --- indra/newview/llfloaterfacebook.cpp | 36 +++++++++++++++++++--- indra/newview/llfloaterfacebook.h | 2 ++ indra/newview/llsnapshotlivepreview.cpp | 10 ++++-- indra/newview/llsnapshotlivepreview.h | 2 +- .../skins/default/xui/en/panel_facebook_photo.xml | 4 +++ 5 files changed, 47 insertions(+), 7 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterfacebook.cpp b/indra/newview/llfloaterfacebook.cpp index 6488e7ea00..09cc14f6db 100644 --- a/indra/newview/llfloaterfacebook.cpp +++ b/indra/newview/llfloaterfacebook.cpp @@ -59,6 +59,13 @@ const std::string DEFAULT_CHECKIN_ICON_URL = "http://map.secondlife.com.s3.amazo const std::string DEFAULT_CHECKIN_QUERY_PARAMETERS = "?sourceid=slshare_checkin&utm_source=facebook&utm_medium=checkin&utm_campaign=slshare"; const std::string DEFAULT_PHOTO_QUERY_PARAMETERS = "?sourceid=slshare_photo&utm_source=facebook&utm_medium=photo&utm_campaign=slshare"; +const S32 MAX_QUALITY = 100; // Max quality value for jpeg images +const S32 MIN_QUALITY = 0; // Min quality value for jpeg images +const S32 TARGET_DATA_SIZE = 95000; // Size of the image (compressed) we're trying to send to Facebook +const S32 MAX_DATA_SIZE = 98000; // Max size of the image (compressed) sent to Facebook +const S32 QUALITY_DECREMENT = 5; // Value we use to ratchet the quality down if we're over MAX_DATA_SIZE + + std::string get_map_url() { LLVector3d center_agent; @@ -73,6 +80,14 @@ std::string get_map_url() return map_url; } +// Compute target jpeg quality : see https://wiki.lindenlab.com/wiki/Facebook_Image_Quality for details +S32 compute_jpeg_quality(S32 width, S32 height) +{ + F32 target_compression_ratio = (F32)(width * height * 3) / (F32)(TARGET_DATA_SIZE); + S32 quality = (S32)(110.0f - (2.0f * target_compression_ratio)); + return llclamp(quality,MIN_QUALITY,MAX_QUALITY); +} + /////////////////////////// //LLFacebookStatusPanel////// /////////////////////////// @@ -173,7 +188,8 @@ mWorkingLabel(NULL), mThumbnailPlaceholder(NULL), mCaptionTextBox(NULL), mLocationCheckbox(NULL), -mPostButton(NULL) +mPostButton(NULL), +mQuality(MAX_QUALITY) { mCommitCallbackRegistrar.add("SocialSharing.SendPhoto", boost::bind(&LLFacebookPhotoPanel::onSend, this)); mCommitCallbackRegistrar.add("SocialSharing.RefreshPhoto", boost::bind(&LLFacebookPhotoPanel::onClickNewSnapshot, this)); @@ -285,10 +301,11 @@ void LLFacebookPhotoPanel::onVisibilityChange(const LLSD& new_visibility) p.rect(full_screen_rect); LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p); mPreviewHandle = previewp->getHandle(); + mQuality = MAX_QUALITY; previewp->setSnapshotType(previewp->SNAPSHOT_WEB); previewp->setSnapshotFormat(LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG); - //previewp->setSnapshotQuality(98); + previewp->setSnapshotQuality(mQuality, false); previewp->setThumbnailPlaceholderRect(mThumbnailPlaceholder->getRect()); updateControls(); @@ -399,6 +416,11 @@ void LLFacebookPhotoPanel::updateControls() if (got_snap) { LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 ); + if (previewp->getDataSize() >= MAX_DATA_SIZE) + { + // If size too big, change mQuality + mQuality -= QUALITY_DECREMENT; + } } //getChild("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : getString("unknown")); <---uses localized string @@ -445,8 +467,14 @@ void LLFacebookPhotoPanel::updateResolution(BOOL do_update) checkAspectRatio(width); previewp->getSize(width, height); + if (do_update || (mQuality == MAX_QUALITY)) + { + // Recompute quality setting if the update is requested by the UI or if quality has been reset + mQuality = compute_jpeg_quality(width, height); + } + bool quality_reset = previewp->setSnapshotQuality(mQuality, false); - if(original_width != width || original_height != height) + if (original_width != width || original_height != height || quality_reset) { previewp->setSize(width, height); @@ -454,7 +482,7 @@ void LLFacebookPhotoPanel::updateResolution(BOOL do_update) lldebugs << "updating thumbnail" << llendl; previewp->updateSnapshot(FALSE, TRUE); - if(do_update) + if (do_update || quality_reset) { lldebugs << "Will update controls" << llendl; updateControls(); diff --git a/indra/newview/llfloaterfacebook.h b/indra/newview/llfloaterfacebook.h index ab6420264b..0776f24034 100644 --- a/indra/newview/llfloaterfacebook.h +++ b/indra/newview/llfloaterfacebook.h @@ -88,6 +88,8 @@ private: LLUICtrl * mLocationCheckbox; LLUICtrl * mPostButton; LLUICtrl* mCancelButton; + + S32 mQuality; // Compression quality }; class LLFacebookCheckinPanel : public LLPanel diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp index 9feeea1644..7f578975db 100644 --- a/indra/newview/llsnapshotlivepreview.cpp +++ b/indra/newview/llsnapshotlivepreview.cpp @@ -222,15 +222,21 @@ void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail } } -void LLSnapshotLivePreview::setSnapshotQuality(S32 quality) +// Return true if the quality has been changed, false otherwise +bool LLSnapshotLivePreview::setSnapshotQuality(S32 quality, bool set_by_user) { llclamp(quality, 0, 100); if (quality != mSnapshotQuality) { mSnapshotQuality = quality; - gSavedSettings.setS32("SnapshotQuality", quality); + if (set_by_user) + { + gSavedSettings.setS32("SnapshotQuality", quality); + } mSnapshotUpToDate = FALSE; + return true; } + return false; } void LLSnapshotLivePreview::drawPreviewRect(S32 offset_x, S32 offset_y) diff --git a/indra/newview/llsnapshotlivepreview.h b/indra/newview/llsnapshotlivepreview.h index fe3d257b02..0c63bf47c7 100644 --- a/indra/newview/llsnapshotlivepreview.h +++ b/indra/newview/llsnapshotlivepreview.h @@ -93,7 +93,7 @@ public: void setSnapshotType(ESnapshotType type) { mSnapshotType = type; } void setSnapshotFormat(LLFloaterSnapshot::ESnapshotFormat type) { mSnapshotFormat = type; } - void setSnapshotQuality(S32 quality); + bool setSnapshotQuality(S32 quality, bool set_by_user = true); void setSnapshotBufferType(LLViewerWindow::ESnapshotType type) { mSnapshotBufferType = type; } void updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail = FALSE, F32 delay = 0.f); void saveWeb(); diff --git a/indra/newview/skins/default/xui/en/panel_facebook_photo.xml b/indra/newview/skins/default/xui/en/panel_facebook_photo.xml index 19f9f2fb74..2d46665bae 100644 --- a/indra/newview/skins/default/xui/en/panel_facebook_photo.xml +++ b/indra/newview/skins/default/xui/en/panel_facebook_photo.xml @@ -39,6 +39,10 @@ label="1024x768" name="1024x768" value="[i1024,i768]" /> + Date: Thu, 12 Dec 2013 08:51:15 -0500 Subject: STORM-68 Fix bug for new gestures, notecards, and scripts where a copied item did not preserve its default permissions. Add apply button. --- indra/newview/llfloaterperms.cpp | 11 ++++-- indra/newview/llfloaterperms.h | 3 +- indra/newview/llviewerinventory.cpp | 3 ++ .../skins/default/xui/en/floater_perms_default.xml | 40 ++++++++++++++-------- 4 files changed, 38 insertions(+), 19 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index b4ea34d5f1..0178c0b4f1 100755 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -103,6 +103,7 @@ LLFloaterPermsDefault::LLFloaterPermsDefault(const LLSD& seed) : LLFloater(seed) { mCommitCallbackRegistrar.add("PermsDefault.Copy", boost::bind(&LLFloaterPermsDefault::onCommitCopy, this, _2)); + mCommitCallbackRegistrar.add("PermsDefault.Apply", boost::bind(&LLFloaterPermsDefault::onClickApply, this)); mCommitCallbackRegistrar.add("PermsDefault.OK", boost::bind(&LLFloaterPermsDefault::onClickOK, this)); mCommitCallbackRegistrar.add("PermsDefault.Cancel", boost::bind(&LLFloaterPermsDefault::onClickCancel, this)); } @@ -129,9 +130,14 @@ BOOL LLFloaterPermsDefault::postBuild() return true; } +void LLFloaterPermsDefault::onClickApply() +{ + apply(); +} + void LLFloaterPermsDefault::onClickOK() { - ok(); + apply(); closeFloater(); } @@ -164,7 +170,6 @@ private: void error(U32 status, const std::string& reason) { -llwarns << "DBG !" << sPreviousReason << "!" << llendl; // Do not display the same error more than once in a row if (reason != sPreviousReason) { @@ -217,7 +222,7 @@ void LLFloaterPermsDefault::setCapSent(bool cap_sent) mCapSent = cap_sent; } -void LLFloaterPermsDefault::ok() +void LLFloaterPermsDefault::apply() { // Changes were already applied automatically to saved settings. // Refreshing internal values makes it official. diff --git a/indra/newview/llfloaterperms.h b/indra/newview/llfloaterperms.h index 2bb0a19dc1..12f297960a 100755 --- a/indra/newview/llfloaterperms.h +++ b/indra/newview/llfloaterperms.h @@ -54,8 +54,9 @@ class LLFloaterPermsDefault : public LLFloater public: /*virtual*/ BOOL postBuild(); - void ok(); + void apply(); void cancel(); + void onClickApply(); void onClickOK(); void onClickCancel(); void onCommitCopy(const LLSD& user_data); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index c52505e4b3..5c41ef52b6 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1004,6 +1004,7 @@ void create_script_cb(const LLUUID& inv_item) item->setPermissions(perm); + item->updateServer(FALSE); gInventory.updateItem(item); gInventory.notifyObservers(); } @@ -1024,6 +1025,7 @@ void create_gesture_cb(const LLUUID& inv_item) item->setPermissions(perm); + item->updateServer(FALSE); gInventory.updateItem(item); gInventory.notifyObservers(); @@ -1047,6 +1049,7 @@ void create_notecard_cb(const LLUUID& inv_item) item->setPermissions(perm); + item->updateServer(FALSE); gInventory.updateItem(item); gInventory.notifyObservers(); } diff --git a/indra/newview/skins/default/xui/en/floater_perms_default.xml b/indra/newview/skins/default/xui/en/floater_perms_default.xml index 9c3b92bc83..4e44c9ebb3 100644 --- a/indra/newview/skins/default/xui/en/floater_perms_default.xml +++ b/indra/newview/skins/default/xui/en/floater_perms_default.xml @@ -17,24 +17,22 @@ name="default permissions" top="20" width="690"> - - - + Next owner: + Title: -- cgit v1.2.3 From 6dfcd7fc2bd0f502673c43f1a54cda2a8d74e391 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 25 Feb 2014 23:01:52 -0800 Subject: ACME-1327 : WIP : Added computation of the big preview, allow big preview to be resizable --- indra/newview/llfloaterbigpreview.cpp | 8 ++-- indra/newview/llsnapshotlivepreview.cpp | 54 +++++++++++++++++++++- indra/newview/llsnapshotlivepreview.h | 10 +++- .../skins/default/xui/en/floater_big_preview.xml | 2 +- 4 files changed, 66 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterbigpreview.cpp b/indra/newview/llfloaterbigpreview.cpp index 84a1523e7c..d5f25d5f95 100644 --- a/indra/newview/llfloaterbigpreview.cpp +++ b/indra/newview/llfloaterbigpreview.cpp @@ -78,7 +78,7 @@ void LLFloaterBigPreview::draw() // Display the preview if one is available // HACK!!! We use the puny thumbnail image for the moment // *TODO : Use the real large preview - if (previewp && previewp->getThumbnailImage()) + if (previewp && previewp->getBigThumbnailImage()) { const LLRect& preview_rect = mPreviewPlaceholder->getRect(); // const S32 thumbnail_w = previewp->getThumbnailWidth(); @@ -93,9 +93,7 @@ void LLFloaterBigPreview::draw() // calc preview offset within the floater rect S32 offset_x = preview_rect.mLeft + local_offset_x; S32 offset_y = preview_rect.mBottom + local_offset_y; - - //llinfos << "Merov : draw, offset x = " << offset_x << ", y = " << offset_y << ", thumbnail w = " << thumbnail_w << ", h = " << thumbnail_h << ", rect w = " << preview_rect.getWidth() << ", h = " << preview_rect.getHeight() << llendl; - + gGL.matrixMode(LLRender::MM_MODELVIEW); // Apply floater transparency to the texture unless the floater is focused. F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); @@ -103,7 +101,7 @@ void LLFloaterBigPreview::draw() gl_draw_scaled_image(offset_x, offset_y, //thumbnail_w, thumbnail_h, preview_rect.getWidth(), preview_rect.getHeight(), - previewp->getThumbnailImage(), color % alpha); + previewp->getBigThumbnailImage(), color % alpha); } } diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp index eef4ed78c8..2ab00419f9 100644 --- a/indra/newview/llsnapshotlivepreview.cpp +++ b/indra/newview/llsnapshotlivepreview.cpp @@ -75,7 +75,8 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLSnapshotLivePreview::Param mColor(1.f, 0.f, 0.f, 0.5f), mCurImageIndex(0), mPreviewImage(NULL), - mThumbnailImage(NULL) , + mThumbnailImage(NULL) , + mBigThumbnailImage(NULL) , mThumbnailWidth(0), mThumbnailHeight(0), mThumbnailSubsampled(FALSE), @@ -115,6 +116,7 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLSnapshotLivePreview::Param mKeepAspectRatio = gSavedSettings.getBOOL("KeepAspectForSnapshot") ; mThumbnailUpdateLock = FALSE ; mThumbnailUpToDate = FALSE ; + mBigThumbnailUpToDate = FALSE ; } LLSnapshotLivePreview::~LLSnapshotLivePreview() @@ -205,6 +207,7 @@ void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail if (new_thumbnail) { mThumbnailUpToDate = FALSE ; + mBigThumbnailUpToDate = FALSE; } } @@ -602,6 +605,55 @@ void LLSnapshotLivePreview::generateThumbnailImage(BOOL force_update) mThumbnailUpdateLock = FALSE ; } +LLViewerTexture* LLSnapshotLivePreview::getBigThumbnailImage() +{ + if (mThumbnailUpdateLock) //in the process of updating + { + return NULL; + } + if (mBigThumbnailUpToDate && mBigThumbnailImage)//already updated + { + return mBigThumbnailImage; + } + + LLPointer raw = new LLImageRaw; + + // The big thumbnail is be a subsampled version of the preview (used in SL Share previews, i.e. Flickr, Twitter, Facebook) + raw->resize( mPreviewImage->getWidth(), + mPreviewImage->getHeight(), + mPreviewImage->getComponents()); + raw->copy(mPreviewImage); + // Scale to the big thumbnail size + if (!raw->scale(getBigThumbnailWidth(), getBigThumbnailHeight())) + { + raw = NULL ; + } + + if (raw) + { + // Filter + // Note: filtering needs to be done *before* the scaling to power of 2 or the effect is distorted + if (getFilter() != "") + { + std::string filter_path = LLImageFiltersManager::getInstance()->getFilterPath(getFilter()); + if (filter_path != "") + { + LLImageFilter filter(filter_path); + filter.executeFilter(raw); + } + else + { + llwarns << "Couldn't find a path to the following filter : " << getFilter() << llendl; + } + } + // Scale to a power of 2 so it can be mapped to a texture + raw->expandToPowerOfTwo(); + mBigThumbnailImage = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE); + mBigThumbnailUpToDate = TRUE ; + } + + return mBigThumbnailImage ; +} // Called often. Checks whether it's time to grab a new snapshot and if so, does it. // Returns TRUE if new snapshot generated, FALSE otherwise. diff --git a/indra/newview/llsnapshotlivepreview.h b/indra/newview/llsnapshotlivepreview.h index 1b7b5290f8..baf3531e69 100644 --- a/indra/newview/llsnapshotlivepreview.h +++ b/indra/newview/llsnapshotlivepreview.h @@ -120,6 +120,11 @@ public: void resetThumbnailImage() { mThumbnailImage = NULL ; } void drawPreviewRect(S32 offset_x, S32 offset_y) ; + + LLViewerTexture* getBigThumbnailImage(); + S32 getBigThumbnailWidth() const { return 3*mThumbnailWidth ; } + S32 getBigThumbnailHeight() const { return 3*mThumbnailHeight ; } + // Returns TRUE when snapshot generated, FALSE otherwise. static BOOL onIdle( void* snapshot_preview ); @@ -145,7 +150,10 @@ private: BOOL mThumbnailUpdateLock ; BOOL mThumbnailUpToDate ; LLRect mThumbnailPlaceholderRect; - BOOL mThumbnailSubsampled; // TRUE is the thumbnail is a subsampled version of the mPreviewImage + BOOL mThumbnailSubsampled; // TRUE if the thumbnail is a subsampled version of the mPreviewImage + + LLPointer mBigThumbnailImage ; + BOOL mBigThumbnailUpToDate; S32 mCurImageIndex; // The logic is mPreviewImage (raw frame) -> mFormattedImage (formatted / filtered) -> mPreviewImageEncoded (decoded back, to show artifacts) diff --git a/indra/newview/skins/default/xui/en/floater_big_preview.xml b/indra/newview/skins/default/xui/en/floater_big_preview.xml index 23698ccc40..c0bdd3d9bd 100644 --- a/indra/newview/skins/default/xui/en/floater_big_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_big_preview.xml @@ -2,7 +2,7 @@ Date: Wed, 26 Feb 2014 06:33:15 -0800 Subject: ACME-1327 : WIP : Update the big preview with size and refresh as well --- indra/newview/llsnapshotlivepreview.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra') diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp index 2ab00419f9..db203c7c78 100644 --- a/indra/newview/llsnapshotlivepreview.cpp +++ b/indra/newview/llsnapshotlivepreview.cpp @@ -545,6 +545,9 @@ void LLSnapshotLivePreview::generateThumbnailImage(BOOL force_update) return ; } + // Invalidate the big thumbnail when we regenerate the small one + mBigThumbnailUpToDate = FALSE; + if(mThumbnailImage) { resetThumbnailImage() ; -- cgit v1.2.3 From d80a812ffc0e70dcb049aefca69f2a4f8bbd4ab8 Mon Sep 17 00:00:00 2001 From: Cho Date: Wed, 26 Feb 2014 20:21:05 +0000 Subject: Changed SLShare photo upload filename to Untitled for the sake of default Flickr title --- indra/newview/llfacebookconnect.cpp | 2 +- indra/newview/llflickrconnect.cpp | 2 +- indra/newview/lltwitterconnect.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index e3ddb31935..ec7d0f7c50 100644 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -518,7 +518,7 @@ void LLFacebookConnect::sharePhoto(LLPointer image, const std: << caption << "\r\n"; body << "--" << boundary << "\r\n" - << "Content-Disposition: form-data; name=\"image\"; filename=\"snapshot." << imageFormat << "\"\r\n" + << "Content-Disposition: form-data; name=\"image\"; filename=\"Untitled." << imageFormat << "\"\r\n" << "Content-Type: image/" << imageFormat << "\r\n\r\n"; // Insert the image data. diff --git a/indra/newview/llflickrconnect.cpp b/indra/newview/llflickrconnect.cpp index c09e738a26..1898842478 100644 --- a/indra/newview/llflickrconnect.cpp +++ b/indra/newview/llflickrconnect.cpp @@ -401,7 +401,7 @@ void LLFlickrConnect::uploadPhoto(LLPointer image, const std:: << safety_level << "\r\n"; body << "--" << boundary << "\r\n" - << "Content-Disposition: form-data; name=\"image\"; filename=\"snapshot." << imageFormat << "\"\r\n" + << "Content-Disposition: form-data; name=\"image\"; filename=\"Untitled." << imageFormat << "\"\r\n" << "Content-Type: image/" << imageFormat << "\r\n\r\n"; // Insert the image data. diff --git a/indra/newview/lltwitterconnect.cpp b/indra/newview/lltwitterconnect.cpp index 350da84f69..cfdbca1b81 100644 --- a/indra/newview/lltwitterconnect.cpp +++ b/indra/newview/lltwitterconnect.cpp @@ -386,7 +386,7 @@ void LLTwitterConnect::uploadPhoto(LLPointer image, const std: << status << "\r\n"; body << "--" << boundary << "\r\n" - << "Content-Disposition: form-data; name=\"image\"; filename=\"snapshot." << imageFormat << "\"\r\n" + << "Content-Disposition: form-data; name=\"image\"; filename=\"Untitled." << imageFormat << "\"\r\n" << "Content-Type: image/" << imageFormat << "\r\n\r\n"; // Insert the image data. -- cgit v1.2.3 From ed38a0aede09f42c4fe7eb4dd53ecd6490d12ca0 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 26 Feb 2014 17:22:16 -0800 Subject: ACME-1327 : WIP : Make rescale of preview isotropic, make preview button a toggle --- indra/newview/llfloaterbigpreview.cpp | 33 ++++++++++++---------- indra/newview/llfloaterbigpreview.h | 4 +-- indra/newview/llfloaterflickr.cpp | 31 +++++++++++++++----- indra/newview/llfloaterflickr.h | 1 + indra/newview/llsnapshotlivepreview.h | 1 + .../skins/default/xui/en/panel_flickr_photo.xml | 5 ++-- 6 files changed, 48 insertions(+), 27 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterbigpreview.cpp b/indra/newview/llfloaterbigpreview.cpp index d5f25d5f95..b516e9dd01 100644 --- a/indra/newview/llfloaterbigpreview.cpp +++ b/indra/newview/llfloaterbigpreview.cpp @@ -28,8 +28,6 @@ #include "llviewerprecompiledheaders.h" #include "llfloaterbigpreview.h" - -#include "llfloaterreg.h" #include "llsnapshotlivepreview.h" /////////////////////// @@ -57,7 +55,7 @@ void LLFloaterBigPreview::onCancel() void LLFloaterBigPreview::closeOnFloaterOwnerClosing(LLFloater* floaterp) { - if (floaterp == mFloaterOwner) + if (isFloaterOwner(floaterp)) { closeFloater(); } @@ -76,21 +74,25 @@ void LLFloaterBigPreview::draw() LLSnapshotLivePreview * previewp = static_cast(mPreviewHandle.get()); // Display the preview if one is available - // HACK!!! We use the puny thumbnail image for the moment - // *TODO : Use the real large preview if (previewp && previewp->getBigThumbnailImage()) { + // Get the preview rect const LLRect& preview_rect = mPreviewPlaceholder->getRect(); -// const S32 thumbnail_w = previewp->getThumbnailWidth(); -// const S32 thumbnail_h = previewp->getThumbnailHeight(); - // calc preview offset within the preview rect -// const S32 local_offset_x = (preview_rect.getWidth() - thumbnail_w) / 2 ; -// const S32 local_offset_y = (preview_rect.getHeight() - thumbnail_h) / 2 ; - const S32 local_offset_x = 0 ; - const S32 local_offset_y = 0 ; + // Get the preview texture size + S32 thumbnail_w = previewp->getBigThumbnailWidth(); + S32 thumbnail_h = previewp->getBigThumbnailHeight(); + + // Compute the scaling ratio and the size of the final texture in the rect: we want to prevent anisotropic scaling (distorted in x and y) + F32 ratio = llmax((F32)(thumbnail_w)/(F32)(preview_rect.getWidth()), (F32)(thumbnail_h)/(F32)(preview_rect.getHeight())); + thumbnail_w = (S32)((F32)(thumbnail_w)/ratio); + thumbnail_h = (S32)((F32)(thumbnail_h)/ratio); - // calc preview offset within the floater rect + // Compute the preview offset within the preview rect: we want to center that preview in the available rect + const S32 local_offset_x = (preview_rect.getWidth() - thumbnail_w) / 2 ; + const S32 local_offset_y = (preview_rect.getHeight() - thumbnail_h) / 2 ; + + // Compute preview offset within the floater rect S32 offset_x = preview_rect.mLeft + local_offset_x; S32 offset_y = preview_rect.mBottom + local_offset_y; @@ -98,9 +100,10 @@ void LLFloaterBigPreview::draw() // Apply floater transparency to the texture unless the floater is focused. F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); LLColor4 color = LLColor4::white; + + // Draw the preview texture gl_draw_scaled_image(offset_x, offset_y, - //thumbnail_w, thumbnail_h, - preview_rect.getWidth(), preview_rect.getHeight(), + thumbnail_w, thumbnail_h, previewp->getBigThumbnailImage(), color % alpha); } } diff --git a/indra/newview/llfloaterbigpreview.h b/indra/newview/llfloaterbigpreview.h index 91b0968e88..63c6784d36 100644 --- a/indra/newview/llfloaterbigpreview.h +++ b/indra/newview/llfloaterbigpreview.h @@ -28,9 +28,6 @@ #define LL_LLFLOATERBIGPREVIEW_H #include "llfloater.h" -#include "llviewertexture.h" - -//class LLSnapshotLivePreview; class LLFloaterBigPreview : public LLFloater { @@ -44,6 +41,7 @@ public: void setPreview(LLView* previewp) { mPreviewHandle = previewp->getHandle(); } void setFloaterOwner(LLFloater* floaterp) { mFloaterOwner = floaterp; } + bool isFloaterOwner(LLFloater* floaterp) const { return (mFloaterOwner == floaterp); } void closeOnFloaterOwnerClosing(LLFloater* floaterp); private: diff --git a/indra/newview/llfloaterflickr.cpp b/indra/newview/llfloaterflickr.cpp index 21c619730c..e93adf1570 100644 --- a/indra/newview/llfloaterflickr.cpp +++ b/indra/newview/llfloaterflickr.cpp @@ -66,6 +66,7 @@ LLFlickrPhotoPanel::LLFlickrPhotoPanel() : mSnapshotPanel(NULL), mResolutionComboBox(NULL), mRefreshBtn(NULL), +mBtnPreview(NULL), mWorkingLabel(NULL), mThumbnailPlaceholder(NULL), mTitleTextBox(NULL), @@ -98,6 +99,7 @@ BOOL LLFlickrPhotoPanel::postBuild() mFilterComboBox = getChild("filters_combobox"); mFilterComboBox->setCommitCallback(boost::bind(&LLFlickrPhotoPanel::updateResolution, this, TRUE)); mRefreshBtn = getChild("new_snapshot_btn"); + mBtnPreview = getChild("big_preview_btn"); mWorkingLabel = getChild("working_lbl"); mThumbnailPlaceholder = getChild("thumbnail_placeholder"); mTitleTextBox = getChild("photo_title"); @@ -162,8 +164,14 @@ void LLFlickrPhotoPanel::draw() mResolutionComboBox->setEnabled(no_ongoing_connection); mFilterComboBox->setEnabled(no_ongoing_connection); mRefreshBtn->setEnabled(no_ongoing_connection); + mBtnPreview->setEnabled(no_ongoing_connection); mLocationCheckbox->setEnabled(no_ongoing_connection); + // Toggle the button state as appropriate + LLFloaterBigPreview* big_preview_floater = dynamic_cast(LLFloaterReg::getInstance("big_preview")); + bool preview_active = (big_preview_floater && big_preview_floater->getVisible() && big_preview_floater->isFloaterOwner(getParentByType())); + mBtnPreview->setToggleState(preview_active); + // Display the preview if one is available if (previewp && previewp->getThumbnailImage()) { @@ -256,13 +264,22 @@ void LLFlickrPhotoPanel::onClickNewSnapshot() void LLFlickrPhotoPanel::onClickBigPreview() { LLFloaterBigPreview* big_preview_floater = dynamic_cast(LLFloaterReg::getInstance("big_preview")); - if (big_preview_floater) - { - LLSnapshotLivePreview* previewp = getPreviewView(); - big_preview_floater->setPreview(previewp); - big_preview_floater->setFloaterOwner(getParentByType()); - } - LLFloaterReg::showInstance("big_preview"); + bool preview_active = (big_preview_floater && big_preview_floater->getVisible() && big_preview_floater->isFloaterOwner(getParentByType())); + // Toggle the preview + if (preview_active) + { + LLFloaterReg::hideInstance("big_preview"); + } + else + { + if (big_preview_floater) + { + LLSnapshotLivePreview* previewp = getPreviewView(); + big_preview_floater->setPreview(previewp); + big_preview_floater->setFloaterOwner(getParentByType()); + } + LLFloaterReg::showInstance("big_preview"); + } } void LLFlickrPhotoPanel::onSend() diff --git a/indra/newview/llfloaterflickr.h b/indra/newview/llfloaterflickr.h index 9fa4a258e2..8a346c3166 100644 --- a/indra/newview/llfloaterflickr.h +++ b/indra/newview/llfloaterflickr.h @@ -76,6 +76,7 @@ private: LLUICtrl * mRatingComboBox; LLUICtrl * mPostButton; LLUICtrl * mCancelButton; + LLButton * mBtnPreview; }; class LLFlickrAccountPanel : public LLPanel diff --git a/indra/newview/llsnapshotlivepreview.h b/indra/newview/llsnapshotlivepreview.h index baf3531e69..0e918d165e 100644 --- a/indra/newview/llsnapshotlivepreview.h +++ b/indra/newview/llsnapshotlivepreview.h @@ -28,6 +28,7 @@ #define LL_LLSNAPSHOTLIVEPREVIEW_H #include "llpanelsnapshot.h" +#include "llviewertexture.h" #include "llviewerwindow.h" class LLImageJPEG; diff --git a/indra/newview/skins/default/xui/en/panel_flickr_photo.xml b/indra/newview/skins/default/xui/en/panel_flickr_photo.xml index 350c385cc3..8d8ef45c0d 100644 --- a/indra/newview/skins/default/xui/en/panel_flickr_photo.xml +++ b/indra/newview/skins/default/xui/en/panel_flickr_photo.xml @@ -95,11 +95,12 @@ Refreshing... + Date: Thu, 27 Feb 2014 16:03:35 -0800 Subject: ACME-1333 : Allow Facebook panel to be resized, fixed ensuing follow positioning issues in all subpanels --- indra/newview/skins/default/xui/en/floater_facebook.xml | 7 +++++-- indra/newview/skins/default/xui/en/panel_facebook_account.xml | 2 ++ indra/newview/skins/default/xui/en/panel_facebook_friends.xml | 1 + indra/newview/skins/default/xui/en/panel_facebook_photo.xml | 9 +++++---- indra/newview/skins/default/xui/en/panel_facebook_place.xml | 7 ++++--- indra/newview/skins/default/xui/en/panel_facebook_status.xml | 7 ++++--- 6 files changed, 21 insertions(+), 12 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/floater_facebook.xml b/indra/newview/skins/default/xui/en/floater_facebook.xml index 544c443c76..4535b9084e 100644 --- a/indra/newview/skins/default/xui/en/floater_facebook.xml +++ b/indra/newview/skins/default/xui/en/floater_facebook.xml @@ -2,7 +2,7 @@ diff --git a/indra/newview/skins/default/xui/en/panel_facebook_friends.xml b/indra/newview/skins/default/xui/en/panel_facebook_friends.xml index d772dde0c5..07cbd06afa 100644 --- a/indra/newview/skins/default/xui/en/panel_facebook_friends.xml +++ b/indra/newview/skins/default/xui/en/panel_facebook_friends.xml @@ -2,6 +2,7 @@ height="400" width="304" layout="topleft" + follows="all" name="panel_facebook_friends">