summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2009-10-08 22:39:17 +0000
committerSteven Bennetts <steve@lindenlab.com>2009-10-08 22:39:17 +0000
commit4c89e7389383e2943334ad8ec185b8935cbe7db8 (patch)
tree5854b9d843f2b31d70676f82a11aa456cd2dde22 /indra/llui
parente11ed1f01fd8733adc122a5efe82a9bfc2f78734 (diff)
Fixed a problem where floaters that failed to load their XML would still be opened. This was particularly a problem with Modal Dialogs since the UI would loose focus with no floater to respond to.
Reviewed by Leyla
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llfloater.cpp6
-rw-r--r--indra/llui/llfloater.h2
-rw-r--r--indra/llui/llfloaterreg.cpp9
-rw-r--r--indra/llui/lluictrlfactory.cpp16
-rw-r--r--indra/llui/lluictrlfactory.h2
5 files changed, 23 insertions, 12 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index b7a15a2b33..51e2b5dea4 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -2564,10 +2564,10 @@ void LLFloater::initFromParams(const LLFloater::Params& p)
LLFastTimer::DeclareTimer POST_BUILD("Floater Post Build");
-void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node)
+bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node)
{
Params params(LLUICtrlFactory::getDefaultParams<LLFloater>());
- LLXUIParser::instance().readXUI(node, params);
+ LLXUIParser::instance().readXUI(node, params); // *TODO: Error checking
if (output_node)
{
@@ -2613,5 +2613,7 @@ void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr o
gFloaterView->adjustToFitScreen(this, FALSE); // Floaters loaded from XML should all fit on screen
moveResizeHandlesToFront();
+
+ return true; // *TODO: Error checking
}
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index 17ffc94014..7a6c3f6863 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -144,7 +144,7 @@ public:
static void setupParamsForExport(Params& p, LLView* parent);
void initFromParams(const LLFloater::Params& p);
- void initFloaterXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node = NULL);
+ bool initFloaterXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node = NULL);
/*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false);
/*virtual*/ BOOL canSnapTo(const LLView* other_view);
diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp
index a63b1b085c..815260dff3 100644
--- a/indra/llui/llfloaterreg.cpp
+++ b/indra/llui/llfloaterreg.cpp
@@ -121,8 +121,13 @@ LLFloater* LLFloaterReg::getInstance(const std::string& name, const LLSD& key)
res = build_func(key);
- LLUICtrlFactory::getInstance()->buildFloater(res, xui_file, NULL);
-
+ bool success = LLUICtrlFactory::getInstance()->buildFloater(res, xui_file, NULL);
+ if (!success)
+ {
+ llwarns << "Failed to buid floater type: '" << name << "'." << llendl;
+ return NULL;
+ }
+
// Note: key should eventually be a non optional LLFloater arg; for now, set mKey to be safe
res->mKey = key;
res->setInstanceName(name);
diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp
index 4ce6677294..209ee76940 100644
--- a/indra/llui/lluictrlfactory.cpp
+++ b/indra/llui/lluictrlfactory.cpp
@@ -170,7 +170,7 @@ static LLFastTimer::DeclareTimer FTM_BUILD_FLOATERS("Build Floaters");
//-----------------------------------------------------------------------------
// buildFloater()
//-----------------------------------------------------------------------------
-void LLUICtrlFactory::buildFloater(LLFloater* floaterp, const std::string& filename, LLXMLNodePtr output_node)
+bool LLUICtrlFactory::buildFloater(LLFloater* floaterp, const std::string& filename, LLXMLNodePtr output_node)
{
LLFastTimer timer(FTM_BUILD_FLOATERS);
LLXMLNodePtr root;
@@ -182,22 +182,24 @@ void LLUICtrlFactory::buildFloater(LLFloater* floaterp, const std::string& filen
if (!LLUICtrlFactory::getLocalizedXMLNode(filename, root))
{
llwarns << "Couldn't parse floater from: " << LLUI::getLocalizedSkinPath() + gDirUtilp->getDirDelimiter() + filename << llendl;
- return;
+ return false;
}
}
else if (!LLUICtrlFactory::getLayeredXMLNode(filename, root))
{
llwarns << "Couldn't parse floater from: " << LLUI::getSkinPath() + gDirUtilp->getDirDelimiter() + filename << llendl;
- return;
+ return false;
}
// root must be called floater
if( !(root->hasName("floater") || root->hasName("multi_floater")) )
{
llwarns << "Root node should be named floater in: " << filename << llendl;
- return;
+ return false;
}
-
+
+ bool res = true;
+
lldebugs << "Building floater " << filename << llendl;
mFileNames.push_back(gDirUtilp->findSkinnedFilename(LLUI::getSkinPath(), filename));
{
@@ -210,7 +212,7 @@ void LLUICtrlFactory::buildFloater(LLFloater* floaterp, const std::string& filen
floaterp->getCommitCallbackRegistrar().pushScope();
floaterp->getEnableCallbackRegistrar().pushScope();
- floaterp->initFloaterXML(root, floaterp->getParent(), output_node);
+ res = floaterp->initFloaterXML(root, floaterp->getParent(), output_node);
floaterp->setXMLFilename(filename);
@@ -223,6 +225,8 @@ void LLUICtrlFactory::buildFloater(LLFloater* floaterp, const std::string& filen
}
}
mFileNames.pop_back();
+
+ return res;
}
//-----------------------------------------------------------------------------
diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h
index 3c77c655b8..5e6dad312c 100644
--- a/indra/llui/lluictrlfactory.h
+++ b/indra/llui/lluictrlfactory.h
@@ -157,7 +157,7 @@ public:
return ParamDefaults<typename T::Params, 0>::instance().get();
}
- void buildFloater(LLFloater* floaterp, const std::string &filename, LLXMLNodePtr output_node);
+ bool buildFloater(LLFloater* floaterp, const std::string &filename, LLXMLNodePtr output_node);
BOOL buildPanel(LLPanel* panelp, const std::string &filename, LLXMLNodePtr output_node = NULL);
// Does what you want for LLFloaters and LLPanels