Make everyone upset! Reorganize group notices!

Feature request: clickable names and group names
Remove dead space in group notices that has always plagued us
This commit is contained in:
Liru Færs
2020-03-22 09:07:46 -04:00
parent c7e03600aa
commit 7509d929d8
5 changed files with 61 additions and 50 deletions

View File

@@ -36,6 +36,7 @@
#include "llfocusmgr.h"
#include "llavataractions.h"
#include "llbutton.h"
#include "lliconctrl.h"
#include "llfloaterchat.h" // for add_chat_history()
@@ -94,15 +95,15 @@ LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject,
mHasInventory(has_inventory),
mInventoryOffer(NULL)
{
const S32 VPAD = 2;
const S32 TOP = getRect().getHeight() - 32; // Get past the top menu bar
const S32 BOTTOM_PAD = VPAD * 2;
const S32 BTN_TOP = BOTTOM_PAD + BTN_HEIGHT + VPAD;
const S32 RIGHT = getRect().getWidth() - HPAD - HPAD;
const S32 LINE_HEIGHT = 16;
constexpr S32 PAD = 2;
const S32 TOP = getRect().getHeight() - 28; // Get past the top menu bar
const S32 BOTTOM_PAD = PAD * 2;
const S32 BTN_TOP = BOTTOM_PAD + BTN_HEIGHT + PAD;
const S32 RIGHT = getRect().getWidth() - HPAD;
constexpr S32 LINE_HEIGHT = 16;
const S32 LABEL_WIDTH = 64;
const S32 ICON_WIDTH = 64;
constexpr S32 LABEL_WIDTH = 64;
constexpr S32 ICON_WIDTH = 64;
time_t timestamp = (time_t)time_stamp.secondsSinceEpoch();
if (!timestamp) time(&timestamp);
@@ -122,48 +123,58 @@ LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject,
setBackgroundColor( gColors.getColor("GroupNotifyBoxColor") );
S32 y = TOP;
S32 x = HPAD + HPAD;
S32 x = ICON_WIDTH + HPAD + PAD;
static const auto text_color = gColors.getColor("GroupNotifyTextColor");
class NoticeText : public LLTextBox
{
public:
NoticeText(const std::string& name, const LLRect& rect, const std::string& text = LLStringUtil::null, const LLFontGL* font = NULL)
NoticeText(const std::string& name, const LLRect& rect, const std::string& text = LLStringUtil::null, const LLFontGL* font = NULL)
: LLTextBox(name, rect, text, font)
{
setHAlign(LLFontGL::RIGHT);
setFontShadow(LLFontGL::DROP_SHADOW_SOFT);
setBorderVisible(FALSE);
setColor( gColors.getColor("GroupNotifyTextColor") );
setBackgroundColor( gColors.getColor("GroupNotifyBoxColor") );
setColor(text_color);
setBackgroundColor(LLColor4::transparent);
}
};
// Title
addChild(new NoticeText(std::string("title"),LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),LLTrans::getString("GroupNotifyGroupNotice"),LLFontGL::getFontSansSerifHuge()));
static LLStyleSP headerstyle = nullptr;
if (!headerstyle)
{
headerstyle = new LLStyle(true, text_color, LLStringUtil::null);
headerstyle->mBold = true;
}
const auto bottom = y - ICON_WIDTH;
y -= llfloor(1.5f*LINE_HEIGHT);
auto links = new LLTextEditor(std::string("group"), LLRect(x, y + 5, RIGHT, bottom), S32_MAX, LLStringUtil::null, nullptr, false, true); // Top adjustment to line up with icon
links->setBorderVisible(FALSE);
links->setReadOnlyFgColor(text_color);
links->setReadOnlyBgColor(LLColor4::transparent);
links->setEnabled(false);
links->setTakesNonScrollClicks(TRUE);
links->setHideScrollbarForShortDocs(TRUE);
links->setWordWrap(TRUE);
x += HPAD + HPAD + ICON_WIDTH;
links->appendText(subject, false, false, headerstyle, false); // This is from a user, do not force replace.
links->appendText(time_buf, false, true, nullptr, true);
links->appendText(LLTrans::getString("GroupNotifyBy", LLSD().with("NAME", from_name).with("GROUP", group_name)), false, true, nullptr, true);
addChild(links);
std::stringstream from;
from << LLTrans::getString("GroupNotifySentBy") << " " + from_name << LLTrans::getString(",") + " " << group_name;
x = HPAD;
addChild(new NoticeText(std::string("group"),LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),from.str(),LLFontGL::getFontSansSerif()));
y -= (LINE_HEIGHT + VPAD);
x = HPAD + HPAD;
// TODO: change this to be the group icon.
LLIconCtrl* icon = new LLIconCtrl(std::string("icon"),
LLRect(x, y, x+ICON_WIDTH, y-ICON_WIDTH),
group_insignia.isNull() ? "notify_box_icon.tga" : group_insignia.asString());
LLRect(x, y, x+ICON_WIDTH, bottom),
group_insignia.isNull() ? "icon_groupnotice.tga" : group_insignia.asString());
icon->setMouseOpaque(FALSE);
addChild(icon);
x += HPAD + HPAD + ICON_WIDTH;
y = bottom - PAD*2;
// If we have inventory with this message, leave room for the name.
S32 box_bottom = BTN_TOP + (mHasInventory ? (LINE_HEIGHT + 2*VPAD) : 0);
S32 box_bottom = BTN_TOP + (mHasInventory ? (LINE_HEIGHT + 2*PAD) : 0);
LLTextEditor* text = new LLViewerTextEditor(std::string("box"),
LLRect(x, y, RIGHT, box_bottom),
@@ -172,15 +183,11 @@ LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject,
LLFontGL::getFontSansSerif(),
FALSE,
true);
text->setBorderVisible(false);
static const LLStyleSP headerstyle(new LLStyle(true,LLColor4::black,"SansSerifBig"));
static const LLStyleSP datestyle(new LLStyle(true,LLColor4::black,"serif"));
static const LLStyleSP msgstyle(new LLStyle(true, LLColor4::grey4, LLStringUtil::null));
text->appendText(subject + '\n',false,false,headerstyle,false);
text->appendText(time_buf,false,false,datestyle,false);
text->appendText(std::string(" \n\n") + message,false,false,msgstyle,false);
text->appendText(message, false, false, msgstyle, false);
LLColor4 semi_transparent(1.0f,1.0f,1.0f,0.8f);
text->setCursor(0,0);
@@ -196,11 +203,11 @@ LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject,
addChild(text);
y = box_bottom - VPAD;
y = box_bottom - PAD;
if (mHasInventory)
{
addChild(new NoticeText(std::string("subjecttitle"),LLRect(x,y,x + LABEL_WIDTH,y - LINE_HEIGHT),LLTrans::getString("GroupNotifyAttached"),LLFontGL::getFontSansSerif()));
addChild(new NoticeText(std::string("subjecttitle"), LLRect(x,y,x + LABEL_WIDTH,y - LINE_HEIGHT), LLTrans::getString("GroupNotifyAttached") + ' ', LLFontGL::getFontSansSerif()));
LLUIImagePtr item_icon = LLInventoryIcon::getIcon(mInventoryOffer->mType,
LLInventoryType::IT_TEXTURE,
@@ -240,7 +247,7 @@ LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject,
S32 btn_width = 80;
S32 wide_btn_width = 136;
LLRect btn_rect;
x = 3 * HPAD;
x = 2 * HPAD;
btn_rect.setOriginAndSize(x,
BOTTOM_PAD,
@@ -364,10 +371,10 @@ bool LLGroupNotifyBox::onNewNotification(const LLSD& notify)
gNotifyBoxView->addChild(new LLGroupNotifyBox(payload["subject"].asString(),
payload["message"].asString(),
payload["sender_name"].asString(),
payload.has("sender_id") ? LLAvatarActions::getSLURL(payload["sender_id"]) : payload["sender_name"].asString(),
payload["group_id"].asUUID(),
group_data.mInsigniaID,
group_data.mName,
LLGroupActions::getSLURL(payload["group_id"].asUUID()),
notification->getDate(),
payload["inventory_offer"].isDefined(),
payload["inventory_name"].asString(),

View File

@@ -1790,9 +1790,11 @@ Where tag = tag string to match. Removes bot's matching the tag.</string>
<!-- used in the construction of a Group Notice blue dialog box, buttons, tooltip etc. Seems to be no longer utilized by code in Viewer 2.0 -->
<string name="next">Vor</string>
<string name="ok">OK</string>
<string name="GroupNotifyGroupNotice">Gruppenmitteilung</string>
<string name="GroupNotifyGroupNotices">Gruppenmitteilungen</string>
<string name="GroupNotifySentBy">Gesendet von</string>
<string name="GroupNotifyBy">
von [NAME]
im [GROUP]
</string>
<string name="GroupNotifyAttached">Im Anhang:</string>
<string name="GroupNotifyViewPastNotices">Alte Mitteilungen anzeigen oder hier Auswahl treffen, um keine Mitteilungen mehr zu erhalten.</string>
<string name="GroupNotifyOpenAttachment">Anhang öffnen</string>

View File

@@ -3331,9 +3331,11 @@ Where tag = tag string to match. Removes bot's matching the tag.
<!-- used in the construction of a Group Notice blue dialog box, buttons, tooltip etc. Seems to be no longer utilized by code in Viewer 2.0 -->
<string name="next">Next</string>
<string name="ok">OK</string>
<string name="GroupNotifyGroupNotice">Group Notice</string>
<string name="GroupNotifyGroupNotices">Group Notices</string>
<string name="GroupNotifySentBy">Sent by</string>
<string name="GroupNotifyBy">
by [NAME]
in [GROUP]
</string>
<string name="GroupNotifyAttached">Attached:</string>
<string name="GroupNotifyViewPastNotices">View past notices or opt-out of receiving these messages here.</string>
<string name="GroupNotifyOpenAttachment">Open Attachment</string>

View File

@@ -3298,9 +3298,11 @@ Where tag = tag string to match. Removes bot's matching the tag.
<!-- used in the construction of a Group Notice blue dialog box, buttons, tooltip etc. Seems to be no longer utilized by code in Viewer 2.0 -->
<string name="next">Siguiente</string>
<string name="ok">OK</string>
<string name="GroupNotifyGroupNotice">Aviso de Grupo</string>
<string name="GroupNotifyGroupNotices">Avisos de Grupo</string>
<string name="GroupNotifySentBy">Enviado por</string>
<string name="GroupNotifyBy">
por [NAME]
en [GROUP]
</string>
<string name="GroupNotifyAttached">Anexado:</string>
<string name="GroupNotifyViewPastNotices">Ver noticias anteriores o bien optar por no recibir estos mensajes aquí.</string>
<string name="GroupNotifyOpenAttachment">Abrir Adjunto</string>

View File

@@ -1172,14 +1172,12 @@ Pessoas com contas gratuitas não poderão acessar o Second Life no momento para
<string name="ok">
OK
</string>
<string name="GroupNotifyGroupNotice">
Anúncio de grupo
</string>
<string name="GroupNotifyGroupNotices">
Anúncios do grupo
</string>
<string name="GroupNotifySentBy">
Enviado por
<string name="GroupNotifyBy">
por [NAME]
en [GROUP]
</string>
<string name="GroupNotifyAttached">
Anexo: