Fix LLLayoutStack saving undefined values if persisting its layout; Also only write to settings if the LLLayoutStack gets destroyed instead of per frame

Ansariel 2015-02-17 10:56:47 +01:00
parent 4a6e25964a
commit c72ef6f7ee
2 changed files with 21 additions and 10 deletions

View File

@ -271,6 +271,13 @@ LLLayoutStack::LLLayoutStack(const LLLayoutStack::Params& p)
LLLayoutStack::~LLLayoutStack()
{
// <FS:Zi> Record new size for this panel
if (mSaveSizes)
{
LLControlGroup::getInstance("Global")->setLLSD(mSizeControlName, mSavedSizes);
}
// </FS:Zi>
e_panel_list_t panels = mPanels; // copy list of panel pointers
mPanels.clear(); // clear so that removeChild() calls don't cause trouble
std::for_each(panels.begin(), panels.end(), DeletePointer());
@ -484,7 +491,9 @@ void LLLayoutStack::updateLayout()
F32 cur_pos = (mOrientation == HORIZONTAL) ? 0.f : (F32)getRect().getHeight();
S32 index=0;
// <FS:Zi> Record new size for this panel
mSavedSizes = LLSD();
// </FS:Zi>
BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
{
F32 panel_dim = llmax(panelp->getExpandedMinDim(), panelp->mTargetDim);
@ -562,19 +571,11 @@ void LLLayoutStack::updateLayout()
// <FS:Zi> Record new size for this panel
if (mSaveSizes)
{
mSavedSizes[index] = panelp->mTargetDim;
index++;
mSavedSizes.append(panelp->mTargetDim);
}
// </FS:Zi>
}
// <FS:Zi> Save new sizes for this layout stack's panels
if (mSaveSizes)
{
LLControlGroup::getInstance("Global")->setLLSD(mSizeControlName, mSavedSizes);
}
// </FS:Zi>
updateResizeBarLimits();
// clear animation flag at end, since panel resizes will set it

View File

@ -226,6 +226,7 @@
#include "llfloatersearch.h"
#include "llfloatersidepanelcontainer.h"
#include "llnotificationmanager.h"
#include "lltoolbarview.h"
#include "NACLantispam.h"
#include "rlvhandler.h"
#include "streamtitledisplay.h"
@ -1282,6 +1283,15 @@ bool idle_startup()
// Overwrite default user settings with user settings
LLAppViewer::instance()->loadSettingsFromDirectory("Account");
LLLayoutStack* chat_bar_stack = gToolBarView->findChild<LLLayoutStack>("chat_bar_stack");
if (chat_bar_stack)
{
LLSD persisted_sizes = //gSavedPerAccountSettings.getLLSD("layout_size_chat_bar_stack");
gSavedSettings.getLLSD("layout_size_chat_bar_stack");
LL_INFOS() << "ADBG: size = " << persisted_sizes.size() << LL_ENDL;
}
// Convert 'LogInstantMessages' into 'KeepConversationLogTranscripts' for backward compatibility (CHUI-743).
// <FS:CR> FIRE-11410 - Don't do this, handle it in settings restore and first run
//LLControlVariablePtr logInstantMessagesControl = gSavedPerAccountSettings.getControl("LogInstantMessages");