1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-23 01:09:42 +01:00

* TomahawkStyle::loadFonts() auto-loads all fonts in the data/fonts/ resource.

This commit is contained in:
Christian Muehlhaeuser 2013-06-13 14:27:04 +02:00
parent 25a5c4a0dc
commit f3643eebba
2 changed files with 19 additions and 0 deletions

View File

@ -19,12 +19,16 @@
#include "TomahawkStyle.h"
#include "utils/Logger.h"
#include <QDir>
#include <QPainter>
#include <QPixmapCache>
#include <QApplication>
#include <QStyleOption>
#include <QFrame>
#include <QScrollBar>
#include <QFontDatabase>
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();
}
}

View File

@ -31,6 +31,8 @@ class QScrollBar;
namespace TomahawkStyle
{
DLLEXPORT void loadFonts();
/**
* Draws a header background on a painter with the specified rectangle
*/