summaryrefslogtreecommitdiffstats
path: root/tools/qml
diff options
context:
space:
mode:
Diffstat (limited to 'tools/qml')
-rw-r--r--tools/qml/qdeclarativefolderlistmodel.cpp2
-rw-r--r--tools/qml/qfxtester.cpp8
-rw-r--r--tools/qml/qmlruntime.cpp65
3 files changed, 45 insertions, 30 deletions
diff --git a/tools/qml/qdeclarativefolderlistmodel.cpp b/tools/qml/qdeclarativefolderlistmodel.cpp
index 58bf59b..d36033d 100644
--- a/tools/qml/qdeclarativefolderlistmodel.cpp
+++ b/tools/qml/qdeclarativefolderlistmodel.cpp
@@ -413,7 +413,7 @@ void QDeclarativeFolderListModel::setShowOnlyReadable(bool on)
void QDeclarativeFolderListModel::registerTypes()
{
- QML_REGISTER_TYPE(Qt,4,6,FolderListModel,QDeclarativeFolderListModel);
+ qmlRegisterType<QDeclarativeFolderListModel>("Qt",4,6,"FolderListModel");
}
QT_END_NAMESPACE
diff --git a/tools/qml/qfxtester.cpp b/tools/qml/qfxtester.cpp
index 638a3c9..28bbf5e 100644
--- a/tools/qml/qfxtester.cpp
+++ b/tools/qml/qfxtester.cpp
@@ -372,10 +372,10 @@ void QDeclarativeTester::updateCurrentTime(int msec)
void QDeclarativeTester::registerTypes()
{
- QML_REGISTER_TYPE(Qt.VisualTest, 4,6, VisualTest, QDeclarativeVisualTest);
- QML_REGISTER_TYPE(Qt.VisualTest, 4,6, Frame, QDeclarativeVisualTestFrame);
- QML_REGISTER_TYPE(Qt.VisualTest, 4,6, Mouse, QDeclarativeVisualTestMouse);
- QML_REGISTER_TYPE(Qt.VisualTest, 4,6, Key, QDeclarativeVisualTestKey);
+ qmlRegisterType<QDeclarativeVisualTest>("Qt.VisualTest", 4,6, "VisualTest");
+ qmlRegisterType<QDeclarativeVisualTestFrame>("Qt.VisualTest", 4,6, "Frame");
+ qmlRegisterType<QDeclarativeVisualTestMouse>("Qt.VisualTest", 4,6, "Mouse");
+ qmlRegisterType<QDeclarativeVisualTestKey>("Qt.VisualTest", 4,6, "Key");
}
QT_END_NAMESPACE
diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp
index 7da3f5a..6660947 100644
--- a/tools/qml/qmlruntime.cpp
+++ b/tools/qml/qmlruntime.cpp
@@ -351,30 +351,10 @@ private:
class NetworkAccessManagerFactory : public QDeclarativeNetworkAccessManagerFactory
{
public:
- NetworkAccessManagerFactory() : cookieJar(0), cacheSize(0) {}
- ~NetworkAccessManagerFactory() {
- delete cookieJar;
- }
+ NetworkAccessManagerFactory() : cacheSize(0) {}
+ ~NetworkAccessManagerFactory() {}
- QNetworkAccessManager *create(QObject *parent) {
- QMutexLocker lock(&mutex);
- QNetworkAccessManager *manager = new QNetworkAccessManager(parent);
- if (!cookieJar)
- cookieJar = new PersistentCookieJar(0);
- manager->setCookieJar(cookieJar);
- cookieJar->setParent(0);
- setupProxy(manager);
- if (cacheSize > 0) {
- QNetworkDiskCache *cache = new QNetworkDiskCache;
- cache->setCacheDirectory(QDir::tempPath()+QLatin1String("/qml-duiviewer-network-cache"));
- cache->setMaximumCacheSize(cacheSize);
- manager->setCache(cache);
- } else {
- manager->setCache(0);
- }
- qDebug() << "created new network access manager for" << parent;
- return manager;
- }
+ QNetworkAccessManager *create(QObject *parent);
void setupProxy(QNetworkAccessManager *nam)
{
@@ -419,11 +399,41 @@ public:
}
}
- PersistentCookieJar *cookieJar;
+ static PersistentCookieJar *cookieJar;
QMutex mutex;
int cacheSize;
};
+PersistentCookieJar *NetworkAccessManagerFactory::cookieJar = 0;
+
+static void cleanup_cookieJar()
+{
+ delete NetworkAccessManagerFactory::cookieJar;
+ NetworkAccessManagerFactory::cookieJar = 0;
+}
+
+QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent)
+{
+ QMutexLocker lock(&mutex);
+ QNetworkAccessManager *manager = new QNetworkAccessManager(parent);
+ if (!cookieJar) {
+ qAddPostRoutine(cleanup_cookieJar);
+ cookieJar = new PersistentCookieJar(0);
+ }
+ manager->setCookieJar(cookieJar);
+ cookieJar->setParent(0);
+ setupProxy(manager);
+ if (cacheSize > 0) {
+ QNetworkDiskCache *cache = new QNetworkDiskCache;
+ cache->setCacheDirectory(QDir::tempPath()+QLatin1String("/qml-duiviewer-network-cache"));
+ cache->setMaximumCacheSize(cacheSize);
+ manager->setCache(cache);
+ } else {
+ manager->setCache(0);
+ }
+ qDebug() << "created new network access manager for" << parent;
+ return manager;
+}
QString QDeclarativeViewer::getVideoFileName()
{
@@ -1444,10 +1454,15 @@ void QDeclarativeViewer::setUseGL(bool useGL)
#ifdef GL_SUPPORTED
if (useGL) {
QGLFormat format = QGLFormat::defaultFormat();
+#ifdef Q_WS_MAC
+ format.setSampleBuffers(true);
+#else
format.setSampleBuffers(false);
+#endif
QGLWidget *glWidget = new QGLWidget(format);
glWidget->setAutoFillBackground(false);
+
canvas->setViewport(glWidget);
}
#endif
@@ -1460,7 +1475,7 @@ void QDeclarativeViewer::setUseNativeFileBrowser(bool use)
void QDeclarativeViewer::registerTypes()
{
- QML_REGISTER_TYPE(QDeclarativeViewer, 1, 0, Screen, Screen);
+ qmlRegisterType<Screen>("QDeclarativeViewer", 1, 0, "Screen");
}
QT_END_NAMESPACE