@ -24,6 +24,7 @@
# ifdef Q_WS_X11
# ifdef Q_WS_X11
# include <X11/Xlib.h>
# include <X11/Xlib.h>
# include <X11/Xutil.h>
# endif
# endif
QDeclarativeBoosterCachePrivate * const QDeclarativeBoosterCache : : d_ptr = new QDeclarativeBoosterCachePrivate ;
QDeclarativeBoosterCachePrivate * const QDeclarativeBoosterCache : : d_ptr = new QDeclarativeBoosterCachePrivate ;
@ -63,6 +64,11 @@ void QDeclarativeBoosterCachePrivate::populate()
}
}
if ( qApplicationInstance = = 0 ) {
if ( qApplicationInstance = = 0 ) {
# ifdef __arm__
QApplication : : setGraphicsSystem ( " meego " ) ;
# else
QApplication : : setGraphicsSystem ( " raster " ) ;
# endif
qApplicationInstance = new QApplication ( initialArgc , initialArgv ) ;
qApplicationInstance = new QApplication ( initialArgc , initialArgv ) ;
}
}
@ -74,8 +80,7 @@ QApplication* QDeclarativeBoosterCachePrivate::qApplication(int &argc, char **ar
if ( qApplicationInstance = = 0 ) {
if ( qApplicationInstance = = 0 ) {
qApplicationInstance = new QApplication ( argc , argv ) ;
qApplicationInstance = new QApplication ( argc , argv ) ;
} else {
} else {
if ( canUseCachedApp ( argc , argv ) ) {
if ( argc > ARGV_LIMIT ) {
if ( argc > ARGV_LIMIT ) {
qWarning ( " MComponentCache: QCoreApplication::arguments() will not contain all arguments. " ) ;
qWarning ( " MComponentCache: QCoreApplication::arguments() will not contain all arguments. " ) ;
}
}
@ -93,76 +98,27 @@ QApplication* QDeclarativeBoosterCachePrivate::qApplication(int &argc, char **ar
Display * display = QX11Info : : display ( ) ;
Display * display = QX11Info : : display ( ) ;
if ( display ) {
if ( display ) {
XSetCommand ( display , qDeclarativeViewInstance - > effectiveWinId ( ) , argv , argc ) ;
XSetCommand ( display , qDeclarativeViewInstance - > effectiveWinId ( ) , argv , argc ) ;
}
}
# endif
} else {
// Clean up cache.
if ( qDeclarativeViewInstance ) {
delete qDeclarativeViewInstance ;
qDeclarativeViewInstance = 0 ;
}
delete qApplicationInstance ;
// set correct WM_CLASS properties
qApplicationInstance = new QApplication ( argc , argv ) ;
QString appName = QFileInfo ( argv [ 0 ] ) . fileName ( ) ;
}
QString appClass = appName . left ( 1 ) . toUpper ( ) ;
}
if ( appName . length ( ) > 1 )
return qApplicationInstance ;
appClass + = appName . right ( appName . length ( ) - 1 ) ;
}
bool QDeclarativeBoosterCachePrivate : : canUseCachedApp ( int & argc , char * * argv )
// reserve memory for C strings
{
QByteArray arrName ( appName . toLatin1 ( ) ) ;
if ( hasExtraParams ( argc , argv ) )
QByteArray arrClass ( appClass . toLatin1 ( ) ) ;
return false ;
return true ;
XClassHint class_hint ;
}
class_hint . res_name = arrName . data ( ) ;
class_hint . res_class = arrClass . data ( ) ;
bool QDeclarativeBoosterCachePrivate : : hasExtraParams ( int & argc , char * * argv )
XSetClassHint ( display , qDeclarativeViewInstance - > effectiveWinId ( ) , & class_hint ) ;
{
}
for ( int i = 1 ; i < argc ; + + i )
{
QString s ( argv [ i ] ) ;
if (
/* QApplication command options */
( s = = " -style " ) | |
( s = = " -stylesheet " ) | |
( s = = " -session " ) | |
( s = = " -widgetcount " ) | |
( s = = " -reverse " ) | |
( s = = " -graphicssystem " ) | |
/* X11 options */
( s = = " -display " ) | |
( s = = " -geometry " ) | |
( s = = " -fn " ) | |
( s = = " -font " ) | |
( s = = " -bg " ) | |
( s = = " -background " ) | |
( s = = " -fg " ) | |
( s = = " -foreground " ) | |
( s = = " -btn " ) | |
( s = = " -button " ) | |
( s = = " -name " ) | |
( s = = " -title " ) | |
( s = = " -visual " ) | |
( s = = " -ncols " ) | |
( s = = " -cmap " ) | |
( s = = " -im " ) | |
( s = = " -inputstyle " ) | |
/* help options, application will not be started */
( s = = " -v " ) | |
( s . startsWith ( " -version " ) ) | |
( s . startsWith ( " --version " ) ) | |
( s = = " -h " ) | |
( s . startsWith ( " -help " ) ) | |
( s . startsWith ( " --help " ) )
)
return true ;
}
}
return false ;
# endif
}
return qApplicationInstance ;
}
}
QDeclarativeView * QDeclarativeBoosterCachePrivate : : qDeclarativeView ( )
QDeclarativeView * QDeclarativeBoosterCachePrivate : : qDeclarativeView ( )