summaryrefslogtreecommitdiff
path: root/indra/llui/lltoolbarview.cpp
diff options
context:
space:
mode:
authorRichard Nelson <richard@lindenlab.com>2011-09-29 08:26:54 -0700
committerRichard Nelson <richard@lindenlab.com>2011-09-29 08:26:54 -0700
commit788c5cdf978e6844663c1d3734fc5d604de5e7cb (patch)
treeee73a63306484a2bf747f7fcfa501843964a74b5 /indra/llui/lltoolbarview.cpp
parent71ed326f51770b215ba5dd2ac8d159c3b764c2d2 (diff)
parent6a49f2947f05963c577a1644c16a8affc779da63 (diff)
Merge
Diffstat (limited to 'indra/llui/lltoolbarview.cpp')
-rw-r--r--indra/llui/lltoolbarview.cpp53
1 files changed, 31 insertions, 22 deletions
diff --git a/indra/llui/lltoolbarview.cpp b/indra/llui/lltoolbarview.cpp
index f60598edcb..bb4ea815c9 100644
--- a/indra/llui/lltoolbarview.cpp
+++ b/indra/llui/lltoolbarview.cpp
@@ -117,12 +117,8 @@ bool LLToolBarView::loadToolbars()
LLToolBarView::ToolbarSet toolbar_set;
// Load the default toolbars.xml file
- std::string toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "toolbars.xml");
- if (!gDirUtilp->fileExists(toolbar_file))
- {
- llwarns << "User toolbars def not found -> use default" << llendl;
- toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "toolbars.xml");
- }
+ // *TODO : pick up the user's toolbar setting if existing
+ std::string toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "toolbars.xml");
LLXMLNodePtr root;
if(!LLXMLNode::parseFile(toolbar_file, root, NULL))
@@ -174,17 +170,43 @@ void LLToolBarView::saveToolbars() const
{
// Build the parameter tree from the toolbar data
LLToolBarView::ToolbarSet toolbar_set;
+
+ // *TODO : factorize that code a bit...
if (mToolbarLeft)
{
- addToToolset(mToolbarLeft->getCommandsList(),toolbar_set.left_toolbar);
+ command_id_list_t& command_list = mToolbarLeft->getCommandsList();
+ for (command_id_list_t::const_iterator it = command_list.begin();
+ it != command_list.end();
+ ++it)
+ {
+ LLCommandId::Params command;
+ command.name = it->name();
+ toolbar_set.left_toolbar.commands.add(command);
+ }
}
if (mToolbarRight)
{
- addToToolset(mToolbarRight->getCommandsList(),toolbar_set.right_toolbar);
+ command_id_list_t& command_list = mToolbarRight->getCommandsList();
+ for (command_id_list_t::const_iterator it = command_list.begin();
+ it != command_list.end();
+ ++it)
+ {
+ LLCommandId::Params command;
+ command.name = it->name();
+ toolbar_set.right_toolbar.commands.add(command);
+ }
}
if (mToolbarBottom)
{
- addToToolset(mToolbarBottom->getCommandsList(),toolbar_set.bottom_toolbar);
+ command_id_list_t& command_list = mToolbarBottom->getCommandsList();
+ for (command_id_list_t::const_iterator it = command_list.begin();
+ it != command_list.end();
+ ++it)
+ {
+ LLCommandId::Params command;
+ command.name = it->name();
+ toolbar_set.bottom_toolbar.commands.add(command);
+ }
}
// Serialize the parameter tree
@@ -206,19 +228,6 @@ void LLToolBarView::saveToolbars() const
}
}
-// Enumerate the commands in command_list and add them as Params to the toolbar
-void LLToolBarView::addToToolset(command_id_list_t& command_list, Toolbar& toolbar) const
-{
- for (command_id_list_t::const_iterator it = command_list.begin();
- it != command_list.end();
- ++it)
- {
- LLCommandId::Params command;
- command.name = it->name();
- toolbar.commands.add(command);
- }
-}
-
void LLToolBarView::draw()
{
static bool debug_print = true;