From 3780c86538ee667bb74f0a70bcf870ec554eda75 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 16 Apr 2021 00:01:57 +0300 Subject: SL-15028 Move guidebook code into own flaoter To help with dispatcher and unify code --- indra/newview/llfloaterhowto.cpp | 66 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 indra/newview/llfloaterhowto.cpp (limited to 'indra/newview/llfloaterhowto.cpp') diff --git a/indra/newview/llfloaterhowto.cpp b/indra/newview/llfloaterhowto.cpp new file mode 100644 index 0000000000..d6c4ed1b20 --- /dev/null +++ b/indra/newview/llfloaterhowto.cpp @@ -0,0 +1,66 @@ +/** + * @file llfloaterhowto.cpp + * @brief A variant of web floater meant to open guidebook + * + * $LicenseInfo:firstyear=2021&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2021, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterhowto.h" + +#include "llfloaterreg.h" +#include "llviewercontrol.h" +#include "llweb.h" + + +LLFloaterHowTo::LLFloaterHowTo(const Params& key) : + LLFloaterWebContent(key) +{ + mShowPageTitle = false; +} + +BOOL LLFloaterHowTo::postBuild() +{ + LLFloaterWebContent::postBuild(); + + return TRUE; +} + +void LLFloaterHowTo::onOpen(const LLSD& key) +{ + LLFloaterWebContent::Params p(key); + if (!p.url.isProvided() || p.url.getValue().empty()) + { + std::string url = gSavedSettings.getString("GuidebookURL"); + p.url = LLWeb::expandURLSubstitutions(url, LLSD()); + p.show_chrome = false; + p.preferred_media_size = LLRect(0, 500, 300, 0); + } + + LLFloaterWebContent::onOpen(p); +} + +LLFloaterHowTo* LLFloaterHowTo::getInstance() +{ + return LLFloaterReg::getTypedInstance("how_to"); +} -- cgit v1.2.3 From d298c9983b9ffc9f212fd9325b1ff5f0e6e7aaab Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 20 Apr 2021 20:00:42 +0300 Subject: SL-14906 Fix LLFloaterHowTo overriding stored position preferred_media_size was repositioning the floater --- indra/newview/llfloaterhowto.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'indra/newview/llfloaterhowto.cpp') diff --git a/indra/newview/llfloaterhowto.cpp b/indra/newview/llfloaterhowto.cpp index d6c4ed1b20..665955c946 100644 --- a/indra/newview/llfloaterhowto.cpp +++ b/indra/newview/llfloaterhowto.cpp @@ -33,6 +33,9 @@ #include "llweb.h" +const S32 STACK_WIDTH = 300; +const S32 STACK_HEIGHT = 505; // content will be 500 + LLFloaterHowTo::LLFloaterHowTo(const Params& key) : LLFloaterWebContent(key) { @@ -49,15 +52,19 @@ BOOL LLFloaterHowTo::postBuild() void LLFloaterHowTo::onOpen(const LLSD& key) { LLFloaterWebContent::Params p(key); - if (!p.url.isProvided() || p.url.getValue().empty()) - { - std::string url = gSavedSettings.getString("GuidebookURL"); - p.url = LLWeb::expandURLSubstitutions(url, LLSD()); - p.show_chrome = false; - p.preferred_media_size = LLRect(0, 500, 300, 0); - } + std::string url = gSavedSettings.getString("GuidebookURL"); + p.url = LLWeb::expandURLSubstitutions(url, LLSD()); + p.show_chrome = false; LLFloaterWebContent::onOpen(p); + + // Elements from LLFloaterWebContent did not pick up restored size (save_rect) of LLFloaterHowTo + // set the stack size and position (alternative to preferred_media_size) + LLLayoutStack *stack = getChild("stack1"); + LLRect stack_rect = stack->getRect(); + stack->reshape(STACK_WIDTH, STACK_HEIGHT); + stack->setOrigin(stack_rect.mLeft, stack_rect.mTop - STACK_HEIGHT); + stack->updateLayout(); } LLFloaterHowTo* LLFloaterHowTo::getInstance() -- cgit v1.2.3 From cfb6ca569b2c834520ce50564e857dfc06831675 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 6 May 2021 00:46:14 +0300 Subject: SL-15168 Viewer side functionality for guidebook window opening --- indra/newview/llfloaterhowto.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloaterhowto.cpp') diff --git a/indra/newview/llfloaterhowto.cpp b/indra/newview/llfloaterhowto.cpp index 665955c946..9db733db25 100644 --- a/indra/newview/llfloaterhowto.cpp +++ b/indra/newview/llfloaterhowto.cpp @@ -52,8 +52,11 @@ BOOL LLFloaterHowTo::postBuild() void LLFloaterHowTo::onOpen(const LLSD& key) { LLFloaterWebContent::Params p(key); - std::string url = gSavedSettings.getString("GuidebookURL"); - p.url = LLWeb::expandURLSubstitutions(url, LLSD()); + if (!p.url.isProvided() || p.url.getValue().empty()) + { + std::string url = gSavedSettings.getString("GuidebookURL"); + p.url = LLWeb::expandURLSubstitutions(url, LLSD()); + } p.show_chrome = false; LLFloaterWebContent::onOpen(p); -- cgit v1.2.3 From cb42bc2823931b84ce079423a471a332dc332b0c Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 6 May 2021 21:57:46 +0300 Subject: SL-15168 Viewer side functionality for guidebook window opening #2 --- indra/newview/llfloaterhowto.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'indra/newview/llfloaterhowto.cpp') diff --git a/indra/newview/llfloaterhowto.cpp b/indra/newview/llfloaterhowto.cpp index 9db733db25..ef40060807 100644 --- a/indra/newview/llfloaterhowto.cpp +++ b/indra/newview/llfloaterhowto.cpp @@ -61,13 +61,16 @@ void LLFloaterHowTo::onOpen(const LLSD& key) LLFloaterWebContent::onOpen(p); - // Elements from LLFloaterWebContent did not pick up restored size (save_rect) of LLFloaterHowTo - // set the stack size and position (alternative to preferred_media_size) - LLLayoutStack *stack = getChild("stack1"); - LLRect stack_rect = stack->getRect(); - stack->reshape(STACK_WIDTH, STACK_HEIGHT); - stack->setOrigin(stack_rect.mLeft, stack_rect.mTop - STACK_HEIGHT); - stack->updateLayout(); + if (p.preferred_media_size().isEmpty()) + { + // Elements from LLFloaterWebContent did not pick up restored size (save_rect) of LLFloaterHowTo + // set the stack size and position (alternative to preferred_media_size) + LLLayoutStack *stack = getChild("stack1"); + LLRect stack_rect = stack->getRect(); + stack->reshape(STACK_WIDTH, STACK_HEIGHT); + stack->setOrigin(stack_rect.mLeft, stack_rect.mTop - STACK_HEIGHT); + stack->updateLayout(); + } } LLFloaterHowTo* LLFloaterHowTo::getInstance() -- cgit v1.2.3 From e886a5e34320c6448293dc05ac89a41b2b4a7f69 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 11 May 2021 01:48:21 +0300 Subject: SL-15168 Reset title of guidebook when opening --- indra/newview/llfloaterhowto.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/llfloaterhowto.cpp') diff --git a/indra/newview/llfloaterhowto.cpp b/indra/newview/llfloaterhowto.cpp index ef40060807..6e913b08ea 100644 --- a/indra/newview/llfloaterhowto.cpp +++ b/indra/newview/llfloaterhowto.cpp @@ -51,6 +51,12 @@ BOOL LLFloaterHowTo::postBuild() void LLFloaterHowTo::onOpen(const LLSD& key) { + // LLFloaterHowTo is intended to be opened as a location specific guidebook + // with custom titles, reset the title, LLUrlFloaterDispatchHandler will + // set needed one later + // todo: make title into general parameter for LLFloaterWebContent + setTitle(getString("default_tittle")); + LLFloaterWebContent::Params p(key); if (!p.url.isProvided() || p.url.getValue().empty()) { -- cgit v1.2.3 From e4dc39cf19a00ab148de6d1bd6c4cd229cf545f5 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Tue, 11 May 2021 13:25:57 +0300 Subject: SL-15249 FIXED The F1 key does not close the guidebook after clicking a link --- indra/newview/llfloaterhowto.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'indra/newview/llfloaterhowto.cpp') diff --git a/indra/newview/llfloaterhowto.cpp b/indra/newview/llfloaterhowto.cpp index 6e913b08ea..2bd2c47dd7 100644 --- a/indra/newview/llfloaterhowto.cpp +++ b/indra/newview/llfloaterhowto.cpp @@ -83,3 +83,16 @@ LLFloaterHowTo* LLFloaterHowTo::getInstance() { return LLFloaterReg::getTypedInstance("how_to"); } + +BOOL LLFloaterHowTo::handleKeyHere(KEY key, MASK mask) +{ + BOOL handled = FALSE; + + if (KEY_F1 == key ) + { + closeFloater(); + handled = TRUE; + } + + return handled; +} -- cgit v1.2.3 From 8eede89c0f3edb7eb6289dc023c3b8e67ae33fd9 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 11 May 2021 20:46:11 +0300 Subject: Revert "SL-15168 Changed format" --- indra/newview/llfloaterhowto.cpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'indra/newview/llfloaterhowto.cpp') diff --git a/indra/newview/llfloaterhowto.cpp b/indra/newview/llfloaterhowto.cpp index 2bd2c47dd7..ddb3ea04ba 100644 --- a/indra/newview/llfloaterhowto.cpp +++ b/indra/newview/llfloaterhowto.cpp @@ -51,12 +51,6 @@ BOOL LLFloaterHowTo::postBuild() void LLFloaterHowTo::onOpen(const LLSD& key) { - // LLFloaterHowTo is intended to be opened as a location specific guidebook - // with custom titles, reset the title, LLUrlFloaterDispatchHandler will - // set needed one later - // todo: make title into general parameter for LLFloaterWebContent - setTitle(getString("default_tittle")); - LLFloaterWebContent::Params p(key); if (!p.url.isProvided() || p.url.getValue().empty()) { -- cgit v1.2.3 From 79f8c024c34efad93ce55ebacf656e6fc9804198 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 9 Jun 2021 19:46:23 +0300 Subject: SL-15363 how_to on older viewers is forced to persist Older how_to floater is not set to persist in between sessions and gets stuck, ranamed new how_to into guidebook to avoid the issue --- indra/newview/llfloaterhowto.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloaterhowto.cpp') diff --git a/indra/newview/llfloaterhowto.cpp b/indra/newview/llfloaterhowto.cpp index ddb3ea04ba..a359fb7c7d 100644 --- a/indra/newview/llfloaterhowto.cpp +++ b/indra/newview/llfloaterhowto.cpp @@ -75,7 +75,7 @@ void LLFloaterHowTo::onOpen(const LLSD& key) LLFloaterHowTo* LLFloaterHowTo::getInstance() { - return LLFloaterReg::getTypedInstance("how_to"); + return LLFloaterReg::getTypedInstance("guidebook"); } BOOL LLFloaterHowTo::handleKeyHere(KEY key, MASK mask) -- cgit v1.2.3