Skip to content
Snippets Groups Projects
Commit 726c2f44 authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Hook up changing notecard font

parent 11229745
No related branches found
No related tags found
2 merge requests!3Update to main branch,!2Rebase onto current main branch
......@@ -85,11 +85,36 @@ LLPreviewNotecard::LLPreviewNotecard(const LLSD& key) //const LLUUID& item_id,
LLPreviewNotecard::~LLPreviewNotecard()
{
delete mLiveFile;
mFontNameConnection.disconnect();
mFontSizeConnection.disconnect();
}
BOOL LLPreviewNotecard::postBuild()
{
mEditor = getChild<LLViewerTextEditor>("Notecard Editor");
if (auto fontp = LLFontGL::getFont(LLFontDescriptor(gSavedSettings.getString("NotecardFontName"), gSavedSettings.getString("NotecardFontSize"), 0).normalize()))
{
mEditor->setFont(fontp);
}
mFontNameConnection = gSavedSettings.getControl("NotecardFontName")->getCommitSignal()->connect([this](LLControlVariable*, const LLSD& newval, const LLSD&)
{
std::string text = mEditor->getText();
if (auto fontp = LLFontGL::getFont(LLFontDescriptor(newval.asString(), gSavedSettings.getString("NotecardFontSize"), 0).normalize()))
{
mEditor->setFont(fontp);
}
mEditor->setText(text);
});
mFontSizeConnection = gSavedSettings.getControl("NotecardFontSize")->getCommitSignal()->connect([this](LLControlVariable*, const LLSD& newval, const LLSD&)
{
std::string text = mEditor->getText();
if (auto fontp = LLFontGL::getFont(LLFontDescriptor(gSavedSettings.getString("NotecardFontName"), newval.asString(), 0).normalize()))
{
mEditor->setFont(fontp);
}
mEditor->setText(text);
});
mEditor->setNotecardInfo(mItemUUID, mObjectID, getKey());
mEditor->makePristine();
......
......@@ -140,6 +140,9 @@ class LLPreviewNotecard final : public LLPreview, public LLVOInventoryListener
LLUUID mObjectID;
LLLiveLSLFile* mLiveFile;
boost::signals2::connection mFontNameConnection;
boost::signals2::connection mFontSizeConnection;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment