SL-15028 Move guidebook code into own flaoter

To help with dispatcher and unify code
meow-7.2.2
Andrey Kleshchev 2021-04-16 00:01:57 +03:00
parent 96daac0ab4
commit 3780c86538
6 changed files with 123 additions and 17 deletions

View File

@ -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

View File

@ -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");
}

View File

@ -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

View File

@ -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();

View File

@ -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>);

View File

@ -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;
}
};