summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@nokia.com>2010-07-13 09:33:02 (GMT)
committerMartin Smith <martin.smith@nokia.com>2010-07-13 09:33:02 (GMT)
commite305732c0df93332a514a957b08e0ce283cb747f (patch)
tree603522227e5d4e9f2994408afd5d5523951ba648 /tools
parentc93c9bbfe94cd271aeda9e2730d343e3eee31ec5 (diff)
parenta296749eaea94ae4ed36086b632d32c87d3d99c9 (diff)
downloadQt-e305732c0df93332a514a957b08e0ce283cb747f.zip
Qt-e305732c0df93332a514a957b08e0ce283cb747f.tar.gz
Qt-e305732c0df93332a514a957b08e0ce283cb747f.tar.bz2
Fixing merge conflicts.
Merge branch '4.7-upstream' into 4.7 Conflicts: doc/src/declarative/advtutorial.qdoc src/declarative/graphicsitems/qdeclarativeloader.cpp src/declarative/graphicsitems/qdeclarativetextedit.cpp src/declarative/qml/qdeclarativeengine.cpp src/declarative/util/qdeclarativexmllistmodel.cpp
Diffstat (limited to 'tools')
-rw-r--r--tools/qdoc3/doc/files/qt.qdocconf10
-rw-r--r--tools/qdoc3/test/qdeclarative.qdocconf6
-rw-r--r--tools/qml/deviceorientation_symbian.cpp162
-rw-r--r--tools/qml/main.cpp21
-rw-r--r--tools/qml/qml.pri4
-rw-r--r--tools/qml/qml.pro3
-rw-r--r--tools/qml/qmlruntime.cpp164
-rw-r--r--tools/qml/qmlruntime.h4
8 files changed, 283 insertions, 91 deletions
diff --git a/tools/qdoc3/doc/files/qt.qdocconf b/tools/qdoc3/doc/files/qt.qdocconf
index 942d023..09c112a 100644
--- a/tools/qdoc3/doc/files/qt.qdocconf
+++ b/tools/qdoc3/doc/files/qt.qdocconf
@@ -8,7 +8,7 @@ project = Qt
versionsym =
version = %VERSION%
description = Qt Reference Documentation
-url = http://qt.nokia.com/doc/4.6
+url = http://qt.nokia.com/doc/4.7
edition.Console.modules = QtCore QtDBus QtNetwork QtScript QtSql QtXml \
QtXmlPatterns QtTest
@@ -22,7 +22,7 @@ edition.DesktopLight.groups = -graphicsview-api
qhp.projects = Qt
qhp.Qt.file = qt.qhp
-qhp.Qt.namespace = com.trolltech.qt.460
+qhp.Qt.namespace = com.trolltech.qt.470
qhp.Qt.virtualFolder = qdoc
qhp.Qt.indexTitle = Qt Reference Documentation
qhp.Qt.indexRoot =
@@ -36,9 +36,9 @@ qhp.Qt.extraFiles = classic.css \
images/dynamiclayouts-example.png \
images/stylesheet-coffee-plastique.png
-qhp.Qt.filterAttributes = qt 4.6.0 qtrefdoc
-qhp.Qt.customFilters.Qt.name = Qt 4.6.0
-qhp.Qt.customFilters.Qt.filterAttributes = qt 4.6.0
+qhp.Qt.filterAttributes = qt 4.7.0 qtrefdoc
+qhp.Qt.customFilters.Qt.name = Qt 4.7.0
+qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.0
qhp.Qt.subprojects = classes overviews examples
qhp.Qt.subprojects.classes.title = Classes
qhp.Qt.subprojects.classes.indexTitle = Qt's Classes
diff --git a/tools/qdoc3/test/qdeclarative.qdocconf b/tools/qdoc3/test/qdeclarative.qdocconf
index 0433c9f..facec5c 100644
--- a/tools/qdoc3/test/qdeclarative.qdocconf
+++ b/tools/qdoc3/test/qdeclarative.qdocconf
@@ -55,9 +55,9 @@ qhp.Qml.extraFiles = images/bg_l.png \
style/style_ie8.css \
style/style.css
-qhp.Qml.filterAttributes = qt 4.6.0 qtrefdoc
-qhp.Qml.customFilters.Qt.name = Qt 4.6.0
-qhp.Qml.customFilters.Qt.filterAttributes = qt 4.6.0
+qhp.Qml.filterAttributes = qt 4.7.0 qtrefdoc
+qhp.Qml.customFilters.Qt.name = Qt 4.7.0
+qhp.Qml.customFilters.Qt.filterAttributes = qt 4.7.0
qhp.Qml.subprojects = classes
qhp.Qml.subprojects.classes.title = Elements
qhp.Qml.subprojects.classes.indexTitle = Qml Elements
diff --git a/tools/qml/deviceorientation_symbian.cpp b/tools/qml/deviceorientation_symbian.cpp
new file mode 100644
index 0000000..c305f94
--- /dev/null
+++ b/tools/qml/deviceorientation_symbian.cpp
@@ -0,0 +1,162 @@
+/****************************************************************************
+**
+** 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 "deviceorientation.h"
+
+#include <e32base.h>
+#include <sensrvchannelfinder.h>
+#include <sensrvdatalistener.h>
+#include <sensrvchannel.h>
+#include <sensrvorientationsensor.h>
+
+class SymbianOrientation : public DeviceOrientation, public MSensrvDataListener
+{
+ Q_OBJECT
+public:
+ SymbianOrientation()
+ : DeviceOrientation(), m_current(UnknownOrientation), m_sensorChannel(0)
+ {
+ TRAP_IGNORE(initL());
+ if (!m_sensorChannel)
+ qWarning("No valid sensors found.");
+ }
+
+ ~SymbianOrientation()
+ {
+ if (m_sensorChannel) {
+ m_sensorChannel->StopDataListening();
+ m_sensorChannel->CloseChannel();
+ delete m_sensorChannel;
+ }
+ }
+
+ void initL()
+ {
+ CSensrvChannelFinder *channelFinder = CSensrvChannelFinder::NewLC();
+ RSensrvChannelInfoList channelInfoList;
+ CleanupClosePushL(channelInfoList);
+
+ TSensrvChannelInfo searchConditions;
+ searchConditions.iChannelType = KSensrvChannelTypeIdOrientationData;
+ channelFinder->FindChannelsL(channelInfoList, searchConditions);
+
+ for (int i = 0; i < channelInfoList.Count(); ++i) {
+ TRAPD(error, m_sensorChannel = CSensrvChannel::NewL(channelInfoList[i]));
+ if (!error)
+ TRAP(error, m_sensorChannel->OpenChannelL());
+ if (!error) {
+ TRAP(error, m_sensorChannel->StartDataListeningL(this, 1, 1, 0));
+ break;
+ }
+ if (error) {
+ delete m_sensorChannel;
+ m_sensorChannel = 0;
+ }
+ }
+
+ channelInfoList.Close();
+ CleanupStack::Pop(&channelInfoList);
+ CleanupStack::PopAndDestroy(channelFinder);
+ }
+
+ Orientation orientation() const
+ {
+ return m_current;
+ }
+
+ void setOrientation(Orientation) { }
+
+private:
+ DeviceOrientation::Orientation m_current;
+ CSensrvChannel *m_sensorChannel;
+
+ void DataReceived(CSensrvChannel &channel, TInt count, TInt dataLost)
+ {
+ if (channel.GetChannelInfo().iChannelType == KSensrvChannelTypeIdOrientationData) {
+ TSensrvOrientationData data;
+ for (int i = 0; i < count; ++i) {
+ TPckgBuf<TSensrvOrientationData> dataBuf;
+ channel.GetData(dataBuf);
+ data = dataBuf();
+ Orientation o = UnknownOrientation;
+ switch (data.iDeviceOrientation) {
+ case TSensrvOrientationData::EOrientationDisplayUp:
+ o = Portrait;
+ break;
+ case TSensrvOrientationData::EOrientationDisplayRightUp:
+ o = Landscape;
+ break;
+ case TSensrvOrientationData::EOrientationDisplayLeftUp:
+ case TSensrvOrientationData::EOrientationDisplayDown:
+ case TSensrvOrientationData::EOrientationUndefined:
+ case TSensrvOrientationData::EOrientationDisplayUpwards:
+ case TSensrvOrientationData::EOrientationDisplayDownwards:
+ default:
+ break;
+ }
+
+ if (m_current != o && o != UnknownOrientation) {
+ m_current = o;
+ emit orientationChanged();
+ }
+ }
+ }
+ }
+
+ void DataError(CSensrvChannel& /* channel */, TSensrvErrorSeverity /* error */)
+ {
+ }
+
+ void GetDataListenerInterfaceL(TUid /* interfaceUid */, TAny*& /* interface */)
+ {
+ }
+};
+
+
+DeviceOrientation* DeviceOrientation::instance()
+{
+ static SymbianOrientation *o = 0;
+ if (!o)
+ o = new SymbianOrientation;
+ return o;
+}
+
+#include "deviceorientation_symbian.moc"
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index 900a464..4b1162e 100644
--- a/tools/qml/main.cpp
+++ b/tools/qml/main.cpp
@@ -49,12 +49,15 @@
#include <QTranslator>
#include <QDebug>
#include <QMessageBox>
+#include <QAtomicInt>
#include "qdeclarativetester.h"
QT_USE_NAMESPACE
QtMsgHandler systemMsgOutput = 0;
+
+
#if defined (Q_OS_SYMBIAN)
#include <unistd.h>
#include <sys/types.h>
@@ -89,19 +92,25 @@ void showWarnings()
}
}
+static QAtomicInt recursiveLock(0);
+
void myMessageOutput(QtMsgType type, const char *msg)
{
- if (!logger.isNull()) {
- QString strMsg = QString::fromAscii(msg);
- QMetaObject::invokeMethod(logger.data(), "append", Q_ARG(QString, strMsg));
+ QString strMsg = QString::fromLatin1(msg);
+
+ if (!logger.isNull() && !QCoreApplication::closingDown()) {
+ if (recursiveLock.testAndSetOrdered(0, 1)) {
+ QMetaObject::invokeMethod(logger.data(), "append", Q_ARG(QString, strMsg));
+ recursiveLock = 0;
+ }
} else {
- warnings += msg;
+ warnings += strMsg;
warnings += QLatin1Char('\n');
}
if (systemMsgOutput) { // Windows
systemMsgOutput(type, msg);
} else { // Unix
- fprintf(stderr, "%s\n",msg);
+ fprintf(stderr, "%s\n", msg);
fflush(stderr);
}
}
@@ -200,6 +209,8 @@ int main(int argc, char ** argv)
app.setOrganizationName("Nokia");
app.setOrganizationDomain("nokia.com");
+
+
QDeclarativeViewer::registerTypes();
QDeclarativeTester::registerTypes();
diff --git a/tools/qml/qml.pri b/tools/qml/qml.pri
index 3e5a88b..fcd0c33 100644
--- a/tools/qml/qml.pri
+++ b/tools/qml/qml.pri
@@ -23,6 +23,10 @@ maemo5 {
SOURCES += $$PWD/deviceorientation_maemo5.cpp
FORMS = $$PWD/recopts_maemo5.ui \
$$PWD/proxysettings_maemo5.ui
+} symbian:!contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) {
+ SOURCES += $$PWD/deviceorientation_symbian.cpp
+ FORMS = $$PWD/recopts.ui \
+ $$PWD/proxysettings.ui
} else {
SOURCES += $$PWD/deviceorientation.cpp
FORMS = $$PWD/recopts.ui \
diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro
index 63efff1..bb69e8a 100644
--- a/tools/qml/qml.pro
+++ b/tools/qml/qml.pro
@@ -37,6 +37,9 @@ symbian {
include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
TARGET.EPOCHEAPSIZE = 0x20000 0x2000000
TARGET.CAPABILITY = NetworkServices ReadUserData
+ !contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) {
+ LIBS += -lsensrvclient -lsensrvutil
+ }
}
mac {
QMAKE_INFO_PLIST=Info_mac.plist
diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp
index debc902..951b187 100644
--- a/tools/qml/qmlruntime.cpp
+++ b/tools/qml/qmlruntime.cpp
@@ -431,65 +431,82 @@ private:
mutable QMutex mutex;
};
-class NetworkAccessManagerFactory : public QDeclarativeNetworkAccessManagerFactory
+class SystemProxyFactory : public QNetworkProxyFactory
{
public:
- NetworkAccessManagerFactory() : cacheSize(0) {}
- ~NetworkAccessManagerFactory() {}
-
- QNetworkAccessManager *create(QObject *parent);
+ SystemProxyFactory() : proxyDirty(true), httpProxyInUse(false) {
+ }
- void setupProxy(QNetworkAccessManager *nam)
+ virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query)
{
- class SystemProxyFactory : public QNetworkProxyFactory
- {
- public:
- virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query)
- {
- QString protocolTag = query.protocolTag();
- if (httpProxyInUse && (protocolTag == "http" || protocolTag == "https")) {
- QList<QNetworkProxy> ret;
- ret << httpProxy;
- return ret;
- }
+ if (proxyDirty)
+ setupProxy();
+ QString protocolTag = query.protocolTag();
+ if (httpProxyInUse && (protocolTag == "http" || protocolTag == "https")) {
+ QList<QNetworkProxy> ret;
+ ret << httpProxy;
+ return ret;
+ }
#ifdef Q_OS_WIN
- // systemProxyForQuery can take insanely long on Windows (QTBUG-10106)
- return QNetworkProxyFactory::proxyForQuery(query);
+ // systemProxyForQuery can take insanely long on Windows (QTBUG-10106)
+ return QNetworkProxyFactory::proxyForQuery(query);
#else
- return QNetworkProxyFactory::systemProxyForQuery(query);
+ return QNetworkProxyFactory::systemProxyForQuery(query);
#endif
- }
- void setHttpProxy (QNetworkProxy proxy)
- {
- httpProxy = proxy;
- httpProxyInUse = true;
- }
- void unsetHttpProxy ()
- {
- httpProxyInUse = false;
- }
- private:
- bool httpProxyInUse;
- QNetworkProxy httpProxy;
- };
-
- SystemProxyFactory *proxyFactory = new SystemProxyFactory;
- if (ProxySettings::httpProxyInUse())
- proxyFactory->setHttpProxy(ProxySettings::httpProxy());
- else
- proxyFactory->unsetHttpProxy();
- nam->setProxyFactory(proxyFactory);
}
+ void setupProxy() {
+ // Don't bother locking because we know that the proxy only
+ // changes in response to the settings dialog and that
+ // the view will be reloaded.
+ proxyDirty = false;
+ httpProxyInUse = ProxySettings::httpProxyInUse();
+ if (httpProxyInUse)
+ httpProxy = ProxySettings::httpProxy();
+ }
+
+ void proxyChanged() {
+ proxyDirty = true;
+ }
+
+private:
+ volatile bool proxyDirty;
+ bool httpProxyInUse;
+ QNetworkProxy httpProxy;
+};
+
+class NetworkAccessManagerFactory : public QObject, public QDeclarativeNetworkAccessManagerFactory
+{
+ Q_OBJECT
+public:
+ NetworkAccessManagerFactory() : cacheSize(0) {}
+ ~NetworkAccessManagerFactory() {}
+
+ QNetworkAccessManager *create(QObject *parent);
+
void setCacheSize(int size) {
if (size != cacheSize) {
cacheSize = size;
}
}
+ void proxyChanged() {
+ foreach (QNetworkAccessManager *nam, namList) {
+ static_cast<SystemProxyFactory*>(nam->proxyFactory())->proxyChanged();
+ }
+ }
+
static PersistentCookieJar *cookieJar;
+
+private slots:
+ void managerDestroyed(QObject *obj) {
+ namList.removeOne(static_cast<QNetworkAccessManager*>(obj));
+ }
+
+private:
QMutex mutex;
int cacheSize;
+ QList<QNetworkAccessManager*> namList;
};
PersistentCookieJar *NetworkAccessManagerFactory::cookieJar = 0;
@@ -510,7 +527,7 @@ QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent)
}
manager->setCookieJar(cookieJar);
cookieJar->setParent(0);
- setupProxy(manager);
+ manager->setProxyFactory(new SystemProxyFactory);
if (cacheSize > 0) {
QNetworkDiskCache *cache = new QNetworkDiskCache;
cache->setCacheDirectory(QDir::tempPath()+QLatin1String("/qml-viewer-network-cache"));
@@ -519,6 +536,8 @@ QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent)
} else {
manager->setCache(0);
}
+ connect(manager, SIGNAL(destroyed(QObject*)), this, SLOT(managerDestroyed(QObject*)));
+ namList.append(manager);
qDebug() << "created new network access manager for" << parent;
return manager;
}
@@ -777,6 +796,7 @@ void QDeclarativeViewer::showProxySettings()
void QDeclarativeViewer::proxySettingsChanged()
{
+ namFactory->proxyChanged();
reload ();
}
@@ -924,13 +944,7 @@ void QDeclarativeViewer::statusChanged()
if (canvas->status() == QDeclarativeView::Ready) {
initialSize = canvas->initialSize();
- if (canvas->resizeMode() == QDeclarativeView::SizeRootObjectToView) {
- if (!isFullScreen() && !isMaximized()) {
- canvas->setFixedSize(initialSize);
- resize(1, 1); // workaround for QMainWindowLayout NOT shrinking the window if the centralWidget() shrink
- QTimer::singleShot(0, this, SLOT(updateSizeHints()));
- }
- }
+ updateSizeHints(true);
}
}
@@ -1055,13 +1069,9 @@ void QDeclarativeViewer::setRecordRate(int fps)
record_rate = fps;
}
-void QDeclarativeViewer::sceneResized(QSize size)
+void QDeclarativeViewer::sceneResized(QSize)
{
- if (size.width() > 0 && size.height() > 0) {
- if (canvas->resizeMode() == QDeclarativeView::SizeViewToRootObject) {
- updateSizeHints();
- }
- }
+ updateSizeHints();
}
void QDeclarativeViewer::keyPressEvent(QKeyEvent *event)
@@ -1324,17 +1334,7 @@ void QDeclarativeViewer::changeOrientation(QAction *action)
void QDeclarativeViewer::orientationChanged()
{
- if (canvas->resizeMode() == QDeclarativeView::SizeRootObjectToView) {
- if (canvas->rootObject()) {
- QSizeF rootObjectSize = canvas->rootObject()->boundingRect().size();
- if (size() != rootObjectSize.toSize()) {
- canvas->setMinimumSize(rootObjectSize.toSize());
- canvas->resize(rootObjectSize.toSize());
- resize(rootObjectSize.toSize());
- resize(1, 1); // workaround for QMainWindowLayout NOT shrinking the window if the centralWidget() shrinks
- }
- }
- }
+ updateSizeHints();
}
void QDeclarativeViewer::setDeviceKeys(bool on)
@@ -1383,20 +1383,32 @@ void QDeclarativeViewer::setSizeToView(bool sizeToView)
}
}
-void QDeclarativeViewer::updateSizeHints()
+void QDeclarativeViewer::updateSizeHints(bool initial)
{
- if (canvas->resizeMode() == QDeclarativeView::SizeViewToRootObject) {
- QSize newWindowSize = canvas->sizeHint();
+ static bool isRecursive = false;
+
+ if (isRecursive)
+ return;
+ isRecursive = true;
+
+ if (initial || (canvas->resizeMode() == QDeclarativeView::SizeViewToRootObject)) {
+ QSize newWindowSize = initial ? initialSize : canvas->sizeHint();
+ //qWarning() << "USH:" << (initial ? "INIT:" : "V2R:") << "setting fixed size " << newWindowSize;
if (!isFullScreen() && !isMaximized()) {
- canvas->setMinimumSize(newWindowSize);
- canvas->resize(newWindowSize);
- resize(1, 1); // workaround for QMainWindowLayout NOT shrinking the window if the centralWidget() shrinks
- canvas->setMinimumSize(QSize(0, 0));
+ canvas->setFixedSize(newWindowSize);
+ resize(1, 1);
+ layout()->setSizeConstraint(QLayout::SetFixedSize);
+ layout()->activate();
}
- } else { // QDeclarativeView::SizeRootObjectToView
- canvas->setMinimumSize(QSize(0,0));
- canvas->setMaximumSize(QSize(16777215,16777215));
}
+ //qWarning() << "USH: R2V: setting free size ";
+ layout()->setSizeConstraint(QLayout::SetNoConstraint);
+ layout()->activate();
+ setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
+ canvas->setMinimumSize(QSize(0,0));
+ canvas->setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
+
+ isRecursive = false;
}
void QDeclarativeViewer::registerTypes()
diff --git a/tools/qml/qmlruntime.h b/tools/qml/qmlruntime.h
index e70e69f..68d3452 100644
--- a/tools/qml/qmlruntime.h
+++ b/tools/qml/qmlruntime.h
@@ -145,9 +145,9 @@ private slots:
void warningsWidgetOpened();
void warningsWidgetClosed();
- void updateSizeHints();
-
private:
+ void updateSizeHints(bool initial = false);
+
QString getVideoFileName();
LoggerWidget *loggerWindow;