From aed889ae614243392b58ce6e58356b399bdab8f5 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Sun, 28 Oct 2018 14:35:36 -0400 Subject: [PATCH] HaikuDepot: Truncate copyright label to 45 characters at most. Some packages have excessively long copyright labels that were forcing the HaikuDepot window to become too wide. So in this case, put the full copyright string in the tooltip, and only the first 45 characters in the label. --- src/apps/haikudepot/ui/PackageInfoView.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/apps/haikudepot/ui/PackageInfoView.cpp b/src/apps/haikudepot/ui/PackageInfoView.cpp index b390109fa8..b93bc82648 100644 --- a/src/apps/haikudepot/ui/PackageInfoView.cpp +++ b/src/apps/haikudepot/ui/PackageInfoView.cpp @@ -395,7 +395,12 @@ public: fTitleView->SetText(package.Title()); BString publisher = package.Publisher().Name(); - fPublisherView->SetText(publisher); + if (publisher.CountChars() > 45) { + fPublisherView->SetToolTip(publisher); + fPublisherView->SetText(publisher.TruncateChars(45) + .Append(B_UTF8_ELLIPSIS)); + } else + fPublisherView->SetText(publisher); BString version = B_TRANSLATE("%Version%"); version.ReplaceAll("%Version%", package.Version().ToString());