1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 14:16:32 +02: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 "TomahawkStyle.h"
#include "utils/Logger.h"
#include <QDir>
#include <QPainter> #include <QPainter>
#include <QPixmapCache> #include <QPixmapCache>
#include <QApplication> #include <QApplication>
#include <QStyleOption> #include <QStyleOption>
#include <QFrame> #include <QFrame>
#include <QScrollBar> #include <QScrollBar>
#include <QFontDatabase>
void void
@@ -191,3 +195,16 @@ TomahawkStyle::styleScrollBar( QScrollBar* scrollBar )
"QScrollBar:up-arrow:vertical, QScrollBar::down-arrow:vertical {" "QScrollBar:up-arrow:vertical, QScrollBar::down-arrow:vertical {"
"border: 0px; width: 0px; height: 0px; background: none; background-color: transparent; }" ); "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 namespace TomahawkStyle
{ {
DLLEXPORT void loadFonts();
/** /**
* Draws a header background on a painter with the specified rectangle * Draws a header background on a painter with the specified rectangle
*/ */