summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-04-16 00:01:57 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-04-16 01:24:29 +0300
commit3780c86538ee667bb74f0a70bcf870ec554eda75 (patch)
tree38e2e4ba086553dc740a996a33b20b0af2d3ec0e /indra/newview
parent96daac0ab458a3e1cd425ee4b580470e6b02416f (diff)
SL-15028 Move guidebook code into own flaoter
To help with dispatcher and unify code
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/CMakeLists.txt2
-rw-r--r--indra/newview/llfloaterhowto.cpp66
-rw-r--r--indra/newview/llfloaterhowto.h51
-rw-r--r--indra/newview/llstartup.cpp9
-rw-r--r--indra/newview/llviewerfloaterreg.cpp3
-rw-r--r--indra/newview/llviewermenu.cpp9
6 files changed, 123 insertions, 17 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 456fcdf574..405b4e09ba 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -255,6 +255,7 @@ set(viewer_SOURCE_FILES
llfloaterhandler.cpp
llfloaterhelpbrowser.cpp
llfloaterhoverheight.cpp
+ llfloaterhowto.cpp
llfloaterhud.cpp
llfloaterimagepreview.cpp
llfloaterimsessiontab.cpp
@@ -890,6 +891,7 @@ set(viewer_HEADER_FILES
llfloaterhandler.h
llfloaterhelpbrowser.h
llfloaterhoverheight.h
+ llfloaterhowto.h
llfloaterhud.h
llfloaterimagepreview.h
llfloaterimnearbychat.h
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<LLFloaterHowTo>("how_to");
+}
diff --git a/indra/newview/llfloaterhowto.h b/indra/newview/llfloaterhowto.h
new file mode 100644
index 0000000000..e08d102e2a
--- /dev/null
+++ b/indra/newview/llfloaterhowto.h
@@ -0,0 +1,51 @@
+/**
+ * @file llfloaterhowto.h
+ * @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$
+ */
+
+#ifndef LL_LLFLOATERHOWTO_H
+#define LL_LLFLOATERHOWTO_H
+
+#include "llfloaterwebcontent.h"
+
+class LLMediaCtrl;
+
+
+class LLFloaterHowTo :
+ public LLFloaterWebContent
+{
+public:
+
+ LLFloaterHowTo(const Params& key);
+
+ /*virtual*/ void onOpen(const LLSD& key);
+
+ static LLFloaterHowTo* getInstance();
+
+private:
+ /*virtual*/ BOOL postBuild();
+};
+
+#endif // LL_LLFLOATERHOWTO_H
+
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index b7606f7f23..486c33cb43 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -1905,14 +1905,7 @@ bool idle_startup()
// on with this install.
gSavedSettings.setBOOL("ShowStartLocation", TRUE);
- LLFloaterWebContent::Params p;
- std::string url = gSavedSettings.getString("GuidebookURL");
- p.url = LLWeb::expandURLSubstitutions(url, LLSD());
- p.show_chrome = false;
- p.show_page_title = false;
- p.preferred_media_size = LLRect(0, 500, 300, 0);
-
- LLFloaterReg::toggleInstanceOrBringToFront("how_to", p);
+ LLFloaterReg::toggleInstanceOrBringToFront("how_to");
}
display_startup();
diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp
index 46ff441719..de184392f9 100644
--- a/indra/newview/llviewerfloaterreg.cpp
+++ b/indra/newview/llviewerfloaterreg.cpp
@@ -76,6 +76,7 @@
#include "llfloatergroups.h"
#include "llfloaterhelpbrowser.h"
#include "llfloaterhoverheight.h"
+#include "llfloaterhowto.h"
#include "llfloaterhud.h"
#include "llfloaterimagepreview.h"
#include "llfloaterimsession.h"
@@ -362,7 +363,7 @@ void LLViewerFloaterReg::registerFloaters()
LLFloaterReg::add("search", "floater_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSearch>);
LLFloaterReg::add("my_profile", "floater_my_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebProfile::create);
LLFloaterReg::add("profile", "floater_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebProfile::create);
- LLFloaterReg::add("how_to", "floater_how_to.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create);
+ LLFloaterReg::add("how_to", "floater_how_to.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterHowTo>);
LLFloaterReg::add("big_preview", "floater_big_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBigPreview>);
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 78f6f23bc5..8ae245b924 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -7746,14 +7746,7 @@ class LLToggleHowTo : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
- LLFloaterWebContent::Params p;
- std::string url = gSavedSettings.getString("GuidebookURL");
- p.url = LLWeb::expandURLSubstitutions(url, LLSD());
- p.show_chrome = false;
- p.show_page_title = false;
- p.preferred_media_size = LLRect(0, 500, 300, 0);
-
- LLFloaterReg::toggleInstanceOrBringToFront("how_to", p);
+ LLFloaterReg::toggleInstanceOrBringToFront("how_to");
return true;
}
};