From 7509d929d80fbaa8134a6c98b4651eb052de96eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Liru=20F=C3=A6rs?= Date: Sun, 22 Mar 2020 09:07:46 -0400 Subject: [PATCH] Make everyone upset! Reorganize group notices! Feature request: clickable names and group names Remove dead space in group notices that has always plagued us --- indra/newview/llgroupnotify.cpp | 85 ++++++++++--------- .../newview/skins/default/xui/de/strings.xml | 6 +- .../skins/default/xui/en-us/strings.xml | 6 +- .../newview/skins/default/xui/es/strings.xml | 6 +- .../newview/skins/default/xui/pt/strings.xml | 8 +- 5 files changed, 61 insertions(+), 50 deletions(-) diff --git a/indra/newview/llgroupnotify.cpp b/indra/newview/llgroupnotify.cpp index 4d70787a7..96245ea62 100644 --- a/indra/newview/llgroupnotify.cpp +++ b/indra/newview/llgroupnotify.cpp @@ -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(×tamp); @@ -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(), diff --git a/indra/newview/skins/default/xui/de/strings.xml b/indra/newview/skins/default/xui/de/strings.xml index 9c95ef0bd..abd6aa23b 100644 --- a/indra/newview/skins/default/xui/de/strings.xml +++ b/indra/newview/skins/default/xui/de/strings.xml @@ -1790,9 +1790,11 @@ Where tag = tag string to match. Removes bot's matching the tag. Vor OK - Gruppenmitteilung Gruppenmitteilungen - Gesendet von + +von [NAME] +im [GROUP] + Im Anhang: Alte Mitteilungen anzeigen oder hier Auswahl treffen, um keine Mitteilungen mehr zu erhalten. Anhang öffnen diff --git a/indra/newview/skins/default/xui/en-us/strings.xml b/indra/newview/skins/default/xui/en-us/strings.xml index 0666c0342..b88854ab6 100644 --- a/indra/newview/skins/default/xui/en-us/strings.xml +++ b/indra/newview/skins/default/xui/en-us/strings.xml @@ -3331,9 +3331,11 @@ Where tag = tag string to match. Removes bot's matching the tag. Next OK - Group Notice Group Notices - Sent by + +by [NAME] +in [GROUP] + Attached: View past notices or opt-out of receiving these messages here. Open Attachment diff --git a/indra/newview/skins/default/xui/es/strings.xml b/indra/newview/skins/default/xui/es/strings.xml index d6541038d..3562a6ff1 100644 --- a/indra/newview/skins/default/xui/es/strings.xml +++ b/indra/newview/skins/default/xui/es/strings.xml @@ -3298,9 +3298,11 @@ Where tag = tag string to match. Removes bot's matching the tag. Siguiente OK - Aviso de Grupo Avisos de Grupo - Enviado por + +por [NAME] +en [GROUP] + Anexado: Ver noticias anteriores o bien optar por no recibir estos mensajes aquí. Abrir Adjunto diff --git a/indra/newview/skins/default/xui/pt/strings.xml b/indra/newview/skins/default/xui/pt/strings.xml index 02ac1ceb5..395f212a3 100644 --- a/indra/newview/skins/default/xui/pt/strings.xml +++ b/indra/newview/skins/default/xui/pt/strings.xml @@ -1172,14 +1172,12 @@ Pessoas com contas gratuitas não poderão acessar o Second Life no momento para OK - - Anúncio de grupo - Anúncios do grupo - - Enviado por + +por [NAME] +en [GROUP] Anexo: