/**************************************************************************** ** ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the tools applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions ** contained in the Technology Preview License Agreement accompanying ** this package. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** ** ** ** ** ** ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qdeclarative.h" #include "qmlruntime.h" #include "qdeclarativeengine.h" #include "loggerwidget.h" #include #include #include #include #include #include #include "qdeclarativetester.h" #include "qdeclarativefolderlistmodel.h" QT_USE_NAMESPACE QtMsgHandler systemMsgOutput; #if defined (Q_OS_SYMBIAN) #include #include #include #include void myMessageOutput(QtMsgType type, const char *msg) { static int fd = -1; if (fd == -1) fd = ::open("E:\\qml.log", O_WRONLY | O_CREAT); ::write(fd, msg, strlen(msg)); ::write(fd, "\n", 1); ::fsync(fd); switch (type) { case QtFatalMsg: abort(); } } #else // !defined (Q_OS_SYMBIAN) QWeakPointer logger; QString warnings; void showWarnings() { if (!warnings.isEmpty()) { QMessageBox::warning(0, QApplication::tr("Qt Declarative UI Runtime"), warnings); } } void myMessageOutput(QtMsgType type, const char *msg) { if (!logger.isNull()) { QString strMsg = QString::fromAscii(msg); QMetaObject::invokeMethod(logger.data(), "append", Q_ARG(QString, strMsg)); } else { warnings += msg; warnings += QLatin1Char('\n'); } if (systemMsgOutput) { // Windows systemMsgOutput(type, msg); } else { // Unix fprintf(stderr, "%s\n",msg); fflush(stderr); } } #endif void usage() { qWarning("Usage: qml [options] "); qWarning(" "); qWarning(" options:"); qWarning(" -v, -version ............................. display version"); qWarning(" -frameless ............................... run with no window frame"); qWarning(" -maximized................................ run maximized"); qWarning(" -fullscreen............................... run fullscreen"); qWarning(" -stayontop................................ keep viewer window on top"); qWarning(" -skin ...................... run with a skin window frame"); qWarning(" \"list\" for a list of built-ins"); qWarning(" -resizeview .............................. resize the view, not the skin"); qWarning(" -sizeviewtorootobject .................... the view resizes to the changes in the content"); qWarning(" -sizerootobjecttoview .................... the content resizes to the changes in the view"); qWarning(" -qmlbrowser .............................. use a QML-based file browser"); qWarning(" -warnings ................................ show warnings in a separate log window"); qWarning(" -recordfile ..................... set video recording file"); qWarning(" - ImageMagick 'convert' for GIF)"); qWarning(" - png file for raw frames"); qWarning(" - 'ffmpeg' for other formats"); qWarning(" -recorddither ordered|threshold|floyd .... set GIF dither recording mode"); qWarning(" -recordrate ........................ set recording frame rate"); qWarning(" -record arg .............................. add a recording process argument"); qWarning(" -autorecord [from-] ...... set recording to start and stop"); qWarning(" -devicekeys .............................. use numeric keys (see F1)"); qWarning(" -dragthreshold .................... set mouse drag threshold size"); qWarning(" -netcache ......................... set disk cache to size bytes"); qWarning(" -translation ........... set the language to run in"); qWarning(" -I ........................... prepend to the module import search path,"); qWarning(" display path if is empty"); qWarning(" -P ........................... prepend to the plugin search path"); qWarning(" -opengl .................................. use a QGLWidget for the viewport"); qWarning(" -script ........................... set the script to use"); qWarning(" -scriptopts |help ............... set the script options to use"); qWarning(" "); qWarning(" Press F1 for interactive help"); exit(1); } void scriptOptsUsage() { qWarning("Usage: qml -scriptopts