fix: elide user notes (#6318)

This commit is contained in:
pajlada
2025-07-12 13:20:05 +02:00
committed by GitHub
parent fba845f978
commit 49aa83244c
5 changed files with 130 additions and 38 deletions
+2 -6
View File
@@ -56,7 +56,6 @@ constexpr QStringView TEXT_UNAVAILABLE = u"(not available)";
constexpr QStringView TEXT_PRONOUNS = u"Pronouns: %1";
constexpr QStringView TEXT_UNSPECIFIED = u"(unspecified)";
constexpr QStringView TEXT_LOADING = u"(loading...)";
constexpr qsizetype NOTES_PREVIEW_LENGTH = 80;
using namespace chatterino;
@@ -490,6 +489,7 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, Split *split)
auto notesPreview = layout.emplace<Label>().assign(&ui_.notesPreview);
notesPreview->setVisible(false);
notesPreview->setShouldElide(true);
auto lineMod = layout.emplace<Line>(false);
@@ -1143,10 +1143,6 @@ void UserInfoPopup::updateNotes()
static QRegularExpression spaceRegex{"\\s+"};
auto previewText = "Notes: " + userData->notes.replace(spaceRegex, " ");
if (previewText.length() > NOTES_PREVIEW_LENGTH)
{
previewText = previewText.left(NOTES_PREVIEW_LENGTH - 3) + "...";
}
this->ui_.notesPreview->setText(previewText);
this->ui_.notesPreview->setVisible(true);
@@ -1173,7 +1169,7 @@ UserInfoPopup::TimeoutWidget::TimeoutWidget()
title->addStretch(1);
auto label = title.emplace<Label>(text);
label->setStyleSheet("color: #BBB");
label->setHasOffset(false);
label->setHasPadding(false);
title->addStretch(1);
auto hbox = vbox.emplace<QHBoxLayout>().withoutMargin();