From d712dde69e29381ab1bf55f27c41bb3b29ef3b59 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Fri, 5 Aug 2011 11:05:48 -0700 Subject: SH-2218 FIX -- v2.8.x Viewers crash consistently when I actively use other applications * Mac memory stats now extracted from proper system calls. Reviewed by Nat Linden. --- indra/llcommon/llsys.cpp | 248 ++++++++++++++--------------------------------- 1 file changed, 72 insertions(+), 176 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 99e61433c6..37733cf9ad 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -68,9 +68,11 @@ using namespace llsd; # include # include # include -# include -# include # include +# include +# include +# include +# include #elif LL_LINUX # include # include @@ -990,194 +992,88 @@ LLSD LLMemoryInfo::loadStatsMap() stats.add("PrivateUsage KB", pmem.PrivateUsage/1024); #elif LL_DARWIN - uint64_t phys = 0; - - size_t len = sizeof(phys); - if (sysctlbyname("hw.memsize", &phys, &len, NULL, 0) == 0) - { - stats.add("Total Physical KB", phys/1024); - } - else - { - LL_WARNS("LLMemoryInfo") << "Unable to collect hw.memsize memory information" << LL_ENDL; - } - - FILE* pout = popen("vm_stat 2>&1", "r"); - if (! pout) // popen() couldn't run vm_stat + const vm_size_t pagekb(vm_page_size / 1024); + + // + // Collect the vm_stat's + // + { - // Save errno right away. - int popen_errno(errno); - LL_WARNS("LLMemoryInfo") << "Unable to collect vm_stat memory information: "; - char buffer[256]; - if (0 == strerror_r(popen_errno, buffer, sizeof(buffer))) + vm_statistics_data_t vmstat; + mach_msg_type_number_t vmstatCount = HOST_VM_INFO_COUNT; + + if (host_statistics(mach_host_self(), HOST_VM_INFO, (host_info_t) &vmstat, &vmstatCount) != KERN_SUCCESS) { - LL_CONT << buffer; + LL_WARNS("LLMemoryInfo") << "Unable to collect memory information" << LL_ENDL; } else { - LL_CONT << "errno " << popen_errno; + stats.add("Pages free KB", pagekb * vmstat.free_count); + stats.add("Pages active KB", pagekb * vmstat.active_count); + stats.add("Pages inactive KB", pagekb * vmstat.inactive_count); + stats.add("Pages wired KB", pagekb * vmstat.wire_count); + + stats.add("Pages zero fill", vmstat.zero_fill_count); + stats.add("Page reactivations", vmstat.reactivations); + stats.add("Page-ins", vmstat.pageins); + stats.add("Page-outs", vmstat.pageouts); + + stats.add("Faults", vmstat.faults); + stats.add("Faults copy-on-write", vmstat.cow_faults); + + stats.add("Cache lookups", vmstat.lookups); + stats.add("Cache hits", vmstat.hits); + + stats.add("Page purgeable count", vmstat.purgeable_count); + stats.add("Page purges", vmstat.purges); + + stats.add("Page speculative reads", vmstat.speculative_count); } - LL_CONT << LL_ENDL; } - else // popen() launched vm_stat + + // + // Collect the misc task info + // + { - // Mach Virtual Memory Statistics: (page size of 4096 bytes) - // Pages free: 462078. - // Pages active: 142010. - // Pages inactive: 220007. - // Pages wired down: 159552. - // "Translation faults": 220825184. - // Pages copy-on-write: 2104153. - // Pages zero filled: 167034876. - // Pages reactivated: 65153. - // Pageins: 2097212. - // Pageouts: 41759. - // Object cache: 841598 hits of 7629869 lookups (11% hit rate) - - // Intentionally don't pass the boost::no_except flag. These - // boost::regex objects are constructed with string literals, so they - // should be valid every time. If they become invalid, we WANT an - // exception, hopefully even before the dev checks in. - boost::regex pagesize_rx("\\(page size of ([0-9]+) bytes\\)"); - boost::regex stat_rx("(.+): +([0-9]+)\\."); - boost::regex cache_rx("Object cache: ([0-9]+) hits of ([0-9]+) lookups " - "\\(([0-9]+)% hit rate\\)"); - boost::cmatch matched; - LLSD::Integer pagesizekb(4096/1024); - - // Here 'pout' is vm_stat's stdout. Search it for relevant data. - char line[100]; - line[sizeof(line)-1] = '\0'; - while (fgets(line, sizeof(line)-1, pout)) + task_events_info_data_t taskinfo; + unsigned taskinfoSize = sizeof(taskinfo); + + if (task_info(mach_task_self(), TASK_EVENTS_INFO, (task_info_t) &taskinfo, &taskinfoSize) != KERN_SUCCESS) { - size_t linelen(strlen(line)); - // Truncate any trailing newline - if (line[linelen - 1] == '\n') - { - line[--linelen] = '\0'; - } - LL_DEBUGS("LLMemoryInfo") << line << LL_ENDL; - if (regex_search_no_exc(line, matched, pagesize_rx)) - { - // "Mach Virtual Memory Statistics: (page size of 4096 bytes)" - std::string pagesize_str(matched[1].first, matched[1].second); - try - { - // Reasonable to assume that pagesize will always be a - // multiple of 1Kb? - pagesizekb = boost::lexical_cast(pagesize_str)/1024; - } - catch (const boost::bad_lexical_cast&) - { - LL_WARNS("LLMemoryInfo") << "couldn't parse '" << pagesize_str - << "' in vm_stat line: " << line << LL_ENDL; - continue; - } - stats.add("page size", pagesizekb); - } - else if (regex_match_no_exc(line, matched, stat_rx)) - { - // e.g. "Pages free: 462078." - // Strip double-quotes off certain statistic names - const char *key_begin(matched[1].first), *key_end(matched[1].second); - if (key_begin[0] == '"' && key_end[-1] == '"') - { - ++key_begin; - --key_end; - } - LLSD::String key(key_begin, key_end); - LLSD::String value_str(matched[2].first, matched[2].second); - LLSD::Integer value(0); - try - { - value = boost::lexical_cast(value_str); - } - catch (const boost::bad_lexical_cast&) - { - LL_WARNS("LLMemoryInfo") << "couldn't parse '" << value_str - << "' in vm_stat line: " << line << LL_ENDL; - continue; - } - // Store this statistic. - stats.add(key, value); - // Is this in units of pages? If so, convert to Kb. - static const LLSD::String pages("Pages "); - if (key.substr(0, pages.length()) == pages) - { - // Synthesize a new key with kb in place of Pages - LLSD::String kbkey("kb "); - kbkey.append(key.substr(pages.length())); - stats.add(kbkey, value * pagesizekb); - } - } - else if (regex_match_no_exc(line, matched, cache_rx)) - { - // e.g. "Object cache: 841598 hits of 7629869 lookups (11% hit rate)" - static const char* cache_keys[] = { "cache hits", "cache lookups", "cache hit%" }; - std::vector cache_values; - for (size_t i = 0; i < (sizeof(cache_keys)/sizeof(cache_keys[0])); ++i) - { - LLSD::String value_str(matched[i+1].first, matched[i+1].second); - LLSD::Integer value(0); - try - { - value = boost::lexical_cast(value_str); - } - catch (boost::bad_lexical_cast&) - { - LL_WARNS("LLMemoryInfo") << "couldn't parse '" << value_str - << "' in vm_stat line: " << line << LL_ENDL; - continue; - } - stats.add(cache_keys[i], value); - } - } - else - { - LL_WARNS("LLMemoryInfo") << "unrecognized vm_stat line: " << line << LL_ENDL; - } + LL_WARNS("LLMemoryInfo") << "Unable to collect task information" << LL_ENDL; } - int status(pclose(pout)); - if (status == -1) // pclose() couldn't retrieve rc + else { - // Save errno right away. - int pclose_errno(errno); - // The ECHILD error happens so frequently that unless filtered, - // the warning below spams the log file. This is too bad, because - // sometimes the logic above fails to produce any output derived - // from vm_stat, but we've been unable to observe any specific - // error indicating the problem. - if (pclose_errno != ECHILD) - { - LL_WARNS("LLMemoryInfo") << "Unable to obtain vm_stat termination code: "; - char buffer[256]; - if (0 == strerror_r(pclose_errno, buffer, sizeof(buffer))) - { - LL_CONT << buffer; - } - else - { - LL_CONT << "errno " << pclose_errno; - } - LL_CONT << LL_ENDL; - } + stats.add("Task page-ins", taskinfo.pageins); + stats.add("Task copy-on-write faults", taskinfo.cow_faults); + stats.add("Task messages sent", taskinfo.messages_sent); + stats.add("Task messages received", taskinfo.messages_received); + stats.add("Task mach system call count", taskinfo.syscalls_mach); + stats.add("Task unix system call count", taskinfo.syscalls_unix); + stats.add("Task context switch count", taskinfo.csw); } - else // pclose() retrieved rc; analyze + } + + // + // Collect the basic task info + // + + { + task_basic_info_64_data_t taskinfo; + unsigned taskinfoSize = sizeof(taskinfo); + + if (task_info(mach_task_self(), TASK_BASIC_INFO_64, (task_info_t) &taskinfo, &taskinfoSize) != KERN_SUCCESS) { - if (WIFEXITED(status)) - { - int rc(WEXITSTATUS(status)); - if (rc != 0) - { - LL_WARNS("LLMemoryInfo") << "vm_stat terminated with rc " << rc << LL_ENDL; - } - } - else if (WIFSIGNALED(status)) - { - LL_WARNS("LLMemoryInfo") << "vm_stat terminated by signal " << WTERMSIG(status) - << LL_ENDL; - } + LL_WARNS("LLMemoryInfo") << "Unable to collect task information" << LL_ENDL; + } + else + { + stats.add("Basic suspend count", taskinfo.suspend_count); + stats.add("Basic virtual memory KB", taskinfo.virtual_size / 1024); + stats.add("Basic resident memory KB", taskinfo.resident_size / 1024); + stats.add("Basic new thread policy", taskinfo.policy); } } -- cgit v1.2.3 From f5886bfaff0385acf0a55bc1b8678330ae89442a Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 8 Aug 2011 14:37:36 -0700 Subject: EXP-1065 FIX Inventory has slowed to a crawl. Clicking between items has an average one second delay. Same with switching between tabs. disable traversal of inventory contents for findView family of functions --- indra/newview/llfolderview.cpp | 12 ++---------- indra/newview/llfolderview.h | 1 - indra/newview/llfolderviewitem.h | 2 ++ indra/newview/llinventorypanel.cpp | 4 +--- 4 files changed, 5 insertions(+), 14 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index 7581fa91c5..02be477e0d 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -369,16 +369,6 @@ void LLFolderView::closeAllFolders() arrangeAll(); } -void LLFolderView::openFolder(const std::string& foldername) -{ - LLFolderViewFolder* inv = findChild(foldername); - if (inv) - { - setSelection(inv, FALSE, FALSE); - inv->setOpen(TRUE); - } -} - void LLFolderView::openTopLevelFolders() { for (folders_t::iterator iter = mFolders.begin(); @@ -720,8 +710,10 @@ void LLFolderView::extendSelection(LLFolderViewItem* selection, LLFolderViewItem mSignalSelectCallback = SIGNAL_KEYBOARD_FOCUS; } +static LLFastTimer::DeclareTimer FTM_SANITIZE_SELECTION("Sanitize Selection"); void LLFolderView::sanitizeSelection() { + LLFastTimer _(FTM_SANITIZE_SELECTION); // store off current item in case it is automatically deselected // and we want to preserve context LLFolderViewItem* original_selected_item = getCurSelectedItem(); diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h index 0b92548fd0..705a76a7b4 100644 --- a/indra/newview/llfolderview.h +++ b/indra/newview/llfolderview.h @@ -108,7 +108,6 @@ public: // Close all folders in the view void closeAllFolders(); - void openFolder(const std::string& foldername); void openTopLevelFolders(); virtual void toggleOpen() {}; diff --git a/indra/newview/llfolderviewitem.h b/indra/newview/llfolderviewitem.h index f70e63ecdf..dac0c3032c 100644 --- a/indra/newview/llfolderviewitem.h +++ b/indra/newview/llfolderviewitem.h @@ -328,6 +328,8 @@ public: virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask ); virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); + virtual LLView* findChildView(const std::string& name, BOOL recurse) const { return NULL; } + // virtual void handleDropped(); virtual void draw(); virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index d5d40ca65d..1aa402802e 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -812,9 +812,7 @@ void LLInventoryPanel::openStartFolderOrMyInventory() && fchild->getListener() && fchild->getListener()->getUUID() == gInventory.getRootFolderID()) { - const std::string& child_name = child->getName(); - mFolderRoot->openFolder(child_name); - mFolderRoot->clearSelection(); // No need to keep it selected though! + fchild->setOpen(TRUE); break; } } -- cgit v1.2.3 From b6685b5872a4afe976f39d201868b8d656044e84 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Mon, 8 Aug 2011 15:13:53 -0700 Subject: EXP-1065 FIX -- Inventory has slowed to a crawl. Clicking between items has an average one second delay. Same with switching between tabs. * Removed numerous places in the code that called findChild across the inventory panel unnecessarily. * Conglomerated uses of inbox and outbox inventory panels to the sidepanel class so the pointers can be cached and functionality like selection handling can be done more efficiently. * Optimized LLView::childHasKeyboardFocus() to work backwards up from the focus object rather than searching for children that may or may not turn out to have focus. Reviewed by Richard. --- indra/llui/llview.cpp | 18 +++--- indra/newview/llavataractions.cpp | 8 +-- indra/newview/llfloaterworldmap.cpp | 46 ++++++++------- indra/newview/llfloaterworldmap.h | 5 ++ indra/newview/llpanelmaininventory.cpp | 20 ++----- indra/newview/llpanelmarketplaceinbox.cpp | 23 ++------ indra/newview/llpanelmarketplaceinbox.h | 2 +- indra/newview/llpanelmarketplaceoutbox.cpp | 25 ++------ indra/newview/llpanelmarketplaceoutbox.h | 2 +- indra/newview/llsidepanelinventory.cpp | 92 ++++++++++++++++++++++-------- indra/newview/llsidepanelinventory.h | 5 ++ 11 files changed, 132 insertions(+), 114 deletions(-) (limited to 'indra') diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 8803d106ba..659a54cc6e 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -1655,15 +1655,19 @@ BOOL LLView::hasAncestor(const LLView* parentp) const BOOL LLView::childHasKeyboardFocus( const std::string& childname ) const { - LLView *child = findChildView(childname, TRUE); - if (child) - { - return gFocusMgr.childHasKeyboardFocus(child); - } - else + LLView *focus = dynamic_cast(gFocusMgr.getKeyboardFocus()); + + while (focus != NULL) { - return FALSE; + if (focus->getName() == childname) + { + return TRUE; + } + + focus = focus->getParent(); } + + return FALSE; } //----------------------------------------------------------------------------- diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index f22b02093f..48edecc89c 100755 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -697,12 +697,8 @@ std::set LLAvatarActions::getInventorySelectedUUIDs() if (inventory_selected_uuids.empty()) { LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel("sidepanel_inventory"); - LLInventoryPanel * inbox = sidepanel_inventory->findChild("inventory_inbox"); - if (inbox) - { - inventory_selected_uuids = inbox->getRootFolder()->getSelectionList(); - } - + + inventory_selected_uuids = sidepanel_inventory->getInboxOrOutboxSelectionList(); } return inventory_selected_uuids; diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index d5f0648f3b..8e11d71048 100755 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -237,16 +237,19 @@ const LLUUID LLFloaterWorldMap::sHomeID( "10000000-0000-0000-0000-000000000001" LLFloaterWorldMap::LLFloaterWorldMap(const LLSD& key) : LLFloater(key), -mInventory(NULL), -mInventoryObserver(NULL), -mFriendObserver(NULL), -mCompletingRegionName(), -mCompletingRegionPos(), -mWaitingForTracker(FALSE), -mIsClosing(FALSE), -mSetToUserPosition(TRUE), -mTrackedLocation(0,0,0), -mTrackedStatus(LLTracker::TRACKING_NOTHING) + mInventory(NULL), + mInventoryObserver(NULL), + mFriendObserver(NULL), + mCompletingRegionName(), + mCompletingRegionPos(), + mWaitingForTracker(FALSE), + mIsClosing(FALSE), + mSetToUserPosition(TRUE), + mTrackedLocation(0,0,0), + mTrackedStatus(LLTracker::TRACKING_NOTHING), + mListFriendCombo(NULL), + mListLandmarkCombo(NULL), + mListSearchResults(NULL) { gFloaterWorldMap = this; @@ -281,17 +284,20 @@ BOOL LLFloaterWorldMap::postBuild() avatar_combo->selectFirstItem(); avatar_combo->setPrearrangeCallback( boost::bind(&LLFloaterWorldMap::onAvatarComboPrearrange, this) ); avatar_combo->setTextEntryCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) ); + mListFriendCombo = dynamic_cast(avatar_combo); LLSearchEditor *location_editor = getChild("location"); location_editor->setFocusChangedCallback(boost::bind(&LLFloaterWorldMap::onLocationFocusChanged, this, _1)); location_editor->setKeystrokeCallback( boost::bind(&LLFloaterWorldMap::onSearchTextEntry, this)); getChild("search_results")->setDoubleClickCallback( boost::bind(&LLFloaterWorldMap::onClickTeleportBtn, this)); + mListSearchResults = childGetListInterface("search_results"); LLComboBox *landmark_combo = getChild( "landmark combo"); landmark_combo->selectFirstItem(); landmark_combo->setPrearrangeCallback( boost::bind(&LLFloaterWorldMap::onLandmarkComboPrearrange, this) ); landmark_combo->setTextEntryCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) ); + mListLandmarkCombo = dynamic_cast(landmark_combo); mCurZoomVal = log(LLWorldMapView::sMapScale)/log(2.f); getChild("zoom slider")->setValue(LLWorldMapView::sMapScale); @@ -864,7 +870,7 @@ void LLFloaterWorldMap::friendsChanged() // No longer really builds a list. Instead, just updates mAvatarCombo. void LLFloaterWorldMap::buildAvatarIDList() { - LLCtrlListInterface *list = childGetListInterface("friend combo"); + LLCtrlListInterface *list = mListFriendCombo; if (!list) return; // Delete all but the "None" entry @@ -894,7 +900,7 @@ void LLFloaterWorldMap::buildAvatarIDList() void LLFloaterWorldMap::buildLandmarkIDLists() { - LLCtrlListInterface *list = childGetListInterface("landmark combo"); + LLCtrlListInterface *list = mListLandmarkCombo; if (!list) return; // Delete all but the "None" entry @@ -955,7 +961,7 @@ F32 LLFloaterWorldMap::getDistanceToDestination(const LLVector3d &destination, void LLFloaterWorldMap::clearLocationSelection(BOOL clear_ui) { - LLCtrlListInterface *list = childGetListInterface("search_results"); + LLCtrlListInterface *list = mListSearchResults; if (list) { list->operateOnAll(LLCtrlListInterface::OP_DELETE); @@ -969,7 +975,7 @@ void LLFloaterWorldMap::clearLandmarkSelection(BOOL clear_ui) { if (clear_ui || !childHasKeyboardFocus("landmark combo")) { - LLCtrlListInterface *list = childGetListInterface("landmark combo"); + LLCtrlListInterface *list = mListLandmarkCombo; if (list) { list->selectByValue( "None" ); @@ -983,7 +989,7 @@ void LLFloaterWorldMap::clearAvatarSelection(BOOL clear_ui) if (clear_ui || !childHasKeyboardFocus("friend combo")) { mTrackedStatus = LLTracker::TRACKING_NOTHING; - LLCtrlListInterface *list = childGetListInterface("friend combo"); + LLCtrlListInterface *list = mListFriendCombo; if (list) { list->selectByValue( "None" ); @@ -1051,7 +1057,7 @@ void LLFloaterWorldMap::onLandmarkComboPrearrange( ) return; } - LLCtrlListInterface *list = childGetListInterface("landmark combo"); + LLCtrlListInterface *list = mListLandmarkCombo; if (!list) return; LLUUID current_choice = list->getCurrentID(); @@ -1087,7 +1093,7 @@ void LLFloaterWorldMap::onLandmarkComboCommit() return; } - LLCtrlListInterface *list = childGetListInterface("landmark combo"); + LLCtrlListInterface *list = mListLandmarkCombo; if (!list) return; LLUUID asset_id; @@ -1134,7 +1140,7 @@ void LLFloaterWorldMap::onAvatarComboPrearrange( ) return; } - LLCtrlListInterface *list = childGetListInterface("friend combo"); + LLCtrlListInterface *list = mListFriendCombo; if (!list) return; LLUUID current_choice; @@ -1159,7 +1165,7 @@ void LLFloaterWorldMap::onAvatarComboCommit() return; } - LLCtrlListInterface *list = childGetListInterface("friend combo"); + LLCtrlListInterface *list = mListFriendCombo; if (!list) return; const LLUUID& new_avatar_id = list->getCurrentID(); @@ -1553,7 +1559,7 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim) void LLFloaterWorldMap::onCommitSearchResult() { - LLCtrlListInterface *list = childGetListInterface("search_results"); + LLCtrlListInterface *list = mListSearchResults; if (!list) return; LLSD selected_value = list->getSelectedValue(); diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h index 783d9f4819..e3b83b2579 100644 --- a/indra/newview/llfloaterworldmap.h +++ b/indra/newview/llfloaterworldmap.h @@ -39,6 +39,7 @@ #include "lltracker.h" #include "llslurl.h" +class LLCtrlListInterface; class LLFriendObserver; class LLInventoryModel; class LLInventoryObserver; @@ -190,6 +191,10 @@ private: std::string mTrackedSimName; std::string mTrackedAvatarName; LLSLURL mSLURL; + + LLCtrlListInterface * mListFriendCombo; + LLCtrlListInterface * mListLandmarkCombo; + LLCtrlListInterface * mListSearchResults; }; extern LLFloaterWorldMap* gFloaterWorldMap; diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 1920cc2940..858f5cf575 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -572,28 +572,16 @@ void LLPanelMainInventory::updateItemcountText() { text = getString("ItemcountUnknown"); } + + // *TODO: Cache the LLUICtrl* for the ItemcountText control getChild("ItemcountText")->setValue(text); } void LLPanelMainInventory::onFocusReceived() { LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel("sidepanel_inventory"); - - LLInventoryPanel * inbox_panel = sidepanel_inventory->findChild("inventory_inbox"); - - if (inbox_panel) - { - inbox_panel->clearSelection(); - } - - LLInventoryPanel * outbox_panel = sidepanel_inventory->findChild("inventory_outbox"); - - if (outbox_panel) - { - outbox_panel->clearSelection(); - } - - sidepanel_inventory->updateVerbs(); + + sidepanel_inventory->clearSelections(false, true, true); } void LLPanelMainInventory::setFilterTextFromFilter() diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index c505ad85a3..141e29fcec 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -83,7 +83,7 @@ void LLPanelMarketplaceInbox::handleLoginComplete() LLSideTray::getInstance()->setTabButtonBadgeDriver("sidebar_inventory", this); } -void LLPanelMarketplaceInbox::setupInventoryPanel() +LLInventoryPanel * LLPanelMarketplaceInbox::setupInventoryPanel() { LLView * inbox_inventory_placeholder = getChild("inbox_inventory_placeholder"); LLView * inbox_inventory_parent = inbox_inventory_placeholder->getParent(); @@ -106,30 +106,15 @@ void LLPanelMarketplaceInbox::setupInventoryPanel() // Hide the placeholder text inbox_inventory_placeholder->setVisible(FALSE); + + return mInventoryPanel; } void LLPanelMarketplaceInbox::onFocusReceived() { LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel("sidepanel_inventory"); - - if (sidepanel_inventory) - { - LLInventoryPanel * inv_panel = sidepanel_inventory->getActivePanel(); - - if (inv_panel) - { - inv_panel->clearSelection(); - } - LLInventoryPanel * outbox_panel = sidepanel_inventory->findChild("inventory_outbox"); - - if (outbox_panel) - { - outbox_panel->clearSelection(); - } - - sidepanel_inventory->updateVerbs(); - } + sidepanel_inventory->clearSelections(true, false, true); } BOOL LLPanelMarketplaceInbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) diff --git a/indra/newview/llpanelmarketplaceinbox.h b/indra/newview/llpanelmarketplaceinbox.h index 4ecea29304..7b4ed137db 100644 --- a/indra/newview/llpanelmarketplaceinbox.h +++ b/indra/newview/llpanelmarketplaceinbox.h @@ -55,7 +55,7 @@ public: /*virtual*/ void draw(); - void setupInventoryPanel(); + LLInventoryPanel * setupInventoryPanel(); U32 getFreshItemCount() const; U32 getTotalItemCount() const; diff --git a/indra/newview/llpanelmarketplaceoutbox.cpp b/indra/newview/llpanelmarketplaceoutbox.cpp index 74d0de3b30..d51a0d78fe 100644 --- a/indra/newview/llpanelmarketplaceoutbox.cpp +++ b/indra/newview/llpanelmarketplaceoutbox.cpp @@ -83,25 +83,8 @@ void LLPanelMarketplaceOutbox::handleLoginComplete() void LLPanelMarketplaceOutbox::onFocusReceived() { LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel("sidepanel_inventory"); - - if (sidepanel_inventory) - { - LLInventoryPanel * inv_panel = sidepanel_inventory->getActivePanel(); - - if (inv_panel) - { - inv_panel->clearSelection(); - } - - LLInventoryPanel * inbox_panel = sidepanel_inventory->findChild("inventory_inbox"); - - if (inbox_panel) - { - inbox_panel->clearSelection(); - } - - sidepanel_inventory->updateVerbs(); - } + + sidepanel_inventory->clearSelections(true, true, false); } void LLPanelMarketplaceOutbox::onSelectionChange() @@ -111,7 +94,7 @@ void LLPanelMarketplaceOutbox::onSelectionChange() sidepanel_inventory->updateVerbs(); } -void LLPanelMarketplaceOutbox::setupInventoryPanel() +LLInventoryPanel * LLPanelMarketplaceOutbox::setupInventoryPanel() { LLView * outbox_inventory_placeholder = getChild("outbox_inventory_placeholder"); LLView * outbox_inventory_parent = outbox_inventory_placeholder->getParent(); @@ -134,6 +117,8 @@ void LLPanelMarketplaceOutbox::setupInventoryPanel() // Hide the placeholder text outbox_inventory_placeholder->setVisible(FALSE); + + return mInventoryPanel; } bool LLPanelMarketplaceOutbox::isOutboxEmpty() const diff --git a/indra/newview/llpanelmarketplaceoutbox.h b/indra/newview/llpanelmarketplaceoutbox.h index 1b502127ef..8e2c35914d 100644 --- a/indra/newview/llpanelmarketplaceoutbox.h +++ b/indra/newview/llpanelmarketplaceoutbox.h @@ -54,7 +54,7 @@ public: /*virtual*/ BOOL postBuild(); - void setupInventoryPanel(); + LLInventoryPanel * setupInventoryPanel(); bool isOutboxEmpty() const; bool isSyncInProgress() const; diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 6f809ba3ca..54198cc577 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -132,6 +132,8 @@ private: LLSidepanelInventory::LLSidepanelInventory() : LLPanel() , mItemPanel(NULL) + , mInventoryPanelInbox(NULL) + , mInventoryPanelOutbox(NULL) , mPanelMainInventory(NULL) , mInboxEnabled(false) , mOutboxEnabled(false) @@ -351,7 +353,7 @@ void LLSidepanelInventory::observeInboxModifications(const LLUUID& inboxID) // LLPanelMarketplaceInbox * inbox = getChild(MARKETPLACE_INBOX_PANEL); - inbox->setupInventoryPanel(); + mInventoryPanelInbox = inbox->setupInventoryPanel(); } @@ -380,7 +382,7 @@ void LLSidepanelInventory::observeOutboxModifications(const LLUUID& outboxID) // LLPanelMarketplaceOutbox * outbox = getChild(MARKETPLACE_OUTBOX_PANEL); - outbox->setupInventoryPanel(); + mInventoryPanelOutbox = outbox->setupInventoryPanel(); } void LLSidepanelInventory::enableInbox(bool enabled) @@ -529,14 +531,12 @@ void LLSidepanelInventory::onShopButtonClicked() void LLSidepanelInventory::performActionOnSelection(const std::string &action) { - LLPanelMainInventory *panel_main_inventory = mInventoryPanel->getChild("panel_main_inventory"); - LLFolderViewItem* current_item = panel_main_inventory->getActivePanel()->getRootFolder()->getCurSelectedItem(); + LLFolderViewItem* current_item = mPanelMainInventory->getActivePanel()->getRootFolder()->getCurSelectedItem(); if (!current_item) { - LLInventoryPanel* inbox = findChild("inventory_inbox"); - if (inbox) + if (mInventoryPanelInbox) { - current_item = inbox->getRootFolder()->getCurSelectedItem(); + current_item = mInventoryPanelInbox->getRootFolder()->getCurSelectedItem(); } if (!current_item) @@ -545,7 +545,7 @@ void LLSidepanelInventory::performActionOnSelection(const std::string &action) } } - current_item->getListener()->performAction(panel_main_inventory->getActivePanel()->getModel(), action); + current_item->getListener()->performAction(mPanelMainInventory->getActivePanel()->getModel(), action); } void LLSidepanelInventory::onWearButtonClicked() @@ -687,19 +687,16 @@ void LLSidepanelInventory::updateVerbs() bool LLSidepanelInventory::canShare() { - LLPanelMainInventory* panel_main_inventory = - mInventoryPanel->findChild("panel_main_inventory"); - - LLInventoryPanel* inbox = findChild("inventory_inbox"); + LLInventoryPanel* inbox = mInventoryPanelInbox; // Avoid flicker in the Recent tab while inventory is being loaded. if ( (!inbox || inbox->getRootFolder()->getSelectionList().empty()) - && (panel_main_inventory && !panel_main_inventory->getActivePanel()->getRootFolder()->hasVisibleChildren()) ) + && (mPanelMainInventory && !mPanelMainInventory->getActivePanel()->getRootFolder()->hasVisibleChildren()) ) { return false; } - return ( (panel_main_inventory ? LLAvatarActions::canShareSelectedItems(panel_main_inventory->getActivePanel()) : false) + return ( (mPanelMainInventory ? LLAvatarActions::canShareSelectedItems(mPanelMainInventory->getActivePanel()) : false) || (inbox ? LLAvatarActions::canShareSelectedItems(inbox) : false) ); } @@ -724,14 +721,13 @@ bool LLSidepanelInventory::canWearSelected() LLInventoryItem *LLSidepanelInventory::getSelectedItem() { - LLPanelMainInventory *panel_main_inventory = mInventoryPanel->getChild("panel_main_inventory"); - LLFolderViewItem* current_item = panel_main_inventory->getActivePanel()->getRootFolder()->getCurSelectedItem(); + LLFolderViewItem* current_item = mPanelMainInventory->getActivePanel()->getRootFolder()->getCurSelectedItem(); + if (!current_item) { - LLInventoryPanel* inbox = findChild("inventory_inbox"); - if (inbox) + if (mInventoryPanelInbox) { - current_item = inbox->getRootFolder()->getCurSelectedItem(); + current_item = mInventoryPanelInbox->getRootFolder()->getCurSelectedItem(); } if (!current_item) @@ -748,14 +744,20 @@ U32 LLSidepanelInventory::getSelectedCount() { int count = 0; - LLPanelMainInventory *panel_main_inventory = mInventoryPanel->getChild("panel_main_inventory"); - std::set selection_list = panel_main_inventory->getActivePanel()->getRootFolder()->getSelectionList(); + std::set selection_list = mPanelMainInventory->getActivePanel()->getRootFolder()->getSelectionList(); count += selection_list.size(); - LLInventoryPanel* inbox = findChild("inventory_inbox"); - if (inbox) + if ((count == 0) && mInboxEnabled && (mInventoryPanelInbox != NULL)) { - selection_list = inbox->getRootFolder()->getSelectionList(); + selection_list = mInventoryPanelInbox->getRootFolder()->getSelectionList(); + + count += selection_list.size(); + } + + if ((count == 0) && mOutboxEnabled && (mInventoryPanelOutbox != NULL)) + { + selection_list = mInventoryPanelOutbox->getRootFolder()->getSelectionList(); + count += selection_list.size(); } @@ -779,3 +781,45 @@ BOOL LLSidepanelInventory::isMainInventoryPanelActive() const { return mInventoryPanel->getVisible(); } + +void LLSidepanelInventory::clearSelections(bool clearMain, bool clearInbox, bool clearOutbox) +{ + if (clearMain) + { + LLInventoryPanel * inv_panel = getActivePanel(); + + if (inv_panel) + { + inv_panel->clearSelection(); + } + } + + if (clearInbox && mInboxEnabled && (mInventoryPanelInbox != NULL)) + { + mInventoryPanelInbox->clearSelection(); + } + + if (clearOutbox && mOutboxEnabled && (mInventoryPanelOutbox != NULL)) + { + mInventoryPanelOutbox->clearSelection(); + } + + updateVerbs(); +} + +std::set LLSidepanelInventory::getInboxOrOutboxSelectionList() +{ + std::set inventory_selected_uuids; + + if (mInboxEnabled && (mInventoryPanelInbox != NULL)) + { + inventory_selected_uuids = mInventoryPanelInbox->getRootFolder()->getSelectionList(); + } + + if (inventory_selected_uuids.empty() && mOutboxEnabled && (mInventoryPanelOutbox != NULL)) + { + inventory_selected_uuids = mInventoryPanelOutbox->getRootFolder()->getSelectionList(); + } + + return inventory_selected_uuids; +} diff --git a/indra/newview/llsidepanelinventory.h b/indra/newview/llsidepanelinventory.h index 9117e3bf27..f80a3a9dd3 100644 --- a/indra/newview/llsidepanelinventory.h +++ b/indra/newview/llsidepanelinventory.h @@ -58,6 +58,9 @@ public: LLInventoryPanel* getActivePanel(); // Returns an active inventory panel, if any. LLPanelMainInventory* getMainInventoryPanel() const { return mPanelMainInventory; } BOOL isMainInventoryPanelActive() const; + + void clearSelections(bool clearMain, bool clearInbox, bool clearOutbox); + std::set getInboxOrOutboxSelectionList(); void showItemInfoPanel(); void showTaskInfoPanel(); @@ -95,6 +98,8 @@ protected: // private: LLPanel* mInventoryPanel; // Main inventory view + LLInventoryPanel* mInventoryPanelInbox; + LLInventoryPanel* mInventoryPanelOutbox; LLSidepanelItemInfo* mItemPanel; // Individual item view LLSidepanelTaskInfo* mTaskPanel; // Individual in-world object view LLPanelMainInventory* mPanelMainInventory; -- cgit v1.2.3 From 70a872c4a2d27c8f3e85f30c3741db8d36061b9b Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 9 Aug 2011 16:00:56 -0700 Subject: EXP-700 WIP SLPlugin(s) takes high CPU% clamp maximum framerate of slplugin to 100Hz also added assert to catch cases where we're requesting infinite framerate --- indra/llplugin/llpluginprocesschild.cpp | 2 +- indra/llplugin/llpluginprocessparent.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llplugin/llpluginprocesschild.cpp b/indra/llplugin/llpluginprocesschild.cpp index 0beb46d0e5..f8a282184e 100644 --- a/indra/llplugin/llpluginprocesschild.cpp +++ b/indra/llplugin/llpluginprocesschild.cpp @@ -410,7 +410,7 @@ void LLPluginProcessChild::receiveMessageRaw(const std::string &message) } else if(message_name == "sleep_time") { - mSleepTime = parsed.getValueReal("time"); + mSleepTime = llmax(parsed.getValueReal("time"), 1.0 / 100.0); // clamp to maximum of 100Hz } else if(message_name == "crash") { diff --git a/indra/llplugin/llpluginprocessparent.cpp b/indra/llplugin/llpluginprocessparent.cpp index 315096d4fd..110fac0f23 100644 --- a/indra/llplugin/llpluginprocessparent.cpp +++ b/indra/llplugin/llpluginprocessparent.cpp @@ -927,6 +927,7 @@ void LLPluginProcessParent::receiveMessage(const LLPluginMessage &message) } // Send initial sleep time + llassert_always(mSleepTime != 0.f); setSleepTime(mSleepTime, true); setState(STATE_RUNNING); -- cgit v1.2.3 From 11005a9d917dde208fc0917bb84701d09e1a395e Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Wed, 10 Aug 2011 10:52:56 -0700 Subject: added fast timers to profile inventory LLSD deserialization --- indra/llcommon/llsdserialize.cpp | 2 ++ indra/llcommon/llsdserialize_xml.cpp | 12 ++++++++---- indra/llinventory/llinventory.cpp | 3 +++ indra/newview/llfolderview.cpp | 2 ++ 4 files changed, 15 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index bf62600514..6610daa1e0 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -313,8 +313,10 @@ LLSDParser::LLSDParser() LLSDParser::~LLSDParser() { } +LLFastTimer::DeclareTimer FTM_SD_PARSE("LLSD Parsing"); S32 LLSDParser::parse(std::istream& istr, LLSD& data, S32 max_bytes) { + LLFastTimer _(FTM_SD_PARSE); mCheckLimits = (LLSDSerialize::SIZE_UNLIMITED == max_bytes) ? false : true; mMaxBytesLeft = max_bytes; return doParse(istr, data); diff --git a/indra/llcommon/llsdserialize_xml.cpp b/indra/llcommon/llsdserialize_xml.cpp index c5a7c6fc15..d8213c4477 100644 --- a/indra/llcommon/llsdserialize_xml.cpp +++ b/indra/llcommon/llsdserialize_xml.cpp @@ -354,6 +354,7 @@ static unsigned get_till_eol(std::istream& input, char *buf, unsigned bufsize) return count; } +LLFastTimer::DeclareTimer FTM_SD_PARSE_READ_STREAM("LLSD Read Stream"); S32 LLSDXMLParser::Impl::parse(std::istream& input, LLSD& data) { XML_Status status; @@ -373,10 +374,13 @@ S32 LLSDXMLParser::Impl::parse(std::istream& input, LLSD& data) { break; } - count = get_till_eol(input, (char *)buffer, BUFFER_SIZE); - if (!count) - { - break; + { LLFastTimer _(FTM_SD_PARSE_READ_STREAM); + + count = get_till_eol(input, (char *)buffer, BUFFER_SIZE); + if (!count) + { + break; + } } status = XML_ParseBuffer(mParser, count, false); diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index a3caf79519..76760aa414 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -1034,8 +1034,11 @@ void LLInventoryItem::asLLSD( LLSD& sd ) const sd[INV_CREATION_DATE_LABEL] = (S32) mCreationDate; } +LLFastTimer::DeclareTimer FTM_INVENTORY_SD_DESERIALIZE("Inventory SD Deserialize"); + bool LLInventoryItem::fromLLSD(const LLSD& sd) { + LLFastTimer _(FTM_INVENTORY_SD_DESERIALIZE); mInventoryType = LLInventoryType::IT_NONE; mAssetUUID.setNull(); std::string w; diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index 02be477e0d..f471caa65c 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -2040,8 +2040,10 @@ void LLFolderView::removeItemID(const LLUUID& id) mItemMap.erase(id); } +LLFastTimer::DeclareTimer FTM_GET_ITEM_BY_ID("Get FolderViewItem by ID"); LLFolderViewItem* LLFolderView::getItemByID(const LLUUID& id) { + LLFastTimer _(FTM_GET_ITEM_BY_ID); if (id == getListener()->getUUID()) { return this; -- cgit v1.2.3 From dfcd11e51e68922b5158ef4076721f7c66a3d637 Mon Sep 17 00:00:00 2001 From: Aaron Stone Date: Wed, 10 Aug 2011 11:55:05 -0700 Subject: CHOP-757 Ask for the inventory-basic login option and dump its return id to llinfo. --- indra/newview/lllogininstance.cpp | 1 + indra/newview/llstartup.cpp | 6 ++++++ 2 files changed, 7 insertions(+) (limited to 'indra') diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index 00de6a86e1..b20f89aa7c 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -568,6 +568,7 @@ void LLLoginInstance::constructAuthParams(LLPointer user_credentia else { requested_options.append("basic-mode"); + requested_options.append("inventory-basic"); } #endif diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index b390c933f7..1cbf99dbe7 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1543,6 +1543,12 @@ bool idle_startup() } } + LLSD inv_basic = response["inventory-basic"]; + if(inv_basic.isDefined()) + { + llinfos << "Basic inventory root folder id is " << inv_basic["folder_id"] << llendl; + } + LLSD buddy_list = response["buddy-list"]; if(buddy_list.isDefined()) { -- cgit v1.2.3 From e630e98253ab226a9af00da75ba8d91c82326aac Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Wed, 10 Aug 2011 14:15:15 -0700 Subject: EXP-1028 FIX Move mode switching to logged in UI added mode switching button to status bars for advanced and basic mode, changed login combo box to use menu instead --- indra/llui/llmenubutton.cpp | 11 +++- indra/llui/llmenubutton.h | 21 +++++-- indra/newview/llpanellogin.cpp | 30 --------- indra/newview/llpanellogin.h | 2 - indra/newview/llstartup.cpp | 21 +++---- indra/newview/llviewermenu.cpp | 73 +++++++++++++++++++--- indra/newview/skins/default/xui/en/panel_login.xml | 33 +++------- .../skins/default/xui/en/panel_status_bar.xml | 13 +++- indra/newview/skins/minimal/xui/en/main_view.xml | 4 +- indra/newview/skins/minimal/xui/en/panel_login.xml | 37 +++-------- .../skins/minimal/xui/en/panel_navigation_bar.xml | 2 +- .../skins/minimal/xui/en/panel_status_bar.xml | 15 ++++- 12 files changed, 140 insertions(+), 122 deletions(-) (limited to 'indra') diff --git a/indra/llui/llmenubutton.cpp b/indra/llui/llmenubutton.cpp index eed0085273..50d59f79f4 100644 --- a/indra/llui/llmenubutton.cpp +++ b/indra/llui/llmenubutton.cpp @@ -35,9 +35,16 @@ static LLDefaultChildRegistry::Register r("menu_button"); +void LLMenuButton::MenuPositions::declareValues() +{ + declare("topleft", MP_TOP_LEFT); + declare("topright", MP_TOP_RIGHT); + declare("bottomleft", MP_BOTTOM_LEFT); +} LLMenuButton::Params::Params() -: menu_filename("menu_filename") +: menu_filename("menu_filename"), + position("position", MP_BOTTOM_LEFT) { } @@ -45,7 +52,7 @@ LLMenuButton::Params::Params() LLMenuButton::LLMenuButton(const LLMenuButton::Params& p) : LLButton(p), mIsMenuShown(false), - mMenuPosition(MP_BOTTOM_LEFT) + mMenuPosition(p.position) { std::string menu_filename = p.menu_filename; diff --git a/indra/llui/llmenubutton.h b/indra/llui/llmenubutton.h index 7b657595da..e2396e7fb2 100644 --- a/indra/llui/llmenubutton.h +++ b/indra/llui/llmenubutton.h @@ -35,21 +35,30 @@ class LLMenuButton : public LLButton { public: + typedef enum e_menu_position + { + MP_TOP_LEFT, + MP_TOP_RIGHT, + MP_BOTTOM_LEFT + } EMenuPosition; + + struct MenuPositions + : public LLInitParam::TypeValuesHelper + { + static void declareValues(); + }; + struct Params : public LLInitParam::Block { // filename for it's toggleable menu Optional menu_filename; + Optional position; Params(); }; - typedef enum e_menu_position - { - MP_TOP_LEFT, - MP_TOP_RIGHT, - MP_BOTTOM_LEFT - } EMenuPosition; + boost::signals2::connection setMouseDownCallback( const mouse_signal_t::slot_type& cb ); diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 27f341b4f6..bef809f3a7 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -154,10 +154,6 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, } updateLocationCombo(false); - LLUICtrl& mode_combo = getChildRef("mode_combo"); - mode_combo.setValue(gSavedSettings.getString("SessionSettingsFile")); - mode_combo.setCommitCallback(boost::bind(&LLPanelLogin::onModeChange, this, getChild("mode_combo")->getValue(), _2)); - LLComboBox* server_choice_combo = sInstance->getChild("server_combo"); server_choice_combo->setCommitCallback(onSelectServer, NULL); server_choice_combo->setFocusLostCallback(boost::bind(onServerComboLostFocus, _1)); @@ -1025,32 +1021,6 @@ void LLPanelLogin::updateLoginPanelLinks() sInstance->getChildView("forgot_password_text")->setVisible( system_grid); } -void LLPanelLogin::onModeChange(const LLSD& original_value, const LLSD& new_value) -{ - if (original_value.asString() != new_value.asString()) - { - LLNotificationsUtil::add("ModeChange", LLSD(), LLSD(), boost::bind(&LLPanelLogin::onModeChangeConfirm, this, original_value, new_value, _1, _2)); - } -} - -void LLPanelLogin::onModeChangeConfirm(const LLSD& original_value, const LLSD& new_value, const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - switch (option) - { - case 0: - gSavedSettings.getControl("SessionSettingsFile")->set(new_value); - LLAppViewer::instance()->forceQuit(); - break; - case 1: - // revert to original value - getChild("mode_combo")->setValue(original_value); - break; - default: - break; - } -} - std::string canonicalize_username(const std::string& name) { std::string cname = name; diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h index 11273453ba..b29b3af7ca 100644 --- a/indra/newview/llpanellogin.h +++ b/indra/newview/llpanellogin.h @@ -97,8 +97,6 @@ private: static void onServerComboLostFocus(LLFocusableElement*); static void updateServerCombo(); static void updateStartSLURL(); - void onModeChange(const LLSD& original_value, const LLSD& new_value); - void onModeChangeConfirm(const LLSD& original_value, const LLSD& new_value, const LLSD& notification, const LLSD& response); static void updateLoginPanelLinks(); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index b390c933f7..aa908d8cfd 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -720,7 +720,13 @@ bool idle_startup() timeout_count = 0; - initialize_edit_menu(); + // Login screen needs menus for preferences, but we can enter + // this startup phase more than once. + if (gLoginMenuBarView == NULL) + { + initialize_edit_menu(); + init_menus(); + } if (show_connect_box) { @@ -755,19 +761,6 @@ bool idle_startup() LLStartUp::setStartupState( STATE_LOGIN_CLEANUP ); } - // *NOTE: This is where LLViewerParcelMgr::getInstance() used to get allocated before becoming LLViewerParcelMgr::getInstance(). - - // *NOTE: This is where gHUDManager used to bet allocated before becoming LLHUDManager::getInstance(). - - // *NOTE: This is where gMuteList used to get allocated before becoming LLMuteList::getInstance(). - - // Login screen needs menus for preferences, but we can enter - // this startup phase more than once. - if (gLoginMenuBarView == NULL) - { - init_menus(); - } - gViewerWindow->setNormalControlsVisible( FALSE ); gLoginMenuBarView->setVisible( TRUE ); gLoginMenuBarView->setEnabled( TRUE ); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index f74bcafc5c..e5dfa51e7f 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -831,7 +831,8 @@ U32 feature_from_string(std::string feature) }; -class LLAdvancedToggleFeature : public view_listener_t{ +class LLAdvancedToggleFeature : public view_listener_t +{ bool handleEvent(const LLSD& userdata) { U32 feature = feature_from_string( userdata.asString() ); @@ -844,18 +845,19 @@ class LLAdvancedToggleFeature : public view_listener_t{ }; class LLAdvancedCheckFeature : public view_listener_t -{bool handleEvent(const LLSD& userdata) { - U32 feature = feature_from_string( userdata.asString() ); - bool new_value = false; - - if ( feature != 0 ) + bool handleEvent(const LLSD& userdata) { - new_value = LLPipeline::toggleRenderDebugFeatureControl( (void*)feature ); - } + U32 feature = feature_from_string( userdata.asString() ); + bool new_value = false; - return new_value; -} + if ( feature != 0 ) + { + new_value = LLPipeline::toggleRenderDebugFeatureControl( (void*)feature ); + } + + return new_value; + } }; void toggle_destination_and_avatar_picker(const LLSD& show) @@ -7774,6 +7776,55 @@ class LLToggleUIHints : public view_listener_t } }; +class LLCheckSessionsSettings : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + std::string expected = userdata.asString(); + return gSavedSettings.getString("SessionSettingsFile") == expected; + } +}; + +class LLChangeMode : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + std::string mode = userdata.asString(); + if (mode == "basic") + { + if (gSavedSettings.getString("SessionSettingsFile") != "settings_minimal.xml") + { + LLNotificationsUtil::add("ModeChange", LLSD(), LLSD(), boost::bind(onModeChangeConfirm, "settings_minimal.xml", _1, _2)); + } + return true; + } + else if (mode == "advanced") + { + if (gSavedSettings.getString("SessionSettingsFile") != "") + { + LLNotificationsUtil::add("ModeChange", LLSD(), LLSD(), boost::bind(onModeChangeConfirm, "", _1, _2)); + } + return true; + } + return false; + } + + static void onModeChangeConfirm(const std::string& new_session_settings_file, const LLSD& notification, const LLSD& response) + { + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + switch (option) + { + case 0: + gSavedSettings.getControl("SessionSettingsFile")->set(new_session_settings_file); + LLAppViewer::instance()->forceQuit(); + break; + case 1: + default: + break; + } + } +}; + void LLUploadCostCalculator::calculateCost() { S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); @@ -8263,6 +8314,8 @@ void initialize_menus() view_listener_t::addMenu(new LLEditableSelectedMono(), "EditableSelectedMono"); view_listener_t::addMenu(new LLToggleUIHints(), "ToggleUIHints"); + view_listener_t::addMenu(new LLCheckSessionsSettings(), "CheckSessionSettings"); + view_listener_t::addMenu(new LLChangeMode(), "ChangeMode"); commit.add("Destination.show", boost::bind(&toggle_destination_and_avatar_picker, 0)); commit.add("Avatar.show", boost::bind(&toggle_destination_and_avatar_picker, 1)); diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml index 8d0f1437e6..079fb958ec 100644 --- a/indra/newview/skins/default/xui/en/panel_login.xml +++ b/indra/newview/skins/default/xui/en/panel_login.xml @@ -117,33 +117,16 @@ label="Remember password" name="connect_btn" top="35" width="90" /> - - Mode: - - - - - + menu_filename="menu_mode_change.xml" + /> + + width="70"> 24:00 AM PST