From 56234f04fc1fe85303fd8d12e5c771a2100d88ed Mon Sep 17 00:00:00 2001 From: <> Date: Sun, 1 Aug 2010 14:50:38 +0200 Subject: [PATCH] Use FontUtils everywhere --- minitube.pro | 7 ++++--- src/AboutView.cpp | 1 + src/SearchView.cpp | 9 +++------ src/playlist/PrettyItemDelegate.cpp | 12 +++--------- src/thlibrary/thblackbar.cpp | 9 +++------ 5 files changed, 14 insertions(+), 24 deletions(-) diff --git a/minitube.pro b/minitube.pro index de883f8..0c00ef2 100755 --- a/minitube.pro +++ b/minitube.pro @@ -11,7 +11,6 @@ QT += network \ xml \ phonon include(src/qtsingleapplication/qtsingleapplication.pri) -include(src/thlibrary/thlibrary.pri) HEADERS += src/MainWindow.h \ src/SearchView.h \ src/MediaView.h \ @@ -41,7 +40,8 @@ HEADERS += src/MainWindow.h \ src/videowidget.h \ src/flickcharm.h \ src/videodefinition.h \ - src/fontutils.h + src/fontutils.h \ + src/thlibrary/thblackbar.h SOURCES += src/main.cpp \ src/MainWindow.cpp \ src/SearchView.cpp \ @@ -70,7 +70,8 @@ SOURCES += src/main.cpp \ src/flickcharm.cpp \ src/videodefinition.cpp \ src/constants.cpp \ - src/fontutils.cpp + src/fontutils.cpp \ + src/thlibrary/thblackbar.cpp RESOURCES += resources.qrc DESTDIR = build/target/ OBJECTS_DIR = build/obj/ diff --git a/src/AboutView.cpp b/src/AboutView.cpp index 7abcb1d..42477be 100644 --- a/src/AboutView.cpp +++ b/src/AboutView.cpp @@ -5,6 +5,7 @@ AboutView::AboutView(QWidget *parent) : QWidget(parent) { QBoxLayout *aboutlayout = new QHBoxLayout(this); aboutlayout->setAlignment(Qt::AlignCenter); + aboutlayout->setMargin(30); aboutlayout->setSpacing(30); QLabel *logo = new QLabel(this); diff --git a/src/SearchView.cpp b/src/SearchView.cpp index c56bd97..99efdb6 100644 --- a/src/SearchView.cpp +++ b/src/SearchView.cpp @@ -1,5 +1,6 @@ #include "SearchView.h" #include "constants.h" +#include "fontutils.h" namespace The { QMap* globalActions(); @@ -10,12 +11,8 @@ static const int PADDING = 30; SearchView::SearchView(QWidget *parent) : QWidget(parent) { - QFont biggerFont; - biggerFont.setPointSize(biggerFont.pointSize()*1.5); - - QFont smallerFont; - smallerFont.setPointSize(smallerFont.pointSize()*.85); - smallerFont.setBold(true); + QFont biggerFont = FontUtils::big(); + QFont smallerFont = FontUtils::smallBold(); QBoxLayout *mainLayout = new QVBoxLayout(); mainLayout->setMargin(PADDING); diff --git a/src/playlist/PrettyItemDelegate.cpp b/src/playlist/PrettyItemDelegate.cpp index 9463b66..cc25c4d 100644 --- a/src/playlist/PrettyItemDelegate.cpp +++ b/src/playlist/PrettyItemDelegate.cpp @@ -1,5 +1,6 @@ #include "PrettyItemDelegate.h" #include "../ListModel.h" +#include "../fontutils.h" #include #include @@ -9,16 +10,9 @@ const qreal PrettyItemDelegate::THUMB_WIDTH = 120.0; const qreal PrettyItemDelegate::PADDING = 10.0; PrettyItemDelegate::PrettyItemDelegate( QObject* parent ) : QStyledItemDelegate( parent ) { - boldFont.setBold(true); - smallerFont.setPointSize(smallerFont.pointSize()*.85); - smallerBoldFont.setBold(true); - smallerBoldFont.setPointSize(smallerBoldFont.pointSize()*.85); - QFontInfo fontInfo(smallerFont); - if (fontInfo.pixelSize() < 10) { - smallerFont.setPixelSize(10); - smallerBoldFont.setPixelSize(10); - } + smallerBoldFont = FontUtils::smallBold(); + smallerFont = FontUtils::small(); createPlayIcon(); } diff --git a/src/thlibrary/thblackbar.cpp b/src/thlibrary/thblackbar.cpp index 0043fc5..8ec7438 100644 --- a/src/thlibrary/thblackbar.cpp +++ b/src/thlibrary/thblackbar.cpp @@ -4,6 +4,7 @@ #include #include "thblackbar.h" +#include "../fontutils.h" /* ============================================================================ * PRIVATE Class @@ -176,9 +177,7 @@ QAction *THBlackBar::hoveredAction (const QPoint& pos) const { } int THBlackBar::calculateButtonWidth (void) const { - QFont smallerBoldFont; - smallerBoldFont.setBold(true); - smallerBoldFont.setPointSize(smallerBoldFont.pointSize()*.85); + QFont smallerBoldFont = FontUtils::smallBold(); QFontMetrics fontMetrics(smallerBoldFont); int tmpItemWidth, itemWidth = 0; foreach (QAction *action, d->actionList) { @@ -247,9 +246,7 @@ void THBlackBar::drawButton ( QPainter *painter, painter->fillRect(0, mh, width, mh, color); painter->drawRect(0, 0, width, height); - QFont smallerBoldFont; - smallerBoldFont.setBold(true); - smallerBoldFont.setPointSize(smallerBoldFont.pointSize()*.85); + QFont smallerBoldFont = FontUtils::smallBold(); painter->setFont(smallerBoldFont); painter->setPen(QPen(QColor(0xff, 0xff, 0xff), 1)); painter->drawText(0, 1, width, height, Qt::AlignCenter, action->text()); -- 2.39.5