diff options
61 files changed, 1216 insertions, 917 deletions
diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp index 6a51c4240b..08da599ef2 100644 --- a/indra/llui/llcheckboxctrl.cpp +++ b/indra/llui/llcheckboxctrl.cpp @@ -187,10 +187,32 @@ void LLCheckBoxCtrl::clear() void LLCheckBoxCtrl::reshape(S32 width, S32 height, BOOL called_from_parent) { - S32 label_top = mLabel->getRect().mTop; - mLabel->reshapeToFitText(); + LLRect rect = getRect(); + S32 delta_width = width - rect.getWidth(); + S32 delta_height = height - rect.getHeight(); - LLRect label_rect = mLabel->getRect(); + if (delta_width || delta_height) + { + // adjust our rectangle + rect.mRight = getRect().mLeft + width; + rect.mTop = getRect().mBottom + height; + setRect(rect); + } + + // reshapeToFitText reshapes label to minimal size according to last bounding box + // it will work fine in case of decrease of space, but if we get more space or text + // becomes longer, label will fail to grow so reinit label's dimentions. + + static LLUICachedControl<S32> llcheckboxctrl_hpad("UICheckboxctrlHPad", 0); + LLRect label_rect = mLabel->getRect(); + S32 new_width = getRect().getWidth() - label_rect.mLeft - llcheckboxctrl_hpad; + label_rect.mRight = label_rect.mLeft + new_width; + mLabel->setRect(label_rect); + + S32 label_top = label_rect.mTop; + mLabel->reshapeToFitText(TRUE); + + label_rect = mLabel->getRect(); if (label_top != label_rect.mTop && mWordWrap == WRAP_DOWN) { // reshapeToFitText uses LLView::reshape() which always reshapes @@ -210,6 +232,8 @@ void LLCheckBoxCtrl::reshape(S32 width, S32 height, BOOL called_from_parent) llmax(btn_rect.getWidth(), label_rect.mRight - btn_rect.mLeft), llmax(label_rect.mTop - btn_rect.mBottom, btn_rect.getHeight())); mButton->setShape(btn_rect); + + updateBoundingRect(); } //virtual diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 4aae1e374b..29a156e933 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -166,7 +166,7 @@ void LLLayoutPanel::setVisible( BOOL visible ) void LLLayoutPanel::reshape( S32 width, S32 height, BOOL called_from_parent /*= TRUE*/ ) { - if (width == getRect().getWidth() && height == getRect().getHeight()) return; + if (width == getRect().getWidth() && height == getRect().getHeight() && !LLView::sForceReshape) return; if (!mIgnoreReshape && mAutoResize == false) { diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 5568a84494..2c28b7943e 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -3244,7 +3244,7 @@ void hide_top_view( LLView* view ) // x and y are the desired location for the popup, in the spawning_view's // coordinate frame, NOT necessarily the mouse location // static -void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y) +void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y, S32 mouse_x, S32 mouse_y) { const S32 CURSOR_HEIGHT = 22; // Approximate "normal" cursor size const S32 CURSOR_WIDTH = 12; @@ -3275,12 +3275,6 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y) } } - // Save click point for detecting cursor moves before mouse-up. - // Must be in local coords to compare with mouseUp events. - // If the mouse doesn't move, the menu will stay open ala the Mac. - // See also LLContextMenu::show() - S32 mouse_x, mouse_y; - // Resetting scrolling position if (menu->isScrollable() && menu->isScrollPositionOnShowReset()) { @@ -3291,7 +3285,18 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y) menu->needsArrange(); menu->arrangeAndClear(); - LLUI::getInstance()->getMousePositionLocal(menu->getParent(), &mouse_x, &mouse_y); + if ((mouse_x == 0) || (mouse_y == 0)) + + { + // Save click point for detecting cursor moves before mouse-up. + // Must be in local coords to compare with mouseUp events. + // If the mouse doesn't move, the menu will stay open ala the Mac. + // See also LLContextMenu::show() + + LLUI::getInstance()->getMousePositionLocal(menu->getParent(), &mouse_x, &mouse_y); + } + + LLMenuHolderGL::sContextMenuSpawnPos.set(mouse_x,mouse_y); const LLRect menu_region_rect = LLMenuGL::sMenuContainer->getRect(); diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 1f11f26192..805620bf9b 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -510,7 +510,7 @@ public: void createJumpKeys(); // Show popup at a specific location, in the spawn_view's coordinate frame - static void showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y); + static void showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y, S32 mouse_x = 0, S32 mouse_y = 0); // Whether to drop shadow menu bar void setDropShadowed( const BOOL shadowed ); diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 83b851eed2..fc1301351d 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1148,7 +1148,7 @@ BOOL LLTextBase::handleToolTip(S32 x, S32 y, MASK mask) void LLTextBase::reshape(S32 width, S32 height, BOOL called_from_parent) { - if (width != getRect().getWidth() || height != getRect().getHeight()) + if (width != getRect().getWidth() || height != getRect().getHeight() || LLView::sForceReshape) { bool scrolled_to_bottom = mScroller ? mScroller->isAtBottom() : false; diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp index 0afd32f332..134afc005b 100644 --- a/indra/llui/lltextbox.cpp +++ b/indra/llui/lltextbox.cpp @@ -163,13 +163,13 @@ BOOL LLTextBox::setTextArg( const std::string& key, const LLStringExplicit& text } -void LLTextBox::reshapeToFitText() +void LLTextBox::reshapeToFitText(BOOL called_from_parent) { reflow(); S32 width = getTextPixelWidth(); S32 height = getTextPixelHeight(); - reshape( width + 2 * mHPad, height + 2 * mVPad, FALSE ); + reshape( width + 2 * mHPad, height + 2 * mVPad, called_from_parent ); } diff --git a/indra/llui/lltextbox.h b/indra/llui/lltextbox.h index 061d2dd23d..c3e3b61912 100644 --- a/indra/llui/lltextbox.h +++ b/indra/llui/lltextbox.h @@ -60,7 +60,7 @@ public: void setHAlign( LLFontGL::HAlign align ) { mHAlign = align; } void setClickedCallback( boost::function<void (void*)> cb, void* userdata = NULL ); - void reshapeToFitText(); + void reshapeToFitText(BOOL called_from_parent = FALSE); S32 getTextPixelWidth(); S32 getTextPixelHeight(); diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 333d03f208..d8d46e9e62 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -511,8 +511,7 @@ LLUrlEntrySimpleSecondlifeURL::LLUrlEntrySimpleSecondlifeURL() // secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about // x-grid-location-info://lincoln.lindenlab.com/app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about // -LLUrlEntryAgent::LLUrlEntryAgent() : - mAvatarNameCacheConnection() +LLUrlEntryAgent::LLUrlEntryAgent() { mPattern = boost::regex(APP_HEADER_REGEX "/agent/[\\da-f-]+/\\w+", boost::regex::perl|boost::regex::icase); @@ -543,7 +542,15 @@ void LLUrlEntryAgent::callObservers(const std::string &id, void LLUrlEntryAgent::onAvatarNameCache(const LLUUID& id, const LLAvatarName& av_name) { - mAvatarNameCacheConnection.disconnect(); + avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(id); + if (it != mAvatarNameCacheConnections.end()) + { + if (it->second.connected()) + { + it->second.disconnect(); + } + mAvatarNameCacheConnections.erase(it); + } std::string label = av_name.getCompleteName(); @@ -630,11 +637,17 @@ std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCa } else { - if (mAvatarNameCacheConnection.connected()) + avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(agent_id); + if (it != mAvatarNameCacheConnections.end()) { - mAvatarNameCacheConnection.disconnect(); + if (it->second.connected()) + { + it->second.disconnect(); + } + mAvatarNameCacheConnections.erase(it); } - mAvatarNameCacheConnection = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgent::onAvatarNameCache, this, _1, _2)); + mAvatarNameCacheConnections[agent_id] = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgent::onAvatarNameCache, this, _1, _2)); + addObserver(agent_id_string, url, cb); return LLTrans::getString("LoadingData"); } @@ -695,14 +708,21 @@ std::string LLUrlEntryAgent::getIcon(const std::string &url) // secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/(completename|displayname|username) // x-grid-location-info://lincoln.lindenlab.com/app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/(completename|displayname|username) // -LLUrlEntryAgentName::LLUrlEntryAgentName() : - mAvatarNameCacheConnection() +LLUrlEntryAgentName::LLUrlEntryAgentName() {} void LLUrlEntryAgentName::onAvatarNameCache(const LLUUID& id, const LLAvatarName& av_name) { - mAvatarNameCacheConnection.disconnect(); + avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(id); + if (it != mAvatarNameCacheConnections.end()) + { + if (it->second.connected()) + { + it->second.disconnect(); + } + mAvatarNameCacheConnections.erase(it); + } std::string label = getName(av_name); // received the agent name from the server - tell our observers @@ -737,11 +757,17 @@ std::string LLUrlEntryAgentName::getLabel(const std::string &url, const LLUrlLab } else { - if (mAvatarNameCacheConnection.connected()) + avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(agent_id); + if (it != mAvatarNameCacheConnections.end()) { - mAvatarNameCacheConnection.disconnect(); + if (it->second.connected()) + { + it->second.disconnect(); + } + mAvatarNameCacheConnections.erase(it); } - mAvatarNameCacheConnection = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgentName::onAvatarNameCache, this, _1, _2)); + mAvatarNameCacheConnections[agent_id] = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgentName::onAvatarNameCache, this, _1, _2)); + addObserver(agent_id_string, url, cb); return LLTrans::getString("LoadingData"); } diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h index 78c149d9fd..61aa94a813 100644 --- a/indra/llui/llurlentry.h +++ b/indra/llui/llurlentry.h @@ -212,10 +212,14 @@ public: LLUrlEntryAgent(); ~LLUrlEntryAgent() { - if (mAvatarNameCacheConnection.connected()) + for (avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.begin(); it != mAvatarNameCacheConnections.end(); ++it) { - mAvatarNameCacheConnection.disconnect(); + if (it->second.connected()) + { + it->second.disconnect(); + } } + mAvatarNameCacheConnections.clear(); } /*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb); /*virtual*/ std::string getIcon(const std::string &url); @@ -227,7 +231,9 @@ protected: /*virtual*/ void callObservers(const std::string &id, const std::string &label, const std::string& icon); private: void onAvatarNameCache(const LLUUID& id, const LLAvatarName& av_name); - boost::signals2::connection mAvatarNameCacheConnection; + + typedef std::map<LLUUID, boost::signals2::connection> avatar_name_cache_connection_map_t; + avatar_name_cache_connection_map_t mAvatarNameCacheConnections; }; /// @@ -241,10 +247,14 @@ public: LLUrlEntryAgentName(); ~LLUrlEntryAgentName() { - if (mAvatarNameCacheConnection.connected()) + for (avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.begin(); it != mAvatarNameCacheConnections.end(); ++it) { - mAvatarNameCacheConnection.disconnect(); + if (it->second.connected()) + { + it->second.disconnect(); + } } + mAvatarNameCacheConnections.clear(); } /*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb); /*virtual*/ LLStyle::Params getStyle() const; @@ -253,7 +263,9 @@ protected: virtual std::string getName(const LLAvatarName& avatar_name) = 0; private: void onAvatarNameCache(const LLUUID& id, const LLAvatarName& av_name); - boost::signals2::connection mAvatarNameCacheConnection; + + typedef std::map<LLUUID, boost::signals2::connection> avatar_name_cache_connection_map_t; + avatar_name_cache_connection_map_t mAvatarNameCacheConnections; }; diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index bd213d594a..bd1b1183a5 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -1392,7 +1392,9 @@ void LLView::reshape(S32 width, S32 height, BOOL called_from_parent) S32 delta_x = child_rect.mLeft - viewp->getRect().mLeft; S32 delta_y = child_rect.mBottom - viewp->getRect().mBottom; viewp->translate( delta_x, delta_y ); - if (child_rect.getWidth() != viewp->getRect().getWidth() || child_rect.getHeight() != viewp->getRect().getHeight()) + if (child_rect.getWidth() != viewp->getRect().getWidth() + || child_rect.getHeight() != viewp->getRect().getHeight() + || sForceReshape) { viewp->reshape(child_rect.getWidth(), child_rect.getHeight()); } diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index d77997a928..30bc743e72 100644 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp @@ -263,6 +263,18 @@ std::vector<std::string> LLWindow::getDynamicFallbackFontList() #endif } +// static +std::vector<std::string> LLWindow::getDisplaysResolutionList() +{ +#if LL_WINDOWS + return LLWindowWin32::getDisplaysResolutionList(); +#elif LL_DARWIN + return LLWindowMacOSX::getDisplaysResolutionList(); +#else + return std::vector<std::string>(); +#endif +} + #define UTF16_IS_HIGH_SURROGATE(U) ((U16)((U) - 0xD800) < 0x0400) #define UTF16_IS_LOW_SURROGATE(U) ((U16)((U) - 0xDC00) < 0x0400) #define UTF16_SURROGATE_PAIR_TO_UTF32(H,L) (((H) << 10) + (L) - (0xD800 << 10) - 0xDC00 + 0x00010000) diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index a05ba8cbba..bb4e534b60 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -168,6 +168,9 @@ public: // Get system UI size based on DPI (for 96 DPI UI size should be 1.0) virtual F32 getSystemUISize() { return 1.0; } + + static std::vector<std::string> getDisplaysResolutionList(); + protected: LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags); virtual ~LLWindow(); diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 2604a23c85..0d0607a0bb 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -41,6 +41,7 @@ #include <OpenGL/OpenGL.h> #include <Carbon/Carbon.h> #include <CoreServices/CoreServices.h> +#include <CoreGraphics/CGDisplayConfiguration.h> extern BOOL gDebugWindowProc; BOOL gHiDPISupport = TRUE; @@ -1911,6 +1912,35 @@ void LLWindowMacOSX::interruptLanguageTextInput() commitCurrentPreedit(mGLView); } +std::vector<std::string> LLWindowMacOSX::getDisplaysResolutionList() +{ + std::vector<std::string> resolution_list; + + CGDirectDisplayID display_ids[10]; + uint32_t found_displays = 0; + CGError err = CGGetActiveDisplayList(10, display_ids, &found_displays); + + if (kCGErrorSuccess != err) + { + LL_WARNS() << "Couldn't get a list of active displays" << LL_ENDL; + return std::vector<std::string>(); + } + + for (uint32_t i = 0; i < found_displays; i++) + { + S32 monitor_width = CGDisplayPixelsWide(display_ids[i]); + S32 monitor_height = CGDisplayPixelsHigh(display_ids[i]); + + std::ostringstream sstream; + sstream << monitor_width << "x" << monitor_height;; + std::string res = sstream.str(); + + resolution_list.push_back(res); + } + + return resolution_list; +} + //static std::vector<std::string> LLWindowMacOSX::getDynamicFallbackFontList() { diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index 24651027e8..bf45238c8d 100644 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -114,6 +114,8 @@ public: /*virtual*/ void spawnWebBrowser(const std::string& escaped_url, bool async); /*virtual*/ F32 getSystemUISize(); + static std::vector<std::string> getDisplaysResolutionList(); + static std::vector<std::string> getDynamicFallbackFontList(); // Provide native key event data diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 7783505c27..7535f0deb7 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -400,6 +400,39 @@ LLWinImm::~LLWinImm() } +class LLMonitorInfo +{ +public: + + std::vector<std::string> getResolutionsList() { return mResList; } + + LLMonitorInfo() + { + EnumDisplayMonitors(0, 0, MonitorEnum, (LPARAM)this); + } + +private: + + static BOOL CALLBACK MonitorEnum(HMONITOR hMon, HDC hdc, LPRECT lprcMonitor, LPARAM pData) + { + int monitor_width = lprcMonitor->right - lprcMonitor->left; + int monitor_height = lprcMonitor->bottom - lprcMonitor->top; + + std::ostringstream sstream; + sstream << monitor_width << "x" << monitor_height;; + std::string res = sstream.str(); + + LLMonitorInfo* pThis = reinterpret_cast<LLMonitorInfo*>(pData); + pThis->mResList.push_back(res); + + return TRUE; + } + + std::vector<std::string> mResList; +}; + +static LLMonitorInfo sMonitorInfo; + LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, U32 flags, @@ -4232,6 +4265,12 @@ F32 LLWindowWin32::getSystemUISize() } //static +std::vector<std::string> LLWindowWin32::getDisplaysResolutionList() +{ + return sMonitorInfo.getResolutionsList(); +} + +//static std::vector<std::string> LLWindowWin32::getDynamicFallbackFontList() { // Fonts previously in getFontListSans() have moved to fonts.xml. diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index 9cd16eb993..b1e8350a78 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -114,6 +114,7 @@ public: LLWindowCallbacks::DragNDropResult completeDragNDropRequest( const LLCoordGL gl_coord, const MASK mask, LLWindowCallbacks::DragNDropAction action, const std::string url ); + static std::vector<std::string> getDisplaysResolutionList(); static std::vector<std::string> getDynamicFallbackFontList(); static void setDPIAwareness(); protected: diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 88667bdc11..0d204fd716 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -234,6 +234,7 @@ set(viewer_SOURCE_FILES llfloaterconversationpreview.cpp llfloaterdeleteprefpreset.cpp llfloaterdestinations.cpp + llfloatereditenvironmentbase.cpp llfloatereditextdaycycle.cpp llfloaterenvironmentadjust.cpp llfloaterevent.cpp @@ -864,6 +865,7 @@ set(viewer_HEADER_FILES llfloaterconversationpreview.h llfloaterdeleteprefpreset.h llfloaterdestinations.h + llfloatereditenvironmentbase.h llfloatereditextdaycycle.h llfloaterenvironmentadjust.h llfloaterevent.h diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 75574df00e..dfb7327619 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3475,6 +3475,12 @@ void LLAppViewer::writeSystemInfo() gDebugInfo["FirstRunThisInstall"] = gSavedSettings.getBOOL("FirstRunThisInstall"); gDebugInfo["StartupState"] = LLStartUp::getStartupStateString(); + std::vector<std::string> resolutions = gViewerWindow->getWindow()->getDisplaysResolutionList(); + for (auto res_iter : resolutions) + { + gDebugInfo["DisplayInfo"].append(res_iter); + } + writeDebugInfo(); // Save out debug_info.log early, in case of crash. } diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index 5539fa75dd..dcffaf5930 100644 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -398,6 +398,23 @@ void LLConversationLog::deleteBackupLogs() } } +void LLConversationLog::verifyFilename(const LLUUID& session_id, const std::string &expected_filename) +{ + conversations_vec_t::iterator conv_it = mConversations.begin(); + for (; conv_it != mConversations.end(); ++conv_it) + { + if (conv_it->getSessionID() == session_id) + { + if (conv_it->getHistoryFileName() != expected_filename) + { + LLLogChat::renameLogFile(conv_it->getHistoryFileName(), expected_filename); + conv_it->updateHistoryFileName(expected_filename); + } + break; + } + } +} + bool LLConversationLog::moveLog(const std::string &originDirectory, const std::string &targetDirectory) { diff --git a/indra/newview/llconversationlog.h b/indra/newview/llconversationlog.h index 46e46a3278..82e7e597d0 100644 --- a/indra/newview/llconversationlog.h +++ b/indra/newview/llconversationlog.h @@ -59,7 +59,7 @@ public: getTime() const { return mTime; } bool hasOfflineMessages() const { return mHasOfflineIMs; } - void setConversationName(std::string conv_name) { mConversationName = conv_name; } + void setConversationName(const std::string &conv_name) { mConversationName = conv_name; } void setOfflineMessages(bool new_messages) { mHasOfflineIMs = new_messages; } bool isOlderThan(U32Days days) const; @@ -68,6 +68,8 @@ public: */ void updateTimestamp(); + void updateHistoryFileName(const std::string &new_name) { mHistoryFileName = new_name; } + /* * Resets flag of unread offline message to false when im floater with this conversation is opened. */ @@ -137,6 +139,8 @@ public: * public method which is called on viewer exit to save conversation log */ void cache(); + // will check if current name is edentical with the one on disk and will rename the one on disk if it isn't + void verifyFilename(const LLUUID& session_id, const std::string &expected_filename); bool moveLog(const std::string &originDirectory, const std::string &targetDirectory); void getListOfBackupLogs(std::vector<std::string>& list_of_backup_logs); void deleteBackupLogs(); diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index 60a5204547..0ca4679ea4 100644 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -31,6 +31,7 @@ #include <boost/bind.hpp> #include "llagentdata.h" +#include "llavataractions.h" #include "llconversationmodel.h" #include "llfloaterimsession.h" #include "llfloaterimnearbychat.h" @@ -432,8 +433,13 @@ void LLConversationViewSession::refresh() vmi->resetRefresh(); if (mSessionTitle) - { - mSessionTitle->setText(vmi->getDisplayName()); + { + if (!highlightFriendTitle(vmi)) + { + LLStyle::Params title_style; + title_style.color = LLUIColorTable::instance().getColor("LabelTextColor"); + mSessionTitle->setText(vmi->getDisplayName(), title_style); + } } // Update all speaking indicators @@ -478,6 +484,22 @@ void LLConversationViewSession::onCurrentVoiceSessionChanged(const LLUUID& sessi } } +bool LLConversationViewSession::highlightFriendTitle(LLConversationItem* vmi) +{ + if(vmi->getType() == LLConversationItem::CONV_PARTICIPANT || vmi->getType() == LLConversationItem::CONV_SESSION_1_ON_1) + { + LLIMModel::LLIMSession* session= LLIMModel::instance().findIMSession(vmi->getUUID()); + if (session && LLAvatarActions::isFriend(session->mOtherParticipantID)) + { + LLStyle::Params title_style; + title_style.color = LLUIColorTable::instance().getColor("ConversationFriendColor"); + mSessionTitle->setText(vmi->getDisplayName(), title_style); + return true; + } + } + return false; +} + // // Implementation of conversations list participant (avatar) widgets // @@ -576,7 +598,14 @@ void LLConversationViewParticipant::draw() } else { - color = mIsSelected ? sHighlightFgColor : sFgColor; + if (LLAvatarActions::isFriend(mUUID)) + { + color = LLUIColorTable::instance().getColor("ConversationFriendColor"); + } + else + { + color = mIsSelected ? sHighlightFgColor : sFgColor; + } } LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(getViewModelItem()); diff --git a/indra/newview/llconversationview.h b/indra/newview/llconversationview.h index 420c250dfe..5b2fd6b7c4 100644 --- a/indra/newview/llconversationview.h +++ b/indra/newview/llconversationview.h @@ -35,6 +35,7 @@ class LLTextBox; class LLFloaterIMContainer; +class LLConversationItem; class LLConversationViewSession; class LLConversationViewParticipant; @@ -92,6 +93,8 @@ public: LLFloater* getSessionFloater(); bool isInActiveVoiceChannel() { return mIsInActiveVoiceChannel; } + bool highlightFriendTitle(LLConversationItem* vmi); + private: void onCurrentVoiceSessionChanged(const LLUUID& session_id); diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 347997a69a..7a887a2549 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -384,6 +384,8 @@ LLFavoritesBarCtrl::LLFavoritesBarCtrl(const LLFavoritesBarCtrl::Params& p) mUpdateDropDownItems(true), mRestoreOverflowMenu(false), mGetPrevItems(true), + mMouseX(0), + mMouseY(0), mItemsChangedTimer() { // Register callback for menus with current registrar (will be parent panel's registrar) @@ -399,7 +401,7 @@ LLFavoritesBarCtrl::LLFavoritesBarCtrl(const LLFavoritesBarCtrl::Params& p) //make chevron button LLTextBox::Params more_button_params(p.more_button); mMoreTextBox = LLUICtrlFactory::create<LLTextBox> (more_button_params); - mMoreTextBox->setClickedCallback(boost::bind(&LLFavoritesBarCtrl::showDropDownMenu, this)); + mMoreTextBox->setClickedCallback(boost::bind(&LLFavoritesBarCtrl::onMoreTextBoxClicked, this)); addChild(mMoreTextBox); mDropDownItemsCount = 0; @@ -975,6 +977,12 @@ BOOL LLFavoritesBarCtrl::collectFavoriteItems(LLInventoryModel::item_array_t &it return TRUE; } +void LLFavoritesBarCtrl::onMoreTextBoxClicked() +{ + LLUI::getInstance()->getMousePositionScreen(&mMouseX, &mMouseY); + showDropDownMenu(); +} + void LLFavoritesBarCtrl::showDropDownMenu() { if (mOverflowMenuHandle.isDead()) @@ -1130,7 +1138,7 @@ void LLFavoritesBarCtrl::positionAndShowMenu(LLToggleableMenu* menu) } } - LLMenuGL::showPopup(this, menu, menu_x, menu_y); + LLMenuGL::showPopup(this, menu, menu_x, menu_y, mMouseX, mMouseY); } void LLFavoritesBarCtrl::onButtonClick(LLUUID item_id) diff --git a/indra/newview/llfavoritesbar.h b/indra/newview/llfavoritesbar.h index 571208aa31..868f1c83c8 100644 --- a/indra/newview/llfavoritesbar.h +++ b/indra/newview/llfavoritesbar.h @@ -96,6 +96,8 @@ protected: void showDropDownMenu(); + void onMoreTextBoxClicked(); + LLHandle<LLView> mOverflowMenuHandle; LLHandle<LLView> mContextMenuHandle; @@ -163,6 +165,9 @@ private: BOOL mTabsHighlightEnabled; + S32 mMouseX; + S32 mMouseY; + boost::signals2::connection mEndDragConnection; }; diff --git a/indra/newview/llfloaterbuy.cpp b/indra/newview/llfloaterbuy.cpp index 4d3ebcda1e..ea93d3bfaa 100644 --- a/indra/newview/llfloaterbuy.cpp +++ b/indra/newview/llfloaterbuy.cpp @@ -49,7 +49,8 @@ #include "lltrans.h" LLFloaterBuy::LLFloaterBuy(const LLSD& key) -: LLFloater(key) +: LLFloater(key), + mSelectionUpdateSlot() { } @@ -179,12 +180,19 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info) floater->getChild<LLUICtrl>("buy_text")->setTextArg("[AMOUNT]", llformat("%d", sale_info.getSalePrice())); floater->getChild<LLUICtrl>("buy_name_text")->setTextArg("[NAME]", owner_name); + floater->showViews(true); + // Must do this after the floater is created, because // sometimes the inventory is already there and // the callback is called immediately. LLViewerObject* obj = selection->getFirstRootObject(); floater->registerVOInventoryListener(obj,NULL); floater->requestVOInventory(); + + if (!floater->mSelectionUpdateSlot.connected()) + { + floater->mSelectionUpdateSlot = LLSelectMgr::getInstance()->mUpdateSignal.connect(boost::bind(&LLFloaterBuy::onSelectionChanged, floater)); + } } void LLFloaterBuy::inventoryChanged(LLViewerObject* obj, @@ -280,6 +288,30 @@ void LLFloaterBuy::inventoryChanged(LLViewerObject* obj, removeVOInventoryListener(); } +void LLFloaterBuy::onSelectionChanged() +{ + + if (LLSelectMgr::getInstance()->getEditSelection()->getRootObjectCount() == 0) + { + removeVOInventoryListener(); + closeFloater(); + } + else if (LLSelectMgr::getInstance()->getEditSelection()->getRootObjectCount() > 1) + { + removeVOInventoryListener(); + showViews(false); + reset(); + setTitle(getString("mupliple_selected")); + } +} + +void LLFloaterBuy::showViews(bool show) +{ + getChild<LLUICtrl>("buy_btn")->setEnabled(show); + getChild<LLUICtrl>("buy_text")->setVisible(show); + getChild<LLUICtrl>("buy_name_text")->setVisible(show); +} + void LLFloaterBuy::onClickBuy() { // Put the items where we put new folders. @@ -303,5 +335,10 @@ void LLFloaterBuy::onClickCancel() // virtual void LLFloaterBuy::onClose(bool app_quitting) { + if (mSelectionUpdateSlot.connected()) + { + mSelectionUpdateSlot.disconnect(); + } + mObjectSelection.clear(); } diff --git a/indra/newview/llfloaterbuy.h b/indra/newview/llfloaterbuy.h index 3ec642dee1..e83b3c6ba6 100644 --- a/indra/newview/llfloaterbuy.h +++ b/indra/newview/llfloaterbuy.h @@ -63,12 +63,17 @@ protected: S32 serial_num, void* data); + void onSelectionChanged(); + void showViews(bool show); + void onClickBuy(); void onClickCancel(); private: LLSafeHandle<LLObjectSelection> mObjectSelection; LLSaleInfo mSaleInfo; + + boost::signals2::connection mSelectionUpdateSlot; }; #endif diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index d574f1433f..3b192ff81b 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -457,6 +457,7 @@ void LLFloaterCamera::switchMode(ECameraControlMode mode) switch (mode) { + case CAMERA_CTRL_MODE_PRESETS: case CAMERA_CTRL_MODE_PAN: sFreeCamera = false; clear_camera_tool(); @@ -467,13 +468,6 @@ void LLFloaterCamera::switchMode(ECameraControlMode mode) activate_camera_tool(); break; - case CAMERA_CTRL_MODE_PRESETS: - if(sFreeCamera) - { - switchMode(CAMERA_CTRL_MODE_FREE_CAMERA); - } - break; - default: //normally we won't occur here llassert_always(FALSE); @@ -528,7 +522,6 @@ void LLFloaterCamera::onClickCameraItem(const LLSD& param) { camera_floater->switchMode(CAMERA_CTRL_MODE_FREE_CAMERA); camera_floater->updateItemsSelection(); - camera_floater->fromFreeToPresets(); } } else @@ -586,15 +579,7 @@ void LLFloaterCamera::switchToPreset(const std::string& name) if (camera_floater) { camera_floater->updateItemsSelection(); - camera_floater->fromFreeToPresets(); - } -} - -void LLFloaterCamera::fromFreeToPresets() -{ - if (!sFreeCamera && mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA && mPrevMode == CAMERA_CTRL_MODE_PRESETS) - { - switchMode(CAMERA_CTRL_MODE_PRESETS); + camera_floater->switchMode(CAMERA_CTRL_MODE_PRESETS); } } diff --git a/indra/newview/llfloatercamera.h b/indra/newview/llfloatercamera.h index 9440f50c3f..a69b87ad16 100644 --- a/indra/newview/llfloatercamera.h +++ b/indra/newview/llfloatercamera.h @@ -69,10 +69,6 @@ public: /*switch to one of the camera presets (front, rear, side)*/ static void switchToPreset(const std::string& name); - /* move to CAMERA_CTRL_MODE_PRESETS from CAMERA_CTRL_MODE_FREE_CAMERA if we are on presets panel and - are not in free camera mode*/ - void fromFreeToPresets(); - virtual void onOpen(const LLSD& key); virtual void onClose(bool app_quitting); diff --git a/indra/newview/llfloatereditenvironmentbase.cpp b/indra/newview/llfloatereditenvironmentbase.cpp new file mode 100644 index 0000000000..2a38f18b73 --- /dev/null +++ b/indra/newview/llfloatereditenvironmentbase.cpp @@ -0,0 +1,479 @@ +/** + * @file llfloatereditenvironmentbase.cpp + * @brief Floaters to create and edit fixed settings for sky and water. + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, 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 "llfloatereditenvironmentbase.h" + +#include <boost/make_shared.hpp> + +// libs +#include "llnotifications.h" +#include "llnotificationsutil.h" +#include "llfilepicker.h" +#include "llsettingspicker.h" +#include "llviewerparcelmgr.h" + +// newview +#include "llsettingssky.h" +#include "llsettingswater.h" + +#include "llenvironment.h" +#include "llagent.h" +#include "llparcel.h" + +#include "llsettingsvo.h" +#include "llinventorymodel.h" + +namespace +{ + const std::string ACTION_APPLY_LOCAL("apply_local"); + const std::string ACTION_APPLY_PARCEL("apply_parcel"); + const std::string ACTION_APPLY_REGION("apply_region"); +} + +//========================================================================= +const std::string LLFloaterEditEnvironmentBase::KEY_INVENTORY_ID("inventory_id"); + + +//========================================================================= + +class LLFixedSettingCopiedCallback : public LLInventoryCallback +{ +public: + LLFixedSettingCopiedCallback(LLHandle<LLFloater> handle) : mHandle(handle) {} + + virtual void fire(const LLUUID& inv_item_id) + { + if (!mHandle.isDead()) + { + LLViewerInventoryItem* item = gInventory.getItem(inv_item_id); + if (item) + { + LLFloaterEditEnvironmentBase* floater = (LLFloaterEditEnvironmentBase*)mHandle.get(); + floater->onInventoryCreated(item->getAssetUUID(), inv_item_id); + } + } + } + +private: + LLHandle<LLFloater> mHandle; +}; + +//========================================================================= +LLFloaterEditEnvironmentBase::LLFloaterEditEnvironmentBase(const LLSD &key) : + LLFloater(key), + mInventoryId(), + mInventoryItem(nullptr), + mIsDirty(false), + mCanCopy(false), + mCanMod(false), + mCanTrans(false), + mCanSave(false) +{ +} + +LLFloaterEditEnvironmentBase::~LLFloaterEditEnvironmentBase() +{ +} + +void LLFloaterEditEnvironmentBase::onFocusReceived() +{ + if (isInVisibleChain()) + { + updateEditEnvironment(); + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT, LLEnvironment::TRANSITION_FAST); + } +} + +void LLFloaterEditEnvironmentBase::onFocusLost() +{ +} + +void LLFloaterEditEnvironmentBase::loadInventoryItem(const LLUUID &inventoryId, bool can_trans) +{ + if (inventoryId.isNull()) + { + mInventoryItem = nullptr; + mInventoryId.setNull(); + mCanMod = true; + mCanCopy = true; + mCanTrans = true; + return; + } + + mInventoryId = inventoryId; + LL_INFOS("SETTINGS") << "Setting edit inventory item to " << mInventoryId << "." << LL_ENDL; + mInventoryItem = gInventory.getItem(mInventoryId); + + if (!mInventoryItem) + { + LL_WARNS("SETTINGS") << "Could not find inventory item with Id = " << mInventoryId << LL_ENDL; + LLNotificationsUtil::add("CantFindInvItem"); + closeFloater(); + + mInventoryId.setNull(); + mInventoryItem = nullptr; + return; + } + + if (mInventoryItem->getAssetUUID().isNull()) + { + LL_WARNS("ENVIRONMENT") << "Asset ID in inventory item is NULL (" << mInventoryId << ")" << LL_ENDL; + LLNotificationsUtil::add("UnableEditItem"); + closeFloater(); + + mInventoryId.setNull(); + mInventoryItem = nullptr; + return; + } + + mCanSave = true; + mCanCopy = mInventoryItem->getPermissions().allowCopyBy(gAgent.getID()); + mCanMod = mInventoryItem->getPermissions().allowModifyBy(gAgent.getID()); + mCanTrans = can_trans && mInventoryItem->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()); + + mExpectingAssetId = mInventoryItem->getAssetUUID(); + LLSettingsVOBase::getSettingsAsset(mInventoryItem->getAssetUUID(), + [this](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onAssetLoaded(asset_id, settings, status); }); +} + + +void LLFloaterEditEnvironmentBase::checkAndConfirmSettingsLoss(LLFloaterEditEnvironmentBase::on_confirm_fn cb) +{ + if (isDirty()) + { + LLSD args(LLSDMap("TYPE", getEditSettings()->getSettingsType()) + ("NAME", getEditSettings()->getName())); + + // create and show confirmation textbox + LLNotificationsUtil::add("SettingsConfirmLoss", args, LLSD(), + [cb](const LLSD¬if, const LLSD&resp) + { + S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); + if (opt == 0) + cb(); + }); + } + else if (cb) + { + cb(); + } +} + +void LLFloaterEditEnvironmentBase::onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status) +{ + if (asset_id != mExpectingAssetId) + { + LL_WARNS("ENVDAYEDIT") << "Expecting {" << mExpectingAssetId << "} got {" << asset_id << "} - throwing away." << LL_ENDL; + return; + } + mExpectingAssetId.setNull(); + clearDirtyFlag(); + + if (!settings || status) + { + LLSD args; + args["NAME"] = (mInventoryItem) ? mInventoryItem->getName() : "Unknown"; + LLNotificationsUtil::add("FailedToFindSettings", args); + closeFloater(); + return; + } + + if (settings->getFlag(LLSettingsBase::FLAG_NOSAVE)) + { + mCanSave = false; + mCanCopy = false; + mCanMod = false; + mCanTrans = false; + } + else + { + if (mInventoryItem) + settings->setName(mInventoryItem->getName()); + + if (mCanCopy) + settings->clearFlag(LLSettingsBase::FLAG_NOCOPY); + else + settings->setFlag(LLSettingsBase::FLAG_NOCOPY); + + if (mCanMod) + settings->clearFlag(LLSettingsBase::FLAG_NOMOD); + else + settings->setFlag(LLSettingsBase::FLAG_NOMOD); + + if (mCanTrans) + settings->clearFlag(LLSettingsBase::FLAG_NOTRANS); + else + settings->setFlag(LLSettingsBase::FLAG_NOTRANS); + } + + setEditSettingsAndUpdate(settings); +} + +void LLFloaterEditEnvironmentBase::onButtonImport() +{ + checkAndConfirmSettingsLoss([this](){ doImportFromDisk(); }); +} + +void LLFloaterEditEnvironmentBase::onSaveAsCommit(const LLSD& notification, const LLSD& response, const LLSettingsBase::ptr_t &settings) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (0 == option) + { + std::string settings_name = response["message"].asString(); + + LLInventoryObject::correctInventoryName(settings_name); + if (settings_name.empty()) + { + // Ideally notification should disable 'OK' button if name won't fit our requirements, + // for now either display notification, or use some default name + settings_name = "Unnamed"; + } + + if (mCanMod) + { + doApplyCreateNewInventory(settings_name, settings); + } + else if (mInventoryItem) + { + const LLUUID &marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); + LLUUID parent_id = mInventoryItem->getParentUUID(); + if (marketplacelistings_id == parent_id) + { + parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS); + } + + LLPointer<LLInventoryCallback> cb = new LLFixedSettingCopiedCallback(getHandle()); + copy_inventory_item( + gAgent.getID(), + mInventoryItem->getPermissions().getOwner(), + mInventoryItem->getUUID(), + parent_id, + settings_name, + cb); + } + else + { + LL_WARNS() << "Failed to copy fixed env setting" << LL_ENDL; + } + } +} + +void LLFloaterEditEnvironmentBase::onClickCloseBtn(bool app_quitting) +{ + if (!app_quitting) + checkAndConfirmSettingsLoss([this](){ closeFloater(); clearDirtyFlag(); }); + else + closeFloater(); +} + +void LLFloaterEditEnvironmentBase::doApplyCreateNewInventory(std::string settings_name, const LLSettingsBase::ptr_t &settings) +{ + if (mInventoryItem) + { + LLUUID parent_id = mInventoryItem->getParentUUID(); + U32 next_owner_perm = mInventoryItem->getPermissions().getMaskNextOwner(); + LLSettingsVOBase::createInventoryItem(settings, next_owner_perm, parent_id, settings_name, + [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); + } + else + { + LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS); + // This method knows what sort of settings object to create. + LLSettingsVOBase::createInventoryItem(settings, parent_id, settings_name, + [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); + } +} + +void LLFloaterEditEnvironmentBase::doApplyUpdateInventory(const LLSettingsBase::ptr_t &settings) +{ + LL_DEBUGS("ENVEDIT") << "Update inventory for " << mInventoryId << LL_ENDL; + if (mInventoryId.isNull()) + { + LLSettingsVOBase::createInventoryItem(settings, gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS), std::string(), + [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); + } + else + { + LLSettingsVOBase::updateInventoryItem(settings, mInventoryId, + [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryUpdated(asset_id, inventory_id, results); }); + } +} + +void LLFloaterEditEnvironmentBase::doApplyEnvironment(const std::string &where, const LLSettingsBase::ptr_t &settings) +{ + U32 flags(0); + + if (mInventoryItem) + { + if (!mInventoryItem->getPermissions().allowOperationBy(PERM_MODIFY, gAgent.getID())) + flags |= LLSettingsBase::FLAG_NOMOD; + if (!mInventoryItem->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) + flags |= LLSettingsBase::FLAG_NOTRANS; + } + + flags |= settings->getFlags(); + settings->setFlag(flags); + + if (where == ACTION_APPLY_LOCAL) + { + settings->setName("Local"); // To distinguish and make sure there is a name. Safe, because this is a copy. + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, settings); + } + else if (where == ACTION_APPLY_PARCEL) + { + LLParcel *parcel(LLViewerParcelMgr::instance().getAgentOrSelectedParcel()); + + if ((!parcel) || (parcel->getLocalID() == INVALID_PARCEL_ID)) + { + LL_WARNS("ENVIRONMENT") << "Can not identify parcel. Not applying." << LL_ENDL; + LLNotificationsUtil::add("WLParcelApplyFail"); + return; + } + + if (mInventoryItem && !isDirty()) + { + LLEnvironment::instance().updateParcel(parcel->getLocalID(), mInventoryItem->getAssetUUID(), mInventoryItem->getName(), LLEnvironment::NO_TRACK, -1, -1, flags); + } + else if (settings->getSettingsType() == "sky") + { + LLEnvironment::instance().updateParcel(parcel->getLocalID(), std::static_pointer_cast<LLSettingsSky>(settings), -1, -1); + } + else if (settings->getSettingsType() == "water") + { + LLEnvironment::instance().updateParcel(parcel->getLocalID(), std::static_pointer_cast<LLSettingsWater>(settings), -1, -1); + } + else if (settings->getSettingsType() == "day") + { + LLEnvironment::instance().updateParcel(parcel->getLocalID(), std::static_pointer_cast<LLSettingsDay>(settings), -1, -1); + } + } + else if (where == ACTION_APPLY_REGION) + { + if (mInventoryItem && !isDirty()) + { + LLEnvironment::instance().updateRegion(mInventoryItem->getAssetUUID(), mInventoryItem->getName(), LLEnvironment::NO_TRACK, -1, -1, flags); + } + else if (settings->getSettingsType() == "sky") + { + LLEnvironment::instance().updateRegion(std::static_pointer_cast<LLSettingsSky>(settings), -1, -1); + } + else if (settings->getSettingsType() == "water") + { + LLEnvironment::instance().updateRegion(std::static_pointer_cast<LLSettingsWater>(settings), -1, -1); + } + else if (settings->getSettingsType() == "day") + { + LLEnvironment::instance().updateRegion(std::static_pointer_cast<LLSettingsDay>(settings), -1, -1); + } + } + else + { + LL_WARNS("ENVIRONMENT") << "Unknown apply '" << where << "'" << LL_ENDL; + return; + } + +} + +void LLFloaterEditEnvironmentBase::doCloseInventoryFloater(bool quitting) +{ + LLFloater* floaterp = mInventoryFloater.get(); + + if (floaterp) + { + floaterp->closeFloater(quitting); + } +} + +void LLFloaterEditEnvironmentBase::onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results) +{ + LL_WARNS("ENVIRONMENT") << "Inventory item " << inventory_id << " has been created with asset " << asset_id << " results are:" << results << LL_ENDL; + + if (inventory_id.isNull() || !results["success"].asBoolean()) + { + LLNotificationsUtil::add("CantCreateInventory"); + return; + } + onInventoryCreated(asset_id, inventory_id); +} + +void LLFloaterEditEnvironmentBase::onInventoryCreated(LLUUID asset_id, LLUUID inventory_id) +{ + bool can_trans = true; + if (mInventoryItem) + { + LLPermissions perms = mInventoryItem->getPermissions(); + + LLInventoryItem *created_item = gInventory.getItem(mInventoryId); + + if (created_item) + { + can_trans = perms.allowOperationBy(PERM_TRANSFER, gAgent.getID()); + created_item->setPermissions(perms); + created_item->updateServer(false); + } + } + + clearDirtyFlag(); + setFocus(TRUE); // Call back the focus... + loadInventoryItem(inventory_id, can_trans); +} + +void LLFloaterEditEnvironmentBase::onInventoryUpdated(LLUUID asset_id, LLUUID inventory_id, LLSD results) +{ + LL_WARNS("ENVIRONMENT") << "Inventory item " << inventory_id << " has been updated with asset " << asset_id << " results are:" << results << LL_ENDL; + + clearDirtyFlag(); + if (inventory_id != mInventoryId) + { + loadInventoryItem(inventory_id); + } +} + +void LLFloaterEditEnvironmentBase::onPanelDirtyFlagChanged(bool value) +{ + if (value) + setDirtyFlag(); +} + +//------------------------------------------------------------------------- +bool LLFloaterEditEnvironmentBase::canUseInventory() const +{ + return LLEnvironment::instance().isInventoryEnabled(); +} + +bool LLFloaterEditEnvironmentBase::canApplyRegion() const +{ + return gAgent.canManageEstate(); +} + +bool LLFloaterEditEnvironmentBase::canApplyParcel() const +{ + return LLEnvironment::instance().canAgentUpdateParcelEnvironment(); +} + +//========================================================================= diff --git a/indra/newview/llfloatereditenvironmentbase.h b/indra/newview/llfloatereditenvironmentbase.h new file mode 100644 index 0000000000..7c7cf5bdcd --- /dev/null +++ b/indra/newview/llfloatereditenvironmentbase.h @@ -0,0 +1,148 @@ +/** + * @file llfloatereditenvironmentbase.h + * @brief Floaters to create and edit fixed settings for sky and water. + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, 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_FLOATEREDITENVIRONMENTBASE_H +#define LL_FLOATEREDITENVIRONMENTBASE_H + +#include "llfloater.h" +#include "llsettingsbase.h" +#include "llflyoutcombobtn.h" +#include "llinventory.h" + +#include "boost/signals2.hpp" + +class LLTabContainer; +class LLButton; +class LLLineEditor; +class LLFloaterSettingsPicker; +class LLFixedSettingCopiedCallback; + +class LLFloaterEditEnvironmentBase : public LLFloater +{ + LOG_CLASS(LLFloaterEditEnvironmentBase); + + friend class LLFixedSettingCopiedCallback; + +public: + static const std::string KEY_INVENTORY_ID; + + LLFloaterEditEnvironmentBase(const LLSD &key); + ~LLFloaterEditEnvironmentBase(); + + virtual void onFocusReceived() override; + virtual void onFocusLost() override; + + virtual LLSettingsBase::ptr_t getEditSettings() const = 0; + + virtual BOOL isDirty() const override { return getIsDirty(); } + +protected: + typedef std::function<void()> on_confirm_fn; + + virtual void setEditSettingsAndUpdate(const LLSettingsBase::ptr_t &settings) = 0; + virtual void updateEditEnvironment() = 0; + + virtual LLFloaterSettingsPicker *getSettingsPicker() = 0; + + void loadInventoryItem(const LLUUID &inventoryId, bool can_trans = true); + + void checkAndConfirmSettingsLoss(on_confirm_fn cb); + + virtual void doImportFromDisk() = 0; + virtual void doApplyCreateNewInventory(std::string settings_name, const LLSettingsBase::ptr_t &settings); + virtual void doApplyUpdateInventory(const LLSettingsBase::ptr_t &settings); + virtual void doApplyEnvironment(const std::string &where, const LLSettingsBase::ptr_t &settings); + void doCloseInventoryFloater(bool quitting = false); + + bool canUseInventory() const; + bool canApplyRegion() const; + bool canApplyParcel() const; + + LLUUID mInventoryId; + LLInventoryItem * mInventoryItem; + LLHandle<LLFloater> mInventoryFloater; + bool mCanCopy; + bool mCanMod; + bool mCanTrans; + bool mCanSave; + + bool mIsDirty; + + void onInventoryCreated(LLUUID asset_id, LLUUID inventory_id); + void onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results); + void onInventoryUpdated(LLUUID asset_id, LLUUID inventory_id, LLSD results); + + bool getIsDirty() const { return mIsDirty; } + void setDirtyFlag() { mIsDirty = true; } + virtual void clearDirtyFlag() = 0; + + void onPanelDirtyFlagChanged(bool); + + virtual void onClickCloseBtn(bool app_quitting = false) override; + void onSaveAsCommit(const LLSD& notification, const LLSD& response, const LLSettingsBase::ptr_t &settings); + void onButtonImport(); + + void onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settins, S32 status); + +private: + LLUUID mExpectingAssetId; // for asset load confirmation +}; + +class LLSettingsEditPanel : public LLPanel +{ +public: + virtual void setSettings(const LLSettingsBase::ptr_t &) = 0; + + typedef boost::signals2::signal<void(LLPanel *, bool)> on_dirty_charged_sg; + typedef boost::signals2::connection connection_t; + + inline bool getIsDirty() const { return mIsDirty; } + inline void setIsDirty() { mIsDirty = true; if (!mOnDirtyChanged.empty()) mOnDirtyChanged(this, mIsDirty); } + inline void clearIsDirty() { mIsDirty = false; if (!mOnDirtyChanged.empty()) mOnDirtyChanged(this, mIsDirty); } + + inline bool getCanChangeSettings() const { return mCanEdit; } + inline void setCanChangeSettings(bool flag) { mCanEdit = flag; } + + inline connection_t setOnDirtyFlagChanged(on_dirty_charged_sg::slot_type cb) { return mOnDirtyChanged.connect(cb); } + + +protected: + LLSettingsEditPanel() : + LLPanel(), + mIsDirty(false), + mOnDirtyChanged() + {} + +private: + void onTextureChanged(LLUUID &inventory_item_id); + + bool mIsDirty; + bool mCanEdit; + + on_dirty_charged_sg mOnDirtyChanged; +}; + +#endif // LL_FLOATERENVIRONMENTBASE_H diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index ea22043de8..0501c287ad 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -125,7 +125,6 @@ namespace { } //========================================================================= -const std::string LLFloaterEditExtDayCycle::KEY_INVENTORY_ID("inventory_id"); const std::string LLFloaterEditExtDayCycle::KEY_EDIT_CONTEXT("edit_context"); const std::string LLFloaterEditExtDayCycle::KEY_DAY_LENGTH("day_length"); const std::string LLFloaterEditExtDayCycle::KEY_CANMOD("canmod"); @@ -133,7 +132,7 @@ const std::string LLFloaterEditExtDayCycle::KEY_CANMOD("canmod"); const std::string LLFloaterEditExtDayCycle::VALUE_CONTEXT_INVENTORY("inventory"); const std::string LLFloaterEditExtDayCycle::VALUE_CONTEXT_PARCEL("parcel"); const std::string LLFloaterEditExtDayCycle::VALUE_CONTEXT_REGION("region"); - +/* //========================================================================= class LLDaySettingCopiedCallback : public LLInventoryCallback @@ -156,12 +155,12 @@ public: private: LLHandle<LLFloater> mHandle; -}; +};*/ //========================================================================= LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key) : - LLFloater(key), + LLFloaterEditEnvironmentBase(key), mFlyoutControl(nullptr), mDayLength(0), mCurrentTrack(1), @@ -170,19 +169,12 @@ LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key) : mFramesSlider(nullptr), mCurrentTimeLabel(nullptr), mImportButton(nullptr), - mInventoryId(), - mInventoryItem(nullptr), mLoadFrame(nullptr), mSkyBlender(), mWaterBlender(), mScratchSky(), mScratchWater(), mIsPlaying(false), - mIsDirty(false), - mCanSave(false), - mCanCopy(false), - mCanMod(false), - mCanTrans(false), mCloneTrack(nullptr), mLoadTrack(nullptr), mClearTrack(nullptr) @@ -425,19 +417,6 @@ void LLFloaterEditExtDayCycle::onClose(bool app_quitting) } } -void LLFloaterEditExtDayCycle::onFocusReceived() -{ - if (isInVisibleChain()) - { - updateEditEnvironment(); - LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT, LLEnvironment::TRANSITION_FAST); - } -} - -void LLFloaterEditExtDayCycle::onFocusLost() -{ -} - void LLFloaterEditExtDayCycle::onVisibilityChange(BOOL new_visibility) { @@ -488,6 +467,10 @@ void LLFloaterEditExtDayCycle::refresh() LLFloater::refresh(); } +void LLFloaterEditExtDayCycle::setEditSettingsAndUpdate(const LLSettingsBase::ptr_t &settings) +{ + setEditDayCycle(std::dynamic_pointer_cast<LLSettingsDay>(settings)); +} void LLFloaterEditExtDayCycle::setEditDayCycle(const LLSettingsDay::ptr_t &pday) { @@ -700,63 +683,6 @@ void LLFloaterEditExtDayCycle::onButtonApply(LLUICtrl *ctrl, const LLSD &data) } } -void LLFloaterEditExtDayCycle::onSaveAsCommit(const LLSD& notification, const LLSD& response, const LLSettingsDay::ptr_t &day) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if (0 == option) - { - std::string settings_name = response["message"].asString(); - - LLInventoryObject::correctInventoryName(settings_name); - if (settings_name.empty()) - { - // Ideally notification should disable 'OK' button if name won't fit our requirements, - // for now either display notification, or use some default name - settings_name = "Unnamed"; - } - - if (mCanMod) - { - doApplyCreateNewInventory(day, settings_name); - } - else if (mInventoryItem) - { - const LLUUID &marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); - LLUUID parent_id = mInventoryItem->getParentUUID(); - if (marketplacelistings_id == parent_id) - { - parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS); - } - - LLPointer<LLInventoryCallback> cb = new LLDaySettingCopiedCallback(getHandle()); - copy_inventory_item( - gAgent.getID(), - mInventoryItem->getPermissions().getOwner(), - mInventoryItem->getUUID(), - parent_id, - settings_name, - cb); - } - else - { - LL_WARNS() << "Failed to copy day setting" << LL_ENDL; - } - } -} - -void LLFloaterEditExtDayCycle::onClickCloseBtn(bool app_quitting /*= false*/) -{ - if (!app_quitting) - checkAndConfirmSettingsLoss([this](){ closeFloater(); clearDirtyFlag(); }); - else - closeFloater(); -} - -void LLFloaterEditExtDayCycle::onButtonImport() -{ - checkAndConfirmSettingsLoss([this]() { doImportFromDisk(); }); -} - void LLFloaterEditExtDayCycle::onButtonLoadFrame() { doOpenInventoryFloater((mCurrentTrack == LLSettingsDay::TRACK_WATER) ? LLSettingsType::ST_WATER : LLSettingsType::ST_SKY, LLUUID::null); @@ -1053,35 +979,6 @@ void LLFloaterEditExtDayCycle::onFrameSliderMouseUp(S32 x, S32 y, MASK mask) selectFrame(sliderpos, LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR); } - -void LLFloaterEditExtDayCycle::onPanelDirtyFlagChanged(bool value) -{ - if (value) - setDirtyFlag(); -} - -void LLFloaterEditExtDayCycle::checkAndConfirmSettingsLoss(on_confirm_fn cb) -{ - if (isDirty()) - { - LLSD args(LLSDMap("TYPE", mEditDay->getSettingsType()) - ("NAME", mEditDay->getName())); - - // create and show confirmation textbox - LLNotificationsUtil::add("SettingsConfirmLoss", args, LLSD(), - [cb](const LLSD¬if, const LLSD&resp) - { - S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); - if (opt == 0) - cb(); - }); - } - else if (cb) - { - cb(); - } -} - void LLFloaterEditExtDayCycle::onTimeSliderCallback() { stopPlay(); @@ -1435,106 +1332,6 @@ LLFloaterEditExtDayCycle::connection_t LLFloaterEditExtDayCycle::setEditCommitSi return mCommitSignal.connect(cb); } -void LLFloaterEditExtDayCycle::loadInventoryItem(const LLUUID &inventoryId, bool can_trans) -{ - if (inventoryId.isNull()) - { - mInventoryItem = nullptr; - mInventoryId.setNull(); - mCanSave = true; - mCanCopy = true; - mCanMod = true; - mCanTrans = true; - return; - } - - mInventoryId = inventoryId; - LL_INFOS("ENVDAYEDIT") << "Setting edit inventory item to " << mInventoryId << "." << LL_ENDL; - mInventoryItem = gInventory.getItem(mInventoryId); - - if (!mInventoryItem) - { - LL_WARNS("ENVDAYEDIT") << "Could not find inventory item with Id = " << mInventoryId << LL_ENDL; - - LLNotificationsUtil::add("CantFindInvItem"); - closeFloater(); - mInventoryId.setNull(); - mInventoryItem = nullptr; - return; - } - - if (mInventoryItem->getAssetUUID().isNull()) - { - LL_WARNS("ENVDAYEDIT") << "Asset ID in inventory item is NULL (" << mInventoryId << ")" << LL_ENDL; - - LLNotificationsUtil::add("UnableEditItem"); - closeFloater(); - - mInventoryId.setNull(); - mInventoryItem = nullptr; - return; - } - - mCanSave = true; - mCanCopy = mInventoryItem->getPermissions().allowCopyBy(gAgent.getID()); - mCanMod = mInventoryItem->getPermissions().allowModifyBy(gAgent.getID()); - mCanTrans = can_trans && mInventoryItem->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()); - - mExpectingAssetId = mInventoryItem->getAssetUUID(); - LLSettingsVOBase::getSettingsAsset(mInventoryItem->getAssetUUID(), - [this](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onAssetLoaded(asset_id, settings, status); }); -} - -void LLFloaterEditExtDayCycle::onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status) -{ - if (asset_id != mExpectingAssetId) - { - LL_WARNS("ENVDAYEDIT") << "Expecting {" << mExpectingAssetId << "} got {" << asset_id << "} - throwing away." << LL_ENDL; - return; - } - mExpectingAssetId.setNull(); - clearDirtyFlag(); - - if (!settings || status) - { - LLSD args; - args["NAME"] = (mInventoryItem) ? mInventoryItem->getName() : "Unknown"; - LLNotificationsUtil::add("FailedToFindSettings", args); - closeFloater(); - return; - } - - if (settings->getFlag(LLSettingsBase::FLAG_NOSAVE)) - { - mCanSave = false; - mCanCopy = false; - mCanMod = false; - mCanTrans = false; - } - else - { - if (mCanCopy) - settings->clearFlag(LLSettingsBase::FLAG_NOCOPY); - else - settings->setFlag(LLSettingsBase::FLAG_NOCOPY); - - if (mCanMod) - settings->clearFlag(LLSettingsBase::FLAG_NOMOD); - else - settings->setFlag(LLSettingsBase::FLAG_NOMOD); - - if (mCanTrans) - settings->clearFlag(LLSettingsBase::FLAG_NOTRANS); - else - settings->setFlag(LLSettingsBase::FLAG_NOTRANS); - - if (mInventoryItem) - settings->setName(mInventoryItem->getName()); - } - - setEditDayCycle(std::dynamic_pointer_cast<LLSettingsDay>(settings)); -} - void LLFloaterEditExtDayCycle::updateEditEnvironment(void) { if (!mEditDay) @@ -1670,93 +1467,6 @@ void LLFloaterEditExtDayCycle::reblendSettings() mWaterBlender->setPosition(position); } -void LLFloaterEditExtDayCycle::doApplyCreateNewInventory(const LLSettingsDay::ptr_t &day, std::string settings_name) -{ - if (mInventoryItem) - { - LLUUID parent_id = mInventoryItem->getParentUUID(); - U32 next_owner_perm = mInventoryItem->getPermissions().getMaskNextOwner(); - LLSettingsVOBase::createInventoryItem(day, next_owner_perm, parent_id, settings_name, - [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); - } - else - { - LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS); - // This method knows what sort of settings object to create. - LLSettingsVOBase::createInventoryItem(day, parent_id, settings_name, - [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); - } -} - -void LLFloaterEditExtDayCycle::doApplyUpdateInventory(const LLSettingsDay::ptr_t &day) -{ - if (mInventoryId.isNull()) - LLSettingsVOBase::createInventoryItem(day, gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS), std::string(), - [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); - else - LLSettingsVOBase::updateInventoryItem(day, mInventoryId, - [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryUpdated(asset_id, inventory_id, results); }); -} - -void LLFloaterEditExtDayCycle::doApplyEnvironment(const std::string &where, const LLSettingsDay::ptr_t &day) -{ - U32 flags(0); - - if (mInventoryItem) - { - if (!mInventoryItem->getPermissions().allowOperationBy(PERM_MODIFY, gAgent.getID())) - flags |= LLSettingsBase::FLAG_NOMOD; - if (!mInventoryItem->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) - flags |= LLSettingsBase::FLAG_NOTRANS; - } - - flags |= day->getFlags(); - day->setFlag(flags); - - if (where == ACTION_APPLY_LOCAL) - { - day->setName("Local"); // To distinguish and make sure there is a name. Safe, because this is a copy. - LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, day); - } - else if (where == ACTION_APPLY_PARCEL) - { - LLParcel *parcel(LLViewerParcelMgr::instance().getAgentOrSelectedParcel()); - - if ((!parcel) || (parcel->getLocalID() == INVALID_PARCEL_ID)) - { - LL_WARNS("ENVDAYEDIT") << "Can not identify parcel. Not applying." << LL_ENDL; - LLNotificationsUtil::add("WLParcelApplyFail"); - return; - } - - if (mInventoryItem && !isDirty()) - { - LLEnvironment::instance().updateParcel(parcel->getLocalID(), mInventoryItem->getAssetUUID(), mInventoryItem->getName(), LLEnvironment::NO_TRACK, -1, -1, flags); - } - else - { - LLEnvironment::instance().updateParcel(parcel->getLocalID(), day, -1, -1); - } - } - else if (where == ACTION_APPLY_REGION) - { - if (mInventoryItem && !isDirty()) - { - LLEnvironment::instance().updateRegion(mInventoryItem->getAssetUUID(), mInventoryItem->getName(), LLEnvironment::NO_TRACK, -1, -1, flags); - } - else - { - LLEnvironment::instance().updateRegion(day, -1, -1); - } - } - else - { - LL_WARNS("ENVDAYEDIT") << "Unknown apply '" << where << "'" << LL_ENDL; - return; - } - -} - void LLFloaterEditExtDayCycle::doApplyCommit(LLSettingsDay::ptr_t day) { if (!mCommitSignal.empty()) @@ -1793,51 +1503,6 @@ bool LLFloaterEditExtDayCycle::isAddingFrameAllowed() return mFramesSlider->canAddSliders(); } -void LLFloaterEditExtDayCycle::onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results) -{ - LL_INFOS("ENVDAYEDIT") << "Inventory item " << inventory_id << " has been created with asset " << asset_id << " results are:" << results << LL_ENDL; - - if (inventory_id.isNull() || !results["success"].asBoolean()) - { - LLNotificationsUtil::add("CantCreateInventory"); - return; - } - onInventoryCreated(asset_id, inventory_id); -} - -void LLFloaterEditExtDayCycle::onInventoryCreated(LLUUID asset_id, LLUUID inventory_id) -{ - bool can_trans = true; - if (mInventoryItem) - { - LLPermissions perms = mInventoryItem->getPermissions(); - - LLInventoryItem *created_item = gInventory.getItem(mInventoryId); - - if (created_item) - { - can_trans = perms.allowOperationBy(PERM_TRANSFER, gAgent.getID()); - created_item->setPermissions(perms); - created_item->updateServer(false); - } - } - - clearDirtyFlag(); - setFocus(TRUE); // Call back the focus... - loadInventoryItem(inventory_id, can_trans); -} - -void LLFloaterEditExtDayCycle::onInventoryUpdated(LLUUID asset_id, LLUUID inventory_id, LLSD results) -{ - LL_WARNS("ENVDAYEDIT") << "Inventory item " << inventory_id << " has been updated with asset " << asset_id << " results are:" << results << LL_ENDL; - - clearDirtyFlag(); - if (inventory_id != mInventoryId) - { - loadInventoryItem(inventory_id); - } -} - void LLFloaterEditExtDayCycle::doImportFromDisk() { // Load a a legacy Windlight XML from disk. (new LLFilePickerReplyThread(boost::bind(&LLFloaterEditExtDayCycle::loadSettingFromFile, this, _1), LLFilePicker::FFLOAD_XML, false))->getFile(); @@ -1864,21 +1529,6 @@ void LLFloaterEditExtDayCycle::loadSettingFromFile(const std::vector<std::string setEditDayCycle(legacyday); } -bool LLFloaterEditExtDayCycle::canUseInventory() const -{ - return LLEnvironment::instance().isInventoryEnabled(); -} - -bool LLFloaterEditExtDayCycle::canApplyRegion() const -{ - return gAgent.canManageEstate(); -} - -bool LLFloaterEditExtDayCycle::canApplyParcel() const -{ - return LLEnvironment::instance().canAgentUpdateParcelEnvironment(); -} - void LLFloaterEditExtDayCycle::startPlay() { doCloseInventoryFloater(); @@ -1983,14 +1633,8 @@ void LLFloaterEditExtDayCycle::doCloseTrackFloater(bool quitting) } } -void LLFloaterEditExtDayCycle::onPickerCommitTrackId(U32 track_id) +LLFloaterSettingsPicker * LLFloaterEditExtDayCycle::getSettingsPicker() { - cloneTrack(track_id, mCurrentTrack); -} - -void LLFloaterEditExtDayCycle::doOpenInventoryFloater(LLSettingsType::type_e type, LLUUID curritem) -{ -// LLUI::sWindow->setCursor(UI_CURSOR_WAIT); LLFloaterSettingsPicker *picker = static_cast<LLFloaterSettingsPicker *>(mInventoryFloater.get()); // Show the dialog @@ -2003,7 +1647,17 @@ void LLFloaterEditExtDayCycle::doOpenInventoryFloater(LLSettingsType::type_e typ picker->setCommitCallback([this](LLUICtrl *, const LLSD &data){ onPickerCommitSetting(data["ItemId"].asUUID(), data["Track"].asInteger()); }); } + return picker; +} + +void LLFloaterEditExtDayCycle::onPickerCommitTrackId(U32 track_id) +{ + cloneTrack(track_id, mCurrentTrack); +} +void LLFloaterEditExtDayCycle::doOpenInventoryFloater(LLSettingsType::type_e type, LLUUID curritem) +{ + LLFloaterSettingsPicker *picker = getSettingsPicker(); picker->setSettingsFilter(type); picker->setSettingsItemId(curritem); if (type == LLSettingsType::ST_DAYCYCLE) @@ -2018,16 +1672,6 @@ void LLFloaterEditExtDayCycle::doOpenInventoryFloater(LLSettingsType::type_e typ picker->setFocus(TRUE); } -void LLFloaterEditExtDayCycle::doCloseInventoryFloater(bool quitting) -{ - LLFloater* floaterp = mInventoryFloater.get(); - - if (floaterp) - { - floaterp->closeFloater(quitting); - } -} - void LLFloaterEditExtDayCycle::onPickerCommitSetting(LLUUID item_id, S32 track) { LLSettingsBase::TrackPosition frame(mTimeSlider->getCurSliderValue()); @@ -2118,7 +1762,9 @@ void LLFloaterEditExtDayCycle::onAssetLoadedForInsertion(LLUUID item_id, LLUUID LLInventoryItem *inv_item = gInventory.getItem(item_id); - if (inv_item && !inv_item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) + if (inv_item + && (!inv_item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()) + || !inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID()))) { // Need to check if item is already no-transfer, otherwise make it no-transfer bool no_transfer = false; diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h index b6e9fdb14f..9a30fb199f 100644 --- a/indra/newview/llfloatereditextdaycycle.h +++ b/indra/newview/llfloatereditextdaycycle.h @@ -32,6 +32,7 @@ #include <boost/signals2.hpp> #include "llenvironment.h" +#include "llfloatereditenvironmentbase.h" class LLCheckBoxCtrl; class LLComboBox; @@ -50,14 +51,13 @@ typedef std::shared_ptr<LLSettingsBase> LLSettingsBasePtr_t; /** * Floater for creating or editing a day cycle. */ -class LLFloaterEditExtDayCycle : public LLFloater +class LLFloaterEditExtDayCycle : public LLFloaterEditEnvironmentBase { LOG_CLASS(LLFloaterEditExtDayCycle); friend class LLDaySettingCopiedCallback; public: - static const std::string KEY_INVENTORY_ID; static const std::string KEY_EDIT_CONTEXT; static const std::string KEY_DAY_LENGTH; static const std::string KEY_CANMOD; @@ -82,8 +82,8 @@ public: virtual BOOL postBuild() override; virtual void onOpen(const LLSD& key) override; virtual void onClose(bool app_quitting) override; - virtual void onFocusReceived() override; - virtual void onFocusLost() override; + //virtual void onFocusReceived() override; + //virtual void onFocusLost() override; virtual void onVisibilityChange(BOOL new_visibility) override; connection_t setEditCommitSignal(edit_commit_signal_t::slot_type cb); @@ -97,10 +97,13 @@ public: LLUUID getEditingAssetId() { return mEditDay ? mEditDay->getAssetId() : LLUUID::null; } LLUUID getEditingInventoryId() { return mInventoryId; } + virtual LLSettingsBase::ptr_t getEditSettings() const override { return mEditDay; } + BOOL handleKeyUp(KEY key, MASK mask, BOOL called_from_parent) override; - BOOL isDirty() const override { return getIsDirty(); } +protected: + virtual void setEditSettingsAndUpdate(const LLSettingsBase::ptr_t &settings) override; private: typedef std::function<void()> on_confirm_fn; @@ -108,8 +111,8 @@ private: // flyout response/click void onButtonApply(LLUICtrl *ctrl, const LLSD &data); - virtual void onClickCloseBtn(bool app_quitting = false) override; - void onButtonImport(); + //virtual void onClickCloseBtn(bool app_quitting = false) override; + //void onButtonImport(); void onButtonLoadFrame(); void onAddFrame(); void onRemoveFrame(); @@ -119,7 +122,6 @@ private: void onCommitName(class LLLineEditor* caller, void* user_data); void onTrackSelectionCallback(const LLSD& user_data); void onPlayActionCallback(const LLSD& user_data); - void onSaveAsCommit(const LLSD& notification, const LLSD& response, const LLSettingsDay::ptr_t &day); // time slider clicked void onTimeSliderCallback(); // a frame moved or frame selection changed @@ -128,10 +130,6 @@ private: void onFrameSliderMouseDown(S32 x, S32 y, MASK mask); void onFrameSliderMouseUp(S32 x, S32 y, MASK mask); - void onPanelDirtyFlagChanged(bool); - - void checkAndConfirmSettingsLoss(on_confirm_fn cb); - void cloneTrack(U32 source_index, U32 dest_index); void cloneTrack(const LLSettingsDay::ptr_t &source_day, U32 source_index, U32 dest_index); void selectTrack(U32 track_index, bool force = false); @@ -148,25 +146,21 @@ private: void removeCurrentSliderFrame(); void removeSliderFrame(F32 frame); - void loadInventoryItem(const LLUUID &inventoryId, bool can_trans = true); - void onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status); - - void doImportFromDisk(); + virtual void doImportFromDisk() override; void loadSettingFromFile(const std::vector<std::string>& filenames); - void doApplyCreateNewInventory(const LLSettingsDay::ptr_t &day, std::string settings_name); - void doApplyUpdateInventory(const LLSettingsDay::ptr_t &day); - void doApplyEnvironment(const std::string &where, const LLSettingsDay::ptr_t &day); void doApplyCommit(LLSettingsDay::ptr_t day); void onInventoryCreated(LLUUID asset_id, LLUUID inventory_id); void onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results); void onInventoryUpdated(LLUUID asset_id, LLUUID inventory_id, LLSD results); + void doOpenTrackFloater(const LLSD &args); void doCloseTrackFloater(bool quitting = false); + virtual LLFloaterSettingsPicker* getSettingsPicker() override; void onPickerCommitTrackId(U32 track_id); void doOpenInventoryFloater(LLSettingsType::type_e type, LLUUID curritem); - void doCloseInventoryFloater(bool quitting = false); + //void doCloseInventoryFloater(bool quitting = false); void onPickerCommitSetting(LLUUID item_id, S32 track); void onAssetLoadedForInsertion(LLUUID item_id, LLUUID asset_id, @@ -176,11 +170,7 @@ private: S32 dest_track, LLSettingsBase::TrackPosition dest_frame); - bool canUseInventory() const; - bool canApplyRegion() const; - bool canApplyParcel() const; - - void updateEditEnvironment(); + virtual void updateEditEnvironment() override; void synchronizeTabs(); void reblendSettings(); @@ -193,7 +183,7 @@ private: bool getIsDirty() const { return mIsDirty; } void setDirtyFlag() { mIsDirty = true; } - virtual void clearDirtyFlag(); + virtual void clearDirtyFlag() override; bool isRemovingFrameAllowed(); bool isAddingFrameAllowed(); @@ -218,11 +208,8 @@ private: LLView* mSkyTabLayoutContainer; LLView* mWaterTabLayoutContainer; LLTextBox* mCurrentTimeLabel; - LLUUID mInventoryId; - LLInventoryItem * mInventoryItem; LLFlyoutComboBtnCtrl * mFlyoutControl; - LLHandle<LLFloater> mInventoryFloater; LLHandle<LLFloater> mTrackFloater; LLTrackBlenderLoopingManual::ptr_t mSkyBlender; @@ -236,11 +223,6 @@ private: LLFrameTimer mPlayTimer; F32 mPlayStartFrame; // an env frame bool mIsPlaying; - bool mIsDirty; - bool mCanCopy; - bool mCanMod; - bool mCanTrans; - bool mCanSave; edit_commit_signal_t mCommitSignal; diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index 37e162b249..41bbd5e8f9 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -81,44 +81,11 @@ namespace const std::string XML_FLYOUTMENU_FILE("menu_save_settings.xml"); } -//========================================================================= -const std::string LLFloaterFixedEnvironment::KEY_INVENTORY_ID("inventory_id"); - - -//========================================================================= - -class LLFixedSettingCopiedCallback : public LLInventoryCallback -{ -public: - LLFixedSettingCopiedCallback(LLHandle<LLFloater> handle) : mHandle(handle) {} - - virtual void fire(const LLUUID& inv_item_id) - { - if (!mHandle.isDead()) - { - LLViewerInventoryItem* item = gInventory.getItem(inv_item_id); - if (item) - { - LLFloaterFixedEnvironment* floater = (LLFloaterFixedEnvironment*)mHandle.get(); - floater->onInventoryCreated(item->getAssetUUID(), inv_item_id); - } - } - } - -private: - LLHandle<LLFloater> mHandle; -}; //========================================================================= LLFloaterFixedEnvironment::LLFloaterFixedEnvironment(const LLSD &key) : - LLFloater(key), - mFlyoutControl(nullptr), - mInventoryId(), - mInventoryItem(nullptr), - mIsDirty(false), - mCanCopy(false), - mCanMod(false), - mCanTrans(false) + LLFloaterEditEnvironmentBase(key), + mFlyoutControl(nullptr) { } @@ -176,19 +143,6 @@ void LLFloaterFixedEnvironment::onClose(bool app_quitting) syncronizeTabs(); } -void LLFloaterFixedEnvironment::onFocusReceived() -{ - if (isInVisibleChain()) - { - updateEditEnvironment(); - LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT, LLEnvironment::TRANSITION_FAST); - } -} - -void LLFloaterFixedEnvironment::onFocusLost() -{ -} - void LLFloaterFixedEnvironment::refresh() { if (!mSettings) @@ -220,6 +174,15 @@ void LLFloaterFixedEnvironment::refresh() } } +void LLFloaterFixedEnvironment::setEditSettingsAndUpdate(const LLSettingsBase::ptr_t &settings) +{ + mSettings = settings; // shouldn't this do buildDeepCloneAndUncompress() ? + updateEditEnvironment(); + syncronizeTabs(); + refresh(); + LLEnvironment::instance().updateEnvironment(LLEnvironment::TRANSITION_FAST); +} + void LLFloaterFixedEnvironment::syncronizeTabs() { S32 count = mTab->getTabCount(); @@ -250,131 +213,9 @@ LLFloaterSettingsPicker * LLFloaterFixedEnvironment::getSettingsPicker() return picker; } -void LLFloaterFixedEnvironment::loadInventoryItem(const LLUUID &inventoryId, bool can_trans) -{ - if (inventoryId.isNull()) - { - mInventoryItem = nullptr; - mInventoryId.setNull(); - mCanMod = true; - mCanCopy = true; - mCanTrans = true; - return; - } - - mInventoryId = inventoryId; - LL_INFOS("SETTINGS") << "Setting edit inventory item to " << mInventoryId << "." << LL_ENDL; - mInventoryItem = gInventory.getItem(mInventoryId); - - if (!mInventoryItem) - { - LL_WARNS("SETTINGS") << "Could not find inventory item with Id = " << mInventoryId << LL_ENDL; - LLNotificationsUtil::add("CantFindInvItem"); - closeFloater(); - - mInventoryId.setNull(); - mInventoryItem = nullptr; - return; - } - - if (mInventoryItem->getAssetUUID().isNull()) - { - LL_WARNS("ENVIRONMENT") << "Asset ID in inventory item is NULL (" << mInventoryId << ")" << LL_ENDL; - LLNotificationsUtil::add("UnableEditItem"); - closeFloater(); - - mInventoryId.setNull(); - mInventoryItem = nullptr; - return; - } - - mCanCopy = mInventoryItem->getPermissions().allowCopyBy(gAgent.getID()); - mCanMod = mInventoryItem->getPermissions().allowModifyBy(gAgent.getID()); - mCanTrans = can_trans && mInventoryItem->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()); - - LLSettingsVOBase::getSettingsAsset(mInventoryItem->getAssetUUID(), - [this](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onAssetLoaded(asset_id, settings, status); }); -} - - -void LLFloaterFixedEnvironment::checkAndConfirmSettingsLoss(LLFloaterFixedEnvironment::on_confirm_fn cb) -{ - if (isDirty()) - { - LLSD args(LLSDMap("TYPE", mSettings->getSettingsType()) - ("NAME", mSettings->getName())); - - // create and show confirmation textbox - LLNotificationsUtil::add("SettingsConfirmLoss", args, LLSD(), - [cb](const LLSD¬if, const LLSD&resp) - { - S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); - if (opt == 0) - cb(); - }); - } - else if (cb) - { - cb(); - } -} - void LLFloaterFixedEnvironment::onPickerCommitSetting(LLUUID item_id) { loadInventoryItem(item_id); -// mInventoryId = item_id; -// mInventoryItem = gInventory.getItem(mInventoryId); -// -// mCanCopy = mInventoryItem->getPermissions().allowCopyBy(gAgent.getID()); -// mCanMod = mInventoryItem->getPermissions().allowModifyBy(gAgent.getID()); -// mCanTrans = mInventoryItem->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()); -// -// LLSettingsVOBase::getSettingsAsset(mInventoryItem->getAssetUUID(), -// [this](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onAssetLoaded(asset_id, settings, status); }); -} - -void LLFloaterFixedEnvironment::onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status) -{ - if (mInventoryItem && mInventoryItem->getAssetUUID() != asset_id) - { - LL_WARNS("ENVIRONMENT") << "Discarding obsolete asset callback" << LL_ENDL; - return; - } - - clearDirtyFlag(); - - if (!settings || status) - { - LLSD args; - args["NAME"] = (mInventoryItem) ? mInventoryItem->getName() : "Unknown"; - LLNotificationsUtil::add("FailedToFindSettings", args); - closeFloater(); - return; - } - - mSettings = settings; - if (mInventoryItem) - mSettings->setName(mInventoryItem->getName()); - - if (mCanCopy) - settings->clearFlag(LLSettingsBase::FLAG_NOCOPY); - else - settings->setFlag(LLSettingsBase::FLAG_NOCOPY); - - if (mCanMod) - settings->clearFlag(LLSettingsBase::FLAG_NOMOD); - else - settings->setFlag(LLSettingsBase::FLAG_NOMOD); - - if (mCanTrans) - settings->clearFlag(LLSettingsBase::FLAG_NOTRANS); - else - settings->setFlag(LLSettingsBase::FLAG_NOTRANS); - - updateEditEnvironment(); - syncronizeTabs(); - refresh(); - LLEnvironment::instance().updateEnvironment(LLEnvironment::TRANSITION_FAST); } void LLFloaterFixedEnvironment::onNameChanged(const std::string &name) @@ -473,50 +314,6 @@ void LLFloaterFixedEnvironment::onButtonApply(LLUICtrl *ctrl, const LLSD &data) } } -void LLFloaterFixedEnvironment::onSaveAsCommit(const LLSD& notification, const LLSD& response, const LLSettingsBase::ptr_t &settings) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if (0 == option) - { - std::string settings_name = response["message"].asString(); - - LLInventoryObject::correctInventoryName(settings_name); - if (settings_name.empty()) - { - // Ideally notification should disable 'OK' button if name won't fit our requirements, - // for now either display notification, or use some default name - settings_name = "Unnamed"; - } - - if (mCanMod) - { - doApplyCreateNewInventory(settings_name, settings); - } - else if (mInventoryItem) - { - const LLUUID &marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); - LLUUID parent_id = mInventoryItem->getParentUUID(); - if (marketplacelistings_id == parent_id) - { - parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS); - } - - LLPointer<LLInventoryCallback> cb = new LLFixedSettingCopiedCallback(getHandle()); - copy_inventory_item( - gAgent.getID(), - mInventoryItem->getPermissions().getOwner(), - mInventoryItem->getUUID(), - parent_id, - settings_name, - cb); - } - else - { - LL_WARNS() << "Failed to copy fixed env setting" << LL_ENDL; - } - } -} - void LLFloaterFixedEnvironment::onClickCloseBtn(bool app_quitting) { if (!app_quitting) @@ -530,116 +327,6 @@ void LLFloaterFixedEnvironment::onButtonLoad() checkAndConfirmSettingsLoss([this](){ doSelectFromInventory(); }); } -void LLFloaterFixedEnvironment::doApplyCreateNewInventory(std::string settings_name, const LLSettingsBase::ptr_t &settings) -{ - if (mInventoryItem) - { - LLUUID parent_id = mInventoryItem->getParentUUID(); - U32 next_owner_perm = mInventoryItem->getPermissions().getMaskNextOwner(); - LLSettingsVOBase::createInventoryItem(settings, next_owner_perm, parent_id, settings_name, - [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); - } - else - { - LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS); - // This method knows what sort of settings object to create. - LLSettingsVOBase::createInventoryItem(settings, parent_id, settings_name, - [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); - } -} - -void LLFloaterFixedEnvironment::doApplyUpdateInventory(const LLSettingsBase::ptr_t &settings) -{ - LL_DEBUGS("ENVEDIT") << "Update inventory for " << mInventoryId << LL_ENDL; - if (mInventoryId.isNull()) - { - LLSettingsVOBase::createInventoryItem(settings, gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS), std::string(), - [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); - } - else - { - LLSettingsVOBase::updateInventoryItem(settings, mInventoryId, - [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryUpdated(asset_id, inventory_id, results); }); - } -} - -void LLFloaterFixedEnvironment::doApplyEnvironment(const std::string &where, const LLSettingsBase::ptr_t &settings) -{ - U32 flags(0); - - if (mInventoryItem) - { - if (!mInventoryItem->getPermissions().allowOperationBy(PERM_MODIFY, gAgent.getID())) - flags |= LLSettingsBase::FLAG_NOMOD; - if (!mInventoryItem->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) - flags |= LLSettingsBase::FLAG_NOTRANS; - } - - flags |= settings->getFlags(); - settings->setFlag(flags); - - if (where == ACTION_APPLY_LOCAL) - { - settings->setName("Local"); // To distinguish and make sure there is a name. Safe, because this is a copy. - LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, settings); - } - else if (where == ACTION_APPLY_PARCEL) - { - LLParcel *parcel(LLViewerParcelMgr::instance().getAgentOrSelectedParcel()); - - if ((!parcel) || (parcel->getLocalID() == INVALID_PARCEL_ID)) - { - LL_WARNS("ENVIRONMENT") << "Can not identify parcel. Not applying." << LL_ENDL; - LLNotificationsUtil::add("WLParcelApplyFail"); - return; - } - - if (mInventoryItem && !isDirty()) - { - LLEnvironment::instance().updateParcel(parcel->getLocalID(), mInventoryItem->getAssetUUID(), mInventoryItem->getName(), LLEnvironment::NO_TRACK, -1, -1, flags); - } - else if (settings->getSettingsType() == "sky") - { - LLEnvironment::instance().updateParcel(parcel->getLocalID(), std::static_pointer_cast<LLSettingsSky>(settings), -1, -1); - } - else if (settings->getSettingsType() == "water") - { - LLEnvironment::instance().updateParcel(parcel->getLocalID(), std::static_pointer_cast<LLSettingsWater>(settings), -1, -1); - } - } - else if (where == ACTION_APPLY_REGION) - { - if (mInventoryItem && !isDirty()) - { - LLEnvironment::instance().updateRegion(mInventoryItem->getAssetUUID(), mInventoryItem->getName(), LLEnvironment::NO_TRACK, -1, -1, flags); - } - else if (settings->getSettingsType() == "sky") - { - LLEnvironment::instance().updateRegion(std::static_pointer_cast<LLSettingsSky>(settings), -1, -1); - } - else if (settings->getSettingsType() == "water") - { - LLEnvironment::instance().updateRegion(std::static_pointer_cast<LLSettingsWater>(settings), -1, -1); - } - } - else - { - LL_WARNS("ENVIRONMENT") << "Unknown apply '" << where << "'" << LL_ENDL; - return; - } - -} - -void LLFloaterFixedEnvironment::doCloseInventoryFloater(bool quitting) -{ - LLFloater* floaterp = mInventoryFloater.get(); - - if (floaterp) - { - floaterp->closeFloater(quitting); - } -} - void LLFloaterFixedEnvironment::onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results) { LL_WARNS("ENVIRONMENT") << "Inventory item " << inventory_id << " has been created with asset " << asset_id << " results are:" << results << LL_ENDL; @@ -709,28 +396,6 @@ void LLFloaterFixedEnvironment::doSelectFromInventory() picker->setFocus(TRUE); } -void LLFloaterFixedEnvironment::onPanelDirtyFlagChanged(bool value) -{ - if (value) - setDirtyFlag(); -} - -//------------------------------------------------------------------------- -bool LLFloaterFixedEnvironment::canUseInventory() const -{ - return LLEnvironment::instance().isInventoryEnabled(); -} - -bool LLFloaterFixedEnvironment::canApplyRegion() const -{ - return gAgent.canManageEstate(); -} - -bool LLFloaterFixedEnvironment::canApplyParcel() const -{ - return LLEnvironment::instance().canAgentUpdateParcelEnvironment(); -} - //========================================================================= LLFloaterFixedEnvironmentWater::LLFloaterFixedEnvironmentWater(const LLSD &key): LLFloaterFixedEnvironment(key) diff --git a/indra/newview/llfloaterfixedenvironment.h b/indra/newview/llfloaterfixedenvironment.h index 513996c4a3..f35f4a4368 100644 --- a/indra/newview/llfloaterfixedenvironment.h +++ b/indra/newview/llfloaterfixedenvironment.h @@ -27,7 +27,7 @@ #ifndef LL_FLOATERFIXEDENVIRONMENT_H #define LL_FLOATERFIXEDENVIRONMENT_H -#include "llfloater.h" +#include "llfloatereditenvironmentbase.h" #include "llsettingsbase.h" #include "llflyoutcombobtn.h" #include "llinventory.h" @@ -43,15 +43,10 @@ class LLFixedSettingCopiedCallback; /** * Floater container for creating and editing fixed environment settings. */ -class LLFloaterFixedEnvironment : public LLFloater +class LLFloaterFixedEnvironment : public LLFloaterEditEnvironmentBase { LOG_CLASS(LLFloaterFixedEnvironment); - - friend class LLFixedSettingCopiedCallback; - public: - static const std::string KEY_INVENTORY_ID; - LLFloaterFixedEnvironment(const LLSD &key); ~LLFloaterFixedEnvironment(); @@ -59,64 +54,35 @@ public: virtual void onOpen(const LLSD& key) override; virtual void onClose(bool app_quitting) override; - virtual void onFocusReceived() override; - virtual void onFocusLost() override; - void setEditSettings(const LLSettingsBase::ptr_t &settings) { mSettings = settings; clearDirtyFlag(); syncronizeTabs(); refresh(); } - LLSettingsBase::ptr_t getEditSettings() const { return mSettings; } - - virtual BOOL isDirty() const override { return getIsDirty(); } + virtual LLSettingsBase::ptr_t getEditSettings() const override { return mSettings; } protected: typedef std::function<void()> on_confirm_fn; - virtual void updateEditEnvironment() = 0; virtual void refresh() override; + void setEditSettingsAndUpdate(const LLSettingsBase::ptr_t &settings) override; virtual void syncronizeTabs(); - LLFloaterSettingsPicker *getSettingsPicker(); - - void loadInventoryItem(const LLUUID &inventoryId, bool can_trans = true); - - void checkAndConfirmSettingsLoss(on_confirm_fn cb); + virtual LLFloaterSettingsPicker *getSettingsPicker() override; LLTabContainer * mTab; LLLineEditor * mTxtName; LLSettingsBase::ptr_t mSettings; - virtual void doImportFromDisk() = 0; - virtual void doApplyCreateNewInventory(std::string settings_name, const LLSettingsBase::ptr_t &settings); - virtual void doApplyUpdateInventory(const LLSettingsBase::ptr_t &settings); - virtual void doApplyEnvironment(const std::string &where, const LLSettingsBase::ptr_t &settings); - void doCloseInventoryFloater(bool quitting = false); - - bool canUseInventory() const; - bool canApplyRegion() const; - bool canApplyParcel() const; - LLFlyoutComboBtnCtrl * mFlyoutControl; - LLUUID mInventoryId; - LLInventoryItem * mInventoryItem; - LLHandle<LLFloater> mInventoryFloater; - bool mCanCopy; - bool mCanMod; - bool mCanTrans; - void onInventoryCreated(LLUUID asset_id, LLUUID inventory_id); void onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results); void onInventoryUpdated(LLUUID asset_id, LLUUID inventory_id, LLSD results); - bool getIsDirty() const { return mIsDirty; } - void setDirtyFlag() { mIsDirty = true; } - virtual void clearDirtyFlag(); + virtual void clearDirtyFlag() override; + void updatePermissionFlags(); void doSelectFromInventory(); - void onPanelDirtyFlagChanged(bool); virtual void onClickCloseBtn(bool app_quitting = false) override; - void onSaveAsCommit(const LLSD& notification, const LLSD& response, const LLSettingsBase::ptr_t &settings); private: void onNameChanged(const std::string &name); @@ -126,9 +92,6 @@ private: void onButtonLoad(); void onPickerCommitSetting(LLUUID item_id); - void onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settins, S32 status); - - bool mIsDirty; }; class LLFloaterFixedEnvironmentWater : public LLFloaterFixedEnvironment @@ -172,36 +135,4 @@ protected: private: }; -class LLSettingsEditPanel : public LLPanel -{ -public: - virtual void setSettings(const LLSettingsBase::ptr_t &) = 0; - - typedef boost::signals2::signal<void(LLPanel *, bool)> on_dirty_charged_sg; - typedef boost::signals2::connection connection_t; - - inline bool getIsDirty() const { return mIsDirty; } - inline void setIsDirty() { mIsDirty = true; if (!mOnDirtyChanged.empty()) mOnDirtyChanged(this, mIsDirty); } - inline void clearIsDirty() { mIsDirty = false; if (!mOnDirtyChanged.empty()) mOnDirtyChanged(this, mIsDirty); } - - inline bool getCanChangeSettings() const { return mCanEdit; } - inline void setCanChangeSettings(bool flag) { mCanEdit = flag; } - - inline connection_t setOnDirtyFlagChanged(on_dirty_charged_sg::slot_type cb) { return mOnDirtyChanged.connect(cb); } - - -protected: - LLSettingsEditPanel() : - LLPanel(), - mIsDirty(false), - mOnDirtyChanged() - {} - -private: - bool mIsDirty; - bool mCanEdit; - - on_dirty_charged_sg mOnDirtyChanged; -}; - #endif // LL_FLOATERFIXEDENVIRONMENT_H diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 21420b122b..540d2366a9 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -304,12 +304,15 @@ void LLFloaterIMContainer::addFloater(LLFloater* floaterp, LLIconCtrl* icon = 0; + bool is_in_group = gAgent.isInGroup(session_id, TRUE); + LLUUID icon_id; - if(gAgent.isInGroup(session_id, TRUE)) + if (is_in_group) { LLGroupIconCtrl::Params icon_params; icon_params.group_id = session_id; icon = LLUICtrlFactory::instance().create<LLGroupIconCtrl>(icon_params); + icon_id = session_id; mSessions[session_id] = floaterp; floaterp->mCloseSignal.connect(boost::bind(&LLFloaterIMContainer::onCloseFloater, this, session_id)); @@ -321,11 +324,18 @@ void LLFloaterIMContainer::addFloater(LLFloater* floaterp, LLAvatarIconCtrl::Params icon_params; icon_params.avatar_id = avatar_id; icon = LLUICtrlFactory::instance().create<LLAvatarIconCtrl>(icon_params); + icon_id = avatar_id; mSessions[session_id] = floaterp; floaterp->mCloseSignal.connect(boost::bind(&LLFloaterIMContainer::onCloseFloater, this, session_id)); } + LLFloaterIMSessionTab* floater = LLFloaterIMSessionTab::getConversation(session_id); + if (floater) + { + floater->updateChatIcon(icon_id); + } + // forced resize of the floater LLRect wrapper_rect = this->mTabContainer->getLocalRect(); floaterp->setRect(wrapper_rect); diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 3aee08482b..c75109db36 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -32,6 +32,8 @@ #include "llagent.h" #include "llagentcamera.h" #include "llavataractions.h" +#include "llavatariconctrl.h" +#include "llgroupiconctrl.h" #include "llchatentry.h" #include "llchathistory.h" #include "llchiclet.h" @@ -45,6 +47,9 @@ #include "llfloaterimnearbychat.h" const F32 REFRESH_INTERVAL = 1.0f; +const std::string ICN_GROUP("group_chat_icon"); +const std::string ICN_NEARBY("nearby_chat_icon"); +const std::string ICN_AVATAR("avatar_icon"); void cb_group_do_nothing() { @@ -693,6 +698,39 @@ void LLFloaterIMSessionTab::updateSessionName(const std::string& name) mInputEditor->setLabel(LLTrans::getString("IM_to_label") + " " + name); } +void LLFloaterIMSessionTab::updateChatIcon(const LLUUID& id) +{ + if (mSession) + { + if (mSession->isP2PSessionType()) + { + LLAvatarIconCtrl* icon = getChild<LLAvatarIconCtrl>(ICN_AVATAR); + icon->setVisible(true); + icon->setValue(id); + } + if (mSession->isAdHocSessionType()) + { + LLGroupIconCtrl* icon = getChild<LLGroupIconCtrl>(ICN_GROUP); + icon->setVisible(true); + } + if (mSession->isGroupSessionType()) + { + LLGroupIconCtrl* icon = getChild<LLGroupIconCtrl>(ICN_GROUP); + icon->setVisible(true); + icon->setValue(id); + } + } + else + { + if (mIsNearbyChat) + { + LLIconCtrl* icon = getChild<LLIconCtrl>(ICN_NEARBY); + icon->setVisible(true); + } + } + +} + void LLFloaterIMSessionTab::hideAllStandardButtons() { for (S32 i = 0; i < BUTTON_COUNT; i++) diff --git a/indra/newview/llfloaterimsessiontab.h b/indra/newview/llfloaterimsessiontab.h index 1b4922fd73..169eb1cf7f 100644 --- a/indra/newview/llfloaterimsessiontab.h +++ b/indra/newview/llfloaterimsessiontab.h @@ -103,6 +103,8 @@ public: void restoreFloater(); void saveCollapsedState(); + void updateChatIcon(const LLUUID& id); + LLView* getChatHistory(); protected: diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp index d2bd716f55..12d82d101f 100644 --- a/indra/newview/llgroupactions.cpp +++ b/indra/newview/llgroupactions.cpp @@ -39,6 +39,7 @@ #include "llfloaterimcontainer.h" #include "llimview.h" // for gIMMgr #include "llnotificationsutil.h" +#include "llstartup.h" #include "llstatusbar.h" // can_afford_transaction() #include "groupchatlistener.h" @@ -55,6 +56,11 @@ public: bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web) { + if (LLStartUp::getStartupState() < STATE_STARTED) + { + return true; + } + if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableGroupInfo")) { LLNotificationsUtil::add("NoGroupInfo", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit")); diff --git a/indra/newview/llimprocessing.cpp b/indra/newview/llimprocessing.cpp index e1b58dde51..ab98c5f50f 100644 --- a/indra/newview/llimprocessing.cpp +++ b/indra/newview/llimprocessing.cpp @@ -1616,6 +1616,10 @@ void LLIMProcessing::requestOfflineMessagesCoro(std::string url) { from_group = message_data["from_group"].asString() == "Y"; } + else + { + from_group = message_data["from_group"].asString() == "Y"; + } LLIMProcessing::processNewMessage( diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index d5142a4496..72162a1242 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -601,6 +601,10 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& } buildHistoryFileName(); + if (isP2P()) // user's account name can change, but filenames are account name based + { + LLConversationLog::getInstance()->verifyFilename(mSessionID, mHistoryFileName); + } loadHistory(); // Localizing name of ad-hoc session. STORM-153 diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index 0c64531783..abd7102aea 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -271,6 +271,28 @@ std::string LLLogChat::makeLogFileName(std::string filename) return filename; } +//static +void LLLogChat::renameLogFile(const std::string& old_filename, const std::string& new_filename) +{ + std::string new_name = cleanFileName(new_filename); + std::string old_name = cleanFileName(old_filename); + new_name = gDirUtilp->getExpandedFilename(LL_PATH_PER_ACCOUNT_CHAT_LOGS, new_name); + old_name = gDirUtilp->getExpandedFilename(LL_PATH_PER_ACCOUNT_CHAT_LOGS, old_name); + + if (new_name.empty() || old_name.empty()) + { + return; + } + + new_name += '.' + LL_TRANSCRIPT_FILE_EXTENSION; + old_name += '.' + LL_TRANSCRIPT_FILE_EXTENSION; + + if (!LLFile::isfile(new_name) && LLFile::isfile(old_name)) + { + LLFile::rename(old_name, new_name); + } +} + std::string LLLogChat::cleanFileName(std::string filename) { std::string invalidChars = "\"\'\\/?*:.<>|[]{}~"; // Cannot match glob or illegal filename chars diff --git a/indra/newview/lllogchat.h b/indra/newview/lllogchat.h index 8b7fe14e16..c4b61ee716 100644 --- a/indra/newview/lllogchat.h +++ b/indra/newview/lllogchat.h @@ -94,6 +94,7 @@ public: static std::string timestamp(bool withdate = false); static std::string makeLogFileName(std::string(filename)); + static void renameLogFile(const std::string& old_filename, const std::string& new_filename); /** *Add functions to get old and non date stamped file names when needed */ diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h index 52c5234137..ef4aced2c7 100644 --- a/indra/newview/llnotificationhandler.h +++ b/indra/newview/llnotificationhandler.h @@ -297,6 +297,7 @@ public: * Writes notification message to IM p2p session. */ static void logToIMP2P(const LLNotificationPtr& notification, bool to_file_only = false); + static void logToIMP2P(const LLUUID& from_id, const std::string& message, bool to_file_only = false); /** * Writes group notice notification message to IM group session. diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index 9a3f1a853a..39a0b9b50e 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -123,15 +123,13 @@ void log_name_callback(const LLAvatarName& av_name, const std::string& from_name } // static -void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification, bool to_file_only) +void LLHandlerUtil::logToIMP2P(const LLUUID& from_id, const std::string& message, bool to_file_only) { if (!gCacheName) { return; } - LLUUID from_id = notification->getPayload()["from_id"]; - if (from_id.isNull()) { // Normal behavior for system generated messages, don't spam. @@ -141,15 +139,22 @@ void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification, bool to_fi if(to_file_only) { - LLAvatarNameCache::get(from_id, boost::bind(&log_name_callback, _2, "", notification->getMessage(), LLUUID())); + LLAvatarNameCache::get(from_id, boost::bind(&log_name_callback, _2, "", message, LLUUID())); } else { - LLAvatarNameCache::get(from_id, boost::bind(&log_name_callback, _2, INTERACTIVE_SYSTEM_FROM, notification->getMessage(), from_id)); + LLAvatarNameCache::get(from_id, boost::bind(&log_name_callback, _2, INTERACTIVE_SYSTEM_FROM, message, from_id)); } } // static +void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification, bool to_file_only) +{ + LLUUID from_id = notification->getPayload()["from_id"]; + logToIMP2P(from_id, notification->getMessage(), to_file_only); +} + +// static void LLHandlerUtil::logGroupNoticeToIMGroup( const LLNotificationPtr& notification) { diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp index 14d25d8158..a9678b1e93 100644 --- a/indra/newview/llnotificationofferhandler.cpp +++ b/indra/newview/llnotificationofferhandler.cpp @@ -37,6 +37,8 @@ #include "llimview.h" #include "llnotificationsutil.h" +#include <boost/regex.hpp> + using namespace LLNotificationsUI; //-------------------------------------------------------------------------- @@ -143,7 +145,19 @@ bool LLOfferHandler::processNotification(const LLNotificationPtr& notification) { // log only to file if notif panel can be embedded to IM and IM is opened bool file_only = add_notif_to_im && LLHandlerUtil::isIMFloaterOpened(notification); - LLHandlerUtil::logToIMP2P(notification, file_only); + if ((notification->getName() == "TeleportOffered" + || notification->getName() == "TeleportOffered_MaturityExceeded" + || notification->getName() == "TeleportOffered_MaturityBlocked")) + { + boost::regex r("<icon\\s*>\\s*([^<]*)?\\s*</icon\\s*>( - )?", + boost::regex::perl|boost::regex::icase); + std::string stripped_msg = boost::regex_replace(notification->getMessage(), r, ""); + LLHandlerUtil::logToIMP2P(notification->getPayload()["from_id"], stripped_msg,file_only); + } + else + { + LLHandlerUtil::logToIMP2P(notification, file_only); + } } } diff --git a/indra/newview/llpaneleditsky.h b/indra/newview/llpaneleditsky.h index c02c9c95a0..801fb8b9b2 100644 --- a/indra/newview/llpaneleditsky.h +++ b/indra/newview/llpaneleditsky.h @@ -29,7 +29,7 @@ #include "llpanel.h" #include "llsettingssky.h" -#include "llfloaterfixedenvironment.h" +#include "llfloatereditenvironmentbase.h" //========================================================================= class LLSlider; diff --git a/indra/newview/llpaneleditwater.h b/indra/newview/llpaneleditwater.h index ab2dc47bcc..4b7ec903c9 100644 --- a/indra/newview/llpaneleditwater.h +++ b/indra/newview/llpaneleditwater.h @@ -30,7 +30,7 @@ #include "llpanel.h" #include "llsettingswater.h" -#include "llfloaterfixedenvironment.h" +#include "llfloatereditenvironmentbase.h" //========================================================================= class LLSlider; diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index da21d5e69a..ded274acdc 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -545,6 +545,16 @@ void LLPanelLogin::show(const LLRect &rect, } //static +void LLPanelLogin::reshapePanel() +{ + if (sInstance) + { + LLRect rect = sInstance->getRect(); + sInstance->reshape(rect.getWidth(), rect.getHeight()); + } +} + +//static void LLPanelLogin::populateFields(LLPointer<LLCredential> credential, bool remember_user, bool remember_psswrd) { if (!sInstance) diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h index c9b8e1b6fc..788c269ffd 100644 --- a/indra/newview/llpanellogin.h +++ b/indra/newview/llpanellogin.h @@ -54,6 +54,7 @@ public: static void show(const LLRect &rect, void (*callback)(S32 option, void* user_data), void* callback_data); + static void reshapePanel(); static void populateFields(LLPointer<LLCredential> credential, bool remember_user, bool remember_psswrd); static void resetFields(); diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp index c39df3fe8b..4762e15d8f 100644 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -37,6 +37,7 @@ #include "llfloatersidepanelcontainer.h" #include "llfloaterworldmap.h" #include "llnotificationsutil.h" +#include "llstartup.h" #include "lltexturectrl.h" #include "lltoggleablemenu.h" #include "lltrans.h" @@ -84,6 +85,11 @@ public: bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) { + if (LLStartUp::getStartupState() < STATE_STARTED) + { + return true; + } + if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnablePicks")) { LLNotificationsUtil::add("NoPicks", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit")); @@ -198,6 +204,11 @@ public: bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) { + if (LLStartUp::getStartupState() < STATE_STARTED) + { + return true; + } + if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableClassifieds")) { LLNotificationsUtil::add("NoClassifieds", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit")); diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index 55c84815aa..6bb213c0ef 100644 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -73,6 +73,8 @@ bool get_hud_matrices(glh::matrix4f &proj, glh::matrix4f &model); const LLPanelPrimMediaControls::EZoomLevel LLPanelPrimMediaControls::kZoomLevels[] = { ZOOM_NONE, ZOOM_MEDIUM }; const int LLPanelPrimMediaControls::kNumZoomLevels = 2; +const S32 ADDR_LEFT_PAD = 3; + // // LLPanelPrimMediaControls // @@ -154,7 +156,7 @@ BOOL LLPanelPrimMediaControls::postBuild() mMediaProgressPanel = getChild<LLPanel>("media_progress_indicator"); mMediaProgressBar = getChild<LLProgressBar>("media_progress_bar"); mMediaAddressCtrl = getChild<LLUICtrl>("media_address"); - mMediaAddress = getChild<LLUICtrl>("media_address_url"); + mMediaAddress = getChild<LLLineEditor>("media_address_url"); mMediaPlaySliderPanel = getChild<LLUICtrl>("media_play_position"); mMediaPlaySliderCtrl = getChild<LLUICtrl>("media_play_slider"); mSkipFwdCtrl = getChild<LLUICtrl>("skip_forward"); @@ -498,8 +500,10 @@ void LLPanelPrimMediaControls::updateShape() std::string test_prefix = mCurrentURL.substr(0, prefix.length()); LLStringUtil::toLower(test_prefix); mSecureURL = has_focus && (test_prefix == prefix); - mCurrentURL = (mSecureURL ? " " + mCurrentURL : mCurrentURL); - + + S32 left_pad = mSecureURL ? mSecureLockIcon->getRect().getWidth() : ADDR_LEFT_PAD; + mMediaAddress->setTextPadding(left_pad, 0); + if(mCurrentURL!=mPreviousURL) { setCurrentURL(); diff --git a/indra/newview/llpanelprimmediacontrols.h b/indra/newview/llpanelprimmediacontrols.h index d4301aaf7c..a8d0e31cf2 100644 --- a/indra/newview/llpanelprimmediacontrols.h +++ b/indra/newview/llpanelprimmediacontrols.h @@ -39,6 +39,7 @@ class LLProgressBar; class LLSliderCtrl; class LLViewerMediaImpl; class LLWindowShade; +class LLLineEditor; class LLPanelPrimMediaControls : public LLPanel { @@ -162,7 +163,7 @@ private: LLPanel *mMediaProgressPanel; LLProgressBar *mMediaProgressBar; LLUICtrl *mMediaAddressCtrl; - LLUICtrl *mMediaAddress; + LLLineEditor *mMediaAddress; LLUICtrl *mMediaPlaySliderPanel; LLUICtrl *mMediaPlaySliderCtrl; LLUICtrl *mVolumeCtrl; diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 7a68d1e270..9a79ab2fd1 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -736,7 +736,10 @@ void LLScriptEdCore::updateDynamicHelp(BOOL immediate) } if (immediate || (mLiveHelpTimer.getStarted() && mLiveHelpTimer.getElapsedTimeF32() > LIVE_HELP_REFRESH_TIME)) { - std::string help_string = mEditor->getText().substr(segment->getStart(), segment->getEnd() - segment->getStart()); + // Use Wtext since segment's start/end are made for wstring and will + // result in a shift for case of multi-byte symbols inside std::string. + LLWString segment_text = mEditor->getWText().substr(segment->getStart(), segment->getEnd() - segment->getStart()); + std::string help_string = wstring_to_utf8str(segment_text); setHelpPage(help_string); mLiveHelpTimer.stop(); } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index b6c7be2ed3..0b44e50dd6 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -5353,7 +5353,7 @@ class LLToolsSelectNextPartFace : public view_listener_t new_te = to_select->getNumTEs() - 1; } } - LLSelectMgr::getInstance()->addAsIndividual(to_select, new_te, FALSE); + LLSelectMgr::getInstance()->selectObjectOnly(to_select, new_te); } else { diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 0cc1e0df06..8fdb5416a9 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2407,6 +2407,11 @@ void LLViewerWindow::reshape(S32 width, S32 height) // round up when converting coordinates to make sure there are no gaps at edge of window LLView::sForceReshape = display_scale_changed; mRootView->reshape(llceil((F32)width / mDisplayScale.mV[VX]), llceil((F32)height / mDisplayScale.mV[VY])); + if (display_scale_changed) + { + // Needs only a 'scale change' update, everything else gets handled by LLLayoutStack::updateClass() + LLPanelLogin::reshapePanel(); + } LLView::sForceReshape = FALSE; // clear font width caches diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp index 8e46ccd555..41099cb570 100644 --- a/indra/newview/llvotree.cpp +++ b/indra/newview/llvotree.cpp @@ -45,6 +45,8 @@ #include "llviewertexturelist.h" #include "llviewerobjectlist.h" #include "llviewerregion.h" +#include "llvolumemgr.h" +#include "llvovolume.h" #include "llworld.h" #include "noise.h" #include "pipeline.h" @@ -85,6 +87,9 @@ LLVOTree::LLVOTree(const LLUUID &id, const LLPCode pcode, LLViewerRegion *region mFrameCount = 0; mWind = mRegionp->mWind.getVelocity(getPositionRegion()); mTrunkLOD = 0; + + // if assert triggers, idleUpdate() needs to be revised and adjusted to new LOD levels + llassert(sMAX_NUM_TREE_LOD_LEVELS == LLVolumeLODGroup::NUM_LODS); } @@ -347,8 +352,11 @@ void LLVOTree::idleUpdate(LLAgent &agent, const F64 &time) return; } - S32 trunk_LOD = sMAX_NUM_TREE_LOD_LEVELS ; + S32 trunk_LOD = sMAX_NUM_TREE_LOD_LEVELS ; // disabled F32 app_angle = getAppAngle()*LLVOTree::sTreeFactor; + F32 distance = mDrawable->mDistanceWRTCamera * LLVOVolume::sDistanceFactor * (F_PI / 3.f); + F32 diameter = getScale().length(); // trees have very broken scale, but length rougtly outlines proper diameter + F32 sz = mBillboardScale * mBillboardRatio * diameter; for (S32 j = 0; j < sMAX_NUM_TREE_LOD_LEVELS; j++) { @@ -357,7 +365,14 @@ void LLVOTree::idleUpdate(LLAgent &agent, const F64 &time) trunk_LOD = j; break; } - } + } + + F32 tan_angle = (LLVOTree::sTreeFactor * 64 * sz) / distance; + S32 cur_detail = LLVolumeLODGroup::getDetailFromTan(ll_round(tan_angle, 0.01f)); // larger value, better quality + + // for trunk_LOD lower value means better quality, but both trunk_LOD and cur_detail have 4 levels + trunk_LOD = llmax(trunk_LOD, LLVolumeLODGroup::NUM_LODS - cur_detail - 1); + trunk_LOD = llmin(trunk_LOD, sMAX_NUM_TREE_LOD_LEVELS); if (mReferenceBuffer.isNull()) { @@ -408,8 +423,9 @@ void LLVOTree::setPixelAreaAndAngle(LLAgent &agent) LLVector3 lookAt = center - viewer_pos_agent; F32 dist = lookAt.normVec() ; F32 cos_angle_to_view_dir = lookAt * LLViewerCamera::getInstance()->getXAxis() ; - - F32 range = dist - getMinScale()/2; + F32 radius = getScale().length()*0.5f; + F32 range = dist - radius; + if (range < F_ALMOST_ZERO || isHUDAttachment()) // range == zero { mAppAngle = 180.f; diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml index e0da7f5d9e..601d5621a9 100644 --- a/indra/newview/skins/default/colors.xml +++ b/indra/newview/skins/default/colors.xml @@ -334,6 +334,9 @@ name="ContextSilhouetteColor" reference="EmphasisColor" /> <color + name="ConversationFriendColor" + value="0.42 0.85 0.71 1" /> + <color name="DefaultHighlightDark" reference="White_10" /> <color diff --git a/indra/newview/skins/default/textures/icons/nearby_chat_icon.png b/indra/newview/skins/default/textures/icons/nearby_chat_icon.png Binary files differindex 5ac4258b9d..2cb577776d 100644 --- a/indra/newview/skins/default/textures/icons/nearby_chat_icon.png +++ b/indra/newview/skins/default/textures/icons/nearby_chat_icon.png diff --git a/indra/newview/skins/default/xui/en/floater_buy_object.xml b/indra/newview/skins/default/xui/en/floater_buy_object.xml index 49be4290c7..1f7d52dbf5 100644 --- a/indra/newview/skins/default/xui/en/floater_buy_object.xml +++ b/indra/newview/skins/default/xui/en/floater_buy_object.xml @@ -32,6 +32,10 @@ name="no_transfer_text"> (no transfer) </floater.string> + <floater.string + name="mupliple_selected"> + Mupliple selection + </floater.string> <scroll_list background_visible="true" draw_border="false" diff --git a/indra/newview/skins/default/xui/en/floater_im_session.xml b/indra/newview/skins/default/xui/en/floater_im_session.xml index c64ee5565a..15f02ab9c3 100644 --- a/indra/newview/skins/default/xui/en/floater_im_session.xml +++ b/indra/newview/skins/default/xui/en/floater_im_session.xml @@ -267,6 +267,36 @@ right="-1"> <layout_panel name="input_editor_layout_panel"> + <avatar_icon + follows="left|bottom" + name="avatar_icon" + height="20" + default_icon_name="Generic_Person" + layout="topleft" + left="3" + bottom="-9" + visible="false" + width="20" /> + <group_icon + follows="left|bottom" + name="group_chat_icon" + height="20" + default_icon_name="Generic_Group" + layout="topleft" + left="3" + bottom="-9" + visible="false" + width="20" /> + <icon + follows="left|bottom" + height="20" + image_name="Nearby_chat_icon" + layout="topleft" + left="3" + bottom="-9" + name="nearby_chat_icon" + visible="false" + width="20"/> <chat_editor layout="topleft" expand_lines_count="5" @@ -280,7 +310,7 @@ spellcheck="true" tab_group="3" bottom="-8" - left="5" + left_pad="5" right="-5" wrap="true" /> </layout_panel> diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 1bfac6aeb7..29eb733d41 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -3691,10 +3691,10 @@ If you continue to receive this message, contact the [SUPPORT_SITE]. Also there are some other places where "generic" is used. So, let add string with name="generic" with the same value as "generic_request_error" --> <string name="generic"> - Error making request, please try again later. + Please close and reopen the conversation, or relog and try again. </string> <string name="generic_request_error"> - Error making request, please try again later. + Please close and reopen the conversation, or relog and try again. </string> <string name="insufficient_perms_error"> You do not have sufficient permissions. |