/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qdeclarativeengine_p.h"
#include "qdeclarativeengine.h"
+#include "qdeclarativecomponentattached_p.h"
#include "qdeclarativecontext_p.h"
#include "qdeclarativecompiler_p.h"
#include <private/qdeclarativedebugtrace_p.h>
#include <private/qdeclarativeapplication_p.h>
#include <private/qv8debugservice_p.h>
+#include <private/qdebugmessageservice_p.h>
#include "qdeclarativeincubator.h"
#include <private/qv8profilerservice_p.h>
+#include <QtCore/qstandardpaths.h>
+#include <QtCore/qsettings.h>
+
#include <QtCore/qmetaobject.h>
#include <QNetworkAccessManager>
#include <QDebug>
#include <private/qobject_p.h>
-#include <private/qtquick2_p.h>
#include <private/qdeclarativelocale_p.h>
#ifdef Q_OS_WIN // for %APPDATA%
\endcode
*/
-static bool qt_QmlQtModule_registered = false;
bool QDeclarativeEnginePrivate::qml_debugging_enabled = false;
void QDeclarativeEnginePrivate::registerBaseTypes(const char *uri, int versionMajor, int versionMinor)
workerScriptEngine(0), activeVME(0),
networkAccessManager(0), networkAccessManagerFactory(0),
scarceResourcesRefCount(0), typeLoader(e), importDatabase(e), uniqueId(1),
- incubatorCount(0), incubationController(0), sgContext(0), mutex(QMutex::Recursive)
+ incubatorCount(0), incubationController(0), mutex(QMutex::Recursive)
{
- if (!qt_QmlQtModule_registered) {
- qt_QmlQtModule_registered = true;
- QDeclarativeQtQuick2Module::defineModule();
- }
}
QDeclarativeEnginePrivate::~QDeclarativeEnginePrivate()
static bool firstTime = true;
if (firstTime) {
- // This is a nasty hack as QNetworkAccessManager will issue a
- // BlockingQueuedConnection to the main thread if it is initialized for the
- // first time on a non-main thread. This can cause a lockup if the main thread
- // is blocking on the thread that initialize the network access manager.
- QNetworkConfigurationManager man;
+ qmlRegisterType<QDeclarativeComponent>("QML", 1, 0, "Component");
firstTime = false;
}
QDeclarativeEngineDebugService::isDebuggingEnabled()) {
isDebugging = true;
QDeclarativeEngineDebugService::instance()->addEngine(q);
- QV8DebugService::initialize();
+ QV8DebugService::initialize(v8engine());
QV8ProfilerService::initialize();
QDeclarativeDebugTrace::initialize();
+ QDebugMessageService::instance();
}
+
+ QString dataLocation = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
+ offlineStoragePath = dataLocation.replace(QLatin1Char('/'), QDir::separator()) +
+ QDir::separator() + QLatin1String("QML") +
+ QDir::separator() + QLatin1String("OfflineStorage");
}
QDeclarativeWorkerScriptEngine *QDeclarativeEnginePrivate::getWorkerScriptEngine()
return QDeclarativeImageProvider::Invalid;
}
-QSGTexture *QDeclarativeEnginePrivate::getTextureFromProvider(const QUrl &url, QSize *size, const QSize& req_size)
+QDeclarativeTextureFactory *QDeclarativeEnginePrivate::getTextureFromProvider(const QUrl &url, QSize *size, const QSize& req_size)
{
QMutexLocker locker(&mutex);
QSharedPointer<QDeclarativeImageProvider> provider = imageProviders.value(url.host());
QString typeName = type ? type->qmlTypeName() : QString::fromUtf8(object->metaObject()->className());
QDeclarativeDebugTrace::rangeData(QDeclarativeDebugTrace::Creating, typeName);
if (data->outerContext)
- QDeclarativeDebugTrace::rangeLocation(QDeclarativeDebugTrace::Creating, data->outerContext->url, data->lineNumber);
+ QDeclarativeDebugTrace::rangeLocation(QDeclarativeDebugTrace::Creating, data->outerContext->url, data->lineNumber, data->columnNumber);
}
QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(data->context->engine);
void QDeclarativeEngine::setOfflineStoragePath(const QString& dir)
{
Q_D(QDeclarativeEngine);
- qt_qmlsqldatabase_setOfflineStoragePath(d->v8engine(), dir);
+ d->offlineStoragePath = dir;
}
QString QDeclarativeEngine::offlineStoragePath() const
{
Q_D(const QDeclarativeEngine);
- return qt_qmlsqldatabase_getOfflineStoragePath(d->v8engine());
+ return d->offlineStoragePath;
}
static void voidptr_destructor(void *v)
return rv;
} else {
QDeclarativePropertyCache *super = cache(mo->superClass());
- QDeclarativePropertyCache *rv = super->copy(mo->propertyCount() + mo->methodCount() -
- mo->superClass()->propertyCount() -
- mo->superClass()->methodCount());
- rv->append(q, mo);
+ QDeclarativePropertyCache *rv = super->copyAndAppend(q, mo);
propertyCache.insert(mo, rv);
return rv;
}
bool QDeclarative_isFileCaseCorrect(const QString &fileName)
{
-#if defined(Q_OS_MAC) || defined(Q_OS_WIN32)
+#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
QFileInfo info(fileName);
-
- QString absolute = info.absoluteFilePath();
+ const QString absolute = info.absoluteFilePath();
#if defined(Q_OS_MAC)
- QString canonical = info.canonicalFilePath();
-#elif defined(Q_OS_WIN32)
+ const QString canonical = info.canonicalFilePath();
+#elif defined(Q_OS_WIN)
wchar_t buffer[1024];
DWORD rv = ::GetShortPathName((wchar_t*)absolute.utf16(), buffer, 1024);
rv = ::GetLongPathName(buffer, buffer, 1024);
if (rv == 0 || rv >= 1024) return true;
- QString canonical((QChar *)buffer);
+ const QString canonical = QString::fromWCharArray(buffer);
#endif
- int absoluteLength = absolute.length();
- int canonicalLength = canonical.length();
+ const int absoluteLength = absolute.length();
+ const int canonicalLength = canonical.length();
- int length = qMin(absoluteLength, canonicalLength);
+ const int length = qMin(absoluteLength, canonicalLength);
for (int ii = 0; ii < length; ++ii) {
const QChar &a = absolute.at(absoluteLength - 1 - ii);
const QChar &c = canonical.at(canonicalLength - 1 - ii);