From f3f31519d4f7bc4c525124df6582f2b77fb3e807 Mon Sep 17 00:00:00 2001 From: Kai Philipp Date: Wed, 5 Apr 2017 15:55:48 +0200 Subject: [PATCH] #326 shortened too long usernames in gui --- src/gui/qt/gametable/mynamelabel.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gui/qt/gametable/mynamelabel.cpp b/src/gui/qt/gametable/mynamelabel.cpp index 96bd0842..aa19f31d 100644 --- a/src/gui/qt/gametable/mynamelabel.cpp +++ b/src/gui/qt/gametable/mynamelabel.cpp @@ -92,11 +92,21 @@ void MyNameLabel::setText ( const QString &t, bool trans, bool guest, bool compu } else { linkString = QString("http://pokerth.net/redirect_user_profile.php?nick="+QUrl::toPercentEncoding(t)); } + + // truncate nicknames longer than 10 characters + QString t2 = t; + if(t2.size() > 10){ + int chop = t.size() - 10 - 3; + t2.chop(chop); + t2.append("..."); + } + + QString tTruncated; if(trans) { - text = ""+t+""; + text = ""+t2+""; } else { - text = ""+t+""; + text = ""+t2+""; } } else {