From b3c50e792138872c1ac6f4b99b40a9781a4e2464 Mon Sep 17 00:00:00 2001 From: Flavio Tordini Date: Wed, 22 Jul 2015 17:52:11 +0200 Subject: [PATCH] Better font on Mac, better title splitting --- src/loadingwidget.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) 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); -- 2.39.5