From 9608b6dcac894c5251d9419c66943d6473fa5d41 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Thu, 11 Jun 2020 17:41:59 +0300 Subject: SL-13433 Viewer should recognizes ipv6 links --- indra/llui/llurlentry.cpp | 39 +++++++++++++++++++++++++++++++++++++++ indra/llui/llurlentry.h | 13 +++++++++++++ indra/llui/llurlregistry.cpp | 1 + 3 files changed, 53 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 333d03f208..ac86101f69 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -1475,4 +1475,43 @@ void LLUrlEntryExperienceProfile::onExperienceDetails( const LLSD& experience_de callObservers(experience_details[LLExperienceCache::EXPERIENCE_ID].asString(), name, LLStringUtil::null); } +// +// LLUrlEntryEmail Describes an IPv6 address +// +LLUrlEntryIPv6::LLUrlEntryIPv6() + : LLUrlEntryBase() +{ + mHostPath = "https?://\\[([a-f0-9:]+:+)+[a-f0-9]+]"; + mPattern = boost::regex(mHostPath + "(:\\d{1,5})?(/\\S*)?", + boost::regex::perl | boost::regex::icase); + mMenuName = "menu_url_http.xml"; + mTooltip = LLTrans::getString("TooltipHttpUrl"); +} +std::string LLUrlEntryIPv6::getLabel(const std::string &url, const LLUrlLabelCallback &cb) +{ + boost::regex regex = boost::regex(mHostPath, boost::regex::perl | boost::regex::icase); + boost::match_results matches; + + if (boost::regex_search(url, matches, regex)) + { + return url.substr(0, matches[0].length()); + } + else + { + return url; + } +} + +std::string LLUrlEntryIPv6::getQuery(const std::string &url) const +{ + boost::regex regex = boost::regex(mHostPath, boost::regex::perl | boost::regex::icase); + boost::match_results matches; + + return boost::regex_replace(url, regex, ""); +} + +std::string LLUrlEntryIPv6::getUrl(const std::string &string) const +{ + return string; +} diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h index 78c149d9fd..0a0c247a6a 100644 --- a/indra/llui/llurlentry.h +++ b/indra/llui/llurlentry.h @@ -513,5 +513,18 @@ public: /*virtual*/ std::string getUrl(const std::string &string) const; }; +/// +/// LLUrlEntryEmail Describes an IPv6 address +/// +class LLUrlEntryIPv6 : public LLUrlEntryBase +{ +public: + LLUrlEntryIPv6(); + /*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb); + /*virtual*/ std::string getUrl(const std::string &string) const; + /*virtual*/ std::string getQuery(const std::string &url) const; + + std::string mHostPath; +}; #endif diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index ba6fa1e2e9..321a0ec5b9 100644 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -79,6 +79,7 @@ LLUrlRegistry::LLUrlRegistry() mUrlEntrySLLabel = new LLUrlEntrySLLabel(); registerUrl(mUrlEntrySLLabel); registerUrl(new LLUrlEntryEmail()); + registerUrl(new LLUrlEntryIPv6()); } LLUrlRegistry::~LLUrlRegistry() -- cgit v1.3 From 905005be3c7e15429d8380c99d7590e677482286 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Thu, 11 Jun 2020 20:54:09 +0300 Subject: SL-13433 Add tests for new url entry --- indra/llui/tests/llurlentry_test.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/tests/llurlentry_test.cpp b/indra/llui/tests/llurlentry_test.cpp index 3c34fd269e..4a4fdb72e3 100644 --- a/indra/llui/tests/llurlentry_test.cpp +++ b/indra/llui/tests/llurlentry_test.cpp @@ -903,4 +903,38 @@ namespace tut "and even no www something lindenlab.com", ""); } + + template<> template<> + void object::test<16>() + { + // + // test LLUrlEntryIPv6 + // + LLUrlEntryIPv6 url; + + // Regex tests. + testRegex("match urls with a protocol", url, + "this url should match http://[::1]", + "http://[::1]"); + + testRegex("match urls with a protocol and query", url, + "this url should match http://[::1]/file.mp3", + "http://[::1]/file.mp3"); + + testRegex("match urls with a protocol", url, + "this url should match http://[2001:0db8:11a3:09d7:1f34:8a2e:07a0:765d]", + "http://[2001:0db8:11a3:09d7:1f34:8a2e:07a0:765d]"); + + testRegex("match urls with port", url, + "let's specify some port http://[2001:0db8:11a3:09d7:1f34:8a2e:07a0:765d]:8080", + "http://[2001:0db8:11a3:09d7:1f34:8a2e:07a0:765d]:8080"); + + testRegex("don't match urls w/o protocol", url, + "looks like an url something [2001:0db8:11a3:09d7:1f34:8a2e:07a0:765d] but no https prefix", + ""); + + testRegex("don't match incorrect urls", url, + "http://[ 2001:0db8:11a3:09d7:1f34:8a2e:07a0:765d ]", + ""); + } } -- cgit v1.3 From 05ce7511aa6ffebe78676d714a621a1fe04c66e2 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Wed, 8 Jul 2020 20:29:44 +0300 Subject: SL-13479 Avatar menu tweaks --- indra/llui/llmenugl.cpp | 4 +- indra/newview/llviewermenu.cpp | 10 + indra/newview/llviewermenu.h | 4 + indra/newview/llvoavatarself.cpp | 8 +- .../skins/default/xui/en/menu_attachment_self.xml | 210 +++++++++++++++++++-- .../skins/default/xui/en/menu_avatar_self.xml | 2 +- indra/newview/skins/default/xui/en/menu_viewer.xml | 186 +++++++++++++++++- 7 files changed, 404 insertions(+), 20 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 5568a84494..c2698fa648 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -79,7 +79,7 @@ const U32 LEFT_PAD_PIXELS = 3; const U32 LEFT_WIDTH_PIXELS = 15; const U32 LEFT_PLAIN_PIXELS = LEFT_PAD_PIXELS + LEFT_WIDTH_PIXELS; -const U32 RIGHT_PAD_PIXELS = 2; +const U32 RIGHT_PAD_PIXELS = 7; const U32 RIGHT_WIDTH_PIXELS = 15; const U32 RIGHT_PLAIN_PIXELS = RIGHT_PAD_PIXELS + RIGHT_WIDTH_PIXELS; @@ -95,7 +95,7 @@ const std::string SEPARATOR_NAME("separator"); const std::string VERTICAL_SEPARATOR_LABEL( "|" ); const std::string LLMenuGL::BOOLEAN_TRUE_PREFIX( "\xE2\x9C\x94" ); // U+2714 HEAVY CHECK MARK -const std::string LLMenuGL::BRANCH_SUFFIX( "\xE2\x96\xB6" ); // U+25B6 BLACK RIGHT-POINTING TRIANGLE +const std::string LLMenuGL::BRANCH_SUFFIX( "\xe2\x96\xb8" ); // U+25B6 BLACK RIGHT-POINTING TRIANGLE const std::string LLMenuGL::ARROW_UP ("^^^^^^^"); const std::string LLMenuGL::ARROW_DOWN("vvvvvvv"); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index df8cf6bf81..0a9a386f8d 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -185,11 +185,15 @@ const std::string SAVE_INTO_TASK_INVENTORY("Save Object Back to Object Contents" LLMenuGL* gAttachSubMenu = NULL; LLMenuGL* gDetachSubMenu = NULL; LLMenuGL* gTakeOffClothes = NULL; +LLMenuGL* gDetachAvatarMenu = NULL; +LLMenuGL* gDetachHUDAvatarMenu = NULL; LLContextMenu* gAttachScreenPieMenu = NULL; LLContextMenu* gAttachPieMenu = NULL; LLContextMenu* gAttachBodyPartPieMenus[9]; LLContextMenu* gDetachPieMenu = NULL; LLContextMenu* gDetachScreenPieMenu = NULL; +LLContextMenu* gDetachAttSelfMenu = NULL; +LLContextMenu* gDetachHUDAttSelfMenu = NULL; LLContextMenu* gDetachBodyPartPieMenus[9]; // @@ -458,6 +462,9 @@ void init_menus() gMenuAttachmentOther = LLUICtrlFactory::createFromFile( "menu_attachment_other.xml", gMenuHolder, registry); + gDetachHUDAttSelfMenu = gMenuHolder->getChild("Detach Self HUD", true); + gDetachAttSelfMenu = gMenuHolder->getChild("Detach Self", true); + gMenuLand = LLUICtrlFactory::createFromFile( "menu_land.xml", gMenuHolder, registry); @@ -514,6 +521,9 @@ void init_menus() gAttachSubMenu = gMenuBarView->findChildMenuByName("Attach Object", TRUE); gDetachSubMenu = gMenuBarView->findChildMenuByName("Detach Object", TRUE); + gDetachAvatarMenu = gMenuHolder->getChild("Avatar Detach", true); + gDetachHUDAvatarMenu = gMenuHolder->getChild("Avatar Detach HUD", true); + // Don't display the Memory console menu if the feature is turned off LLMenuItemCheckGL *memoryMenu = gMenuBarView->getChild("Memory", TRUE); if (memoryMenu) diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h index 74a15af50c..f2c52913a8 100644 --- a/indra/newview/llviewermenu.h +++ b/indra/newview/llviewermenu.h @@ -187,10 +187,14 @@ extern LLContextMenu *gMenuMuteParticle; extern LLMenuGL* gAttachSubMenu; extern LLMenuGL* gDetachSubMenu; extern LLMenuGL* gTakeOffClothes; +extern LLMenuGL* gDetachAvatarMenu; +extern LLMenuGL* gDetachHUDAvatarMenu; extern LLContextMenu* gAttachScreenPieMenu; extern LLContextMenu* gDetachScreenPieMenu; +extern LLContextMenu* gDetachHUDAttSelfMenu; extern LLContextMenu* gAttachPieMenu; extern LLContextMenu* gDetachPieMenu; +extern LLContextMenu* gDetachAttSelfMenu; extern LLContextMenu* gAttachBodyPartPieMenus[9]; extern LLContextMenu* gDetachBodyPartPieMenus[9]; diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 16b27fd144..48e736eb24 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -465,6 +465,8 @@ BOOL LLVOAvatarSelf::buildMenus() if (gDetachBodyPartPieMenus[i]) { gDetachPieMenu->appendContextSubMenu( gDetachBodyPartPieMenus[i] ); + gDetachAttSelfMenu->appendContextSubMenu(gDetachBodyPartPieMenus[i]); + gDetachAvatarMenu->appendContextSubMenu(gDetachBodyPartPieMenus[i]); } else { @@ -493,12 +495,14 @@ BOOL LLVOAvatarSelf::buildMenus() LLMenuItemCallGL* item = LLUICtrlFactory::create(item_params); gDetachPieMenu->addChild(item); - + gDetachAttSelfMenu->addChild(LLUICtrlFactory::create(item_params)); + gDetachAvatarMenu->addChild(LLUICtrlFactory::create(item_params)); break; } } } } + // add screen attachments for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); @@ -532,6 +536,8 @@ BOOL LLVOAvatarSelf::buildMenus() item_params.on_enable.parameter = iter->first; item = LLUICtrlFactory::create(item_params); gDetachScreenPieMenu->addChild(item); + gDetachHUDAttSelfMenu->addChild(LLUICtrlFactory::create(item_params)); + gDetachHUDAvatarMenu->addChild(LLUICtrlFactory::create(item_params)); } } diff --git a/indra/newview/skins/default/xui/en/menu_attachment_self.xml b/indra/newview/skins/default/xui/en/menu_attachment_self.xml index 03c05e6591..856bf4ce73 100644 --- a/indra/newview/skins/default/xui/en/menu_attachment_self.xml +++ b/indra/newview/skins/default/xui/en/menu_attachment_self.xml @@ -2,17 +2,6 @@ - - - - - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -284,7 +466,7 @@ name="Help with avatars"> + parameter="https://community.secondlife.com/search/?type=cms_records3&tags=avatar&nodes=30&search_and_or=or"/> Date: Fri, 10 Jul 2020 20:48:43 +0300 Subject: SL-5894 #3 WIP enumerate devices to flaoter, let floater set device temp --- indra/llui/llscrolllistctrl.cpp | 40 +++++++--- indra/llwindow/llwindow.h | 2 +- indra/llwindow/llwindowwin32.cpp | 4 +- indra/llwindow/llwindowwin32.h | 2 +- indra/newview/llfloaterjoystick.cpp | 87 +++++++++++++++++++-- indra/newview/llfloaterjoystick.h | 2 + indra/newview/llviewerjoystick.cpp | 148 ++++++++++++++++++++++++++---------- indra/newview/llviewerjoystick.h | 6 +- 8 files changed, 225 insertions(+), 66 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 763c3aeb81..8570dcf318 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -1380,18 +1380,34 @@ BOOL LLScrollListCtrl::setSelectedByValue(const LLSD& value, BOOL selected) for (iter = mItemList.begin(); iter != mItemList.end(); iter++) { LLScrollListItem* item = *iter; - if (item->getEnabled() && (item->getValue().asString() == value.asString())) - { - if (selected) - { - selectItem(item); - } - else - { - deselectItem(item); - } - found = TRUE; - break; + if (item->getEnabled()) + { + if (value.isBinary()) + { + if (item->getValue().isBinary()) + { + LLSD::Binary data1 = value.asBinary(); + LLSD::Binary data2 = item->getValue().asBinary(); + found = std::equal(data1.begin(), data1.end(), data2.begin()) ? TRUE : FALSE; + } + } + else + { + found = item->getValue().asString() == value.asString() ? TRUE : FALSE; + } + + if (found) + { + if (selected) + { + selectItem(item); + } + else + { + deselectItem(item); + } + break; + } } } diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index 90107a7c29..f1113acd5f 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -171,7 +171,7 @@ public: // windows only DirectInput8 for joysticks virtual void* getDirectInput8() { return NULL; }; - virtual bool getInputDevices(U32 device_type_filter, void * devices_callback) { return false; }; + virtual bool getInputDevices(U32 device_type_filter, void * devices_callback, void* userdata) { return false; }; protected: LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags); virtual ~LLWindow(); diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 2bc9c8d63c..c67e7f7c6c 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -4181,7 +4181,7 @@ void* LLWindowWin32::getDirectInput8() return &gDirectInput8; } -bool LLWindowWin32::getInputDevices(U32 device_type_filter, void * di8_devices_callback) +bool LLWindowWin32::getInputDevices(U32 device_type_filter, void * di8_devices_callback, void* userdata) { if (gDirectInput8 != NULL) { @@ -4189,7 +4189,7 @@ bool LLWindowWin32::getInputDevices(U32 device_type_filter, void * di8_devices_c HRESULT status = gDirectInput8->EnumDevices( (DWORD) device_type_filter, // DWORD dwDevType, (LPDIENUMDEVICESCALLBACK)di8_devices_callback, // LPDIENUMDEVICESCALLBACK lpCallback, // BOOL DIEnumDevicesCallback( LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef ) // BOOL CALLBACK DinputDevice::DevicesCallback - (LPVOID*)gDirectInput8, // LPVOID pvRef + (LPVOID*)userdata, // LPVOID pvRef DIEDFL_ATTACHEDONLY // DWORD dwFlags ); diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index dc02528bf2..ee0df570e9 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -118,7 +118,7 @@ public: static void setDPIAwareness(); /*virtual*/ void* getDirectInput8(); - /*virtual*/ bool getInputDevices(U32 device_type_filter, void * di8_devices_callback); + /*virtual*/ bool getInputDevices(U32 device_type_filter, void * di8_devices_callback, void* userdata); protected: LLWindowWin32(LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags, diff --git a/indra/newview/llfloaterjoystick.cpp b/indra/newview/llfloaterjoystick.cpp index 4538d34c95..79814de28d 100644 --- a/indra/newview/llfloaterjoystick.cpp +++ b/indra/newview/llfloaterjoystick.cpp @@ -40,9 +40,21 @@ #include "llviewercontrol.h" #include "llappviewer.h" #include "llviewerjoystick.h" +#include "llviewerwindow.h" +#include "llwindow.h" #include "llcheckboxctrl.h" #include "llcombobox.h" +#if LL_WINDOWS && !LL_MESA_HEADLESS +// Require DirectInput version 8 +#define DIRECTINPUT_VERSION 0x0800 + +//#include +//#pragma comment(lib, "dinput8") +//#pragma comment(lib, "dxguid.lib") +#include +#endif + static LLTrace::SampleStatHandle<> sJoystickAxis0("Joystick axis 0"), sJoystickAxis1("Joystick axis 1"), sJoystickAxis2("Joystick axis 2"), @@ -59,6 +71,29 @@ static LLTrace::SampleStatHandle<>* sJoystickAxes[6] = &sJoystickAxis5 }; + +#if LL_WINDOWS && !LL_MESA_HEADLESS + +BOOL CALLBACK di8_list_devices_callback(LPCDIDEVICEINSTANCE device_instance_ptr, LPVOID pvRef) +{ + // Note: If a single device can function as more than one DirectInput + // device type, it is enumerated as each device type that it supports. + // Capable of detecting devices like Oculus Rift + if (device_instance_ptr && pvRef) + { + std::string product_name = utf16str_to_utf8str(llutf16string(device_instance_ptr->tszProductName)); + S32 size = sizeof(GUID); + LLSD::Binary data; //just an std::vector + data.resize(size); + memcpy(&data[0], &device_instance_ptr->guidInstance /*POD _GUID*/, size); + + LLFloaterJoystick * floater = (LLFloaterJoystick*)pvRef; + floater->addDevice(product_name, LLSD(data)); + } + return DIENUM_CONTINUE; +} +#endif + LLFloaterJoystick::LLFloaterJoystick(const LLSD& data) : LLFloater(data), mHasDeviceList(false) @@ -216,25 +251,62 @@ void LLFloaterJoystick::refresh() initFromSettings(); } +void LLFloaterJoystick::addDevice(std::string &name, LLSD& value) +{ + mJoysticksCombo->add(name, value, ADD_BOTTOM, 1); +} + void LLFloaterJoystick::refreshListOfDevices() { mJoysticksCombo->removeall(); - mJoysticksCombo->add(getString("JoystickDisabled"), LLSD(LLSD::Integer(0)), ADD_BOTTOM, 1); + std::string no_device = getString("JoystickDisabled"); + addDevice(no_device, LLSD(LLSD::Integer(0))); mHasDeviceList = false; - std::string desc = LLViewerJoystick::getInstance()->getDescription(); - if (!desc.empty()) + + // di8_devices_callback callback is immediate and happens in scope of getInputDevices() +#if LL_WINDOWS && !LL_MESA_HEADLESS + // space navigator is marked as DI8DEVCLASS_GAMECTRL in ndof lib + U32 device_type = DI8DEVCLASS_GAMECTRL; + void* callback = &di8_list_devices_callback; +#elif + // MAC doesn't support device search yet + // On MAC there is an ndof_idsearch and it is possible to specify product + // and manufacturer in NDOF_Device for ndof_init_first to pick specific one + U32 device_type = 0; + void* callback = NULL; +#endif + if (gViewerWindow->getWindow()->getInputDevices(device_type, callback, this)) { - mJoysticksCombo->add(desc, LLSD(LLSD::Integer(1)), ADD_BOTTOM, 1); mHasDeviceList = true; } - //todo: load list of devices + LLSD guid = LLViewerJoystick::getInstance()->getDeviceUUID(); + + if (LLViewerJoystick::getInstance()->isJoystickInitialized() && + (!mHasDeviceList || !guid.isBinary())) + { +#if LL_WINDOWS && !LL_MESA_HEADLESS + LL_WARNS() << "NDOF connected to device without using SL provided handle" << LL_ENDL; +#endif + std::string desc = LLViewerJoystick::getInstance()->getDescription(); + if (!desc.empty()) + { + addDevice(desc, LLSD(LLSD::Integer(1))); + mHasDeviceList = true; + } + } if (gSavedSettings.getBOOL("JoystickEnabled") && mHasDeviceList) { - // todo: select device according to data from LLViewerJoystick - mJoysticksCombo->selectByValue(LLSD::Integer(1)); + if (guid.isBinary()) + { + mJoysticksCombo->selectByValue(guid); + } + else + { + mJoysticksCombo->selectByValue(LLSD::Integer(1)); + } } else { @@ -324,6 +396,7 @@ void LLFloaterJoystick::onCommitJoystickEnabled(LLUICtrl*, void *joy_panel) } else { + LLViewerJoystick::getInstance()->initDevice(value); // else joystick is enabled, because combobox holds id of device joystick_enabled = true; // todo: make LLViewerJoystick select a device based on value diff --git a/indra/newview/llfloaterjoystick.h b/indra/newview/llfloaterjoystick.h index b3d879b233..93f5696272 100644 --- a/indra/newview/llfloaterjoystick.h +++ b/indra/newview/llfloaterjoystick.h @@ -46,6 +46,8 @@ public: virtual void draw(); static void setSNDefaults(); + void addDevice(std::string &name, LLSD& value); + protected: void refreshListOfDevices(); diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp index 9775bf646a..baeaaa0722 100644 --- a/indra/newview/llviewerjoystick.cpp +++ b/indra/newview/llviewerjoystick.cpp @@ -164,56 +164,66 @@ BOOL CALLBACK di8_devices_callback(LPCDIDEVICEINSTANCE device_instance_ptr, LPVO // Note: If a single device can function as more than one DirectInput // device type, it is enumerated as each device type that it supports. // Capable of detecting devices like Oculus Rift - if (device_instance_ptr && pvRef) + if (device_instance_ptr) { std::string product_name = utf16str_to_utf8str(llutf16string(device_instance_ptr->tszProductName)); - LL_DEBUGS("Joystick") << "DirectInput8 Devices: " << product_name << LL_ENDL; + LLSD guid = LLViewerJoystick::getInstance()->getDeviceUUID(); - U16 product_id = (device_instance_ptr->guidProduct.Data1 >> 16) & 0xFFFF; - U16 vendor_id = (device_instance_ptr->guidProduct.Data1 >> 0) & 0xFFFF; + bool init_device = false; + if (guid.isBinary()) + { + std::vector bin_bucket = guid.asBinary(); + init_device = memcmp(&bin_bucket[0], &device_instance_ptr->guidInstance, sizeof(GUID)) == 0; + } + else + { + // It might be better to init space navigator here, but if system doesn't has one, + // ndof will pick a random device, it is simpler to pick device now + init_device = true; + } - if (!LLViewerJoystick::getInstance()->isJoystickInitialized()) + if (init_device) { - bool found_space_mouse = is_space_mouse(product_id, vendor_id); + LL_DEBUGS("Joystick") << "Found and attempting to use device: " << product_name << LL_ENDL; + LPDIRECTINPUT8 di8_interface = *((LPDIRECTINPUT8 *)gViewerWindow->getWindow()->getDirectInput8()); + LPDIRECTINPUTDEVICE8 device = NULL; + + HRESULT status = di8_interface->CreateDevice( + device_instance_ptr->guidInstance, // REFGUID rguid, + &device, // LPDIRECTINPUTDEVICE * lplpDirectInputDevice, + NULL // LPUNKNOWN pUnkOuter + ); - if (found_space_mouse) + if (status == DI_OK) { - LL_DEBUGS("Joystick") << "Found device that matches criteria: " << product_name << LL_ENDL; - LPDIRECTINPUT8 di8_interface = (LPDIRECTINPUT8)pvRef; - LPDIRECTINPUTDEVICE8 device = NULL; - - HRESULT status = di8_interface->CreateDevice( - device_instance_ptr->guidInstance, // REFGUID rguid, - &device, // LPDIRECTINPUTDEVICE * lplpDirectInputDevice, - NULL // LPUNKNOWN pUnkOuter - ); - - if (status == DI_OK) - { - // prerequisite for aquire() - LL_DEBUGS("Joystick") << "Device created" << LL_ENDL; - status = device->SetDataFormat(&c_dfDIJoystick); // c_dfDIJoystick2 - } - - if (status == DI_OK) - { - // set properties - LL_DEBUGS("Joystick") << "Format set" << LL_ENDL; - status = device->EnumObjects(EnumNDOFObjectsCallback, &device, DIDFT_ALL); - } - - // todo: record device name, ndof won't fill it from passed device - // strncpy(mNdofDev->product, inst->tszProductName, sizeof(mNdofDev->product)); - // strncpy(mNdofDev->product, product_name.c_str(), sizeof(mNdofDev->product)); - - if (status == DI_OK) - { - LL_DEBUGS("Joystick") << "Properties updated" << LL_ENDL; - LLViewerJoystick::getInstance()->initDevice(&device); - return DIENUM_STOP; - } + // prerequisite for aquire() + LL_DEBUGS("Joystick") << "Device created" << LL_ENDL; + status = device->SetDataFormat(&c_dfDIJoystick); // c_dfDIJoystick2 } + + if (status == DI_OK) + { + // set properties + LL_DEBUGS("Joystick") << "Format set" << LL_ENDL; + status = device->EnumObjects(EnumNDOFObjectsCallback, &device, DIDFT_ALL); + } + + if (status == DI_OK) + { + LL_DEBUGS("Joystick") << "Properties updated" << LL_ENDL; + + S32 size = sizeof(GUID); + LLSD::Binary data; //just an std::vector + data.resize(size); + memcpy(&data[0], &device_instance_ptr->guidInstance /*POD _GUID*/, size); + LLViewerJoystick::getInstance()->initDevice(&device, product_name, LLSD(data)); + return DIENUM_STOP; + } + } + else + { + LL_DEBUGS("Joystick") << "Found device: " << product_name << LL_ENDL; } } return DIENUM_CONTINUE; @@ -310,6 +320,8 @@ LLViewerJoystick::LLViewerJoystick() // factor in bandwidth? bandwidth = gViewerStats->mKBitStat mPerfScale = 4000.f / gSysCPU.getMHz(); // hmm. why? + + mLastDeviceUUID = LLSD::Integer(1); } // ----------------------------------------------------------------------------- @@ -327,6 +339,7 @@ void LLViewerJoystick::init(bool autoenable) #if LIB_NDOF static bool libinit = false; mDriverState = JDS_INITIALIZING; + //todo: load mLastDeviceUUID from settings if (libinit == false) { @@ -363,10 +376,11 @@ void LLViewerJoystick::init(bool autoenable) U32 device_type = 0; void* callback = NULL; #endif - if (!gViewerWindow->getWindow()->getInputDevices(device_type, callback)) + if (!gViewerWindow->getWindow()->getInputDevices(device_type, callback, NULL)) { LL_INFOS() << "Failed to gather devices from window. Falling back to ndof's init" << LL_ENDL; // Failed to gather devices from windows, init first suitable one + mLastDeviceUUID = LLSD::Integer(1); void *preffered_device = NULL; initDevice(preffered_device); } @@ -375,6 +389,7 @@ void LLViewerJoystick::init(bool autoenable) if (mDriverState == JDS_INITIALIZING) { LL_INFOS() << "Found no suitable devices. Trying ndof's default init" << LL_ENDL; + mLastDeviceUUID = LLSD::Integer(1); void *preffered_device = NULL; initDevice(preffered_device); } @@ -421,6 +436,47 @@ void LLViewerJoystick::init(bool autoenable) #endif } +void LLViewerJoystick::initDevice(LLSD &guid) +{ +#if LIB_NDOF + mLastDeviceUUID = guid; + // todo: should we Unacquire old one? + +#if LL_WINDOWS && !LL_MESA_HEADLESS + // space navigator is marked as DI8DEVCLASS_GAMECTRL in ndof lib + U32 device_type = DI8DEVCLASS_GAMECTRL; + void* callback = &di8_devices_callback; +#elif + // MAC doesn't support device search yet + // On MAC there is an ndof_idsearch and it is possible to specify product + // and manufacturer in NDOF_Device for ndof_init_first to pick specific one + U32 device_type = 0; + void* callback = NULL; +#endif + + if (!gViewerWindow->getWindow()->getInputDevices(device_type, callback, NULL)) + { + LL_INFOS() << "Failed to gather devices from window. Falling back to ndof's init" << LL_ENDL; + // Failed to gather devices from windows, init first suitable one + void *preffered_device = NULL; + mLastDeviceUUID = LLSD::Integer(1); + initDevice(preffered_device); + } +#endif +} + +void LLViewerJoystick::initDevice(void * preffered_device /*LPDIRECTINPUTDEVICE8*/, std::string &name, LLSD &guid) +{ +#if LIB_NDOF + mLastDeviceUUID = guid; + + strncpy(mNdofDev->product, name.c_str(), sizeof(mNdofDev->product)); + mNdofDev->manufacturer[0] = '\0'; + + initDevice(preffered_device); +#endif +} + void LLViewerJoystick::initDevice(void * preffered_device /* LPDIRECTINPUTDEVICE8* */) { #if LIB_NDOF @@ -452,6 +508,8 @@ void LLViewerJoystick::initDevice(void * preffered_device /* LPDIRECTINPUTDEVICE { mDriverState = JDS_INITIALIZED; } + + //todo: save mLastDeviceUUID to settings #endif } @@ -1251,6 +1309,12 @@ void LLViewerJoystick::scanJoystick() } } +// ----------------------------------------------------------------------------- +LLSD LLViewerJoystick::getDeviceUUID() +{ + return mLastDeviceUUID; +} + // ----------------------------------------------------------------------------- std::string LLViewerJoystick::getDescription() { diff --git a/indra/newview/llviewerjoystick.h b/indra/newview/llviewerjoystick.h index 9c59f811f1..eba549c5f2 100644 --- a/indra/newview/llviewerjoystick.h +++ b/indra/newview/llviewerjoystick.h @@ -50,7 +50,9 @@ class LLViewerJoystick : public LLSingleton public: void init(bool autoenable); + void initDevice(LLSD &guid); void initDevice(void * preffered_device /*LPDIRECTINPUTDEVICE8*/); + void initDevice(void * preffered_device /*LPDIRECTINPUTDEVICE8*/, std::string &name, LLSD &guid); void terminate(); void updateStatus(); @@ -69,8 +71,9 @@ public: void setOverrideCamera(bool val); bool toggleFlycam(); void setSNDefaults(); + LLSD getDeviceUUID(); std::string getDescription(); - + protected: void updateEnabled(bool autoenable); void handleRun(F32 inc); @@ -96,6 +99,7 @@ private: bool mCameraUpdated; bool mOverrideCamera; U32 mJoystickRun; + LLSD mLastDeviceUUID; // _UUID as U8 binary map, integer 1 for no device/ndof's device static F32 sLastDelta[7]; static F32 sDelta[7]; -- cgit v1.3 From 2b5396a8e8962ad03ef74c60fe0bf6515a4b8521 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Fri, 2 Oct 2020 13:24:00 +0300 Subject: SL-14050 Remove all Help question marks from Viewer UI --- indra/llui/llfloater.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index abb043f428..e9c980ad9a 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -303,12 +303,10 @@ void LLFloater::initFloater(const Params& p) mButtonsEnabled[BUTTON_CLOSE] = TRUE; } - // Help button: '?' - if ( !mHelpTopic.empty() ) - { - mButtonsEnabled[BUTTON_HELP] = TRUE; - } - + // Help button: '?' + //SL-14050 Disable all Help question marks + mButtonsEnabled[BUTTON_HELP] = FALSE; + // Minimize button only for top draggers if ( !mDragOnLeft && mCanMinimize ) { -- cgit v1.3 From fc17790a35402e25d7790dfed467e9c46b059554 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Tue, 6 Oct 2020 19:45:26 +0300 Subject: SL-14030 FIXED Clicking in Places > My Landmarks scrolls the Places window. --- indra/llui/llaccordionctrl.cpp | 3 ++- indra/llui/llaccordionctrl.h | 4 ++++ indra/newview/llpanellandmarks.cpp | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp index 61a119800e..809d72208f 100644 --- a/indra/llui/llaccordionctrl.cpp +++ b/indra/llui/llaccordionctrl.cpp @@ -55,6 +55,7 @@ LLAccordionCtrl::LLAccordionCtrl(const Params& params):LLPanel(params) , mTabComparator( NULL ) , mNoVisibleTabsHelpText(NULL) , mNoVisibleTabsOrigString(params.no_visible_tabs_text.initial_value().asString()) + , mSkipScrollToChild(false) { initNoTabsWidget(params.no_matched_tabs_text); @@ -659,7 +660,7 @@ void LLAccordionCtrl::onScrollPosChangeCallback(S32, LLScrollbar*) // virtual void LLAccordionCtrl::onUpdateScrollToChild(const LLUICtrl *cntrl) { - if (mScrollbar && mScrollbar->getVisible()) + if (mScrollbar && mScrollbar->getVisible() && !mSkipScrollToChild) { // same as scrollToShowRect LLRect rect; diff --git a/indra/llui/llaccordionctrl.h b/indra/llui/llaccordionctrl.h index b38a76d27f..2828254472 100644 --- a/indra/llui/llaccordionctrl.h +++ b/indra/llui/llaccordionctrl.h @@ -138,6 +138,8 @@ public: bool getFitParent() const {return mFitParent;} + void setSkipScrollToChild(bool skip) { mSkipScrollToChild = skip; } + private: void initNoTabsWidget(const LLTextBox::Params& tb_params); void updateNoTabsHelpTextVisibility(); @@ -183,6 +185,8 @@ private: F32 mAutoScrollRate; LLTextBox* mNoVisibleTabsHelpText; + bool mSkipScrollToChild; + std::string mNoMatchedTabsOrigString; std::string mNoVisibleTabsOrigString; diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index cd1dc0f070..ccd8497484 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -227,6 +227,12 @@ BOOL LLLandmarksPanel::postBuild() initMyInventoryPanel(); initLibraryInventoryPanel(); + LLAccordionCtrl* accordion = getChild("landmarks_accordion"); + if (accordion) + { + accordion->setSkipScrollToChild(true); + } + return TRUE; } -- cgit v1.3 From 281c3d8beec393de9afced57c6756d0d367a1c77 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 5 Nov 2020 21:40:54 +0200 Subject: SL-14270 Crash accessing deleted 'parent' via callback from child --- indra/llui/llfolderviewmodel.cpp | 5 +++++ indra/llui/llfolderviewmodel.h | 4 ++++ 2 files changed, 9 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp index 3b45fb53a2..58a1ef646a 100644 --- a/indra/llui/llfolderviewmodel.cpp +++ b/indra/llui/llfolderviewmodel.cpp @@ -29,6 +29,11 @@ #include "llfolderviewmodel.h" #include "lltrans.h" +LLFolderViewModelItemCommon::~LLFolderViewModelItemCommon() +{ + clearChildren(); +} + bool LLFolderViewModelCommon::needsSort(LLFolderViewModelItem* item) { return item->getSortVersion() < mTargetSortVersion; diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index f71a88c56e..903049b9af 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -248,6 +248,8 @@ public: mChildren.clear(); } + virtual ~LLFolderViewModelItemCommon(); + void requestSort() { mSortVersion = -1; } S32 getSortVersion() { return mSortVersion; } void setSortVersion(S32 version) { mSortVersion = version;} @@ -399,6 +401,8 @@ public: mFolderView(NULL) {} + virtual ~LLFolderViewModelCommon() {} + virtual void requestSortAll() { // sort everything -- cgit v1.3 From d17af5f3a6303c816f357b1e94a28cae36828b69 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 5 Nov 2020 21:58:12 +0200 Subject: SL-14270 A bit of cleanup #1 --- indra/llui/llfolderviewmodel.cpp | 135 +++++++++++++++++++++++++++++++++++++++ indra/llui/llfolderviewmodel.h | 130 ++++--------------------------------- 2 files changed, 147 insertions(+), 118 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp index 58a1ef646a..727ed7a405 100644 --- a/indra/llui/llfolderviewmodel.cpp +++ b/indra/llui/llfolderviewmodel.cpp @@ -29,11 +29,146 @@ #include "llfolderviewmodel.h" #include "lltrans.h" +// LLFolderViewModelItemCommon + +LLFolderViewModelItemCommon::LLFolderViewModelItemCommon(LLFolderViewModelInterface& root_view_model) + : mSortVersion(-1), + mPassedFilter(true), + mPassedFolderFilter(true), + mStringMatchOffsetFilter(std::string::npos), + mStringFilterSize(0), + mFolderViewItem(NULL), + mLastFilterGeneration(-1), + mLastFolderFilterGeneration(-1), + mMarkedDirtyGeneration(-1), + mMostFilteredDescendantGeneration(-1), + mParent(NULL), + mRootViewModel(root_view_model) +{ + mChildren.clear(); //??? +} + LLFolderViewModelItemCommon::~LLFolderViewModelItemCommon() { clearChildren(); } +void LLFolderViewModelItemCommon::dirtyFilter() +{ + if (mMarkedDirtyGeneration < 0) + { + mMarkedDirtyGeneration = mLastFilterGeneration; + } + mLastFilterGeneration = -1; + mLastFolderFilterGeneration = -1; + + // bubble up dirty flag all the way to root + if (mParent) + { + mParent->dirtyFilter(); + } +} + +void LLFolderViewModelItemCommon::dirtyDescendantsFilter() +{ + mMostFilteredDescendantGeneration = -1; + if (mParent) + { + mParent->dirtyDescendantsFilter(); + } +} + +//virtual +void LLFolderViewModelItemCommon::addChild(LLFolderViewModelItem* child) +{ + // Avoid duplicates: bail out if that child is already present in the list + // Note: this happens when models are created before views + child_list_t::const_iterator iter; + for (iter = mChildren.begin(); iter != mChildren.end(); iter++) + { + if (child == *iter) + { + return; + } + } + mChildren.push_back(child); + child->setParent(this); + dirtyFilter(); + requestSort(); +} + +//virtual +void LLFolderViewModelItemCommon::removeChild(LLFolderViewModelItem* child) +{ + mChildren.remove(child); + child->setParent(NULL); + dirtyDescendantsFilter(); + dirtyFilter(); +} + +//virtual +void LLFolderViewModelItemCommon::clearChildren() +{ + // As this is cleaning the whole list of children wholesale, we do need to delete the pointed objects + // This is different and not equivalent to calling removeChild() on each child + std::for_each(mChildren.begin(), mChildren.end(), DeletePointer()); + mChildren.clear(); + dirtyDescendantsFilter(); + dirtyFilter(); +} + +void LLFolderViewModelItemCommon::setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset /*= std::string::npos*/, std::string::size_type string_size /*= 0*/) +{ + mPassedFilter = passed; + mLastFilterGeneration = filter_generation; + mStringMatchOffsetFilter = string_offset; + mStringFilterSize = string_size; + mMarkedDirtyGeneration = -1; +} + +void LLFolderViewModelItemCommon::setPassedFolderFilter(bool passed, S32 filter_generation) +{ + mPassedFolderFilter = passed; + mLastFolderFilterGeneration = filter_generation; +} + +//virtual +bool LLFolderViewModelItemCommon::potentiallyVisible() +{ + return passedFilter() // we've passed the filter + || (getLastFilterGeneration() < mRootViewModel.getFilter().getFirstSuccessGeneration()) // or we don't know yet + || descendantsPassedFilter(); +} + +//virtual +bool LLFolderViewModelItemCommon::passedFilter(S32 filter_generation /*= -1*/) +{ + if (filter_generation < 0) + { + filter_generation = mRootViewModel.getFilter().getFirstSuccessGeneration(); + } + bool passed_folder_filter = mPassedFolderFilter && (mLastFolderFilterGeneration >= filter_generation); + bool passed_filter = mPassedFilter && (mLastFilterGeneration >= filter_generation); + return passed_folder_filter && (passed_filter || descendantsPassedFilter(filter_generation)); +} + +//virtual +bool LLFolderViewModelItemCommon::descendantsPassedFilter(S32 filter_generation /*= -1*/) +{ + if (filter_generation < 0) + { + filter_generation = mRootViewModel.getFilter().getFirstSuccessGeneration(); + } + return mMostFilteredDescendantGeneration >= filter_generation; +} + +// LLFolderViewModelCommon + +LLFolderViewModelCommon::LLFolderViewModelCommon() + : mTargetSortVersion(0), + mFolderView(NULL) +{} + bool LLFolderViewModelCommon::needsSort(LLFolderViewModelItem* item) { return item->getSortVersion() < mTargetSortVersion; diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index 903049b9af..d8e5bccc9b 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -231,23 +231,7 @@ protected: class LLFolderViewModelItemCommon : public LLFolderViewModelItem { public: - LLFolderViewModelItemCommon(LLFolderViewModelInterface& root_view_model) - : mSortVersion(-1), - mPassedFilter(true), - mPassedFolderFilter(true), - mStringMatchOffsetFilter(std::string::npos), - mStringFilterSize(0), - mFolderViewItem(NULL), - mLastFilterGeneration(-1), - mLastFolderFilterGeneration(-1), - mMarkedDirtyGeneration(-1), - mMostFilteredDescendantGeneration(-1), - mParent(NULL), - mRootViewModel(root_view_model) - { - mChildren.clear(); - } - + LLFolderViewModelItemCommon(LLFolderViewModelInterface& root_view_model); virtual ~LLFolderViewModelItemCommon(); void requestSort() { mSortVersion = -1; } @@ -257,115 +241,28 @@ public: S32 getLastFilterGeneration() const { return mLastFilterGeneration; } S32 getLastFolderFilterGeneration() const { return mLastFolderFilterGeneration; } S32 getMarkedDirtyGeneration() const { return mMarkedDirtyGeneration; } - void dirtyFilter() - { - if(mMarkedDirtyGeneration < 0) - { - mMarkedDirtyGeneration = mLastFilterGeneration; - } - mLastFilterGeneration = -1; - mLastFolderFilterGeneration = -1; - - // bubble up dirty flag all the way to root - if (mParent) - { - mParent->dirtyFilter(); - } - } - void dirtyDescendantsFilter() - { - mMostFilteredDescendantGeneration = -1; - if (mParent) - { - mParent->dirtyDescendantsFilter(); - } - } + void dirtyFilter(); + void dirtyDescendantsFilter(); bool hasFilterStringMatch(); std::string::size_type getFilterStringOffset(); std::string::size_type getFilterStringSize(); typedef std::list child_list_t; - virtual void addChild(LLFolderViewModelItem* child) - { - // Avoid duplicates: bail out if that child is already present in the list - // Note: this happens when models are created before views - child_list_t::const_iterator iter; - for (iter = mChildren.begin(); iter != mChildren.end(); iter++) - { - if (child == *iter) - { - return; - } - } - mChildren.push_back(child); - child->setParent(this); - dirtyFilter(); - requestSort(); - } - virtual void removeChild(LLFolderViewModelItem* child) - { - mChildren.remove(child); - child->setParent(NULL); - dirtyDescendantsFilter(); - dirtyFilter(); - } + virtual void addChild(LLFolderViewModelItem* child); + virtual void removeChild(LLFolderViewModelItem* child); - virtual void clearChildren() - { - // As this is cleaning the whole list of children wholesale, we do need to delete the pointed objects - // This is different and not equivalent to calling removeChild() on each child - std::for_each(mChildren.begin(), mChildren.end(), DeletePointer()); - mChildren.clear(); - dirtyDescendantsFilter(); - dirtyFilter(); - } + virtual void clearChildren(); child_list_t::const_iterator getChildrenBegin() const { return mChildren.begin(); } child_list_t::const_iterator getChildrenEnd() const { return mChildren.end(); } child_list_t::size_type getChildrenCount() const { return mChildren.size(); } - void setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0) - { - mPassedFilter = passed; - mLastFilterGeneration = filter_generation; - mStringMatchOffsetFilter = string_offset; - mStringFilterSize = string_size; - mMarkedDirtyGeneration = -1; - } - - void setPassedFolderFilter(bool passed, S32 filter_generation) - { - mPassedFolderFilter = passed; - mLastFolderFilterGeneration = filter_generation; - } - - virtual bool potentiallyVisible() - { - return passedFilter() // we've passed the filter - || (getLastFilterGeneration() < mRootViewModel.getFilter().getFirstSuccessGeneration()) // or we don't know yet - || descendantsPassedFilter(); - } - - virtual bool passedFilter(S32 filter_generation = -1) - { - if (filter_generation < 0) - { - filter_generation = mRootViewModel.getFilter().getFirstSuccessGeneration(); - } - bool passed_folder_filter = mPassedFolderFilter && (mLastFolderFilterGeneration >= filter_generation); - bool passed_filter = mPassedFilter && (mLastFilterGeneration >= filter_generation); - return passed_folder_filter && (passed_filter || descendantsPassedFilter(filter_generation)); - } - - virtual bool descendantsPassedFilter(S32 filter_generation = -1) - { - if (filter_generation < 0) - { - filter_generation = mRootViewModel.getFilter().getFirstSuccessGeneration(); - } - return mMostFilteredDescendantGeneration >= filter_generation; - } + void setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0); + void setPassedFolderFilter(bool passed, S32 filter_generation); + virtual bool potentiallyVisible(); + virtual bool passedFilter(S32 filter_generation = -1); + virtual bool descendantsPassedFilter(S32 filter_generation = -1); protected: @@ -396,10 +293,7 @@ protected: class LLFolderViewModelCommon : public LLFolderViewModelInterface { public: - LLFolderViewModelCommon() - : mTargetSortVersion(0), - mFolderView(NULL) - {} + LLFolderViewModelCommon(); virtual ~LLFolderViewModelCommon() {} -- cgit v1.3 From dc136e8dc886cf4798804757d3002f5711995b97 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 5 Nov 2020 22:54:28 +0200 Subject: SL-14270 A bit of cleanup #2 --- indra/llui/llfolderviewmodel.cpp | 7 +++++ indra/llui/llfolderviewmodel.h | 65 +++++++++++++++++++--------------------- 2 files changed, 37 insertions(+), 35 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp index 727ed7a405..adadf979b7 100644 --- a/indra/llui/llfolderviewmodel.cpp +++ b/indra/llui/llfolderviewmodel.cpp @@ -169,6 +169,13 @@ LLFolderViewModelCommon::LLFolderViewModelCommon() mFolderView(NULL) {} +//virtual +void LLFolderViewModelCommon::requestSortAll() +{ + // sort everything + mTargetSortVersion++; +} + bool LLFolderViewModelCommon::needsSort(LLFolderViewModelItem* item) { return item->getSortVersion() < mTargetSortVersion; diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index d8e5bccc9b..ba8733c86d 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -38,7 +38,6 @@ enum EInventorySortGroup SG_ITEM }; -class LLFontGL; class LLInventoryModel; class LLMenuGL; class LLUIImage; @@ -232,25 +231,25 @@ class LLFolderViewModelItemCommon : public LLFolderViewModelItem { public: LLFolderViewModelItemCommon(LLFolderViewModelInterface& root_view_model); - virtual ~LLFolderViewModelItemCommon(); + virtual ~LLFolderViewModelItemCommon() override; - void requestSort() { mSortVersion = -1; } - S32 getSortVersion() { return mSortVersion; } - void setSortVersion(S32 version) { mSortVersion = version;} + void requestSort() override { mSortVersion = -1; } + S32 getSortVersion() override { return mSortVersion; } + void setSortVersion(S32 version) override { mSortVersion = version;} - S32 getLastFilterGeneration() const { return mLastFilterGeneration; } + S32 getLastFilterGeneration() const override { return mLastFilterGeneration; } S32 getLastFolderFilterGeneration() const { return mLastFolderFilterGeneration; } - S32 getMarkedDirtyGeneration() const { return mMarkedDirtyGeneration; } - void dirtyFilter(); - void dirtyDescendantsFilter(); - bool hasFilterStringMatch(); - std::string::size_type getFilterStringOffset(); - std::string::size_type getFilterStringSize(); + S32 getMarkedDirtyGeneration() const override { return mMarkedDirtyGeneration; } + void dirtyFilter() override; + void dirtyDescendantsFilter() override; + bool hasFilterStringMatch() override; + std::string::size_type getFilterStringOffset() override; + std::string::size_type getFilterStringSize() override; typedef std::list child_list_t; - virtual void addChild(LLFolderViewModelItem* child); - virtual void removeChild(LLFolderViewModelItem* child); + virtual void addChild(LLFolderViewModelItem* child) override; + virtual void removeChild(LLFolderViewModelItem* child) override; virtual void clearChildren(); @@ -258,16 +257,16 @@ public: child_list_t::const_iterator getChildrenEnd() const { return mChildren.end(); } child_list_t::size_type getChildrenCount() const { return mChildren.size(); } - void setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0); - void setPassedFolderFilter(bool passed, S32 filter_generation); - virtual bool potentiallyVisible(); - virtual bool passedFilter(S32 filter_generation = -1); - virtual bool descendantsPassedFilter(S32 filter_generation = -1); + void setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0) override; + void setPassedFolderFilter(bool passed, S32 filter_generation) override; + virtual bool potentiallyVisible() override; + virtual bool passedFilter(S32 filter_generation = -1) override; + virtual bool descendantsPassedFilter(S32 filter_generation = -1) override; protected: - virtual void setParent(LLFolderViewModelItem* parent) { mParent = parent; } - virtual bool hasParent() { return mParent != NULL; } + virtual void setParent(LLFolderViewModelItem* parent) override { mParent = parent; } + virtual bool hasParent() override { return mParent != NULL; } S32 mSortVersion; bool mPassedFilter; @@ -284,7 +283,7 @@ protected: LLFolderViewModelItem* mParent; LLFolderViewModelInterface& mRootViewModel; - void setFolderViewItem(LLFolderViewItem* folder_view_item) { mFolderViewItem = folder_view_item;} + void setFolderViewItem(LLFolderViewItem* folder_view_item) override { mFolderViewItem = folder_view_item;} LLFolderViewItem* mFolderViewItem; }; @@ -295,17 +294,13 @@ class LLFolderViewModelCommon : public LLFolderViewModelInterface public: LLFolderViewModelCommon(); - virtual ~LLFolderViewModelCommon() {} + virtual ~LLFolderViewModelCommon() override {} - virtual void requestSortAll() - { - // sort everything - mTargetSortVersion++; - } - virtual std::string getStatusText(); - virtual void filter(); + virtual void requestSortAll() override; + virtual std::string getStatusText() override; + virtual void filter() override; - void setFolderView(LLFolderView* folder_view) { mFolderView = folder_view;} + void setFolderView(LLFolderView* folder_view) override { mFolderView = folder_view;} protected: bool needsSort(class LLFolderViewModelItem* item); @@ -329,7 +324,7 @@ public: mFilter(filter) {} - virtual ~LLFolderViewModel() + virtual ~LLFolderViewModel() override { delete mSorter; mSorter = NULL; @@ -347,8 +342,8 @@ public: // By default, we assume the content is available. If a network fetch mechanism is implemented for the model, // this method needs to be overloaded and return the relevant fetch status. - virtual bool contentsReady() { return true; } - virtual bool isFolderComplete(LLFolderViewFolder* folder) { return true; } + virtual bool contentsReady() override { return true; } + virtual bool isFolderComplete(LLFolderViewFolder* folder) override { return true; } struct ViewModelCompare { @@ -369,7 +364,7 @@ public: const SortType& mSorter; }; - void sort(LLFolderViewFolder* folder) + void sort(LLFolderViewFolder* folder) override { if (needsSort(folder->getViewModelItem())) { -- cgit v1.3 From 561da5bd7f32e5d09849ac97c69b1acf07cd9a0f Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 6 Nov 2020 23:17:30 +0200 Subject: SL-14270 Crash fix --- indra/llui/llfolderviewmodel.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp index adadf979b7..eae0d2f3e4 100644 --- a/indra/llui/llfolderviewmodel.cpp +++ b/indra/llui/llfolderviewmodel.cpp @@ -50,7 +50,14 @@ LLFolderViewModelItemCommon::LLFolderViewModelItemCommon(LLFolderViewModelInterf LLFolderViewModelItemCommon::~LLFolderViewModelItemCommon() { - clearChildren(); + // Children don't belong to model, but to LLFolderViewItem, just mark them as having no parent + std::for_each(mChildren.begin(), mChildren.end(), [](LLFolderViewModelItem* c) {c->setParent(NULL); }); + + // Don't leave dead pointer in parent + if (mParent) + { + mParent->removeChild(this); + } } void LLFolderViewModelItemCommon::dirtyFilter() -- cgit v1.3 From e1ae2e7cbd8335abf5463fe28aa942d46523638e Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Thu, 12 Nov 2020 00:06:39 +0200 Subject: Mac buildfix --- indra/llui/llfolderviewmodel.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index ba8733c86d..6e739a57a6 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -336,8 +336,8 @@ public: virtual const SortType& getSorter() const { return *mSorter; } virtual void setSorter(const SortType& sorter) { mSorter = new SortType(sorter); requestSortAll(); } - virtual FilterType& getFilter() { return *mFilter; } - virtual const FilterType& getFilter() const { return *mFilter; } + virtual FilterType& getFilter() override { return *mFilter; } + virtual const FilterType& getFilter() const override { return *mFilter; } virtual void setFilter(const FilterType& filter) { mFilter = new FilterType(filter); } // By default, we assume the content is available. If a network fetch mechanism is implemented for the model, -- cgit v1.3 From f534e37328e7408b1609c9b78d13c6c749091e53 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 21 Nov 2020 00:06:32 +0200 Subject: SL-14368 Expanding the 'People' floater to the right does not expand the displayed values --- indra/llui/llscrolllistctrl.cpp | 24 ++++++++++++++++++++++-- indra/newview/llappviewer.cpp | 2 -- 2 files changed, 22 insertions(+), 4 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index dc525517bf..a6e4f3a2af 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -763,14 +763,20 @@ void LLScrollListCtrl::updateColumns(bool force_update) } } + bool header_changed_width = false; // expand last column header we encountered to full list width if (last_header) { + S32 old_width = last_header->getColumn()->getWidth(); S32 new_width = llmax(0, mItemListRect.mRight - last_header->getRect().mLeft); last_header->reshape(new_width, last_header->getRect().getHeight()); last_header->setVisible(mDisplayColumnHeaders && new_width > 0); - last_header->getColumn()->setWidth(new_width); - } + if (old_width != new_width) + { + last_header->getColumn()->setWidth(new_width); + header_changed_width = true; + } + } // propagate column widths to individual cells if (columns_changed_width || force_update) @@ -789,6 +795,20 @@ void LLScrollListCtrl::updateColumns(bool force_update) } } } + else if (header_changed_width) + { + item_list::iterator iter; + S32 index = last_header->getColumn()->mIndex; // Not always identical to last column! + for (iter = mItemList.begin(); iter != mItemList.end(); iter++) + { + LLScrollListItem *itemp = *iter; + LLScrollListCell* cell = itemp->getColumn(index); + if (cell) + { + cell->setWidth(last_header->getColumn()->getWidth()); + } + } + } } void LLScrollListCtrl::setHeadingHeight(S32 heading_height) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 808a9d63c6..9f8584cd8b 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1882,8 +1882,6 @@ bool LLAppViewer::cleanup() SUBSYSTEM_CLEANUP(LLAvatarAppearance); - SUBSYSTEM_CLEANUP(LLAvatarAppearance); - SUBSYSTEM_CLEANUP(LLPostProcess); LLTracker::cleanupInstance(); -- cgit v1.3 From 7b7667973b3ecaa857f1013c8084f3159105eec1 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 23 Nov 2020 14:29:07 +0200 Subject: DRTVWR-513 Resolved merge conflict from merge with DRTVWR-507 See changes from SL-13119 and SL-13190 --- indra/llui/llfolderviewmodel.cpp | 10 ---------- indra/newview/skins/default/xui/en/menu_wearable_list_item.xml | 8 -------- 2 files changed, 18 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp index e95cc12520..a028a32704 100644 --- a/indra/llui/llfolderviewmodel.cpp +++ b/indra/llui/llfolderviewmodel.cpp @@ -88,16 +88,6 @@ void LLFolderViewModelItemCommon::dirtyDescendantsFilter() //virtual void LLFolderViewModelItemCommon::addChild(LLFolderViewModelItem* child) { - // Avoid duplicates: bail out if that child is already present in the list - // Note: this happens when models are created before views - child_list_t::const_iterator iter; - for (iter = mChildren.begin(); iter != mChildren.end(); iter++) - { - if (child == *iter) - { - return; - } - } mChildren.push_back(child); child->setParent(this); dirtyFilter(); diff --git a/indra/newview/skins/default/xui/en/menu_wearable_list_item.xml b/indra/newview/skins/default/xui/en/menu_wearable_list_item.xml index 46b8b042d5..20c81c983b 100644 --- a/indra/newview/skins/default/xui/en/menu_wearable_list_item.xml +++ b/indra/newview/skins/default/xui/en/menu_wearable_list_item.xml @@ -71,14 +71,6 @@ - - - Date: Tue, 24 Nov 2020 04:20:06 +0200 Subject: Revert "SL-13479 Avatar menu tweaks" This reverts commit 05ce7511aa6ffebe78676d714a621a1fe04c66e2. --- indra/llui/llmenugl.cpp | 4 +- indra/newview/llviewermenu.cpp | 10 - indra/newview/llviewermenu.h | 4 - indra/newview/llvoavatarself.cpp | 8 +- .../skins/default/xui/en/menu_attachment_self.xml | 210 ++------------------- .../skins/default/xui/en/menu_avatar_self.xml | 2 +- indra/newview/skins/default/xui/en/menu_viewer.xml | 186 +----------------- 7 files changed, 20 insertions(+), 404 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index c2698fa648..5568a84494 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -79,7 +79,7 @@ const U32 LEFT_PAD_PIXELS = 3; const U32 LEFT_WIDTH_PIXELS = 15; const U32 LEFT_PLAIN_PIXELS = LEFT_PAD_PIXELS + LEFT_WIDTH_PIXELS; -const U32 RIGHT_PAD_PIXELS = 7; +const U32 RIGHT_PAD_PIXELS = 2; const U32 RIGHT_WIDTH_PIXELS = 15; const U32 RIGHT_PLAIN_PIXELS = RIGHT_PAD_PIXELS + RIGHT_WIDTH_PIXELS; @@ -95,7 +95,7 @@ const std::string SEPARATOR_NAME("separator"); const std::string VERTICAL_SEPARATOR_LABEL( "|" ); const std::string LLMenuGL::BOOLEAN_TRUE_PREFIX( "\xE2\x9C\x94" ); // U+2714 HEAVY CHECK MARK -const std::string LLMenuGL::BRANCH_SUFFIX( "\xe2\x96\xb8" ); // U+25B6 BLACK RIGHT-POINTING TRIANGLE +const std::string LLMenuGL::BRANCH_SUFFIX( "\xE2\x96\xB6" ); // U+25B6 BLACK RIGHT-POINTING TRIANGLE const std::string LLMenuGL::ARROW_UP ("^^^^^^^"); const std::string LLMenuGL::ARROW_DOWN("vvvvvvv"); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 590f3619b4..1ceec00c8f 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -185,15 +185,11 @@ const std::string SAVE_INTO_TASK_INVENTORY("Save Object Back to Object Contents" LLMenuGL* gAttachSubMenu = NULL; LLMenuGL* gDetachSubMenu = NULL; LLMenuGL* gTakeOffClothes = NULL; -LLMenuGL* gDetachAvatarMenu = NULL; -LLMenuGL* gDetachHUDAvatarMenu = NULL; LLContextMenu* gAttachScreenPieMenu = NULL; LLContextMenu* gAttachPieMenu = NULL; LLContextMenu* gAttachBodyPartPieMenus[9]; LLContextMenu* gDetachPieMenu = NULL; LLContextMenu* gDetachScreenPieMenu = NULL; -LLContextMenu* gDetachAttSelfMenu = NULL; -LLContextMenu* gDetachHUDAttSelfMenu = NULL; LLContextMenu* gDetachBodyPartPieMenus[9]; // @@ -448,9 +444,6 @@ void init_menus() gMenuAttachmentOther = LLUICtrlFactory::createFromFile( "menu_attachment_other.xml", gMenuHolder, registry); - gDetachHUDAttSelfMenu = gMenuHolder->getChild("Detach Self HUD", true); - gDetachAttSelfMenu = gMenuHolder->getChild("Detach Self", true); - gMenuLand = LLUICtrlFactory::createFromFile( "menu_land.xml", gMenuHolder, registry); @@ -507,9 +500,6 @@ void init_menus() gAttachSubMenu = gMenuBarView->findChildMenuByName("Attach Object", TRUE); gDetachSubMenu = gMenuBarView->findChildMenuByName("Detach Object", TRUE); - gDetachAvatarMenu = gMenuHolder->getChild("Avatar Detach", true); - gDetachHUDAvatarMenu = gMenuHolder->getChild("Avatar Detach HUD", true); - // Don't display the Memory console menu if the feature is turned off LLMenuItemCheckGL *memoryMenu = gMenuBarView->getChild("Memory", TRUE); if (memoryMenu) diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h index 1420db0940..a9db65ecba 100644 --- a/indra/newview/llviewermenu.h +++ b/indra/newview/llviewermenu.h @@ -189,14 +189,10 @@ extern LLContextMenu *gMenuMuteParticle; extern LLMenuGL* gAttachSubMenu; extern LLMenuGL* gDetachSubMenu; extern LLMenuGL* gTakeOffClothes; -extern LLMenuGL* gDetachAvatarMenu; -extern LLMenuGL* gDetachHUDAvatarMenu; extern LLContextMenu* gAttachScreenPieMenu; extern LLContextMenu* gDetachScreenPieMenu; -extern LLContextMenu* gDetachHUDAttSelfMenu; extern LLContextMenu* gAttachPieMenu; extern LLContextMenu* gDetachPieMenu; -extern LLContextMenu* gDetachAttSelfMenu; extern LLContextMenu* gAttachBodyPartPieMenus[9]; extern LLContextMenu* gDetachBodyPartPieMenus[9]; diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 66233a860e..58109b838e 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -465,8 +465,6 @@ BOOL LLVOAvatarSelf::buildMenus() if (gDetachBodyPartPieMenus[i]) { gDetachPieMenu->appendContextSubMenu( gDetachBodyPartPieMenus[i] ); - gDetachAttSelfMenu->appendContextSubMenu(gDetachBodyPartPieMenus[i]); - gDetachAvatarMenu->appendContextSubMenu(gDetachBodyPartPieMenus[i]); } else { @@ -495,14 +493,12 @@ BOOL LLVOAvatarSelf::buildMenus() LLMenuItemCallGL* item = LLUICtrlFactory::create(item_params); gDetachPieMenu->addChild(item); - gDetachAttSelfMenu->addChild(LLUICtrlFactory::create(item_params)); - gDetachAvatarMenu->addChild(LLUICtrlFactory::create(item_params)); + break; } } } } - // add screen attachments for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); @@ -536,8 +532,6 @@ BOOL LLVOAvatarSelf::buildMenus() item_params.on_enable.parameter = iter->first; item = LLUICtrlFactory::create(item_params); gDetachScreenPieMenu->addChild(item); - gDetachHUDAttSelfMenu->addChild(LLUICtrlFactory::create(item_params)); - gDetachHUDAvatarMenu->addChild(LLUICtrlFactory::create(item_params)); } } diff --git a/indra/newview/skins/default/xui/en/menu_attachment_self.xml b/indra/newview/skins/default/xui/en/menu_attachment_self.xml index 856bf4ce73..03c05e6591 100644 --- a/indra/newview/skins/default/xui/en/menu_attachment_self.xml +++ b/indra/newview/skins/default/xui/en/menu_attachment_self.xml @@ -2,6 +2,17 @@ + + + + - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -466,7 +284,7 @@ name="Help with avatars"> + parameter="https://community.secondlife.com/search/?q=avatar"/> Date: Thu, 3 Dec 2020 01:26:26 +0200 Subject: SL-14270 A bit of cleanup #3 Just in case and for clarity --- indra/llui/llfolderviewmodel.cpp | 2 ++ indra/newview/llconversationmodel.h | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp index a028a32704..a2ac9ffaa0 100644 --- a/indra/llui/llfolderviewmodel.cpp +++ b/indra/llui/llfolderviewmodel.cpp @@ -52,11 +52,13 @@ LLFolderViewModelItemCommon::~LLFolderViewModelItemCommon() { // Children don't belong to model, but to LLFolderViewItem, just mark them as having no parent std::for_each(mChildren.begin(), mChildren.end(), [](LLFolderViewModelItem* c) {c->setParent(NULL); }); + mChildren.clear(); // Don't leave dead pointer in parent if (mParent) { mParent->removeChild(this); + mParent = NULL; } } diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index 30c7481864..9787a263c7 100644 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -156,7 +156,8 @@ class LLConversationItemSession : public LLConversationItem public: LLConversationItemSession(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); LLConversationItemSession(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); - + virtual ~LLConversationItemSession() {} + /*virtual*/ bool hasChildren() const; LLPointer getIcon() const { return NULL; } void setSessionID(const LLUUID& session_id) { mUUID = session_id; mNeedsRefresh = true; } -- cgit v1.3 From 7ab3de94cd10cb6aa9d1f4a6607366edae101464 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 7 Dec 2020 19:29:39 +0200 Subject: Revert "SL-14270 Crash accessing deleted 'parent' via callback from child" There are random inventory's buildViewsTree crashes in branch with SL-14270 commit and there doesn't seem to be anything else inventory related that could have caused those. Reverting commits to see if it fixes crashes. --- indra/llui/llfolderviewmodel.cpp | 146 ------------------------------- indra/llui/llfolderviewmodel.h | 169 ++++++++++++++++++++++++++++-------- indra/newview/llconversationmodel.h | 3 +- 3 files changed, 134 insertions(+), 184 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp index a2ac9ffaa0..ea106b5fae 100644 --- a/indra/llui/llfolderviewmodel.cpp +++ b/indra/llui/llfolderviewmodel.cpp @@ -29,152 +29,6 @@ #include "llfolderviewmodel.h" #include "lltrans.h" -// LLFolderViewModelItemCommon - -LLFolderViewModelItemCommon::LLFolderViewModelItemCommon(LLFolderViewModelInterface& root_view_model) - : mSortVersion(-1), - mPassedFilter(true), - mPassedFolderFilter(true), - mStringMatchOffsetFilter(std::string::npos), - mStringFilterSize(0), - mFolderViewItem(NULL), - mLastFilterGeneration(-1), - mLastFolderFilterGeneration(-1), - mMarkedDirtyGeneration(-1), - mMostFilteredDescendantGeneration(-1), - mParent(NULL), - mRootViewModel(root_view_model) -{ - mChildren.clear(); //??? -} - -LLFolderViewModelItemCommon::~LLFolderViewModelItemCommon() -{ - // Children don't belong to model, but to LLFolderViewItem, just mark them as having no parent - std::for_each(mChildren.begin(), mChildren.end(), [](LLFolderViewModelItem* c) {c->setParent(NULL); }); - mChildren.clear(); - - // Don't leave dead pointer in parent - if (mParent) - { - mParent->removeChild(this); - mParent = NULL; - } -} - -void LLFolderViewModelItemCommon::dirtyFilter() -{ - if (mMarkedDirtyGeneration < 0) - { - mMarkedDirtyGeneration = mLastFilterGeneration; - } - mLastFilterGeneration = -1; - mLastFolderFilterGeneration = -1; - - // bubble up dirty flag all the way to root - if (mParent) - { - mParent->dirtyFilter(); - } -} - -void LLFolderViewModelItemCommon::dirtyDescendantsFilter() -{ - mMostFilteredDescendantGeneration = -1; - if (mParent) - { - mParent->dirtyDescendantsFilter(); - } -} - -//virtual -void LLFolderViewModelItemCommon::addChild(LLFolderViewModelItem* child) -{ - mChildren.push_back(child); - child->setParent(this); - dirtyFilter(); - requestSort(); -} - -//virtual -void LLFolderViewModelItemCommon::removeChild(LLFolderViewModelItem* child) -{ - mChildren.remove(child); - child->setParent(NULL); - dirtyDescendantsFilter(); - dirtyFilter(); -} - -//virtual -void LLFolderViewModelItemCommon::clearChildren() -{ - // As this is cleaning the whole list of children wholesale, we do need to delete the pointed objects - // This is different and not equivalent to calling removeChild() on each child - std::for_each(mChildren.begin(), mChildren.end(), DeletePointer()); - mChildren.clear(); - dirtyDescendantsFilter(); - dirtyFilter(); -} - -void LLFolderViewModelItemCommon::setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset /*= std::string::npos*/, std::string::size_type string_size /*= 0*/) -{ - mPassedFilter = passed; - mLastFilterGeneration = filter_generation; - mStringMatchOffsetFilter = string_offset; - mStringFilterSize = string_size; - mMarkedDirtyGeneration = -1; -} - -void LLFolderViewModelItemCommon::setPassedFolderFilter(bool passed, S32 filter_generation) -{ - mPassedFolderFilter = passed; - mLastFolderFilterGeneration = filter_generation; -} - -//virtual -bool LLFolderViewModelItemCommon::potentiallyVisible() -{ - return passedFilter() // we've passed the filter - || (getLastFilterGeneration() < mRootViewModel.getFilter().getFirstSuccessGeneration()) // or we don't know yet - || descendantsPassedFilter(); -} - -//virtual -bool LLFolderViewModelItemCommon::passedFilter(S32 filter_generation /*= -1*/) -{ - if (filter_generation < 0) - { - filter_generation = mRootViewModel.getFilter().getFirstSuccessGeneration(); - } - bool passed_folder_filter = mPassedFolderFilter && (mLastFolderFilterGeneration >= filter_generation); - bool passed_filter = mPassedFilter && (mLastFilterGeneration >= filter_generation); - return passed_folder_filter && (passed_filter || descendantsPassedFilter(filter_generation)); -} - -//virtual -bool LLFolderViewModelItemCommon::descendantsPassedFilter(S32 filter_generation /*= -1*/) -{ - if (filter_generation < 0) - { - filter_generation = mRootViewModel.getFilter().getFirstSuccessGeneration(); - } - return mMostFilteredDescendantGeneration >= filter_generation; -} - -// LLFolderViewModelCommon - -LLFolderViewModelCommon::LLFolderViewModelCommon() - : mTargetSortVersion(0), - mFolderView(NULL) -{} - -//virtual -void LLFolderViewModelCommon::requestSortAll() -{ - // sort everything - mTargetSortVersion++; -} - bool LLFolderViewModelCommon::needsSort(LLFolderViewModelItem* item) { return item->getSortVersion() < mTargetSortVersion; diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index 6e739a57a6..f4ddfa8f18 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -38,6 +38,7 @@ enum EInventorySortGroup SG_ITEM }; +class LLFontGL; class LLInventoryModel; class LLMenuGL; class LLUIImage; @@ -230,43 +231,134 @@ protected: class LLFolderViewModelItemCommon : public LLFolderViewModelItem { public: - LLFolderViewModelItemCommon(LLFolderViewModelInterface& root_view_model); - virtual ~LLFolderViewModelItemCommon() override; + LLFolderViewModelItemCommon(LLFolderViewModelInterface& root_view_model) + : mSortVersion(-1), + mPassedFilter(true), + mPassedFolderFilter(true), + mStringMatchOffsetFilter(std::string::npos), + mStringFilterSize(0), + mFolderViewItem(NULL), + mLastFilterGeneration(-1), + mLastFolderFilterGeneration(-1), + mMarkedDirtyGeneration(-1), + mMostFilteredDescendantGeneration(-1), + mParent(NULL), + mRootViewModel(root_view_model) + { + mChildren.clear(); + } - void requestSort() override { mSortVersion = -1; } - S32 getSortVersion() override { return mSortVersion; } - void setSortVersion(S32 version) override { mSortVersion = version;} + void requestSort() { mSortVersion = -1; } + S32 getSortVersion() { return mSortVersion; } + void setSortVersion(S32 version) { mSortVersion = version;} - S32 getLastFilterGeneration() const override { return mLastFilterGeneration; } + S32 getLastFilterGeneration() const { return mLastFilterGeneration; } S32 getLastFolderFilterGeneration() const { return mLastFolderFilterGeneration; } - S32 getMarkedDirtyGeneration() const override { return mMarkedDirtyGeneration; } - void dirtyFilter() override; - void dirtyDescendantsFilter() override; - bool hasFilterStringMatch() override; - std::string::size_type getFilterStringOffset() override; - std::string::size_type getFilterStringSize() override; + S32 getMarkedDirtyGeneration() const { return mMarkedDirtyGeneration; } + void dirtyFilter() + { + if(mMarkedDirtyGeneration < 0) + { + mMarkedDirtyGeneration = mLastFilterGeneration; + } + mLastFilterGeneration = -1; + mLastFolderFilterGeneration = -1; + + // bubble up dirty flag all the way to root + if (mParent) + { + mParent->dirtyFilter(); + } + } + void dirtyDescendantsFilter() + { + mMostFilteredDescendantGeneration = -1; + if (mParent) + { + mParent->dirtyDescendantsFilter(); + } + } + bool hasFilterStringMatch(); + std::string::size_type getFilterStringOffset(); + std::string::size_type getFilterStringSize(); typedef std::list child_list_t; - virtual void addChild(LLFolderViewModelItem* child) override; - virtual void removeChild(LLFolderViewModelItem* child) override; + virtual void addChild(LLFolderViewModelItem* child) + { + mChildren.push_back(child); + child->setParent(this); + dirtyFilter(); + requestSort(); + } + virtual void removeChild(LLFolderViewModelItem* child) + { + mChildren.remove(child); + child->setParent(NULL); + dirtyDescendantsFilter(); + dirtyFilter(); + } - virtual void clearChildren(); + virtual void clearChildren() + { + // As this is cleaning the whole list of children wholesale, we do need to delete the pointed objects + // This is different and not equivalent to calling removeChild() on each child + std::for_each(mChildren.begin(), mChildren.end(), DeletePointer()); + mChildren.clear(); + dirtyDescendantsFilter(); + dirtyFilter(); + } child_list_t::const_iterator getChildrenBegin() const { return mChildren.begin(); } child_list_t::const_iterator getChildrenEnd() const { return mChildren.end(); } child_list_t::size_type getChildrenCount() const { return mChildren.size(); } - void setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0) override; - void setPassedFolderFilter(bool passed, S32 filter_generation) override; - virtual bool potentiallyVisible() override; - virtual bool passedFilter(S32 filter_generation = -1) override; - virtual bool descendantsPassedFilter(S32 filter_generation = -1) override; + void setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0) + { + mPassedFilter = passed; + mLastFilterGeneration = filter_generation; + mStringMatchOffsetFilter = string_offset; + mStringFilterSize = string_size; + mMarkedDirtyGeneration = -1; + } + + void setPassedFolderFilter(bool passed, S32 filter_generation) + { + mPassedFolderFilter = passed; + mLastFolderFilterGeneration = filter_generation; + } + + virtual bool potentiallyVisible() + { + return passedFilter() // we've passed the filter + || (getLastFilterGeneration() < mRootViewModel.getFilter().getFirstSuccessGeneration()) // or we don't know yet + || descendantsPassedFilter(); + } + + virtual bool passedFilter(S32 filter_generation = -1) + { + if (filter_generation < 0) + { + filter_generation = mRootViewModel.getFilter().getFirstSuccessGeneration(); + } + bool passed_folder_filter = mPassedFolderFilter && (mLastFolderFilterGeneration >= filter_generation); + bool passed_filter = mPassedFilter && (mLastFilterGeneration >= filter_generation); + return passed_folder_filter && (passed_filter || descendantsPassedFilter(filter_generation)); + } + + virtual bool descendantsPassedFilter(S32 filter_generation = -1) + { + if (filter_generation < 0) + { + filter_generation = mRootViewModel.getFilter().getFirstSuccessGeneration(); + } + return mMostFilteredDescendantGeneration >= filter_generation; + } protected: - virtual void setParent(LLFolderViewModelItem* parent) override { mParent = parent; } - virtual bool hasParent() override { return mParent != NULL; } + virtual void setParent(LLFolderViewModelItem* parent) { mParent = parent; } + virtual bool hasParent() { return mParent != NULL; } S32 mSortVersion; bool mPassedFilter; @@ -283,7 +375,7 @@ protected: LLFolderViewModelItem* mParent; LLFolderViewModelInterface& mRootViewModel; - void setFolderViewItem(LLFolderViewItem* folder_view_item) override { mFolderViewItem = folder_view_item;} + void setFolderViewItem(LLFolderViewItem* folder_view_item) { mFolderViewItem = folder_view_item;} LLFolderViewItem* mFolderViewItem; }; @@ -292,15 +384,20 @@ protected: class LLFolderViewModelCommon : public LLFolderViewModelInterface { public: - LLFolderViewModelCommon(); - - virtual ~LLFolderViewModelCommon() override {} + LLFolderViewModelCommon() + : mTargetSortVersion(0), + mFolderView(NULL) + {} - virtual void requestSortAll() override; - virtual std::string getStatusText() override; - virtual void filter() override; + virtual void requestSortAll() + { + // sort everything + mTargetSortVersion++; + } + virtual std::string getStatusText(); + virtual void filter(); - void setFolderView(LLFolderView* folder_view) override { mFolderView = folder_view;} + void setFolderView(LLFolderView* folder_view) { mFolderView = folder_view;} protected: bool needsSort(class LLFolderViewModelItem* item); @@ -324,7 +421,7 @@ public: mFilter(filter) {} - virtual ~LLFolderViewModel() override + virtual ~LLFolderViewModel() { delete mSorter; mSorter = NULL; @@ -336,14 +433,14 @@ public: virtual const SortType& getSorter() const { return *mSorter; } virtual void setSorter(const SortType& sorter) { mSorter = new SortType(sorter); requestSortAll(); } - virtual FilterType& getFilter() override { return *mFilter; } - virtual const FilterType& getFilter() const override { return *mFilter; } + virtual FilterType& getFilter() { return *mFilter; } + virtual const FilterType& getFilter() const { return *mFilter; } virtual void setFilter(const FilterType& filter) { mFilter = new FilterType(filter); } // By default, we assume the content is available. If a network fetch mechanism is implemented for the model, // this method needs to be overloaded and return the relevant fetch status. - virtual bool contentsReady() override { return true; } - virtual bool isFolderComplete(LLFolderViewFolder* folder) override { return true; } + virtual bool contentsReady() { return true; } + virtual bool isFolderComplete(LLFolderViewFolder* folder) { return true; } struct ViewModelCompare { @@ -364,7 +461,7 @@ public: const SortType& mSorter; }; - void sort(LLFolderViewFolder* folder) override + void sort(LLFolderViewFolder* folder) { if (needsSort(folder->getViewModelItem())) { diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index 9787a263c7..30c7481864 100644 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -156,8 +156,7 @@ class LLConversationItemSession : public LLConversationItem public: LLConversationItemSession(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); LLConversationItemSession(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); - virtual ~LLConversationItemSession() {} - + /*virtual*/ bool hasChildren() const; LLPointer getIcon() const { return NULL; } void setSessionID(const LLUUID& session_id) { mUUID = session_id; mNeedsRefresh = true; } -- cgit v1.3