From: Flavio Tordini Date: Wed, 22 Jul 2015 15:52:11 +0000 (+0200) Subject: Better font on Mac, better title splitting X-Git-Tag: 2.5~71 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b3c50e792138872c1ac6f4b99b40a9781a4e2464;p=minitube Better font on Mac, better title splitting --- diff --git a/src/loadingwidget.cpp b/src/loadingwidget.cpp index 5530b74..2b2a5e5 100644 --- a/src/loadingwidget.cpp +++ b/src/loadingwidget.cpp @@ -64,14 +64,15 @@ void LoadingWidget::setVideo(Video *video) { QFont titleFont; #ifdef APP_MAC titleFont.setFamily("Helvetica Neue"); -#endif -#ifdef APP_WIN + titleFont.setStyleName("Thin"); +#elif APP_WIN titleFont.setFamily("Segoe UI Light"); -#endif titleFont.setStyleName("Light"); +#else + titleFont.setStyleName("Light"); +#endif int smallerDimension = qMin(height(), width()); titleFont.setPixelSize(smallerDimension / 12); - titleFont.setHintingPreference(QFont::PreferNoHinting); QFontMetrics fm(titleFont); int textHeightInPixels = fm.height(); int spacing = textHeightInPixels / 2; @@ -80,9 +81,13 @@ void LoadingWidget::setVideo(Video *video) { QString title = video->title(); // enhance legibility by splitting the title - title = title.replace(" - ", "

"); - title = title.replace("] ", "]

"); - title = title.replace(" [", "

["); + title.replace(QLatin1String(" - "), QLatin1String("

")); + title.replace(QLatin1String(" | "), QLatin1String("

")); + title.replace(QLatin1String(" — "), QLatin1String("

")); + title.replace(QLatin1String("] "), QLatin1String("]

")); + title.replace(QLatin1String(" ["), QLatin1String("

[")); + title.replace(QLatin1String(" ("), QLatin1String("

(")); + title.replace(QLatin1String(") "), QLatin1String(")

")); titleLabel->setText(title); titleLabel->setVisible(window()->height() > 100); titleLabel->setFont(titleFont);