From f3643eebba7adb7566bd1840550471a5a2c8f5ae Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Thu, 13 Jun 2013 14:27:04 +0200 Subject: [PATCH] * TomahawkStyle::loadFonts() auto-loads all fonts in the data/fonts/ resource. --- src/libtomahawk/utils/TomahawkStyle.cpp | 17 +++++++++++++++++ src/libtomahawk/utils/TomahawkStyle.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/src/libtomahawk/utils/TomahawkStyle.cpp b/src/libtomahawk/utils/TomahawkStyle.cpp index f70a7cafd..5f325704b 100644 --- a/src/libtomahawk/utils/TomahawkStyle.cpp +++ b/src/libtomahawk/utils/TomahawkStyle.cpp @@ -19,12 +19,16 @@ #include "TomahawkStyle.h" +#include "utils/Logger.h" + +#include #include #include #include #include #include #include +#include void @@ -191,3 +195,16 @@ TomahawkStyle::styleScrollBar( QScrollBar* scrollBar ) "QScrollBar:up-arrow:vertical, QScrollBar::down-arrow:vertical {" "border: 0px; width: 0px; height: 0px; background: none; background-color: transparent; }" ); } + + +void +TomahawkStyle::loadFonts() +{ + QDir dir( ":/data/fonts" ); + foreach ( const QString& fileName, dir.entryList() ) + { + tDebug() << "Trying to add font resource:" << fileName; + const int id = QFontDatabase::addApplicationFont( ":/data/fonts/" + fileName ); + tDebug() << "Added font:" << id << QFontDatabase::applicationFontFamilies( id ).first(); + } +} diff --git a/src/libtomahawk/utils/TomahawkStyle.h b/src/libtomahawk/utils/TomahawkStyle.h index 6016a6e97..b19be89d1 100644 --- a/src/libtomahawk/utils/TomahawkStyle.h +++ b/src/libtomahawk/utils/TomahawkStyle.h @@ -31,6 +31,8 @@ class QScrollBar; namespace TomahawkStyle { + DLLEXPORT void loadFonts(); + /** * Draws a header background on a painter with the specified rectangle */