diff options
Diffstat (limited to 'indra')
42 files changed, 721 insertions, 760 deletions
diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp index 9045324bf2..ed94ef21ef 100644 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp @@ -293,7 +293,7 @@ int LLFile::rename(const std::string& filename, const std::string& newname, int return warnif(STRINGIZE("rename to '" << newname << "' from"), filename, rc, supress_error); } -bool LLFile::copy(const std::string from, const std::string to) +bool LLFile::copy(const std::string& from, const std::string& to) { bool copied = false; LLFILE* in = LLFile::fopen(from, "rb"); /* Flawfinder: ignore */ @@ -424,7 +424,7 @@ LLFILE * LLFile::_Fiopen(const std::string& filename, if (valid[n] == 0) return (0); // no valid mode - else if (norepflag && mode & (ios_base::out || ios_base::app) + else if (norepflag && mode & (ios_base::out | ios_base::app) && (fp = LLFile::fopen(filename, "r")) != 0) /* Flawfinder: ignore */ { // file must not exist, close and fail fclose(fp); diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h index 74110343fc..1661cbeb55 100644 --- a/indra/llcommon/llfile.h +++ b/indra/llcommon/llfile.h @@ -77,7 +77,7 @@ public: static int rmdir(const std::string& filename); static int remove(const std::string& filename, int supress_error = 0); static int rename(const std::string& filename,const std::string& newname, int supress_error = 0); - static bool copy(const std::string from, const std::string to); + static bool copy(const std::string& from, const std::string& to); static int stat(const std::string& filename,llstat* file_status); static bool isdir(const std::string& filename); @@ -160,7 +160,7 @@ private: * Does The Right Thing when passed a non-ASCII pathname. Sadly, that isn't * true of Microsoft's std::ifstream. */ -class LL_COMMON_API llifstream : public std::ifstream +class LL_COMMON_API llifstream : public std::ifstream { // input stream associated with a C stream public: @@ -205,7 +205,7 @@ class LL_COMMON_API llifstream : public std::ifstream * Right Thing when passed a non-ASCII pathname. Sadly, that isn't true of * Microsoft's std::ofstream. */ -class LL_COMMON_API llofstream : public std::ofstream +class LL_COMMON_API llofstream : public std::ofstream { public: // Constructors: @@ -241,7 +241,7 @@ class LL_COMMON_API llofstream : public std::ofstream /** - * @breif filesize helpers. + * @brief filesize helpers. * * The file size helpers are not considered particularly efficient, * and should only be used for config files and the like -- not in a diff --git a/indra/llfilesystem/lldiskcache.cpp b/indra/llfilesystem/lldiskcache.cpp index e780387f4e..49904911a9 100644 --- a/indra/llfilesystem/lldiskcache.cpp +++ b/indra/llfilesystem/lldiskcache.cpp @@ -51,7 +51,7 @@ static const std::string CACHE_FILENAME_PREFIX("sl_cache"); std::string LLDiskCache::sCacheDir; -LLDiskCache::LLDiskCache(const std::string cache_dir, +LLDiskCache::LLDiskCache(const std::string& cache_dir, const uintmax_t max_size_bytes, const bool enable_cache_debug_info) : mMaxSizeBytes(max_size_bytes), @@ -196,59 +196,9 @@ void LLDiskCache::purge() } } -const std::string LLDiskCache::assetTypeToString(LLAssetType::EType at) +const std::string LLDiskCache::metaDataToFilepath(const LLUUID& id, LLAssetType::EType at) { - /** - * Make use of the handy C++17 feature that allows - * for inline initialization of an std::map<> - */ - typedef std::map<LLAssetType::EType, std::string> asset_type_to_name_t; - asset_type_to_name_t asset_type_to_name = - { - { LLAssetType::AT_TEXTURE, "TEXTURE" }, - { LLAssetType::AT_SOUND, "SOUND" }, - { LLAssetType::AT_CALLINGCARD, "CALLINGCARD" }, - { LLAssetType::AT_LANDMARK, "LANDMARK" }, - { LLAssetType::AT_SCRIPT, "SCRIPT" }, - { LLAssetType::AT_CLOTHING, "CLOTHING" }, - { LLAssetType::AT_OBJECT, "OBJECT" }, - { LLAssetType::AT_NOTECARD, "NOTECARD" }, - { LLAssetType::AT_CATEGORY, "CATEGORY" }, - { LLAssetType::AT_LSL_TEXT, "LSL_TEXT" }, - { LLAssetType::AT_LSL_BYTECODE, "LSL_BYTECODE" }, - { LLAssetType::AT_TEXTURE_TGA, "TEXTURE_TGA" }, - { LLAssetType::AT_BODYPART, "BODYPART" }, - { LLAssetType::AT_SOUND_WAV, "SOUND_WAV" }, - { LLAssetType::AT_IMAGE_TGA, "IMAGE_TGA" }, - { LLAssetType::AT_IMAGE_JPEG, "IMAGE_JPEG" }, - { LLAssetType::AT_ANIMATION, "ANIMATION" }, - { LLAssetType::AT_GESTURE, "GESTURE" }, - { LLAssetType::AT_SIMSTATE, "SIMSTATE" }, - { LLAssetType::AT_LINK, "LINK" }, - { LLAssetType::AT_LINK_FOLDER, "LINK_FOLDER" }, - { LLAssetType::AT_MARKETPLACE_FOLDER, "MARKETPLACE_FOLDER" }, - { LLAssetType::AT_WIDGET, "WIDGET" }, - { LLAssetType::AT_PERSON, "PERSON" }, - { LLAssetType::AT_MESH, "MESH" }, - { LLAssetType::AT_SETTINGS, "SETTINGS" }, - { LLAssetType::AT_MATERIAL, "MATERIAL" }, - { LLAssetType::AT_GLTF, "GLTF" }, - { LLAssetType::AT_GLTF_BIN, "GLTF_BIN" }, - { LLAssetType::AT_UNKNOWN, "UNKNOWN" } - }; - - asset_type_to_name_t::iterator iter = asset_type_to_name.find(at); - if (iter != asset_type_to_name.end()) - { - return iter->second; - } - - return std::string("UNKNOWN"); -} - -const std::string LLDiskCache::metaDataToFilepath(const std::string& id, LLAssetType::EType at) -{ - return llformat("%s%s%s_%s_0.asset", sCacheDir.c_str(), gDirUtilp->getDirDelimiter().c_str(), CACHE_FILENAME_PREFIX.c_str(), id.c_str()); + return llformat("%s%s%s_%s_0.asset", sCacheDir.c_str(), gDirUtilp->getDirDelimiter().c_str(), CACHE_FILENAME_PREFIX.c_str(), id.asString().c_str()); } const std::string LLDiskCache::getCacheInfo() @@ -335,7 +285,7 @@ void LLDiskCache::removeOldVFSFiles() } } -uintmax_t LLDiskCache::dirFileSize(const std::string dir) +uintmax_t LLDiskCache::dirFileSize(const std::string& dir) { uintmax_t total_file_size = 0; diff --git a/indra/llfilesystem/lldiskcache.h b/indra/llfilesystem/lldiskcache.h index 62c19361fb..f07b26c2d7 100644 --- a/indra/llfilesystem/lldiskcache.h +++ b/indra/llfilesystem/lldiskcache.h @@ -81,7 +81,7 @@ class LLDiskCache : * a child of the main Viewer cache directory. Defined * by the setting at 'DiskCacheDirName' */ - const std::string cache_dir, + const std::string& cache_dir, /** * The maximum size of the cache in bytes - Based on the * setting at 'CacheSize' and 'DiskCachePercentOfTotal' @@ -104,9 +104,7 @@ class LLDiskCache : * so many things had to be pushed back there to accomodate it, that I * decided to move it here. Still not sure that's completely right. */ - static const std::string metaDataToFilepath(const std::string& id, - LLAssetType::EType at); - + static const std::string metaDataToFilepath(const LLUUID& id, LLAssetType::EType at); /** * Purge the oldest items in the cache so that the combined size of all files @@ -141,13 +139,7 @@ class LLDiskCache : * directory. Primarily used here to determine the directory size * before and after the cache purge */ - uintmax_t dirFileSize(const std::string dir); - - /** - * Utility function to convert an LLAssetType enum into a - * string that we use as part of the cache file filename - */ - const std::string assetTypeToString(LLAssetType::EType at); + uintmax_t dirFileSize(const std::string& dir); private: /** diff --git a/indra/llfilesystem/llfilesystem.cpp b/indra/llfilesystem/llfilesystem.cpp index b206aab7cf..c8ce9531c2 100644 --- a/indra/llfilesystem/llfilesystem.cpp +++ b/indra/llfilesystem/llfilesystem.cpp @@ -36,10 +36,10 @@ #include "boost/filesystem.hpp" -const S32 LLFileSystem::READ = 0x00000001; -const S32 LLFileSystem::WRITE = 0x00000002; -const S32 LLFileSystem::READ_WRITE = 0x00000003; // LLFileSystem::READ & LLFileSystem::WRITE -const S32 LLFileSystem::APPEND = 0x00000006; // 0x00000004 & LLFileSystem::WRITE +constexpr S32 LLFileSystem::READ = 0x00000001; +constexpr S32 LLFileSystem::WRITE = 0x00000002; +constexpr S32 LLFileSystem::READ_WRITE = 0x00000003; // LLFileSystem::READ & LLFileSystem::WRITE +constexpr S32 LLFileSystem::APPEND = 0x00000006; // 0x00000004 & LLFileSystem::WRITE static LLTrace::BlockTimerStatHandle FTM_VFILE_WAIT("VFile Wait"); @@ -57,9 +57,7 @@ LLFileSystem::LLFileSystem(const LLUUID& file_id, const LLAssetType::EType file_ if (mode == LLFileSystem::READ) { // build the filename (TODO: we do this in a few places - perhaps we should factor into a single function) - std::string id; - mFileID.asString(); - const std::string filename = LLDiskCache::metaDataToFilepath(id, mFileType); + const std::string filename = LLDiskCache::metaDataToFilepath(mFileID, mFileType); // update the last access time for the file if it exists - this is required // even though we are reading and not writing because this is the @@ -73,17 +71,11 @@ LLFileSystem::LLFileSystem(const LLUUID& file_id, const LLAssetType::EType file_ } } -LLFileSystem::~LLFileSystem() -{ -} - // static bool LLFileSystem::getExists(const LLUUID& file_id, const LLAssetType::EType file_type) { LL_PROFILE_ZONE_SCOPED; - std::string id_str; - file_id.toString(id_str); - const std::string filename = LLDiskCache::metaDataToFilepath(id_str, file_type); + const std::string filename = LLDiskCache::metaDataToFilepath(file_id, file_type); llifstream file(filename, std::ios::binary); if (file.is_open()) @@ -97,9 +89,7 @@ bool LLFileSystem::getExists(const LLUUID& file_id, const LLAssetType::EType fil // static bool LLFileSystem::removeFile(const LLUUID& file_id, const LLAssetType::EType file_type, int suppress_error /*= 0*/) { - std::string id_str; - file_id.toString(id_str); - const std::string filename = LLDiskCache::metaDataToFilepath(id_str, file_type); + const std::string filename = LLDiskCache::metaDataToFilepath(file_id, file_type); LLFile::remove(filename.c_str(), suppress_error); @@ -110,13 +100,8 @@ bool LLFileSystem::removeFile(const LLUUID& file_id, const LLAssetType::EType fi bool LLFileSystem::renameFile(const LLUUID& old_file_id, const LLAssetType::EType old_file_type, const LLUUID& new_file_id, const LLAssetType::EType new_file_type) { - std::string old_id_str; - old_file_id.toString(old_id_str); - const std::string old_filename = LLDiskCache::metaDataToFilepath(old_id_str, old_file_type); - - std::string new_id_str; - new_file_id.toString(new_id_str); - const std::string new_filename = LLDiskCache::metaDataToFilepath(new_id_str, new_file_type); + const std::string old_filename = LLDiskCache::metaDataToFilepath(old_file_id, old_file_type); + const std::string new_filename = LLDiskCache::metaDataToFilepath(new_file_id, new_file_type); // Rename needs the new file to not exist. LLFileSystem::removeFile(new_file_id, new_file_type, ENOENT); @@ -127,7 +112,7 @@ bool LLFileSystem::renameFile(const LLUUID& old_file_id, const LLAssetType::ETyp // failed but the original code does not and doing so seems to // break a lot of things so we go with the flow... //return false; - LL_WARNS() << "Failed to rename " << old_file_id << " to " << new_id_str << " reason: " << strerror(errno) << LL_ENDL; + LL_WARNS() << "Failed to rename " << old_file_id << " to " << new_file_id << " reason: " << strerror(errno) << LL_ENDL; } return true; @@ -136,9 +121,7 @@ bool LLFileSystem::renameFile(const LLUUID& old_file_id, const LLAssetType::ETyp // static S32 LLFileSystem::getFileSize(const LLUUID& file_id, const LLAssetType::EType file_type) { - std::string id_str; - file_id.toString(id_str); - const std::string filename = LLDiskCache::metaDataToFilepath(id_str, file_type); + const std::string filename = LLDiskCache::metaDataToFilepath(file_id, file_type); S32 file_size = 0; llifstream file(filename, std::ios::binary); @@ -155,9 +138,7 @@ bool LLFileSystem::read(U8* buffer, S32 bytes) { bool success = false; - std::string id; - mFileID.toString(id); - const std::string filename = LLDiskCache::metaDataToFilepath(id, mFileType); + const std::string filename = LLDiskCache::metaDataToFilepath(mFileID, mFileType); llifstream file(filename, std::ios::binary); if (file.is_open()) @@ -187,21 +168,19 @@ bool LLFileSystem::read(U8* buffer, S32 bytes) return success; } -S32 LLFileSystem::getLastBytesRead() +S32 LLFileSystem::getLastBytesRead() const { return mBytesRead; } -bool LLFileSystem::eof() +bool LLFileSystem::eof() const { return mPosition >= getSize(); } bool LLFileSystem::write(const U8* buffer, S32 bytes) { - std::string id_str; - mFileID.toString(id_str); - const std::string filename = LLDiskCache::metaDataToFilepath(id_str, mFileType); + const std::string filename = LLDiskCache::metaDataToFilepath(mFileID, mFileType); bool success = false; @@ -212,12 +191,11 @@ bool LLFileSystem::write(const U8* buffer, S32 bytes) { ofs.write((const char*)buffer, bytes); - mPosition = (S32)ofs.tellp(); // <FS:Ansariel> Fix asset caching + mPosition = (S32)ofs.tellp(); success = true; } } - // <FS:Ansariel> Fix asset caching else if (mMode == READ_WRITE) { // Don't truncate if file already exists @@ -241,7 +219,6 @@ bool LLFileSystem::write(const U8* buffer, S32 bytes) } } } - // </FS:Ansariel> else { llofstream ofs(filename, std::ios::binary); @@ -293,12 +270,12 @@ S32 LLFileSystem::tell() const return mPosition; } -S32 LLFileSystem::getSize() +S32 LLFileSystem::getSize() const { return LLFileSystem::getFileSize(mFileID, mFileType); } -S32 LLFileSystem::getMaxSize() +S32 LLFileSystem::getMaxSize() const { // offer up a huge size since we don't care what the max is return INT_MAX; @@ -314,10 +291,9 @@ bool LLFileSystem::rename(const LLUUID& new_id, const LLAssetType::EType new_typ return true; } -bool LLFileSystem::remove() +bool LLFileSystem::remove() const { LLFileSystem::removeFile(mFileID, mFileType); - return true; } @@ -332,7 +308,7 @@ void LLFileSystem::updateFileAccessTime(const std::string& file_path) * * Let's start with 1 hour in time_t units and see how that unfolds */ - const std::time_t time_threshold = 1 * 60 * 60; + constexpr std::time_t time_threshold = 1 * 60 * 60; // current time const std::time_t cur_time = std::time(nullptr); diff --git a/indra/llfilesystem/llfilesystem.h b/indra/llfilesystem/llfilesystem.h index 983e452981..10649b6920 100644 --- a/indra/llfilesystem/llfilesystem.h +++ b/indra/llfilesystem/llfilesystem.h @@ -38,20 +38,20 @@ class LLFileSystem { public: LLFileSystem(const LLUUID& file_id, const LLAssetType::EType file_type, S32 mode = LLFileSystem::READ); - ~LLFileSystem(); + ~LLFileSystem() = default; bool read(U8* buffer, S32 bytes); - S32 getLastBytesRead(); - bool eof(); + S32 getLastBytesRead() const; + bool eof() const; bool write(const U8* buffer, S32 bytes); bool seek(S32 offset, S32 origin = -1); S32 tell() const; - S32 getSize(); - S32 getMaxSize(); + S32 getSize() const; + S32 getMaxSize() const; bool rename(const LLUUID& new_id, const LLAssetType::EType new_type); - bool remove(); + bool remove() const; /** * Update the "last write time" of a file to "now". This must be called whenever a @@ -78,8 +78,6 @@ class LLFileSystem S32 mPosition; S32 mMode; S32 mBytesRead; -//private: -// static const std::string idToFilepath(const std::string id, LLAssetType::EType at); }; #endif // LL_FILESYSTEM_H diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp index 06f7a20add..495ba2f40f 100644 --- a/indra/llui/llaccordionctrl.cpp +++ b/indra/llui/llaccordionctrl.cpp @@ -36,12 +36,12 @@ #include "boost/bind.hpp" -static const S32 BORDER_MARGIN = 2; -static const S32 PARENT_BORDER_MARGIN = 5; -static const S32 VERTICAL_MULTIPLE = 16; -static const F32 MIN_AUTO_SCROLL_RATE = 120.f; -static const F32 MAX_AUTO_SCROLL_RATE = 500.f; -static const F32 AUTO_SCROLL_RATE_ACCEL = 120.f; +static constexpr S32 BORDER_MARGIN = 2; +static constexpr S32 PARENT_BORDER_MARGIN = 5; +static constexpr S32 VERTICAL_MULTIPLE = 16; +static constexpr F32 MIN_AUTO_SCROLL_RATE = 120.f; +static constexpr F32 MAX_AUTO_SCROLL_RATE = 500.f; +static constexpr F32 AUTO_SCROLL_RATE_ACCEL = 120.f; // LLAccordionCtrl =================================================================| @@ -49,13 +49,7 @@ static LLDefaultChildRegistry::Register<LLAccordionCtrl> t2("accordion"); LLAccordionCtrl::LLAccordionCtrl(const Params& params):LLPanel(params) , mFitParent(params.fit_parent) - , mAutoScrolling( false ) - , mAutoScrollRate( 0.f ) - , mSelectedTab( NULL ) - , mTabComparator( NULL ) - , mNoVisibleTabsHelpText(NULL) , mNoVisibleTabsOrigString(params.no_visible_tabs_text.initial_value().asString()) - , mSkipScrollToChild(false) { initNoTabsWidget(params.no_matched_tabs_text); @@ -67,10 +61,6 @@ LLAccordionCtrl::LLAccordionCtrl(const Params& params):LLPanel(params) } LLAccordionCtrl::LLAccordionCtrl() : LLPanel() - , mAutoScrolling( false ) - , mAutoScrollRate( 0.f ) - , mSelectedTab( NULL ) - , mNoVisibleTabsHelpText(NULL) { initNoTabsWidget(LLTextBox::Params()); @@ -133,11 +123,10 @@ bool LLAccordionCtrl::postBuild() mScrollbar->setFollowsBottom(); //if it was created from xml... - std::vector<LLUICtrl*> accordion_tabs; - for (child_list_const_iter_t it = getChildList()->begin(); - getChildList()->end() != it; ++it) + std::vector<LLAccordionCtrlTab*> accordion_tabs; + for(LLView* viewp : *getChildList()) { - LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(*it); + LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(viewp); if (accordion_tab == NULL) continue; if (std::find(mAccordionTabs.begin(), mAccordionTabs.end(), accordion_tab) == mAccordionTabs.end()) @@ -146,7 +135,7 @@ bool LLAccordionCtrl::postBuild() } } - for (std::vector<LLUICtrl*>::reverse_iterator it = accordion_tabs.rbegin(); + for (auto it = accordion_tabs.rbegin(); it < accordion_tabs.rend(); ++it) { addCollapsibleCtrl(*it); @@ -294,11 +283,8 @@ void LLAccordionCtrl::hideScrollbar(S32 width, S32 height) S32 LLAccordionCtrl::calcRecuiredHeight() { S32 rec_height = 0; - - std::vector<LLAccordionCtrlTab*>::iterator panel; - for(panel=mAccordionTabs.begin(); panel!=mAccordionTabs.end(); ++panel) + for(LLAccordionCtrlTab* accordion_tab : mAccordionTabs) { - LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(*panel); if(accordion_tab && accordion_tab->getVisible()) { rec_height += accordion_tab->getRect().getHeight(); @@ -330,9 +316,8 @@ void LLAccordionCtrl::ctrlShiftVertical(LLView* panel, S32 delta) //--------------------------------------------------------------------------------- -void LLAccordionCtrl::addCollapsibleCtrl(LLView* view) +void LLAccordionCtrl::addCollapsibleCtrl(LLAccordionCtrlTab* accordion_tab) { - LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(view); if (!accordion_tab) return; if (std::find(beginChild(), endChild(), accordion_tab) == endChild()) @@ -343,9 +328,8 @@ void LLAccordionCtrl::addCollapsibleCtrl(LLView* view) arrange(); } -void LLAccordionCtrl::removeCollapsibleCtrl(LLView* view) +void LLAccordionCtrl::removeCollapsibleCtrl(LLAccordionCtrlTab* accordion_tab) { - LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(view); if(!accordion_tab) return; @@ -363,7 +347,7 @@ void LLAccordionCtrl::removeCollapsibleCtrl(LLView* view) } // if removed is selected - reset selection - if (mSelectedTab == view) + if (mSelectedTab == accordion_tab) { mSelectedTab = NULL; } @@ -401,24 +385,20 @@ void LLAccordionCtrl::arrangeSingle() S32 collapsed_height = 0; - for (size_t i = 0; i < mAccordionTabs.size(); ++i) + for (LLAccordionCtrlTab* accordion_tab : mAccordionTabs) { - LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); - if (!accordion_tab->getVisible()) // Skip hidden accordion tabs continue; if (!accordion_tab->isExpanded() ) { - collapsed_height+=mAccordionTabs[i]->getRect().getHeight(); + collapsed_height += accordion_tab->getRect().getHeight(); } } S32 expanded_height = getRect().getHeight() - BORDER_MARGIN - collapsed_height; - for (size_t i = 0; i < mAccordionTabs.size(); ++i) + for (LLAccordionCtrlTab* accordion_tab : mAccordionTabs) { - LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); - if (!accordion_tab->getVisible()) // Skip hidden accordion tabs continue; if (!accordion_tab->isExpanded() ) @@ -448,8 +428,8 @@ void LLAccordionCtrl::arrangeSingle() // make sure at least header is shown panel_height = llmax(panel_height, accordion_tab->getHeaderHeight()); - ctrlSetLeftTopAndSize(mAccordionTabs[i], panel_left, panel_top, panel_width, panel_height); - panel_top -= mAccordionTabs[i]->getRect().getHeight(); + ctrlSetLeftTopAndSize(accordion_tab, panel_left, panel_top, panel_width, panel_height); + panel_top -= accordion_tab->getRect().getHeight(); } show_hide_scrollbar(getRect().getWidth(), getRect().getHeight()); @@ -463,17 +443,16 @@ void LLAccordionCtrl::arrangeMultiple() S32 panel_width = getRect().getWidth() - 4; //Calculate params - for (size_t i = 0; i < mAccordionTabs.size(); i++ ) + for (size_t i = 0, end = mAccordionTabs.size(); i < end; i++) { - LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); - + LLAccordionCtrlTab* accordion_tab = static_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); if (!accordion_tab->getVisible()) // Skip hidden accordion tabs continue; if (!accordion_tab->isExpanded() ) { - ctrlSetLeftTopAndSize(mAccordionTabs[i], panel_left, panel_top, panel_width, accordion_tab->getRect().getHeight()); - panel_top -= mAccordionTabs[i]->getRect().getHeight(); + ctrlSetLeftTopAndSize(accordion_tab, panel_left, panel_top, panel_width, accordion_tab->getRect().getHeight()); + panel_top -= accordion_tab->getRect().getHeight(); } else { @@ -495,13 +474,13 @@ void LLAccordionCtrl::arrangeMultiple() } // minimum tab height is equal to header height - if (mAccordionTabs[i]->getHeaderHeight() > panel_height) + if (accordion_tab->getHeaderHeight() > panel_height) { - panel_height = mAccordionTabs[i]->getHeaderHeight(); + panel_height = accordion_tab->getHeaderHeight(); } } - ctrlSetLeftTopAndSize(mAccordionTabs[i], panel_left, panel_top, panel_width, panel_height); + ctrlSetLeftTopAndSize(accordion_tab, panel_left, panel_top, panel_width, panel_height); panel_top -= panel_height; } @@ -528,7 +507,7 @@ void LLAccordionCtrl::arrange() S32 panel_top = getRect().getHeight() - BORDER_MARGIN; // Top coordinate of the first panel S32 panel_width = getRect().getWidth() - 4; - LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[0]); + LLAccordionCtrlTab* accordion_tab = mAccordionTabs[0]; LLRect panel_rect = accordion_tab->getRect(); @@ -638,12 +617,12 @@ void LLAccordionCtrl::updateLayout(S32 width, S32 height) panel_width -= scrollbar_size; // set sizes for first panels and dragbars - for (size_t i = 0; i < mAccordionTabs.size(); ++i) + for (LLAccordionCtrlTab* accordion_tab : mAccordionTabs) { - if (!mAccordionTabs[i]->getVisible()) + if (!accordion_tab->getVisible()) continue; - LLRect panel_rect = mAccordionTabs[i]->getRect(); - ctrlSetLeftTopAndSize(mAccordionTabs[i], panel_rect.mLeft, panel_top, panel_width, panel_rect.getHeight()); + LLRect panel_rect = accordion_tab->getRect(); + ctrlSetLeftTopAndSize(accordion_tab, panel_rect.mLeft, panel_top, panel_width, panel_rect.getHeight()); panel_top -= panel_rect.getHeight(); } } @@ -685,9 +664,8 @@ void LLAccordionCtrl::onUpdateScrollToChild(const LLUICtrl *cntrl) void LLAccordionCtrl::onOpen(const LLSD& key) { - for (size_t i = 0; i < mAccordionTabs.size(); ++i) + for (LLAccordionCtrlTab* accordion_tab : mAccordionTabs) { - LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); LLPanel* panel = dynamic_cast<LLPanel*>(accordion_tab->getAccordionView()); if (panel != NULL) { @@ -711,7 +689,7 @@ S32 LLAccordionCtrl::notifyParent(const LLSD& info) { for (size_t i = 0; i < mAccordionTabs.size(); ++i) { - LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); + LLAccordionCtrlTab* accordion_tab = static_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); if (accordion_tab->hasFocus()) { while (++i < mAccordionTabs.size()) @@ -721,7 +699,7 @@ S32 LLAccordionCtrl::notifyParent(const LLSD& info) } if (i < mAccordionTabs.size()) { - accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); + accordion_tab = static_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); accordion_tab->notify(LLSD().with("action","select_first")); return 1; } @@ -734,7 +712,7 @@ S32 LLAccordionCtrl::notifyParent(const LLSD& info) { for (size_t i = 0; i < mAccordionTabs.size(); ++i) { - LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); + LLAccordionCtrlTab* accordion_tab = static_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); if (accordion_tab->hasFocus() && i > 0) { bool prev_visible_tab_found = false; @@ -749,7 +727,7 @@ S32 LLAccordionCtrl::notifyParent(const LLSD& info) if (prev_visible_tab_found) { - accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); + accordion_tab = static_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); accordion_tab->notify(LLSD().with("action","select_last")); return 1; } @@ -887,15 +865,12 @@ void LLAccordionCtrl::setFilterSubString(const std::string& filter_string) const LLAccordionCtrlTab* LLAccordionCtrl::getExpandedTab() const { - typedef std::vector<LLAccordionCtrlTab*>::const_iterator tabs_const_iterator; - - const LLAccordionCtrlTab* result = 0; - - for (tabs_const_iterator i = mAccordionTabs.begin(); i != mAccordionTabs.end(); ++i) + const LLAccordionCtrlTab* result = nullptr; + for (LLAccordionCtrlTab* accordion_tab : mAccordionTabs) { - if ((*i)->isExpanded()) + if (accordion_tab->isExpanded()) { - result = *i; + result = accordion_tab; break; } } @@ -913,11 +888,11 @@ S32 LLAccordionCtrl::calcExpandedTabHeight(S32 tab_index /* = 0 */, S32 availabl S32 collapsed_tabs_height = 0; S32 num_expanded = 0; - for (size_t n = tab_index; n < mAccordionTabs.size(); ++n) + for (LLAccordionCtrlTab* tab : mAccordionTabs) { - if (!mAccordionTabs[n]->isExpanded()) + if (!tab->isExpanded()) { - collapsed_tabs_height += mAccordionTabs[n]->getHeaderHeight(); + collapsed_tabs_height += tab->getHeaderHeight(); } else { @@ -939,10 +914,8 @@ void LLAccordionCtrl::collapseAllTabs() { if (mAccordionTabs.size() > 0) { - for (size_t i = 0; i < mAccordionTabs.size(); ++i) + for (LLAccordionCtrlTab* tab : mAccordionTabs) { - LLAccordionCtrlTab *tab = mAccordionTabs[i]; - if (tab->getDisplayChildren()) { tab->setDisplayChildren(false); diff --git a/indra/llui/llaccordionctrl.h b/indra/llui/llaccordionctrl.h index 1dfa9100f6..43a33a2b3c 100644 --- a/indra/llui/llaccordionctrl.h +++ b/indra/llui/llaccordionctrl.h @@ -57,8 +57,8 @@ public: class LLTabComparator { public: - LLTabComparator() {}; - virtual ~LLTabComparator() {}; + LLTabComparator() = default; + virtual ~LLTabComparator() = default; /** Returns true if tab1 < tab2, false otherwise */ virtual bool compare(const LLAccordionCtrlTab* tab1, const LLAccordionCtrlTab* tab2) const = 0; @@ -103,8 +103,8 @@ public: // Call reshape after changing splitter's size virtual void reshape(S32 width, S32 height, bool called_from_parent = true); - void addCollapsibleCtrl(LLView* view); - void removeCollapsibleCtrl(LLView* view); + void addCollapsibleCtrl(LLAccordionCtrlTab* accordion_tab); + void removeCollapsibleCtrl(LLAccordionCtrlTab* accordion_tab); void arrange(); @@ -180,20 +180,20 @@ private: private: LLRect mInnerRect; - LLScrollbar* mScrollbar; - bool mSingleExpansion; - bool mFitParent; - bool mAutoScrolling; - F32 mAutoScrollRate; - LLTextBox* mNoVisibleTabsHelpText; + LLScrollbar* mScrollbar = nullptr; + bool mSingleExpansion = false; + bool mFitParent = false; + bool mAutoScrolling = false; + F32 mAutoScrollRate = 0.f; + LLTextBox* mNoVisibleTabsHelpText = nullptr; - bool mSkipScrollToChild; + bool mSkipScrollToChild = false; std::string mNoMatchedTabsOrigString; std::string mNoVisibleTabsOrigString; - LLAccordionCtrlTab* mSelectedTab; - const LLTabComparator* mTabComparator; + LLAccordionCtrlTab* mSelectedTab = nullptr; + const LLTabComparator* mTabComparator = nullptr; }; diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 3a3aa7e4df..1c59938f90 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -86,10 +86,6 @@ void LLLayoutPanel::initFromParams(const Params& p) LLLayoutPanel::~LLLayoutPanel() { - // probably not necessary, but... - delete mResizeBar; - mResizeBar = NULL; - gFocusMgr.removeKeyboardFocusWithoutCallback(this); } @@ -242,11 +238,9 @@ LLLayoutStack::LLLayoutStack(const LLLayoutStack::Params& p) LLLayoutStack::~LLLayoutStack() { - e_panel_list_t panels = mPanels; // copy list of panel pointers - mPanels.clear(); // clear so that removeChild() calls don't cause trouble - std::for_each(panels.begin(), panels.end(), DeletePointer()); } +// virtual void LLLayoutStack::draw() { updateLayout(); @@ -284,8 +278,14 @@ void LLLayoutStack::draw() } } +// virtual void LLLayoutStack::deleteAllChildren() { + for (LLLayoutPanel* p : mPanels) + { + p->mResizeBar = nullptr; + } + mPanels.clear(); LLView::deleteAllChildren(); @@ -295,29 +295,47 @@ void LLLayoutStack::deleteAllChildren() mNeedsLayout = true; } +// virtual void LLLayoutStack::removeChild(LLView* view) { - LLLayoutPanel* embedded_panelp = findEmbeddedPanel(dynamic_cast<LLPanel*>(view)); - - if (embedded_panelp) + if (LLLayoutPanel* embedded_panelp = dynamic_cast<LLLayoutPanel*>(view)) { - mPanels.erase(std::find(mPanels.begin(), mPanels.end(), embedded_panelp)); - LLView::removeChild(view); - updateFractionalSizes(); - mNeedsLayout = true; + auto it = std::find(mPanels.begin(), mPanels.end(), embedded_panelp); + if (it != mPanels.end()) + { + mPanels.erase(it); + } + if (embedded_panelp->mResizeBar) + { + LLView::removeChild(embedded_panelp->mResizeBar); + embedded_panelp->mResizeBar = nullptr; + } } - else + else if (LLResizeBar* resize_bar = dynamic_cast<LLResizeBar*>(view)) { - LLView::removeChild(view); + for (LLLayoutPanel* p : mPanels) + { + if (p->mResizeBar == resize_bar) + { + p->mResizeBar = nullptr; + } + } } + + LLView::removeChild(view); + + updateFractionalSizes(); + mNeedsLayout = true; } +// virtual bool LLLayoutStack::postBuild() { updateLayout(); return true; } +// virtual bool LLLayoutStack::addChild(LLView* child, S32 tab_group) { LLLayoutPanel* panelp = dynamic_cast<LLLayoutPanel*>(child); @@ -983,6 +1001,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& //normalizeFractionalSizes(); } +// virtual void LLLayoutStack::reshape(S32 width, S32 height, bool called_from_parent) { mNeedsLayout = true; diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index b89618dc87..483c8774a7 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -621,6 +621,18 @@ <key>Value</key> <string>http://lecs-viewer-web-components.s3.amazonaws.com/v3.0/[GRID_LOWERCASE]/avatars.html</string> </map> + <!--AvatarBakedTextureUploadTimeout is in use by QA--> + <key>AvatarBakedTextureUploadTimeout</key> + <map> + <key>Comment</key> + <string>Specifes the maximum time in seconds to wait before sending your baked textures for avatar appearance. Set to 0 to disable and wait until all baked textures are at highest resolution.</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>U32</string> + <key>Value</key> + <integer>60</integer> + </map> <key>AvatarPhysics</key> <map> <key>Comment</key> diff --git a/indra/newview/lldebugview.cpp b/indra/newview/lldebugview.cpp index 0596a8fe7d..53da9826ed 100644 --- a/indra/newview/lldebugview.cpp +++ b/indra/newview/lldebugview.cpp @@ -119,7 +119,7 @@ void LLDebugView::draw() { if (mFloaterSnapRegion == NULL) { - mFloaterSnapRegion = getRootView()->getChildView("floater_snap_region"); + mFloaterSnapRegion = gViewerWindow->getFloaterSnapRegion(); } LLRect debug_rect; diff --git a/indra/newview/llfloaterimnearbychathandler.cpp b/indra/newview/llfloaterimnearbychathandler.cpp index e9cd912ca9..c920a3c898 100644 --- a/indra/newview/llfloaterimnearbychathandler.cpp +++ b/indra/newview/llfloaterimnearbychathandler.cpp @@ -286,7 +286,7 @@ void LLFloaterIMNearbyChatScreenChannel::addChat(LLSD& chat) if (mFloaterSnapRegion == NULL) { - mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region"); + mFloaterSnapRegion = gViewerWindow->getFloaterSnapRegion(); } LLRect channel_rect; mFloaterSnapRegion->localRectToOtherView(mFloaterSnapRegion->getLocalRect(), &channel_rect, gFloaterView); @@ -376,7 +376,7 @@ void LLFloaterIMNearbyChatScreenChannel::arrangeToasts() if (mFloaterSnapRegion == NULL) { - mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region"); + mFloaterSnapRegion = gViewerWindow->getFloaterSnapRegion(); } if (!getParent()) diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 5e5cfcecbf..3441fff7e8 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -430,6 +430,13 @@ void LLFloaterPreference::saveAvatarPropertiesCoro(const std::string cap_url, bo bool LLFloaterPreference::postBuild() { + mDeleteTranscriptsBtn = getChild<LLButton>("delete_transcripts"); + + mEnabledPopups = getChild<LLScrollListCtrl>("enabled_popups"); + mDisabledPopups = getChild<LLScrollListCtrl>("disabled_popups"); + mEnablePopupBtn = getChild<LLButton>("enable_this_popup"); + mDisablePopupBtn = getChild<LLButton>("disable_this_popup"); + gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLFloaterIMSessionTab::processChatHistoryStyleUpdate, false)); gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLViewerChat::signalChatFontChanged)); @@ -519,7 +526,7 @@ bool LLFloaterPreference::postBuild() void LLFloaterPreference::updateDeleteTranscriptsButton() { - getChild<LLButton>("delete_transcripts")->setEnabled(LLLogChat::transcriptFilesExist()); + mDeleteTranscriptsBtn->setEnabled(LLLogChat::transcriptFilesExist()); } void LLFloaterPreference::onDoNotDisturbResponseChanged() @@ -540,11 +547,11 @@ LLFloaterPreference::~LLFloaterPreference() void LLFloaterPreference::draw() { - bool has_first_selected = (getChildRef<LLScrollListCtrl>("disabled_popups").getFirstSelected()!=NULL); - gSavedSettings.setBOOL("FirstSelectedDisabledPopups", has_first_selected); + bool has_first_selected = (mDisabledPopups->getFirstSelected()!=NULL); + mEnablePopupBtn->setEnabled(has_first_selected); - has_first_selected = (getChildRef<LLScrollListCtrl>("enabled_popups").getFirstSelected()!=NULL); - gSavedSettings.setBOOL("FirstSelectedEnabledPopups", has_first_selected); + has_first_selected = (mEnabledPopups->getFirstSelected()!=NULL); + mDisablePopupBtn->setEnabled(has_first_selected); LLFloater::draw(); } @@ -1171,13 +1178,8 @@ void LLFloaterPreference::refreshSkin(void* data) void LLFloaterPreference::buildPopupLists() { - LLScrollListCtrl& disabled_popups = - getChildRef<LLScrollListCtrl>("disabled_popups"); - LLScrollListCtrl& enabled_popups = - getChildRef<LLScrollListCtrl>("enabled_popups"); - - disabled_popups.deleteAllItems(); - enabled_popups.deleteAllItems(); + mDisabledPopups->deleteAllItems(); + mEnabledPopups->deleteAllItems(); for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin(); iter != LLNotifications::instance().templatesEnd(); @@ -1219,11 +1221,11 @@ void LLFloaterPreference::buildPopupLists() } } } - item = disabled_popups.addElement(row); + item = mDisabledPopups->addElement(row); } else { - item = enabled_popups.addElement(row); + item = mEnabledPopups->addElement(row); } if (item) @@ -1324,9 +1326,7 @@ void LLFloaterPreference::onClickSetSounds() void LLFloaterPreference::onClickEnablePopup() { - LLScrollListCtrl& disabled_popups = getChildRef<LLScrollListCtrl>("disabled_popups"); - - std::vector<LLScrollListItem*> items = disabled_popups.getAllSelected(); + std::vector<LLScrollListItem*> items = mDisabledPopups->getAllSelected(); std::vector<LLScrollListItem*>::iterator itor; for (itor = items.begin(); itor != items.end(); ++itor) { @@ -1345,9 +1345,7 @@ void LLFloaterPreference::onClickEnablePopup() void LLFloaterPreference::onClickDisablePopup() { - LLScrollListCtrl& enabled_popups = getChildRef<LLScrollListCtrl>("enabled_popups"); - - std::vector<LLScrollListItem*> items = enabled_popups.getAllSelected(); + std::vector<LLScrollListItem*> items = mEnabledPopups->getAllSelected(); std::vector<LLScrollListItem*>::iterator itor; for (itor = items.begin(); itor != items.end(); ++itor) { @@ -1796,11 +1794,9 @@ void LLFloaterPreference::onDeleteTranscriptsResponse(const LLSD& notification, void LLFloaterPreference::onLogChatHistorySaved() { - LLButton * delete_transcripts_buttonp = getChild<LLButton>("delete_transcripts"); - - if (!delete_transcripts_buttonp->getEnabled()) + if (!mDeleteTranscriptsBtn->getEnabled()) { - delete_transcripts_buttonp->setEnabled(true); + mDeleteTranscriptsBtn->setEnabled(true); } } @@ -2334,7 +2330,6 @@ bool LLPanelPreferenceGraphics::postBuild() void LLPanelPreferenceGraphics::draw() { - setPresetText(); LLPanelPreference::draw(); } @@ -3315,8 +3310,8 @@ void LLFloaterPreference::onUpdateFilterTerm(bool force) void LLFloaterPreference::filterIgnorableNotifications() { - bool visible = getChildRef<LLScrollListCtrl>("enabled_popups").highlightMatchingItems(mFilterEdit->getValue()); - visible |= getChildRef<LLScrollListCtrl>("disabled_popups").highlightMatchingItems(mFilterEdit->getValue()); + bool visible = mEnabledPopups->highlightMatchingItems(mFilterEdit->getValue()); + visible |= mDisabledPopups->highlightMatchingItems(mFilterEdit->getValue()); if (visible) { diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index c8b98d8e1b..51ed3d8179 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -225,7 +225,12 @@ private: std::string mSavedGraphicsPreset; LOG_CLASS(LLFloaterPreference); - LLSearchEditor *mFilterEdit; + LLSearchEditor* mFilterEdit = nullptr; + LLScrollListCtrl* mEnabledPopups = nullptr; + LLScrollListCtrl* mDisabledPopups = nullptr; + LLButton* mDeleteTranscriptsBtn = nullptr; + LLButton* mEnablePopupBtn = nullptr; + LLButton* mDisablePopupBtn = nullptr; std::unique_ptr< ll::prefs::SearchData > mSearchData; bool mSearchDataDirty; diff --git a/indra/newview/llfloatersettingsdebug.cpp b/indra/newview/llfloatersettingsdebug.cpp index 525317304d..8cc01f6dc6 100644 --- a/indra/newview/llfloatersettingsdebug.cpp +++ b/indra/newview/llfloatersettingsdebug.cpp @@ -51,6 +51,18 @@ bool LLFloaterSettingsDebug::postBuild() { enableResizeCtrls(true, false, true); + mValSpinner1 = getChild<LLSpinCtrl>("val_spinner_1"); + mValSpinner2 = getChild<LLSpinCtrl>("val_spinner_2"); + mValSpinner3 = getChild<LLSpinCtrl>("val_spinner_3"); + mValSpinner4 = getChild<LLSpinCtrl>("val_spinner_4"); + mBooleanCombo = getChild<LLUICtrl>("boolean_combo"); + mValText = getChild<LLUICtrl>("val_text"); + + mColorSwatch = getChild<LLColorSwatchCtrl>("val_color_swatch"); + + mDefaultButton = getChild<LLUICtrl>("default_btn"); + mSettingNameText = getChild<LLTextBox>("setting_name_txt"); + mComment = getChild<LLTextEditor>("comment_text"); getChild<LLFilterEditor>("filter_input")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::setSearchFilter, this, _2)); @@ -104,56 +116,56 @@ void LLFloaterSettingsDebug::onCommitSettings() switch(controlp->type()) { case TYPE_U32: - controlp->set(getChild<LLUICtrl>("val_spinner_1")->getValue()); + controlp->set(mValSpinner1->getValue()); break; case TYPE_S32: - controlp->set(getChild<LLUICtrl>("val_spinner_1")->getValue()); + controlp->set(mValSpinner1->getValue()); break; case TYPE_F32: - controlp->set(LLSD(getChild<LLUICtrl>("val_spinner_1")->getValue().asReal())); + controlp->set(LLSD(mValSpinner1->getValue().asReal())); break; case TYPE_BOOLEAN: - controlp->set(getChild<LLUICtrl>("boolean_combo")->getValue()); + controlp->set(mBooleanCombo->getValue()); break; case TYPE_STRING: - controlp->set(LLSD(getChild<LLUICtrl>("val_text")->getValue().asString())); + controlp->set(LLSD(mValText->getValue().asString())); break; case TYPE_VEC3: - vector.mV[VX] = (F32)getChild<LLUICtrl>("val_spinner_1")->getValue().asReal(); - vector.mV[VY] = (F32)getChild<LLUICtrl>("val_spinner_2")->getValue().asReal(); - vector.mV[VZ] = (F32)getChild<LLUICtrl>("val_spinner_3")->getValue().asReal(); + vector.mV[VX] = (F32)mValSpinner1->getValue().asReal(); + vector.mV[VY] = (F32)mValSpinner2->getValue().asReal(); + vector.mV[VZ] = (F32)mValSpinner3->getValue().asReal(); controlp->set(vector.getValue()); break; case TYPE_VEC3D: - vectord.mdV[VX] = getChild<LLUICtrl>("val_spinner_1")->getValue().asReal(); - vectord.mdV[VY] = getChild<LLUICtrl>("val_spinner_2")->getValue().asReal(); - vectord.mdV[VZ] = getChild<LLUICtrl>("val_spinner_3")->getValue().asReal(); + vectord.mdV[VX] = mValSpinner1->getValue().asReal(); + vectord.mdV[VY] = mValSpinner2->getValue().asReal(); + vectord.mdV[VZ] = mValSpinner3->getValue().asReal(); controlp->set(vectord.getValue()); break; case TYPE_QUAT: - quat.mQ[VX] = (F32)getChild<LLUICtrl>("val_spinner_1")->getValue().asReal(); - quat.mQ[VY] = (F32)getChild<LLUICtrl>("val_spinner_2")->getValue().asReal(); - quat.mQ[VZ] = (F32)getChild<LLUICtrl>("val_spinner_3")->getValue().asReal(); - quat.mQ[VS] = (F32)getChild<LLUICtrl>("val_spinner_4")->getValue().asReal();; + quat.mQ[VX] = mValSpinner1->getValueF32(); + quat.mQ[VY] = mValSpinner2->getValueF32(); + quat.mQ[VZ] = mValSpinner3->getValueF32(); + quat.mQ[VS] = mValSpinner4->getValueF32(); controlp->set(quat.getValue()); break; case TYPE_RECT: - rect.mLeft = getChild<LLUICtrl>("val_spinner_1")->getValue().asInteger(); - rect.mRight = getChild<LLUICtrl>("val_spinner_2")->getValue().asInteger(); - rect.mBottom = getChild<LLUICtrl>("val_spinner_3")->getValue().asInteger(); - rect.mTop = getChild<LLUICtrl>("val_spinner_4")->getValue().asInteger(); + rect.mLeft = mValSpinner1->getValue().asInteger(); + rect.mRight = mValSpinner2->getValue().asInteger(); + rect.mBottom = mValSpinner3->getValue().asInteger(); + rect.mTop = mValSpinner4->getValue().asInteger(); controlp->set(rect.getValue()); break; case TYPE_COL4: - col3.setValue(getChild<LLUICtrl>("val_color_swatch")->getValue()); - col4 = LLColor4(col3, (F32)getChild<LLUICtrl>("val_spinner_4")->getValue().asReal()); + col3.setValue(mColorSwatch->getValue()); + col4 = LLColor4(col3, (F32)mValSpinner4->getValue().asReal()); controlp->set(col4.getValue()); break; case TYPE_COL3: - controlp->set(getChild<LLUICtrl>("val_color_swatch")->getValue()); - //col3.mV[VRED] = (F32)floaterp->getChild<LLUICtrl>("val_spinner_1")->getValue().asC(); - //col3.mV[VGREEN] = (F32)floaterp->getChild<LLUICtrl>("val_spinner_2")->getValue().asReal(); - //col3.mV[VBLUE] = (F32)floaterp->getChild<LLUICtrl>("val_spinner_3")->getValue().asReal(); + controlp->set(mColorSwatch->getValue()); + //col3.mV[VRED] = (F32)floaterp->mValSpinner1->getValue().asC(); + //col3.mV[VGREEN] = (F32)floaterp->mValSpinner2->getValue().asReal(); + //col3.mV[VBLUE] = (F32)floaterp->mValSpinner3->getValue().asReal(); //controlp->set(col3.getValue()); break; default: @@ -181,19 +193,6 @@ void LLFloaterSettingsDebug::onClickDefault() // we've switched controls, or doing per-frame update, so update spinners, etc. void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) { - LLSpinCtrl* spinner1 = getChild<LLSpinCtrl>("val_spinner_1"); - LLSpinCtrl* spinner2 = getChild<LLSpinCtrl>("val_spinner_2"); - LLSpinCtrl* spinner3 = getChild<LLSpinCtrl>("val_spinner_3"); - LLSpinCtrl* spinner4 = getChild<LLSpinCtrl>("val_spinner_4"); - LLColorSwatchCtrl* color_swatch = getChild<LLColorSwatchCtrl>("val_color_swatch"); - - if (!spinner1 || !spinner2 || !spinner3 || !spinner4 || !color_swatch) - { - LL_WARNS() << "Could not find all desired controls by name" - << LL_ENDL; - return; - } - hideUIControls(); if (controlp && !isSettingHidden(controlp)) @@ -201,11 +200,11 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) eControlType type = controlp->type(); //hide combo box only for non booleans, otherwise this will result in the combo box closing every frame - getChildView("boolean_combo")->setVisible( type == TYPE_BOOLEAN); - getChildView("default_btn")->setVisible(true); - getChildView("setting_name_txt")->setVisible(true); - getChild<LLTextBox>("setting_name_txt")->setText(controlp->getName()); - getChild<LLTextBox>("setting_name_txt")->setToolTip(controlp->getName()); + mBooleanCombo->setVisible( type == TYPE_BOOLEAN); + mDefaultButton->setVisible(true); + mSettingNameText->setVisible(true); + mSettingNameText->setText(controlp->getName()); + mSettingNameText->setToolTip(controlp->getName()); mComment->setVisible(true); std::string old_text = mComment->getText(); @@ -218,111 +217,111 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) mComment->setText(controlp->getComment()); } - spinner1->setMaxValue(F32_MAX); - spinner2->setMaxValue(F32_MAX); - spinner3->setMaxValue(F32_MAX); - spinner4->setMaxValue(F32_MAX); - spinner1->setMinValue(-F32_MAX); - spinner2->setMinValue(-F32_MAX); - spinner3->setMinValue(-F32_MAX); - spinner4->setMinValue(-F32_MAX); - if (!spinner1->hasFocus()) + mValSpinner1->setMaxValue(F32_MAX); + mValSpinner2->setMaxValue(F32_MAX); + mValSpinner3->setMaxValue(F32_MAX); + mValSpinner4->setMaxValue(F32_MAX); + mValSpinner1->setMinValue(-F32_MAX); + mValSpinner2->setMinValue(-F32_MAX); + mValSpinner3->setMinValue(-F32_MAX); + mValSpinner4->setMinValue(-F32_MAX); + if (!mValSpinner1->hasFocus()) { - spinner1->setIncrement(0.1f); + mValSpinner1->setIncrement(0.1f); } - if (!spinner2->hasFocus()) + if (!mValSpinner2->hasFocus()) { - spinner2->setIncrement(0.1f); + mValSpinner2->setIncrement(0.1f); } - if (!spinner3->hasFocus()) + if (!mValSpinner3->hasFocus()) { - spinner3->setIncrement(0.1f); + mValSpinner3->setIncrement(0.1f); } - if (!spinner4->hasFocus()) + if (!mValSpinner4->hasFocus()) { - spinner4->setIncrement(0.1f); + mValSpinner4->setIncrement(0.1f); } LLSD sd = controlp->get(); switch(type) { case TYPE_U32: - spinner1->setVisible(true); - spinner1->setLabel(std::string("value")); // Debug, don't translate - if (!spinner1->hasFocus()) + mValSpinner1->setVisible(true); + mValSpinner1->setLabel(std::string("value")); // Debug, don't translate + if (!mValSpinner1->hasFocus()) { - spinner1->setValue(sd); - spinner1->setMinValue((F32)U32_MIN); - spinner1->setMaxValue((F32)U32_MAX); - spinner1->setIncrement(1.f); - spinner1->setPrecision(0); + mValSpinner1->setValue(sd); + mValSpinner1->setMinValue((F32)U32_MIN); + mValSpinner1->setMaxValue((F32)U32_MAX); + mValSpinner1->setIncrement(1.f); + mValSpinner1->setPrecision(0); } break; case TYPE_S32: - spinner1->setVisible(true); - spinner1->setLabel(std::string("value")); // Debug, don't translate - if (!spinner1->hasFocus()) + mValSpinner1->setVisible(true); + mValSpinner1->setLabel(std::string("value")); // Debug, don't translate + if (!mValSpinner1->hasFocus()) { - spinner1->setValue(sd); - spinner1->setMinValue((F32)S32_MIN); - spinner1->setMaxValue((F32)S32_MAX); - spinner1->setIncrement(1.f); - spinner1->setPrecision(0); + mValSpinner1->setValue(sd); + mValSpinner1->setMinValue((F32)S32_MIN); + mValSpinner1->setMaxValue((F32)S32_MAX); + mValSpinner1->setIncrement(1.f); + mValSpinner1->setPrecision(0); } break; case TYPE_F32: - spinner1->setVisible(true); - spinner1->setLabel(std::string("value")); // Debug, don't translate - if (!spinner1->hasFocus()) + mValSpinner1->setVisible(true); + mValSpinner1->setLabel(std::string("value")); // Debug, don't translate + if (!mValSpinner1->hasFocus()) { - spinner1->setPrecision(3); - spinner1->setValue(sd); + mValSpinner1->setPrecision(3); + mValSpinner1->setValue(sd); } break; case TYPE_BOOLEAN: - if (!getChild<LLUICtrl>("boolean_combo")->hasFocus()) + if (!mBooleanCombo->hasFocus()) { if (sd.asBoolean()) { - getChild<LLUICtrl>("boolean_combo")->setValue(LLSD("true")); + mBooleanCombo->setValue(LLSD("true")); } else { - getChild<LLUICtrl>("boolean_combo")->setValue(LLSD("")); + mBooleanCombo->setValue(LLSD("")); } } break; case TYPE_STRING: - getChildView("val_text")->setVisible( true); - if (!getChild<LLUICtrl>("val_text")->hasFocus()) + mValText->setVisible( true); + if (!mValText->hasFocus()) { - getChild<LLUICtrl>("val_text")->setValue(sd); + mValText->setValue(sd); } break; case TYPE_VEC3: { LLVector3 v; v.setValue(sd); - spinner1->setVisible(true); - spinner1->setLabel(std::string("X")); - spinner2->setVisible(true); - spinner2->setLabel(std::string("Y")); - spinner3->setVisible(true); - spinner3->setLabel(std::string("Z")); - if (!spinner1->hasFocus()) + mValSpinner1->setVisible(true); + mValSpinner1->setLabel(std::string("X")); + mValSpinner2->setVisible(true); + mValSpinner2->setLabel(std::string("Y")); + mValSpinner3->setVisible(true); + mValSpinner3->setLabel(std::string("Z")); + if (!mValSpinner1->hasFocus()) { - spinner1->setPrecision(3); - spinner1->setValue(v[VX]); + mValSpinner1->setPrecision(3); + mValSpinner1->setValue(v[VX]); } - if (!spinner2->hasFocus()) + if (!mValSpinner2->hasFocus()) { - spinner2->setPrecision(3); - spinner2->setValue(v[VY]); + mValSpinner2->setPrecision(3); + mValSpinner2->setValue(v[VY]); } - if (!spinner3->hasFocus()) + if (!mValSpinner3->hasFocus()) { - spinner3->setPrecision(3); - spinner3->setValue(v[VZ]); + mValSpinner3->setPrecision(3); + mValSpinner3->setValue(v[VZ]); } break; } @@ -330,26 +329,26 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) { LLVector3d v; v.setValue(sd); - spinner1->setVisible(true); - spinner1->setLabel(std::string("X")); - spinner2->setVisible(true); - spinner2->setLabel(std::string("Y")); - spinner3->setVisible(true); - spinner3->setLabel(std::string("Z")); - if (!spinner1->hasFocus()) + mValSpinner1->setVisible(true); + mValSpinner1->setLabel(std::string("X")); + mValSpinner2->setVisible(true); + mValSpinner2->setLabel(std::string("Y")); + mValSpinner3->setVisible(true); + mValSpinner3->setLabel(std::string("Z")); + if (!mValSpinner1->hasFocus()) { - spinner1->setPrecision(3); - spinner1->setValue(v[VX]); + mValSpinner1->setPrecision(3); + mValSpinner1->setValue(v[VX]); } - if (!spinner2->hasFocus()) + if (!mValSpinner2->hasFocus()) { - spinner2->setPrecision(3); - spinner2->setValue(v[VY]); + mValSpinner2->setPrecision(3); + mValSpinner2->setValue(v[VY]); } - if (!spinner3->hasFocus()) + if (!mValSpinner3->hasFocus()) { - spinner3->setPrecision(3); - spinner3->setValue(v[VZ]); + mValSpinner3->setPrecision(3); + mValSpinner3->setValue(v[VZ]); } break; } @@ -357,33 +356,33 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) { LLQuaternion q; q.setValue(sd); - spinner1->setVisible(true); - spinner1->setLabel(std::string("X")); - spinner2->setVisible(true); - spinner2->setLabel(std::string("Y")); - spinner3->setVisible(true); - spinner3->setLabel(std::string("Z")); - spinner4->setVisible(true); - spinner4->setLabel(std::string("S")); - if (!spinner1->hasFocus()) + mValSpinner1->setVisible(true); + mValSpinner1->setLabel(std::string("X")); + mValSpinner2->setVisible(true); + mValSpinner2->setLabel(std::string("Y")); + mValSpinner3->setVisible(true); + mValSpinner3->setLabel(std::string("Z")); + mValSpinner4->setVisible(true); + mValSpinner4->setLabel(std::string("S")); + if (!mValSpinner1->hasFocus()) { - spinner1->setPrecision(4); - spinner1->setValue(q.mQ[VX]); + mValSpinner1->setPrecision(4); + mValSpinner1->setValue(q.mQ[VX]); } - if (!spinner2->hasFocus()) + if (!mValSpinner2->hasFocus()) { - spinner2->setPrecision(4); - spinner2->setValue(q.mQ[VY]); + mValSpinner2->setPrecision(4); + mValSpinner2->setValue(q.mQ[VY]); } - if (!spinner3->hasFocus()) + if (!mValSpinner3->hasFocus()) { - spinner3->setPrecision(4); - spinner3->setValue(q.mQ[VZ]); + mValSpinner3->setPrecision(4); + mValSpinner3->setValue(q.mQ[VZ]); } - if (!spinner4->hasFocus()) + if (!mValSpinner4->hasFocus()) { - spinner4->setPrecision(4); - spinner4->setValue(q.mQ[VS]); + mValSpinner4->setPrecision(4); + mValSpinner4->setValue(q.mQ[VS]); } break; } @@ -391,70 +390,70 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) { LLRect r; r.setValue(sd); - spinner1->setVisible(true); - spinner1->setLabel(std::string("Left")); - spinner2->setVisible(true); - spinner2->setLabel(std::string("Right")); - spinner3->setVisible(true); - spinner3->setLabel(std::string("Bottom")); - spinner4->setVisible(true); - spinner4->setLabel(std::string("Top")); - if (!spinner1->hasFocus()) + mValSpinner1->setVisible(true); + mValSpinner1->setLabel(std::string("Left")); + mValSpinner2->setVisible(true); + mValSpinner2->setLabel(std::string("Right")); + mValSpinner3->setVisible(true); + mValSpinner3->setLabel(std::string("Bottom")); + mValSpinner4->setVisible(true); + mValSpinner4->setLabel(std::string("Top")); + if (!mValSpinner1->hasFocus()) { - spinner1->setPrecision(0); - spinner1->setValue(r.mLeft); + mValSpinner1->setPrecision(0); + mValSpinner1->setValue(r.mLeft); } - if (!spinner2->hasFocus()) + if (!mValSpinner2->hasFocus()) { - spinner2->setPrecision(0); - spinner2->setValue(r.mRight); + mValSpinner2->setPrecision(0); + mValSpinner2->setValue(r.mRight); } - if (!spinner3->hasFocus()) + if (!mValSpinner3->hasFocus()) { - spinner3->setPrecision(0); - spinner3->setValue(r.mBottom); + mValSpinner3->setPrecision(0); + mValSpinner3->setValue(r.mBottom); } - if (!spinner4->hasFocus()) + if (!mValSpinner4->hasFocus()) { - spinner4->setPrecision(0); - spinner4->setValue(r.mTop); + mValSpinner4->setPrecision(0); + mValSpinner4->setValue(r.mTop); } - spinner1->setMinValue((F32)S32_MIN); - spinner1->setMaxValue((F32)S32_MAX); - spinner1->setIncrement(1.f); + mValSpinner1->setMinValue((F32)S32_MIN); + mValSpinner1->setMaxValue((F32)S32_MAX); + mValSpinner1->setIncrement(1.f); - spinner2->setMinValue((F32)S32_MIN); - spinner2->setMaxValue((F32)S32_MAX); - spinner2->setIncrement(1.f); + mValSpinner2->setMinValue((F32)S32_MIN); + mValSpinner2->setMaxValue((F32)S32_MAX); + mValSpinner2->setIncrement(1.f); - spinner3->setMinValue((F32)S32_MIN); - spinner3->setMaxValue((F32)S32_MAX); - spinner3->setIncrement(1.f); + mValSpinner3->setMinValue((F32)S32_MIN); + mValSpinner3->setMaxValue((F32)S32_MAX); + mValSpinner3->setIncrement(1.f); - spinner4->setMinValue((F32)S32_MIN); - spinner4->setMaxValue((F32)S32_MAX); - spinner4->setIncrement(1.f); + mValSpinner4->setMinValue((F32)S32_MIN); + mValSpinner4->setMaxValue((F32)S32_MAX); + mValSpinner4->setIncrement(1.f); break; } case TYPE_COL4: { LLColor4 clr; clr.setValue(sd); - color_swatch->setVisible(true); + mColorSwatch->setVisible(true); // only set if changed so color picker doesn't update - if(clr != LLColor4(color_swatch->getValue())) + if(clr != LLColor4(mColorSwatch->getValue())) { - color_swatch->set(LLColor4(sd), true, false); + mColorSwatch->set(LLColor4(sd), true, false); } - spinner4->setVisible(true); - spinner4->setLabel(std::string("Alpha")); - if (!spinner4->hasFocus()) + mValSpinner4->setVisible(true); + mValSpinner4->setLabel(std::string("Alpha")); + if (!mValSpinner4->hasFocus()) { - spinner4->setPrecision(3); - spinner4->setMinValue(0.0); - spinner4->setMaxValue(1.f); - spinner4->setValue(clr.mV[VALPHA]); + mValSpinner4->setPrecision(3); + mValSpinner4->setMinValue(0.0); + mValSpinner4->setMaxValue(1.f); + mValSpinner4->setValue(clr.mV[VALPHA]); } break; } @@ -462,8 +461,8 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) { LLColor3 clr; clr.setValue(sd); - color_swatch->setVisible(true); - color_swatch->setValue(sd); + mColorSwatch->setVisible(true); + mColorSwatch->setValue(sd); break; } default: @@ -624,15 +623,15 @@ void LLFloaterSettingsDebug::updateDefaultColumn(LLControlVariable* control) void LLFloaterSettingsDebug::hideUIControls() { - getChildView("val_spinner_1")->setVisible(false); - getChildView("val_spinner_2")->setVisible(false); - getChildView("val_spinner_3")->setVisible(false); - getChildView("val_spinner_4")->setVisible(false); - getChildView("val_color_swatch")->setVisible(false); - getChildView("val_text")->setVisible(false); - getChildView("default_btn")->setVisible(false); - getChildView("boolean_combo")->setVisible(false); - getChildView("setting_name_txt")->setVisible(false); + mValSpinner1->setVisible(false); + mValSpinner2->setVisible(false); + mValSpinner3->setVisible(false); + mValSpinner4->setVisible(false); + mColorSwatch->setVisible(false); + mValText->setVisible(false); + mDefaultButton->setVisible(false); + mBooleanCombo->setVisible(false); + mSettingNameText->setVisible(false); mComment->setVisible(false); } diff --git a/indra/newview/llfloatersettingsdebug.h b/indra/newview/llfloatersettingsdebug.h index 4df0dc8dd2..b813cf4a74 100644 --- a/indra/newview/llfloatersettingsdebug.h +++ b/indra/newview/llfloatersettingsdebug.h @@ -30,9 +30,12 @@ #include "llcontrol.h" #include "llfloater.h" +class LLColorSwatchCtrl; class LLScrollListCtrl; +class LLSpinCtrl; +class LLTextBox; -class LLFloaterSettingsDebug +class LLFloaterSettingsDebug final : public LLFloater { friend class LLFloaterReg; @@ -67,6 +70,16 @@ private: protected: class LLTextEditor* mComment; + LLSpinCtrl* mValSpinner1 = nullptr; + LLSpinCtrl* mValSpinner2 = nullptr; + LLSpinCtrl* mValSpinner3 = nullptr; + LLSpinCtrl* mValSpinner4 = nullptr; + LLUICtrl* mBooleanCombo = nullptr; + LLUICtrl* mValText = nullptr; + LLUICtrl* mDefaultButton = nullptr; + LLTextBox* mSettingNameText = nullptr; + + LLColorSwatchCtrl* mColorSwatch = nullptr; std::string mSearchFilter; }; diff --git a/indra/newview/llfloatersidepanelcontainer.cpp b/indra/newview/llfloatersidepanelcontainer.cpp index 6c5d2570f2..7bc95c2884 100644 --- a/indra/newview/llfloatersidepanelcontainer.cpp +++ b/indra/newview/llfloatersidepanelcontainer.cpp @@ -53,31 +53,39 @@ LLFloaterSidePanelContainer::~LLFloaterSidePanelContainer() LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::GLOBAL, this); } +bool LLFloaterSidePanelContainer::postBuild() +{ + mMainPanel = getChild<LLPanel>(sMainPanelName); + return TRUE; +} + void LLFloaterSidePanelContainer::onOpen(const LLSD& key) { - getChild<LLPanel>(sMainPanelName)->onOpen(key); + mMainPanel->onOpen(key); } void LLFloaterSidePanelContainer::closeFloater(bool app_quitting) { - LLPanelOutfitEdit* panel_outfit_edit = - dynamic_cast<LLPanelOutfitEdit*>(LLFloaterSidePanelContainer::findPanel("appearance", "panel_outfit_edit")); - if (panel_outfit_edit) + if(getInstanceName() == "appearance") { - LLFloater *parent = gFloaterView->getParentFloater(panel_outfit_edit); - if (parent == this ) + LLPanelOutfitEdit* panel_outfit_edit = findChild<LLPanelOutfitEdit>("panel_outfit_edit"); + if (panel_outfit_edit) { - LLSidepanelAppearance* panel_appearance = dynamic_cast<LLSidepanelAppearance*>(getPanel("appearance")); - if (panel_appearance) + LLFloater *parent = gFloaterView->getParentFloater(panel_outfit_edit); + if (parent == this) { - LLPanelEditWearable *edit_wearable_ptr = panel_appearance->getWearable(); - if (edit_wearable_ptr) - { - edit_wearable_ptr->onClose(); - } - if (!app_quitting) + LLSidepanelAppearance* panel_appearance = dynamic_cast<LLSidepanelAppearance*>(mMainPanel); + if (panel_appearance) { - panel_appearance->showOutfitsInventoryPanel(); + LLPanelEditWearable *edit_wearable_ptr = panel_appearance->getWearable(); + if (edit_wearable_ptr) + { + edit_wearable_ptr->onClose(); + } + if(!app_quitting) + { + panel_appearance->showOutfitsInventoryPanel(); + } } } } @@ -93,10 +101,9 @@ void LLFloaterSidePanelContainer::closeFloater(bool app_quitting) void LLFloaterSidePanelContainer::onClickCloseBtn(bool app_quitting) { - if (!app_quitting) + if (!app_quitting && getInstanceName() == "appearance") { - LLPanelOutfitEdit* panel_outfit_edit = - dynamic_cast<LLPanelOutfitEdit*>(LLFloaterSidePanelContainer::findPanel("appearance", "panel_outfit_edit")); + LLPanelOutfitEdit* panel_outfit_edit = findChild<LLPanelOutfitEdit>("panel_outfit_edit"); if (panel_outfit_edit) { LLFloater* parent = gFloaterView->getParentFloater(panel_outfit_edit); @@ -206,10 +213,16 @@ void LLFloaterSidePanelContainer::showPanel(std::string_view floater_name, std:: LLPanel* LLFloaterSidePanelContainer::getPanel(std::string_view floater_name, std::string_view panel_name) { LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>(floater_name); - if (floaterp) { - return floaterp->findChild<LLPanel>(panel_name, true); + if (panel_name == sMainPanelName) + { + return floaterp->mMainPanel; + } + else + { + return floaterp->findChild<LLPanel>(panel_name, true); + } } return NULL; @@ -218,10 +231,16 @@ LLPanel* LLFloaterSidePanelContainer::getPanel(std::string_view floater_name, st LLPanel* LLFloaterSidePanelContainer::findPanel(std::string_view floater_name, std::string_view panel_name) { LLFloaterSidePanelContainer* floaterp = LLFloaterReg::findTypedInstance<LLFloaterSidePanelContainer>(floater_name); - if (floaterp) { - return floaterp->findChild<LLPanel>(panel_name, true); + if (panel_name == sMainPanelName) + { + return floaterp->mMainPanel; + } + else + { + return floaterp->findChild<LLPanel>(panel_name, true); + } } return NULL; diff --git a/indra/newview/llfloatersidepanelcontainer.h b/indra/newview/llfloatersidepanelcontainer.h index d7f6c309c4..4b9d0e34a7 100644 --- a/indra/newview/llfloatersidepanelcontainer.h +++ b/indra/newview/llfloatersidepanelcontainer.h @@ -49,6 +49,8 @@ public: LLFloaterSidePanelContainer(const LLSD& key, const Params& params = getDefaultParams()); ~LLFloaterSidePanelContainer(); + bool postBuild() override; + void onOpen(const LLSD& key) override; void closeFloater(bool app_quitting = false) override; @@ -77,6 +79,11 @@ public: * @returns a pointer to the panel of given type T. */ template <typename T> + static T* findPanel(std::string_view floater_name, std::string_view panel_name = sMainPanelName) + { + return dynamic_cast<T*>(findPanel(floater_name, panel_name)); + } + template <typename T> static T* getPanel(std::string_view floater_name, std::string_view panel_name = sMainPanelName) { T* panel = dynamic_cast<T*>(getPanel(floater_name, panel_name)); @@ -89,6 +96,8 @@ public: protected: void onCloseMsgCallback(const LLSD& notification, const LLSD& response); + + LLPanel* mMainPanel = nullptr; }; #endif // LL_LLFLOATERSIDEPANELCONTAINER_H diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index ddd55d0c17..f7c82621fb 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -344,10 +344,22 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshotBase* floater) } floater->getChild<LLUICtrl>("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : floater->getString("unknown")); - floater->getChild<LLUICtrl>("file_size_label")->setColor( - shot_type == LLSnapshotModel::SNAPSHOT_POSTCARD - && got_bytes - && previewp->getDataSize() > MAX_POSTCARD_DATASIZE ? LLUIColor(LLColor4::red) : LLUIColorTable::instance().getColor( "LabelTextColor" )); + + LLUIColor color = LLUIColorTable::instance().getColor( "LabelTextColor" ); + if (shot_type == LLSnapshotModel::SNAPSHOT_POSTCARD + && got_bytes + && previewp->getDataSize() > MAX_POSTCARD_DATASIZE) + { + color = LLUIColor(LLColor4::red); + } + if (shot_type == LLSnapshotModel::SNAPSHOT_WEB + && got_bytes + && previewp->getDataSize() > LLWebProfile::MAX_WEB_DATASIZE) + { + color = LLUIColor(LLColor4::red); + } + + floater->getChild<LLUICtrl>("file_size_label")->setColor(color); // Update the width and height spinners based on the corresponding resolution combos. (?) switch(shot_type) diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index aadc5b9580..f6d8fcab36 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -284,6 +284,15 @@ bool LLFloaterTools::postBuild() // the setting stores the actual force multiplier, but the slider is logarithmic, so we convert here getChild<LLUICtrl>("slider force")->setValue(log10(gSavedSettings.getF32("LandBrushForce"))); + mTextBulldozer = getChild<LLTextBox>("Bulldozer:"); + mTextDozerSize = getChild<LLTextBox>("Dozer Size:"); + mTextDozerStrength = getChild<LLTextBox>("Strength:"); + mSliderZoom = getChild<LLSlider>("slider zoom"); + + mTextSelectionCount = getChild<LLTextBox>("selection_count"); + mTextSelectionEmpty = getChild<LLTextBox>("selection_empty"); + mTextSelectionFaces = getChild<LLTextBox>("selection_faces"); + mCostTextBorder = getChild<LLViewBorder>("cost_text_border"); mTab = getChild<LLTabContainer>("Object Info Tabs"); @@ -450,10 +459,10 @@ void LLFloaterTools::refresh() { std::string obj_count_string; LLResMgr::getInstance()->getIntegerString(obj_count_string, LLSelectMgr::getInstance()->getSelection()->getRootObjectCount()); - getChild<LLUICtrl>("selection_count")->setTextArg("[OBJ_COUNT]", obj_count_string); + mTextSelectionCount->setTextArg("[OBJ_COUNT]", obj_count_string); std::string prim_count_string; LLResMgr::getInstance()->getIntegerString(prim_count_string, LLSelectMgr::getInstance()->getSelection()->getObjectCount()); - getChild<LLUICtrl>("selection_count")->setTextArg("[PRIM_COUNT]", prim_count_string); + mTextSelectionCount->setTextArg("[PRIM_COUNT]", prim_count_string); // calculate selection rendering cost if (sShowObjectCost) @@ -521,23 +530,18 @@ void LLFloaterTools::refresh() } } } - - childSetTextArg("selection_faces", "[FACES_STRING]", faces_str); + mTextSelectionFaces->setTextArg("[FACES_STRING]", faces_str); } bool show_faces = (object_count == 1) && LLToolFace::getInstance() == LLToolMgr::getInstance()->getCurrentTool(); - getChildView("selection_faces")->setVisible(show_faces); + mTextSelectionFaces->setVisible(show_faces); LLStringUtil::format_map_t selection_args; selection_args["OBJ_COUNT"] = llformat("%.1d", link_count); selection_args["LAND_IMPACT"] = llformat("%.1d", (S32)link_cost); - std::ostringstream selection_info; - - selection_info << getString("status_selectcount", selection_args); - - getChild<LLTextBox>("selection_count")->setText(selection_info.str()); + mTextSelectionCount->setText(getString("status_selectcount", selection_args)); } @@ -618,8 +622,9 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) mBtnFocus ->setToggleState( focus_visible ); mRadioGroupFocus->setVisible( focus_visible ); - getChildView("slider zoom")->setVisible( focus_visible); - getChildView("slider zoom")->setEnabled(gCameraBtnZoom); + + mSliderZoom->setVisible( focus_visible); + mSliderZoom->setEnabled(gCameraBtnZoom); if (!gCameraBtnOrbit && !gCameraBtnPan && @@ -644,7 +649,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) } // multiply by correction factor because volume sliders go [0, 0.5] - getChild<LLUICtrl>("slider zoom")->setValue(gAgentCamera.getCameraZoomFraction() * 0.5f); + mSliderZoom->setValue(gAgentCamera.getCameraZoomFraction() * 0.5f); // Move buttons bool move_visible = (tool == LLToolGrab::getInstance()); @@ -832,22 +837,22 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) } if (mSliderDozerSize) { - mSliderDozerSize ->setVisible( land_visible ); - getChildView("Bulldozer:")->setVisible( land_visible); - getChildView("Dozer Size:")->setVisible( land_visible); + mSliderDozerSize->setVisible( land_visible ); + mTextBulldozer->setVisible( land_visible); + mTextDozerSize->setVisible( land_visible); } if (mSliderDozerForce) { - mSliderDozerForce ->setVisible( land_visible ); - getChildView("Strength:")->setVisible( land_visible); + mSliderDozerForce->setVisible( land_visible ); + mTextDozerStrength->setVisible( land_visible); } bool have_selection = !LLSelectMgr::getInstance()->getSelection()->isEmpty(); - getChildView("selection_count")->setVisible(!land_visible && have_selection); - getChildView("selection_faces")->setVisible(LLToolFace::getInstance() == LLToolMgr::getInstance()->getCurrentTool() + mTextSelectionCount->setVisible(!land_visible && have_selection); + mTextSelectionFaces->setVisible(LLToolFace::getInstance() == LLToolMgr::getInstance()->getCurrentTool() && LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1); - getChildView("selection_empty")->setVisible(!land_visible && !have_selection); + mTextSelectionEmpty->setVisible(!land_visible && !have_selection); mTab->setVisible(!land_visible); mPanelLandInfo->setVisible(land_visible); diff --git a/indra/newview/llfloatertools.h b/indra/newview/llfloatertools.h index f9c3b401bb..0f7a61b733 100644 --- a/indra/newview/llfloatertools.h +++ b/indra/newview/llfloatertools.h @@ -148,6 +148,11 @@ public: LLButton *mBtnDuplicate; LLButton *mBtnDuplicateInPlace; + LLTextBox* mTextSelectionCount = nullptr; + LLTextBox* mTextSelectionEmpty = nullptr; + LLTextBox* mTextSelectionFaces = nullptr; + LLSlider* mSliderZoom = nullptr; + // Create buttons LLCheckBoxCtrl *mCheckSticky; LLCheckBoxCtrl *mCheckCopySelection; @@ -155,9 +160,12 @@ public: LLCheckBoxCtrl *mCheckCopyRotates; // Land buttons - LLRadioGroup* mRadioGroupLand; - LLSlider *mSliderDozerSize; - LLSlider *mSliderDozerForce; + LLRadioGroup* mRadioGroupLand = nullptr; + LLSlider *mSliderDozerSize = nullptr; + LLSlider *mSliderDozerForce = nullptr; + LLTextBox* mTextBulldozer = nullptr; + LLTextBox* mTextDozerSize = nullptr; + LLTextBox* mTextDozerStrength = nullptr; LLButton *mBtnApplyToSelection; diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 349df11f35..26e2d8f319 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -3292,8 +3292,6 @@ void LLMeshHeaderHandler::processData(LLCore::BufferArray * /* body */, S32 /* b // only allocate as much space in the cache as is needed for the local cache data_size = llmin(data_size, bytes); - // <FS:Ansariel> Fix asset caching - //LLFileSystem file(mesh_id, LLAssetType::AT_MESH, LLFileSystem::WRITE); LLFileSystem file(mesh_id, LLAssetType::AT_MESH, LLFileSystem::READ_WRITE); if (file.getMaxSize() >= bytes) { @@ -3302,7 +3300,6 @@ void LLMeshHeaderHandler::processData(LLCore::BufferArray * /* body */, S32 /* b file.write(data, data_size); - // <FS:Ansariel> Fix asset caching S32 remaining = bytes - file.tell(); if (remaining > 0) { @@ -3314,7 +3311,6 @@ void LLMeshHeaderHandler::processData(LLCore::BufferArray * /* body */, S32 /* b delete[] block; } } - // </FS:Ansariel> } } else @@ -3367,8 +3363,6 @@ void LLMeshLODHandler::processData(LLCore::BufferArray * /* body */, S32 /* body if (result == MESH_OK) { // good fetch from sim, write to cache - // <FS:Ansariel> Fix asset caching - //LLFileSystem file(mMeshParams.getSculptID(), LLAssetType::AT_MESH, LLFileSystem::WRITE); LLFileSystem file(mMeshParams.getSculptID(), LLAssetType::AT_MESH, LLFileSystem::READ_WRITE); S32 offset = mOffset; @@ -3432,8 +3426,6 @@ void LLMeshSkinInfoHandler::processData(LLCore::BufferArray * /* body */, S32 /* && gMeshRepo.mThread->skinInfoReceived(mMeshID, data, data_size)) { // good fetch from sim, write to cache - // <FS:Ansariel> Fix asset caching - //LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::WRITE); LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::READ_WRITE); S32 offset = mOffset; @@ -3483,8 +3475,6 @@ void LLMeshDecompositionHandler::processData(LLCore::BufferArray * /* body */, S && gMeshRepo.mThread->decompositionReceived(mMeshID, data, data_size)) { // good fetch from sim, write to cache - // <FS:Ansariel> Fix asset caching - //LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::WRITE); LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::READ_WRITE); S32 offset = mOffset; @@ -3532,8 +3522,6 @@ void LLMeshPhysicsShapeHandler::processData(LLCore::BufferArray * /* body */, S3 && gMeshRepo.mThread->physicsShapeReceived(mMeshID, data, data_size) == MESH_OK) { // good fetch from sim, write to cache for caching - // <FS:Ansariel> Fix asset caching - //LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::WRITE); LLFileSystem file(mMeshID, LLAssetType::AT_MESH, LLFileSystem::READ_WRITE); S32 offset = mOffset; diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index fd7085c452..8334da1836 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -239,6 +239,11 @@ bool LLPanelMainInventory::postBuild() } } + mParentSidepanel = getParentSidepanelInventory(); + if (mParentSidepanel) + { + mInboxPanel = mParentSidepanel->getChild<LLPanelMarketplaceInbox>("marketplace_inbox"); + } mFilterEditor = getChild<LLFilterEditor>("inventory search editor"); if (mFilterEditor) @@ -303,31 +308,29 @@ LLPanelMainInventory::~LLPanelMainInventory( void ) // for example, LLParamSDParser doesn't know about U64, // so some FilterOps params should be revised. LLSD filterRoot; - LLInventoryPanel* all_items_panel = getChild<LLInventoryPanel>(ALL_ITEMS); - if (all_items_panel) + if (mAllItemsPanel) { LLSD filterState; LLInventoryPanel::InventoryState p; - all_items_panel->getFilter().toParams(p.filter); - all_items_panel->getRootViewModel().getSorter().toParams(p.sort); + mAllItemsPanel->getFilter().toParams(p.filter); + mAllItemsPanel->getRootViewModel().getSorter().toParams(p.sort); if (p.validateBlock(false)) { LLParamSDParser().writeSD(filterState, p); - filterRoot[all_items_panel->getName()] = filterState; + filterRoot[mAllItemsPanel->getName()] = filterState; } } - LLInventoryPanel* panel = findChild<LLInventoryPanel>(RECENT_ITEMS); - if (panel) + if (mRecentPanel) { LLSD filterState; LLInventoryPanel::InventoryState p; - panel->getFilter().toParams(p.filter); - panel->getRootViewModel().getSorter().toParams(p.sort); + mRecentPanel->getFilter().toParams(p.filter); + mRecentPanel->getRootViewModel().getSorter().toParams(p.sort); if (p.validateBlock(false)) { LLParamSDParser().writeSD(filterState, p); - filterRoot[panel->getName()] = filterState; + filterRoot[mRecentPanel->getName()] = filterState; } } @@ -761,14 +764,9 @@ void LLPanelMainInventory::onClearSearch() } mFilterSubString = ""; - LLSidepanelInventory * sidepanel_inventory = getParentSidepanelInventory(); - if (sidepanel_inventory) + if (mInboxPanel) { - LLPanelMarketplaceInbox* inbox_panel = sidepanel_inventory->getChild<LLPanelMarketplaceInbox>("marketplace_inbox"); - if (inbox_panel) - { - inbox_panel->onClearSearch(); - } + mInboxPanel->onClearSearch(); } } @@ -818,14 +816,9 @@ void LLPanelMainInventory::onFilterEdit(const std::string& search_string ) // set new filter string setFilterSubString(mFilterSubString); - LLSidepanelInventory * sidepanel_inventory = getParentSidepanelInventory(); - if (sidepanel_inventory) + if (mInboxPanel) { - LLPanelMarketplaceInbox* inbox_panel = sidepanel_inventory->getChild<LLPanelMarketplaceInbox>("marketplace_inbox"); - if (inbox_panel) - { - inbox_panel->onFilterEdit(search_string); - } + mInboxPanel->onFilterEdit(search_string); } } @@ -1530,17 +1523,13 @@ void LLPanelMainInventory::onAddButtonClick() void LLPanelMainInventory::setActivePanel() { // Todo: should cover gallery mode in some way - if(mSingleFolderMode && isListViewMode()) - { - mActivePanel = getChild<LLInventoryPanel>("comb_single_folder_inv"); - } - else if(mSingleFolderMode && isCombinationViewMode()) + if(mSingleFolderMode && (isListViewMode() || isCombinationViewMode())) { - mActivePanel = getChild<LLInventoryPanel>("comb_single_folder_inv"); + mActivePanel = mCombinationInventoryPanel; } else { - mActivePanel = (LLInventoryPanel*)getChild<LLTabContainer>("inventory filter tabs")->getCurrentPanel(); + mActivePanel = (LLInventoryPanel*)mFilterTabs->getCurrentPanel(); } mViewModeBtn->setEnabled(mSingleFolderMode || (getAllItemsPanel() == getActivePanel())); } @@ -1578,16 +1567,15 @@ void LLPanelMainInventory::toggleViewMode() updateTitle(); onFilterSelected(); - LLSidepanelInventory* sidepanel_inventory = getParentSidepanelInventory(); - if (sidepanel_inventory) + if (mParentSidepanel) { if(mSingleFolderMode) { - sidepanel_inventory->hideInbox(); + mParentSidepanel->hideInbox(); } else { - sidepanel_inventory->toggleInbox(); + mParentSidepanel->toggleInbox(); } } } diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index 68ac3410d8..c1c7e9a7ab 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -49,6 +49,8 @@ class LLSidepanelInventory; class LLToggleableMenu; class LLFloater; class LLFloaterSidePanelContainer; +class LLSidepanelInventory; +class LLPanelMarketplaceInbox; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLPanelMainInventory @@ -244,6 +246,9 @@ protected: void setUploadCostIfNeeded(); void disableAddIfNeeded(); private: + LLSidepanelInventory* mParentSidepanel = nullptr; + LLPanelMarketplaceInbox* mInboxPanel = nullptr; + LLToggleableMenu* mMenuGearDefault; LLToggleableMenu* mMenuViewDefault; LLToggleableMenu* mMenuVisibility; diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 2f0a8f7656..107b1cf6cd 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -727,12 +727,14 @@ bool LLPanelPeople::postBuild() LL_WARNS() << "People->Groups list menu not found" << LL_ENDL; } - LLAccordionCtrlTab* accordion_tab = getChild<LLAccordionCtrlTab>("tab_all"); - accordion_tab->setDropDownStateChangedCallback( + mFriendsAccordion = friends_tab->getChild<LLAccordionCtrl>("friends_accordion"); + + mFriendsAllTab = mFriendsAccordion->getChild<LLAccordionCtrlTab>("tab_all"); + mFriendsAllTab->setDropDownStateChangedCallback( boost::bind(&LLPanelPeople::onFriendsAccordionExpandedCollapsed, this, _1, _2, mAllFriendList)); - accordion_tab = getChild<LLAccordionCtrlTab>("tab_online"); - accordion_tab->setDropDownStateChangedCallback( + mFriendsOnlineTab = mFriendsAccordion->getChild<LLAccordionCtrlTab>("tab_online"); + mFriendsOnlineTab->setDropDownStateChangedCallback( boost::bind(&LLPanelPeople::onFriendsAccordionExpandedCollapsed, this, _1, _2, mOnlineFriendList)); // Must go after setting commit callback and initializing all pointers to children. @@ -1064,8 +1066,8 @@ void LLPanelPeople::onFilterEdit(const std::string& search_string) mOnlineFriendList->setNameFilter(filter); mAllFriendList->setNameFilter(filter); - setAccordionCollapsedByUser("tab_online", false); - setAccordionCollapsedByUser("tab_all", false); + setAccordionCollapsedByUser(mFriendsOnlineTab, false); + setAccordionCollapsedByUser(mFriendsAllTab, false); showFriendsAccordionsIfNeeded(); // restore accordion tabs state _after_ all manipulations @@ -1108,7 +1110,6 @@ void LLPanelPeople::onGroupLimitInfo() void LLPanelPeople::onTabSelected(const LLSD& param) { - std::string tab_name = getChild<LLPanel>(param.asString())->getName(); updateButtons(); showFriendsAccordionsIfNeeded(); @@ -1142,9 +1143,9 @@ void LLPanelPeople::onAvatarListCommitted(LLAvatarList* list) uuid_vec_t selected_uuids; getCurrentItemIDs(selected_uuids); mMiniMap->setSelected(selected_uuids); - } else + } // Make sure only one of the friends lists (online/all) has selection. - if (getActiveTabName() == FRIENDS_TAB_NAME) + else if (getActiveTabName() == FRIENDS_TAB_NAME) { if (list == mOnlineFriendList) mAllFriendList->resetSelection(true); @@ -1169,12 +1170,9 @@ void LLPanelPeople::onAddFriendButtonClicked() bool LLPanelPeople::isItemsFreeOfFriends(const uuid_vec_t& uuids) { const LLAvatarTracker& av_tracker = LLAvatarTracker::instance(); - for ( uuid_vec_t::const_iterator - id = uuids.begin(), - id_end = uuids.end(); - id != id_end; ++id ) + for (const LLUUID& uuid : uuids) { - if (av_tracker.isBuddy (*id)) + if (av_tracker.isBuddy(uuid)) { return false; } @@ -1479,15 +1477,8 @@ bool LLPanelPeople::notifyChildren(const LLSD& info) return LLPanel::notifyChildren(info); } -void LLPanelPeople::showAccordion(const std::string name, bool show) +void LLPanelPeople::showAccordion(LLAccordionCtrlTab* tab, bool show) { - if(name.empty()) - { - LL_WARNS() << "No name provided" << LL_ENDL; - return; - } - - LLAccordionCtrlTab* tab = getChild<LLAccordionCtrlTab>(name); tab->setVisible(show); if(show) { @@ -1505,12 +1496,11 @@ void LLPanelPeople::showFriendsAccordionsIfNeeded() if(FRIENDS_TAB_NAME == getActiveTabName()) { // Expand and show accordions if needed, else - hide them - showAccordion("tab_online", mOnlineFriendList->filterHasMatches()); - showAccordion("tab_all", mAllFriendList->filterHasMatches()); + showAccordion(mFriendsOnlineTab, mOnlineFriendList->filterHasMatches()); + showAccordion(mFriendsAllTab, mAllFriendList->filterHasMatches()); // Rearrange accordions - LLAccordionCtrl* accordion = getChild<LLAccordionCtrl>("friends_accordion"); - accordion->arrange(); + mFriendsAccordion->arrange(); // *TODO: new no_matched_tabs_text attribute was implemented in accordion (EXT-7368). // this code should be refactored to use it @@ -1523,11 +1513,11 @@ void LLPanelPeople::onFriendListRefreshComplete(LLUICtrl*ctrl, const LLSD& param { if(ctrl == mOnlineFriendList) { - showAccordion("tab_online", param.asInteger()); + showAccordion(mFriendsOnlineTab, param.asInteger()); } else if(ctrl == mAllFriendList) { - showAccordion("tab_all", param.asInteger()); + showAccordion(mFriendsAllTab, param.asInteger()); } } diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h index 445bc4c081..aef66db980 100644 --- a/indra/newview/llpanelpeople.h +++ b/indra/newview/llpanelpeople.h @@ -40,6 +40,8 @@ class LLGroupList; class LLMenuButton; class LLTabContainer; class LLNetMap; +class LLAccordionCtrl; +class LLAccordionCtrlTab; class LLPanelPeople : public LLPanel @@ -120,7 +122,7 @@ private: void onFriendsAccordionExpandedCollapsed(LLUICtrl* ctrl, const LLSD& param, LLAvatarList* avatar_list); - void showAccordion(const std::string name, bool show); + void showAccordion(LLAccordionCtrlTab* tab, bool show); void showFriendsAccordionsIfNeeded(); @@ -139,6 +141,10 @@ private: LLGroupList* mGroupList; LLNetMap* mMiniMap; + LLAccordionCtrl* mFriendsAccordion = nullptr; + LLAccordionCtrlTab* mFriendsAllTab = nullptr; + LLAccordionCtrlTab* mFriendsOnlineTab = nullptr; + LLButton* mNearbyGearBtn = nullptr; LLButton* mFriendsGearBtn = nullptr; LLButton* mRecentGearBtn = nullptr; diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index 620b7c8b2d..9a991727b2 100644 --- a/indra/newview/llpreviewnotecard.cpp +++ b/indra/newview/llpreviewnotecard.cpp @@ -67,8 +67,7 @@ // Default constructor LLPreviewNotecard::LLPreviewNotecard(const LLSD& key) //const LLUUID& item_id, - : LLPreview( key ), - mLiveFile(NULL) + : LLPreview( key ) { const LLInventoryItem *item = getItem(); if (item) @@ -88,24 +87,30 @@ bool LLPreviewNotecard::postBuild() mEditor->setNotecardInfo(mItemUUID, mObjectID, getKey()); mEditor->makePristine(); - childSetAction("Save", onClickSave, this); - getChildView("lock")->setVisible( false); + mSaveBtn = getChild<LLButton>("Save"); + mSaveBtn->setCommitCallback(boost::bind(&LLPreviewNotecard::saveIfNeeded, this, nullptr, true)); - childSetAction("Delete", onClickDelete, this); - getChildView("Delete")->setEnabled(false); + mLockBtn = getChild<LLUICtrl>("lock"); + mLockBtn->setVisible(false); - childSetAction("Edit", onClickEdit, this); + mDeleteBtn = getChild<LLButton>("Delete"); + mDeleteBtn->setCommitCallback(boost::bind(&LLPreviewNotecard::deleteNotecard, this)); + mDeleteBtn->setEnabled(false); + + mEditBtn = getChild<LLButton>("Edit"); + mEditBtn->setCommitCallback(boost::bind(&LLPreviewNotecard::openInExternalEditor, this)); const LLInventoryItem* item = getItem(); - childSetCommitCallback("desc", LLPreview::onText, this); + mDescEditor = getChild<LLLineEditor>("desc"); + mDescEditor->setCommitCallback(boost::bind(&LLPreview::onText, mDescEditor, this)); if (item) { - getChild<LLUICtrl>("desc")->setValue(item->getDescription()); + mDescEditor->setValue(item->getDescription()); bool source_library = mObjectUUID.isNull() && gInventory.isObjectDescendentOf(item->getUUID(), gInventory.getLibraryRootFolderID()); - getChildView("Delete")->setEnabled(!source_library); + mDeleteBtn->setEnabled(!source_library); } - getChild<LLLineEditor>("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe); + mDescEditor->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe); return LLPreview::postBuild(); } @@ -118,22 +123,30 @@ bool LLPreviewNotecard::saveItem() void LLPreviewNotecard::setEnabled(bool enabled) { - - LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); - - getChildView("Notecard Editor")->setEnabled(enabled); - getChildView("lock")->setVisible( !enabled); - getChildView("desc")->setEnabled(enabled); - getChildView("Save")->setEnabled(enabled && editor && (!editor->isPristine())); + if (mEditor) + { + mEditor->setEnabled(enabled); + } + if (mLockBtn) + { + mLockBtn->setVisible(!enabled); + } + if (mDescEditor) + { + mDescEditor->setEnabled(enabled); + } + if (mSaveBtn) + { + mSaveBtn->setEnabled(enabled && mEditor && (!mEditor->isPristine())); + } } void LLPreviewNotecard::draw() { - LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); - bool changed = !editor->isPristine(); + bool changed = !mEditor->isPristine(); - getChildView("Save")->setEnabled(changed && getEnabled()); + mSaveBtn->setEnabled(changed && getEnabled()); LLPreview::draw(); } @@ -153,9 +166,7 @@ bool LLPreviewNotecard::handleKeyHere(KEY key, MASK mask) // virtual bool LLPreviewNotecard::canClose() { - LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); - - if(mForceClose || editor->isPristine()) + if(mForceClose || mEditor->isPristine()) { return true; } @@ -176,28 +187,18 @@ void LLPreviewNotecard::setObjectID(const LLUUID& object_id) { LLPreview::setObjectID(object_id); - LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); - editor->setNotecardObjectID(mObjectUUID); - editor->makePristine(); + mEditor->setNotecardObjectID(mObjectUUID); + mEditor->makePristine(); } const LLInventoryItem* LLPreviewNotecard::getDragItem() { - LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); - - if(editor) - { - return editor->getDragItem(); - } - return NULL; + return mEditor->getDragItem(); } bool LLPreviewNotecard::hasEmbeddedInventory() { - LLViewerTextEditor* editor = NULL; - editor = getChild<LLViewerTextEditor>("Notecard Editor"); - if (!editor) return false; - return editor->hasEmbeddedInventory(); + return mEditor->hasEmbeddedInventory(); } void LLPreviewNotecard::refreshFromInventory(const LLUUID& new_item_id) @@ -215,10 +216,9 @@ void LLPreviewNotecard::updateTitleButtons() { LLPreview::updateTitleButtons(); - LLUICtrl* lock_btn = getChild<LLUICtrl>("lock"); - if(lock_btn->getVisible() && !isMinimized()) // lock button stays visible if floater is minimized. + if(mLockBtn && mLockBtn->getVisible() && !isMinimized()) // lock button stays visible if floater is minimized. { - LLRect lock_rc = lock_btn->getRect(); + LLRect lock_rc = mLockBtn->getRect(); LLRect buttons_rect = getDragHandle()->getButtonsRect(); buttons_rect.mLeft = lock_rc.mLeft; getDragHandle()->setButtonsRect(buttons_rect); @@ -229,11 +229,6 @@ void LLPreviewNotecard::loadAsset() { // request the asset. const LLInventoryItem* item = getItem(); - LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); - - if (!editor) - return; - bool fail = false; if(item) @@ -249,9 +244,9 @@ void LLPreviewNotecard::loadAsset() mAssetID = item->getAssetUUID(); if(mAssetID.isNull()) { - editor->setText(LLStringUtil::null); - editor->makePristine(); - editor->setEnabled(true); + mEditor->setText(LLStringUtil::null); + mEditor->makePristine(); + mEditor->setEnabled(true); mAssetStatus = PREVIEW_ASSET_LOADED; } else @@ -270,9 +265,9 @@ void LLPreviewNotecard::loadAsset() // The object that we're trying to look at disappeared, bail. LL_WARNS() << "Can't find object " << mObjectUUID << " associated with notecard." << LL_ENDL; mAssetID.setNull(); - editor->setText(getString("no_object")); - editor->makePristine(); - editor->setEnabled(false); + mEditor->setText(getString("no_object")); + mEditor->makePristine(); + mEditor->setEnabled(false); mAssetStatus = PREVIEW_ASSET_LOADED; return; } @@ -301,22 +296,22 @@ void LLPreviewNotecard::loadAsset() else { mAssetID.setNull(); - editor->setText(getString("not_allowed")); - editor->makePristine(); - editor->setEnabled(false); + mEditor->setText(getString("not_allowed")); + mEditor->makePristine(); + mEditor->setEnabled(false); mAssetStatus = PREVIEW_ASSET_LOADED; } if(!allow_modify) { - editor->setEnabled(false); - getChildView("lock")->setVisible( true); - getChildView("Edit")->setEnabled(false); + mEditor->setEnabled(false); + mLockBtn->setVisible( true); + mEditBtn->setEnabled(false); } if((allow_modify || is_owner) && !source_library) { - getChildView("Delete")->setEnabled(true); + mDeleteBtn->setEnabled(true); } } else if (mObjectUUID.notNull() && mItemUUID.notNull()) @@ -345,9 +340,9 @@ void LLPreviewNotecard::loadAsset() if (fail) { - editor->setText(LLStringUtil::null); - editor->makePristine(); - editor->setEnabled(true); + mEditor->setText(LLStringUtil::null); + mEditor->makePristine(); + mEditor->setEnabled(true); // Don't set asset status here; we may not have set the item id yet // (e.g. when this gets called initially) //mAssetStatus = PREVIEW_ASSET_LOADED; @@ -377,7 +372,7 @@ void LLPreviewNotecard::onLoadComplete(const LLUUID& asset_uuid, buffer[file_length] = 0; - LLViewerTextEditor* previewEditor = preview->getChild<LLViewerTextEditor>("Notecard Editor"); + LLViewerTextEditor* previewEditor = preview->mEditor; if( (file_length > 19) && !strncmp( &buffer[0], "Linden text version", 19 ) ) { @@ -421,38 +416,6 @@ void LLPreviewNotecard::onLoadComplete(const LLUUID& asset_uuid, delete floater_key; } -// static -void LLPreviewNotecard::onClickSave(void* user_data) -{ - //LL_INFOS() << "LLPreviewNotecard::onBtnSave()" << LL_ENDL; - LLPreviewNotecard* preview = (LLPreviewNotecard*)user_data; - if(preview) - { - preview->saveIfNeeded(); - } -} - - -// static -void LLPreviewNotecard::onClickDelete(void* user_data) -{ - LLPreviewNotecard* preview = (LLPreviewNotecard*)user_data; - if(preview) - { - preview->deleteNotecard(); - } -} - -// static -void LLPreviewNotecard::onClickEdit(void* user_data) -{ - LLPreviewNotecard* preview = (LLPreviewNotecard*)user_data; - if (preview) - { - preview->openInExternalEditor(); - } -} - struct LLSaveNotecardInfo { LLPreviewNotecard* mSelf; @@ -515,23 +478,15 @@ void LLPreviewNotecard::finishTaskUpload(LLUUID itemId, LLUUID newAssetId, LLUUI bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem, bool sync) { - LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); - - if(!editor) - { - LL_WARNS() << "Cannot get handle to the notecard editor." << LL_ENDL; - return false; - } - - if(!editor->isPristine()) + if(!mEditor->isPristine()) { std::string buffer; - if (!editor->exportBuffer(buffer)) + if (!mEditor->exportBuffer(buffer)) { return false; } - editor->makePristine(); + mEditor->makePristine(); const LLInventoryItem* item = getItem(); // save it out to database if (item) @@ -692,11 +647,7 @@ void LLPreviewNotecard::onSaveComplete(const LLUUID& asset_uuid, void* user_data // Perform item copy to inventory if (info->mCopyItem.notNull()) { - LLViewerTextEditor* editor = info->mSelf->getChild<LLViewerTextEditor>("Notecard Editor"); - if (editor) - { - editor->copyInventory(info->mCopyItem); - } + info->mSelf->mEditor->copyInventory(info->mCopyItem); } // Find our window and close it if requested. @@ -731,7 +682,7 @@ bool LLPreviewNotecard::handleSaveChangesDialog(const LLSD& notification, const { case 0: // "Yes" mCloseAfterSave = true; - LLPreviewNotecard::onClickSave((void*)this); + saveIfNeeded(); break; case 1: // "No" diff --git a/indra/newview/llpreviewnotecard.h b/indra/newview/llpreviewnotecard.h index db677b1cf9..be3c804f9b 100644 --- a/indra/newview/llpreviewnotecard.h +++ b/indra/newview/llpreviewnotecard.h @@ -41,6 +41,7 @@ class LLViewerTextEditor; class LLButton; +class LLLineEditor; class LLPreviewNotecard : public LLPreview, public LLVOInventoryListener { @@ -93,12 +94,6 @@ protected: LLAssetType::EType type, void* user_data, S32 status, LLExtStat ext_status); - static void onClickSave(void* data); - - static void onClickDelete(void* data); - - static void onClickEdit(void* data); - static void onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status); @@ -116,14 +111,18 @@ protected: std::string getTmpFileName(); protected: - LLViewerTextEditor* mEditor; - LLButton* mSaveBtn; + LLViewerTextEditor* mEditor = nullptr; + LLLineEditor* mDescEditor = nullptr; + LLButton* mSaveBtn = nullptr; + LLButton* mEditBtn = nullptr; + LLButton* mDeleteBtn = nullptr; + LLUICtrl* mLockBtn = nullptr; LLUUID mAssetID; LLUUID mObjectID; - LLLiveLSLFile* mLiveFile; + LLLiveLSLFile* mLiveFile = nullptr; }; diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index b7c929f0b5..02a4c7fb26 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -435,7 +435,7 @@ void LLLiveLSLEditor::experienceChanged() if(mScriptEd->getAssociatedExperience() != mExperiences->getSelectedValue().asUUID()) { mScriptEd->enableSave(getIsModifiable()); - //getChildView("Save_btn")->setEnabled(true); + //mSaveBtn->setEnabled(true); mScriptEd->setAssociatedExperience(mExperiences->getSelectedValue().asUUID()); updateExperiencePanel(); } @@ -481,6 +481,7 @@ void LLLiveLSLEditor::onToggleExperience( LLUICtrl *ui, void* userdata ) bool LLScriptEdCore::postBuild() { + mLineCol = getChild<LLTextBox>("line_col"); mErrorList = getChild<LLScrollListCtrl>("lsl errors"); mFunctions = getChild<LLComboBox>("Insert..."); @@ -490,7 +491,8 @@ bool LLScriptEdCore::postBuild() mEditor = getChild<LLScriptEditor>("Script Editor"); childSetCommitCallback("lsl errors", &LLScriptEdCore::onErrorList, this); - childSetAction("Save_btn", boost::bind(&LLScriptEdCore::doSave,this,false)); + mSaveBtn = getChild<LLButton>("Save_btn"); + mSaveBtn->setCommitCallback(boost::bind(&LLScriptEdCore::doSave, this, false)); childSetAction("Edit_btn", boost::bind(&LLScriptEdCore::openInExternalEditor, this)); initMenu(); @@ -711,7 +713,7 @@ bool LLScriptEdCore::hasChanged() void LLScriptEdCore::draw() { bool script_changed = hasChanged(); - getChildView("Save_btn")->setEnabled(script_changed && !mScriptRemoved); + mSaveBtn->setEnabled(script_changed && !mScriptRemoved); if( mEditor->hasFocus() ) { @@ -723,11 +725,11 @@ void LLScriptEdCore::draw() args["[LINE]"] = llformat ("%d", line); args["[COLUMN]"] = llformat ("%d", column); cursor_pos = LLTrans::getString("CursorPos", args); - getChild<LLUICtrl>("line_col")->setValue(cursor_pos); + mLineCol->setValue(cursor_pos); } else { - getChild<LLUICtrl>("line_col")->setValue(LLStringUtil::null); + mLineCol->setValue(LLStringUtil::null); } updateDynamicHelp(); diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index 9a3bc35f12..70ee1a4274 100644 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -195,6 +195,8 @@ private: bool mScriptRemoved; bool mSaveDialogShown; LLUUID mAssetID; + LLTextBox* mLineCol = nullptr; + LLButton* mSaveBtn = nullptr; LLScriptEdContainer* mContainer; // parent view diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 2a5d7f2450..1b657d9ea1 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -129,6 +129,10 @@ void LLPreviewTexture::populateRatioList() // virtual bool LLPreviewTexture::postBuild() { + mButtonsPanel = getChild<LLLayoutPanel>("buttons_panel"); + mDimensionsText = getChild<LLUICtrl>("dimensions"); + mAspectRatioText = getChild<LLUICtrl>("aspect_ratio"); + if (mCopyToInv) { getChild<LLButton>("Keep")->setLabel(getString("Copy")); @@ -346,15 +350,20 @@ void LLPreviewTexture::reshape(S32 width, S32 height, bool called_from_parent) { LLPreview::reshape(width, height, called_from_parent); - LLRect dim_rect(getChildView("dimensions")->getRect()); - S32 horiz_pad = 2 * (LLPANEL_BORDER_WIDTH + PREVIEW_PAD) + PREVIEW_RESIZE_HANDLE_SIZE; // add space for dimensions and aspect ratio - S32 info_height = dim_rect.mTop + CLIENT_RECT_VPAD; - if (getChild<LLLayoutPanel>("buttons_panel")->getVisible()) + S32 info_height = CLIENT_RECT_VPAD; + + if (mDimensionsText) + { + LLRect dim_rect(mDimensionsText->getRect()); + info_height += dim_rect.mTop; + } + + if (mButtonsPanel && mButtonsPanel->getVisible()) { - info_height += getChild<LLLayoutPanel>("buttons_panel")->getRect().getHeight(); + info_height += mButtonsPanel->getRect().getHeight(); } LLRect client_rect(horiz_pad, getRect().getHeight(), getRect().getWidth() - horiz_pad, 0); client_rect.mTop -= (PREVIEW_HEADER_SIZE + CLIENT_RECT_VPAD); @@ -404,8 +413,8 @@ void LLPreviewTexture::hideCtrlButtons() { getChildView("desc txt")->setVisible(false); getChildView("desc")->setVisible(false); - getChild<LLLayoutStack>("preview_stack")->collapsePanel(getChild<LLLayoutPanel>("buttons_panel"), true); - getChild<LLLayoutPanel>("buttons_panel")->setVisible(false); + getChild<LLLayoutStack>("preview_stack")->collapsePanel(mButtonsPanel, true); + mButtonsPanel->setVisible(false); getChild<LLComboBox>("combo_aspect_ratio")->setCurrentByIndex(0); //unconstrained reshape(getRect().getWidth(), getRect().getHeight()); } @@ -538,8 +547,8 @@ void LLPreviewTexture::updateDimensions() // Update the width/height display every time - getChild<LLUICtrl>("dimensions")->setTextArg("[WIDTH]", llformat("%d", img_width)); - getChild<LLUICtrl>("dimensions")->setTextArg("[HEIGHT]", llformat("%d", img_height)); + mDimensionsText->setTextArg("[WIDTH]", llformat("%d", img_width)); + mDimensionsText->setTextArg("[HEIGHT]", llformat("%d", img_height)); mLastHeight = img_height; mLastWidth = img_width; @@ -554,9 +563,9 @@ void LLPreviewTexture::updateDimensions() gFloaterView->adjustToFitScreen(this, false); - LLRect dim_rect(getChildView("dimensions")->getRect()); - LLRect aspect_label_rect(getChildView("aspect_ratio")->getRect()); - getChildView("aspect_ratio")->setVisible( dim_rect.mRight < aspect_label_rect.mLeft); + LLRect dim_rect(mDimensionsText->getRect()); + LLRect aspect_label_rect(mAspectRatioText->getRect()); + mAspectRatioText->setVisible( dim_rect.mRight < aspect_label_rect.mLeft); } } diff --git a/indra/newview/llpreviewtexture.h b/indra/newview/llpreviewtexture.h index e55d61ef10..44f3f07339 100644 --- a/indra/newview/llpreviewtexture.h +++ b/indra/newview/llpreviewtexture.h @@ -34,6 +34,7 @@ class LLComboBox; class LLImageRaw; +class LLLayoutPanel; class LLPreviewTexture : public LLPreview { @@ -105,5 +106,9 @@ private: LLLoadedCallbackEntry::source_callback_list_t mCallbackTextureList ; std::vector<std::string> mRatiosList; + + LLLayoutPanel* mButtonsPanel = nullptr; + LLUICtrl* mDimensionsText = nullptr; + LLUICtrl* mAspectRatioText = nullptr; }; #endif // LL_LLPREVIEWTEXTURE_H diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp index f75e48c728..44c2a8fdaf 100644 --- a/indra/newview/llscreenchannel.cpp +++ b/indra/newview/llscreenchannel.cpp @@ -55,12 +55,12 @@ LLRect LLScreenChannelBase::getChannelRect() if (mFloaterSnapRegion == NULL) { - mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region"); + mFloaterSnapRegion = gViewerWindow->getFloaterSnapRegion(); } if (mChicletRegion == NULL) { - mChicletRegion = gViewerWindow->getRootView()->getChildView("chiclet_container"); + mChicletRegion = gViewerWindow->getChicletContainer(); } LLRect channel_rect; @@ -103,12 +103,12 @@ bool LLScreenChannelBase::postBuild() { if (mFloaterSnapRegion == NULL) { - mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region"); + mFloaterSnapRegion = gViewerWindow->getFloaterSnapRegion(); } if (mChicletRegion == NULL) { - mChicletRegion = gViewerWindow->getRootView()->getChildView("chiclet_container"); + mChicletRegion = gViewerWindow->getChicletContainer(); } return true; diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp index e5a61b359d..9eaee2e326 100644 --- a/indra/newview/lltextureview.cpp +++ b/indra/newview/lltextureview.cpp @@ -415,12 +415,14 @@ void LLAvatarTexBar::draw() text_color, LLFontGL::LEFT, LLFontGL::TOP); //, LLFontGL::BOLD, LLFontGL::DROP_SHADOW_SOFT); line_num++; } + const U32 texture_timeout = gSavedSettings.getU32("AvatarBakedTextureUploadTimeout"); const U32 override_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel"); LLColor4 header_color(1.f, 1.f, 1.f, 0.9f); + const std::string texture_timeout_str = texture_timeout ? llformat("%d", texture_timeout) : "Disabled"; const std::string override_tex_discard_level_str = override_tex_discard_level ? llformat("%d",override_tex_discard_level) : "Disabled"; - std::string header_text = llformat("[ Timeout:60 ] [ LOD_Override('TextureDiscardLevel'):%s ]", override_tex_discard_level_str.c_str()); + std::string header_text = llformat("[ Timeout('AvatarBakedTextureUploadTimeout'):%s ] [ LOD_Override('TextureDiscardLevel'):%s ]", texture_timeout_str.c_str(), override_tex_discard_level_str.c_str()); LLFontGL::getFontMonospace()->renderUTF8(header_text, 0, l_offset, v_offset + line_height*line_num, header_color, LLFontGL::LEFT, LLFontGL::TOP); //, LLFontGL::BOLD, LLFontGL::DROP_SHADOW_SOFT); line_num++; diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp index b74b48b9f6..7ef2c8d697 100644 --- a/indra/newview/llviewerassetupload.cpp +++ b/indra/newview/llviewerassetupload.cpp @@ -984,6 +984,7 @@ void LLViewerAssetUpload::HandleUploadError(LLCore::HttpStatus status, LLSD &res label = result["label"].asString(); } + LLFloaterSnapshot* floater_snapshot = LLFloaterSnapshot::findInstance(); if (result.has("message")) { reason = result["message"].asString(); @@ -994,6 +995,12 @@ void LLViewerAssetUpload::HandleUploadError(LLCore::HttpStatus status, LLSD &res { case 404: reason = LLTrans::getString("AssetUploadServerUnreacheble"); + if (floater_snapshot + && floater_snapshot->isWaitingState() + && uploadInfo->getAssetType() == LLAssetType::AT_IMAGE_JPEG) + { + label = "CannotUploadSnapshotEmailTooBig"; + } break; case 499: reason = LLTrans::getString("AssetUploadServerDifficulties"); @@ -1030,7 +1037,6 @@ void LLViewerAssetUpload::HandleUploadError(LLCore::HttpStatus status, LLSD &res // Todo: move these floater specific actions into proper callbacks // Let the Snapshot floater know we have failed uploading. - LLFloaterSnapshot* floater_snapshot = LLFloaterSnapshot::findInstance(); if (floater_snapshot && floater_snapshot->isWaitingState()) { if (uploadInfo->getAssetType() == LLAssetType::AT_IMAGE_JPEG) diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 529d6f97ca..97d5781566 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -10125,7 +10125,6 @@ void initialize_menus() commit.add("Object.Buy", boost::bind(&handle_buy)); commit.add("Object.Edit", boost::bind(&handle_object_edit)); - commit.add("Object.Edit", boost::bind(&handle_object_edit)); commit.add("Object.EditGLTFMaterial", boost::bind(&handle_object_edit_gltf_material)); commit.add("Object.Inspect", boost::bind(&handle_object_inspect)); commit.add("Object.Open", boost::bind(&handle_object_open)); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index b13ccda5e0..8ea8fbf905 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2064,6 +2064,9 @@ void LLViewerWindow::initBase() mPopupView = main_view->getChild<LLPopupView>("popup_holder"); mHintHolder = main_view->getChild<LLView>("hint_holder")->getHandle(); mLoginPanelHolder = main_view->getChild<LLView>("login_panel_holder")->getHandle(); + mStatusBarContainer = main_view->getChild<LLPanel>("status_bar_container"); + mNavBarContainer = mStatusBarContainer->getChild<LLView>("nav_bar_container"); + mTopInfoContainer = main_view->getChild<LLPanel>("topinfo_bar_container"); // Create the toolbar view // Get a pointer to the toolbar view holder @@ -2079,6 +2082,8 @@ void LLViewerWindow::initBase() // Hide the toolbars for the moment: we'll make them visible after logging in world (see LLViewerWindow::initWorldUI()) gToolBarView->setVisible(false); + mFloaterSnapRegion = gToolBarView->getChild<LLView>("floater_snap_region"); + mChicletContainer = gToolBarView->getChild<LLPanel>("chiclet_container"); // Constrain floaters to inside the menu and status bar regions. gFloaterView = main_view->getChild<LLFloaterView>("Floater View"); for (S32 i = 0; i < LLToolBarEnums::TOOLBAR_COUNT; ++i) @@ -2089,7 +2094,7 @@ void LLViewerWindow::initBase() toolbarp->getCenterLayoutPanel()->setReshapeCallback(boost::bind(&LLFloaterView::setToolbarRect, gFloaterView, _1, _2)); } } - gFloaterView->setFloaterSnapView(main_view->getChild<LLView>("floater_snap_region")->getHandle()); + gFloaterView->setFloaterSnapView(mFloaterSnapRegion->getHandle()); gSnapshotFloaterView = main_view->getChild<LLSnapshotFloaterView>("Snapshot Floater View"); const F32 CHAT_PERSIST_TIME = 20.f; @@ -2155,12 +2160,11 @@ void LLViewerWindow::initWorldUI() if (!gNonInteractive) { - LLPanel* chiclet_container = getRootView()->getChild<LLPanel>("chiclet_container"); LLChicletBar* chiclet_bar = LLChicletBar::getInstance(); - chiclet_bar->setShape(chiclet_container->getLocalRect()); + chiclet_bar->setShape(mChicletContainer->getLocalRect()); chiclet_bar->setFollowsAll(); - chiclet_container->addChild(chiclet_bar); - chiclet_container->setVisible(true); + mChicletContainer->addChild(chiclet_bar); + mChicletContainer->setVisible(true); } LLRect morph_view_rect = full_window; @@ -2185,30 +2189,25 @@ void LLViewerWindow::initWorldUI() if (!gStatusBar) { // Status bar - LLPanel* status_bar_container = getRootView()->getChild<LLPanel>("status_bar_container"); - gStatusBar = new LLStatusBar(status_bar_container->getLocalRect()); + gStatusBar = new LLStatusBar(mStatusBarContainer->getLocalRect()); gStatusBar->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP | FOLLOWS_RIGHT); - gStatusBar->setShape(status_bar_container->getLocalRect()); + gStatusBar->setShape(mStatusBarContainer->getLocalRect()); // sync bg color with menu bar gStatusBar->setBackgroundColor(gMenuBarView->getBackgroundColor()); // add InBack so that gStatusBar won't be drawn over menu - status_bar_container->addChildInBack(gStatusBar, 2/*tab order, after menu*/); - status_bar_container->setVisible(true); + mStatusBarContainer->addChildInBack(gStatusBar, 2/*tab order, after menu*/); + mStatusBarContainer->setVisible(true); // Navigation bar - LLView* nav_bar_container = getRootView()->getChild<LLView>("nav_bar_container"); - - navbar->setShape(nav_bar_container->getLocalRect()); + navbar->setShape(mNavBarContainer->getLocalRect()); navbar->setBackgroundColor(gMenuBarView->getBackgroundColor()); - nav_bar_container->addChild(navbar); - nav_bar_container->setVisible(true); + mNavBarContainer->addChild(navbar); + mNavBarContainer->setVisible(true); } else { - LLPanel* status_bar_container = getRootView()->getChild<LLPanel>("status_bar_container"); - LLView* nav_bar_container = getRootView()->getChild<LLView>("nav_bar_container"); - status_bar_container->setVisible(true); - nav_bar_container->setVisible(true); + mStatusBarContainer->setVisible(true); + mNavBarContainer->setVisible(true); } if (!gSavedSettings.getBOOL("ShowNavbarNavigationPanel")) @@ -2222,13 +2221,11 @@ void LLViewerWindow::initWorldUI() // Top Info bar - LLPanel* topinfo_bar_container = getRootView()->getChild<LLPanel>("topinfo_bar_container"); LLPanelTopInfoBar* topinfo_bar = LLPanelTopInfoBar::getInstance(); + topinfo_bar->setShape(mTopInfoContainer->getLocalRect()); - topinfo_bar->setShape(topinfo_bar_container->getLocalRect()); - - topinfo_bar_container->addChild(topinfo_bar); - topinfo_bar_container->setVisible(true); + mTopInfoContainer->addChild(topinfo_bar); + mTopInfoContainer->setVisible(true); if (!gSavedSettings.getBOOL("ShowMiniLocationPanel")) { @@ -2248,7 +2245,7 @@ void LLViewerWindow::initWorldUI() getRootView()->sendChildToBack(gHUDView); } - LLPanel* panel_ssf_container = getRootView()->getChild<LLPanel>("state_management_buttons_container"); + LLPanel* panel_ssf_container = gToolBarView->getChild<LLPanel>("state_management_buttons_container"); LLPanelStandStopFlying* panel_stand_stop_flying = LLPanelStandStopFlying::getInstance(); panel_ssf_container->addChild(panel_stand_stop_flying); @@ -2571,12 +2568,11 @@ void LLViewerWindow::setNormalControlsVisible( bool visible ) gStatusBar->setEnabled( visible ); } - LLNavigationBar* navbarp = LLUI::getInstance()->getRootView()->findChild<LLNavigationBar>("navigation_bar"); - if (navbarp) + if (mNavBarContainer) { // when it's time to show navigation bar we need to ensure that the user wants to see it // i.e. ShowNavbarNavigationPanel option is true - navbarp->setVisible( visible && gSavedSettings.getBOOL("ShowNavbarNavigationPanel") ); + mNavBarContainer->setVisible( visible && gSavedSettings.getBOOL("ShowNavbarNavigationPanel") ); } } @@ -5954,23 +5950,20 @@ LLRect LLViewerWindow::getChatConsoleRect() void LLViewerWindow::reshapeStatusBarContainer() { - LLPanel* status_bar_container = getRootView()->getChild<LLPanel>("status_bar_container"); - LLView* nav_bar_container = getRootView()->getChild<LLView>("nav_bar_container"); - - S32 new_height = status_bar_container->getRect().getHeight(); - S32 new_width = status_bar_container->getRect().getWidth(); + S32 new_height = mStatusBarContainer->getRect().getHeight(); + S32 new_width = mStatusBarContainer->getRect().getWidth(); if (gSavedSettings.getBOOL("ShowNavbarNavigationPanel")) { // Navigation bar is outside visible area, expand status_bar_container to show it - new_height += nav_bar_container->getRect().getHeight(); + new_height += mNavBarContainer->getRect().getHeight(); } else { // collapse status_bar_container - new_height -= nav_bar_container->getRect().getHeight(); + new_height -= mNavBarContainer->getRect().getHeight(); } - status_bar_container->reshape(new_width, new_height, true); + mStatusBarContainer->reshape(new_width, new_height, true); } void LLViewerWindow::resetStatusBarContainer() @@ -5979,12 +5972,10 @@ void LLViewerWindow::resetStatusBarContainer() if (gSavedSettings.getBOOL("ShowNavbarNavigationPanel") || navbar->getVisible()) { // was previously showing navigation bar - LLView* nav_bar_container = getRootView()->getChild<LLView>("nav_bar_container"); - LLPanel* status_bar_container = getRootView()->getChild<LLPanel>("status_bar_container"); - S32 new_height = status_bar_container->getRect().getHeight(); - S32 new_width = status_bar_container->getRect().getWidth(); - new_height -= nav_bar_container->getRect().getHeight(); - status_bar_container->reshape(new_width, new_height, true); + S32 new_height = mStatusBarContainer->getRect().getHeight(); + S32 new_width = mStatusBarContainer->getRect().getWidth(); + new_height -= mNavBarContainer->getRect().getHeight(); + mStatusBarContainer->reshape(new_width, new_height, true); } } //---------------------------------------------------------------------------- @@ -6011,7 +6002,7 @@ void LLViewerWindow::setUIVisibility(bool visible) LLNavigationBar::getInstance()->setVisible(visible ? gSavedSettings.getBOOL("ShowNavbarNavigationPanel") : false); LLPanelTopInfoBar::getInstance()->setVisible(visible? gSavedSettings.getBOOL("ShowMiniLocationPanel") : false); - mRootView->getChildView("status_bar_container")->setVisible(visible); + mStatusBarContainer->setVisible(visible); } bool LLViewerWindow::getUIVisibility() diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index ba59ce4141..395d8c78da 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -463,6 +463,9 @@ public: static std::string getLastSnapshotDir(); + LLView* getFloaterSnapRegion() { return mFloaterSnapRegion; } + LLPanel* getChicletContainer() { return mChicletContainer; } + private: bool shouldShowToolTipFor(LLMouseHandler *mh); @@ -491,6 +494,11 @@ private: LLRect mWorldViewRectRaw; // area of screen for 3D world LLRect mWorldViewRectScaled; // area of screen for 3D world scaled by UI size LLRootView* mRootView; // a view of size mWindowRectRaw, containing all child views + LLView* mFloaterSnapRegion = nullptr; + LLView* mNavBarContainer = nullptr; + LLPanel* mStatusBarContainer = nullptr; + LLPanel* mChicletContainer = nullptr; + LLPanel* mTopInfoContainer = nullptr; LLVector2 mDisplayScale; LLCoordGL mCurrentMousePoint; // last mouse position in GL coords diff --git a/indra/newview/llwebprofile.cpp b/indra/newview/llwebprofile.cpp index 83e417633a..feb5ecb1fb 100644 --- a/indra/newview/llwebprofile.cpp +++ b/indra/newview/llwebprofile.cpp @@ -38,6 +38,7 @@ // newview #include "llavataractions.h" // for getProfileURL() #include "llviewermedia.h" // FIXME: don't use LLViewerMedia internals +#include "llnotificationsutil.h" #include "llcorehttputil.h" @@ -132,6 +133,10 @@ void LLWebProfile::uploadImageCoro(LLPointer<LLImageFormatted> image, std::strin if (!status) { + if (image->getDataSize() > MAX_WEB_DATASIZE) + { + LLNotificationsUtil::add("CannotUploadSnapshotWebTooBig"); + } LL_WARNS("Snapshots") << "Failed to get image upload config" << LL_ENDL; LLWebProfile::reportImageUploadStatus(false); return; diff --git a/indra/newview/llwebprofile.h b/indra/newview/llwebprofile.h index 335282bf13..a9cfa102c0 100644 --- a/indra/newview/llwebprofile.h +++ b/indra/newview/llwebprofile.h @@ -57,6 +57,8 @@ public: static void setAuthCookie(const std::string& cookie); static void setImageUploadResultCallback(status_callback_t cb) { mStatusCallback = cb; } + static constexpr S32 MAX_WEB_DATASIZE = 8 * 1024 * 1024; // 8MB + private: static LLCore::HttpHeaders::ptr_t buildDefaultHeaders(); diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 91b137b75f..e539388735 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -2388,6 +2388,26 @@ Unable to upload [FILE] due to the following reason: [REASON] Please try again later. <tag>fail</tag> </notification> + + <notification + icon="alertmodal.tga" + name="CannotUploadSnapshotEmailTooBig" + type="alertmodal"> +Unable to upload snapshot [FILE] due to the following reason: [REASON] + +File might be too big, try reducing resolution, quality or try again later. + <tag>fail</tag> + </notification> + + <notification + icon="alertmodal.tga" + name="CannotUploadSnapshotWebTooBig" + type="alertmodal"> +Unable to upload snapshot. + +File might be too big, try reducing resolution or try again later. + <tag>fail</tag> + </notification> <notification icon="notifytip.tga" diff --git a/indra/newview/skins/default/xui/en/panel_preferences_alerts.xml b/indra/newview/skins/default/xui/en/panel_preferences_alerts.xml index fb528bf98f..425cbb6f44 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_alerts.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_alerts.xml @@ -69,7 +69,6 @@ sort_ascending="true" width="495" /> <button - enabled_control="FirstSelectedDisabledPopups" follows="top|left" height="23" image_overlay="Arrow_Up" @@ -83,7 +82,6 @@ function="Pref.ClickEnablePopup" /> </button> <button - enabled_control="FirstSelectedEnabledPopups" follows="top|left" height="23" image_overlay="Arrow_Down" |