author | drw <drw> | 2002-06-20 00:32:56 (UTC) |
---|---|---|
committer | drw <drw> | 2002-06-20 00:32:56 (UTC) |
commit | 2ae11eec4c1b90093e464b863131de07c4528d96 (patch) (side-by-side diff) | |
tree | f8df2cf39b9fe183944be3f6453cbfe383729e57 /library | |
parent | 51ef8523daa3874e7b5542de6b19423fba261de6 (diff) | |
download | opie-2ae11eec4c1b90093e464b863131de07c4528d96.zip opie-2ae11eec4c1b90093e464b863131de07c4528d96.tar.gz opie-2ae11eec4c1b90093e464b863131de07c4528d96.tar.bz2 |
Allow apps to use font selected in appearance app
-rw-r--r-- | library/qpeapplication.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index cf437da..f84bc0e 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp @@ -67,12 +67,14 @@ #if QT_VERSION <= 230 && defined(QT_NO_CODECS) #include "qutfcodec.h" #endif #include "config.h" #include "network.h" #include "fontmanager.h" +#include "fontdatabase.h" + #include "power.h" #include "alarmserver.h" #include "applnk.h" #include "qpemenubar.h" #include <unistd.h> @@ -382,13 +384,13 @@ public: LcdOn = FALSE; } else // We're going to suspend the whole machine { if ( disable_suspend > 2 && !powerOnline() && !networkOnline() ) { QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); - return TRUE; + return TRUE; } } break; } return FALSE; } @@ -501,13 +503,13 @@ static void setScreenSaverInterval(int interval) */ QPEApplication::QPEApplication( int& argc, char **argv, Type t ) : QApplication( hack(argc), argv, t ) { int dw = desktop()->width(); if ( dw < 200 ) { - setFont( QFont( "helvetica", 8 ) ); +// setFont( QFont( "helvetica", 8 ) ); AppLnk::setSmallIconSize(10); AppLnk::setBigIconSize(28); } d = new QPEApplicationData; QMimeSourceFactory::setDefaultFactory(new ResourceMimeFactory); @@ -596,13 +598,27 @@ QPEApplication::QPEApplication( int& argc, char **argv, Type t ) //###language/font hack; should look it up somewhere if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { QFont fn = FontManager::unicodeFont( FontManager::Proportional ); setFont( fn ); } + else { + Config config( "qpe" ); + config.setGroup( "Appearance" ); + QString familyStr = config.readEntry( "FontFamily", "fixed" ); + QString styleStr = config.readEntry( "FontStyle", "Regular" ); + QString sizeStr = config.readEntry( "FontSize", "10" ); + QString charSetStr = config.readEntry( "FontCharSet", "iso10646-1" ); + bool ok; + int i_size = sizeStr.toInt( &ok, 10 ); + FontDatabase fdb; + QFont selectedFont = fdb.font( familyStr, styleStr, i_size, charSetStr ); + setFont( selectedFont ); + } } + #endif applyStyle(); if ( type() == GuiServer ) { setScreenSaverInterval(-1); |