FIRE-15575: Change persisted LLLayoutStack layout settings into a per-account setting

Ansariel 2015-02-17 14:04:06 +01:00
parent c2ef0bf500
commit e130d1d133
5 changed files with 65 additions and 16 deletions

View File

@ -251,7 +251,7 @@ LLLayoutStack::LLLayoutStack(const LLLayoutStack::Params& p)
std::string res = std::string("layout_size_") + getName();
LLStringUtil::replaceChar(res, ' ', '_');
mSizeControlName = res;
LLControlGroup* controlGroup = LLUI::sSettingGroups["config"];
LLControlGroup* controlGroup = LLUI::sSettingGroups["account"];
if (!controlGroup->controlExists(mSizeControlName))
{
LL_WARNS() << "declaring control " << mSizeControlName << LL_ENDL;
@ -263,7 +263,7 @@ LLLayoutStack::LLLayoutStack(const LLLayoutStack::Params& p)
}
else
{
mSavedSizes = LLControlGroup::getInstance("Global")->getLLSD(mSizeControlName);
mSavedSizes = controlGroup->getLLSD(mSizeControlName);
}
}
// </FS:Zi>
@ -271,10 +271,10 @@ LLLayoutStack::LLLayoutStack(const LLLayoutStack::Params& p)
LLLayoutStack::~LLLayoutStack()
{
// <FS:Zi> Record new size for this panel
// <FS:Zi> Save new sizes for this layout stack's panels
if (mSaveSizes)
{
LLControlGroup::getInstance("Global")->setLLSD(mSizeControlName, mSavedSizes);
LLUI::sSettingGroups["account"]->setLLSD(mSizeControlName, mSavedSizes);
}
// </FS:Zi>
@ -1069,3 +1069,39 @@ void LLLayoutStack::updateResizeBarLimits()
}
}
// <FS:Ansariel> Applier for dimensions
void LLLayoutStack::refreshFromSettings()
{
if (!mSaveSizes)
{
return;
}
LLSD dimensions = LLUI::sSettingGroups["account"]->getLLSD(mSizeControlName);
if (dimensions.size() < mPanels.size())
{
return;
}
for (size_t i = 0; i < mPanels.size(); ++i)
{
LLLayoutPanel* panelp = mPanels.at(i);
S32 width = panelp->getRect().getWidth();
S32 height = panelp->getRect().getHeight();
S32 dim = dimensions[i].asInteger();
if (mOrientation == LLLayoutStack::HORIZONTAL)
{
width = dim;
}
else
{
height = dim;
}
panelp->reshape(width, height, TRUE);
}
mNeedsLayout = true;
}
// </FS:Ansariel>

View File

@ -94,6 +94,9 @@ public:
static void updateClass();
// <FS:Ansariel> Applier for dimensions
void refreshFromSettings();
protected:
LLLayoutStack(const Params&);
friend class LLUICtrlFactory;

View File

@ -19993,18 +19993,6 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<integer>0</integer>
</map>
<key>layout_size_chat_bar_stack</key>
<map>
<key>Comment</key>
<string>Fractional size for layout panel chat_bar_stack</string>
<key>Type</key>
<string>LLSD</string>
<key>Value</key>
<array>
<integer>400</integer>
<integer>600</integer>
</array>
</map>
<key>FSEnableGrowl</key>
<map>
<key>Comment</key>

View File

@ -909,6 +909,20 @@
<string></string>
</map>
<!-- End of settings imported from Exodus -->
<key>layout_size_chat_bar_stack</key>
<map>
<key>Backup</key>
<boolean>1</boolean>
<key>Comment</key>
<string>Fractional size for layout panel chat_bar_stack</string>
<key>Type</key>
<string>LLSD</string>
<key>Value</key>
<array>
<integer>400</integer>
<integer>600</integer>
</array>
</map>
</map>
</llsd>

View File

@ -1283,6 +1283,14 @@ bool idle_startup()
// Overwrite default user settings with user settings
LLAppViewer::instance()->loadSettingsFromDirectory("Account");
// <FS:Ansariel> Restore bottom toolbar layout now he have the user settings
LLLayoutStack* chat_bar_stack = gToolBarView->findChild<LLLayoutStack>("chat_bar_stack");
if (chat_bar_stack)
{
chat_bar_stack->refreshFromSettings();
}
// </FS:Ansariel>
// 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");