From: Flavio Tordini Date: Fri, 24 Jul 2015 07:35:08 +0000 (+0200) Subject: Clickable links and better ellipsis X-Git-Tag: 2.5~68 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a87b37f9956bcd58cffc0d16c8167beafcb6a731;p=minitube Clickable links and better ellipsis --- diff --git a/src/loadingwidget.cpp b/src/loadingwidget.cpp index 2b2a5e5..0f030d9 100644 --- a/src/loadingwidget.cpp +++ b/src/loadingwidget.cpp @@ -45,6 +45,8 @@ LoadingWidget::LoadingWidget(QWidget *parent) : QWidget(parent) { descriptionLabel->setForegroundRole(QPalette::Text); descriptionLabel->setWordWrap(true); descriptionLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Expanding); + descriptionLabel->setTextFormat(Qt::RichText); + descriptionLabel->setOpenExternalLinks(true); layout->addWidget(descriptionLabel); progressBar = new QProgressBar(this); @@ -96,11 +98,15 @@ void LoadingWidget::setVideo(Video *video) { QString videoDesc = video->description(); if (videoDesc.length() > maxDescLength) { videoDesc.truncate(maxDescLength-1); - videoDesc.append("..."); + videoDesc = videoDesc.trimmed(); + videoDesc.append("…"); + } else if (videoDesc.endsWith(QLatin1String(" ..."))) { + videoDesc = videoDesc.left(videoDesc.length() - 4); + videoDesc.append("…"); } + videoDesc.replace(QRegExp("(https?://\\S+)"), "\\1"); QFont descFont(titleFont); descFont.setPixelSize(descFont.pixelSize() / 2); - descFont.setHintingPreference(QFont::PreferNoHinting); descriptionLabel->setFont(descFont); descriptionLabel->setText(videoDesc); bool hiddenDesc = height() < 400;