2011-04-27 12:13:26 +00:00
|
|
|
/****************************************************************************
|
|
|
|
**
|
2012-01-10 05:19:47 +00:00
|
|
|
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
2011-04-27 12:13:26 +00:00
|
|
|
** All rights reserved.
|
2012-01-20 04:04:27 +00:00
|
|
|
** Contact: http://www.qt-project.org/
|
2011-04-27 12:13:26 +00:00
|
|
|
**
|
|
|
|
** This file is part of the tools applications of the Qt Toolkit.
|
|
|
|
**
|
|
|
|
** $QT_BEGIN_LICENSE:LGPL$
|
|
|
|
** GNU Lesser General Public License Usage
|
2011-07-07 12:52:03 +00:00
|
|
|
** 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.
|
2011-04-27 12:13:26 +00:00
|
|
|
**
|
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-07-07 12:52:03 +00:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2011-04-27 12:13:26 +00:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
**
|
2011-07-07 12:52:03 +00:00
|
|
|
** GNU General Public License Usage
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU General
|
|
|
|
** Public License version 3.0 as published by the Free Software Foundation
|
|
|
|
** and appearing in the file LICENSE.GPL included in the packaging of this
|
|
|
|
** file. Please review the following information to ensure the GNU General
|
|
|
|
** Public License version 3.0 requirements will be met:
|
|
|
|
** http://www.gnu.org/copyleft/gpl.html.
|
|
|
|
**
|
|
|
|
** Other Usage
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
2011-04-27 12:13:26 +00:00
|
|
|
**
|
|
|
|
**
|
|
|
|
**
|
|
|
|
**
|
|
|
|
**
|
|
|
|
** $QT_END_LICENSE$
|
|
|
|
**
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <QtCore/qdebug.h>
|
|
|
|
#include <QtCore/qabstractanimation.h>
|
2011-12-06 07:06:03 +00:00
|
|
|
#include <QtCore/qdir.h>
|
|
|
|
#include <QtCore/qmath.h>
|
|
|
|
#include <QtCore/qdatetime.h>
|
|
|
|
|
|
|
|
#include <QtGui/QGuiApplication>
|
|
|
|
|
2011-04-27 12:13:26 +00:00
|
|
|
#include <QtDeclarative/qdeclarative.h>
|
|
|
|
#include <QtDeclarative/qdeclarativeengine.h>
|
|
|
|
#include <QtDeclarative/qdeclarativecomponent.h>
|
|
|
|
#include <QtDeclarative/qdeclarativecontext.h>
|
|
|
|
|
Say hello to QtQuick module
This change moves the QtQuick 2 types and C++ API (including
SceneGraph) to a new module (AKA library), QtQuick.
99% of this change is moving files from src/declarative to
src/quick, and from tests/auto/declarative to
tests/auto/qtquick2.
The loading of QtQuick 2 ("import QtQuick 2.0") is now delegated to
a plugin, src/imports/qtquick2, just like it's done for QtQuick 1.
All tools, examples, and tests that use QtQuick C++ API have gotten
"QT += quick" or "QT += quick-private" added to their .pro file.
A few additional internal QtDeclarative classes had to be exported
(via Q_DECLARATIVE_PRIVATE_EXPORT) since they're needed by the
QtQuick 2 implementation.
The old header locations (e.g. QtDeclarative/qquickitem.h) will
still be supported for some time, but will produce compile-time
warnings. (To avoid the QtQuick implementation using the
compatibility headers (since QtDeclarative's includepath comes
first), a few include statements were modified, e.g. from
"#include <qsgnode.h>" to "#include <QtQuick/qsgnode.h>".)
There's a change in qtbase that automatically adds QtQuick to the
module list if QtDeclarative is used. Together with the compatibility
headers, this should help reduce the migration pain for existing
projects.
In theory, simply getting an existing QtDeclarative-based project
to compile and link shouldn't require any changes for now -- but
porting to the new scheme is of course recommended, and will
eventually become mandatory.
Task-number: QTBUG-22889
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Change-Id: Ia52be9373172ba2f37e7623231ecb060316c96a7
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
2011-11-23 14:14:07 +00:00
|
|
|
#include <QtQuick/qquickitem.h>
|
|
|
|
#include <QtQuick/qquickview.h>
|
2011-04-27 12:13:26 +00:00
|
|
|
|
2011-12-12 06:18:03 +00:00
|
|
|
#ifdef QT_WIDGETS_LIB
|
2011-12-13 10:06:15 +00:00
|
|
|
#include <QtWidgets/QApplication>
|
2011-12-12 06:18:03 +00:00
|
|
|
#include <QtWidgets/QFileDialog>
|
|
|
|
#endif
|
|
|
|
|
2011-04-27 12:13:26 +00:00
|
|
|
|
|
|
|
#ifdef QML_RUNTIME_TESTING
|
|
|
|
class RenderStatistics
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static void updateStats();
|
|
|
|
static void printTotalStats();
|
|
|
|
private:
|
|
|
|
static QVector<qreal> timePerFrame;
|
|
|
|
static QVector<int> timesPerFrames;
|
|
|
|
};
|
|
|
|
|
|
|
|
QVector<qreal> RenderStatistics::timePerFrame;
|
|
|
|
QVector<int> RenderStatistics::timesPerFrames;
|
|
|
|
|
|
|
|
void RenderStatistics::updateStats()
|
|
|
|
{
|
|
|
|
static QTime time;
|
|
|
|
static int frames;
|
|
|
|
static int lastTime;
|
|
|
|
|
|
|
|
if (frames == 0) {
|
|
|
|
time.start();
|
|
|
|
} else {
|
|
|
|
int elapsed = time.elapsed();
|
|
|
|
timesPerFrames.append(elapsed - lastTime);
|
|
|
|
lastTime = elapsed;
|
|
|
|
|
|
|
|
if (elapsed > 5000) {
|
|
|
|
qreal avgtime = elapsed / (qreal) frames;
|
|
|
|
qreal var = 0;
|
|
|
|
for (int i = 0; i < timesPerFrames.size(); ++i) {
|
|
|
|
qreal diff = timesPerFrames.at(i) - avgtime;
|
|
|
|
var += diff * diff;
|
|
|
|
}
|
|
|
|
var /= timesPerFrames.size();
|
|
|
|
|
|
|
|
qDebug("Average time per frame: %f ms (%i fps), std.dev: %f ms", avgtime, qRound(1000. / avgtime), qSqrt(var));
|
|
|
|
|
|
|
|
timePerFrame.append(avgtime);
|
|
|
|
timesPerFrames.clear();
|
|
|
|
time.start();
|
|
|
|
lastTime = 0;
|
|
|
|
frames = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
++frames;
|
|
|
|
}
|
|
|
|
|
|
|
|
void RenderStatistics::printTotalStats()
|
|
|
|
{
|
|
|
|
int count = timePerFrame.count();
|
|
|
|
if (count == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
qreal minTime = 0;
|
|
|
|
qreal maxTime = 0;
|
|
|
|
qreal avg = 0;
|
|
|
|
for (int i = 0; i < count; ++i) {
|
|
|
|
minTime = minTime == 0 ? timePerFrame.at(i) : qMin(minTime, timePerFrame.at(i));
|
|
|
|
maxTime = qMax(maxTime, timePerFrame.at(i));
|
|
|
|
avg += timePerFrame.at(i);
|
|
|
|
}
|
|
|
|
avg /= count;
|
|
|
|
|
|
|
|
qDebug(" ");
|
|
|
|
qDebug("----- Statistics -----");
|
|
|
|
qDebug("Average time per frame: %f ms (%i fps)", avg, qRound(1000. / avg));
|
|
|
|
qDebug("Best time per frame: %f ms (%i fps)", minTime, int(1000 / minTime));
|
|
|
|
qDebug("Worst time per frame: %f ms (%i fps)", maxTime, int(1000 / maxTime));
|
|
|
|
qDebug("----------------------");
|
|
|
|
qDebug(" ");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2011-10-14 08:51:42 +00:00
|
|
|
class MyQQuickView : public QQuickView
|
2011-04-27 12:13:26 +00:00
|
|
|
{
|
|
|
|
public:
|
2011-10-14 08:51:42 +00:00
|
|
|
MyQQuickView() : QQuickView()
|
2011-04-27 12:13:26 +00:00
|
|
|
{
|
2011-10-14 08:51:42 +00:00
|
|
|
setResizeMode(QQuickView::SizeRootObjectToView);
|
2011-04-27 12:13:26 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Options
|
|
|
|
{
|
|
|
|
Options()
|
|
|
|
: originalQml(false)
|
|
|
|
, originalQmlRaster(false)
|
|
|
|
, maximized(false)
|
|
|
|
, fullscreen(false)
|
|
|
|
, clip(false)
|
|
|
|
, versionDetection(true)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
QUrl file;
|
|
|
|
bool originalQml;
|
|
|
|
bool originalQmlRaster;
|
|
|
|
bool maximized;
|
|
|
|
bool fullscreen;
|
|
|
|
bool scenegraphOnGraphicsview;
|
|
|
|
bool clip;
|
|
|
|
bool versionDetection;
|
|
|
|
};
|
|
|
|
|
|
|
|
#if defined(QMLSCENE_BUNDLE)
|
|
|
|
Q_DECLARE_METATYPE(QFileInfo);
|
|
|
|
QFileInfoList findQmlFiles(const QString &dirName)
|
|
|
|
{
|
|
|
|
QDir dir(dirName);
|
|
|
|
|
|
|
|
QFileInfoList ret;
|
|
|
|
if (dir.exists()) {
|
|
|
|
QFileInfoList fileInfos = dir.entryInfoList(QStringList() << "*.qml",
|
|
|
|
QDir::Files | QDir::AllDirs | QDir::NoDotAndDotDot);
|
|
|
|
|
|
|
|
foreach (QFileInfo fileInfo, fileInfos) {
|
|
|
|
if (fileInfo.isDir())
|
|
|
|
ret += findQmlFiles(fileInfo.filePath());
|
|
|
|
else if (fileInfo.fileName().length() > 0 && fileInfo.fileName().at(0).isLower())
|
|
|
|
ret.append(fileInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int displayOptionsDialog(Options *options)
|
|
|
|
{
|
|
|
|
QDialog dialog;
|
|
|
|
|
|
|
|
QFormLayout *layout = new QFormLayout(&dialog);
|
|
|
|
|
|
|
|
QComboBox *qmlFileComboBox = new QComboBox(&dialog);
|
|
|
|
QFileInfoList fileInfos = findQmlFiles(":/bundle") + findQmlFiles("./qmlscene-resources");
|
|
|
|
|
|
|
|
foreach (QFileInfo fileInfo, fileInfos)
|
|
|
|
qmlFileComboBox->addItem(fileInfo.dir().dirName() + "/" + fileInfo.fileName(), QVariant::fromValue(fileInfo));
|
|
|
|
|
|
|
|
QCheckBox *originalCheckBox = new QCheckBox(&dialog);
|
|
|
|
originalCheckBox->setText("Use original QML viewer");
|
|
|
|
originalCheckBox->setChecked(options->originalQml);
|
|
|
|
|
|
|
|
QCheckBox *fullscreenCheckBox = new QCheckBox(&dialog);
|
|
|
|
fullscreenCheckBox->setText("Start fullscreen");
|
|
|
|
fullscreenCheckBox->setChecked(options->fullscreen);
|
|
|
|
|
|
|
|
QCheckBox *maximizedCheckBox = new QCheckBox(&dialog);
|
|
|
|
maximizedCheckBox->setText("Start maximized");
|
|
|
|
maximizedCheckBox->setChecked(options->maximized);
|
|
|
|
|
|
|
|
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
|
|
|
|
Qt::Horizontal,
|
|
|
|
&dialog);
|
|
|
|
QObject::connect(buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept()));
|
|
|
|
QObject::connect(buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject()));
|
|
|
|
|
|
|
|
layout->addRow("Qml file:", qmlFileComboBox);
|
|
|
|
layout->addWidget(originalCheckBox);
|
|
|
|
layout->addWidget(maximizedCheckBox);
|
|
|
|
layout->addWidget(fullscreenCheckBox);
|
|
|
|
layout->addWidget(buttonBox);
|
|
|
|
|
|
|
|
int result = dialog.exec();
|
|
|
|
if (result == QDialog::Accepted) {
|
|
|
|
QVariant variant = qmlFileComboBox->itemData(qmlFileComboBox->currentIndex());
|
|
|
|
QFileInfo fileInfo = variant.value<QFileInfo>();
|
|
|
|
|
|
|
|
if (fileInfo.canonicalFilePath().startsWith(":"))
|
|
|
|
options->file = QUrl("qrc" + fileInfo.canonicalFilePath());
|
|
|
|
else
|
|
|
|
options->file = QUrl::fromLocalFile(fileInfo.canonicalFilePath());
|
|
|
|
options->originalQml = originalCheckBox->isChecked();
|
|
|
|
options->maximized = maximizedCheckBox->isChecked();
|
|
|
|
options->fullscreen = fullscreenCheckBox->isChecked();
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static void checkAndAdaptVersion(const QUrl &url)
|
|
|
|
{
|
|
|
|
if (!qgetenv("QMLSCENE_IMPORT_NAME").isEmpty()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString fileName = url.toLocalFile();
|
|
|
|
if (fileName.isEmpty())
|
|
|
|
return;
|
|
|
|
|
|
|
|
QFile f(fileName);
|
|
|
|
if (!f.open(QFile::ReadOnly | QFile::Text)) {
|
|
|
|
qWarning("qmlscene: failed to check version of file '%s', could not open...",
|
|
|
|
qPrintable(fileName));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-08-01 06:27:01 +00:00
|
|
|
QRegExp quick1("^\\s*import +QtQuick +1\\.");
|
2011-07-06 03:43:47 +00:00
|
|
|
QRegExp quick2("^\\s*import +QtQuick +2\\.");
|
2011-08-01 06:27:01 +00:00
|
|
|
QRegExp qt47("^\\s*import +Qt +4\\.7");
|
2011-04-27 12:13:26 +00:00
|
|
|
|
|
|
|
QString envToWrite;
|
|
|
|
QString compat;
|
|
|
|
|
|
|
|
QTextStream stream(&f);
|
|
|
|
bool codeFound= false;
|
2011-07-06 03:43:47 +00:00
|
|
|
while (!codeFound) {
|
2011-04-27 12:13:26 +00:00
|
|
|
QString line = stream.readLine();
|
|
|
|
if (line.contains("{"))
|
|
|
|
codeFound = true;
|
2011-07-06 03:43:47 +00:00
|
|
|
if (envToWrite.isEmpty() && quick1.indexIn(line) >= 0) {
|
2011-04-27 12:13:26 +00:00
|
|
|
envToWrite = QLatin1String("quick1");
|
|
|
|
compat = QLatin1String("QtQuick 1.0");
|
2011-07-06 03:43:47 +00:00
|
|
|
} else if (envToWrite.isEmpty() && qt47.indexIn(line) >= 0) {
|
2011-04-27 12:13:26 +00:00
|
|
|
envToWrite = QLatin1String("qt");
|
|
|
|
compat = QLatin1String("Qt 4.7");
|
2011-07-06 03:43:47 +00:00
|
|
|
} else if (quick2.indexIn(line) >= 0) {
|
|
|
|
envToWrite.clear();
|
|
|
|
compat.clear();
|
|
|
|
break;
|
2011-04-27 12:13:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!envToWrite.isEmpty()) {
|
|
|
|
qWarning("qmlscene: Autodetecting compatibility import \"%s\"...", qPrintable(compat));
|
|
|
|
if (qgetenv("QMLSCENE_IMPORT_NAME").isEmpty())
|
|
|
|
qputenv("QMLSCENE_IMPORT_NAME", envToWrite.toLatin1().constData());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void displayFileDialog(Options *options)
|
|
|
|
{
|
2011-12-06 07:06:03 +00:00
|
|
|
#ifdef QT_WIDGETS_LIB
|
2011-04-27 12:13:26 +00:00
|
|
|
QString fileName = QFileDialog::getOpenFileName(0, "Open QML file", QString(), "QML Files (*.qml)");
|
|
|
|
if (!fileName.isEmpty()) {
|
|
|
|
QFileInfo fi(fileName);
|
|
|
|
options->file = QUrl::fromLocalFile(fi.canonicalFilePath());
|
|
|
|
}
|
2011-12-06 07:06:03 +00:00
|
|
|
#else
|
|
|
|
Q_UNUSED(options);
|
|
|
|
qWarning("No filename specified...");
|
|
|
|
#endif
|
2011-04-27 12:13:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void loadDummyDataFiles(QDeclarativeEngine &engine, const QString& directory)
|
|
|
|
{
|
|
|
|
QDir dir(directory+"/dummydata", "*.qml");
|
|
|
|
QStringList list = dir.entryList();
|
|
|
|
for (int i = 0; i < list.size(); ++i) {
|
|
|
|
QString qml = list.at(i);
|
|
|
|
QFile f(dir.filePath(qml));
|
|
|
|
f.open(QIODevice::ReadOnly);
|
|
|
|
QByteArray data = f.readAll();
|
|
|
|
QDeclarativeComponent comp(&engine);
|
|
|
|
comp.setData(data, QUrl());
|
|
|
|
QObject *dummyData = comp.create();
|
|
|
|
|
|
|
|
if(comp.isError()) {
|
|
|
|
QList<QDeclarativeError> errors = comp.errors();
|
|
|
|
foreach (const QDeclarativeError &error, errors) {
|
|
|
|
qWarning() << error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dummyData) {
|
|
|
|
qWarning() << "Loaded dummy data:" << dir.filePath(qml);
|
|
|
|
qml.truncate(qml.length()-4);
|
|
|
|
engine.rootContext()->setContextProperty(qml, dummyData);
|
|
|
|
dummyData->setParent(&engine);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void usage()
|
|
|
|
{
|
|
|
|
qWarning("Usage: qmlscene [options] <filename>");
|
|
|
|
qWarning(" ");
|
|
|
|
qWarning(" options:");
|
|
|
|
qWarning(" --maximized ............................... run maximized");
|
|
|
|
qWarning(" --fullscreen .............................. run fullscreen");
|
|
|
|
qWarning(" --no-multisample .......................... Disable multisampling (anti-aliasing)");
|
|
|
|
qWarning(" --no-version-detection .................... Do not try to detect the version of the .qml file");
|
|
|
|
|
|
|
|
qWarning(" ");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char ** argv)
|
|
|
|
{
|
|
|
|
Options options;
|
|
|
|
|
|
|
|
QStringList imports;
|
|
|
|
for (int i = 1; i < argc; ++i) {
|
2011-10-17 14:02:01 +00:00
|
|
|
if (*argv[i] != '-' && QFileInfo(QFile::decodeName(argv[i])).exists()) {
|
2011-04-27 12:13:26 +00:00
|
|
|
options.file = QUrl::fromLocalFile(argv[i]);
|
2011-10-17 14:02:01 +00:00
|
|
|
} else {
|
|
|
|
const QString lowerArgument = QString::fromLatin1(argv[i]).toLower();
|
2011-12-06 07:06:03 +00:00
|
|
|
if (lowerArgument == QLatin1String("--maximized"))
|
2011-10-17 14:02:01 +00:00
|
|
|
options.maximized = true;
|
|
|
|
else if (lowerArgument == QLatin1String("--fullscreen"))
|
|
|
|
options.fullscreen = true;
|
|
|
|
else if (lowerArgument == QLatin1String("--clip"))
|
|
|
|
options.clip = true;
|
|
|
|
else if (lowerArgument == QLatin1String("--no-version-detection"))
|
|
|
|
options.versionDetection = false;
|
|
|
|
else if (lowerArgument == QLatin1String("-i") && i + 1 < argc)
|
|
|
|
imports.append(QString::fromLatin1(argv[++i]));
|
|
|
|
else if (lowerArgument == QLatin1String("--help")
|
|
|
|
|| lowerArgument == QLatin1String("-help")
|
|
|
|
|| lowerArgument == QLatin1String("--h")
|
|
|
|
|| lowerArgument == QLatin1String("-h"))
|
|
|
|
usage();
|
|
|
|
}
|
2011-04-27 12:13:26 +00:00
|
|
|
}
|
|
|
|
|
2011-12-13 10:06:15 +00:00
|
|
|
#ifdef QT_WIDGETS_LIB
|
|
|
|
QApplication app(argc, argv);
|
|
|
|
#else
|
2011-12-06 07:06:03 +00:00
|
|
|
QGuiApplication app(argc, argv);
|
2011-12-13 10:06:15 +00:00
|
|
|
#endif
|
2011-04-27 12:13:26 +00:00
|
|
|
app.setApplicationName("QtQmlViewer");
|
|
|
|
app.setOrganizationName("Nokia");
|
|
|
|
app.setOrganizationDomain("nokia.com");
|
|
|
|
|
|
|
|
if (options.file.isEmpty())
|
|
|
|
#if defined(QMLSCENE_BUNDLE)
|
|
|
|
displayOptionsDialog(&options);
|
|
|
|
#else
|
|
|
|
displayFileDialog(&options);
|
|
|
|
#endif
|
|
|
|
|
2011-08-04 08:34:08 +00:00
|
|
|
QWindow *window = 0;
|
2011-04-27 12:13:26 +00:00
|
|
|
QDeclarativeEngine *engine = 0;
|
|
|
|
|
|
|
|
int exitCode = 0;
|
|
|
|
|
|
|
|
if (!options.file.isEmpty()) {
|
2011-08-04 08:34:08 +00:00
|
|
|
if (options.versionDetection)
|
|
|
|
checkAndAdaptVersion(options.file);
|
2011-10-14 08:51:42 +00:00
|
|
|
QQuickView *qxView = new MyQQuickView();
|
2011-08-04 08:34:08 +00:00
|
|
|
engine = qxView->engine();
|
|
|
|
for (int i = 0; i < imports.size(); ++i)
|
|
|
|
engine->addImportPath(imports.at(i));
|
|
|
|
window = qxView;
|
|
|
|
if (options.file.isLocalFile()) {
|
|
|
|
QFileInfo fi(options.file.toLocalFile());
|
|
|
|
loadDummyDataFiles(*engine, fi.path());
|
2011-04-27 12:13:26 +00:00
|
|
|
}
|
2011-08-04 08:34:08 +00:00
|
|
|
qxView->setSource(options.file);
|
2011-04-27 12:13:26 +00:00
|
|
|
|
|
|
|
QObject::connect(engine, SIGNAL(quit()), QCoreApplication::instance(), SLOT(quit()));
|
|
|
|
|
2011-10-17 14:02:01 +00:00
|
|
|
window->setWindowFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
2011-04-27 12:13:26 +00:00
|
|
|
if (options.fullscreen)
|
2011-08-04 08:34:08 +00:00
|
|
|
window->showFullScreen();
|
2011-04-27 12:13:26 +00:00
|
|
|
else if (options.maximized)
|
2011-08-04 08:34:08 +00:00
|
|
|
window->showMaximized();
|
2011-04-27 12:13:26 +00:00
|
|
|
else
|
2011-08-04 08:34:08 +00:00
|
|
|
window->show();
|
|
|
|
|
2011-04-27 12:13:26 +00:00
|
|
|
exitCode = app.exec();
|
|
|
|
|
2011-08-04 08:34:08 +00:00
|
|
|
delete window;
|
2011-04-27 12:13:26 +00:00
|
|
|
|
|
|
|
#ifdef QML_RUNTIME_TESTING
|
|
|
|
RenderStatistics::printTotalStats();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
return exitCode;
|
|
|
|
}
|
|
|
|
|