-rw-r--r-- | library/qpeapplication.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 1117240..4adfc8f 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp @@ -767,43 +767,66 @@ static void qtopia_loadTranslations( const QStringList& qms ) QTranslator * trans; QString tfn; for (QStringList::ConstIterator qmit = qms.begin(); qmit!=qms.end(); ++qmit) { trans = new QTranslator(qApp); tfn = QPEApplication::qpeDir() + "i18n/" + lang + "/" + *qmit + ".qm"; if ( trans->load( tfn )) qApp->installTranslator( trans ); else delete trans; } } } #endif +/* + Turn off qDebug in release mode + */ +static void qtopiaMsgHandler(QtMsgType type, const char* msg) +{ + switch ( type ) { + case QtDebugMsg: +#ifdef QT_DEBUG + fprintf( stderr, "Debug: %s\n", msg ); +#endif + break; + case QtWarningMsg: +#ifdef QT_DEBUG + fprintf( stderr, "Warning: %s\n", msg ); +#endif + break; + case QtFatalMsg: + fprintf( stderr, "Fatal: %s\n", msg ); + abort(); + } +} + /*! Constructs a QPEApplication just as you would construct a QApplication, passing \a argc, \a argv, and \a t. For applications, \a t should be the default, GuiClient. Only the Qtopia server passes GuiServer. */ QPEApplication::QPEApplication( int & argc, char **argv, Type t ) : QApplication( hack(argc), argv, t ), pidChannel( 0 ) { QPixmapCache::setCacheLimit(256); // sensible default for smaller devices. + qInstallMsgHandler(qtopiaMsgHandler); d = new QPEApplicationData; d->loadTextCodecs(); d->loadImageCodecs(); setFont( QFont( d->fontFamily, d->fontSize ) ); AppLnk::setSmallIconSize( d->smallIconSize ); AppLnk::setBigIconSize( d->bigIconSize ); QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); sysChannel = new QCopChannel( "QPE/System", this ); connect( sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ), |