Simple update check mechanism, and tons of notification tweaking to make the notifications look less crap.

This commit is contained in:
Shyotl
2018-02-08 01:26:09 -06:00
parent 30df7dacde
commit 2dc46964b4
12 changed files with 375 additions and 17 deletions

View File

@@ -54,6 +54,7 @@
#include "llfloaterchat.h" // for add_chat_history()
#include "lloverlaybar.h" // for gOverlayBar
#include "lluictrlfactory.h"
#include "llcheckboxctrl.h"
#include "hippogridmanager.h"
@@ -183,6 +184,8 @@ LLNotifyBox::LLNotifyBox(LLNotificationPtr notification)
bool layout_script_dialog(notification->getName() == "ScriptDialog" || notification->getName() == "ScriptDialogGroup");
LLRect rect = mIsTip ? getNotifyTipRect(message)
: getNotifyRect(is_textbox ? 10 : mNumOptions, layout_script_dialog, mIsCaution);
if ((form->getIgnoreType() == LLNotificationForm::IGNORE_WITH_DEFAULT_RESPONSE || form->getIgnoreType() == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE))
rect.mBottom -= BTN_HEIGHT;
setRect(rect);
setFollows(mIsTip ? (FOLLOWS_BOTTOM|FOLLOWS_RIGHT) : (FOLLOWS_TOP|FOLLOWS_RIGHT));
setBackgroundVisible(FALSE);
@@ -359,6 +362,45 @@ LLNotifyBox::LLNotifyBox(LLNotificationPtr notification)
addButton("OK", "OK", false, true, layout_script_dialog);
mAddedDefaultBtn = true;
}
std::string check_title;
if (form->getIgnoreType() == LLNotificationForm::IGNORE_WITH_DEFAULT_RESPONSE)
{
check_title = LLNotificationTemplates::instance().getGlobalString("skipnexttime");
}
else if (form->getIgnoreType() == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE)
{
check_title = LLNotificationTemplates::instance().getGlobalString("alwayschoose");
}
if (!check_title.empty())
{
const LLFontGL* font = LLResMgr::getInstance()->getRes(LLFONT_SANSSERIF);
S32 line_height = llfloor(font->getLineHeight() + 0.99f);
// Extend dialog for "check next time"
S32 max_msg_width = getRect().getWidth() - HPAD * 9;
S32 check_width = S32(font->getWidth(check_title) + 0.99f) + 16;
max_msg_width = llmax(max_msg_width, check_width);
S32 msg_x = (getRect().getWidth() - max_msg_width) / 2;
LLRect check_rect;
check_rect.setOriginAndSize(msg_x, BOTTOM_PAD + BTN_HEIGHT + VPAD*2 + (BTN_HEIGHT + VPAD) * (mNumButtons / 3),
max_msg_width, line_height);
LLCheckboxCtrl* check = new LLCheckboxCtrl(std::string("check"), check_rect, check_title, font,
// Lambda abuse.
[this](LLUICtrl* ctrl, const LLSD& param)
{
this->mNotification->setIgnored(ctrl->getValue());
});
check->setEnabledColor(LLUI::sColorsGroup->getColor(mIsCaution ? "AlertCautionTextColor" : "AlertTextColor"));
if (mIsCaution)
{
check->setButtonColor(LLUI::sColorsGroup->getColor("ButtonCautionImageColor"));
}
addChild(check);
}
if (++sNotifyBoxCount <= 0)
LL_WARNS() << "A notification was mishandled. sNotifyBoxCount = " << sNotifyBoxCount << LL_ENDL;