]> git.sur5r.net Git - minitube/commitdiff
Better font on Mac, better title splitting
authorFlavio Tordini <flavio.tordini@gmail.com>
Wed, 22 Jul 2015 15:52:11 +0000 (17:52 +0200)
committerFlavio Tordini <flavio.tordini@gmail.com>
Wed, 22 Jul 2015 15:52:11 +0000 (17:52 +0200)
src/loadingwidget.cpp

index 5530b742773f467fc864754722bb3b0ba9ab3603..2b2a5e517c855591d94eb6fc762099a69fb02119 100644 (file)
@@ -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(" - ", "<p>");
-    title = title.replace("] ", "]<p>");
-    title = title.replace(" [", "<p>[");
+    title.replace(QLatin1String(" - "), QLatin1String("<p>"));
+    title.replace(QLatin1String(" | "), QLatin1String("<p>"));
+    title.replace(QLatin1String(" — "), QLatin1String("<p>"));
+    title.replace(QLatin1String("] "), QLatin1String("]<p>"));
+    title.replace(QLatin1String(" ["), QLatin1String("<p>["));
+    title.replace(QLatin1String(" ("), QLatin1String("<p>("));
+    title.replace(QLatin1String(") "), QLatin1String(")<p>"));
     titleLabel->setText(title);
     titleLabel->setVisible(window()->height() > 100);
     titleLabel->setFont(titleFont);