From: <> Date: Sun, 1 Aug 2010 12:50:38 +0000 (+0200) Subject: Use FontUtils everywhere X-Git-Tag: 1.2~27 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=56234f04fc1fe85303fd8d12e5c771a2100d88ed;p=minitube Use FontUtils everywhere --- 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());